From 307b8e54538d95f773134333d295956a0221676e Mon Sep 17 00:00:00 2001 From: Anton Staaf Date: Tue, 26 Apr 2016 09:56:40 -0700 Subject: UART: Remove enable/disable interrupt functions These were not being used and complicate changes to the UART API. Signed-off-by: Anton Staaf BRANCH=None BUG=None TEST=make buildall -j Change-Id: I73e256f09f7ea72f0cc4831cc7ce391a7125e555 Reviewed-on: https://chromium-review.googlesource.com/340841 Commit-Ready: Anton Staaf Tested-by: Anton Staaf Reviewed-by: Aseda Aboagye --- chip/g/uart.c | 9 --------- chip/host/uart.c | 24 +++--------------------- chip/it83xx/uart.c | 10 ---------- chip/lm4/uart.c | 10 ---------- chip/mec1322/uart.c | 10 ---------- chip/npcx/uart.c | 10 ---------- chip/nrf51/uart.c | 14 ++------------ chip/stm32/uart.c | 10 ---------- include/uart.h | 12 ------------ 9 files changed, 5 insertions(+), 104 deletions(-) diff --git a/chip/g/uart.c b/chip/g/uart.c index 24081fbaeb..89d3fa1114 100644 --- a/chip/g/uart.c +++ b/chip/g/uart.c @@ -70,15 +70,6 @@ int uart_read_char(void) } #if USE_UART_INTERRUPTS -void uart_disable_interrupt(void) -{ - uartn_disable_interrupt(UARTN); -} - -void uart_enable_interrupt(void) -{ - uartn_enable_interrupt(UARTN); -} /** * Interrupt handlers for UART0 diff --git a/chip/host/uart.c b/chip/host/uart.c index 73821efe32..9db7f1bfe8 100644 --- a/chip/host/uart.c +++ b/chip/host/uart.c @@ -18,7 +18,6 @@ #include "util.h" static int stopped = 1; -static int int_disabled; static int init_done; static pthread_t input_thread; @@ -65,13 +64,6 @@ static void uart_interrupt(void) uart_process_output(); } -static void trigger_interrupt(void) -{ - if (int_disabled) - return; - task_trigger_test_interrupt(uart_interrupt); -} - int uart_init_done(void) { return init_done; @@ -80,7 +72,7 @@ int uart_init_done(void) void uart_tx_start(void) { stopped = 0; - trigger_interrupt(); + task_trigger_test_interrupt(uart_interrupt); } void uart_tx_stop(void) @@ -125,16 +117,6 @@ int uart_read_char(void) return ret; } -void uart_disable_interrupt(void) -{ - int_disabled = 1; -} - -void uart_enable_interrupt(void) -{ - int_disabled = 0; -} - void uart_inject_char(char *s, int sz) { int i; @@ -146,7 +128,7 @@ void uart_inject_char(char *s, int sz) return; queue_add_units(&cached_char, s + i, num_char); char_available = num_char; - trigger_interrupt(); + task_trigger_test_interrupt(uart_interrupt); } } @@ -176,7 +158,7 @@ void *uart_monitor_stdin(void *d) * input while interrupt handler runs is queued by the * system. */ - trigger_interrupt(); + task_trigger_test_interrupt(uart_interrupt); } return 0; diff --git a/chip/it83xx/uart.c b/chip/it83xx/uart.c index 69c88e93c7..d6bb08fbc1 100644 --- a/chip/it83xx/uart.c +++ b/chip/it83xx/uart.c @@ -92,16 +92,6 @@ int uart_read_char(void) return IT83XX_UART_RBR(UART_PORT); } -void uart_disable_interrupt(void) -{ - task_disable_irq(IT83XX_IRQ_UART1); -} - -void uart_enable_interrupt(void) -{ - task_enable_irq(IT83XX_IRQ_UART1); -} - static void uart_ec_interrupt(void) { uint8_t uart_ier; diff --git a/chip/lm4/uart.c b/chip/lm4/uart.c index 6ceffb4acb..6ef44f8dc4 100644 --- a/chip/lm4/uart.c +++ b/chip/lm4/uart.c @@ -98,16 +98,6 @@ static void uart_clear_rx_fifo(int channel) scratch = LM4_UART_DR(channel); } -void uart_disable_interrupt(void) -{ - task_disable_irq(LM4_IRQ_UART0); -} - -void uart_enable_interrupt(void) -{ - task_enable_irq(LM4_IRQ_UART0); -} - /** * Interrupt handler for UART0 */ diff --git a/chip/mec1322/uart.c b/chip/mec1322/uart.c index d9922b8ca4..ddbe113c7d 100644 --- a/chip/mec1322/uart.c +++ b/chip/mec1322/uart.c @@ -100,16 +100,6 @@ static void uart_clear_rx_fifo(int channel) MEC1322_UART_FCR = (1 << 0) | (1 << 1); } -void uart_disable_interrupt(void) -{ - task_disable_irq(MEC1322_IRQ_UART); -} - -void uart_enable_interrupt(void) -{ - task_enable_irq(MEC1322_IRQ_UART); -} - /** * Interrupt handler for UART */ diff --git a/chip/npcx/uart.c b/chip/npcx/uart.c index 512478b05a..e92b5d18be 100644 --- a/chip/npcx/uart.c +++ b/chip/npcx/uart.c @@ -121,16 +121,6 @@ static void uart_clear_rx_fifo(int channel) } } -void uart_disable_interrupt(void) -{ - task_disable_irq(NPCX_IRQ_UART); -} - -void uart_enable_interrupt(void) -{ - task_enable_irq(NPCX_IRQ_UART); -} - /** * Interrupt handler for UART0 */ diff --git a/chip/nrf51/uart.c b/chip/nrf51/uart.c index 90c1990541..ab52c6ad9a 100644 --- a/chip/nrf51/uart.c +++ b/chip/nrf51/uart.c @@ -80,17 +80,6 @@ int uart_read_char(void) return NRF51_UART_RXD; } -void uart_disable_interrupt(void) -{ - task_disable_irq(NRF51_PERID_USART); -} - -void uart_enable_interrupt(void) -{ - task_enable_irq(NRF51_PERID_USART); -} - - /* Interrupt handler for console USART */ void uart_interrupt(void) { @@ -122,7 +111,8 @@ void uart_init(void) NRF51_UART_BAUDRATE = 0x01d7e000; /* 115200 */ NRF51_UART_ENABLE = 0x4; /* Enable UART */ - uart_enable_interrupt(); + task_enable_irq(NRF51_PERID_USART); + NRF51_UART_INTENSET = (1 << NRF55_UART_RXDRDY_BIT); NRF51_UART_STARTRX = 1; diff --git a/chip/stm32/uart.c b/chip/stm32/uart.c index 2804b3153a..d18b4b781a 100644 --- a/chip/stm32/uart.c +++ b/chip/stm32/uart.c @@ -154,16 +154,6 @@ int uart_read_char(void) return STM32_USART_RDR(UARTN_BASE); } -void uart_disable_interrupt(void) -{ - task_disable_irq(STM32_IRQ_USART(UARTN)); -} - -void uart_enable_interrupt(void) -{ - task_enable_irq(STM32_IRQ_USART(UARTN)); -} - /* Interrupt handler for console USART */ void uart_interrupt(void) { diff --git a/include/uart.h b/include/uart.h index 6499eb9453..c372e3c390 100644 --- a/include/uart.h +++ b/include/uart.h @@ -160,18 +160,6 @@ void uart_write_char(char c); */ int uart_read_char(void); -/** - * Disable all UART related IRQs. - * - * Used to avoid concurrent accesses on UART management variables. - */ -void uart_disable_interrupt(void); - -/** - * Re-enable UART IRQs. - */ -void uart_enable_interrupt(void); - /** * Re-enable the UART transmit interrupt. * -- cgit v1.2.1