# HG changeset patch # User Mychaela Falconia # Date 1726189423 0 # Node ID 3cc26391d24dabee5d5a70331b9e9bdaf202a478 # Parent 13fffc41f989a08dea35ec9dc4e28112db0acb8f ater8: add support for data mode diff -r 13fffc41f989 -r 3cc26391d24d ater8/activate.c --- a/ater8/activate.c Thu Sep 12 23:37:47 2024 +0000 +++ b/ater8/activate.c Fri Sep 13 01:03:43 2024 +0000 @@ -58,12 +58,37 @@ /* good to proceed now */ at->is_active = true; + at->is_data = false; init_trau_ul_frame(nr); at->ul_frame.c_bits[8] = dtxd; trau_frame_from_record(init_frame, &at->ul_frame, &at->frame_has_taf); free(init_frame); } +void cmd_activate_csd(int argc, char **argv) +{ + int nr; + struct ater_subslot *at; + + if (argc != 2) { +usage: fprintf(stderr, "usage: %s 0-7\n", argv[0]); + return; + } + if (argv[1][0] < '0' || argv[1][0] > '7' || argv[1][1]) + goto usage; + nr = argv[1][0] - '0'; + + 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; +} + void cmd_deact(int argc, char **argv) { int nr; diff -r 13fffc41f989 -r 3cc26391d24d ater8/globals.h --- a/ater8/globals.h Thu Sep 12 23:37:47 2024 +0000 +++ b/ater8/globals.h Fri Sep 13 01:03:43 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 13fffc41f989 -r 3cc26391d24d ater8/play_cmd.c --- a/ater8/play_cmd.c Thu Sep 12 23:37:47 2024 +0000 +++ b/ater8/play_cmd.c Fri Sep 13 01:03:43 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 13fffc41f989 -r 3cc26391d24d ater8/submux.h --- a/ater8/submux.h Thu Sep 12 23:37:47 2024 +0000 +++ b/ater8/submux.h Fri Sep 13 01:03:43 2024 +0000 @@ -19,6 +19,7 @@ struct osmo_i460_subchan *schan; int nr; bool is_active; + bool is_data; bool frame_has_taf; struct osmo_trau_frame ul_frame; unsigned mfrm_count; diff -r 13fffc41f989 -r 3cc26391d24d ater8/tx_func.c --- a/ater8/tx_func.c Thu Sep 12 23:37:47 2024 +0000 +++ b/ater8/tx_func.c Fri Sep 13 01:03:43 2024 +0000 @@ -19,6 +19,33 @@ #include "submux.h" #include "out_frame.h" +/* + * The following hard-coded frame is based on TS 48.061 section 5.2.2. + * 1-based octet numbers in the comments are as in the spec. + */ +static const ubit_t idle_data_frame[160] = { + 0, 0, 0, 0, 0, 0, 0, 0, /* octet 1 */ + 1, 0, 0, 1, 1, 1, 1, 1, /* octet 2 */ + 0, 1, 1, 1, 1, 1, 1, 1, /* octet 3 */ + 1, 1, 1, 1, 1, 1, 1, 1, /* octet 4 */ + 1, 1, 1, 1, 1, 1, 1, 1, /* octet 5 */ + 1, 1, 1, 1, 1, 1, 1, 1, /* octet 6 */ + 1, 1, 1, 1, 1, 1, 1, 1, /* octet 7 */ + 1, 1, 1, 1, 1, 1, 1, 1, /* octet 8 */ + 1, 1, 1, 1, 1, 1, 1, 1, /* octet 9 */ + 1, 1, 1, 1, 1, 1, 1, 1, /* octet 10 */ + 1, 1, 1, 1, 1, 1, 1, 1, /* octet 11 */ + 1, 1, 1, 1, 1, 1, 1, 1, /* octet 12 */ + 1, 1, 1, 1, 1, 1, 1, 1, /* octet 13 */ + 1, 1, 1, 1, 1, 1, 1, 1, /* octet 14 */ + 1, 1, 1, 1, 1, 1, 1, 1, /* octet 15 */ + 1, 1, 1, 1, 1, 1, 1, 1, /* octet 16 */ + 1, 1, 1, 1, 1, 1, 1, 1, /* octet 17 */ + 1, 1, 1, 1, 1, 1, 1, 1, /* octet 18 */ + 1, 1, 1, 1, 1, 1, 1, 1, /* octet 19 */ + 1, 1, 1, 1, 1, 1, 1, 1, /* octet 20 */ +}; + void init_trau_ul_frame(int nr) { struct ater_subslot *at = &subslots[nr]; @@ -65,6 +92,19 @@ return 1; } +static void send_idle_data(int nr) +{ + struct ater_subslot *at = &subslots[nr]; + struct msgb *msg; + + msg = msgb_alloc_c(g_ctx, 160, "TRAU-UL-frame"); + if (!msg) + return; + memcpy(msg->tail, idle_data_frame, 160); + msgb_put(msg, 160); + osmo_i460_mux_enqueue(at->schan, msg); +} + static void tx_service_subslot(int nr) { struct ater_subslot *at = &subslots[nr]; @@ -75,6 +115,10 @@ if (!at->is_active) return; + if (at->is_data) { + send_idle_data(nr); + return; + } if (at->play_buffer) handle_play(at); at->mfrm_count++; diff -r 13fffc41f989 -r 3cc26391d24d ater8/user_cmd.c --- a/ater8/user_cmd.c Thu Sep 12 23:37:47 2024 +0000 +++ b/ater8/user_cmd.c Fri Sep 13 01:03:43 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},