summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/m68k/mvme162/console/console.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@oarcorp.com>2012-02-02 14:08:08 -0600
committerJoel Sherrill <joel.sherrill@oarcorp.com>2012-02-02 14:08:08 -0600
commitb3decdb68c0acee5007ceaf655d6c668116c2982 (patch)
tree3391045658b7256e89db2dd45eb57c904cbfd27d /c/src/lib/libbsp/m68k/mvme162/console/console.c
parentPR 1962/bsps - MVME162 Console Corrections and Improvements (diff)
downloadrtems-b3decdb68c0acee5007ceaf655d6c668116c2982.tar.bz2
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 <victor.hoover.ctr@navy.mil>
Diffstat (limited to '')
-rw-r--r--c/src/lib/libbsp/m68k/mvme162/console/console.c48
1 files changed, 47 insertions, 1 deletions
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;
}
/*