OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [freertos-6.1.1/] [Source/] [portable/] [GCC/] [AVR32_UC3/] [exception.S] - Blame information for rev 572

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 572 jeremybenn
/*This file is prepared for Doxygen automatic documentation generation.*/
2
/*! \file *********************************************************************
3
 *
4
 * \brief Exception and interrupt vectors.
5
 *
6
 * This file maps all events supported by an AVR32UC.
7
 *
8
 * - Compiler:           GNU GCC for AVR32
9
 * - Supported devices:  All AVR32UC devices with an INTC module can be used.
10
 * - AppNote:
11
 *
12
 * \author               Atmel Corporation: http://www.atmel.com \n
13
 *                       Support and FAQ: http://support.atmel.no/
14
 *
15
 ******************************************************************************/
16
 
17
/* Copyright (c) 2007, Atmel Corporation All rights reserved.
18
 *
19
 * Redistribution and use in source and binary forms, with or without
20
 * modification, are permitted provided that the following conditions are met:
21
 *
22
 * 1. Redistributions of source code must retain the above copyright notice,
23
 * this list of conditions and the following disclaimer.
24
 *
25
 * 2. Redistributions in binary form must reproduce the above copyright notice,
26
 * this list of conditions and the following disclaimer in the documentation
27
 * and/or other materials provided with the distribution.
28
 *
29
 * 3. The name of ATMEL may not be used to endorse or promote products derived
30
 * from this software without specific prior written permission.
31
 *
32
 * THIS SOFTWARE IS PROVIDED BY ATMEL ``AS IS'' AND ANY EXPRESS OR IMPLIED
33
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
34
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY AND
35
 * SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT,
36
 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
37
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
38
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
39
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
40
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
41
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42
 */
43
 
44
 
45
#include 
46
#include "intc.h"
47
 
48
 
49
//! @{
50
//! \verbatim
51
 
52
 
53
  .section  .exception, "ax", @progbits
54
 
55
 
56
// Start of Exception Vector Table.
57
 
58
  // EVBA must be aligned with a power of two strictly greater than the EVBA-
59
  // relative offset of the last vector.
60
  .balign 0x200
61
 
62
  // Export symbol.
63
  .global _evba
64
  .type _evba, @function
65
_evba:
66
 
67
        .org  0x000
68
        // Unrecoverable Exception.
69
_handle_Unrecoverable_Exception:
70
        rjmp $
71
 
72
        .org  0x004
73
        // TLB Multiple Hit: UNUSED IN AVR32UC.
74
_handle_TLB_Multiple_Hit:
75
        rjmp $
76
 
77
        .org  0x008
78
        // Bus Error Data Fetch.
79
_handle_Bus_Error_Data_Fetch:
80
        rjmp $
81
 
82
        .org  0x00C
83
         // Bus Error Instruction Fetch.
84
_handle_Bus_Error_Instruction_Fetch:
85
        rjmp $
86
 
87
        .org  0x010
88
        // NMI.
89
_handle_NMI:
90
        rjmp $
91
 
92
        .org  0x014
93
        // Instruction Address.
94
_handle_Instruction_Address:
95
        rjmp $
96
 
97
        .org  0x018
98
        // ITLB Protection.
99
_handle_ITLB_Protection:
100
        rjmp $
101
 
102
        .org  0x01C
103
        // Breakpoint.
104
_handle_Breakpoint:
105
        rjmp $
106
 
107
        .org  0x020
108
        // Illegal Opcode.
109
_handle_Illegal_Opcode:
110
        rjmp $
111
 
112
        .org  0x024
113
        // Unimplemented Instruction.
114
_handle_Unimplemented_Instruction:
115
        rjmp $
116
 
117
        .org  0x028
118
        // Privilege Violation.
119
_handle_Privilege_Violation:
120
        rjmp $
121
 
122
        .org  0x02C
123
        // Floating-Point: UNUSED IN AVR32UC.
124
_handle_Floating_Point:
125
        rjmp $
126
 
127
        .org  0x030
128
        // Coprocessor Absent: UNUSED IN AVR32UC.
