diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-10-16 14:34:38 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-10-17 09:58:14 +0200 |
commit | d7c13c87728bd4766c7ffe79467267020e37cf98 (patch) | |
tree | f1e72f2dc548cf64e8f0e19a75e8fd01811b786f /bsps | |
parent | 186a0b1dc017b1e2e44620f8d6274dc1c6ba09d1 (diff) |
bsp/imx7: Add getchark() support
Diffstat (limited to 'bsps')
-rw-r--r-- | bsps/arm/imx/console/console-config.c | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/bsps/arm/imx/console/console-config.c b/bsps/arm/imx/console/console-config.c index 0731446f08..8b8d9fbc81 100644 --- a/bsps/arm/imx/console/console-config.c +++ b/bsps/arm/imx/console/console-config.c @@ -64,6 +64,19 @@ static void imx_uart_write_polled(rtems_termios_device_context *base, char c) regs->utxd = IMX_UART_UTXD_TX_DATA(c); } +static int imx_uart_read_polled(rtems_termios_device_context *base) +{ + volatile imx_uart *regs; + + regs = imx_uart_get_regs(base); + + if ((regs->usr2 & IMX_UART_USR2_RDR) != 0) { + return IMX_UART_URXD_RX_DATA_GET(regs->urxd); + } else { + return -1; + } +} + void imx_uart_console_drain(void) { volatile imx_uart *regs; @@ -82,6 +95,11 @@ static void imx_output_char(char c) imx_uart_write_polled(&imx_uart_console->base, c); } +static int imx_poll_char(void) +{ + return imx_uart_read_polled(&imx_uart_console->base); +} + static void imx_uart_init_context( imx_uart_context *ctx, const char *fdt, @@ -147,6 +165,7 @@ static void imx_uart_probe(void) } BSP_output_char = imx_output_char; + BSP_poll_char = imx_poll_char; } static void imx_output_char_init(char c) @@ -315,21 +334,6 @@ static void imx_uart_write( #endif } -#ifndef CONSOLE_USE_INTERRUPTS -static int imx_uart_read(rtems_termios_device_context *base) -{ - volatile imx_uart *regs; - - regs = imx_uart_get_regs(base); - - if ((regs->usr2 & IMX_UART_USR2_RDR) != 0) { - return IMX_UART_URXD_RX_DATA_GET(regs->urxd); - } else { - return -1; - } -} -#endif - static const rtems_termios_device_handler imx_uart_handler = { .first_open = imx_uart_first_open, .last_close = imx_uart_last_close, @@ -338,7 +342,7 @@ static const rtems_termios_device_handler imx_uart_handler = { #ifdef CONSOLE_USE_INTERRUPTS .mode = TERMIOS_IRQ_DRIVEN #else - .poll_read = imx_uart_read, + .poll_read = imx_uart_read_polled, .mode = TERMIOS_POLLED #endif }; |