changeset 46:43f678895a3a

simtrace3-sniff-rx: add some annotations to output
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 31 Aug 2023 10:01:40 +0000
parents b0524d1dc6ef
children 7c9bf72d460f
files sw/sniff-rx/byteproc.c
diffstat 1 files changed, 23 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/sw/sniff-rx/byteproc.c	Thu Aug 31 09:32:48 2023 +0000
+++ b/sw/sniff-rx/byteproc.c	Thu Aug 31 10:01:40 2023 +0000
@@ -15,6 +15,26 @@
 
 static int byte_pending_flag, byte_pending_val;
 
+static void
+annotate(new_byte)
+{
+	if (new_byte & 0x80) {
+		fprintf(main_outf, " RST %s", new_byte & 0x40 ? "high" : "low");
+		return;
+	}
+	switch (new_byte & 0x18) {
+	case 0x08:
+		fputs(" PPS1", main_outf);
+		return;
+	case 0x10:
+		fputs(" PPS spenh trigger", main_outf);
+		return;
+	case 0x18:
+		fputs(" Bad PPS catcher bits!", main_outf);
+		return;
+	}
+}
+
 void
 rx_byte_in(new_byte)
 {
@@ -24,9 +44,11 @@
 		return;
 	}
 	/* received complete 2-byte message from the FPGA */
-	fprintf(main_outf, "[%02d:%02d:%02d.%06u] %02X%02X\n", cur_tm->tm_hour,
+	fprintf(main_outf, "[%02d:%02d:%02d.%06u] %02X%02X", cur_tm->tm_hour,
 		cur_tm->tm_min, cur_tm->tm_sec, (unsigned) curtime.tv_usec,
 		new_byte, byte_pending_val);
+	annotate(new_byte);
+	putc('\n', main_outf);
 	byte_pending_flag = 0;
 	if (logfile_flag && (new_byte & 0x80))
 		printf("SIM RST is %s\n", new_byte & 0x40 ? "high" : "low");