129
_handle_Coprocessor_Absent:
130
        rjmp $
131
 
132
        .org  0x034
133
        // Data Address (Read).
134
_handle_Data_Address_Read:
135
        rjmp $
136
 
137
        .org  0x038
138
        // Data Address (Write).
139
_handle_Data_Address_Write:
140
        rjmp $
141
 
142
        .org  0x03C
143
        // DTLB Protection (Read).
144
_handle_DTLB_Protection_Read:
145
        rjmp $
146
 
147
        .org  0x040
148
        // DTLB Protection (Write).
149
_handle_DTLB_Protection_Write:
150
        rjmp $
151
 
152
        .org  0x044
153
        // DTLB Modified: UNUSED IN AVR32UC.
154
_handle_DTLB_Modified:
155
        rjmp $
156
 
157
        .org  0x050
158
        // ITLB Miss: UNUSED IN AVR32UC.
159
_handle_ITLB_Miss:
160
        rjmp $
161
 
162
        .org  0x060
163
        // DTLB Miss (Read): UNUSED IN AVR32UC.
164
_handle_DTLB_Miss_Read:
165
        rjmp $
166
 
167
        .org  0x070
168
        // DTLB Miss (Write): UNUSED IN AVR32UC.
169
_handle_DTLB_Miss_Write:
170
        rjmp $
171
 
172
        .org  0x100
173
        // Supervisor Call.
174
_handle_Supervisor_Call:
175
        lda.w   pc, SCALLYield
176
 
177
 
178
// Interrupt support.
179
// The interrupt controller must provide the offset address relative to EVBA.
180
// Important note:
181
//   All interrupts call a C function named _get_interrupt_handler.
182
//   This function will read group and interrupt line number to then return in
183
//   R12 a pointer to a user-provided interrupt handler.
184
 
185
  .balign 4
186
 
187
_int0:
188
  // R8-R12, LR, PC and SR are automatically pushed onto the system stack by the
189
  // CPU upon interrupt entry.
190
#if 1 // B1832: interrupt stack changed to exception stack if exception is detected.
191
  mfsr    r12, AVR32_SR
192
  bfextu  r12, r12, AVR32_SR_M0_OFFSET, AVR32_SR_M0_SIZE + AVR32_SR_M1_SIZE + AVR32_SR_M2_SIZE
193
  cp.w    r12, 0b110
194
  brlo    _int0_normal
195
  lddsp   r12, sp[0 * 4]
196
  stdsp   sp[6 * 4], r12
197
  lddsp   r12, sp[1 * 4]
198
  stdsp   sp[7 * 4], r12
199
  lddsp   r12, sp[3 * 4]
200
  sub     sp, -6 * 4
201
  rete
202
_int0_normal:
203
#endif
204
  mov     r12, 0  // Pass the int_lev parameter to the _get_interrupt_handler function.
205
  call    _get_interrupt_handler
206
  cp.w    r12, 0  // Get the pointer to the interrupt handler returned by the function.
207
  movne   pc, r12 // If this was not a spurious interrupt (R12 != NULL), jump to the handler.
208
  rete            // If this was a spurious interrupt (R12 == NULL), return from event handler.
209
 
210
_int1:
211
  // R8-R12, LR, PC and SR are automatically pushed onto the system stack by the
212
  // CPU upon interrupt entry.
213
#if 1 // B1832: interrupt stack changed to exception stack if exception is detected.
214
  mfsr    r12, AVR32_SR
215
  bfextu  r12, r12, AVR32_SR_M0_OFFSET, AVR32_SR_M0_SIZE + AVR32_SR_M1_SIZE + AVR32_SR_M2_SIZE
216
  cp.w    r12, 0b110
217
  brlo    _int1_normal
218
  lddsp   r12, sp[0 * 4]
219
  stdsp   sp[6 * 4], r12
220
  lddsp   r12, sp[1 * 4]
221
  stdsp   sp[7 * 4], r12
222
  lddsp   r12, sp[3 * 4]
223
  sub     sp, -6 * 4
224
  rete
