source: rtems/c/src/lib/libbsp/sparc/erc32/startup/spurious.c @ d2202ac

4.115
Last change on this file since d2202ac 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.6 KB
Line 
1/*
2 *  ERC32 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 ERC32 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 *  This terms of the RTEMS license apply to this file.
14 */
15
16#include <bsp.h>
17#include <rtems/bspIo.h>
18
19/*
20 *  bsp_spurious_handler
21 *
22 *  Print a message on the debug console and then die
23 */
24
25rtems_isr bsp_spurious_handler(
26   rtems_vector_number trap,
27   CPU_Interrupt_frame *isf
28)
29{
30  uint32_t         real_trap;
31
32  real_trap = SPARC_REAL_TRAP_NUMBER(trap);
33
34  printk( "Unexpected trap (%2d) at address 0x%08x\n", real_trap, isf->tpc);
35
36  switch (real_trap) {
37
38    /*
39     *  First the ones defined by the basic architecture
40     */
41
42    case 0x00:
43      printk( "reset\n" );
44      break;
45    case 0x01:
46      printk( "instruction access exception\n" );
47      break;
48    case 0x02:
49      printk( "illegal instruction\n" );
50      break;
51    case 0x03:
52      printk( "privileged instruction\n" );
53      break;
54    case 0x04:
55      printk( "fp disabled\n" );
56      break;
57    case 0x07:
58      printk( "memory address not aligned\n" );
59      break;
60    case 0x08:
61      printk( "fp exception\n" );
62      break;
63    case 0x09:
64      printk("data access exception at 0x%08x\n",
65        ERC32_MEC.First_Failing_Address );
66      break;
67    case 0x0A:
68      printk( "tag overflow\n" );
69      break;
70
71    /*
72     *  Then the ones defined by the ERC32 in particular
73     */
74
75    case ERC32_TRAP_TYPE( ERC32_INTERRUPT_MASKED_ERRORS ):
76      printk( "ERC32_INTERRUPT_MASKED_ERRORS\n" );
77      break;
78    case ERC32_TRAP_TYPE( ERC32_INTERRUPT_EXTERNAL_1 ):
79      printk( "ERC32_INTERRUPT_EXTERNAL_1\n" );
80      break;
81    case ERC32_TRAP_TYPE( ERC32_INTERRUPT_EXTERNAL_2 ):
82      printk( "ERC32_INTERRUPT_EXTERNAL_2\n" );
83      break;
84    case ERC32_TRAP_TYPE( ERC32_INTERRUPT_UART_A_RX_TX ):
85      printk( "ERC32_INTERRUPT_UART_A_RX_TX\n" );
86      break;
87    case ERC32_TRAP_TYPE( ERC32_INTERRUPT_UART_B_RX_TX ):
88      printk( "ERC32_INTERRUPT_UART_A_RX_TX\n" );
89      break;
90    case ERC32_TRAP_TYPE( ERC32_INTERRUPT_CORRECTABLE_MEMORY_ERROR ):
91      printk( "ERC32_INTERRUPT_CORRECTABLE_MEMORY_ERROR\n" );
92      break;
93    case ERC32_TRAP_TYPE( ERC32_INTERRUPT_UART_ERROR ):
94      printk( "ERC32_INTERRUPT_UART_ERROR\n" );
95      break;
96    case ERC32_TRAP_TYPE( ERC32_INTERRUPT_DMA_ACCESS_ERROR ):
97      printk( "ERC32_INTERRUPT_DMA_ACCESS_ERROR\n" );
98      break;
99    case ERC32_TRAP_TYPE( ERC32_INTERRUPT_DMA_TIMEOUT ):
100      printk( "ERC32_INTERRUPT_DMA_TIMEOUT\n" );
101      break;
102    case ERC32_TRAP_TYPE( ERC32_INTERRUPT_EXTERNAL_3 ):
103      printk( "ERC32_INTERRUPT_EXTERNAL_3\n" );
104      break;
105    case ERC32_TRAP_TYPE( ERC32_INTERRUPT_EXTERNAL_4 ):
106      printk( "ERC32_INTERRUPT_EXTERNAL_4\n" );
107      break;
108    case ERC32_TRAP_TYPE( ERC32_INTERRUPT_GENERAL_PURPOSE_TIMER ):
109      printk( "ERC32_INTERRUPT_GENERAL_PURPOSE_TIMER\n" );
110      break;
111    case ERC32_TRAP_TYPE( ERC32_INTERRUPT_REAL_TIME_CLOCK ):
112      printk( "ERC32_INTERRUPT_REAL_TIME_CLOCK\n" );
113      break;
114    case ERC32_TRAP_TYPE( ERC32_INTERRUPT_EXTERNAL_5 ):
115      printk( "ERC32_INTERRUPT_EXTERNAL_5\n" );
116      break;
117    case ERC32_TRAP_TYPE( ERC32_INTERRUPT_WATCHDOG_TIMEOUT ):
118      printk( "ERC32_INTERRUPT_WATCHDOG_TIMEOUT\n" );
119      break;
120
121    default:
122      break;
123  }
124
125  /*
126   *  What else can we do but stop ...
127   */
128
129  __asm__ volatile( "mov 1, %g1; ta 0x0" );
130}
131
132/*
133 *  bsp_spurious_initialize
134 *
135 *  Install the spurious handler for most traps. Note that set_vector()
136 *  will unmask the corresponding asynchronous interrupt, so the initial
137 *  interrupt mask is restored after the handlers are installed.
138 */
139
140void bsp_spurious_initialize()
141{
142  uint32_t   trap;
143  uint32_t   level = 15;
144  uint32_t   mask;
145
146  level = sparc_disable_interrupts();
147  mask = ERC32_MEC.Interrupt_Mask;
148
149  for ( trap=0 ; trap<256 ; trap++ ) {
150
151    /*
152     *  Skip window overflow, underflow, and flush as well as software
153     *  trap 0 which we will use as a shutdown. Also avoid trap 0x70 - 0x7f
154     *  which cannot happen and where some of the space is used to pass
155     *  paramaters to the program.
156     */
157
158     if (( trap == 5 || trap == 6 ) ||
159        (( trap >= 0x11 ) && ( trap <= 0x1f )) ||
160        (( trap >= 0x70 ) && ( trap <= 0x83 )))
161      continue;
162
163    set_vector( (rtems_isr_entry) bsp_spurious_handler,
164         SPARC_SYNCHRONOUS_TRAP( trap ), 1 );
165  }
166
167  ERC32_MEC.Interrupt_Mask = mask;
168  sparc_enable_interrupts(level);
169
170}
Note: See TracBrowser for help on using the repository browser.