changeset 32:94f11dc0d474

abis: Rx osmo_trau_sync hooked in
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 13 Aug 2024 22:07:49 +0000
parents cd7448724d74
children 351bd801cdce
files abis/main.c abis/submux.h abis/subslot_rx.c
diffstat 3 files changed, 28 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/abis/main.c	Tue Aug 13 21:44:30 2024 +0000
+++ b/abis/main.c	Tue Aug 13 22:07:49 2024 +0000
@@ -20,6 +20,7 @@
 #include <osmocom/core/application.h>
 #include <osmocom/e1d/proto_clnt.h>
 #include <osmocom/isdn/i460_mux.h>
+#include <osmocom/trau/trau_sync.h>
 
 #include "../libutil/open_ts.h"
 #include "../libutil/stdin_handler.h"
@@ -81,6 +82,18 @@
 	}
 }
 
+static void setup_rx_sync(void)
+{
+	int nr;
+
+	for (nr = 0; nr < ABIS_SUBSLOTS; nr++) {
+		subslots[nr].sync = osmo_trau_sync_alloc(g_ctx, "TRAU-UL-sync",
+					sync_rx_func, OSMO_TRAU_SYNCP_16_FR_EFR,
+					subslots + nr);
+		OSMO_ASSERT(subslots[nr].sync);
+	}
+}
+
 int main(int argc, char **argv)
 {
 	process_cmdline(argc, argv);
@@ -98,6 +111,7 @@
 
 	osmo_i460_ts_init(&i460_ts);
 	register_subslots();
+	setup_rx_sync();
 	init_canned_dl_frames();
 
 	osmo_fd_setup(&ts_ofd, ts_fd, OSMO_FD_READ, ts_fd_cb, NULL, 0);
--- a/abis/submux.h	Tue Aug 13 21:44:30 2024 +0000
+++ b/abis/submux.h	Tue Aug 13 22:07:49 2024 +0000
@@ -9,6 +9,7 @@
 #include <stdbool.h>
 
 #include <osmocom/core/bits.h>
+#include <osmocom/core/fsm.h>
 #include <osmocom/isdn/i460_mux.h>
 
 #define	ABIS_SUBSLOTS	4
@@ -18,9 +19,11 @@
 	int nr;
 	bool is_active;
 	bool is_efr;
+	struct osmo_fsm_inst *sync;
 };
 
 extern struct abis_subslot subslots[ABIS_SUBSLOTS];
 
 void i460_rx_func(struct osmo_i460_subchan *schan, void *user_data,
 		  const ubit_t *bits, unsigned int num_bits);
+void sync_rx_func(void *user_data, const ubit_t *bits, unsigned int num_bits);
--- a/abis/subslot_rx.c	Tue Aug 13 21:44:30 2024 +0000
+++ b/abis/subslot_rx.c	Tue Aug 13 22:07:49 2024 +0000
@@ -10,6 +10,7 @@
 
 #include <osmocom/core/select.h>
 #include <osmocom/isdn/i460_mux.h>
+#include <osmocom/trau/trau_sync.h>
 
 #include "globals.h"
 #include "submux.h"
@@ -17,5 +18,14 @@
 void i460_rx_func(struct osmo_i460_subchan *schan, void *user_data,
 		  const ubit_t *bits, unsigned int num_bits)
 {
-	/* to be filled */
+	struct abis_subslot *ab = user_data;
+
+	osmo_trau_sync_rx_ubits(ab->sync, bits, num_bits);
 }
+
+void sync_rx_func(void *user_data, const ubit_t *bits, unsigned int num_bits)
+{
+	struct abis_subslot *ab = user_data;
+
+
+}