summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2019-06-26 17:12:29 -0700
committerCommit Bot <commit-bot@chromium.org>2020-08-25 02:18:57 +0000
commit59093116be94d99b15be0a94411c8902ce9262b4 (patch)
tree858bf82bd2a3f4d356a7ef004e592b2fafe637e9
parentb9f0cd1ccde87398d47fba6c8396957d27b687a5 (diff)
downloadchrome-ec-59093116be94d99b15be0a94411c8902ce9262b4.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> (cherry picked from commit 88f6aafde91413eebca7d9c856fcca194b92f873) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2340249 Tested-by: Namyoon Woo <namyoon@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Marco Chen <marcochen@chromium.org> Commit-Queue: Namyoon Woo <namyoon@chromium.org>
-rw-r--r--common/uart_buffering.c6
-rw-r--r--include/uart.h5
2 files changed, 11 insertions, 0 deletions
diff --git a/common/uart_buffering.c b/common/uart_buffering.c
index 7b4b864c09..1039bece0e 100644
--- a/common/uart_buffering.c
+++ b/common/uart_buffering.c
@@ -316,6 +316,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)
{
@@ -444,3 +449,4 @@ int uart_console_read_buffer(uint8_t type,
return EC_RES_SUCCESS;
}
+
diff --git a/include/uart.h b/include/uart.h
index e40b0e866f..3bc06682f7 100644
--- a/include/uart.h
+++ b/include/uart.h
@@ -195,6 +195,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.
*/