From c75430cd4146455f30fac193edaf26d6b0fde703 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Thu, 2 Feb 2012 14:08:08 -0600 Subject: PR 1962/bsps - MVME162 Console Corrections and Improvements * console/console.c: char_ready() was never returning true so console never processed input data * console/console.c: added printk() support to default device * include/bsp.h: Added #define for MOT_162BUG_VEC_ADDRESS * startup/bspclean.c: Modified to use MOT_162BUG_VEC_ADDRESS * startup/bspstart.c: Modified to use MOT_162BUG_VEC_ADDRESS * make/custom/mvme162.cfg: Modified to use "RTEMS_CPU_MODEL=68lc040" and "CPU_CFLAGS = -mcpu=68040 -msoft-float" so BSP will always work with all board variations. * README: Added notes on user required configuration changes and information about board models and variants * README.models: New file that contains a detailed list of MVME162 models and variants. Signed-off-by: Vic Hoover --- c/src/lib/libbsp/m68k/mvme162/console/console.c | 48 ++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) (limited to 'c/src/lib/libbsp/m68k/mvme162/console/console.c') diff --git a/c/src/lib/libbsp/m68k/mvme162/console/console.c b/c/src/lib/libbsp/m68k/mvme162/console/console.c index 6ace676400..c5ce00ca7c 100644 --- a/c/src/lib/libbsp/m68k/mvme162/console/console.c +++ b/c/src/lib/libbsp/m68k/mvme162/console/console.c @@ -26,6 +26,14 @@ Ring_buffer_t Console_Buffer[2]; +static bool Console_Is_Initialized = false; + +/* Printk function */ +static void _162Bug_output_char( char c ); +static void _BSP_output_char( char c ); +BSP_output_char_function_type BSP_output_char = _BSP_output_char; + + /* * Interrupt handler for receiver interrupts */ @@ -49,6 +57,44 @@ rtems_isr C_Receive_ISR(rtems_vector_number vector) } } + +/* + * _162Bug_output_char + * + * Output a single character using the 162Bug functions. The character + * will be written to the default output port. + */ + +void _162Bug_output_char( char c ) +{ + asm volatile( "moveb %0, -(%%sp)\n\t" /* char to output */ + "trap #15\n\t" /* Trap to 162Bug */ + ".short 0x20" /* Code for .OUTCHR */ + :: "d" (c) ); +} + + +/* + * _BSP_output_char + * + * printk() function prototyped in bspIo.h. Does not use termios. + * + * If we have initialized the console device then use it, otherwise + * use the 162Bug routines to send it to the default output port. + */ + +void _BSP_output_char(char c) +{ + if (Console_Is_Initialized) + putchar(c); + else + _162Bug_output_char(c); + + if ('\n' == c) + _BSP_output_char('\r'); +} + + rtems_device_driver console_initialize( rtems_device_major_number major, rtems_device_minor_number minor, @@ -117,7 +163,7 @@ bool char_ready(int port, char *ch) Ring_buffer_Remove_character( &Console_Buffer[port], *ch ); - return false; + return true; } /* -- cgit v1.2.3