OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [rtos/] [freertos-6.1.1/] [Demo/] [ColdFire_MCF52221_CodeWarrior/] [sources/] [exceptions.c] - Blame information for rev 578

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 jeremybenn
/*
2
 * File:    exceptions.c
3
 * Purpose: Generic exception handling for ColdFire processors
4
 *
5
 */
6
#include "exceptions.h"
7
#include "startcf.h"
8
#include "support_common.h"
9
#include <ansi_parms.h>
10
 
11
#define REGISTER_ABI __REGABI__
12
 
13
 
14
extern void vPIT0InterruptHandler( void );
15
extern void vUART0InterruptHandler( void );
16
extern void vPortYieldISR( void );
17
extern void vFECISRHandler( void );
18
 
19
/***********************************************************************/
20
/*
21
 *  Set NO_PRINTF to 0 in order the exceptions.c interrupt handler
22
 *  to output messages to the standard io.
23
 *
24
 */
25
#define NO_PRINTF    1
26
 
27
#if NO_PRINTF
28
#define VECTORDISPLAY(MESSAGE)                    asm { nop; };
29
#define VECTORDISPLAY2(MESSAGE,MESSAGE2)          asm { nop; };
30
#define VECTORDISPLAY3(MESSAGE,MESSAGE2,MESSAGE3) asm { nop; };
31
#else
32
#include <stdio.h>
33
#define VECTORDISPLAY(MESSAGE1)                    printf(MESSAGE1);
34
#define VECTORDISPLAY2(MESSAGE1,MESSAGE2)          printf(MESSAGE1,MESSAGE2);
35
#define VECTORDISPLAY3(MESSAGE1,MESSAGE2,MESSAGE3) printf(MESSAGE1,MESSAGE2,MESSAGE3);
36
#endif
37
 
