# HG changeset patch # User Mychaela Falconia # Date 1726131710 0 # Node ID 16715bd149e001e491ac2b041c4c95ad478b088c # Parent 55f02d4aee79421726250ce1909a53ef967cd5ea ater: add support for data mode diff -r 55f02d4aee79 -r 16715bd149e0 ater/activate.c --- a/ater/activate.c Fri Aug 30 19:04:57 2024 +0000 +++ b/ater/activate.c Thu Sep 12 09:01:50 2024 +0000 @@ -65,6 +65,7 @@ /* good to proceed now */ at->is_active = true; + at->is_data = false; at->is_efr = is_efr; init_trau_ul_frame(nr); at->ul_frame.c_bits[16] = dtxd; @@ -72,6 +73,38 @@ free(init_frame); } +void cmd_activate_csd(int argc, char **argv) +{ + int nr; + bool ir_16k; + struct ater_subslot *at; + + if (argc != 3) { +usage: fprintf(stderr, "usage: %s 0|1|2|3 8|16\n", argv[0]); + return; + } + if (argv[1][0] < '0' || argv[1][0] > '3' || argv[1][1]) + goto usage; + nr = argv[1][0] - '0'; + if (!strcmp(argv[2], "8")) + ir_16k = false; + else if (!strcmp(argv[2], "16")) + ir_16k = true; + else + goto usage; + + at = &subslots[nr]; + if (at->is_active) { + fprintf(stderr, "error: subslot %d is already active\n", nr); + return; + } + + /* good to proceed now */ + at->is_active = true; + at->is_data = true; + init_trau_ul_frame_csd(nr, ir_16k); +} + void cmd_deact(int argc, char **argv) { int nr; diff -r 55f02d4aee79 -r 16715bd149e0 ater/globals.h --- a/ater/globals.h Fri Aug 30 19:04:57 2024 +0000 +++ b/ater/globals.h Thu Sep 12 09:01:50 2024 +0000 @@ -17,6 +17,7 @@ void cmd_record_stop(int argc, char **argv); void cmd_print_rx(int argc, char **argv); void cmd_activate(int argc, char **argv); +void cmd_activate_csd(int argc, char **argv); void cmd_deact(int argc, char **argv); void cmd_play_file(int argc, char **argv); void cmd_play_stop(int argc, char **argv); diff -r 55f02d4aee79 -r 16715bd149e0 ater/play_cmd.c --- a/ater/play_cmd.c Fri Aug 30 19:04:57 2024 +0000 +++ b/ater/play_cmd.c Thu Sep 12 09:01:50 2024 +0000 @@ -31,6 +31,10 @@ fprintf(stderr, "error: subslot %d is not active\n", nr); return; } + if (at->is_data) { + fprintf(stderr, "error: subslot %d is in data mode\n", nr); + return; + } if (at->play_buffer) { fprintf(stderr, "error: file play already in progress\n"); return; diff -r 55f02d4aee79 -r 16715bd149e0 ater/submux.h --- a/ater/submux.h Fri Aug 30 19:04:57 2024 +0000 +++ b/ater/submux.h Thu Sep 12 09:01:50 2024 +0000 @@ -19,6 +19,7 @@ struct osmo_i460_subchan *schan; int nr; bool is_active; + bool is_data; bool is_efr; struct osmo_trau_frame ul_frame; unsigned mfrm_count; @@ -34,3 +35,4 @@ const ubit_t *bits, unsigned int num_bits); void init_trau_ul_frame(int nr); +void init_trau_ul_frame_csd(int nr, bool ir_16k); diff -r 55f02d4aee79 -r 16715bd149e0 ater/tx_func.c --- a/ater/tx_func.c Fri Aug 30 19:04:57 2024 +0000 +++ b/ater/tx_func.c Thu Sep 12 09:01:50 2024 +0000 @@ -30,6 +30,18 @@ memset(fr->t_bits, 1, 4); } +void init_trau_ul_frame_csd(int nr, bool ir_16k) +{ + struct ater_subslot *at = &subslots[nr]; + struct osmo_trau_frame *fr = &at->ul_frame; + + fr->type = OSMO_TRAU16_FT_DATA; + fr->dir = OSMO_TRAU_DIR_UL; + fr->c_bits[5] = ir_16k; + memset(fr->c_bits + 6, 1, 9); + memset(fr->d_bits, 1, 63 * 4); +} + static void handle_play(struct ater_subslot *at) { if (at->play_wait_align) { @@ -58,12 +70,14 @@ return; if (at->play_buffer) handle_play(at); - at->mfrm_count++; - if (at->mfrm_count >= 24) { - at->mfrm_count = 0; - fr->c_bits[14] = 1; - } else { - fr->c_bits[14] = 0; + if (!at->is_data) { + at->mfrm_count++; + if (at->mfrm_count >= 24) { + at->mfrm_count = 0; + fr->c_bits[14] = 1; + } else { + fr->c_bits[14] = 0; + } } msg = msgb_alloc_c(g_ctx, 640, "TRAU-UL-frame"); if (!msg) diff -r 55f02d4aee79 -r 16715bd149e0 ater/user_cmd.c --- a/ater/user_cmd.c Fri Aug 30 19:04:57 2024 +0000 +++ b/ater/user_cmd.c Thu Sep 12 09:01:50 2024 +0000 @@ -18,6 +18,7 @@ void (*func)(int argc, char **argv); } cmdtab[] = { {"activ", cmd_activate}, + {"activ-d", cmd_activate_csd}, {"deact", cmd_deact}, {"play", cmd_play_file}, {"play-stop", cmd_play_stop},