summaryrefslogtreecommitdiff
path: root/firmware/src
diff options
context:
space:
mode:
authorMin Xu <min.xu@min-info.net>2014-10-25 20:13:23 +0200
committerHarald Welte <laforge@gnumonks.org>2014-11-11 22:30:54 +0100
commit7fcc62940d35ae31bdf5e5ebdd5ca55c8f4429c2 (patch)
treea19f042e1f5f8f5348b390f742a8437810d0199c /firmware/src
parentca4e80551b2144cb08a72a58b6c13c2f88b4b2a0 (diff)
simtrace: Add heartbeat message to debug console
Diffstat (limited to 'firmware/src')
-rw-r--r--firmware/src/simtrace/iso7816_uart.c10
-rw-r--r--firmware/src/simtrace/iso7816_uart.h1
-rw-r--r--firmware/src/simtrace/main_simtrace.c9
3 files changed, 20 insertions, 0 deletions
diff --git a/firmware/src/simtrace/iso7816_uart.c b/firmware/src/simtrace/iso7816_uart.c
index 52522c0..611ccfb 100644
--- a/firmware/src/simtrace/iso7816_uart.c
+++ b/firmware/src/simtrace/iso7816_uart.c
@@ -125,6 +125,14 @@ static const u_int8_t di_table[] = {
12, 20, 2, 4, 8, 16, 32, 64,
};
+void iso_uart_report_overrun(void)
+{
+ static unsigned lastOverrun = 0;
+ if (isoh.stats.overrun != lastOverrun) {
+ DEBUGPCR("UART overrun: %u", lastOverrun = isoh.stats.overrun);
+ }
+}
+
void iso_uart_stats_dump(void)
{
DEBUGPCRF("no_rctx: %u, rctx_sent: %u, rst: %u, pps: %u, bytes: %u, "
@@ -675,6 +683,8 @@ void iso_uart_init(void)
{
DEBUGPCR("USART Initializing");
+ memset(&isoh, 0, sizeof(isoh));
+
refill_rctx(&isoh);
/* make sure we get clock from the power management controller */
diff --git a/firmware/src/simtrace/iso7816_uart.h b/firmware/src/simtrace/iso7816_uart.h
index beb0b23..070d92a 100644
--- a/firmware/src/simtrace/iso7816_uart.h
+++ b/firmware/src/simtrace/iso7816_uart.h
@@ -6,3 +6,4 @@ 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);
diff --git a/firmware/src/simtrace/main_simtrace.c b/firmware/src/simtrace/main_simtrace.c
index 6f82d96..ca4e646 100644
--- a/firmware/src/simtrace/main_simtrace.c
+++ b/firmware/src/simtrace/main_simtrace.c
@@ -218,6 +218,8 @@ int _main_dbgu(char key)
void _main_func(void)
{
+ static unsigned loopLow = 0, loopHigh = 0;
+
/* first we try to get rid of pending to-be-sent stuff */
usb_out_process();
@@ -225,4 +227,11 @@ void _main_func(void)
usb_in_process();
udp_unthrottle();
+
+ if ((loopLow & 0xFFFF) == 0) {
+ DEBUGPCR("Heart beat %08X", loopHigh++);
+ }
+ loopLow++;
+
+ iso_uart_report_overrun();
}
personal git repositories of Harald Welte. Your mileage may vary