]> git.sur5r.net Git - freertos/blob - Demo/AVR32_UC3A_GCC/Atmel_SW_Framework/DRIVERS/INTC/exception._s82
e477128fa285c1cea504ea17f2cf405e6c4e9a44
[freertos] / Demo / AVR32_UC3A_GCC / Atmel_SW_Framework / DRIVERS / INTC / exception._s82
1 /*This file is prepared for Doxygen automatic documentation generation.*/\r
2 /*! \file *********************************************************************\r
3  *\r
4  * \brief Exception and interrupt vectors.\r
5  *\r
6  * This file maps all events supported by an AVR32.\r
7  *\r
8  * - Compiler:           IAR EWAVR32\r
9  * - Supported devices:  All AVR32 devices with an INTC module can be used.\r
10  * - AppNote:\r
11  *\r
12  * \author               Atmel Corporation: http://www.atmel.com \n\r
13  *                       Support and FAQ: http://support.atmel.no/\r
14  *\r
15  ******************************************************************************/\r
16 \r
17 /* Copyright (c) 2009 Atmel Corporation. All rights reserved.\r
18  *\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
21  *\r
22  * 1. Redistributions of source code must retain the above copyright notice, this\r
23  * list of conditions and the following disclaimer.\r
24  *\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
28  *\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
31  *\r
32  * 4. This software may only be redistributed and used in connection with an Atmel\r
33  * AVR product.\r
34  *\r
35  * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED\r
36  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\r
37  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE\r
38  * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR\r
39  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\r
40  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r
41  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\r
42  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r
43  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\r
44  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE\r
45  *\r
46  */\r
47 \r
48 #if __CORE__ != __AVR32A__ && __CORE__ != __AVR32B__\r
49   #error Implementation of the AVR32 architecture not supported by the INTC driver.\r
50 #endif\r
51 \r
52 \r
53 #include <avr32/io.h>\r
54 \r
55 \r
56 //! @{\r
57 //! \verbatim\r
58 \r
59 \r
60 // Start of Exception Vector Table.\r
61 \r
62   // EVBA must be aligned with a power of two strictly greater than the EVBA-\r
63   // relative offset of the last vector.\r
64   COMMON  EVTAB:CODE:ROOT(9)\r
65 \r
66 \r
67   // Force EVBA initialization.\r
68   EXTERN  ??init_EVBA\r
69   REQUIRE ??init_EVBA\r
70 \r
71   // Export symbol.\r
72   PUBLIC  ??EVBA\r
73   PUBLIC  _evba\r
74 ??EVBA:\r
75 _evba:\r
76 \r
77         ORG 0x000\r
78         // Unrecoverable Exception.\r
79 _handle_Unrecoverable_Exception:\r
80         rjmp $\r
81 \r
82         ORG 0x004\r
83         // TLB Multiple Hit.\r
84 _handle_TLB_Multiple_Hit:\r
85         rjmp $\r
86 \r
87         ORG 0x008\r
88         // Bus Error Data Fetch.\r
89 _handle_Bus_Error_Data_Fetch:\r
90         rjmp $\r
91 \r
92         ORG 0x00C\r
93          // Bus Error Instruction Fetch.\r
94 _handle_Bus_Error_Instruction_Fetch:\r
95         rjmp $\r
96 \r
97         ORG 0x010\r
98         // NMI.\r
99 _handle_NMI:\r
100         rjmp $\r
101 \r
102         ORG 0x014\r
103         // Instruction Address.\r
104 _handle_Instruction_Address:\r
105         rjmp $\r
106 \r
107         ORG 0x018\r
108         // ITLB Protection.\r
109 _handle_ITLB_Protection:\r
110         rjmp $\r
111 \r
112         ORG 0x01C\r
113         // Breakpoint.\r
114 _handle_Breakpoint:\r
115         rjmp $\r
116 \r
117         ORG 0x020\r
118         // Illegal Opcode.\r
119 _handle_Illegal_Opcode:\r
120         rjmp $\r
121 \r
122         ORG 0x024\r
123         // Unimplemented Instruction.\r
124 _handle_Unimplemented_Instruction:\r
125         rjmp $\r
126 \r
127         ORG 0x028\r
128         // Privilege Violation.\r
129 _handle_Privilege_Violation:\r
130         rjmp $\r
131 \r
132         ORG 0x02C\r
133         // Floating-Point: UNUSED IN AVR32UC and AVR32AP.\r
134 _handle_Floating_Point:\r
135         rjmp $\r
136 \r
137         ORG 0x030\r
138         // Coprocessor Absent: UNUSED IN AVR32UC.\r
139 _handle_Coprocessor_Absent:\r
140         rjmp $\r
141 \r
142         ORG 0x034\r
143         // Data Address (Read).\r
144 _handle_Data_Address_Read:\r
145         rjmp $\r
146 \r
147         ORG 0x038\r
148         // Data Address (Write).\r
149 _handle_Data_Address_Write:\r
150         rjmp $\r
151 \r
152         ORG 0x03C\r
153         // DTLB Protection (Read).\r
154 _handle_DTLB_Protection_Read:\r
155         rjmp $\r
156 \r
157         ORG 0x040\r
158         // DTLB Protection (Write).\r
159 _handle_DTLB_Protection_Write:\r
160         rjmp $\r
161 \r
162         ORG 0x044\r
163         // DTLB Modified: UNUSED IN AVR32UC.\r
164 _handle_DTLB_Modified:\r
165         rjmp $\r
166 \r
167         ORG 0x050\r
168         // ITLB Miss.\r
169 _handle_ITLB_Miss:\r
170         rjmp $\r
171 \r
172         ORG 0x060\r
173         // DTLB Miss (Read).\r
174 _handle_DTLB_Miss_Read:\r
175         rjmp $\r
176 \r
177         ORG 0x070\r
178         // DTLB Miss (Write).\r
179 _handle_DTLB_Miss_Write:\r
180         rjmp $\r
181 \r
182         ORG 0x100\r
183         // Supervisor Call.\r
184 _handle_Supervisor_Call:\r
185         rjmp $\r
186 \r
187 \r
188 // Interrupt support.\r
189 // The interrupt controller must provide the offset address relative to EVBA.\r
190 // Important note:\r
191 //   All interrupts call a C function named _get_interrupt_handler.\r
192 //   This function will read group and interrupt line number to then return in\r
193 //   R12 a pointer to a user-provided interrupt handler.\r
194 \r
195   ALIGN 2\r
196 \r
197   REPTI   priority, 0, 1, 2, 3\r
198 _int<priority>:\r
199 #if __CORE__ == __AVR32A__\r
200   // R8-R12, LR, PC and SR are automatically pushed onto the system stack by the\r
201   // CPU upon interrupt entry. No other register is saved by hardware.\r
202 #elif __CORE__ == __AVR32B__\r
203   // PC and SR are automatically saved in respectively RAR_INTx and RSR_INTx by\r
204   // the CPU upon interrupt entry. No other register is saved by hardware.\r
205   pushm   r8-r12, lr\r
206 #endif\r
207   mov     r12, priority   // Pass the int_level 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 #if __CORE__ == __AVR32A__\r
211   movne   pc, r12         // If this was not a spurious interrupt (R12 != NULL), jump to the handler.\r
212 #elif __CORE__ == __AVR32B__\r
213   breq    spint<priority> // If this was a spurious interrupt (R12 == NULL), branch.\r
214   st.w    --sp, r12       // Push the pointer to the interrupt handler onto the system stack since no register may be altered.\r
215   popm    r8-r12, lr, pc  // Restore registers and jump to the handler.\r
216 spint<priority>:\r
217   popm    r8-r12, lr\r
218 #endif\r
219   rete                    // If this was a spurious interrupt (R12 == NULL), return from event handler.\r
220   ENDR\r
221 \r
222 \r
223 // Constant data area.\r
224 \r
225   ALIGN 2\r
226 \r
227   // Import symbol.\r
228   EXTERN  _get_interrupt_handler\r
229 __get_interrupt_handler:\r
230   DC32  _get_interrupt_handler\r
231 \r
232   // Values to store in the interrupt priority registers for the various interrupt priority levels.\r
233   // The interrupt priority registers contain the interrupt priority level and\r
234   // the EVBA-relative interrupt vector offset.\r
235   PUBLIC  ipr_val\r
236 ipr_val:\r
237   DC32  (AVR32_INTC_INT0 << AVR32_INTC_IPR_INTLEVEL_OFFSET) | (_int0 - _evba),\\r
238         (AVR32_INTC_INT1 << AVR32_INTC_IPR_INTLEVEL_OFFSET) | (_int1 - _evba),\\r
239         (AVR32_INTC_INT2 << AVR32_INTC_IPR_INTLEVEL_OFFSET) | (_int2 - _evba),\\r
240         (AVR32_INTC_INT3 << AVR32_INTC_IPR_INTLEVEL_OFFSET) | (_int3 - _evba)\r
241 \r
242 \r
243   END\r
244 \r
245 \r
246 //! \endverbatim\r
247 //! @}\r