FreeCalypso > hg > e1-fake-trau
comparison ft16/dl_frames.c @ 2:5c18cd38c8ad
ft16: import from ice1-trau-tester/abis
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 29 Aug 2024 13:07:16 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
1:e5527fc2050b | 2:5c18cd38c8ad |
---|---|
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 tf.dl_ta_usec = 0; | |
49 rc = osmo_trau_frame_encode(dl_frame_fr, DL_OUTPUT_BUFLEN, &tf); | |
50 OSMO_ASSERT(rc == DL_OUTPUT_LEN); | |
51 } | |
52 | |
53 static void gen_dl_efr(void) | |
54 { | |
55 struct osmo_trau_frame tf; | |
56 struct osmo_trau2rtp_state st; | |
57 int rc; | |
58 | |
59 tf.dir = OSMO_TRAU_DIR_DL; | |
60 st.type = OSMO_TRAU16_FT_EFR; | |
61 rc = osmo_rtp2trau(&tf, efr_dhf_rtp, 31, &st); | |
62 OSMO_ASSERT(rc == 0); | |
63 tf.dl_ta_usec = 0; | |
64 rc = osmo_trau_frame_encode(dl_frame_efr, DL_OUTPUT_BUFLEN, &tf); | |
65 OSMO_ASSERT(rc == DL_OUTPUT_LEN); | |
66 } | |
67 | |
68 void init_canned_dl_frames(void) | |
69 { | |
70 gen_dl_fr(); | |
71 gen_dl_efr(); | |
72 } |