comparison ater8/tx_func.c @ 48:3cc26391d24d

ater8: add support for data mode
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 13 Sep 2024 01:03:43 +0000
parents ff94d7fc5891
children
comparison
equal deleted inserted replaced
47:13fffc41f989 48:3cc26391d24d
16 #include <osmocom/trau/trau_frame.h> 16 #include <osmocom/trau/trau_frame.h>
17 17
18 #include "globals.h" 18 #include "globals.h"
19 #include "submux.h" 19 #include "submux.h"
20 #include "out_frame.h" 20 #include "out_frame.h"
21
22 /*
23 * The following hard-coded frame is based on TS 48.061 section 5.2.2.
24 * 1-based octet numbers in the comments are as in the spec.
25 */
26 static const ubit_t idle_data_frame[160] = {
27 0, 0, 0, 0, 0, 0, 0, 0, /* octet 1 */
28 1, 0, 0, 1, 1, 1, 1, 1, /* octet 2 */
29 0, 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 };
21 48
22 void init_trau_ul_frame(int nr) 49 void init_trau_ul_frame(int nr)
23 { 50 {
24 struct ater_subslot *at = &subslots[nr]; 51 struct ater_subslot *at = &subslots[nr];
25 struct osmo_trau_frame *fr = &at->ul_frame; 52 struct osmo_trau_frame *fr = &at->ul_frame;
63 return 0; 90 return 0;
64 else 91 else
65 return 1; 92 return 1;
66 } 93 }
67 94
95 static void send_idle_data(int nr)
96 {
97 struct ater_subslot *at = &subslots[nr];
98 struct msgb *msg;
99
100 msg = msgb_alloc_c(g_ctx, 160, "TRAU-UL-frame");
101 if (!msg)
102 return;
103 memcpy(msg->tail, idle_data_frame, 160);
104 msgb_put(msg, 160);
105 osmo_i460_mux_enqueue(at->schan, msg);
106 }
107
68 static void tx_service_subslot(int nr) 108 static void tx_service_subslot(int nr)
69 { 109 {
70 struct ater_subslot *at = &subslots[nr]; 110 struct ater_subslot *at = &subslots[nr];
71 struct osmo_trau_frame *fr = &at->ul_frame; 111 struct osmo_trau_frame *fr = &at->ul_frame;
72 ubit_t taf; 112 ubit_t taf;
73 struct msgb *msg; 113 struct msgb *msg;
74 int len; 114 int len;
75 115
76 if (!at->is_active) 116 if (!at->is_active)
77 return; 117 return;
118 if (at->is_data) {
119 send_idle_data(nr);
120 return;
121 }
78 if (at->play_buffer) 122 if (at->play_buffer)
79 handle_play(at); 123 handle_play(at);
80 at->mfrm_count++; 124 at->mfrm_count++;
81 if (at->mfrm_count >= 12) { 125 if (at->mfrm_count >= 12) {
82 at->mfrm_count = 0; 126 at->mfrm_count = 0;