diff ater/tx_func.c @ 49:40f781efdbe1

ater: beginning of D144 mode
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 24 Sep 2024 05:59:28 +0000
parents 13fffc41f989
children db39e8855f3d
line wrap: on
line diff
--- a/ater/tx_func.c	Fri Sep 13 01:03:43 2024 +0000
+++ b/ater/tx_func.c	Tue Sep 24 05:59:28 2024 +0000
@@ -18,6 +18,100 @@
 #include "submux.h"
 #include "out_frame.h"
 
+/*
+ * The following hard-coded frame is based on TS 48.060 section 5.3.1.
+ * 0-based octet numbers in the comments are as in the spec.
+ */
+static const ubit_t d144_sync_frame[320] = {
+	0, 0, 0, 0, 0, 0, 0, 0,		/* octet 0 */
+	0, 0, 0, 0, 0, 0, 0, 0,		/* octet 1 */
+	1, 1, 0, 1, 0, 0, 1, 1,		/* octet 2 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 3 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 4 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 5 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 6 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 7 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 8 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 9 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 10 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 11 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 12 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 13 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 14 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 15 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 16 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 17 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 18 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 19 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 20 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 21 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 22 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 23 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 24 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 25 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 26 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 27 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 28 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 29 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 30 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 31 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 32 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 33 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 34 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 35 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 36 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 37 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 38 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 39 */
+};
+
+/*
+ * The following hard-coded frame is based on TS 48.060 section 5.3.2.
+ * 0-based octet numbers in the comments are as in the spec.
+ */
+static const ubit_t d144_idle_edata[320] = {
+	0, 0, 0, 0, 0, 0, 0, 0,		/* octet 0 */
+	0, 0, 0, 0, 0, 0, 0, 0,		/* octet 1 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 2 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 3 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 4 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 5 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 6 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 7 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 8 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 9 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 10 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 11 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 12 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 13 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 14 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 15 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 16 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 17 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 18 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 19 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 20 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 21 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 22 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 23 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 24 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 25 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 26 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 27 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 28 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 29 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 30 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 31 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 32 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 33 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 34 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 35 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 36 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 37 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 38 */
+	1, 1, 1, 1, 1, 1, 1, 1,		/* octet 39 */
+};
+
 void init_trau_ul_frame(int nr)
 {
 	struct ater_subslot *at = &subslots[nr];
@@ -42,6 +136,20 @@
 	memset(fr->d_bits, 1, 63 * 4);
 }
 
+static void handle_d144(int nr)
+{
+	struct ater_subslot *at = &subslots[nr];
+	struct msgb *msg;
+
+	msg = msgb_alloc_c(g_ctx, 320, "TRAU-UL-frame");
+	if (!msg)
+		return;
+	memcpy(msg->tail, at->d144_edata ? d144_idle_edata : d144_sync_frame,
+		320);
+	msgb_put(msg, 320);
+	osmo_i460_mux_enqueue(at->schan, msg);
+}
+
 static void handle_play(struct ater_subslot *at)
 {
 	if (at->play_wait_align) {
@@ -68,6 +176,10 @@
 
 	if (!at->is_active)
 		return;
+	if (at->is_data_144) {
+		handle_d144(nr);
+		return;
+	}
 	if (at->play_buffer)
 		handle_play(at);
 	if (!at->is_data) {