From c058908e5f8514d0c78b8b392dc2d73b077a0e26 Mon Sep 17 00:00:00 2001 From: Jett Rink Date: Wed, 29 May 2019 15:00:41 -0600 Subject: ish: remove unnecessary task switch for UART When starting to send UART data, we do not need to invoke the ISR for the UART. That only needs to be invoked if there is incoming RX messages (which it still is invoked) or the FIFO can accept more data and was full before. BRANCH=none BUG=none TEST=console input and output still works and takes much less time. Change-Id: Ib05c66ee704aad2d93836709bc6b706c627285c5 Signed-off-by: Jett Rink Reviewed-on: https://chromium-review.googlesource.com/1634620 Commit-Ready: ChromeOS CL Exonerator Bot Legacy-Commit-Queue: Commit Bot Reviewed-by: Jack Rosenthal Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1643845 --- chip/ish/uart.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/chip/ish/uart.c b/chip/ish/uart.c index e512b53588..1e5963daf2 100644 --- a/chip/ish/uart.c +++ b/chip/ish/uart.c @@ -73,8 +73,6 @@ void uart_tx_start(void) disable_sleep(SLEEP_MASK_UART); IER(ISH_DEBUG_UART) |= IER_TDRQ; - - task_trigger_irq(ISH_DEBUG_UART_IRQ); } } @@ -98,7 +96,7 @@ void uart_tx_flush(void) int uart_tx_ready(void) { - return 1; + return LSR(ISH_DEBUG_UART) & LSR_TDRQ; } int uart_rx_available(void) @@ -112,7 +110,7 @@ int uart_rx_available(void) void uart_write_char(char c) { /* Wait till reciever is ready */ - while ((LSR(ISH_DEBUG_UART) & LSR_TEMT) == 0) + while (!uart_tx_ready()) continue; THR(ISH_DEBUG_UART) = c; -- cgit v1.2.1