FreeCalypso > hg > ice1-trau-tester
changeset 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 | |
files | ater/tx_func.c |
diffstat | 1 files changed, 19 insertions(+), 29 deletions(-) [+] |
line wrap: on
line diff
--- a/ater/tx_func.c Wed Sep 25 05:53:38 2024 +0000 +++ b/ater/tx_func.c Wed Sep 25 06:40:43 2024 +0000 @@ -137,38 +137,21 @@ memset(fr->d_bits, 1, 63 * 4); } -static void d144_play_frame(struct ater_subslot *at, const uint8_t *filerec) +static void d144_play_frame(ubit_t *out, const uint8_t *filerec) { - struct osmo_trau_frame *fr = &at->ul_frame; - struct msgb *msg; - int len; - - msg = msgb_alloc_c(g_ctx, 320, "TRAU-UL-frame"); - if (!msg) - return; - fr->type = OSMO_TRAU16_FT_EDATA; - fr->dir = OSMO_TRAU_DIR_UL; - fr->c_bits[5] = 0; - memset(fr->c_bits + 6, 1, 7); - fr->m_bits[0] = (filerec[1] & 2) >> 1; - fr->m_bits[1] = filerec[1] & 1; - osmo_pbit2ubit(fr->d_bits, filerec + 2, 288); - len = osmo_trau_frame_encode(msg->tail, msgb_tailroom(msg), fr); - if (len <= 0) { - msgb_free(msg); - return; - } - msgb_put(msg, len); - osmo_i460_mux_enqueue(at->schan, msg); + memset(out, 0, 16); + memset(out + 16, 1, 6); + out[22] = 0; + memset(out + 23, 1, 7); + out[30] = (filerec[1] & 2) >> 1; + out[31] = filerec[1] & 1; + osmo_pbit2ubit(out + 32, filerec + 2, 288); } -static void handle_d144(int nr) +static void d144_fill_frame(struct ater_subslot *at, ubit_t *out) { - struct ater_subslot *at = &subslots[nr]; - struct msgb *msg; - if (at->play_buffer) { - d144_play_frame(at, at->play_buffer + at->play_buf_ptr * 38); + d144_play_frame(out, at->play_buffer + at->play_buf_ptr * 38); at->play_buf_ptr++; if (at->play_buf_ptr < at->play_buf_total) return; @@ -177,11 +160,18 @@ printf("file play finished\n"); return; } + memcpy(out, at->d144_edata ? d144_idle_edata : d144_sync_frame, 320); +} + +static void handle_d144(int nr) +{ + struct ater_subslot *at = &subslots[nr]; + struct msgb *msg; + msg = msgb_alloc_c(g_ctx, 320, "TRAU-UL-frame"); if (!msg) return; - memcpy(msg->tail, at->d144_edata ? d144_idle_edata : d144_sync_frame, - 320); + d144_fill_frame(at, msg->tail); msgb_put(msg, 320); osmo_i460_mux_enqueue(at->schan, msg); }