diff options
author | Yuval Peress <peress@chromium.org> | 2021-04-01 22:28:09 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-04-15 00:36:23 +0000 |
commit | 783543b32a03598228439affb257dfeeea38779e (patch) | |
tree | 5f8e5062fc547a8de7ab0490f6a41eb84550638e /common/vboot | |
parent | 483e42d53b0ffe78b1d24607d39eb31bc7e80c79 (diff) | |
download | chrome-ec-783543b32a03598228439affb257dfeeea38779e.tar.gz |
zephyr: use interrupt based RX buffering
Poll-based RX was technically incorrect since Zephyr was setting up
the UART to FIFO mode (instead of byte mode). This change replaces
polling the RX UART with interrupt based callbacks. When calling
uart_shell_stop(), the ISR will be replaced and will instead queue
items to a ring buffer which can be read from uart_getc() (it can
also be cleared via the uart_clear_input() function).
BRANCH=none
BUG=b:181352041
TEST=Build volteer, run, see expected 0xec07 from the GSC.
Cq-Depend: chromium:2730870, chromium:2730869
Signed-off-by: Yuval Peress <peress@chromium.org>
Change-Id: I5d2b61e914b56f678a259b373969522da87e8df3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2728824
Reviewed-by: Keith Short <keithshort@chromium.org>
Commit-Queue: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'common/vboot')
-rw-r--r-- | common/vboot/efs2.c | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/common/vboot/efs2.c b/common/vboot/efs2.c index b01b82bf8c..7c04d2460e 100644 --- a/common/vboot/efs2.c +++ b/common/vboot/efs2.c @@ -71,7 +71,11 @@ static enum cr50_comm_err send_to_cr50(const uint8_t *data, size_t size) uart_flush_output(); uart_clear_input(); - uart_shell_stop(); + if (uart_shell_stop()) { + /* Failed to stop the shell. */ + enable_packet_mode(false); + return CR50_COMM_ERR_UNKNOWN; + } /* * Send packet. No traffic control, assuming Cr50 consumes stream much @@ -106,18 +110,7 @@ static enum cr50_comm_err send_to_cr50(const uint8_t *data, size_t size) res.error = res.error | c << (i*8); break; } - /* - * TODO(b:181352041) Implement proper RX buffering. - * Zephyr's shell (even when "stopped") can steal some - * bytes from the uart RX. Skipping the sleep here - * appears to always let us capture the response. Once - * we're able to fork the shell RX, we'll be able to - * buffer the response and add the sleep back into the - * Zephyr builds here (or alternatively use event - * signals). - */ - if (!IS_ENABLED(CONFIG_ZEPHYR)) - msleep(1); + msleep(1); timeout = timestamp_expired(until, NULL); } } |