2 * FreeRTOS Kernel <DEVELOPMENT BRANCH>
3 * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5 * SPDX-License-Identifier: MIT AND BSD-3-Clause
7 * Permission is hereby granted, free of charge, to any person obtaining a copy of
8 * this software and associated documentation files (the "Software"), to deal in
9 * the Software without restriction, including without limitation the rights to
10 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11 * the Software, and to permit persons to whom the Software is furnished to do so,
12 * subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included in all
15 * copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 * https://www.FreeRTOS.org
25 * https://github.com/FreeRTOS
29 /*This file is prepared for Doxygen automatic documentation generation.*/
30 /*! \file *********************************************************************
32 * \brief Exception and interrupt vectors.
34 * This file maps all events supported by an AVR32UC.
36 * - Compiler: GNU GCC for AVR32
37 * - Supported devices: All AVR32UC devices with an INTC module can be used.
40 * \author Atmel Corporation (Now Microchip):
41 * https://www.microchip.com \n
42 * Support and FAQ: https://www.microchip.com/support/
44 ******************************************************************************/
47 * Copyright (c) 2007, Atmel Corporation All rights reserved.
49 * Redistribution and use in source and binary forms, with or without
50 * modification, are permitted provided that the following conditions are met:
52 * 1. Redistributions of source code must retain the above copyright notice,
53 * this list of conditions and the following disclaimer.
55 * 2. Redistributions in binary form must reproduce the above copyright notice,
56 * this list of conditions and the following disclaimer in the documentation
57 * and/or other materials provided with the distribution.
59 * 3. The name of ATMEL may not be used to endorse or promote products derived
60 * from this software without specific prior written permission.
62 * THIS SOFTWARE IS PROVIDED BY ATMEL ``AS IS'' AND ANY EXPRESS OR IMPLIED
63 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
64 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY AND
65 * SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT,
66 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
67 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
68 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
69 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
70 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
71 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
83 .section .exception, "ax", @progbits
86 // Start of Exception Vector Table.
88 // EVBA must be aligned with a power of two strictly greater than the EVBA-
89 // relative offset of the last vector.
94 .type _evba, @function
98 // Unrecoverable Exception.
99 _handle_Unrecoverable_Exception:
103 // TLB Multiple Hit: UNUSED IN AVR32UC.
104 _handle_TLB_Multiple_Hit:
108 // Bus Error Data Fetch.
109 _handle_Bus_Error_Data_Fetch:
113 // Bus Error Instruction Fetch.
114 _handle_Bus_Error_Instruction_Fetch:
123 // Instruction Address.
124 _handle_Instruction_Address:
129 _handle_ITLB_Protection:
139 _handle_Illegal_Opcode:
143 // Unimplemented Instruction.
144 _handle_Unimplemented_Instruction:
148 // Privilege Violation.
149 _handle_Privilege_Violation:
153 // Floating-Point: UNUSED IN AVR32UC.
154 _handle_Floating_Point:
158 // Coprocessor Absent: UNUSED IN AVR32UC.
159 _handle_Coprocessor_Absent:
163 // Data Address (Read).
164 _handle_Data_Address_Read:
168 // Data Address (Write).
169 _handle_Data_Address_Write:
173 // DTLB Protection (Read).
174 _handle_DTLB_Protection_Read:
178 // DTLB Protection (Write).
179 _handle_DTLB_Protection_Write:
183 // DTLB Modified: UNUSED IN AVR32UC.
184 _handle_DTLB_Modified:
188 // ITLB Miss: UNUSED IN AVR32UC.
193 // DTLB Miss (Read): UNUSED IN AVR32UC.
194 _handle_DTLB_Miss_Read:
198 // DTLB Miss (Write): UNUSED IN AVR32UC.
199 _handle_DTLB_Miss_Write:
204 _handle_Supervisor_Call:
208 // Interrupt support.
209 // The interrupt controller must provide the offset address relative to EVBA.
211 // All interrupts call a C function named _get_interrupt_handler.
212 // This function will read group and interrupt line number to then return in
213 // R12 a pointer to a user-provided interrupt handler.
218 // R8-R12, LR, PC and SR are automatically pushed onto the system stack by the
219 // CPU upon interrupt entry.
220 #if 1 // B1832: interrupt stack changed to exception stack if exception is detected.
222 bfextu r12, r12, AVR32_SR_M0_OFFSET, AVR32_SR_M0_SIZE + AVR32_SR_M1_SIZE + AVR32_SR_M2_SIZE
234 mov r12, 0 // Pass the int_lev parameter to the _get_interrupt_handler function.
235 call _get_interrupt_handler
236 cp.w r12, 0 // Get the pointer to the interrupt handler returned by the function.
237 movne pc, r12 // If this was not a spurious interrupt (R12 != NULL), jump to the handler.
238 rete // If this was a spurious interrupt (R12 == NULL), return from event handler.
241 // R8-R12, LR, PC and SR are automatically pushed onto the system stack by the
242 // CPU upon interrupt entry.
243 #if 1 // B1832: interrupt stack changed to exception stack if exception is detected.
245 bfextu r12, r12, AVR32_SR_M0_OFFSET, AVR32_SR_M0_SIZE + AVR32_SR_M1_SIZE + AVR32_SR_M2_SIZE
257 mov r12, 1 // Pass the int_lev parameter to the _get_interrupt_handler function.
258 call _get_interrupt_handler
259 cp.w r12, 0 // Get the pointer to the interrupt handler returned by the function.
260 movne pc, r12 // If this was not a spurious interrupt (R12 != NULL), jump to the handler.
261 rete // If this was a spurious interrupt (R12 == NULL), return from event handler.
264 // R8-R12, LR, PC and SR are automatically pushed onto the system stack by the
265 // CPU upon interrupt entry.
266 #if 1 // B1832: interrupt stack changed to exception stack if exception is detected.
268 bfextu r12, r12, AVR32_SR_M0_OFFSET, AVR32_SR_M0_SIZE + AVR32_SR_M1_SIZE + AVR32_SR_M2_SIZE
280 mov r12, 2 // Pass the int_lev parameter to the _get_interrupt_handler function.
281 call _get_interrupt_handler
282 cp.w r12, 0 // Get the pointer to the interrupt handler returned by the function.
283 movne pc, r12 // If this was not a spurious interrupt (R12 != NULL), jump to the handler.
284 rete // If this was a spurious interrupt (R12 == NULL), return from event handler.
287 // R8-R12, LR, PC and SR are automatically pushed onto the system stack by the
288 // CPU upon interrupt entry.
289 #if 1 // B1832: interrupt stack changed to exception stack if exception is detected.
291 bfextu r12, r12, AVR32_SR_M0_OFFSET, AVR32_SR_M0_SIZE + AVR32_SR_M1_SIZE + AVR32_SR_M2_SIZE
303 mov r12, 3 // Pass the int_lev parameter to the _get_interrupt_handler function.
304 call _get_interrupt_handler
305 cp.w r12, 0 // Get the pointer to the interrupt handler returned by the function.
306 movne pc, r12 // If this was not a spurious interrupt (R12 != NULL), jump to the handler.
307 rete // If this was a spurious interrupt (R12 == NULL), return from event handler.
310 // Constant data area.
314 // Values to store in the interrupt priority registers for the various interrupt priority levels.
315 // The interrupt priority registers contain the interrupt priority level and
316 // the EVBA-relative interrupt vector offset.
318 .type ipr_val, @object
320 .word (INT0 << AVR32_INTC_IPR0_INTLEV_OFFSET) | (_int0 - _evba),\
321 (INT1 << AVR32_INTC_IPR0_INTLEV_OFFSET) | (_int1 - _evba),\
322 (INT2 << AVR32_INTC_IPR0_INTLEV_OFFSET) | (_int2 - _evba),\
323 (INT3 << AVR32_INTC_IPR0_INTLEV_OFFSET) | (_int3 - _evba)