]> git.friedersdorff.com Git - max/tmk_keyboard.git/blob - tmk_core/protocol/lufa/LUFA-git/LUFA/Platform/UC3/InterruptManagement.c
Merge commit '71381457fa1311dfa0b58ba882a96db740640871'
[max/tmk_keyboard.git] / tmk_core / protocol / lufa / LUFA-git / LUFA / Platform / UC3 / InterruptManagement.c
1 /*
2              LUFA Library
3      Copyright (C) Dean Camera, 2014.
4
5   dean [at] fourwalledcubicle [dot] com
6            www.lufa-lib.org
7 */
8
9 /*
10   Copyright 2014  Dean Camera (dean [at] fourwalledcubicle [dot] com)
11
12   Permission to use, copy, modify, distribute, and sell this
13   software and its documentation for any purpose is hereby granted
14   without fee, provided that the above copyright notice appear in
15   all copies and that both that the copyright notice and this
16   permission notice and warranty disclaimer appear in supporting
17   documentation, and that the name of the author not be used in
18   advertising or publicity pertaining to distribution of the
19   software without specific, written prior permission.
20
21   The author disclaims all warranties with regard to this
22   software, including all implied warranties of merchantability
23   and fitness.  In no event shall the author be liable for any
24   special, indirect or consequential damages or any damages
25   whatsoever resulting from loss of use, data or profits, whether
26   in an action of contract, negligence or other tortious action,
27   arising out of or in connection with the use or performance of
28   this software.
29 */
30
31 #include "../../Common/Common.h"
32 #if (ARCH == ARCH_UC3)
33
34 #define  __INCLUDE_FROM_INTMANAGEMENT_C
35 #include "InterruptManagement.h"
36
37 /** Interrupt vector table, containing the ISR to call for each interrupt group */
38 InterruptHandlerPtr_t InterruptHandlers[AVR32_INTC_NUM_INT_GRPS];
39
40 /** ISR for unhandled interrupt groups */
41 ISR(Unhandled_Interrupt)
42 {
43         for (;;);
44 }
45
46 InterruptHandlerPtr_t INTC_GetInterruptHandler(const uint_reg_t InterruptLevel)
47 {
48         return InterruptHandlers[AVR32_INTC.icr[AVR32_INTC_INT3 - InterruptLevel]];
49 }
50
51 void INTC_Init(void)
52 {
53         for (uint8_t InterruptGroup = 0; InterruptGroup < AVR32_INTC_NUM_INT_GRPS; InterruptGroup++)
54         {
55                 InterruptHandlers[InterruptGroup] = Unhandled_Interrupt;
56                 AVR32_INTC.ipr[InterruptGroup]    = Autovector_Table[AVR32_INTC_INT0];
57         }
58
59         __builtin_mtsr(AVR32_EVBA, (uintptr_t)&EVBA_Table);
60 }
61
62 #endif