38
#ifdef __cplusplus
39
extern "C" {
40
#endif
41
 
42
extern unsigned long far _SP_INIT[];
43
 
44
/***********************************************************************/
45
/*
46
 * Handling of the TRK ColdFire libs (printf support in Debugger Terminal)
47
 *
48
 * To enable this support (setup by default in CONSOLE_RAM build target
49
 * if available):
50
 * - Set CONSOLE_IO_SUPPORT to 1 in this file; this will enable
51
 *   TrapHandler_printf for the trap #14 exception.
52
 *   (this is set by default to 1 in the ColdFire Pre-Processor panel for
53
 *   the CONSOLE_RAM build target)
54
 *
55
 * - Make sure the file:
56
 *   {Compiler}ColdFire_Support\msl\MSL_C\MSL_ColdFire\Src\console_io_cf.c
57
 *   is referenced from your project.
58
 *
59
 * - Make sure that in the CF Exceptions panel the check box
60
 *   "46 TRAP #14 for Console I/O", in the "User Application Exceptions"
61
 *   area is set.
62
 *
63
 */
64
#ifndef CONSOLE_IO_SUPPORT
65
#define CONSOLE_IO_SUPPORT  0 
66
#endif
67
 
68
#if CONSOLE_IO_SUPPORT
69
asm void TrapHandler_printf(void) {
70
   HALT
71
   RTE
72
}
73
#endif                                                   
74
 
75
/***********************************************************************/
76
/*
77
 * This is the handler for all exceptions which are not common to all
78
 * ColdFire Chips.
79
 *
80
 * Called by mcf_exception_handler
81
 *
82
 */
83
void derivative_interrupt(unsigned long vector)
84
{
85
   if (vector < 64 || vector > 192) {
86
      VECTORDISPLAY2("User Defined Vector #%d\n",vector);
87
   }
88
}
89
 
90
/***********************************************************************
91
 *
92
 * This is the exception handler for all  exceptions common to all
93
 * chips ColdFire.  Most exceptions do nothing, but some of the more
94
 * important ones are handled to some extent.
95
 *
96
 * Called by asm_exception_handler
97
 *
98
 * The ColdFire family of processors has a simplified exception stack
99
 * frame that looks like the following:
100
 *
101
 *              3322222222221111 111111
102
 *              1098765432109876 5432109876543210
103
 *           8 +----------------+----------------+
104
 *             |         Program Counter         |
105
 *           4 +----------------+----------------+
106
 *             |FS/Fmt/Vector/FS|      SR        |
107
 *   SP -->  0 +----------------+----------------+
108
 *
109
 * The stack self-aligns to a 4-byte boundary at an exception, with
110
 * the FS/Fmt/Vector/FS field indicating the size of the adjustment
111
 * (SP += 0,1,2,3 bytes).
112
 *             31     28 27      26 25    18 17      16 15                                  0
113
 *           4 +---------------------------------------+------------------------------------+
114
 *             | Format | FS[3..2] | Vector | FS[1..0] |                 SR                 |
115
 *   SP -->  0 +---------------------------------------+------------------------------------+
116
 */
117
#define MCF5XXX_RD_SF_FORMAT(PTR)   \
118
   ((*((unsigned short *)(PTR)) >> 12) & 0x00FF)
119
 
120
#define MCF5XXX_RD_SF_VECTOR(PTR)   \
121
   ((*((unsigned short *)(PTR)) >>  2) & 0x00FF)
122
 
123
#define MCF5XXX_RD_SF_FS(PTR)    \
124
   ( ((*((unsigned short *)(PTR)) & 0x0C00) >> 8) | (*((unsigned short *)(PTR)) & 0x0003) )
125
 
126
#define MCF5XXX_SF_SR(PTR)    *(((unsigned short *)(PTR))+1)
127
 
128
#define MCF5XXX_SF_PC(PTR)    *((unsigned long *)(PTR)+1)
129
 
130
#define MCF5XXX_EXCEPTFMT     "%s -- PC = %#08X\n"
131
 
132
 
133
void mcf_exception_handler(void *framepointer)
134
{
135
   volatile unsigned long exceptionStackFrame = (*(unsigned long *)(framepointer));
136
   volatile unsigned short stackFrameSR       = MCF5XXX_SF_SR(framepointer);
137
   volatile unsigned short stackFrameWord     = (*(unsigned short *)(framepointer));
138
   volatile unsigned long  stackFrameFormat   = (unsigned long)MCF5XXX_RD_SF_FORMAT(&stackFrameWord);
139
   volatile unsigned long  stackFrameFS       = (unsigned long)MCF5XXX_RD_SF_FS(&stackFrameWord);
140
   volatile unsigned long  stackFrameVector   = (unsigned long)MCF5XXX_RD_SF_VECTOR(&stackFrameWord);
141
   volatile unsigned long  stackFramePC       = MCF5XXX_SF_PC(framepointer);
142
 
143
   switch (stackFrameFormat)
144
   {
145
      case 4:
146
      case 5:
147
      case 6:
148
      case 7:
149
         break;
150
      default:
151
         VECTORDISPLAY3(MCF5XXX_EXCEPTFMT,"Illegal stack type", stackFramePC);
152
         break;
153
   }
154
 
155
   switch (stackFrameVector)
156
   {
157
   case 2:
158
      VECTORDISPLAY3(MCF5XXX_EXCEPTFMT, "Access Error", stackFramePC);
159
      switch (stackFrameFS)
160
      {
161
         case 4:
162
            VECTORDISPLAY("Error on instruction fetch\n");
163
            break;
164
         case 8:
165
            VECTORDISPLAY("Error on operand write\n");
166
            break;
167
         case 9:
168
            VECTORDISPLAY("Attempted write to write-protected space\n");
169
            break;
170
         case 12:
171
            VECTORDISPLAY("Error on operand read\n");
172
            break;
173
         default:
174
            VECTORDISPLAY("Reserved Fault Status Encoding\n");
175
            break;
176
      }
177
      break;
178
   case 3:
179
      VECTORDISPLAY3(MCF5XXX_EXCEPTFMT, "Address Error", stackFramePC);
180
      switch (stackFrameFS)
181
      {
182
         case 4:
183
            VECTORDISPLAY("Error on instruction fetch\n");
184
            break;
185
         case 8:
186
            VECTORDISPLAY("Error on operand write\n");
187
            break;
188
         case 9:
189
            VECTORDISPLAY("Attempted write to write-protected space\n");
190
            break;
191
         case 12:
192
            VECTORDISPLAY("Error on operand read\n");
193
            break;
194
         default:
195
            VECTORDISPLAY("Reserved Fault Status Encoding\n");
196
            break;
197
      }
198
      break;
199
   case 4:
200
      VECTORDISPLAY3(MCF5XXX_EXCEPTFMT, "Illegal instruction", stackFramePC);
201
      break;
202
   case 8:
203
      VECTORDISPLAY3(MCF5XXX_EXCEPTFMT, "Privilege violation", stackFramePC);
204
      break;
205
   case 9:
206
      VECTORDISPLAY3(MCF5XXX_EXCEPTFMT, "Trace Exception", stackFramePC);
207
      break;
208
   case 10:
209
      VECTORDISPLAY3(MCF5XXX_EXCEPTFMT, "Unimplemented A-Line Instruction",     stackFramePC);
210
      break;
211
   case 11:
212
      VECTORDISPLAY3(MCF5XXX_EXCEPTFMT, "Unimplemented F-Line Instruction",     stackFramePC);
213
      break;
214
   case 12:
215
      VECTORDISPLAY3(MCF5XXX_EXCEPTFMT, "Debug Interrupt", stackFramePC);
216
      break;
217
   case 14:
218
      VECTORDISPLAY3(MCF5XXX_EXCEPTFMT, "Format Error", stackFramePC);
219
      break;
220
   case 15:
221
      VECTORDISPLAY3(MCF5XXX_EXCEPTFMT, "Unitialized Interrupt", stackFramePC);
222
      break;
223
   case 24:
224
      VECTORDISPLAY3(MCF5XXX_EXCEPTFMT, "Spurious Interrupt", stackFramePC);
225
      break;
226
   case 25:
227
   case 26:
228
   case 27:
229
   case 28:
230
   case 29:
231
   case 30:
232
   case 31:
233
      VECTORDISPLAY2("Autovector interrupt level %d\n", stackFrameVector - 24);
234
      break;
235
   case 32:
236
   case 33:
237
   case 34:
238
   case 35:
239
   case 36:
240
   case 37:
241
   case 38:
242
   case 39:
243
   case 40:
244
   case 41:
245
   case 42:
246
   case 43:
247
   case 44:
248
   case 45:
249
   case 46:
250
   case 47:
251
      VECTORDISPLAY2("TRAP #%d\n", stackFrameVector - 32);
252
      break;
253
   case 5:
254
   case 6:
255
   case 7:
256
   case 13:
257
   case 16:
258
   case 17:
259
   case 18:
260
   case 19:
261
   case 20:
262
   case 21:
263
   case 22:
264
   case 23:
265
   case 48:
266
   case 49:
267
   case 50:
268
   case 51:
269
   case 52:
270
   case 53:
271
   case 54:
272
   case 55:
273
   case 56:
274
   case 57:
275
   case 58:
276
   case 59:
277
   case 60:
278
   case 61:
279
   case 62:
280
   case 63:
281
      VECTORDISPLAY2("Reserved: #%d\n", stackFrameVector);
282
      break;
283
   default:
284
      derivative_interrupt(stackFrameVector);
285
   break;
286
   }
287
}
288
 
289
#if REGISTER_ABI
290
asm void asm_exception_handler(void)
291
{
292
   link     a6,#0 
293
   lea     -20(sp), sp
294
   movem.l d0-d2/a0-a1, (sp)
295
   lea     24(sp),a0   /* A0 point to exception stack frame on the stack */
296
   jsr     mcf_exception_handler
297
   movem.l (sp), d0-d2/a0-a1
298
   lea     20(sp), sp
299
   unlk a6
300
   rte
301
}
302
#else
303
asm void asm_exception_handler(void)
304
{
305
   link     a6,#0 
306
   lea     -20(sp), sp
307
   movem.l d0-d2/a0-a1, (sp)
308
   pea     24(sp)   /* push exception frame address */
309
   jsr     mcf_exception_handler
310
   movem.l 4(sp), d0-d2/a0-a1
311
   lea     24(sp), sp
312
   unlk a6
313
   rte
314
}
315
#endif
316
 
317
typedef void (* vectorTableEntryType)(void);
318
 
319
#pragma define_section vectortable ".vectortable" far_absolute R
320
 
321
/* CF have 255 vector + SP_INIT in the vector table (256 entries)
322
*/
323
__declspec(vectortable) vectorTableEntryType _vect[256] = {   /* Interrupt vector table */
324
   (vectorTableEntryType)__SP_AFTER_RESET,  /*   0 (0x000) Initial supervisor SP      */
325
   _startup,                        /*   1 (0x004) Initial PC                 */
326
   asm_exception_handler,           /*   2 (0x008) Access Error               */
327
   asm_exception_handler,           /*   3 (0x00C) Address Error              */
328
   asm_exception_handler,           /*   4 (0x010) Illegal Instruction        */
329
   asm_exception_handler,           /*   5 (0x014) Reserved                   */
330
   asm_exception_handler,           /*   6 (0x018) Reserved                   */
331
   asm_exception_handler,           /*   7 (0x01C) Reserved                   */
332
   asm_exception_handler,           /*   8 (0x020) Privilege Violation        */
333
   asm_exception_handler,           /*   9 (0x024) Trace                      */
334
   asm_exception_handler,           /*  10 (0x028) Unimplemented A-Line       */
335
   asm_exception_handler,           /*  11 (0x02C) Unimplemented F-Line       */
336
   asm_exception_handler,           /*  12 (0x030) Debug Interrupt            */
337
   asm_exception_handler,           /*  13 (0x034) Reserved                   */
338
   asm_exception_handler,           /*  14 (0x038) Format Error               */
339
   asm_exception_handler,           /*  15 (0x03C) Unitialized Int            */
340
   asm_exception_handler,           /*  16 (0x040) Reserved                   */
341
   asm_exception_handler,           /*  17 (0x044) Reserved                   */
342
   asm_exception_handler,           /*  18 (0x048) Reserved                   */
343
   asm_exception_handler,           /*  19 (0x04C) Reserved                   */
344
   asm_exception_handler,           /*  20 (0x050) Reserved                   */
345
   asm_exception_handler,           /*  21 (0x054) Reserved                   */
346
   asm_exception_handler,           /*  22 (0x058) Reserved                   */
347
   asm_exception_handler,           /*  23 (0x05C) Reserved                   */
348
   asm_exception_handler,           /*  24 (0x060) Spurious Interrupt         */
349
   asm_exception_handler,           /*  25 (0x064) Autovector Level 1         */
350
   asm_exception_handler,           /*  26 (0x068) Autovector Level 2         */
351
   asm_exception_handler,           /*  27 (0x06C) Autovector Level 3         */
352
   asm_exception_handler,           /*  28 (0x070) Autovector Level 4         */
353
   asm_exception_handler,           /*  29 (0x074) Autovector Level 5         */
354
   asm_exception_handler,           /*  30 (0x078) Autovector Level 6         */
355
   asm_exception_handler,           /*  31 (0x07C) Autovector Level 7         */
356
   asm_exception_handler,           /*  32 (0x080) TRAP #0                    */
357
   asm_exception_handler,           /*  33 (0x084) TRAP #1                    */
358
   asm_exception_handler,           /*  34 (0x088) TRAP #2                    */
359
   asm_exception_handler,           /*  35 (0x08C) TRAP #3                    */
360
   asm_exception_handler,           /*  36 (0x090) TRAP #4                    */
361
   asm_exception_handler,           /*  37 (0x094) TRAP #5                    */
362
   asm_exception_handler,           /*  38 (0x098) TRAP #6                    */
363
   asm_exception_handler,           /*  39 (0x09C) TRAP #7                    */
364
   asm_exception_handler,           /*  40 (0x0A0) TRAP #8                    */
365
   asm_exception_handler,           /*  41 (0x0A4) TRAP #9                    */
366
   asm_exception_handler,           /*  42 (0x0A8) TRAP #10                   */
367
   asm_exception_handler,           /*  43 (0x0AC) TRAP #11                   */
368
   asm_exception_handler,           /*  44 (0x0B0) TRAP #12                   */
369
   asm_exception_handler,           /*  45 (0x0B4) TRAP #13                   */
370
#if CONSOLE_IO_SUPPORT   
371
   TrapHandler_printf,              /*  46 (0x0B8) TRAP #14                   */
372
#else
373
   asm_exception_handler,           /*  46 (0x0B8) TRAP #14                   */
374
#endif   
375
   asm_exception_handler,           /*  47 (0x0BC) TRAP #15                   */
376
   asm_exception_handler,           /*  48 (0x0C0) Reserved                   */
377
   asm_exception_handler,           /*  49 (0x0C4) Reserved                   */
378
   asm_exception_handler,           /*  50 (0x0C8) Reserved                   */
379
   asm_exception_handler,           /*  51 (0x0CC) Reserved                   */
380
   asm_exception_handler,           /*  52 (0x0D0) Reserved                   */
381
   asm_exception_handler,           /*  53 (0x0D4) Reserved                   */
382
   asm_exception_handler,           /*  54 (0x0D8) Reserved                   */
383
   asm_exception_handler,           /*  55 (0x0DC) Reserved                   */
384
   asm_exception_handler,           /*  56 (0x0E0) Reserved                   */
385
   asm_exception_handler,           /*  57 (0x0E4) Reserved                   */
386
   asm_exception_handler,           /*  58 (0x0E8) Reserved                   */
387
   asm_exception_handler,           /*  59 (0x0EC) Reserved                   */
388
   asm_exception_handler,           /*  60 (0x0F0) Reserved                   */
389
   asm_exception_handler,           /*  61 (0x0F4) Reserved                   */
390
   asm_exception_handler,           /*  62 (0x0F8) Reserved                   */
391
   asm_exception_handler,           /*  63 (0x0FC) Reserved                   */
392
   asm_exception_handler,           /*  64 (0x100) Device-specific interrupts */
393
   asm_exception_handler,           /*  65 (0x104) Device-specific interrupts */
394
   asm_exception_handler,           /*  66 (0x108) Device-specific interrupts */
395
   asm_exception_handler,           /*  67 (0x10C) Device-specific interrupts */
396
   asm_exception_handler,           /*  68 (0x110) Device-specific interrupts */
397
   asm_exception_handler,           /*  69 (0x114) Device-specific interrupts */
398
   asm_exception_handler,           /*  70 (0x118) Device-specific interrupts */
399
   asm_exception_handler,           /*  71 (0x11C) Device-specific interrupts */
400
   asm_exception_handler,           /*  72 (0x120) Device-specific interrupts */
401
   asm_exception_handler,           /*  73 (0x124) Device-specific interrupts */
402
   asm_exception_handler,           /*  74 (0x128) Device-specific interrupts */
403
   asm_exception_handler,           /*  75 (0x12C) Device-specific interrupts */
404
   asm_exception_handler,           /*  76 (0x130) Device-specific interrupts */
405
   vUART0InterruptHandler,          /*  77 (0x134) Device-specific interrupts */
406
   asm_exception_handler,           /*  78 (0x138) Device-specific interrupts */
407
   asm_exception_handler,           /*  79 (0x13C) Device-specific interrupts */
408
   vPortYieldISR,                       /*  80 (0x140) Device-specific interrupts */
409
   asm_exception_handler,           /*  81 (0x144) Device-specific interrupts */
410
   asm_exception_handler,           /*  82 (0x148) Device-specific interrupts */
411
   asm_exception_handler,           /*  83 (0x14C) Device-specific interrupts */
412
   asm_exception_handler,           /*  84 (0x150) Device-specific interrupts */
413
   asm_exception_handler,           /*  85 (0x154) Device-specific interrupts */
414
   asm_exception_handler,           /*  86 (0x158) Device-specific interrupts */
415
   asm_exception_handler,           /*  87 (0x15C) Device-specific interrupts */
416
   asm_exception_handler,           /*  88 (0x160) Device-specific interrupts */
417
   asm_exception_handler,           /*  89 (0x164) Device-specific interrupts */
418
   asm_exception_handler,           /*  90 (0x168) Device-specific interrupts */
419
   asm_exception_handler,           /*  91 (0x16C) Device-specific interrupts */
420
   asm_exception_handler,           /*  92 (0x170) Device-specific interrupts */
421
   asm_exception_handler,           /*  93 (0x174) Device-specific interrupts */
422
   asm_exception_handler,           /*  94 (0x178) Device-specific interrupts */
423
   asm_exception_handler,           /*  95 (0x17C) Device-specific interrupts */
424
   asm_exception_handler,           /*  96 (0x180) Level 1 software interrupt */
425
   asm_exception_handler,           /*  97 (0x184) Level 2 software interrupt */
426
   asm_exception_handler,           /*  98 (0x188) Level 3 software interrupt */
427
   asm_exception_handler,           /*  99 (0x18C) Level 4 software interrupt */
428
   asm_exception_handler,           /* 100 (0x190) Level 5 software interrupt */
429
   asm_exception_handler,           /* 101 (0x194) Level 6 software interrupt */
430
   asm_exception_handler,           /* 102 (0x198) Level 7 software interrupt */
431
   asm_exception_handler,           /* 103 (0x19C) Reserved                   */
432
   asm_exception_handler,           /* 104 (0x1A0) Reserved                   */
433
   asm_exception_handler,           /* 105 (0x1A4) Reserved                   */
434
   asm_exception_handler,           /* 106 (0x1A8) Reserved                   */
435
   asm_exception_handler,           /* 107 (0x___) Reserved                   */
436
   asm_exception_handler,           /* 108 (0x___) Reserved                   */
437
   asm_exception_handler,           /* 109 (0x___) Reserved                   */
438
   asm_exception_handler,           /* 110 (0x___) Reserved                   */
439
   asm_exception_handler,           /* 111 (0x___) Reserved                   */
440
   asm_exception_handler,           /* 112 (0x___) Reserved                   */
441
   asm_exception_handler,           /* 113 (0x___) Reserved                   */
442
   asm_exception_handler,           /* 114 (0x___) Reserved                   */
443
   asm_exception_handler,           /* 115 (0x___) Reserved                   */
444
   asm_exception_handler,           /* 116 (0x___) Reserved                   */
445
   asm_exception_handler,           /* 117 (0x___) Reserved                   */
446
   asm_exception_handler,           /* 118 (0x___) Reserved                   */
447
   vPIT0InterruptHandler,           /* 119 (0x___) Reserved                   */
448
   asm_exception_handler,           /* 120 (0x___) Reserved                   */
449
   asm_exception_handler,           /* 121 (0x___) Reserved                   */
450
   asm_exception_handler,           /* 122 (0x___) Reserved                   */
451
   asm_exception_handler,           /* 123 (0x___) Reserved                   */
452
   asm_exception_handler,           /* 124 (0x___) Reserved                   */
453
   asm_exception_handler,           /* 125 (0x___) Reserved                   */
454
   asm_exception_handler,           /* 126 (0x___) Reserved                   */
455
   asm_exception_handler,           /* 127 (0x___) Reserved                   */
456
   asm_exception_handler,           /* 128 (0x___) Reserved                   */
457
   asm_exception_handler,           /* 129 (0x___) Reserved                   */
458
   asm_exception_handler,           /* 130 (0x___) Reserved                   */
459
   asm_exception_handler,           /* 131 (0x___) Reserved                   */
460
   asm_exception_handler,           /* 132 (0x___) Reserved                   */
461
   asm_exception_handler,           /* 133 (0x___) Reserved                   */
462
   asm_exception_handler,           /* 134 (0x___) Reserved                   */
463
   asm_exception_handler,           /* 135 (0x___) Reserved                   */
464
   asm_exception_handler,           /* 136 (0x___) Reserved                   */
465
   asm_exception_handler,           /* 137 (0x___) Reserved                   */
466
   asm_exception_handler,           /* 138 (0x___) Reserved                   */
467
   asm_exception_handler,           /* 139 (0x___) Reserved                   */
468
   asm_exception_handler,           /* 140 (0x___) Reserved                   */
469
   asm_exception_handler,           /* 141 (0x___) Reserved                   */
470
   asm_exception_handler,           /* 142 (0x___) Reserved                   */
471
   asm_exception_handler,           /* 143 (0x___) Reserved                   */
472
   asm_exception_handler,           /* 144 (0x___) Reserved                   */
473
   asm_exception_handler,           /* 145 (0x___) Reserved                   */
474
   asm_exception_handler,           /* 146 (0x___) Reserved                   */
475
   asm_exception_handler,           /* 147 (0x___) Reserved                   */
476
   asm_exception_handler,           /* 148 (0x___) Reserved                   */
477
   asm_exception_handler,           /* 149 (0x___) Reserved                   */
478
   asm_exception_handler,           /* 150 (0x___) Reserved                   */
479
   asm_exception_handler,           /* 151 (0x___) Reserved                   */
480
   asm_exception_handler,           /* 152 (0x___) Reserved                   */
481
   asm_exception_handler,           /* 153 (0x___) Reserved                   */
482
   asm_exception_handler,           /* 154 (0x___) Reserved                   */
483
   asm_exception_handler,           /* 155 (0x___) Reserved                   */
484
   asm_exception_handler,           /* 156 (0x___) Reserved                   */
485
   asm_exception_handler,           /* 157 (0x___) Reserved                   */
486
   asm_exception_handler,           /* 158 (0x___) Reserved                   */
487
   asm_exception_handler,           /* 159 (0x___) Reserved                   */
488
   asm_exception_handler,           /* 160 (0x___) Reserved                   */
489
   asm_exception_handler,           /* 161 (0x___) Reserved                   */
490
   asm_exception_handler,           /* 162 (0x___) Reserved                   */
491
   asm_exception_handler,           /* 163 (0x___) Reserved                   */
492
   asm_exception_handler,           /* 164 (0x___) Reserved                   */
493
   asm_exception_handler,           /* 165 (0x___) Reserved                   */
494
   asm_exception_handler,           /* 166 (0x___) Reserved                   */
495
   asm_exception_handler,           /* 167 (0x___) Reserved                   */
496
   asm_exception_handler,           /* 168 (0x___) Reserved                   */
497
   asm_exception_handler,           /* 169 (0x___) Reserved                   */
498
   asm_exception_handler,           /* 170 (0x___) Reserved                   */
499
   asm_exception_handler,           /* 171 (0x___) Reserved                   */
500
   asm_exception_handler,           /* 172 (0x___) Reserved                   */
501
   asm_exception_handler,           /* 173 (0x___) Reserved                   */
502
   asm_exception_handler,           /* 174 (0x___) Reserved                   */
503
   asm_exception_handler,           /* 175 (0x___) Reserved                   */
504
   asm_exception_handler,           /* 176 (0x___) Reserved                   */
505
   asm_exception_handler,           /* 177 (0x___) Reserved                   */
506
   asm_exception_handler,           /* 178 (0x___) Reserved                   */
507
   asm_exception_handler,           /* 179 (0x___) Reserved                   */
508
   asm_exception_handler,           /* 180 (0x___) Reserved                   */
509
   asm_exception_handler,           /* 181 (0x___) Reserved                   */
510
   asm_exception_handler,           /* 182 (0x___) Reserved                   */
511
   asm_exception_handler,           /* 183 (0x___) Reserved                   */
512
   asm_exception_handler,           /* 184 (0x___) Reserved                   */
513
   asm_exception_handler,           /* 185 (0x___) Reserved                   */
514
   asm_exception_handler,           /* 186 (0x___) Reserved                   */
515
   asm_exception_handler,           /* 187 (0x___) Reserved                   */
516
   asm_exception_handler,           /* 188 (0x___) Reserved                   */
517
   asm_exception_handler,           /* 189 (0x___) Reserved                   */
518
   asm_exception_handler,           /* 190 (0x___) Reserved                   */
519
   asm_exception_handler,           /* 191 (0x___) Reserved                   */
520
   asm_exception_handler,           /* 192 (0x___) Reserved                   */
521
   asm_exception_handler,           /* 193 (0x___) Reserved                   */
522
   asm_exception_handler,           /* 194 (0x___) Reserved                   */
523
   asm_exception_handler,           /* 195 (0x___) Reserved                   */
524
   asm_exception_handler,           /* 196 (0x___) Reserved                   */
525
   asm_exception_handler,           /* 197 (0x___) Reserved                   */
526
   asm_exception_handler,           /* 198 (0x___) Reserved                   */
527
   asm_exception_handler,           /* 199 (0x___) Reserved                   */
528
   asm_exception_handler,           /* 200 (0x___) Reserved                   */
529
   asm_exception_handler,           /* 201 (0x___) Reserved                   */
530
   asm_exception_handler,           /* 202 (0x___) Reserved                   */
531
   asm_exception_handler,           /* 203 (0x___) Reserved                   */
532
   asm_exception_handler,           /* 204 (0x___) Reserved                   */
533
   asm_exception_handler,           /* 205 (0x___) Reserved                   */
534
   asm_exception_handler,           /* 206 (0x___) Reserved                   */
535
   asm_exception_handler,           /* 207 (0x___) Reserved                   */
536
   asm_exception_handler,           /* 208 (0x___) Reserved                   */
537
   asm_exception_handler,           /* 209 (0x___) Reserved                   */
538
   asm_exception_handler,           /* 210 (0x___) Reserved                   */
539
   asm_exception_handler,           /* 211 (0x___) Reserved                   */
540
   asm_exception_handler,           /* 212 (0x___) Reserved                   */
541
   asm_exception_handler,           /* 213 (0x___) Reserved                   */
542
   asm_exception_handler,           /* 214 (0x___) Reserved                   */
543
   asm_exception_handler,           /* 215 (0x___) Reserved                   */
544
   asm_exception_handler,           /* 216 (0x___) Reserved                   */
545
   asm_exception_handler,           /* 217 (0x___) Reserved                   */
546
   asm_exception_handler,           /* 218 (0x___) Reserved                   */
547
   asm_exception_handler,           /* 219 (0x___) Reserved                   */
548
   asm_exception_handler,           /* 220 (0x___) Reserved                   */
549
   asm_exception_handler,           /* 221 (0x___) Reserved                   */
550
   asm_exception_handler,           /* 222 (0x___) Reserved                   */
551
   asm_exception_handler,           /* 223 (0x___) Reserved                   */
552
   asm_exception_handler,           /* 224 (0x___) Reserved                   */
553
   asm_exception_handler,           /* 225 (0x___) Reserved                   */
554
   asm_exception_handler,           /* 226 (0x___) Reserved                   */
555
   asm_exception_handler,           /* 227 (0x___) Reserved                   */
556
   asm_exception_handler,           /* 228 (0x___) Reserved                   */
557
   asm_exception_handler,           /* 229 (0x___) Reserved                   */
558
   asm_exception_handler,           /* 230 (0x___) Reserved                   */
559
   asm_exception_handler,           /* 231 (0x___) Reserved                   */
560
   asm_exception_handler,           /* 232 (0x___) Reserved                   */
561
   asm_exception_handler,           /* 233 (0x___) Reserved                   */
562
   asm_exception_handler,           /* 234 (0x___) Reserved                   */
563
   asm_exception_handler,           /* 235 (0x___) Reserved                   */
564
   asm_exception_handler,           /* 236 (0x___) Reserved                   */
565
   asm_exception_handler,           /* 237 (0x___) Reserved                   */
566
   asm_exception_handler,           /* 238 (0x___) Reserved                   */
567
   asm_exception_handler,           /* 239 (0x___) Reserved                   */
568
   asm_exception_handler,           /* 240 (0x___) Reserved                   */
569
   asm_exception_handler,           /* 241 (0x___) Reserved                   */
570
   asm_exception_handler,           /* 242 (0x___) Reserved                   */
571
   asm_exception_handler,           /* 243 (0x___) Reserved                   */
572
   asm_exception_handler,           /* 244 (0x___) Reserved                   */
573
   asm_exception_handler,           /* 245 (0x___) Reserved                   */
574
   asm_exception_handler,           /* 246 (0x___) Reserved                   */
575
   asm_exception_handler,           /* 247 (0x___) Reserved                   */
576
   asm_exception_handler,           /* 248 (0x___) Reserved                   */
577
   asm_exception_handler,           /* 249 (0x___) Reserved                   */
578
   asm_exception_handler,           /* 250 (0x___) Reserved                   */
579
   asm_exception_handler,           /* 251 (0x___) Reserved                   */
580
   asm_exception_handler,           /* 252 (0x___) Reserved                   */
581
   asm_exception_handler,           /* 253 (0x___) Reserved                   */
582
   asm_exception_handler,           /* 254 (0x___) Reserved                   */
583
   asm_exception_handler,           /* 255 (0x___) Reserved                   */
584
};
585
 
586
/********************************************************************
587
 * MCF5xxx ASM utility functions
588
 */
589
asm void mcf5xxx_wr_vbr(unsigned long) { /* Set VBR */
590
        move.l  4(SP),D0
591
    movec d0,VBR
592
        nop
593
        rts
594
}
595
 
596
/********************************************************************
597
 * MCF5xxx startup copy functions:
598
 *
599
 * Set VBR and performs RAM vector table initializatiom.
600
 * The following symbol should be defined in the lcf:
601
 * __VECTOR_RAM
602
 *
603
 * _vect is the start of the exception table in the code
604
 * In case _vect address is different from __VECTOR_RAM,
605
 * the vector table is copied from _vect to __VECTOR_RAM.
606
 * In any case VBR is set to __VECTOR_RAM.
607
 */
608
void initialize_exceptions(void)
609
{
610
#if 0
611
        /*
612
         * Memory map definitions from linker command files used by mcf5xxx_startup
613
         */
614
 
615
        register uint32 n;
616
 
617
        /*
618
     * Copy the vector table to RAM
619
     */
620
        if (__VECTOR_RAM != (unsigned long*)_vect)
621
        {
622
                for (n = 0; n < 256; n++)
623
                        __VECTOR_RAM[n] = (unsigned long)_vect[n];
624
        }
625
        mcf5xxx_wr_vbr((unsigned long)__VECTOR_RAM);
626
#endif
627
 
628
        mcf5xxx_wr_vbr((unsigned long)_vect);
629
}
630
 
631
#ifdef __cplusplus
632
}
633
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.