summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/mips/jmr3904
diff options
context:
space:
mode:
authorJennifer Averett <jennifer.averett@OARcorp.com>2012-04-04 08:39:46 -0500
committerJoel Sherrill <joel.sherrill@oarcorp.com>2012-04-04 08:43:08 -0500
commit0c0181dee26d64835f0cd4f47ef81f681ea553e8 (patch)
tree2f8aef096fa1ed345176328b805d9bb8394fd2f8 /c/src/lib/libbsp/mips/jmr3904
parentbsp/mpc55xx: Add and use chip features (diff)
downloadrtems-0c0181dee26d64835f0cd4f47ef81f681ea553e8.tar.bz2
PR 1993 - Convert MIPS to PIC IRQ model
Diffstat (limited to 'c/src/lib/libbsp/mips/jmr3904')
-rw-r--r--c/src/lib/libbsp/mips/jmr3904/ChangeLog19
-rw-r--r--c/src/lib/libbsp/mips/jmr3904/Makefile.am19
-rw-r--r--c/src/lib/libbsp/mips/jmr3904/clock/clockdrv.c25
-rw-r--r--c/src/lib/libbsp/mips/jmr3904/include/bsp.h14
-rw-r--r--c/src/lib/libbsp/mips/jmr3904/include/irq.h70
-rw-r--r--c/src/lib/libbsp/mips/jmr3904/irq/vectorisrs.c50
-rw-r--r--c/src/lib/libbsp/mips/jmr3904/preinstall.am12
-rw-r--r--c/src/lib/libbsp/mips/jmr3904/startup/bspstart.c40
8 files changed, 220 insertions, 29 deletions
diff --git a/c/src/lib/libbsp/mips/jmr3904/ChangeLog b/c/src/lib/libbsp/mips/jmr3904/ChangeLog
index a47a0f5891..c26d0b53e1 100644
--- a/c/src/lib/libbsp/mips/jmr3904/ChangeLog
+++ b/c/src/lib/libbsp/mips/jmr3904/ChangeLog
@@ -1,3 +1,22 @@
+2012-03-08 Jennifer Averett <Jennifer.Averett@OARcorp.com>
+
+ * include/bsp.h: Added define for BSP_SHARED_HANDLER_SUPPORT.
+
+2012-03-06 Jennifer Averett <Jennifer.Averett@OARcorp.com>
+
+ PR 1993/bsps
+ * clock/clockdrv.c, include/bsp.h,
+ include/irq.h, irq/vectorisrs.c, startup/bspstart.c:
+ Changed interrupt call, removed warnings and did cleanup.
+
+2012-02-23 Jennifer Averett <Jennifer.Averett@OARcorp.com>
+
+ PR 1993/bsps
+ * Makefile.am, clock/clockdrv.c, include/irq.h,
+ irq/vectorisrs.c, preinstall.am, startup/bspstart.c:
+ Mips conversion to PIC IRQ model.
+ * include/irq.h, irq/vectorisrs.c: New files.
+
2011-12-14 Joel Sherrill <joel.sherrilL@OARcorp.com>
* Makefile.am: Change to one file per line. Clean up.
diff --git a/c/src/lib/libbsp/mips/jmr3904/Makefile.am b/c/src/lib/libbsp/mips/jmr3904/Makefile.am
index 749654644f..540c123215 100644
--- a/c/src/lib/libbsp/mips/jmr3904/Makefile.am
+++ b/c/src/lib/libbsp/mips/jmr3904/Makefile.am
@@ -13,6 +13,10 @@ dist_project_lib_DATA = bsp_specs
include_HEADERS = include/bsp.h
include_HEADERS += include/tm27.h
include_bsp_HEADERS = ../shared/liblnk/regs.h
+#isr
+include_bsp_HEADERS += ../../shared/include/irq-generic.h
+include_bsp_HEADERS += ../../shared/include/irq-info.h
+include_bsp_HEADERS += include/irq.h
nodist_include_HEADERS = include/bspopts.h
nodist_include_bsp_HEADERS = ../../shared/include/bootcard.h
@@ -39,8 +43,6 @@ libbsp_a_SOURCES += ../../shared/bspgetworkarea.c
libbsp_a_SOURCES += startup/bspstart.c
libbsp_a_SOURCES += ../../shared/bootcard.c
libbsp_a_SOURCES += ../../shared/sbrk.c
-libbsp_a_SOURCES += ../../shared/gnatinstallhandler.c
-libbsp_a_SOURCES += ../../shared/setvec.c
libbsp_a_SOURCES += ../../shared/bspreset.c
# clock
libbsp_a_SOURCES += clock/clockdrv.c
@@ -50,11 +52,20 @@ libbsp_a_SOURCES += ../../shared/console-polled.c
libbsp_a_SOURCES += console/console-io.c
# timer
libbsp_a_SOURCES += timer/timer.c
+#isr
+libbsp_a_SOURCES += ../../shared/src/irq-generic.c
+libbsp_a_SOURCES += ../../shared/src/irq-legacy.c
+libbsp_a_SOURCES += ../../shared/src/irq-info.c
+libbsp_a_SOURCES += ../../shared/src/irq-shell.c
+libbsp_a_SOURCES += ../../shared/src/irq-server.c
+libbsp_a_SOURCES += ../shared/irq/vectorexceptions.c
+libbsp_a_SOURCES += ../shared/irq/irq.c
+libbsp_a_SOURCES += ../shared/irq/maxvectors.c
+libbsp_a_SOURCES += irq/vectorisrs.c
+libbsp_a_SOURCES += ../shared/irq/interruptmask.c
libbsp_a_LIBADD = ../../../libcpu/@RTEMS_CPU@/shared/cache.rel
libbsp_a_LIBADD += ../../../libcpu/@RTEMS_CPU@/shared/interrupts.rel
-libbsp_a_LIBADD += ../../../libcpu/@RTEMS_CPU@/tx39/vectorisrs.rel
-libbsp_a_LIBADD += ../../../libcpu/@RTEMS_CPU@/shared/cache.rel
include $(srcdir)/preinstall.am
include $(top_srcdir)/../../../../automake/local.am
diff --git a/c/src/lib/libbsp/mips/jmr3904/clock/clockdrv.c b/c/src/lib/libbsp/mips/jmr3904/clock/clockdrv.c
index d564b0831e..51dcf723a6 100644
--- a/c/src/lib/libbsp/mips/jmr3904/clock/clockdrv.c
+++ b/c/src/lib/libbsp/mips/jmr3904/clock/clockdrv.c
@@ -1,20 +1,24 @@
-/*
+/**
+ * @file
+ *
* Instantiate the clock driver shell.
*
* The TX3904 simulator in gdb counts instructions.
- *
- * COPYRIGHT (c) 1989-2009.
+ */
+
+/*
+ * COPYRIGHT (c) 1989-2012.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
- *
+ *
* $Id$
*/
#include <rtems.h>
-#include <libcpu/tx3904.h>
+#include <bsp/irq.h>
#include <bsp.h>
#define CLOCK_DRIVER_USE_FAST_IDLE
@@ -26,10 +30,17 @@
*/
#define CLICKS 5000
+
#define Clock_driver_support_install_isr( _new, _old ) \
do { \
- _old = set_vector( _new, CLOCK_VECTOR, 1 ); \
- } while(0)
+ rtems_interrupt_handler_install( \
+ CLOCK_VECTOR, \
+ "clock", \
+ 0, \
+ _new, \
+ NULL \
+ ); \
+ } while(0)
#define Clock_driver_support_initialize_hardware() \
do { \
diff --git a/c/src/lib/libbsp/mips/jmr3904/include/bsp.h b/c/src/lib/libbsp/mips/jmr3904/include/bsp.h
index c4e3a36506..0d226a6675 100644
--- a/c/src/lib/libbsp/mips/jmr3904/include/bsp.h
+++ b/c/src/lib/libbsp/mips/jmr3904/include/bsp.h
@@ -1,9 +1,12 @@
-/* bsp.h
- *
+/**
+ * @file
+ *
* This include file contains some definitions specific to the
* JMR3904 simulator in gdb.
- *
- * COPYRIGHT (c) 1989-2000.
+ */
+
+/*
+ * COPYRIGHT (c) 1989-2012.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -28,6 +31,9 @@ extern "C" {
#include <rtems/clockdrv.h>
#include <libcpu/tx3904.h>
+#define BSP_FEATURE_IRQ_EXTENSION
+#define BSP_SHARED_HANDLER_SUPPORT 1
+
/* functions */
rtems_isr_entry set_vector(
diff --git a/c/src/lib/libbsp/mips/jmr3904/include/irq.h b/c/src/lib/libbsp/mips/jmr3904/include/irq.h
new file mode 100644
index 0000000000..0459cba8d5
--- /dev/null
+++ b/c/src/lib/libbsp/mips/jmr3904/include/irq.h
@@ -0,0 +1,70 @@
+/**
+ * @file
+ *
+ * @ingroup bsp_interrupt
+ *
+ * @brief jmr3904 interrupt definitions.
+ */
+
+/*
+ * COPYRIGHT (c) 1989-2012.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#ifndef LIBBSP_MIPS_JMR3904_IRQ_H
+#define LIBBSP_MIPS_JMR3904_IRQ_H
+
+#ifndef ASM
+ #include <rtems.h>
+ #include <rtems/irq.h>
+ #include <rtems/irq-extension.h>
+ #include <rtems/score/mips.h>
+#endif
+
+/**
+ * @addtogroup bsp_interrupt
+ *
+ * @{
+ */
+
+#define BSP_INTERRUPT_VECTOR_MIN 0
+
+/*
+ * Interrupt Vector Numbers
+ *
+ * NOTE: Numbers 0-15 directly map to levels on the IRC.
+ * Number 16 is "1xxxx" per p. 164 of the TX3904 manual.
+ */
+
+ #define TX3904_IRQ_INT1 MIPS_INTERRUPT_BASE+0
+ #define TX3904_IRQ_INT2 MIPS_INTERRUPT_BASE+1
+ #define TX3904_IRQ_INT3 MIPS_INTERRUPT_BASE+2
+ #define TX3904_IRQ_INT4 MIPS_INTERRUPT_BASE+3
+ #define TX3904_IRQ_INT5 MIPS_INTERRUPT_BASE+4
+ #define TX3904_IRQ_INT6 MIPS_INTERRUPT_BASE+5
+ #define TX3904_IRQ_INT7 MIPS_INTERRUPT_BASE+6
+ #define TX3904_IRQ_DMAC3 MIPS_INTERRUPT_BASE+7
+ #define TX3904_IRQ_DMAC2 MIPS_INTERRUPT_BASE+8
+ #define TX3904_IRQ_DMAC1 MIPS_INTERRUPT_BASE+9
+ #define TX3904_IRQ_DMAC0 MIPS_INTERRUPT_BASE+10
+ #define TX3904_IRQ_SIO0 MIPS_INTERRUPT_BASE+11
+ #define TX3904_IRQ_SIO1 MIPS_INTERRUPT_BASE+12
+ #define TX3904_IRQ_TMR0 MIPS_INTERRUPT_BASE+13
+ #define TX3904_IRQ_TMR1 MIPS_INTERRUPT_BASE+14
+ #define TX3904_IRQ_TMR2 MIPS_INTERRUPT_BASE+15
+ #define TX3904_IRQ_INT0 MIPS_INTERRUPT_BASE+16
+ #define TX3904_IRQ_SOFTWARE_1 MIPS_INTERRUPT_BASE+17
+ #define TX3904_IRQ_SOFTWARE_2 MIPS_INTERRUPT_BASE+18
+ #define TX3904_MAXIMUM_VECTORS MIPS_INTERRUPT_BASE+19
+
+#define BSP_INTERRUPT_VECTOR_MAX TX3904_MAXIMUM_VECTORS
+
+/** @} */
+
+#endif /* LIBBSP_MIPS_JMR3904_IRQ_H */
diff --git a/c/src/lib/libbsp/mips/jmr3904/irq/vectorisrs.c b/c/src/lib/libbsp/mips/jmr3904/irq/vectorisrs.c
new file mode 100644
index 0000000000..20b019b865
--- /dev/null
+++ b/c/src/lib/libbsp/mips/jmr3904/irq/vectorisrs.c
@@ -0,0 +1,50 @@
+/**
+ * @file
+ *
+ * TX3904 Interrupt Vectoring
+ */
+
+/*
+ * COPYRIGHT (c) 1989-2012.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include <stdlib.h>
+#include <bsp/irq.h>
+#include <rtems/bspIo.h> /* for printk */
+#include <bsp/irq-generic.h>
+
+void mips_vector_isr_handlers( CPU_Interrupt_frame *frame );
+
+void mips_vector_isr_handlers( CPU_Interrupt_frame *frame )
+{
+ unsigned int sr;
+ unsigned int cause;
+
+ mips_get_sr( sr );
+ mips_get_cause( cause );
+
+ cause &= (sr & SR_IMASK);
+ cause >>= CAUSE_IPSHIFT;
+
+ if ( cause & 0x80 ) /* IP[5] ==> INT0 */
+ bsp_interrupt_handler_dispatch( TX3904_IRQ_INT0 );
+
+ if ( cause & 0x40 ) { /* (IP[4] == 1) ==> IP[0-3] are valid */
+ unsigned int v = (cause >> 2) & 0x0f;
+ bsp_interrupt_handler_dispatch( MIPS_INTERRUPT_BASE + v );
+ }
+
+ if ( cause & 0x02 ) /* SW[0] */
+ bsp_interrupt_handler_dispatch( TX3904_IRQ_SOFTWARE_1 );
+
+ if ( cause & 0x01 ) /* IP[1] */
+ bsp_interrupt_handler_dispatch( TX3904_IRQ_SOFTWARE_2 );
+}
diff --git a/c/src/lib/libbsp/mips/jmr3904/preinstall.am b/c/src/lib/libbsp/mips/jmr3904/preinstall.am
index cdd2c46675..244a22887f 100644
--- a/c/src/lib/libbsp/mips/jmr3904/preinstall.am
+++ b/c/src/lib/libbsp/mips/jmr3904/preinstall.am
@@ -49,6 +49,18 @@ $(PROJECT_INCLUDE)/bsp/regs.h: ../shared/liblnk/regs.h $(PROJECT_INCLUDE)/bsp/$(
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/regs.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/regs.h
+$(PROJECT_INCLUDE)/bsp/irq-generic.h: ../../shared/include/irq-generic.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+ $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/irq-generic.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/irq-generic.h
+
+$(PROJECT_INCLUDE)/bsp/irq-info.h: ../../shared/include/irq-info.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+ $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/irq-info.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/irq-info.h
+
+$(PROJECT_INCLUDE)/bsp/irq.h: include/irq.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+ $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/irq.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/irq.h
+
$(PROJECT_INCLUDE)/bspopts.h: include/bspopts.h $(PROJECT_INCLUDE)/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bspopts.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/bspopts.h
diff --git a/c/src/lib/libbsp/mips/jmr3904/startup/bspstart.c b/c/src/lib/libbsp/mips/jmr3904/startup/bspstart.c
index b6d6cf333a..aba8d43309 100644
--- a/c/src/lib/libbsp/mips/jmr3904/startup/bspstart.c
+++ b/c/src/lib/libbsp/mips/jmr3904/startup/bspstart.c
@@ -1,22 +1,43 @@
-/*
+/**
+ * @file
+ *
* This routine starts the application. It includes application,
* board, and monitor specific initialization and configuration.
* The generic CPU dependent initialization has been performed
* before this routine is invoked.
- *
- * COPYRIGHT (c) 1989-2009.
+ */
+
+/*
+ * COPYRIGHT (c) 1989-2012.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
- *
+ *
* $Id$
*/
#include <bsp.h>
#include <libcpu/isr_entries.h>
#include <bsp/bootcard.h>
+#include <bsp/irq-generic.h>
+#include <bsp/irq.h>
+#include <bsp/irq-generic.h>
+
+/* Structure filled in by get_mem_info. Only the size field is
+ * actually used (to clear bss), so the others aren't even filled in.
+ */
+struct s_mem
+{
+ unsigned int size;
+ unsigned int icsize;
+ unsigned int dcsize;
+};
+
+void bsp_start( void );
+void clear_cache( void *address, size_t n );
+void get_mem_info( struct s_mem *mem );
/*
* bsp_start
@@ -27,7 +48,7 @@ void bsp_start( void )
{
mips_set_sr( 0xff00 ); /* all interrupts unmasked but globally off */
/* depend on the IRC to take care of things */
- mips_install_isr_entries();
+ bsp_interrupt_initialize();
}
/*
@@ -37,15 +58,6 @@ void clear_cache( void *address, size_t n )
{
}
-/* Structure filled in by get_mem_info. Only the size field is
- * actually used (to clear bss), so the others aren't even filled in.
- */
-struct s_mem
-{
- unsigned int size;
- unsigned int icsize;
- unsigned int dcsize;
-};
void get_mem_info(
struct s_mem *mem