FreeCalypso > hg > ice1-trau-tester
diff ater/main.c @ 16:4ffe22f5b4b5
ater: initial osmo_i460 framework
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 24 Jun 2024 07:19:38 +0000 |
parents | 98ae717734d6 |
children | 1e375472d5a5 |
line wrap: on
line diff
--- a/ater/main.c Mon Jun 24 04:01:38 2024 +0000 +++ b/ater/main.c Mon Jun 24 07:19:38 2024 +0000 @@ -11,19 +11,24 @@ #include <stdbool.h> #include <stdio.h> #include <stdlib.h> +#include <string.h> #include <unistd.h> #include <osmocom/core/talloc.h> #include <osmocom/core/select.h> #include <osmocom/core/application.h> #include <osmocom/e1d/proto_clnt.h> +#include <osmocom/isdn/i460_mux.h> #include "../libutil/open_ts.h" #include "../libutil/stdin_handler.h" #include "globals.h" +#include "submux.h" struct osmo_e1dp_client *g_client; int ts_fd; +struct osmo_i460_timeslot i460_ts; +struct ater_subslot subslots[ATER_SUBSLOTS]; static const char *e1d_socket_path = E1DP_DEFAULT_SOCKET; static const char *timeslot_spec; @@ -53,6 +58,27 @@ timeslot_spec = argv[optind]; } +static void register_subslots(void) +{ + int nr; + struct osmo_i460_schan_desc chd; + + memset(&chd, 0, sizeof chd); + chd.rate = OSMO_I460_RATE_16k; + chd.demux.num_bits = 320; + chd.demux.out_cb_bits = i460_rx_func; + + for (nr = 0; nr < ATER_SUBSLOTS; nr++) { + subslots[nr].nr = nr; + chd.demux.user_data = subslots + nr; + chd.mux.user_data = subslots + nr; + subslots[nr].schan = + osmo_i460_subchan_add(g_ctx, &i460_ts, &chd); + OSMO_ASSERT(subslots[nr].schan); + chd.bit_offset += 2; + } +} + int main(int argc, char **argv) { process_cmdline(argc, argv); @@ -68,6 +94,9 @@ } ts_fd = open_e1d_ts(g_client, timeslot_spec); + osmo_i460_ts_init(&i460_ts); + register_subslots(); + osmo_fd_setup(&ts_ofd, ts_fd, OSMO_FD_READ, ts_fd_cb, NULL, 0); OSMO_ASSERT(osmo_fd_register(&ts_ofd) == 0);