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