source: rtems/c/src/lib/libbsp/sparc/leon3/startup/spurious.c @ ae55da72

4.115
Last change on this file since ae55da72 was 9b4422a2, checked in by Joel Sherrill <joel.sherrill@…>, on 05/03/12 at 15:09:24

Remove All CVS Id Strings Possible Using a Script

Script does what is expected and tries to do it as
smartly as possible.

+ remove occurrences of two blank comment lines

next to each other after Id string line removed.

+ remove entire comment blocks which only exited to

contain CVS Ids

+ If the processing left a blank line at the top of

a file, it was removed.

  • Property mode set to 100644
File size: 4.0 KB
Line 
1/*
2 *  LEON Spurious Trap Handler
3 *
4 *  This is just enough of a trap handler to let us know what
5 *  the likely source of the trap was.
6 *
7 *  Developed as part of the port of RTEMS to the LEON implementation
8 *  of the SPARC by On-Line Applications Research Corporation (OAR)
9 *  under contract to the European Space Agency (ESA).
10 *
11 *  COPYRIGHT (c) 1995. European Space Agency.
12 *
13 *  Modified for LEON3 BSP.
14 *  COPYRIGHT (c) 2004.
15 *  Gaisler Research.
16 *
17 *  This terms of the RTEMS license apply to this file.
18 */
19
20#include <bsp.h>
21
22#include <rtems/bspIo.h>
23
24/*
25 *  bsp_spurious_handler
26 *
27 *  Print a message on the debug console and then die
28 */
29
30rtems_isr bsp_spurious_handler(
31   rtems_vector_number trap,
32   CPU_Interrupt_frame *isf
33)
34{
35  uint32_t real_trap;
36
37  real_trap = SPARC_REAL_TRAP_NUMBER(trap);
38
39  printk( "Unexpected trap (0x%02x) at address 0x%08x\n", real_trap, isf->tpc);
40
41  switch (real_trap) {
42
43    /*
44     *  First the ones defined by the basic architecture
45     */
46
47    case 0x00:
48      printk( "reset\n" );
49      break;
50    case 0x01:
51      printk( "instruction access exception\n" );
52      break;
53    case 0x02:
54      printk( "illegal instruction\n" );
55      break;
56    case 0x03:
57      printk( "privileged instruction\n" );
58      break;
59    case 0x04:
60      printk( "fp disabled\n" );
61      break;
62    case 0x07:
63      printk( "memory address not aligned\n" );
64      break;
65    case 0x08:
66      printk( "fp exception\n" );
67      break;
68    case 0x09:
69      printk( "Unexpected trap (0x%2d) at address XXX\n",
70        real_trap
71        /* XXX FIXME isf->tpc */
72      );
73      break;
74    case 0x0A:
75      printk( "tag overflow\n" );
76      break;
77
78    /*
79     *  Then the ones defined by the LEON in particular
80     */
81      /* FIXME */
82
83      /*
84    case LEON_TRAP_TYPE( LEON_INTERRUPT_CORRECTABLE_MEMORY_ERROR ):
85      printk( "LEON_INTERRUPT_CORRECTABLE_MEMORY_ERROR\n" );
86      break;
87    case LEON_TRAP_TYPE( LEON_INTERRUPT_UART_2_RX_TX ):
88      printk( "LEON_INTERRUPT_UART_2_RX_TX\n" );
89      break;
90    case LEON_TRAP_TYPE( LEON_INTERRUPT_UART_1_RX_TX ):
91      printk( "LEON_INTERRUPT_UART_1_RX_TX\n" );
92      break;
93    case LEON_TRAP_TYPE( LEON_INTERRUPT_EXTERNAL_0 ):
94      printk( "LEON_INTERRUPT_EXTERNAL_0\n" );
95      break;
96    case LEON_TRAP_TYPE( LEON_INTERRUPT_EXTERNAL_1 ):
97      printk( "LEON_INTERRUPT_EXTERNAL_1\n" );
98      break;
99    case LEON_TRAP_TYPE( LEON_INTERRUPT_EXTERNAL_2 ):
100      printk( "LEON_INTERRUPT_EXTERNAL_2\n" );
101      break;
102    case LEON_TRAP_TYPE( LEON_INTERRUPT_EXTERNAL_3 ):
103      printk( "LEON_INTERRUPT_EXTERNAL_3\n" );
104      break;
105    case LEON_TRAP_TYPE( LEON_INTERRUPT_TIMER1 ):
106      printk( "LEON_INTERRUPT_TIMER1\n" );
107      break;
108    case LEON_TRAP_TYPE( LEON_INTERRUPT_TIMER2 ):
109      printk( "LEON_INTERRUPT_TIMER2\n" );
110      break;
111      */
112
113    default:
114      break;
115  }
116
117  /*
118   *  What else can we do but stop ...
119   */
120
121  __asm__ volatile( "mov 1, %g1; ta 0x0" );
122}
123
124/*
125 *  bsp_spurious_initialize
126 *
127 *  Install the spurious handler for most traps. Note that set_vector()
128 *  will unmask the corresponding asynchronous interrupt, so the initial
129 *  interrupt mask is restored after the handlers are installed.
130 */
131
132void bsp_spurious_initialize()
133{
134  uint32_t trap;
135  uint32_t level;
136  /* uint32_t mask; */
137
138  level = sparc_disable_interrupts();
139  /* mask = LEON3_IrqCtrl_Regs->mask_p0; */
140
141  for ( trap=0 ; trap<256 ; trap++ ) {
142
143    /*
144     *  Skip window overflow, underflow, and flush as well as software
145     *  trap 0 which we will use as a shutdown. Also avoid trap 0x70 - 0x7f
146     *  which cannot happen and where some of the space is used to pass
147     *  paramaters to the program.
148     */
149
150    if (( trap == 5 || trap == 6 ) ||
151        (( trap >= 0x11 ) && ( trap <= 0x1f )) ||
152        (( trap >= 0x70 ) && ( trap <= 0x83 )))
153      continue;
154
155    set_vector(
156        (rtems_isr_entry) bsp_spurious_handler,
157        SPARC_SYNCHRONOUS_TRAP( trap ),
158        1
159    );
160  }
161
162  /* LEON3_IrqCtrl_Regs->mask_p0 = mask; */
163  sparc_enable_interrupts(level);
164
165}
Note: See TracBrowser for help on using the repository browser.