# HG changeset patch # User Mychaela Falconia # Date 1719213578 0 # Node ID 4ffe22f5b4b57345855863dc9bb291ecd6bd8fbf # Parent 98ae717734d68afe1a915f7841bf935a81e61eab ater: initial osmo_i460 framework diff -r 98ae717734d6 -r 4ffe22f5b4b5 ater/Makefile --- a/ater/Makefile Mon Jun 24 04:01:38 2024 +0000 +++ b/ater/Makefile Mon Jun 24 07:19:38 2024 +0000 @@ -1,5 +1,5 @@ PROG= itt-ater-16 -OBJS= main.o read_ts.o record_ctrl.o user_cmd.o +OBJS= main.o read_ts.o record_ctrl.o subslot_rx.o user_cmd.o LIBUTIL=../libutil/libutil.a include ../config.defs @@ -9,7 +9,7 @@ all: ${PROG} -${OBJS}: globals.h +${OBJS}: globals.h submux.h ${PROG}: ${OBJS} ${LIBUTIL} ${CC} -o $@ ${OBJS} ${LIBUTIL} ${OSMO_LINK} diff -r 98ae717734d6 -r 4ffe22f5b4b5 ater/globals.h --- a/ater/globals.h Mon Jun 24 04:01:38 2024 +0000 +++ b/ater/globals.h Mon Jun 24 07:19:38 2024 +0000 @@ -4,6 +4,7 @@ extern struct osmo_e1dp_client *g_client; extern int ts_fd; +extern struct osmo_i460_timeslot i460_ts; extern uint8_t readbuf[160]; extern FILE *record_file; diff -r 98ae717734d6 -r 4ffe22f5b4b5 ater/main.c --- 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 #include #include +#include #include #include #include #include #include +#include #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); diff -r 98ae717734d6 -r 4ffe22f5b4b5 ater/read_ts.c --- a/ater/read_ts.c Mon Jun 24 04:01:38 2024 +0000 +++ b/ater/read_ts.c Mon Jun 24 07:19:38 2024 +0000 @@ -10,6 +10,7 @@ #include #include +#include #include "globals.h" @@ -29,6 +30,7 @@ } if (record_file) fwrite(readbuf, 1, 160, record_file); + osmo_i460_demux_in(&i460_ts, readbuf, 160); /* transmit_e1_ts(); */ return 0; } diff -r 98ae717734d6 -r 4ffe22f5b4b5 ater/submux.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ater/submux.h Mon Jun 24 07:19:38 2024 +0000 @@ -0,0 +1,29 @@ +/* + * The structures and functions defined in this header file deal with + * interfacing to the Submultiplexer part of Nokia's Transcoder and + * Submultiplexer. + */ + +#pragma once + +#include +#include + +#include +#include +#include + +#define ATER_SUBSLOTS 4 + +struct ater_subslot { + struct osmo_i460_subchan *schan; + int nr; + bool is_active; + bool is_efr; + struct osmo_trau_frame ul_frame; +}; + +extern struct ater_subslot subslots[ATER_SUBSLOTS]; + +void i460_rx_func(struct osmo_i460_subchan *schan, void *user_data, + const ubit_t *bits, unsigned int num_bits); diff -r 98ae717734d6 -r 4ffe22f5b4b5 ater/subslot_rx.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ater/subslot_rx.c Mon Jun 24 07:19:38 2024 +0000 @@ -0,0 +1,21 @@ +/* + * Here we are going to implement Ater subslot Rx. + */ + +#include +#include +#include +#include +#include + +#include +#include + +#include "globals.h" +#include "submux.h" + +void i460_rx_func(struct osmo_i460_subchan *schan, void *user_data, + const ubit_t *bits, unsigned int num_bits) +{ + /* to be filled */ +}