summaryrefslogtreecommitdiff
path: root/chip/stm32/uart.c
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2013-09-13 11:22:19 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2013-09-14 00:32:13 +0000
commit573e695a69ffd8e1bfc5d8507ebc3dfc3e2647ff (patch)
tree15b18c3a5a7e04a3dd4d3ccf8552e85c7e8ef9e7 /chip/stm32/uart.c
parentfa76d68ce9b59b82ef69ed297613c67dd6725964 (diff)
downloadchrome-ec-573e695a69ffd8e1bfc5d8507ebc3dfc3e2647ff.tar.gz
Simplify uart_tx_start()
All calls to it did if (uart_tx_stopped()) uart_tx_start(); And that was the only use of uart_tx_stopped(). Merge the functions. BUG=chrome-os-partner:20485 BRANCH=none TEST=EC debug console still prints output and accepts commands. Ctrl+Q pauses output and Ctrl+S resumes it. Change-Id: I113c64f5fdfc6b02b63034a74b1a3c6c6a76c351 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/169329 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Diffstat (limited to 'chip/stm32/uart.c')
-rw-r--r--chip/stm32/uart.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/chip/stm32/uart.c b/chip/stm32/uart.c
index c848f0b20c..3d510c16f1 100644
--- a/chip/stm32/uart.c
+++ b/chip/stm32/uart.c
@@ -41,6 +41,10 @@ int uart_init_done(void)
void uart_tx_start(void)
{
+ /* If interrupt is already enabled, nothing to do */
+ if (STM32_USART_CR1(UARTN) & UART_TX_INT_ENABLE)
+ return;
+
disable_sleep(SLEEP_MASK_UART);
should_stop = 0;
STM32_USART_CR1(UARTN) |= UART_TX_INT_ENABLE;
@@ -54,11 +58,6 @@ void uart_tx_stop(void)
enable_sleep(SLEEP_MASK_UART);
}
-int uart_tx_stopped(void)
-{
- return !(STM32_USART_CR1(UARTN) & UART_TX_INT_ENABLE);
-}
-
void uart_tx_flush(void)
{
while (!(STM32_USART_SR(UARTN) & STM32_USART_SR_TXE))