summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaarten van der Schrieck <maarten@thingsconnected.nl>2023-06-22 15:52:10 +0200
committerDamien George <damien@micropython.org>2024-01-23 13:11:53 +1100
commit057701a7708ca6ca96aaf3784c0ef72d22424df8 (patch)
tree27780d8267de6277180da35f83f55562ebbc93e5
parentc3ca3612d1ef5e490045c3d4038b1362993c0f26 (diff)
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>
-rw-r--r--ports/rp2/machine_uart.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ports/rp2/machine_uart.c b/ports/rp2/machine_uart.c
index bca07cebf..72e68a6fb 100644
--- a/ports/rp2/machine_uart.c
+++ b/ports/rp2/machine_uart.c
@@ -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);
}
}