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