blob: 5f9c80877169e4db89ead3e66a62e182aad5b29f [file] [log] [blame]
rjw1f884582022-01-06 17:20:42 +08001/*
2 * Copyright (c) 2012 Travis Geiselbrecht
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining
5 * a copy of this software and associated documentation files
6 * (the "Software"), to deal in the Software without restriction,
7 * including without limitation the rights to use, copy, modify, merge,
8 * publish, distribute, sublicense, and/or sell copies of the Software,
9 * and to permit persons to whom the Software is furnished to do so,
10 * subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be
13 * included in all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
19 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
20 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
21 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 */
23#include <debug.h>
24#include <compiler.h>
25#include <arch/arm/cm.h>
26#include <lib/cbuf.h>
27#include <platform/nrf51.h>
28#include <target/debugconfig.h>
29
30/* un-overridden irq handler */
31void nrf51_dummy_irq(void)
32{
33 arm_cm_irq_entry();
34 panic("unhandled irq\n");
35}
36
37/* a list of default handlers that are simply aliases to the dummy handler */
38#define DEFAULT_HANDLER(x) \
39void nrf51_##x(void) __WEAK_ALIAS("nrf51_dummy_irq");
40
41DEFAULT_HANDLER(POWER_CLOCK_IRQ);
42DEFAULT_HANDLER(RADIO_IRQ);
43DEFAULT_HANDLER(UART0_IRQ);
44DEFAULT_HANDLER(SPI0_TWI0_IRQ);
45DEFAULT_HANDLER(SPI1_TWI1_IRQ);
46
47DEFAULT_HANDLER(RESERVED_IRQ);
48DEFAULT_HANDLER(GPIOTE_IRQ);
49DEFAULT_HANDLER(ADC_IRQ);
50DEFAULT_HANDLER(TIMER0_IRQ);
51DEFAULT_HANDLER(TIMER1_IRQ);
52DEFAULT_HANDLER(TIMER2_IRQ);
53
54DEFAULT_HANDLER(RTC0_IRQ);
55DEFAULT_HANDLER(TEMP_IRQ);
56DEFAULT_HANDLER(RNG_IRQ);
57DEFAULT_HANDLER(ECB_IRQ);
58DEFAULT_HANDLER(CCM_AAR_IRQ);
59
60DEFAULT_HANDLER(WDT_IRQ);
61DEFAULT_HANDLER(RTC1_IRQ);
62DEFAULT_HANDLER(QDEC_IRQ);
63DEFAULT_HANDLER(LPCOMP_IRQ);
64DEFAULT_HANDLER(SWI0_IRQ);
65
66DEFAULT_HANDLER(SWI1_IRQ);
67DEFAULT_HANDLER(SWI2_IRQ);
68DEFAULT_HANDLER(SWI3_IRQ);
69DEFAULT_HANDLER(SWI4_IRQ);
70DEFAULT_HANDLER(SWI5_IRQ);
71
72
73#define VECTAB_ENTRY(x) [x##n] = nrf51_##x
74
75/* appended to the end of the main vector table */
76const void * const __SECTION(".text.boot.vectab2") vectab2[] = {
77
78VECTAB_ENTRY(POWER_CLOCK_IRQ),
79VECTAB_ENTRY(RADIO_IRQ),
80VECTAB_ENTRY(UART0_IRQ),
81VECTAB_ENTRY(SPI0_TWI0_IRQ),
82VECTAB_ENTRY(SPI1_TWI1_IRQ),
83VECTAB_ENTRY(RESERVED_IRQ),
84VECTAB_ENTRY(GPIOTE_IRQ),
85VECTAB_ENTRY(ADC_IRQ),
86VECTAB_ENTRY(TIMER0_IRQ),
87VECTAB_ENTRY(TIMER1_IRQ),
88VECTAB_ENTRY(TIMER2_IRQ),
89
90VECTAB_ENTRY(RTC0_IRQ),
91VECTAB_ENTRY(TEMP_IRQ),
92VECTAB_ENTRY(RNG_IRQ),
93VECTAB_ENTRY(ECB_IRQ),
94VECTAB_ENTRY(CCM_AAR_IRQ),
95
96VECTAB_ENTRY(WDT_IRQ),
97VECTAB_ENTRY(RTC1_IRQ),
98VECTAB_ENTRY(QDEC_IRQ),
99VECTAB_ENTRY(LPCOMP_IRQ),
100VECTAB_ENTRY(SWI0_IRQ),
101
102VECTAB_ENTRY(SWI1_IRQ),
103VECTAB_ENTRY(SWI2_IRQ),
104VECTAB_ENTRY(SWI3_IRQ),
105VECTAB_ENTRY(SWI4_IRQ),
106VECTAB_ENTRY(SWI5_IRQ),
107};
108