summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDawid Niedzwiecki <dn@semihalf.com>2021-07-13 15:09:05 +0200
committerCommit Bot <commit-bot@chromium.org>2021-07-15 06:54:38 +0000
commit3bdfb9ef4acd666fd69bac40cc25f06b903a67bc (patch)
treef4175ba913df4677752290ead0264711b3c82b13
parent66ba579f6657351725564ccb99d6db5083d2549e (diff)
downloadchrome-ec-3bdfb9ef4acd666fd69bac40cc25f06b903a67bc.tar.gz
zephyr: fix uart output flush
Make sure the whole UART buffer/fifo is flushed in the uart_flush_output function by checking the interrupt state. The shell_process function only passes data from shell layer to the shell_trasport layer(UART) which has its own buffers. The bug was impacting e.g. hibernating. BUG=b:191724484, b:193482737 BRANCH=none TEST=Verify the console output and hibernate works Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com> Change-Id: Iaf245809be57fdba69c6a5a69d394f024ccf60ae Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3024264 Reviewed-by: CH Lin <chlin56@nuvoton.com> Reviewed-by: Keith Short <keithshort@chromium.org>
-rw-r--r--zephyr/shim/src/console.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/zephyr/shim/src/console.c b/zephyr/shim/src/console.c
index 241c6f104b..ae3ae51deb 100644
--- a/zephyr/shim/src/console.c
+++ b/zephyr/shim/src/console.c
@@ -226,10 +226,16 @@ void uart_write_char(char c)
void uart_flush_output(void)
{
shell_process(shell_zephyr);
+ uart_tx_flush();
}
void uart_tx_flush(void)
{
+ const struct device *dev =
+ device_get_binding(CONFIG_UART_SHELL_ON_DEV_NAME);
+
+ while (!uart_irq_tx_complete(dev))
+ ;
}
int uart_getc(void)