diff options
author | Jack Rosenthal <jrosenth@chromium.org> | 2021-02-10 13:25:03 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-02-11 17:19:42 +0000 |
commit | fdf60424cfa7552e7a29bd09dd10aba137e108a3 (patch) | |
tree | d3dee323ce3a1630722ee686ee7cd7899ec37a83 /include/uart.h | |
parent | 7991e4d1f705c84966b382219f194804380b79ab (diff) | |
download | chrome-ec-fdf60424cfa7552e7a29bd09dd10aba137e108a3.tar.gz |
common: uart: split off printf and like functions into separate module
This separates the high-level uart output functions like uart_printf
and uart_putc from the uart buffering module, allowing the buffering
to be implemented separately from the output functions.
The contract between this module and the uart_buffering layer is to
implement uart_tx_char_raw and uart_tx_start.
BUG=b:178033156
BRANCH=none
TEST=buildall
Signed-off-by: Jack Rosenthal <jrosenth@chromium.org>
Change-Id: I5fb62ca2be1fea04654eaadd7a3806ac0c586929
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2685411
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include/uart.h')
-rw-r--r-- | include/uart.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/include/uart.h b/include/uart.h index b6dce4f21f..95df22d5bd 100644 --- a/include/uart.h +++ b/include/uart.h @@ -85,6 +85,22 @@ int uart_printf(const char *format, ...); int uart_vprintf(const char *format, va_list args); /** + * Put a single character into the transmit buffer. + * + * Does not enable the transmit interrupt; assumes that happens elsewhere. + * + * @param context Context; ignored. + * @param c Character to write. + * @return 0 if the character was transmitted, 1 if it was dropped. + * + * Note: This is intended to be implemented by the UART buffering + * module, and called only by the implementations of the uart_* + * functions. You should stick to the higher level functions, such as + * uart_putc, outside of the UART implementation. + */ +int uart_tx_char_raw(void *context, int c); + +/** * Flush output. Blocks until UART has transmitted all output. */ void uart_flush_output(void); |