comparison ater/tx_func.c @ 49:40f781efdbe1

ater: beginning of D144 mode
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 24 Sep 2024 05:59:28 +0000
parents 13fffc41f989
children db39e8855f3d
comparison
equal deleted inserted replaced
48:3cc26391d24d 49:40f781efdbe1
16 16
17 #include "globals.h" 17 #include "globals.h"
18 #include "submux.h" 18 #include "submux.h"
19 #include "out_frame.h" 19 #include "out_frame.h"
20 20
21 /*
22 * The following hard-coded frame is based on TS 48.060 section 5.3.1.
23 * 0-based octet numbers in the comments are as in the spec.
24 */
25 static const ubit_t d144_sync_frame[320] = {
26 0, 0, 0, 0, 0, 0, 0, 0, /* octet 0 */
27 0, 0, 0, 0, 0, 0, 0, 0, /* octet 1 */
28 1, 1, 0, 1, 0, 0, 1, 1, /* octet 2 */
29 1, 1, 1, 1, 1, 1, 1, 1, /* octet 3 */
30 1, 1, 1, 1, 1, 1, 1, 1, /* octet 4 */
31 1, 1, 1, 1, 1, 1, 1, 1, /* octet 5 */
32 1, 1, 1, 1, 1, 1, 1, 1, /* octet 6 */
33 1, 1, 1, 1, 1, 1, 1, 1, /* octet 7 */
34 1, 1, 1, 1, 1, 1, 1, 1, /* octet 8 */
35 1, 1, 1, 1, 1, 1, 1, 1, /* octet 9 */
36 1, 1, 1, 1, 1, 1, 1, 1, /* octet 10 */
37 1, 1, 1, 1, 1, 1, 1, 1, /* octet 11 */
38 1, 1, 1, 1, 1, 1, 1, 1, /* octet 12 */
39 1, 1, 1, 1, 1, 1, 1, 1, /* octet 13 */
40 1, 1, 1, 1, 1, 1, 1, 1, /* octet 14 */
41 1, 1, 1, 1, 1, 1, 1, 1, /* octet 15 */
42 1, 1, 1, 1, 1, 1, 1, 1, /* octet 16 */
43 1, 1, 1, 1, 1, 1, 1, 1, /* octet 17 */
44 1, 1, 1, 1, 1, 1, 1, 1, /* octet 18 */
45 1, 1, 1, 1, 1, 1, 1, 1, /* octet 19 */
46 1, 1, 1, 1, 1, 1, 1, 1, /* octet 20 */
47 1, 1, 1, 1, 1, 1, 1, 1, /* octet 21 */
48 1, 1, 1, 1, 1, 1, 1, 1, /* octet 22 */
49 1, 1, 1, 1, 1, 1, 1, 1, /* octet 23 */
50 1, 1, 1, 1, 1, 1, 1, 1, /* octet 24 */
51 1, 1, 1, 1, 1, 1, 1, 1, /* octet 25 */
52 1, 1, 1, 1, 1, 1, 1, 1, /* octet 26 */
53 1, 1, 1, 1, 1, 1, 1, 1, /* octet 27 */
54 1, 1, 1, 1, 1, 1, 1, 1, /* octet 28 */
55 1, 1, 1, 1, 1, 1, 1, 1, /* octet 29 */
56 1, 1, 1, 1, 1, 1, 1, 1, /* octet 30 */
57 1, 1, 1, 1, 1, 1, 1, 1, /* octet 31 */
58 1, 1, 1, 1, 1, 1, 1, 1, /* octet 32 */
59 1, 1, 1, 1, 1, 1, 1, 1, /* octet 33 */
60 1, 1, 1, 1, 1, 1, 1, 1, /* octet 34 */
61 1, 1, 1, 1, 1, 1, 1, 1, /* octet 35 */
62 1, 1, 1, 1, 1, 1, 1, 1, /* octet 36 */
63 1, 1, 1, 1, 1, 1, 1, 1, /* octet 37 */
64 1, 1, 1, 1, 1, 1, 1, 1, /* octet 38 */
65 1, 1, 1, 1, 1, 1, 1, 1, /* octet 39 */
66 };
67
68 /*
69 * The following hard-coded frame is based on TS 48.060 section 5.3.2.
70 * 0-based octet numbers in the comments are as in the spec.
71 */
72 static const ubit_t d144_idle_edata[320] = {
73 0, 0, 0, 0, 0, 0, 0, 0, /* octet 0 */
74 0, 0, 0, 0, 0, 0, 0, 0, /* octet 1 */
75 1, 1, 1, 1, 1, 1, 1, 1, /* octet 2 */
76 1, 1, 1, 1, 1, 1, 1, 1, /* octet 3 */
77 1, 1, 1, 1, 1, 1, 1, 1, /* octet 4 */
78 1, 1, 1, 1, 1, 1, 1, 1, /* octet 5 */
79 1, 1, 1, 1, 1, 1, 1, 1, /* octet 6 */
80 1, 1, 1, 1, 1, 1, 1, 1, /* octet 7 */
81 1, 1, 1, 1, 1, 1, 1, 1, /* octet 8 */
82 1, 1, 1, 1, 1, 1, 1, 1, /* octet 9 */
83 1, 1, 1, 1, 1, 1, 1, 1, /* octet 10 */
84 1, 1, 1, 1, 1, 1, 1, 1, /* octet 11 */
85 1, 1, 1, 1, 1, 1, 1, 1, /* octet 12 */
86 1, 1, 1, 1, 1, 1, 1, 1, /* octet 13 */
87 1, 1, 1, 1, 1, 1, 1, 1, /* octet 14 */
88 1, 1, 1, 1, 1, 1, 1, 1, /* octet 15 */
89 1, 1, 1, 1, 1, 1, 1, 1, /* octet 16 */
90 1, 1, 1, 1, 1, 1, 1, 1, /* octet 17 */
91 1, 1, 1, 1, 1, 1, 1, 1, /* octet 18 */
92 1, 1, 1, 1, 1, 1, 1, 1, /* octet 19 */
93 1, 1, 1, 1, 1, 1, 1, 1, /* octet 20 */
94 1, 1, 1, 1, 1, 1, 1, 1, /* octet 21 */
95 1, 1, 1, 1, 1, 1, 1, 1, /* octet 22 */
96 1, 1, 1, 1, 1, 1, 1, 1, /* octet 23 */
97 1, 1, 1, 1, 1, 1, 1, 1, /* octet 24 */
98 1, 1, 1, 1, 1, 1, 1, 1, /* octet 25 */
99 1, 1, 1, 1, 1, 1, 1, 1, /* octet 26 */
100 1, 1, 1, 1, 1, 1, 1, 1, /* octet 27 */
101 1, 1, 1, 1, 1, 1, 1, 1, /* octet 28 */
102 1, 1, 1, 1, 1, 1, 1, 1, /* octet 29 */
103 1, 1, 1, 1, 1, 1, 1, 1, /* octet 30 */
104 1, 1, 1, 1, 1, 1, 1, 1, /* octet 31 */
105 1, 1, 1, 1, 1, 1, 1, 1, /* octet 32 */
106 1, 1, 1, 1, 1, 1, 1, 1, /* octet 33 */
107 1, 1, 1, 1, 1, 1, 1, 1, /* octet 34 */
108 1, 1, 1, 1, 1, 1, 1, 1, /* octet 35 */
109 1, 1, 1, 1, 1, 1, 1, 1, /* octet 36 */
110 1, 1, 1, 1, 1, 1, 1, 1, /* octet 37 */
111 1, 1, 1, 1, 1, 1, 1, 1, /* octet 38 */
112 1, 1, 1, 1, 1, 1, 1, 1, /* octet 39 */
113 };
114
21 void init_trau_ul_frame(int nr) 115 void init_trau_ul_frame(int nr)
22 { 116 {
23 struct ater_subslot *at = &subslots[nr]; 117 struct ater_subslot *at = &subslots[nr];
24 struct osmo_trau_frame *fr = &at->ul_frame; 118 struct osmo_trau_frame *fr = &at->ul_frame;
25 119
40 fr->c_bits[5] = ir_16k; 134 fr->c_bits[5] = ir_16k;
41 memset(fr->c_bits + 6, 1, 9); 135 memset(fr->c_bits + 6, 1, 9);
42 memset(fr->d_bits, 1, 63 * 4); 136 memset(fr->d_bits, 1, 63 * 4);
43 } 137 }
44 138
139 static void handle_d144(int nr)
140 {
141 struct ater_subslot *at = &subslots[nr];
142 struct msgb *msg;
143
144 msg = msgb_alloc_c(g_ctx, 320, "TRAU-UL-frame");
145 if (!msg)
146 return;
147 memcpy(msg->tail, at->d144_edata ? d144_idle_edata : d144_sync_frame,
148 320);
149 msgb_put(msg, 320);
150 osmo_i460_mux_enqueue(at->schan, msg);
151 }
152
45 static void handle_play(struct ater_subslot *at) 153 static void handle_play(struct ater_subslot *at)
46 { 154 {
47 if (at->play_wait_align) { 155 if (at->play_wait_align) {
48 if (at->mfrm_count) 156 if (at->mfrm_count)
49 return; 157 return;
66 struct msgb *msg; 174 struct msgb *msg;
67 int len; 175 int len;
68 176
69 if (!at->is_active) 177 if (!at->is_active)
70 return; 178 return;
179 if (at->is_data_144) {
180 handle_d144(nr);
181 return;
182 }
71 if (at->play_buffer) 183 if (at->play_buffer)
72 handle_play(at); 184 handle_play(at);
73 if (!at->is_data) { 185 if (!at->is_data) {
74 at->mfrm_count++; 186 at->mfrm_count++;
75 if (at->mfrm_count >= 24) { 187 if (at->mfrm_count >= 24) {