# HG changeset patch # User Mychaela Falconia # Date 1693476100 0 # Node ID 43f678895a3abda5f50dde40f79ec6b903997c37 # Parent b0524d1dc6eff4904d8f66a5278f5e1b18832215 simtrace3-sniff-rx: add some annotations to output diff -r b0524d1dc6ef -r 43f678895a3a sw/sniff-rx/byteproc.c --- 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");