changeset 10:c1d9b5d128f5

fc-mcsi-rxtx: implement print-rx command
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 28 Oct 2024 06:11:23 +0000
parents 62579cfff4fc
children e93a11f44e6f
files sw/mcsi-rxtx/rx_samples.c sw/mcsi-rxtx/usercmd.c
diffstat 2 files changed, 24 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/sw/mcsi-rxtx/rx_samples.c	Mon Oct 28 06:02:04 2024 +0000
+++ b/sw/mcsi-rxtx/rx_samples.c	Mon Oct 28 06:11:23 2024 +0000
@@ -22,3 +22,24 @@
 		rx_pcm_samples[n] = samp;
 	}
 }
+
+void
+cmd_print_rx()
+{
+	unsigned i, j, n;
+
+	if (!is_active) {
+		printf("Rx is not active\n");
+		return;
+	}
+	n = 0;
+	for (i = 0; i < 10; i++) {
+		for (j = 0; j < 16; j++) {
+			printf("%04x", rx_pcm_samples[n++]);
+			if (j == 15)
+				putchar('\n');
+			else
+				putchar(' ');
+		}
+	}
+}
--- a/sw/mcsi-rxtx/usercmd.c	Mon Oct 28 06:02:04 2024 +0000
+++ b/sw/mcsi-rxtx/usercmd.c	Mon Oct 28 06:11:23 2024 +0000
@@ -11,6 +11,8 @@
 
 extern char usercmd[];
 
+extern void cmd_print_rx();
+
 static void
 cmd_exit()
 {
@@ -25,6 +27,7 @@
 	void (*func)();
 } cmdtab[] = {
 	{"exit", 0, 0, cmd_exit},
+	{"print-rx", 0, 0, cmd_print_rx},
 	{"quit", 0, 0, cmd_exit},
 	{0, 0, 0, 0}
 };