samples: uart: Check return value from uart_fifo_fill
If the UART FIFO is already full at the start of the irq tests (e.g. because the data from the previous polled mode test is still being transmitted), then uart_fifo_fill() may not not be able to add the requested character to the FIFO and so return zero. Fix this issue by repeating retrying uart_fifo_fill() until success. Change-Id: I055ca1d4c91d81488b89f2a9b00031b9f2b8b222 Signed-off-by: Jon Medhurst <tixy@linaro.org>
This commit is contained in:
parent
02dc270d5e
commit
93f49c20e9
|
@ -91,7 +91,8 @@ static void write_buf_irq(struct device *dev, const char *buf, int len)
|
|||
|
||||
for (i = 0; i < len; i++) {
|
||||
data_transmitted = false;
|
||||
uart_fifo_fill(dev, &buf[i], 1);
|
||||
while (uart_fifo_fill(dev, &buf[i], 1) == 0)
|
||||
;
|
||||
while (data_transmitted == false)
|
||||
;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue