diff options
author | Randall Spangler <rspangler@chromium.org> | 2012-03-13 16:50:00 -0700 |
---|---|---|
committer | Randall Spangler <rspangler@chromium.org> | 2012-03-13 16:52:53 -0700 |
commit | 1c6709a332f496bbd92315c5af8573a804617aa5 (patch) | |
tree | ee7c61758ebc37a8afa1288e7314fff982684905 | |
parent | dcb1d1f9299fb6d78814a072114c2eab0f7d3198 (diff) | |
download | chrome-ec-1c6709a332f496bbd92315c5af8573a804617aa5.tar.gz |
Add comxtest debug command
Remove dummy boot-time output to UART1; no longer needed now that
there's a debug command to do the same thing.
Signed-off-by: Randall Spangler <rspangler@chromium.org>
BUG=none
TEST=manual
comxtest - prints default message to x86 UART
comxtext ccc123 - prints 'ccc123' to x86 UART
Change-Id: I37d37aeca06bf71b106f5ad3473a79780fd089a9
-rw-r--r-- | chip/lm4/uart.c | 38 |
1 files changed, 30 insertions, 8 deletions
diff --git a/chip/lm4/uart.c b/chip/lm4/uart.c index 9d2fe0c950..e3201056fe 100644 --- a/chip/lm4/uart.c +++ b/chip/lm4/uart.c @@ -193,17 +193,18 @@ int uart_init(void) /*****************************************************************************/ /* COMx functions */ +/* Write a character to COMx, waiting for space in the output buffer if + * necessary. */ +static void uart_comx_putc_wait(int c) +{ + while (!uart_comx_putc_ok()) {} + uart_comx_putc(c); +} + + void uart_comx_enable(void) { task_enable_irq(LM4_IRQ_UART1); - - /* Print hello on UART1 for debugging */ - /* TODO: remove in production */ - { - const char *c = "Hello on UART1\r\n"; - while (*c) - uart_comx_putc(*c++); - } } @@ -224,3 +225,24 @@ void uart_comx_putc(int c) { LM4_UART_DR(1) = c; } + + +/*****************************************************************************/ +/* Console commands */ + +static int command_comxtest(int argc, char **argv) +{ + /* Put characters to COMX port */ + const char *c = argc > 1 ? argv[1] : "testing comx output!"; + + uart_printf("Writing \"%s\\r\\n\" to COMx UART...\n", c); + + while (*c) + uart_comx_putc_wait(*c++); + + uart_comx_putc_wait('\r'); + uart_comx_putc_wait('\n'); + + return EC_SUCCESS; +} +DECLARE_CONSOLE_COMMAND(comxtest, command_comxtest); |