comparison abis/dl_frames.c @ 30:5dd30224b70a

abis: starting new program
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 13 Aug 2024 21:38:55 +0000
parents
children f0b026615f3b
comparison
equal deleted inserted replaced
29:1dda11905e85 30:5dd30224b70a
1 /*
2 * In this module we generate canned TRAU-DL frames for FR and EFR,
3 * which will later be transmitted on Abis when individual subslots
4 * come alive.
5 */
6
7 #include <stdint.h>
8 #include <stdbool.h>
9 #include <stdio.h>
10 #include <stdlib.h>
11 #include <string.h>
12
13 #include <osmocom/core/bits.h>
14 #include <osmocom/core/utils.h>
15 #include <osmocom/trau/trau_frame.h>
16 #include <osmocom/trau/trau_rtp.h>
17
18 #include "dl_frames.h"
19
20 ubit_t dl_frame_fr[DL_OUTPUT_BUFLEN];
21 ubit_t dl_frame_efr[DL_OUTPUT_BUFLEN];
22
23 static const uint8_t gsmfr_silence_frame[33] = {
24 0xDA, 0xA7, 0xAA, 0xA5, 0x1A,
25 0x50, 0x20, 0x38, 0xE4, 0x6D, 0xB9, 0x1B,
26 0x50, 0x20, 0x38, 0xE4, 0x6D, 0xB9, 0x1B,
27 0x50, 0x20, 0x38, 0xE4, 0x6D, 0xB9, 0x1B,
28 0x50, 0x20, 0x38, 0xE4, 0x6D, 0xB9, 0x1B,
29 };
30
31 static const uint8_t efr_dhf_rtp[31] = {
32 0xC0, 0x85, 0xEB, 0x49, 0x0F, 0xAA, 0xD6, 0x03,
33 0xE3, 0xA1, 0x86, 0x07, 0xB0, 0xC4, 0x2C, 0x08,
34 0x04, 0x80, 0x55, 0x80, 0x00, 0x00, 0x00, 0x00,
35 0x03, 0x6B, 0x00, 0x00, 0x00, 0x00, 0x00
36 };
37
38 static void gen_dl_fr(void)
39 {
40 struct osmo_trau_frame tf;
41 struct osmo_trau2rtp_state st;
42 int rc;
43
44 tf.dir = OSMO_TRAU_DIR_DL;
45 st.type = OSMO_TRAU16_FT_FR;
46 rc = osmo_rtp2trau(&tf, gsmfr_silence_frame, 33, &st);
47 OSMO_ASSERT(rc == 0);
48 rc = osmo_trau_frame_encode(dl_frame_fr, DL_OUTPUT_BUFLEN, &tf);
49 OSMO_ASSERT(rc == DL_OUTPUT_LEN);
50 }
51
52 static void gen_dl_efr(void)
53 {
54 struct osmo_trau_frame tf;
55 struct osmo_trau2rtp_state st;
56 int rc;
57
58 tf.dir = OSMO_TRAU_DIR_DL;
59 st.type = OSMO_TRAU16_FT_EFR;
60 rc = osmo_rtp2trau(&tf, efr_dhf_rtp, 31, &st);
61 OSMO_ASSERT(rc == 0);
62 rc = osmo_trau_frame_encode(dl_frame_efr, DL_OUTPUT_BUFLEN, &tf);
63 OSMO_ASSERT(rc == DL_OUTPUT_LEN);
64 }
65
66 void init_canned_dl_frames(void)
67 {
68 gen_dl_fr();
69 gen_dl_efr();
70 }