Skip to content

Commit eb534d3

Browse files
nvincent-vosslohnashif
authored andcommitted
driver: uart stm32: Check irq enabled in API calls
When calling irq_rx_ready or irq_tx_ready API, return the logical AND between the irq status and the enable of that irq. Signed-off-by: Nicolas VINCENT <[email protected]>
1 parent 4c514b3 commit eb534d3

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/serial/uart_stm32.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,8 @@ static int uart_stm32_irq_tx_ready(const struct device *dev)
533533
{
534534
USART_TypeDef *UartInstance = UART_STRUCT(dev);
535535

536-
return LL_USART_IsActiveFlag_TXE(UartInstance);
536+
return LL_USART_IsActiveFlag_TXE(UartInstance) &&
537+
LL_USART_IsEnabledIT_TC(UartInstance);
537538
}
538539

539540
static int uart_stm32_irq_tx_complete(const struct device *dev)
@@ -561,7 +562,8 @@ static int uart_stm32_irq_rx_ready(const struct device *dev)
561562
{
562563
USART_TypeDef *UartInstance = UART_STRUCT(dev);
563564

564-
return LL_USART_IsActiveFlag_RXNE(UartInstance);
565+
return LL_USART_IsActiveFlag_RXNE(UartInstance) &&
566+
LL_USART_IsEnabledIT_RXNE(UartInstance);
565567
}
566568

567569
static void uart_stm32_irq_err_enable(const struct device *dev)

0 commit comments

Comments
 (0)