diff ater/activate.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
line wrap: on
line diff
--- a/ater/activate.c	Fri Sep 13 01:03:43 2024 +0000
+++ b/ater/activate.c	Tue Sep 24 05:59:28 2024 +0000
@@ -66,6 +66,7 @@
 	/* good to proceed now */
 	at->is_active = true;
 	at->is_data = false;
+	at->is_data_144 = false;
 	at->is_efr = is_efr;
 	init_trau_ul_frame(nr);
 	at->ul_frame.c_bits[16] = dtxd;
@@ -76,21 +77,26 @@
 void cmd_activate_csd(int argc, char **argv)
 {
 	int nr;
-	bool ir_16k, is_hr;
+	bool ir_16k, is_144, is_hr;
 	struct ater_subslot *at;
 
 	if (argc < 3 || argc > 4) {
-usage:		fprintf(stderr, "usage: %s 0|1|2|3 8|16 [hr]\n", argv[0]);
+usage:		fprintf(stderr, "usage: %s 0|1|2|3 8|16|14.4 [hr]\n", argv[0]);
 		return;
 	}
 	if (argv[1][0] < '0' || argv[1][0] > '3' || argv[1][1])
 		goto usage;
 	nr = argv[1][0] - '0';
-	if (!strcmp(argv[2], "8"))
+	if (!strcmp(argv[2], "8")) {
+		is_144 = false;
 		ir_16k = false;
-	else if (!strcmp(argv[2], "16"))
+	} else if (!strcmp(argv[2], "16")) {
+		is_144 = false;
 		ir_16k = true;
-	else
+	} else if (!strcmp(argv[2], "14.4")) {
+		is_144 = true;
+		ir_16k = true;
+	} else
 		goto usage;
 	if (argv[3]) {
 		if (strcmp(argv[3], "hr"))
@@ -98,6 +104,10 @@
 		is_hr = true;
 	} else
 		is_hr = false;
+	if (is_hr && (is_144 || ir_16k)) {
+		fprintf(stderr, "error: HR above 8 kbit/s is impossible\n");
+		return;
+	}
 
 	at = &subslots[nr];
 	if (at->is_active) {
@@ -108,7 +118,9 @@
 	/* good to proceed now */
 	at->is_active = true;
 	at->is_data = true;
+	at->is_data_144 = is_144;
 	at->is_hr_data = is_hr;
+	at->d144_edata = false;
 	init_trau_ul_frame_csd(nr, ir_16k);
 }