mode_cardemu: Disable UART TXRDY generation if we don't have data to TX

When the ISO7816 state machine requires us to transmit something, but
we don't have data ready to transmit, we should switch off TXRDY
interrupt generation.

What's missing is of course the other part that re-enabls TXRDY
generation once new data is available
This commit is contained in:
Harald Welte
2016-02-29 21:35:38 +01:00
parent 349c54bc3b
commit 45688d4c3b

View File

@@ -102,8 +102,10 @@ void usart_irq_rx(uint8_t uart)
#endif
csr = usart->US_CSR;
if (csr & US_CSR_TXRDY)
card_emu_tx_byte(ch);
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;