diff options
author | Min Xu <min.xu@min-info.net> | 2014-10-25 22:08:04 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2014-11-11 22:30:55 +0100 |
commit | b6caca4b64a73d8d3ab4ce6b51cea71b8f1a54b0 (patch) | |
tree | bce986dd5ab366dd141456f842c887868b73db7a /firmware/src | |
parent | 478c2332b74c3ee7dfd8d70873419cf0ef19619e (diff) |
improve handling of spurious IRQs
rather than printing directly from the interrupt handler, just increment
the number and print it from the main loop function instead.
Diffstat (limited to 'firmware/src')
-rw-r--r-- | firmware/src/simtrace/main_simtrace.c | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/firmware/src/simtrace/main_simtrace.c b/firmware/src/simtrace/main_simtrace.c index b84525f..8069349 100644 --- a/firmware/src/simtrace/main_simtrace.c +++ b/firmware/src/simtrace/main_simtrace.c @@ -134,16 +134,30 @@ static int simtrace_usb_in(struct req_ctx *rctx) req_ctx_set_state(rctx, RCTX_STATE_FREE); break; } + return 0; } -void custom_spurious_handler(unsigned previous_pc) +static volatile unsigned spuirq_pc, spuirq_count = 0; + +static void check_spurious_irq() +{ + static unsigned last_count = 0; + if (last_count != spuirq_count) { + DEBUGPCR("SPURRIOUS IRQ %i [Old PC = %08X]", spuirq_count, spuirq_pc); + last_count = spuirq_count; + } +} + +static void custom_spurious_handler(unsigned previous_pc) { - char dbg_buf[100]; - sprintf(dbg_buf, "SPURRIOUS IRQ [Old PC = %08X]\n\r", previous_pc); - AT91F_DBGU_Frame(dbg_buf); + unsigned flags; + local_irq_save(flags); + spuirq_pc = previous_pc; + spuirq_count++; + local_irq_restore(flags); } -void custom_spurious_entry(void) +static void custom_spurious_entry(void) { register unsigned *previous_pc asm("r0"); asm("ADD R1, SP, #16; LDR R0, [R1]"); @@ -247,10 +261,11 @@ void _main_func(void) if ((loopLow & 0xFFFF) == 0) { DEBUGPCR("Heart beat %08X", loopHigh++); } - if ((loopLow & 0x3FF) == 0) { + if ((loopLow & 0x3F) == 0) { iso_uart_idleflush(); } loopLow++; iso_uart_report_errors(); + check_spurious_irq(); } |