diff options
author | Vadim Bendebury <vbendeb@chromium.org> | 2019-06-26 17:12:29 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-06-27 20:50:56 +0000 |
commit | 88f6aafde91413eebca7d9c856fcca194b92f873 (patch) | |
tree | 68799a0548f0523f6cb8104e903cd120e986e6ac | |
parent | c4408e189736b45f275adfd3eb388fde3f457f62 (diff) | |
download | chrome-ec-88f6aafde91413eebca7d9c856fcca194b92f873.tar.gz |
uart_buffering: add tx_buffer_full() API
To aid in system level UART console performance testing a test
function needs to know when the UART console buffer is full. This
patch provides an API for that.
BRANCH=none
BUG=b:38448364
TEST=verified proper operation of the chargen CLI command which uses
this API.
Change-Id: I5fbc6cf4031a5077c91cd4bb85ab6f4dfb18821e
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1679710
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
-rw-r--r-- | common/uart_buffering.c | 6 | ||||
-rw-r--r-- | include/uart.h | 5 |
2 files changed, 11 insertions, 0 deletions
diff --git a/common/uart_buffering.c b/common/uart_buffering.c index d0f302396f..9eb6db5cdf 100644 --- a/common/uart_buffering.c +++ b/common/uart_buffering.c @@ -338,6 +338,11 @@ int uart_buffer_empty(void) return tx_buf_head == tx_buf_tail; } +int uart_buffer_full(void) +{ + return TX_BUF_NEXT(tx_buf_head) == tx_buf_tail; +} + #ifdef CONFIG_UART_RX_DMA static void uart_rx_dma_init(void) { @@ -466,3 +471,4 @@ int uart_console_read_buffer(uint8_t type, return EC_RES_SUCCESS; } + diff --git a/include/uart.h b/include/uart.h index 4b0e4738e9..d5493544c2 100644 --- a/include/uart.h +++ b/include/uart.h @@ -209,6 +209,11 @@ void uart_process_output(void); int uart_buffer_empty(void); /** + * Return boolean expressing whether UART buffer is full or not. + */ +int uart_buffer_full(void); + +/** * Disable the EC console UART and convert the UART RX pin to a generic GPIO * with an edge detect interrupt. */ |