1 /*
2 * Copyright (c) 2012 Travis Geiselbrecht
3 *
4 * Use of this source code is governed by a MIT-style
5 * license that can be found in the LICENSE file or at
6 * https://opensource.org/licenses/MIT
7 */
8 #include <lk/debug.h>
9 #include <lk/compiler.h>
10 #include <arch/arm/cm.h>
11 #include <lib/cbuf.h>
12 #include <platform/nrf51.h>
13 #include <target/debugconfig.h>
14
15 /* un-overridden irq handler */
nrf51_dummy_irq(void)16 void nrf51_dummy_irq(void) {
17 arm_cm_irq_entry();
18 panic("unhandled irq\n");
19 }
20
21 /* a list of default handlers that are simply aliases to the dummy handler */
22 #define DEFAULT_HANDLER(x) \
23 void nrf51_##x(void) __WEAK_ALIAS("nrf51_dummy_irq");
24
25 DEFAULT_HANDLER(POWER_CLOCK_IRQ);
26 DEFAULT_HANDLER(RADIO_IRQ);
27 DEFAULT_HANDLER(UART0_IRQ);
28 DEFAULT_HANDLER(SPI0_TWI0_IRQ);
29 DEFAULT_HANDLER(SPI1_TWI1_IRQ);
30
31 DEFAULT_HANDLER(RESERVED_IRQ);
32 DEFAULT_HANDLER(GPIOTE_IRQ);
33 DEFAULT_HANDLER(ADC_IRQ);
34 DEFAULT_HANDLER(TIMER0_IRQ);
35 DEFAULT_HANDLER(TIMER1_IRQ);
36 DEFAULT_HANDLER(TIMER2_IRQ);
37
38 DEFAULT_HANDLER(RTC0_IRQ);
39 DEFAULT_HANDLER(TEMP_IRQ);
40 DEFAULT_HANDLER(RNG_IRQ);
41 DEFAULT_HANDLER(ECB_IRQ);
42 DEFAULT_HANDLER(CCM_AAR_IRQ);
43
44 DEFAULT_HANDLER(WDT_IRQ);
45 DEFAULT_HANDLER(RTC1_IRQ);
46 DEFAULT_HANDLER(QDEC_IRQ);
47 DEFAULT_HANDLER(LPCOMP_IRQ);
48 DEFAULT_HANDLER(SWI0_IRQ);
49
50 DEFAULT_HANDLER(SWI1_IRQ);
51 DEFAULT_HANDLER(SWI2_IRQ);
52 DEFAULT_HANDLER(SWI3_IRQ);
53 DEFAULT_HANDLER(SWI4_IRQ);
54 DEFAULT_HANDLER(SWI5_IRQ);
55
56
57 #define VECTAB_ENTRY(x) [x##n] = nrf51_##x
58
59 /* appended to the end of the main vector table */
60 const void *const __SECTION(".text.boot.vectab2") vectab2[] = {
61
62 VECTAB_ENTRY(POWER_CLOCK_IRQ),
63 VECTAB_ENTRY(RADIO_IRQ),
64 VECTAB_ENTRY(UART0_IRQ),
65 VECTAB_ENTRY(SPI0_TWI0_IRQ),
66 VECTAB_ENTRY(SPI1_TWI1_IRQ),
67 VECTAB_ENTRY(RESERVED_IRQ),
68 VECTAB_ENTRY(GPIOTE_IRQ),
69 VECTAB_ENTRY(ADC_IRQ),
70 VECTAB_ENTRY(TIMER0_IRQ),
71 VECTAB_ENTRY(TIMER1_IRQ),
72 VECTAB_ENTRY(TIMER2_IRQ),
73
74 VECTAB_ENTRY(RTC0_IRQ),
75 VECTAB_ENTRY(TEMP_IRQ),
76 VECTAB_ENTRY(RNG_IRQ),
77 VECTAB_ENTRY(ECB_IRQ),
78 VECTAB_ENTRY(CCM_AAR_IRQ),
79
80 VECTAB_ENTRY(WDT_IRQ),
81 VECTAB_ENTRY(RTC1_IRQ),
82 VECTAB_ENTRY(QDEC_IRQ),
83 VECTAB_ENTRY(LPCOMP_IRQ),
84 VECTAB_ENTRY(SWI0_IRQ),
85
86 VECTAB_ENTRY(SWI1_IRQ),
87 VECTAB_ENTRY(SWI2_IRQ),
88 VECTAB_ENTRY(SWI3_IRQ),
89 VECTAB_ENTRY(SWI4_IRQ),
90 VECTAB_ENTRY(SWI5_IRQ),
91 };
92
93