drivers: serial: pl011: fix missing TX callback with FIFO enabled
When using the interrupt UART API, it is expected that the driver will call the callback function repeatedly while TX interrupt is enabled. However that is not necessarily the case with the FIFO is enabled. If the application calls uart_fifo_fill() each time with only one byte of data, the TX interrupt will never trigger. This is because the 1/8 TX interrupt trigger threshold is never reached. For this reason, the callback function should be called multiple times from software as needed. Fixes zephyrproject-rtos/zephyr#85479 Signed-off-by: Xudong Zheng <7pkvm5aw@slicealias.com>
This commit is contained in:
parent
bddaff1d1b
commit
b783bc8448
1 changed files with 8 additions and 2 deletions
|
@ -343,6 +343,8 @@ static void pl011_irq_tx_enable(const struct device *dev)
|
||||||
|
|
||||||
get_uart(dev)->imsc |= PL011_IMSC_TXIM;
|
get_uart(dev)->imsc |= PL011_IMSC_TXIM;
|
||||||
if (data->sw_call_txdrdy) {
|
if (data->sw_call_txdrdy) {
|
||||||
|
data->sw_call_txdrdy = false;
|
||||||
|
|
||||||
/* Verify if the callback has been registered */
|
/* Verify if the callback has been registered */
|
||||||
if (data->irq_cb) {
|
if (data->irq_cb) {
|
||||||
/*
|
/*
|
||||||
|
@ -357,14 +359,18 @@ static void pl011_irq_tx_enable(const struct device *dev)
|
||||||
* [1]: PrimeCell UART (PL011) Technical Reference Manual
|
* [1]: PrimeCell UART (PL011) Technical Reference Manual
|
||||||
* functional-overview/interrupts
|
* functional-overview/interrupts
|
||||||
*/
|
*/
|
||||||
data->irq_cb(dev, data->irq_cb_data);
|
while (get_uart(dev)->imsc & PL011_IMSC_TXIM) {
|
||||||
|
data->irq_cb(dev, data->irq_cb_data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
data->sw_call_txdrdy = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pl011_irq_tx_disable(const struct device *dev)
|
static void pl011_irq_tx_disable(const struct device *dev)
|
||||||
{
|
{
|
||||||
|
struct pl011_data *data = dev->data;
|
||||||
|
|
||||||
|
data->sw_call_txdrdy = true;
|
||||||
get_uart(dev)->imsc &= ~PL011_IMSC_TXIM;
|
get_uart(dev)->imsc &= ~PL011_IMSC_TXIM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue