3 Copyright (C) Dean Camera, 2012.
\r
5 dean [at] fourwalledcubicle [dot] com
\r
10 Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com)
\r
12 Permission to use, copy, modify, distribute, and sell this
\r
13 software and its documentation for any purpose is hereby granted
\r
14 without fee, provided that the above copyright notice appear in
\r
15 all copies and that both that the copyright notice and this
\r
16 permission notice and warranty disclaimer appear in supporting
\r
17 documentation, and that the name of the author not be used in
\r
18 advertising or publicity pertaining to distribution of the
\r
19 software without specific, written prior permission.
\r
21 The author disclaim all warranties with regard to this
\r
22 software, including all implied warranties of merchantability
\r
23 and fitness. In no event shall the author be liable for any
\r
24 special, indirect or consequential damages or any damages
\r
25 whatsoever resulting from loss of use, data or profits, whether
\r
26 in an action of contract, negligence or other tortious action,
\r
27 arising out of or in connection with the use or performance of
\r
31 #include "../../Common/Common.h"
\r
32 #if (ARCH == ARCH_UC3)
\r
34 #define __INCLUDE_FROM_INTMANAGEMENT_C
\r
35 #include "InterruptManagement.h"
\r
37 /** Interrupt vector table, containing the ISR to call for each interrupt group */
\r
38 InterruptHandlerPtr_t InterruptHandlers[AVR32_INTC_NUM_INT_GRPS];
\r
40 /** ISR for unhandled interrupt groups */
\r
41 ISR(Unhandled_Interrupt)
\r
46 /** Retrieves the associated interrupt handler for the interrupt group currently being fired. This
\r
47 * is called directly from the exception handler routine before dispatching to the ISR.
\r
49 InterruptHandlerPtr_t INTC_GetInterruptHandler(const uint_reg_t InterruptLevel)
\r
51 return InterruptHandlers[AVR32_INTC.icr[AVR32_INTC_INT3 - InterruptLevel]];
\r
54 /** Initializes the interrupt controller ready to handle interrupts. This must be called at the
\r
55 * start of the user program before any interrupts are registered or enabled.
\r
57 void INTC_Init(void)
\r
59 for (uint8_t InterruptGroup = 0; InterruptGroup < AVR32_INTC_NUM_INT_GRPS; InterruptGroup++)
\r
61 InterruptHandlers[InterruptGroup] = Unhandled_Interrupt;
\r
62 AVR32_INTC.ipr[InterruptGroup] = Autovector_Table[AVR32_INTC_INT0];
\r
65 __builtin_mtsr(AVR32_EVBA, (uintptr_t)&EVBA_Table);
\r