mode_cardemu: Process RX interrupts before TX

It's always more important to pull out a received character from
the receive holding register to avoid the risk of overflow, so let's
do that first.
This commit is contained in:
Harald Welte
2016-03-02 10:31:03 +01:00
parent dda7355306
commit 12d4bdfbb1

View File

@@ -106,16 +106,16 @@ void usart_irq_rx(uint8_t uart)
#endif
csr = usart->US_CSR;
if (csr & US_CSR_TXRDY) {
if (card_emu_tx_byte(ch) == 0)
USART_DisableIt(usart, US_IER_TXRDY);
}
if (csr & US_CSR_RXRDY) {
byte = (usart->US_RHR) & 0xFF;
rbuf_write(&ch1_rb, byte);
}
if (csr & US_CSR_TXRDY) {
if (card_emu_tx_byte(ch) == 0)
USART_DisableIt(usart, US_IER_TXRDY);
}
if (csr & (US_CSR_OVRE|US_CSR_FRAME|US_CSR_PARE|
US_CSR_TIMEOUT|US_CSR_NACK|(1<<10))) {
usart->US_CR = US_CR_RSTSTA | US_CR_RSTIT | US_CR_RSTNACK;