diff options
author | Chris Johns <chrisj@rtems.org> | 2016-05-06 17:52:08 +1000 |
---|---|---|
committer | Chris Johns <chrisj@rtems.org> | 2016-05-11 11:45:01 +1000 |
commit | 292dbff0693ac019625d86d8243c513c26479162 (patch) | |
tree | f32da25761b724119df3f6b849f36ea14d39e525 /c/src/lib/libbsp/i386/pc386/console | |
parent | bsp/pc386: Use irq-generic. (diff) | |
download | rtems-292dbff0693ac019625d86d8243c513c26479162.tar.bz2 |
i386/pc386: Fix printk with the console changes.
Diffstat (limited to 'c/src/lib/libbsp/i386/pc386/console')
-rw-r--r-- | c/src/lib/libbsp/i386/pc386/console/printk_support.c | 69 |
1 files changed, 37 insertions, 32 deletions
diff --git a/c/src/lib/libbsp/i386/pc386/console/printk_support.c b/c/src/lib/libbsp/i386/pc386/console/printk_support.c index d4adf555e7..d6dd569301 100644 --- a/c/src/lib/libbsp/i386/pc386/console/printk_support.c +++ b/c/src/lib/libbsp/i386/pc386/console/printk_support.c @@ -27,16 +27,7 @@ #include <libchip/ns16550.h> #include "../../../shared/console_private.h" -rtems_device_minor_number BSPPrintkPort = 0; - -#if (BSP_IS_EDISON == 1) -void edison_write_polled(int minor, char cChar); /* XXX */ -int edison_inbyte_nonblocking_polled(int minor); -#endif - -#if BSP_ENABLE_COM1_COM4 -int ns16550_inbyte_nonblocking_polled( int minor ); -#endif +rtems_device_minor_number BSPPrintkPort = 0; void BSP_outch(char ch); int BSP_inch(void); @@ -44,41 +35,55 @@ int BSP_inch(void); void BSP_outch(char ch) { #if BSP_ENABLE_VGA - if ( BSPPrintkPort == BSP_CONSOLE_VGA ) { - _IBMPC_outch( ch ); - return; - } + bool isVga = BSPPrintkPort == BSP_CONSOLE_VGA; + #else + bool isVga = false; #endif - console_tbl *cptr; - cptr = &Console_Configuration_Ports[BSPPrintkPort]; - cptr->pDeviceFns->deviceWritePolled( BSPPrintkPort, ch ); + if ( !isVga ) { + console_tbl *port = Console_Port_Tbl[BSPPrintkPort]; + if (port->pDeviceFns && port->pDeviceFns->deviceWritePolled) { + port->pDeviceFns->deviceWritePolled( BSPPrintkPort, ch ); + /* + * No termios so expand the LF to LF/CR. + */ + if ( ch == '\n') + port->pDeviceFns->deviceWritePolled( BSPPrintkPort, '\r' ); + } + return; + } + + #if BSP_ENABLE_VGA + _IBMPC_outch( ch ); + #endif } -int BSP_inch(void) +int BSP_inch(void) { - int result = -1; - #if BSP_ENABLE_VGA - if ( BSPPrintkPort == BSP_CONSOLE_VGA ) { - result = BSP_wait_polled_input(); - } else + bool isVga = BSPPrintkPort == BSP_CONSOLE_VGA; + #else + bool isVga = false; #endif - #if BSP_ENABLE_COM1_COM4 - { + + int result = -1; + + if ( !isVga ) { + console_tbl *port = Console_Port_Tbl[BSPPrintkPort]; + if (port->pDeviceFns && port->pDeviceFns->deviceRead) { do { - result = ns16550_inbyte_nonblocking_polled( BSPPrintkPort ); + result = port->pDeviceFns->deviceRead( BSPPrintkPort ); } while (result == -1); + return result; } + } + + #if BSP_ENABLE_VGA + result = BSP_wait_polled_input(); #endif - #if (BSP_IS_EDISON == 1) - do { - result = edison_inbyte_nonblocking_polled( BSPPrintkPort ); - } while (result == -1); - #endif + return result; } BSP_output_char_function_type BSP_output_char = BSP_outch; BSP_polling_getchar_function_type BSP_poll_char = BSP_inch; - |