[rtems commit] PR 1962/bsps - MVME162 Console Corrections and Improvements
Joel Sherrill
joel at rtems.org
Thu Feb 2 20:10:32 UTC 2012
Module: rtems
Branch: master
Commit: b3decdb68c0acee5007ceaf655d6c668116c2982
Changeset: http://git.rtems.org/rtems/commit/?id=b3decdb68c0acee5007ceaf655d6c668116c2982
Author: Joel Sherrill <joel.sherrill at oarcorp.com>
Date: Thu Feb 2 14:08:08 2012 -0600
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 at navy.mil>
---
c/src/lib/libbsp/m68k/mvme162/README | 32 ++++++++++++-
c/src/lib/libbsp/m68k/mvme162/console/console.c | 48 +++++++++++++++++++-
c/src/lib/libbsp/m68k/mvme162/include/bsp.h | 22 +++++++++
.../libbsp/m68k/mvme162/make/custom/mvme162.cfg | 4 +-
c/src/lib/libbsp/m68k/mvme162/startup/bspclean.c | 8 +---
c/src/lib/libbsp/m68k/mvme162/startup/bspstart.c | 12 +-----
6 files changed, 103 insertions(+), 23 deletions(-)
diff --git a/c/src/lib/libbsp/m68k/mvme162/README b/c/src/lib/libbsp/m68k/mvme162/README
index 8d55f46..c2b3d4a 100644
--- a/c/src/lib/libbsp/m68k/mvme162/README
+++ b/c/src/lib/libbsp/m68k/mvme162/README
@@ -11,14 +11,40 @@
-- $Id$
--
+
MVME162 Models
--------------
-MVME162 model uses 68040.
+There are three different models of the MVME162 board. There are many
+variations within each model.
+
+ Model Variants
+ --------- --------------------------------------------------
+ MVME162 MVME162-0xx
+ MVME162FX MVME162-4xx, MVME162-5xx
+ MVME162LX MVME162-2xx, MVME162-3xx, MVME162-7xx, MVME162-8xx
+
+All models use either an MC68040 or MC68LC040 (no FPU) processors. The
+processor used varies by variant as does the speed, the amount and type
+of memory and the I/O devices (serial, ethernet, SCSI and VME). See the
+README.models file for details.
+
+
+Configuring the BSP
+-------------------
+The BSP needs to be configured for your specific board. The following
+files need to be modified.
+
+include/bsp.h
+Change the MOT_162BUG_VEC_ADDRESS define to start of memory for your
+board
+
+make/custom/mvme162.cfg
+If your board has an MC68040 processor
+- change the value of RTEMS_CPU_MODEL
+- remove the -msoft-float flag from CPU_CFLAGS
-MVME162FX model uses XXX.
-MVME162LX model uses 68LC040.
MVME162FX and DMA on the IP bus
-------------------------------
diff --git a/c/src/lib/libbsp/m68k/mvme162/console/console.c b/c/src/lib/libbsp/m68k/mvme162/console/console.c
index 6ace676..c5ce00c 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;
}
/*
diff --git a/c/src/lib/libbsp/m68k/mvme162/include/bsp.h b/c/src/lib/libbsp/m68k/mvme162/include/bsp.h
index 054937a..b043c2c 100644
--- a/c/src/lib/libbsp/m68k/mvme162/include/bsp.h
+++ b/c/src/lib/libbsp/m68k/mvme162/include/bsp.h
@@ -163,6 +163,28 @@ typedef volatile struct {
#define EXTERN extern
#endif
+
+/*
+ * This value is the default address location of the 162Bug vector table
+ * and is also the default start address of the boards DRAM. This value
+ * may be different for your specific board based on a number of factors:
+ *
+ * Default DRAM address: 0x00000000
+ * Default SRAM address: 0xFFE00000
+ *
+ * o If no DRAM can be found by the 162Bug program, it will use SRAM.
+ * o The default SRAM address may be different if SRAM mezzanine boards
+ * are installed on the main board.
+ * o Both the DRAM and SRAM addresses can be modified by changing the
+ * appropriate values in NVRAM using the ENV command at the 162Bug
+ * prompt.
+ *
+ * If your board has different values than the defaults, change the value
+ * of the following define.
+ *
+ */
+#define MOT_162BUG_VEC_ADDRESS 0x00000000
+
extern m68k_isr_entry M68Kvec[]; /* vector table address */
/* functions */
diff --git a/c/src/lib/libbsp/m68k/mvme162/make/custom/mvme162.cfg b/c/src/lib/libbsp/m68k/mvme162/make/custom/mvme162.cfg
index 329c3d5..a754945 100644
--- a/c/src/lib/libbsp/m68k/mvme162/make/custom/mvme162.cfg
+++ b/c/src/lib/libbsp/m68k/mvme162/make/custom/mvme162.cfg
@@ -9,13 +9,13 @@ include $(RTEMS_ROOT)/make/custom/default.cfg
RTEMS_CPU=m68k
RTEMS_MVME162_MODEL=mvme162
-RTEMS_CPU_MODEL=m68040
+RTEMS_CPU_MODEL=m68lc040
# This contains the compiler options necessary to select the CPU model
# and (hopefully) optimize for it.
#
-CPU_CFLAGS = -mcpu=68040
+CPU_CFLAGS = -mcpu=68040 -msoft-float
# optimize flag: typically -O2
CFLAGS_OPTIMIZE_V = -O2 -g -fomit-frame-pointer
diff --git a/c/src/lib/libbsp/m68k/mvme162/startup/bspclean.c b/c/src/lib/libbsp/m68k/mvme162/startup/bspclean.c
index baa1536..07adb1e 100644
--- a/c/src/lib/libbsp/m68k/mvme162/startup/bspclean.c
+++ b/c/src/lib/libbsp/m68k/mvme162/startup/bspclean.c
@@ -29,12 +29,8 @@ void bsp_return_to_monitor_trap(void)
{
page_table_teardown();
- lcsr->intr_ena = 0; /* disable interrupts */
-#if defined(mvme162lx)
- m68k_set_vbr(0x00000000); /* restore 162Bug vectors */
-#else
- m68k_set_vbr(0xFFE00000); /* restore 162Bug vectors */
-#endif
+ lcsr->intr_ena = 0; /* disable interrupts */
+ m68k_set_vbr(MOT_162BUG_VEC_ADDRESS); /* restore 162Bug vectors */
__asm__ volatile( "trap #15" ); /* trap to 162Bug */
__asm__ volatile( ".short 0x63" ); /* return to 162Bug (.RETURN) */
diff --git a/c/src/lib/libbsp/m68k/mvme162/startup/bspstart.c b/c/src/lib/libbsp/m68k/mvme162/startup/bspstart.c
index a5c980a..7e23b53 100644
--- a/c/src/lib/libbsp/m68k/mvme162/startup/bspstart.c
+++ b/c/src/lib/libbsp/m68k/mvme162/startup/bspstart.c
@@ -34,17 +34,7 @@ void bsp_start( void )
m68k_isr_entry *monitors_vector_table;
int index;
- /*
- * 162Bug Vectors are at 0xFFE00000
- * 162Bug Vectors on LX are at 0x00000000
- */
-
-#if defined(mvme162lx)
- monitors_vector_table = (m68k_isr_entry *)0x00000000;
-#else
- monitors_vector_table = (m68k_isr_entry *)0xFFE00000;
-#endif
-
+ monitors_vector_table = (m68k_isr_entry *)MOT_162BUG_VEC_ADDRESS;
m68k_set_vbr( monitors_vector_table );
for ( index=2 ; index<=255 ; index++ )
More information about the vc
mailing list