1 /*This file is prepared for Doxygen automatic documentation generation.*/
\r
2 /*! \file *********************************************************************
\r
4 * \brief Exception and interrupt vectors.
\r
6 * This file maps all events supported by an AVR32UC.
\r
8 * - Compiler: IAR EWAVR32
\r
9 * - Supported devices: All AVR32UC devices with an INTC module can be used.
\r
12 * \author Atmel Corporation: http://www.atmel.com \n
\r
13 * Support and FAQ: http://support.atmel.no/
\r
15 ******************************************************************************/
\r
17 /* Copyright (c) 2007, Atmel Corporation All rights reserved.
\r
19 * Redistribution and use in source and binary forms, with or without
\r
20 * modification, are permitted provided that the following conditions are met:
\r
22 * 1. Redistributions of source code must retain the above copyright notice,
\r
23 * this list of conditions and the following disclaimer.
\r
25 * 2. Redistributions in binary form must reproduce the above copyright notice,
\r
26 * this list of conditions and the following disclaimer in the documentation
\r
27 * and/or other materials provided with the distribution.
\r
29 * 3. The name of ATMEL may not be used to endorse or promote products derived
\r
30 * from this software without specific prior written permission.
\r
32 * THIS SOFTWARE IS PROVIDED BY ATMEL ``AS IS'' AND ANY EXPRESS OR IMPLIED
\r
33 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
\r
34 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY AND
\r
35 * SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT,
\r
36 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
\r
37 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
\r
38 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
\r
39 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
\r
40 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
\r
41 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\r
45 #include <avr32/io.h>
\r
53 // Start of Exception Vector Table.
\r
55 // EVBA must be aligned with a power of two strictly greater than the EVBA-
\r
56 // relative offset of the last vector.
\r
57 COMMON EVTAB:CODE:ROOT(9)
\r
60 // Force EVBA initialization.
\r
71 // Unrecoverable Exception.
\r
72 _handle_Unrecoverable_Exception:
\r
76 // TLB Multiple Hit: UNUSED IN AVR32UC.
\r
77 _handle_TLB_Multiple_Hit:
\r
81 // Bus Error Data Fetch.
\r
82 _handle_Bus_Error_Data_Fetch:
\r
86 // Bus Error Instruction Fetch.
\r
87 _handle_Bus_Error_Instruction_Fetch:
\r
96 // Instruction Address.
\r
97 _handle_Instruction_Address:
\r
101 // ITLB Protection.
\r
102 _handle_ITLB_Protection:
\r
107 _handle_Breakpoint:
\r
112 _handle_Illegal_Opcode:
\r
116 // Unimplemented Instruction.
\r
117 _handle_Unimplemented_Instruction:
\r
121 // Privilege Violation.
\r
122 _handle_Privilege_Violation:
\r
126 // Floating-Point: UNUSED IN AVR32UC.
\r
127 _handle_Floating_Point:
\r
131 // Coprocessor Absent: UNUSED IN AVR32UC.
\r
132 _handle_Coprocessor_Absent:
\r
136 // Data Address (Read).
\r
137 _handle_Data_Address_Read:
\r
141 // Data Address (Write).
\r
142 _handle_Data_Address_Write:
\r
146 // DTLB Protection (Read).
\r
147 _handle_DTLB_Protection_Read:
\r
151 // DTLB Protection (Write).
\r
152 _handle_DTLB_Protection_Write:
\r
156 // DTLB Modified: UNUSED IN AVR32UC.
\r
157 _handle_DTLB_Modified:
\r
161 // ITLB Miss: UNUSED IN AVR32UC.
\r
166 // DTLB Miss (Read): UNUSED IN AVR32UC.
\r
167 _handle_DTLB_Miss_Read:
\r
171 // DTLB Miss (Write): UNUSED IN AVR32UC.
\r
172 _handle_DTLB_Miss_Write:
\r
176 // Supervisor Call.
\r
177 _handle_Supervisor_Call:
\r
178 lddpc pc, __SCALLYield
\r
181 // Interrupt support.
\r
182 // The interrupt controller must provide the offset address relative to EVBA.
\r
184 // All interrupts call a C function named _get_interrupt_handler.
\r
185 // This function will read group and interrupt line number to then return in
\r
186 // R12 a pointer to a user-provided interrupt handler.
\r
191 // R8-R12, LR, PC and SR are automatically pushed onto the system stack by the
\r
192 // CPU upon interrupt entry.
\r
193 #if 1 // B1832: interrupt stack changed to exception stack if exception is detected.
\r
195 bfextu r12, r12, AVR32_SR_M0_OFFSET, AVR32_SR_M0_SIZE + AVR32_SR_M1_SIZE + AVR32_SR_M2_SIZE
\r
198 lddsp r12, sp[0 * 4]
\r
199 stdsp sp[6 * 4], r12
\r
200 lddsp r12, sp[1 * 4]
\r
201 stdsp sp[7 * 4], r12
\r
202 lddsp r12, sp[3 * 4]
\r
207 mov r12, 0 // Pass the int_lev parameter to the _get_interrupt_handler function.
\r
208 mcall __get_interrupt_handler
\r
209 cp.w r12, 0 // Get the pointer to the interrupt handler returned by the function.
\r
210 movne pc, r12 // If this was not a spurious interrupt (R12 != NULL), jump to the handler.
\r
211 rete // If this was a spurious interrupt (R12 == NULL), return from event handler.
\r
214 // R8-R12, LR, PC and SR are automatically pushed onto the system stack by the
\r
215 // CPU upon interrupt entry.
\r
216 #if 1 // B1832: interrupt stack changed to exception stack if exception is detected.
\r
218 bfextu r12, r12, AVR32_SR_M0_OFFSET, AVR32_SR_M0_SIZE + AVR32_SR_M1_SIZE + AVR32_SR_M2_SIZE
\r
221 lddsp r12, sp[0 * 4]
\r
222 stdsp sp[6 * 4], r12
\r
223 lddsp r12, sp[1 * 4]
\r
224 stdsp sp[7 * 4], r12
\r
225 lddsp r12, sp[3 * 4]
\r
230 mov r12, 1 // Pass the int_lev parameter to the _get_interrupt_handler function.
\r
231 mcall __get_interrupt_handler
\r
232 cp.w r12, 0 // Get the pointer to the interrupt handler returned by the function.
\r
233 movne pc, r12 // If this was not a spurious interrupt (R12 != NULL), jump to the handler.
\r
234 rete // If this was a spurious interrupt (R12 == NULL), return from event handler.
\r
237 // R8-R12, LR, PC and SR are automatically pushed onto the system stack by the
\r
238 // CPU upon interrupt entry.
\r
239 #if 1 // B1832: interrupt stack changed to exception stack if exception is detected.
\r
241 bfextu r12, r12, AVR32_SR_M0_OFFSET, AVR32_SR_M0_SIZE + AVR32_SR_M1_SIZE + AVR32_SR_M2_SIZE
\r
244 lddsp r12, sp[0 * 4]
\r
245 stdsp sp[6 * 4], r12
\r
246 lddsp r12, sp[1 * 4]
\r
247 stdsp sp[7 * 4], r12
\r
248 lddsp r12, sp[3 * 4]
\r
253 mov r12, 2 // Pass the int_lev parameter to the _get_interrupt_handler function.
\r
254 mcall __get_interrupt_handler
\r
255 cp.w r12, 0 // Get the pointer to the interrupt handler returned by the function.
\r
256 movne pc, r12 // If this was not a spurious interrupt (R12 != NULL), jump to the handler.
\r
257 rete // If this was a spurious interrupt (R12 == NULL), return from event handler.
\r
260 // R8-R12, LR, PC and SR are automatically pushed onto the system stack by the
\r
261 // CPU upon interrupt entry.
\r
262 #if 1 // B1832: interrupt stack changed to exception stack if exception is detected.
\r
264 bfextu r12, r12, AVR32_SR_M0_OFFSET, AVR32_SR_M0_SIZE + AVR32_SR_M1_SIZE + AVR32_SR_M2_SIZE
\r
267 lddsp r12, sp[0 * 4]
\r
268 stdsp sp[6 * 4], r12
\r
269 lddsp r12, sp[1 * 4]
\r
270 stdsp sp[7 * 4], r12
\r
271 lddsp r12, sp[3 * 4]
\r
276 mov r12, 3 // Pass the int_lev parameter to the _get_interrupt_handler function.
\r
277 mcall __get_interrupt_handler
\r
278 cp.w r12, 0 // Get the pointer to the interrupt handler returned by the function.
\r
279 movne pc, r12 // If this was not a spurious interrupt (R12 != NULL), jump to the handler.
\r
280 rete // If this was a spurious interrupt (R12 == NULL), return from event handler.
\r
283 // Constant data area.
\r
289 EXTERN _get_interrupt_handler
\r
292 __get_interrupt_handler:
\r
293 DC32 _get_interrupt_handler
\r
295 // Values to store in the interrupt priority registers for the various interrupt priority levels.
\r
296 // The interrupt priority registers contain the interrupt priority level and
\r
297 // the EVBA-relative interrupt vector offset.
\r
300 DC32 (INT0 << AVR32_INTC_IPR0_INTLEV_OFFSET) | (_int0 - _evba),\
\r
301 (INT1 << AVR32_INTC_IPR0_INTLEV_OFFSET) | (_int1 - _evba),\
\r
302 (INT2 << AVR32_INTC_IPR0_INTLEV_OFFSET) | (_int2 - _evba),\
\r
303 (INT3 << AVR32_INTC_IPR0_INTLEV_OFFSET) | (_int3 - _evba)
\r