225
_int1_normal:
226
#endif
227
  mov     r12, 1  // Pass the int_lev parameter to the _get_interrupt_handler function.
228
  call    _get_interrupt_handler
229
  cp.w    r12, 0  // Get the pointer to the interrupt handler returned by the function.
230
  movne   pc, r12 // If this was not a spurious interrupt (R12 != NULL), jump to the handler.
231
  rete            // If this was a spurious interrupt (R12 == NULL), return from event handler.
232
 
233
_int2:
234
  // R8-R12, LR, PC and SR are automatically pushed onto the system stack by the
235
  // CPU upon interrupt entry.
236
#if 1 // B1832: interrupt stack changed to exception stack if exception is detected.
237
  mfsr    r12, AVR32_SR
238
  bfextu  r12, r12, AVR32_SR_M0_OFFSET, AVR32_SR_M0_SIZE + AVR32_SR_M1_SIZE + AVR32_SR_M2_SIZE
239
  cp.w    r12, 0b110
240
  brlo    _int2_normal
241
  lddsp   r12, sp[0 * 4]
242
  stdsp   sp[6 * 4], r12
243
  lddsp   r12, sp[1 * 4]
244
  stdsp   sp[7 * 4], r12
245
  lddsp   r12, sp[3 * 4]
246
  sub     sp, -6 * 4
247
  rete
248
_int2_normal:
249
#endif
250
  mov     r12, 2  // Pass the int_lev parameter to the _get_interrupt_handler function.
251
  call    _get_interrupt_handler
252
  cp.w    r12, 0  // Get the pointer to the interrupt handler returned by the function.
253
  movne   pc, r12 // If this was not a spurious interrupt (R12 != NULL), jump to the handler.
254
  rete            // If this was a spurious interrupt (R12 == NULL), return from event handler.
255
 
256
_int3:
257
  // R8-R12, LR, PC and SR are automatically pushed onto the system stack by the
258
  // CPU upon interrupt entry.
259
#if 1 // B1832: interrupt stack changed to exception stack if exception is detected.
260
  mfsr    r12, AVR32_SR
261
  bfextu  r12, r12, AVR32_SR_M0_OFFSET, AVR32_SR_M0_SIZE + AVR32_SR_M1_SIZE + AVR32_SR_M2_SIZE
262
  cp.w    r12, 0b110
263
  brlo    _int3_normal
264
  lddsp   r12, sp[0 * 4]
265
  stdsp   sp[6 * 4], r12
266
  lddsp   r12, sp[1 * 4]
267
  stdsp   sp[7 * 4], r12
268
  lddsp   r12, sp[3 * 4]
269
  sub     sp, -6 * 4
270
  rete
271
_int3_normal:
272
#endif
273
  mov     r12, 3  // Pass the int_lev parameter to the _get_interrupt_handler function.
274
  call    _get_interrupt_handler
275
  cp.w    r12, 0  // Get the pointer to the interrupt handler returned by the function.
276
  movne   pc, r12 // If this was not a spurious interrupt (R12 != NULL), jump to the handler.
277
  rete            // If this was a spurious interrupt (R12 == NULL), return from event handler.
278
 
279
 
280
// Constant data area.
281
 
282
  .balign 4
283
 
284
  // Values to store in the interrupt priority registers for the various interrupt priority levels.
285
  // The interrupt priority registers contain the interrupt priority level and
286
  // the EVBA-relative interrupt vector offset.
287
  .global ipr_val
288
  .type ipr_val, @object
289
ipr_val:
290
  .word (INT0 << AVR32_INTC_IPR0_INTLEV_OFFSET) | (_int0 - _evba),\
291
        (INT1 << AVR32_INTC_IPR0_INTLEV_OFFSET) | (_int1 - _evba),\
292
        (INT2 << AVR32_INTC_IPR0_INTLEV_OFFSET) | (_int2 - _evba),\
293
        (INT3 << AVR32_INTC_IPR0_INTLEV_OFFSET) | (_int3 - _evba)
294
 
295
 
296
//! \endverbatim
297
//! @}

powered by: WebSVN 2.1.0

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