Skip to content
Commit 8f53407f authored by Jordan Yates's avatar Jordan Yates Committed by Benjamin Cabé
Browse files

serial: cmsdk_apb: fix `irq_is_pending`



Implement `irq_is_pending` in terms of the `irq_rx_ready` and
`irq_tx_ready` function calls.

Using `intstatus` directly results in an implementation that does not
conform to the interrupt driven UART API. Since `intstatus` bits are
only only set when a buffer transitions from full to empty, any calls to
`irq_is_pending` before any bytes have been sent will return 0. This is
problematic since the documented implementation for the API IRQ handler
is:
```
while (uart_irq_update(dev) && uart_irq_is_pending(dev)) {
    if (uart_irq_rx_ready(dev)) {
        ...
    }
    if (uart_irq_tx_ready(dev)) {
        uart_fifo_fill(dev, ...);
    }
}
```
If `uart_irq_is_pending` does not return 1 until the first byte is sent,
we never end up pushing data to be transmitted into the `uart_fifo_full`
function.

Signed-off-by: default avatarJordan Yates <jordan@embeint.com>
parent ba1ad38f
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment