diff options
author | Vadim Bendebury <vbendeb@chromium.org> | 2015-08-07 13:24:30 -0700 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-08-08 04:26:40 +0000 |
commit | 6cb20083487c30fe68397dd09a353c6d4450fc97 (patch) | |
tree | dbeff4a90a95b2c66228a5182637d3536fdd7cf1 | |
parent | c124e8cbc7a2215b418655f644df1fa204e253b4 (diff) | |
download | chrome-ec-6cb20083487c30fe68397dd09a353c6d4450fc97.tar.gz |
uart: provide polling mode of operation
Early hardware bringup often is complicated by exceptions happening in
the code all over the place. Using interrupt based console output to
trace startup progress is inefficient - a lot of text gets buffered
and never shows up on the console.
The new config option enables the mode where the console output is
supposed to be happening in polling mode, the character transmit
function not exiting until the entire character is transmitted.
BRANCH=none
BUG=chrome-os-partner:43791
TEST=with the new config enabled (and the appropriate changes to
chip/g/uart.c) was able to debug bringup on the new version.
Change-Id: I85fd2f3990ac1d31097d58bd6a7fa658b2b5146e
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/291852
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
-rw-r--r-- | common/uart_buffering.c | 7 | ||||
-rw-r--r-- | include/config.h | 10 |
2 files changed, 17 insertions, 0 deletions
diff --git a/common/uart_buffering.c b/common/uart_buffering.c index 8ff8f1cc12..86a3482951 100644 --- a/common/uart_buffering.c +++ b/common/uart_buffering.c @@ -68,6 +68,12 @@ static int __tx_char(void *context, int c) if (c == '\n' && __tx_char(NULL, '\r')) return 1; +#if defined CONFIG_POLLING_UART + (void) tx_buf_next; + (void) tx_buf_new_tail; + uart_write_char(c); +#else + tx_buf_next = TX_BUF_NEXT(tx_buf_head); if (tx_buf_next == tx_buf_tail) return 1; @@ -89,6 +95,7 @@ static int __tx_char(void *context, int c) tx_buf[tx_buf_head] = c; tx_buf_head = tx_buf_next; +#endif return 0; } diff --git a/include/config.h b/include/config.h index 603062f6da..983184d909 100644 --- a/include/config.h +++ b/include/config.h @@ -1220,6 +1220,16 @@ */ #undef CONFIG_PMU_POWERINFO +/* + * Enable this config to make console UART self sufficient (no other + * initialization required before uart_init(), no interrupts, uart_tx_char() + * does not exit until character finished transmitting). + * + * This is useful during early hardware bringup, each platform needs to + * implement its own code to support this. + */ +#undef CONFIG_POLLING_UART + /*****************************************************************************/ /* |