diff trau-decode/parse-main.c @ 38:d7674c80426c

trau-parse: add decoding of data frames
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 12 Sep 2024 19:50:29 +0000
parents 4d1732e4a143
children 95acde708ce2
line wrap: on
line diff
--- a/trau-decode/parse-main.c	Tue Sep 03 21:20:47 2024 +0000
+++ b/trau-decode/parse-main.c	Thu Sep 12 19:50:29 2024 +0000
@@ -83,6 +83,29 @@
 }
 
 static void
+print_data_subframe(nf, bits)
+	uint8_t *bits;
+{
+	unsigned nb;
+
+	printf("  Data frame %d:", nf);
+	for (nb = 0; nb < 9; nb++) {
+		printf(" %02X", bits_to_num(bits, 8));
+		bits += 8;
+	}
+	putchar('\n');
+}
+
+static void
+print_data_frame()
+{
+	print_data_subframe(0, frame_bits + 4 * 8);
+	print_data_subframe(1, frame_bits + 13 * 8);
+	print_data_subframe(2, frame_bits + 22 * 8);
+	print_data_subframe(3, frame_bits + 31 * 8);
+}
+
+static void
 process_frame()
 {
 	unsigned c1_5, c6_11;
@@ -107,6 +130,15 @@
 	case 0x0E:
 		fputs(" (idle DL)", stdout);
 		break;
+	case 0x08:
+		fputs(" (data UL)", stdout);
+		break;
+	case 0x16:
+		fputs(" (data DL)", stdout);
+		break;
+	case 0x14:
+		fputs(" (D144 sync)", stdout);
+		break;
 	}
 	putchar('\n');
 	c6_11 = bits_to_num(frame_bits + 22, 6);
@@ -124,6 +156,11 @@
 		check_efr_crc(d_bits);
 		print_efr_frame(d_bits);
 		break;
+	case 0x08:
+	case 0x16:
+	case 0x14:
+		print_data_frame();
+		return;
 	}
 	printf("  C16=%u C17=%u C18=%u C19=%u C20=%u C21=%u\n",
 		frame_bits[310], frame_bits[311], frame_bits[312],