annotate abis/dl_frames.c @ 31:cd7448724d74

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