source: rtems/c/src/lib/libbsp/powerpc/gen5200/vectors/vectors_init.c @ c90d07c

4.104.114.84.95
Last change on this file since c90d07c was c90d07c, checked in by Joel Sherrill <joel.sherrill@…>, on 03/12/07 at 11:17:23

2007-03-12 Joel Sherrill <joel@…>

  • clock/clock.c, console/console.c, ide/pcmcia_ide.c, irq/irq.c, irq/irq.h, irq/irq_asm.S, irq/irq_init.c, nvram/nvram.c, nvram/nvram.h, slicetimer/slicetimer.c, startup/bspstart.c, vectors/vectors.h, vectors/vectors_init.c: Correct license URL and/or fix mistake in copyright notice. Both of these mistakes appear to be from code submitted after these changes were made previously.
  • Property mode set to 100644
File size: 9.1 KB
Line 
1/*===============================================================*\
2| Project: RTEMS generic MPC5200 BSP                              |
3+-----------------------------------------------------------------+
4| Partially based on the code references which are named below.   |
5| Adaptions, modifications, enhancements and any recent parts of  |
6| the code are:                                                   |
7|                    Copyright (c) 2005                           |
8|                    Embedded Brains GmbH                         |
9|                    Obere Lagerstr. 30                           |
10|                    D-82178 Puchheim                             |
11|                    Germany                                      |
12|                    rtems@embedded-brains.de                     |
13+-----------------------------------------------------------------+
14| The license and distribution terms for this file may be         |
15| found in the file LICENSE in this distribution or at            |
16|                                                                 |
17| http://www.rtems.com/license/LICENSE.                           |
18|                                                                 |
19+-----------------------------------------------------------------+
20| this file contains the irq controller handler                   |
21\*===============================================================*/
22/***********************************************************************/
23/*                                                                     */
24/*   Module:       vectors_init.c                                      */
25/*   Date:         07/17/2003                                          */
26/*   Purpose:      RTEMS exception handling initialization             */
27/*                                                                     */
28/*---------------------------------------------------------------------*/
29/*                                                                     */
30/*   Description:  This include file describe the data structure and   */
31/*                 the functions implemented by rtems to handle        */
32/*                 exceptions.                                         */
33/*                                                                     */
34/*---------------------------------------------------------------------*/
35/*                                                                     */
36/*   Code                                                              */
37/*   References:   RTEMS exception handling initialization             */
38/*                                                                     */
39/*   Module:       vectors_init.c                                      */
40/*   Project:      RTEMS 4.6.0pre1 / MCF8260ads BSP                    */
41/*   Version       1.2                                                 */
42/*   Date:         11/04/2002                                          */
43/*                                                                     */
44/*   Author(s) / Copyright(s):                                         */
45/*                                                                     */
46/*   CopyRight (C) 1999 valette@crf.canon.fr                           */
47/*                                                                     */
48/*   The license and distribution terms for this file may be           */
49/*   found in found in the file LICENSE in this distribution or at     */
50/*   http://www.rtems.com/license/LICENSE.                        */
51/*                                                                     */
52/*---------------------------------------------------------------------*/
53/*                                                                     */
54/*   Partially based on the code references which are named above.     */
55/*   Adaptions, modifications, enhancements and any recent parts of    */
56/*   the code are under the right of                                   */
57/*                                                                     */
58/*         IPR Engineering, Dachauer Straße 38, D-80335 MÃŒnchen        */
59/*                        Copyright(C) 2003                            */
60/*                                                                     */
61/*---------------------------------------------------------------------*/
62/*                                                                     */
63/*   IPR Engineering makes no representation or warranties with        */
64/*   respect to the performance of this computer program, and          */
65/*   specifically disclaims any responsibility for any damages,        */
66/*   special or consequential, connected with the use of this program. */
67/*                                                                     */
68/*---------------------------------------------------------------------*/
69/*                                                                     */
70/*   Version history:  1.0                                             */
71/*                                                                     */
72/***********************************************************************/
73
74#include "../vectors/vectors.h"
75#include <libcpu/raw_exception.h>
76#include <bsp.h>
77#include <rtems/bspIo.h>
78
79extern int mpc60x_vector_is_valid(rtems_vector);
80static rtems_raw_except_global_settings exception_config;
81static rtems_raw_except_connect_data    exception_table[LAST_VALID_EXC + 1];
82
83exception_handler_t globalExceptHdl;
84
85void C_exception_handler(BSP_Exception_frame* excPtr)
86{
87  int recoverable = 0;
88
89  printk("exception handler called for exception %d\n", excPtr->_EXC_number);
90  printk("\t Next PC or Address of fault = %x\n", excPtr->EXC_SRR0);
91  printk("\t Saved MSR = %x\n", excPtr->EXC_SRR1);
92  printk("\t R0 = %x\n", excPtr->GPR0);
93  printk("\t R1 = %x\n", excPtr->GPR1);
94  printk("\t R2 = %x\n", excPtr->GPR2);
95  printk("\t R3 = %x\n", excPtr->GPR3);
96  printk("\t R4 = %x\n", excPtr->GPR4);
97  printk("\t R5 = %x\n", excPtr->GPR5);
98  printk("\t R6 = %x\n", excPtr->GPR6);
99  printk("\t R7 = %x\n", excPtr->GPR7);
100  printk("\t R8 = %x\n", excPtr->GPR8);
101  printk("\t R9 = %x\n", excPtr->GPR9);
102  printk("\t R10 = %x\n", excPtr->GPR10);
103  printk("\t R11 = %x\n", excPtr->GPR11);
104  printk("\t R12 = %x\n", excPtr->GPR12);
105  printk("\t R13 = %x\n", excPtr->GPR13);
106  printk("\t R14 = %x\n", excPtr->GPR14);
107  printk("\t R15 = %x\n", excPtr->GPR15);
108  printk("\t R16 = %x\n", excPtr->GPR16);
109  printk("\t R17 = %x\n", excPtr->GPR17);
110  printk("\t R18 = %x\n", excPtr->GPR18);
111  printk("\t R19 = %x\n", excPtr->GPR19);
112  printk("\t R20 = %x\n", excPtr->GPR20);
113  printk("\t R21 = %x\n", excPtr->GPR21);
114  printk("\t R22 = %x\n", excPtr->GPR22);
115  printk("\t R23 = %x\n", excPtr->GPR23);
116  printk("\t R24 = %x\n", excPtr->GPR24);
117  printk("\t R25 = %x\n", excPtr->GPR25);
118  printk("\t R26 = %x\n", excPtr->GPR26);
119  printk("\t R27 = %x\n", excPtr->GPR27);
120  printk("\t R28 = %x\n", excPtr->GPR28);
121  printk("\t R29 = %x\n", excPtr->GPR29);
122  printk("\t R30 = %x\n", excPtr->GPR30);
123  printk("\t R31 = %x\n", excPtr->GPR31);
124  printk("\t CR = %x\n", excPtr->EXC_CR);
125  printk("\t CTR = %x\n", excPtr->EXC_CTR);
126  printk("\t XER = %x\n", excPtr->EXC_XER);
127  printk("\t LR = %x\n", excPtr->EXC_LR);
128  printk("\t MSR = %x\n", excPtr->EXC_MSR);
129
130  if(excPtr->_EXC_number == ASM_DEC_VECTOR)
131    recoverable = 1;
132
133  if(excPtr->_EXC_number == ASM_SYS_VECTOR)
134    recoverable = 1;
135
136#if 0
137#ifdef TEST_RAW_EXCEPTION_CODE
138    recoverable = 1;
139#else
140    recoverable = 0;
141#endif
142    if (!recoverable) {
143      printk("unrecoverable exception!!! Push reset button\n");
144      while(1);
145
146  }
147#endif
148
149
150}
151
152void nop_except_enable(const rtems_raw_except_connect_data* ptr)
153{
154}
155int except_always_enabled(const rtems_raw_except_connect_data* ptr)
156{
157  return 1;
158}
159
160void initialize_exceptions()
161  {
162  int i;
163
164  /*
165   * Initialize pointer used by low level execption handling
166   */
167  globalExceptHdl                               = C_exception_handler;
168  /*
169   * Put  default_exception_vector_code_prolog at relevant exception
170   * code entry addresses
171   */
172  exception_config.exceptSize                           = LAST_VALID_EXC + 1;
173  exception_config.rawExceptHdlTbl                      = &exception_table[0];
174  exception_config.defaultRawEntry.exceptIndex  = 0;
175  exception_config.defaultRawEntry.hdl.vector   = 0;
176  exception_config.defaultRawEntry.hdl.raw_hdl  = default_exception_vector_code_prolog;
177  /*
178   * Note that next line the '&' before default_exception_vector_code_prolog_size
179   * is not a bug as it is defined a .set directly in asm...
180   */
181  exception_config.defaultRawEntry.hdl.raw_hdl_size = (unsigned) &default_exception_vector_code_prolog_size;
182
183
184  for (i=0; i <= exception_config.exceptSize; i++)
185        {
186
187    printk("installing exception number %d\n", i);
188
189        if (!mpc60x_vector_is_valid(i))
190        continue;
191
192    exception_table[i].exceptIndex      = i;
193    exception_table[i].hdl                  = exception_config.defaultRawEntry.hdl;
194    exception_table[i].hdl.vector       = i;
195    exception_table[i].on                   = nop_except_enable;
196    exception_table[i].off                  = nop_except_enable;
197    exception_table[i].isOn                 = except_always_enabled;
198  }
199
200  if (!mpc60x_init_exceptions(&exception_config))
201    BSP_panic("Exception handling initialization failed\n");
202  else
203    printk("Exception handling initialization done\n");
204
205  }
Note: See TracBrowser for help on using the repository browser.