diff options
-rw-r--r-- | common/uart_buffering.c | 8 | ||||
-rw-r--r-- | include/uart.h | 5 |
2 files changed, 13 insertions, 0 deletions
diff --git a/common/uart_buffering.c b/common/uart_buffering.c index 2b83cb7cfc..86d9f1df92 100644 --- a/common/uart_buffering.c +++ b/common/uart_buffering.c @@ -219,6 +219,14 @@ void uart_process_input(void) console_has_input(); } +void uart_clear_input(void) +{ + int scratch __attribute__ ((unused)); + while (uart_rx_available()) + scratch = uart_read_char(); + rx_buf_head = rx_buf_tail = 0; +} + #endif /* !CONFIG_UART_RX_DMA */ int uart_putc(int c) diff --git a/include/uart.h b/include/uart.h index 9fdc3e8dec..fa3f303211 100644 --- a/include/uart.h +++ b/include/uart.h @@ -191,6 +191,11 @@ void uart_tx_stop(void); void uart_process_input(void); /** + * Clear input buffer + */ +void uart_clear_input(void); + +/** * Helper for processing UART output. * * Fills the output FIFO until the transmit buffer is empty or the FIFO full. |