serial: stm32: fix dropped UART_TX_DONE events

Fix dropped `UART_TX_DONE` events when poll out and async APIs are used
on the same port. Clearing `tx_poll_stream_on` is required to prevent
`uart_stm32_isr` from prematurely clearing the TC status bit.

Signed-off-by: Jordan Yates <jordan@embeint.com>
This commit is contained in:
Jordan Yates 2025-03-18 20:06:14 +10:00 committed by Benjamin Cabé
parent cc28f5072b
commit 83ea0f7f80

View File

@ -1163,6 +1163,9 @@ static inline void async_evt_tx_done(struct uart_stm32_data *data)
/* Reset tx buffer */
data->dma_tx.buffer_length = 0;
data->dma_tx.counter = 0;
#ifdef CONFIG_PM
data->tx_int_stream_on = false;
#endif
async_user_callback(data, &event);
}
@ -1180,6 +1183,9 @@ static inline void async_evt_tx_abort(struct uart_stm32_data *data)
/* Reset tx buffer */
data->dma_tx.buffer_length = 0;
data->dma_tx.counter = 0;
#ifdef CONFIG_PM
data->tx_int_stream_on = false;
#endif
async_user_callback(data, &event);
}
@ -1603,6 +1609,10 @@ static int uart_stm32_async_tx(const struct device *dev,
}
#endif /* CONFIG_DCACHE */
#ifdef CONFIG_PM
data->tx_poll_stream_on = false;
data->tx_int_stream_on = true;
#endif
data->dma_tx.buffer = (uint8_t *)tx_data;
data->dma_tx.buffer_length = buf_size;
data->dma_tx.timeout = timeout;