FreeCalypso > hg > ice1-trau-tester
comparison ater/tx_func.c @ 52:626180a15857 default tip
ater play-d144: emit E-data frames manually,
osmo_trau_frame_encode() is currently broken for this frame type
| author | Mychaela Falconia <falcon@freecalypso.org> |
|---|---|
| date | Wed, 25 Sep 2024 06:40:43 +0000 |
| parents | db39e8855f3d |
| children |
comparison
equal
deleted
inserted
replaced
| 51:db39e8855f3d | 52:626180a15857 |
|---|---|
| 135 fr->c_bits[5] = ir_16k; | 135 fr->c_bits[5] = ir_16k; |
| 136 memset(fr->c_bits + 6, 1, 9); | 136 memset(fr->c_bits + 6, 1, 9); |
| 137 memset(fr->d_bits, 1, 63 * 4); | 137 memset(fr->d_bits, 1, 63 * 4); |
| 138 } | 138 } |
| 139 | 139 |
| 140 static void d144_play_frame(struct ater_subslot *at, const uint8_t *filerec) | 140 static void d144_play_frame(ubit_t *out, const uint8_t *filerec) |
| 141 { | 141 { |
| 142 struct osmo_trau_frame *fr = &at->ul_frame; | 142 memset(out, 0, 16); |
| 143 struct msgb *msg; | 143 memset(out + 16, 1, 6); |
| 144 int len; | 144 out[22] = 0; |
| 145 | 145 memset(out + 23, 1, 7); |
| 146 msg = msgb_alloc_c(g_ctx, 320, "TRAU-UL-frame"); | 146 out[30] = (filerec[1] & 2) >> 1; |
| 147 if (!msg) | 147 out[31] = filerec[1] & 1; |
| 148 return; | 148 osmo_pbit2ubit(out + 32, filerec + 2, 288); |
| 149 fr->type = OSMO_TRAU16_FT_EDATA; | 149 } |
| 150 fr->dir = OSMO_TRAU_DIR_UL; | 150 |
| 151 fr->c_bits[5] = 0; | 151 static void d144_fill_frame(struct ater_subslot *at, ubit_t *out) |
| 152 memset(fr->c_bits + 6, 1, 7); | 152 { |
| 153 fr->m_bits[0] = (filerec[1] & 2) >> 1; | |
| 154 fr->m_bits[1] = filerec[1] & 1; | |
| 155 osmo_pbit2ubit(fr->d_bits, filerec + 2, 288); | |
| 156 len = osmo_trau_frame_encode(msg->tail, msgb_tailroom(msg), fr); | |
| 157 if (len <= 0) { | |
| 158 msgb_free(msg); | |
| 159 return; | |
| 160 } | |
| 161 msgb_put(msg, len); | |
| 162 osmo_i460_mux_enqueue(at->schan, msg); | |
| 163 } | |
| 164 | |
| 165 static void handle_d144(int nr) | |
| 166 { | |
| 167 struct ater_subslot *at = &subslots[nr]; | |
| 168 struct msgb *msg; | |
| 169 | |
| 170 if (at->play_buffer) { | 153 if (at->play_buffer) { |
| 171 d144_play_frame(at, at->play_buffer + at->play_buf_ptr * 38); | 154 d144_play_frame(out, at->play_buffer + at->play_buf_ptr * 38); |
| 172 at->play_buf_ptr++; | 155 at->play_buf_ptr++; |
| 173 if (at->play_buf_ptr < at->play_buf_total) | 156 if (at->play_buf_ptr < at->play_buf_total) |
| 174 return; | 157 return; |
| 175 free(at->play_buffer); | 158 free(at->play_buffer); |
| 176 at->play_buffer = NULL; | 159 at->play_buffer = NULL; |
| 177 printf("file play finished\n"); | 160 printf("file play finished\n"); |
| 178 return; | 161 return; |
| 179 } | 162 } |
| 163 memcpy(out, at->d144_edata ? d144_idle_edata : d144_sync_frame, 320); | |
| 164 } | |
| 165 | |
| 166 static void handle_d144(int nr) | |
| 167 { | |
| 168 struct ater_subslot *at = &subslots[nr]; | |
| 169 struct msgb *msg; | |
| 170 | |
| 180 msg = msgb_alloc_c(g_ctx, 320, "TRAU-UL-frame"); | 171 msg = msgb_alloc_c(g_ctx, 320, "TRAU-UL-frame"); |
| 181 if (!msg) | 172 if (!msg) |
| 182 return; | 173 return; |
| 183 memcpy(msg->tail, at->d144_edata ? d144_idle_edata : d144_sync_frame, | 174 d144_fill_frame(at, msg->tail); |
| 184 320); | |
| 185 msgb_put(msg, 320); | 175 msgb_put(msg, 320); |
| 186 osmo_i460_mux_enqueue(at->schan, msg); | 176 osmo_i460_mux_enqueue(at->schan, msg); |
| 187 } | 177 } |
| 188 | 178 |
| 189 static void handle_play(struct ater_subslot *at) | 179 static void handle_play(struct ater_subslot *at) |
