From 61ba976360804d85f9203821518bb4b132852188 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Tue, 22 Feb 2000 18:39:52 +0000 Subject: New port of RTEMS to TI C3x and C4x. --- c/src/lib/libbsp/c4x/shared/Makefile.am | 11 ++++ c/src/lib/libbsp/c4x/shared/bspspuriousinit.c | 45 ++++++++++++++ c/src/lib/libbsp/c4x/shared/c3xspurious.c | 85 +++++++++++++++++++++++++++ c/src/lib/libbsp/c4x/shared/c4xspurious.c | 79 +++++++++++++++++++++++++ 4 files changed, 220 insertions(+) create mode 100644 c/src/lib/libbsp/c4x/shared/Makefile.am create mode 100644 c/src/lib/libbsp/c4x/shared/bspspuriousinit.c create mode 100644 c/src/lib/libbsp/c4x/shared/c3xspurious.c create mode 100644 c/src/lib/libbsp/c4x/shared/c4xspurious.c (limited to 'c/src/lib/libbsp/c4x/shared') diff --git a/c/src/lib/libbsp/c4x/shared/Makefile.am b/c/src/lib/libbsp/c4x/shared/Makefile.am new file mode 100644 index 0000000000..6593a82031 --- /dev/null +++ b/c/src/lib/libbsp/c4x/shared/Makefile.am @@ -0,0 +1,11 @@ +## +## $Id$ +## + +AUTOMAKE_OPTIONS = foreign 1.4 + +C_FILES = bspspuriousinit.c c3xspurious.c c4xspurious.c + +EXTRA_DIST = bspspuriousinit.c c3xspurious.c c4xspurious.c + +include $(top_srcdir)/../../../../../automake/local.am diff --git a/c/src/lib/libbsp/c4x/shared/bspspuriousinit.c b/c/src/lib/libbsp/c4x/shared/bspspuriousinit.c new file mode 100644 index 0000000000..9573b6bfcc --- /dev/null +++ b/c/src/lib/libbsp/c4x/shared/bspspuriousinit.c @@ -0,0 +1,45 @@ +/* + * CXX Spurious Trap Handler Install Routine + * + * This is just enough of a trap handler to let us know what + * the likely source of the trap was. + * + * COPYRIGHT (c) 1989-1999. + * 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.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include +#include +#include + +/* + * bsp_spurious_initialize + * + * Install the spurious handler for most vectors. + */ + +rtems_isr bsp_spurious_handler( + rtems_vector_number vector, + CPU_Interrupt_frame *isf +); + +void bsp_spurious_initialize() +{ + rtems_unsigned32 vector; + + for ( vector=0 ; vector<64 ; vector++ ) { + + /* + * Skip any vectors that might be generally used for traps. + */ + + set_vector( bsp_spurious_handler, vector, 1 ); + } + +} diff --git a/c/src/lib/libbsp/c4x/shared/c3xspurious.c b/c/src/lib/libbsp/c4x/shared/c3xspurious.c new file mode 100644 index 0000000000..fb14a76d4e --- /dev/null +++ b/c/src/lib/libbsp/c4x/shared/c3xspurious.c @@ -0,0 +1,85 @@ +/* + * C3X Spurious Trap Handler + * + * This is just enough of a trap handler to let us know what + * the likely source of the trap was. + * + * COPYRIGHT (c) 1989-1999. + * 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.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include +#include + +/* + * bsp_spurious_handler + * + * Print a message on the debug console and then die + */ + +void bsp_spurious_handler_assistant( + rtems_vector_number, + CPU_Interrupt_frame * +); + +#if defined(_C3x) +rtems_isr bsp_spurious_handler( + rtems_vector_number vector, + CPU_Interrupt_frame *isf +) +{ + char *s; + + printk( "Unexpected interrupt (0x%x)\n", vector ); + printk( "It looks like we got the interrupt at 0x%x\n", isf->interrupted ); + + /* + * Can we print a name? + */ + + s = 0; + if ( vector <= 0x1f ) { + switch ( vector ) { +#if defined(_C30) || defined(_C31) + case 0: s = "RESET"; break; +#endif + case 1: s = "INT0"; break; + case 2: s = "INT1"; break; + case 3: s = "INT2"; break; + case 4: s = "INT3"; break; + case 5: s = "XINT0"; break; + case 6: s = "RINT0"; break; +#if defined(_C30) || defined(_C31) + case 7: s = "XINT1"; break; + case 8: s = "RINT1"; break; +#endif + case 9: s = "TINT0"; break; + case 0x0a: s = "TINT1"; break; + case 0x0b: s = "DINT0"; break; +#if defined(_C32) + case 0x0c: s = "DINT1"; break; +#endif + default: s = "Reserved"; break; + } + printk( "Looks like it was an %s\n", s ); + } else { + printk( "Looks like it was a TRAP%d\n", vector - 0x20 ); +#if defined(_C30) || defined(_C31) + if ( vector > 0x3B ) + printk( "But TRAP27 - TRAP31 are reserved\n" ); +#endif + } + + /* + * Now call the BSP specific routine + */ + + bsp_spurious_handler_assistant( vector, isf ); +} +#endif diff --git a/c/src/lib/libbsp/c4x/shared/c4xspurious.c b/c/src/lib/libbsp/c4x/shared/c4xspurious.c new file mode 100644 index 0000000000..02320af7ea --- /dev/null +++ b/c/src/lib/libbsp/c4x/shared/c4xspurious.c @@ -0,0 +1,79 @@ +/* + * C4X Spurious Trap Handler + * + * This is just enough of a trap handler to let us know what + * the likely source of the trap was. + * + * COPYRIGHT (c) 1989-1999. + * 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.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include +#include + +/* + * bsp_spurious_handler + * + * Print a message on the debug console and then die + */ + +void bsp_spurious_handler_assistant( + rtems_vector_number, + CPU_Interrupt_frame * +); + +#if defined(_C4x) +rtems_isr bsp_spurious_handler( + rtems_vector_number vector, + CPU_Interrupt_frame *isf +) +{ + char *s; + + printk( "Unexpected interrupt (0x%x)\n", vector ); + printk( "It looks like we got the interrupt at 0x%x\n", isf->interrupted ); + + /* + * Can we print a name? + */ + + printk( "Looks like it was a " ); + if ( vector >= 0x0d && vector <= 0x24 ) { + switch ( vector & 0x3 ) { + case 1: s = "ICFULL"; break; + case 2: s = "ICRDY"; break; + case 3: s = "OCRDY"; break; + case 0: s = "OCEMPTY"; break; + } + printk( "%s%d\n", s, (vector - 0x0d) / 4 ); + } else if ( vector >= 0x25 && vector <= 0x2a ) { + printk( "DMA INT%d\n", (vector - 0x25) ); + } else /* if ( vector <= 0x0c || vector >= 0x2b ) */ { + switch ( vector ) { + case 0: s = "RESET"; break; + case 1: s = "NMI"; break; + case 2: s = "TINT0"; break; + case 3: s = "IIOF0"; break; + case 4: s = "IIOF1"; break; + case 5: s = "IIOF2"; break; + case 6: s = "IIOF3"; break; + case 0x2b: s = "TINT1"; break; + case 0x3f: s = "Reserved"; break; + default: s = "Unused"; break; + } + printk( "%s\n", s ); + } + + /* + * Now call the BSP specific routine + */ + + bsp_spurious_handler_assistant( vector, isf ); +} +#endif -- cgit v1.2.3