diff ater/d144.c @ 50:6ba4de500532

ater: implement edata switch for D144
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 24 Sep 2024 06:15:40 +0000
parents ater/dbits.c@40f781efdbe1
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ater/d144.c	Tue Sep 24 06:15:40 2024 +0000
@@ -0,0 +1,43 @@
+/*
+ * Here we implement commands for exercising D144 mode.
+ */
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <osmocom/core/select.h>
+
+#include "globals.h"
+#include "submux.h"
+
+void cmd_set_edata(int argc, char **argv)
+{
+	int nr;
+	struct ater_subslot *at;
+
+	if (argc != 3) {
+usage:		fprintf(stderr, "usage: %s 0|1|2|3 0|1\n", argv[0]);
+		return;
+	}
+	if (argv[1][0] < '0' || argv[1][0] > '3' || argv[1][1])
+		goto usage;
+	nr = argv[1][0] - '0';
+	at = &subslots[nr];
+	if (!at->is_active) {
+		fprintf(stderr, "error: subslot %d is not active\n", nr);
+		return;
+	}
+	if (!at->is_data_144) {
+		fprintf(stderr, "error: subslot %d is not in D144 mode\n", nr);
+		return;
+	}
+	if (!strcmp(argv[2], "0"))
+		at->d144_edata = 0;
+	else if (!strcmp(argv[2], "1"))
+		at->d144_edata = 1;
+	else
+		goto usage;
+}