Skip to content

Commit

Permalink
rp2/machine_uart: Fix potential race condition in interrupt handling.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
mvds00 authored and dpgeorge committed Jan 23, 2024
1 parent c3ca361 commit 057701a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ports/rp2/machine_uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down

0 comments on commit 057701a

Please sign in to comment.