diff options
Diffstat (limited to 'src/target/firmware/board/mediatek')
-rw-r--r-- | src/target/firmware/board/mediatek/uart.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/target/firmware/board/mediatek/uart.c b/src/target/firmware/board/mediatek/uart.c index 8e86b204..f9e3283b 100644 --- a/src/target/firmware/board/mediatek/uart.c +++ b/src/target/firmware/board/mediatek/uart.c @@ -191,7 +191,7 @@ static uint8_t uart_reg_read(int uart, enum uart_reg reg) static void uart_irq_handler_cons(__unused int irqnr) { - const uint8_t uart = CONS_UART_NR; + const uint8_t uart = cons_get_uart(); uint8_t iir; //uart_putchar_nb(uart, 'U'); @@ -224,7 +224,7 @@ static void uart_irq_handler_cons(__unused int irqnr) static void uart_irq_handler_sercomm(__unused int irqnr) { - const uint8_t uart = SERCOMM_UART_NR; + const uint8_t uart = sercomm_get_uart(); uint8_t iir, ch; //uart_putchar_nb(uart, 'U'); @@ -274,11 +274,13 @@ void uart_init(uint8_t uart, __unused uint8_t interrupts) /* no interrupts, only polling so far */ uart_reg_write(uart, IER, 0x00); - if (uart == CONS_UART_NR) { + if (uart == cons_get_uart()) { cons_init(); - } else { + } else if (uart == sercomm_get_uart()) { sercomm_init(); uart_irq_enable(uart, UART_IRQ_RX_CHAR, 1); + } else { + return; } uart_reg_write(uart, AUTOBAUD_EN, 0x00); /* disable AUTOBAUD */ @@ -301,7 +303,7 @@ void uart_init(uint8_t uart, __unused uint8_t interrupts) } void uart_poll(uint8_t uart) { - if(uart == CONS_UART_NR) { + if(uart == cons_get_uart()) { uart_irq_handler_cons(0); } else { uart_irq_handler_sercomm(0); |