diff options
author | Vic Yang <victoryang@google.com> | 2012-02-01 17:25:01 +0800 |
---|---|---|
committer | Vic Yang <victoryang@google.com> | 2012-02-07 10:23:59 +0800 |
commit | 730f099c83b67861a269560e2bb5da1bd6bee503 (patch) | |
tree | f31cbcfcc2eeac7f387e7c11a53aa3960c28c28c /chip/lm4/uart.c | |
parent | d3e1de758cfa3a7dd990f0fb63eddbb1ae870418 (diff) | |
download | chrome-ec-730f099c83b67861a269560e2bb5da1bd6bee503.tar.gz |
Handle up/down arrow keys for UART console.
Record commands used previously and use up/down arrow key to navigate in
the command history.
Also removed the command '.' of repeating last command as we can use up
arrow key now.
Also changed the behaviour of uart_write_char() to be blocking on
transmit FIFO full, so that we do not lose echoed character and do not
need to flush.
BUG=chrome-os-partner:7815
TEST=Type 'help' and enter. Then type 'aaaa' and up arrow key, should
show 'help', and pressing enter prints help.
Type 'hellp' and enter. Then type 'aaaaaa' and up arrow key, should show
'hellp'. Should be able to use left/right arrow key and backspace to
correct it to 'help', and pressing enter prints help.
Type 'help' and enter. Then type 'aaa', up arrow key, and down arrow
key. Should show 'aaa'.
Change-Id: I65c615d61bf63acb31bea329aa91a3202d4db0ad
Diffstat (limited to 'chip/lm4/uart.c')
-rw-r--r-- | chip/lm4/uart.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/chip/lm4/uart.c b/chip/lm4/uart.c index 1f4205d4fd..84916a07fb 100644 --- a/chip/lm4/uart.c +++ b/chip/lm4/uart.c @@ -58,6 +58,10 @@ int uart_rx_available(void) void uart_write_char(char c) { + /* Wait for space in transmit FIFO. */ + while (!uart_tx_ready()) + ; + LM4_UART_DR(0) = c; } |