From 45544f0d016c4246d9556911afabf106fe6bd7f7 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Wed, 27 Oct 1999 20:50:57 +0000 Subject: Patch from Aleksey (Quality Quorum ) to increase ease of application configuration of the pc386 BSP. This patch allows switching the printk console to a serial port and overriding bsp_start by making it a weak alias. --- c/src/lib/libbsp/i386/pc386/console/console.c | 46 ++++++++++++++++---------- c/src/lib/libbsp/i386/pc386/startup/bspstart.c | 9 ++++- 2 files changed, 36 insertions(+), 19 deletions(-) (limited to 'c/src/lib/libbsp') diff --git a/c/src/lib/libbsp/i386/pc386/console/console.c b/c/src/lib/libbsp/i386/pc386/console/console.c index 3fa6c2217d..a23f46f3cf 100644 --- a/c/src/lib/libbsp/i386/pc386/console/console.c +++ b/c/src/lib/libbsp/i386/pc386/console/console.c @@ -49,16 +49,17 @@ void __assert (const char *file, int line, const char *msg); * BSP_CONSOLE_PORT_CONSOLE * BSP_UART_COM1 * BSP_UART_COM2 - */ - -/* - * Possible value for console input/output : - * BSP_CONSOLE_PORT_CONSOLE - * BSP_UART_COM1 - * BSP_UART_COM2 + * + * Note: + * 1. Currently BSPPrintkPort, cannot be assigned to COM2, + * it will be fixed soon. + * + * 2. If both BSPConsolePort and BSPPrintkport are assigned + * to same serial device it does not work that great */ int BSPConsolePort = BSP_CONSOLE_PORT_CONSOLE; +int BSPPrintkPort = BSP_CONSOLE_PORT_CONSOLE; /* int BSPConsolePort = BSP_UART_COM2; */ int BSPBaseBaud = 115200; @@ -231,17 +232,26 @@ console_initialize(rtems_device_major_number major, { printk("Initialized console on port COM2 9600-8-N-1\n\n"); } -#define PRINTK_ON_SERIAL -#ifdef PRINTK_ON_SERIAL - /* - * You can remove the follwoing tree lines if you want to have printk - * using the video console for output while printf use serial line. - * This may be convenient to debug the serial line driver itself... - */ - /* printk("Warning : This will be the last message displayed on console\n");*/ - BSP_output_char = (BSP_output_char_function_type) BSP_output_char_via_serial; - BSP_poll_char = (BSP_polling_getchar_function_type) BSP_poll_char_via_serial; -#endif + + if(BSPPrintkPort == BSP_UART_COM1) + { + printk("Warning : This will be the last message on console\n"); + + /* + * FIXME: cast below defeats the very idea of having + * function pointer types defined + */ + BSP_output_char = (BSP_output_char_function_type) + BSP_output_char_via_serial; + BSP_poll_char = (BSP_polling_getchar_function_type) + BSP_poll_char_via_serial; + } + else if(BSPPrintkPort != BSP_CONSOLE_PORT_CONSOLE) + { + printk("illegal assignement of projtk channel"); + rtems_fatal_error_occurred (status); + } + } return RTEMS_SUCCESSFUL; } /* console_initialize */ diff --git a/c/src/lib/libbsp/i386/pc386/startup/bspstart.c b/c/src/lib/libbsp/i386/pc386/startup/bspstart.c index a14ff0521f..180dd24ab5 100644 --- a/c/src/lib/libbsp/i386/pc386/startup/bspstart.c +++ b/c/src/lib/libbsp/i386/pc386/startup/bspstart.c @@ -136,7 +136,7 @@ void bsp_pretasking_hook(void) | Arguments: None. | Returns: Nothing. +--------------------------------------------------------------------------*/ -void bsp_start( void ) +void bsp_start_default( void ) { /* * Calibrate variable for 1ms-loop (see timer.c) @@ -207,3 +207,10 @@ void bsp_start( void ) printk( "work_space_size = 0x%x\n", BSP_Configuration.work_space_size ); #endif } /* bsp_start */ + +/* + * By making this a weak alias for bsp_start_default, a brave soul + * can override the actual bsp_start routine used. + */ + +void bsp_start (void) __attribute__ ((weak, alias("bsp_start_default"))); -- cgit v1.2.3