diff options
author | Namyoon Woo <namyoon@chromium.org> | 2019-08-12 13:37:40 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-01-15 05:56:06 +0000 |
commit | e29f365dd38c5d04e8c2bb5af37d37dc12350891 (patch) | |
tree | 7b1bbf49d15e7621afab6523ab6802609a6662cb /common/usb_console_stream.c | |
parent | 86bf6c285c456e08c012835138e9510d5fee059f (diff) | |
download | chrome-ec-e29f365dd38c5d04e8c2bb5af37d37dc12350891.tar.gz |
util: enable chargen for USB console
This patch allows chargen to print output to USB instead of UART,
which is chosen by command parameter.
If USB console is not supported, then the parameter will be ignored,
and output shall go to UART port.
The patch increases flash usage by 48 bytes if CONFIG_CMD_CHARGEN
is defined.
BUG=chromium:992607
BRANCH=None
TEST=manually ran on fleex.
for BOARD in {cr50, fleex}
1. Define CONFIG_CMD_CHARGEN in board/cr50/board.h,
and baseboard/octopus/baseboard.h.
2. Build binaries, and program them.
3. Connect CCD to Octopus Fleex.
4. Open terminal to Cr50 and EC consoles, and run chargen
(cr50) chargen 1 4
> // no output, because they went to UART.
(cr50) chargen 1 4 usb
0000
>
(ec) chargen 1 4
0000
>
(ec) chargen 1 4 usb // usb parameter gets ignored.
0000
>
Change-Id: I5810421fef56548e0bd667488e853e724f699a31
Signed-off-by: Namyoon Woo <namyoon@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1769386
Reviewed-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org>
Diffstat (limited to 'common/usb_console_stream.c')
-rw-r--r-- | common/usb_console_stream.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/common/usb_console_stream.c b/common/usb_console_stream.c index 40bbc07e3c..13dd7f8264 100644 --- a/common/usb_console_stream.c +++ b/common/usb_console_stream.c @@ -231,3 +231,8 @@ void usb_console_enable(int enabled, int readonly) is_enabled = enabled; is_readonly = readonly; } + +int usb_console_tx_blocked(void) +{ + return is_enabled && (queue_space(&tx_q) < USB_MAX_PACKET_SIZE); +} |