diff abis/tx_func.c @ 33:351bd801cdce

abis: should be complete now
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 13 Aug 2024 22:53:42 +0000
parents 5dd30224b70a
children
line wrap: on
line diff
--- a/abis/tx_func.c	Tue Aug 13 22:07:49 2024 +0000
+++ b/abis/tx_func.c	Tue Aug 13 22:53:42 2024 +0000
@@ -12,6 +12,7 @@
 #include <osmocom/core/msgb.h>
 #include <osmocom/core/select.h>
 #include <osmocom/isdn/i460_mux.h>
+#include <osmocom/trau/trau_frame.h>
 
 #include "globals.h"
 #include "submux.h"
@@ -20,16 +21,27 @@
 static void tx_service_subslot(int nr)
 {
 	struct abis_subslot *ab = &subslots[nr];
+	const uint8_t *srcbuf;
 	struct msgb *msg;
 	uint8_t *outbuf;
 
-	if (!ab->is_active)
+	if (!ab->got_sync)
 		return;
+	switch (ab->frame_type) {
+	case TRAU_FT_FR_UP:
+		srcbuf = dl_frame_fr;
+		break;
+	case TRAU_FT_EFR:
+		srcbuf = dl_frame_efr;
+		break;
+	default:
+		return;
+	}
 	msg = msgb_alloc_c(g_ctx, DL_OUTPUT_LEN, "TRAU-DL-frame");
 	if (!msg)
 		return;
 	outbuf = msgb_put(msg, DL_OUTPUT_LEN);
-	memcpy(outbuf, ab->is_efr ? dl_frame_efr : dl_frame_fr, DL_OUTPUT_LEN);
+	memcpy(outbuf, srcbuf, DL_OUTPUT_LEN);
 	osmo_i460_mux_enqueue(ab->schan, msg);
 }