rp2/machine_uart: Fix potential race condition in interrupt handling.

The irq service routine cleared the RT interrupt bit on TX interrupt.  This
opens the possibility that an RT interrupt is missed.

Signed-off-by: Maarten van der Schrieck <maarten@thingsconnected.nl>
This commit is contained in:
Maarten van der Schrieck 2023-06-22 15:52:10 +02:00 committed by Damien George
parent c3ca3612d1
commit 057701a770

View File

@ -194,7 +194,7 @@ STATIC inline void uart_service_interrupt(machine_uart_obj_t *self) {
}
if (uart_get_hw(self->uart)->mis & UART_UARTMIS_TXMIS_BITS) { // tx interrupt?
// clear all interrupt bits but rx
uart_get_hw(self->uart)->icr = UART_UARTICR_BITS & (~UART_UARTICR_RXIC_BITS);
uart_get_hw(self->uart)->icr = UART_UARTICR_BITS & ~(UART_UARTICR_RXIC_BITS | UART_UARTICR_RTIC_BITS);
uart_fill_tx_fifo(self);
}
}