00001 /*This file is prepared for Doxygen automatic documentation generation.*/ 00021 /* Copyright (c) 2009 Atmel Corporation. All rights reserved. 00022 * 00023 * Redistribution and use in source and binary forms, with or without 00024 * modification, are permitted provided that the following conditions are met: 00025 * 00026 * 1. Redistributions of source code must retain the above copyright notice, this 00027 * list of conditions and the following disclaimer. 00028 * 00029 * 2. Redistributions in binary form must reproduce the above copyright notice, 00030 * this list of conditions and the following disclaimer in the documentation 00031 * and/or other materials provided with the distribution. 00032 * 00033 * 3. The name of Atmel may not be used to endorse or promote products derived 00034 * from this software without specific prior written permission. 00035 * 00036 * 4. This software may only be redistributed and used in connection with an Atmel 00037 * AVR product. 00038 * 00039 * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED 00040 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 00041 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE 00042 * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR 00043 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00044 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00045 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 00046 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00047 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00048 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE 00049 * 00050 */ 00051 00052 #include <avr32/io.h> 00053 00054 00057 00058 00059 .section .exception, "ax", @progbits 00060 00061 00062 // Start of Exception Vector Table. 00063 00064 // EVBA must be aligned with a power of two strictly greater than the EVBA- 00065 // relative offset of the last vector. 00066 .balign 0x200 00067 00068 // Export symbol. 00069 .global _evba 00070 .type _evba, @function 00071 _evba: 00072 00073 .org 0x000 00074 // Unrecoverable Exception. 00075 _handle_Unrecoverable_Exception: 00076 rjmp $ 00077 00078 .org 0x004 00079 // TLB Multiple Hit. 00080 _handle_TLB_Multiple_Hit: 00081 rjmp $ 00082 00083 .org 0x008 00084 // Bus Error Data Fetch. 00085 _handle_Bus_Error_Data_Fetch: 00086 rjmp $ 00087 00088 .org 0x00C 00089 // Bus Error Instruction Fetch. 00090 _handle_Bus_Error_Instruction_Fetch: 00091 rjmp $ 00092 00093 .org 0x010 00094 // NMI. 00095 _handle_NMI: 00096 rjmp $ 00097 00098 .org 0x014 00099 // Instruction Address. 00100 _handle_Instruction_Address: 00101 rjmp $ 00102 00103 .org 0x018 00104 // ITLB Protection. 00105 _handle_ITLB_Protection: 00106 rjmp $ 00107 00108 .org 0x01C 00109 // Breakpoint. 00110 _handle_Breakpoint: 00111 rjmp $ 00112 00113 .org 0x020 00114 // Illegal Opcode. 00115 _handle_Illegal_Opcode: 00116 rjmp $ 00117 00118 .org 0x024 00119 // Unimplemented Instruction. 00120 _handle_Unimplemented_Instruction: 00121 rjmp $ 00122 00123 .org 0x028 00124 // Privilege Violation. 00125 _handle_Privilege_Violation: 00126 rjmp $ 00127 00128 .org 0x02C 00129 // Floating-Point: UNUSED IN AVR32UC. 00130 _handle_Floating_Point: 00131 rjmp $ 00132 00133 .org 0x030 00134 // Coprocessor Absent: UNUSED IN AVR32UC. 00135 _handle_Coprocessor_Absent: 00136 rjmp $ 00137 00138 .org 0x034 00139 // Data Address (Read). 00140 _handle_Data_Address_Read: 00141 rjmp $ 00142 00143 .org 0x038 00144 // Data Address (Write). 00145 _handle_Data_Address_Write: 00146 rjmp $ 00147 00148 .org 0x03C 00149 // DTLB Protection (Read). 00150 _handle_DTLB_Protection_Read: 00151 rjmp $ 00152 00153 .org 0x040 00154 // DTLB Protection (Write). 00155 _handle_DTLB_Protection_Write: 00156 rjmp $ 00157 00158 .org 0x044 00159 // DTLB Modified: UNUSED IN AVR32UC. 00160 _handle_DTLB_Modified: 00161 rjmp $ 00162 00163 .org 0x050 00164 // ITLB Miss. 00165 _handle_ITLB_Miss: 00166 rjmp $ 00167 00168 .org 0x060 00169 // DTLB Miss (Read). 00170 _handle_DTLB_Miss_Read: 00171 rjmp $ 00172 00173 .org 0x070 00174 // DTLB Miss (Write). 00175 _handle_DTLB_Miss_Write: 00176 rjmp $ 00177 00178 .org 0x100 00179 // Supervisor Call. 00180 _handle_Supervisor_Call: 00181 lda.w pc, SCALLYield 00182 00183 00184 // Interrupt support. 00185 // The interrupt controller must provide the offset address relative to EVBA. 00186 // Important note: 00187 // All interrupts call a C function named _get_interrupt_handler. 00188 // This function will read group and interrupt line number to then return in 00189 // R12 a pointer to a user-provided interrupt handler. 00190 00191 .balign 4 00192 00193 .irp priority, 0, 1, 2, 3 00194 _int\priority: 00195 // R8-R12, LR, PC and SR are automatically pushed onto the system stack by the 00196 // CPU upon interrupt entry. No other register is saved by hardware. 00197 mov r12, \priority // Pass the int_level parameter to the _get_interrupt_handler function. 00198 call _get_interrupt_handler 00199 cp.w r12, 0 // Get the pointer to the interrupt handler returned by the function. 00200 movne pc, r12 // If this was not a spurious interrupt (R12 != NULL), jump to the handler. 00201 rete // If this was a spurious interrupt (R12 == NULL), return from event handler. 00202 .endr 00203 00204 00205 // Constant data area. 00206 00207 .balign 4 00208 00209 // Values to store in the interrupt priority registers for the various interrupt priority levels. 00210 // The interrupt priority registers contain the interrupt priority level and 00211 // the EVBA-relative interrupt vector offset. 00212 .global ipr_val 00213 .type ipr_val, @object 00214 ipr_val: 00215 .word (AVR32_INTC_INT0 << AVR32_INTC_IPR_INTLEVEL_OFFSET) | (_int0 - _evba),\ 00216 (AVR32_INTC_INT1 << AVR32_INTC_IPR_INTLEVEL_OFFSET) | (_int1 - _evba),\ 00217 (AVR32_INTC_INT2 << AVR32_INTC_IPR_INTLEVEL_OFFSET) | (_int2 - _evba),\ 00218 (AVR32_INTC_INT3 << AVR32_INTC_IPR_INTLEVEL_OFFSET) | (_int3 - _evba) 00219 00220