FreeCalypso > hg > ice1-trau-tester
changeset 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 | 42373f9992cc |
files | ater/Makefile ater/globals.h ater/main.c ater/read_ts.c ater/submux.h ater/subslot_rx.c |
diffstat | 6 files changed, 84 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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}
--- 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;
--- 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);
--- 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 <unistd.h> #include <osmocom/core/select.h> +#include <osmocom/isdn/i460_mux.h> #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; }
--- /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 <stdint.h> +#include <stdbool.h> + +#include <osmocom/core/bits.h> +#include <osmocom/isdn/i460_mux.h> +#include <osmocom/trau/trau_frame.h> + +#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);
--- /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 <stdint.h> +#include <stdbool.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include <osmocom/core/select.h> +#include <osmocom/isdn/i460_mux.h> + +#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 */ +}