rjw | 1f88458 | 2022-01-06 17:20:42 +0800 | [diff] [blame^] | 1 | /* |
| 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 */ |
| 31 | void 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) \ |
| 39 | void nrf51_##x(void) __WEAK_ALIAS("nrf51_dummy_irq"); |
| 40 | |
| 41 | DEFAULT_HANDLER(POWER_CLOCK_IRQ); |
| 42 | DEFAULT_HANDLER(RADIO_IRQ); |
| 43 | DEFAULT_HANDLER(UART0_IRQ); |
| 44 | DEFAULT_HANDLER(SPI0_TWI0_IRQ); |
| 45 | DEFAULT_HANDLER(SPI1_TWI1_IRQ); |
| 46 | |
| 47 | DEFAULT_HANDLER(RESERVED_IRQ); |
| 48 | DEFAULT_HANDLER(GPIOTE_IRQ); |
| 49 | DEFAULT_HANDLER(ADC_IRQ); |
| 50 | DEFAULT_HANDLER(TIMER0_IRQ); |
| 51 | DEFAULT_HANDLER(TIMER1_IRQ); |
| 52 | DEFAULT_HANDLER(TIMER2_IRQ); |
| 53 | |
| 54 | DEFAULT_HANDLER(RTC0_IRQ); |
| 55 | DEFAULT_HANDLER(TEMP_IRQ); |
| 56 | DEFAULT_HANDLER(RNG_IRQ); |
| 57 | DEFAULT_HANDLER(ECB_IRQ); |
| 58 | DEFAULT_HANDLER(CCM_AAR_IRQ); |
| 59 | |
| 60 | DEFAULT_HANDLER(WDT_IRQ); |
| 61 | DEFAULT_HANDLER(RTC1_IRQ); |
| 62 | DEFAULT_HANDLER(QDEC_IRQ); |
| 63 | DEFAULT_HANDLER(LPCOMP_IRQ); |
| 64 | DEFAULT_HANDLER(SWI0_IRQ); |
| 65 | |
| 66 | DEFAULT_HANDLER(SWI1_IRQ); |
| 67 | DEFAULT_HANDLER(SWI2_IRQ); |
| 68 | DEFAULT_HANDLER(SWI3_IRQ); |
| 69 | DEFAULT_HANDLER(SWI4_IRQ); |
| 70 | DEFAULT_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 */ |
| 76 | const void * const __SECTION(".text.boot.vectab2") vectab2[] = { |
| 77 | |
| 78 | VECTAB_ENTRY(POWER_CLOCK_IRQ), |
| 79 | VECTAB_ENTRY(RADIO_IRQ), |
| 80 | VECTAB_ENTRY(UART0_IRQ), |
| 81 | VECTAB_ENTRY(SPI0_TWI0_IRQ), |
| 82 | VECTAB_ENTRY(SPI1_TWI1_IRQ), |
| 83 | VECTAB_ENTRY(RESERVED_IRQ), |
| 84 | VECTAB_ENTRY(GPIOTE_IRQ), |
| 85 | VECTAB_ENTRY(ADC_IRQ), |
| 86 | VECTAB_ENTRY(TIMER0_IRQ), |
| 87 | VECTAB_ENTRY(TIMER1_IRQ), |
| 88 | VECTAB_ENTRY(TIMER2_IRQ), |
| 89 | |
| 90 | VECTAB_ENTRY(RTC0_IRQ), |
| 91 | VECTAB_ENTRY(TEMP_IRQ), |
| 92 | VECTAB_ENTRY(RNG_IRQ), |
| 93 | VECTAB_ENTRY(ECB_IRQ), |
| 94 | VECTAB_ENTRY(CCM_AAR_IRQ), |
| 95 | |
| 96 | VECTAB_ENTRY(WDT_IRQ), |
| 97 | VECTAB_ENTRY(RTC1_IRQ), |
| 98 | VECTAB_ENTRY(QDEC_IRQ), |
| 99 | VECTAB_ENTRY(LPCOMP_IRQ), |
| 100 | VECTAB_ENTRY(SWI0_IRQ), |
| 101 | |
| 102 | VECTAB_ENTRY(SWI1_IRQ), |
| 103 | VECTAB_ENTRY(SWI2_IRQ), |
| 104 | VECTAB_ENTRY(SWI3_IRQ), |
| 105 | VECTAB_ENTRY(SWI4_IRQ), |
| 106 | VECTAB_ENTRY(SWI5_IRQ), |
| 107 | }; |
| 108 | |