summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2011-08-15 22:59:24 +0200
committerHarald Welte <laforge@gnumonks.org>2011-08-15 22:59:24 +0200
commitfa7297b93f4187bce9439bb676874815f66d8f21 (patch)
treeba948f98e97c0e2d2f3fa36137f4c8148c79ab49
parenta6d972c23dc7160331a4495011a73199eca59a9f (diff)
SIMTRACE UART: Reset error status on error related IRQ
This prevents an IRQ-flood after a parity or overrun error, which in turn would cause a watchdog reset.
-rw-r--r--firmware/src/simtrace/iso7816_uart.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/firmware/src/simtrace/iso7816_uart.c b/firmware/src/simtrace/iso7816_uart.c
index 67f8e0d..f30977a 100644
--- a/firmware/src/simtrace/iso7816_uart.c
+++ b/firmware/src/simtrace/iso7816_uart.c
@@ -530,7 +530,16 @@ static __ramfunc void usart_irq(void)
}
if (csr & (AT91C_US_PARE|AT91C_US_FRAME|AT91C_US_OVRE)) {
+ u_int8_t nb_err = usart->US_NER;
/* FIXME: some error has occurrerd */
+ //DEBUGP("NER=%02x ", nb_err);
+ /* clear the status */
+ usart->US_CR |= AT91C_US_RSTSTA;
+ }
+
+ if (csr & AT91C_US_INACK) {
+ /* we would have sent a NACK if INACK was not set */
+ usart->US_CR |= AT91C_US_RSTNACK;
}
}
personal git repositories of Harald Welte. Your mileage may vary