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 <nicolas.vincent@vossloh.com>
This commit is contained in:
Nicolas VINCENT 2021-01-08 15:59:53 +01:00 committed by Anas Nashif
commit eb534d39d2

View file

@ -533,7 +533,8 @@ static int uart_stm32_irq_tx_ready(const struct device *dev)
{
USART_TypeDef *UartInstance = UART_STRUCT(dev);
return LL_USART_IsActiveFlag_TXE(UartInstance);
return LL_USART_IsActiveFlag_TXE(UartInstance) &&
LL_USART_IsEnabledIT_TC(UartInstance);
}
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)
{
USART_TypeDef *UartInstance = UART_STRUCT(dev);
return LL_USART_IsActiveFlag_RXNE(UartInstance);
return LL_USART_IsActiveFlag_RXNE(UartInstance) &&
LL_USART_IsEnabledIT_RXNE(UartInstance);
}
static void uart_stm32_irq_err_enable(const struct device *dev)