From 7e3c9959e1e140753738be9b6d4142f6c2068e3d Mon Sep 17 00:00:00 2001 From: Min Xu Date: Sat, 25 Oct 2014 21:18:03 +0200 Subject: iso_uart: Print more errors, not just overruns --- firmware/src/simtrace/iso7816_uart.c | 10 ++++++++-- firmware/src/simtrace/iso7816_uart.h | 2 +- firmware/src/simtrace/main_simtrace.c | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) (limited to 'firmware/src/simtrace') diff --git a/firmware/src/simtrace/iso7816_uart.c b/firmware/src/simtrace/iso7816_uart.c index 780340f..e37deba 100644 --- a/firmware/src/simtrace/iso7816_uart.c +++ b/firmware/src/simtrace/iso7816_uart.c @@ -125,12 +125,18 @@ static const u_int8_t di_table[] = { 12, 20, 2, 4, 8, 16, 32, 64, }; -void iso_uart_report_overrun(void) +void iso_uart_report_errors(void) { - static unsigned lastOverrun = 0; + static unsigned lastOverrun = 0, lastParity = 0, lastFrame = 0; if (isoh.stats.overrun != lastOverrun) { DEBUGPCR("UART overrun: %u", lastOverrun = isoh.stats.overrun); } + if (isoh.stats.frame_err != lastFrame) { + DEBUGPCR("UART frame error: %u", lastFrame = isoh.stats.frame_err); + } + if (isoh.stats.parity_err != lastParity) { + DEBUGPCR("UART parity error: %u", lastParity = isoh.stats.parity_err); + } } void iso_uart_stats_dump(void) diff --git a/firmware/src/simtrace/iso7816_uart.h b/firmware/src/simtrace/iso7816_uart.h index c5790c8..969e6f9 100644 --- a/firmware/src/simtrace/iso7816_uart.h +++ b/firmware/src/simtrace/iso7816_uart.h @@ -2,13 +2,13 @@ #define SIMTRACE_ISO7816_UART_H struct simtrace_stats *iso_uart_stats_get(void); +void iso_uart_report_errors(void); void iso_uart_stats_dump(void); void iso_uart_dump(void); void iso_uart_rst(unsigned int state); void iso_uart_rx_mode(void); void iso_uart_clk_master(unsigned int master); void iso_uart_init(void); -void iso_uart_report_overrun(void); void iso_uart_flush(void); void iso_uart_idleflush(void); diff --git a/firmware/src/simtrace/main_simtrace.c b/firmware/src/simtrace/main_simtrace.c index 6bad290..b3f2665 100644 --- a/firmware/src/simtrace/main_simtrace.c +++ b/firmware/src/simtrace/main_simtrace.c @@ -236,5 +236,5 @@ void _main_func(void) } loopLow++; - iso_uart_report_overrun(); + iso_uart_report_errors(); } -- cgit v1.2.3