summaryrefslogtreecommitdiff
path: root/drivers/console/uart_pipe.c
diff options
context:
space:
mode:
authorMariusz Skamra <mariusz.skamra@tieto.com>2016-03-24 13:51:26 +0100
committerJohan Hedberg <johan.hedberg@intel.com>2016-03-29 16:41:50 +0000
commit4800266cc652a70572255affa14dd93846d701c3 (patch)
treefa650ea6483ba490de78e93de48d9041f6bc7134 /drivers/console/uart_pipe.c
parent15dc9f326e8270d4780e084f126b50c219d658a5 (diff)
drivers/console: Fix flush data on uart_pipe_setup
This patch fixes drain of data left in UART Rx fifo. uart_irq_tx_ready checks if Rx IRQ has been raised, but because Rx IRQ is disabled this won't work even if there are some data left in the UART buffers. So simply uart_fifo_read is used to discard the data that left in UART buffer. Change-Id: I17f145ba58640650bafd3602412fc75229f39664 Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
Diffstat (limited to 'drivers/console/uart_pipe.c')
-rw-r--r--drivers/console/uart_pipe.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/console/uart_pipe.c b/drivers/console/uart_pipe.c
index c8c89ae22..4b6b2bdc1 100644
--- a/drivers/console/uart_pipe.c
+++ b/drivers/console/uart_pipe.c
@@ -74,14 +74,14 @@ int uart_pipe_send(const uint8_t *data, int len)
static void uart_pipe_setup(struct device *uart)
{
+ uint8_t c;
+
uart_irq_rx_disable(uart);
uart_irq_tx_disable(uart);
/* Drain the fifo */
- while (uart_irq_rx_ready(uart)) {
- unsigned char c;
-
- uart_fifo_read(uart, &c, 1);
+ while (uart_fifo_read(uart, &c, 1)) {
+ continue;
}
uart_irq_callback_set(uart, uart_pipe_isr);