rjw | 1f88458 | 2022-01-06 17:20:42 +0800 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (c) 2013-2014 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 | |
| 24 | #include <debug.h> |
| 25 | #include <compiler.h> |
| 26 | #include <arch/arm/cm.h> |
| 27 | |
| 28 | /* from cmsis.h */ |
| 29 | #if 0 |
| 30 | WDT_IRQn = 0, /*!< Watchdog timer Interrupt */ |
| 31 | WWDT_IRQn = WDT_IRQn, /*!< Watchdog timer Interrupt alias for WDT_IRQn */ |
| 32 | BOD_IRQn = 1, /*!< Brown Out Detect(BOD) Interrupt */ |
| 33 | FMC_IRQn = 2, /*!< FLASH Interrupt */ |
| 34 | FLASHEEPROM_IRQn = 3, /*!< EEPROM controller interrupt */ |
| 35 | DMA_IRQn = 4, /*!< DMA Interrupt */ |
| 36 | GINT0_IRQn = 5, /*!< GPIO group 0 Interrupt */ |
| 37 | GINT1_IRQn = 6, /*!< GPIO group 1 Interrupt */ |
| 38 | PIN_INT0_IRQn = 7, /*!< Pin Interrupt 0 */ |
| 39 | PIN_INT1_IRQn = 8, /*!< Pin Interrupt 1 */ |
| 40 | PIN_INT2_IRQn = 9, /*!< Pin Interrupt 2 */ |
| 41 | PIN_INT3_IRQn = 10, /*!< Pin Interrupt 3 */ |
| 42 | PIN_INT4_IRQn = 11, /*!< Pin Interrupt 4 */ |
| 43 | PIN_INT5_IRQn = 12, /*!< Pin Interrupt 5 */ |
| 44 | PIN_INT6_IRQn = 13, /*!< Pin Interrupt 6 */ |
| 45 | PIN_INT7_IRQn = 14, /*!< Pin Interrupt 7 */ |
| 46 | RITIMER_IRQn = 15, /*!< RITIMER interrupt */ |
| 47 | SCT0_IRQn = 16, /*!< SCT0 interrupt */ |
| 48 | SCT_IRQn = SCT0_IRQn, /*!< Optional alias for SCT0_IRQn */ |
| 49 | SCT1_IRQn = 17, /*!< SCT1 interrupt */ |
| 50 | SCT2_IRQn = 18, /*!< SCT2 interrupt */ |
| 51 | SCT3_IRQn = 19, /*!< SCT3 interrupt */ |
| 52 | MRT_IRQn = 20, /*!< MRT interrupt */ |
| 53 | UART0_IRQn = 21, /*!< UART0 Interrupt */ |
| 54 | UART1_IRQn = 22, /*!< UART1 Interrupt */ |
| 55 | UART2_IRQn = 23, /*!< UART2 Interrupt */ |
| 56 | I2C0_IRQn = 24, /*!< I2C0 Interrupt */ |
| 57 | I2C_IRQn = I2C0_IRQn, /*!< Optional alias for I2C0_IRQn */ |
| 58 | SPI0_IRQn = 25, /*!< SPI0 Interrupt */ |
| 59 | SPI1_IRQn = 26, /*!< SPI1 Interrupt */ |
| 60 | CAN_IRQn = 27, /*!< CAN Interrupt */ |
| 61 | USB0_IRQn = 28, /*!< USB IRQ interrupt */ |
| 62 | USB_IRQn = USB0_IRQn, /*!< Optional alias for USB0_IRQn */ |
| 63 | USB0_FIQ_IRQn = 29, /*!< USB FIQ interrupt */ |
| 64 | USB_FIQ_IRQn = USB0_FIQ_IRQn, /*!< Optional alias for USB0_FIQ_IRQn */ |
| 65 | USB_WAKEUP_IRQn = 30, /*!< USB wake-up interrupt Interrupt */ |
| 66 | ADC0_SEQA_IRQn = 31, /*!< ADC0_A sequencer Interrupt */ |
| 67 | ADC0_A_IRQn = ADC0_SEQA_IRQn, /*!< Optional alias for ADC0_SEQA_IRQn */ |
| 68 | ADC_A_IRQn = ADC0_SEQA_IRQn, /*!< Optional alias for ADC0_SEQA_IRQn */ |
| 69 | ADC0_SEQB_IRQn = 32, /*!< ADC0_B sequencer Interrupt */ |
| 70 | ADC0_B_IRQn = ADC0_SEQB_IRQn, /*!< Optional alias for ADC0_SEQB_IRQn */ |
| 71 | ADC_B_IRQn = ADC0_SEQB_IRQn, /*!< Optional alias for ADC0_SEQB_IRQn */ |
| 72 | ADC0_THCMP = 33, /*!< ADC0 threshold compare interrupt */ |
| 73 | ADC0_OVR = 34, /*!< ADC0 overrun interrupt */ |
| 74 | ADC1_SEQA_IRQn = 35, /*!< ADC1_A sequencer Interrupt */ |
| 75 | ADC1_A_IRQn = ADC1_SEQA_IRQn, /*!< Optional alias for ADC1_SEQA_IRQn */ |
| 76 | ADC1_SEQB_IRQn = 36, /*!< ADC1_B sequencer Interrupt */ |
| 77 | ADC1_B_IRQn = ADC1_SEQB_IRQn, /*!< Optional alias for ADC1_SEQB_IRQn */ |
| 78 | ADC1_THCMP = 37, /*!< ADC1 threshold compare interrupt */ |
| 79 | ADC1_OVR = 38, /*!< ADC1 overrun interrupt */ |
| 80 | DAC_IRQ = 39, /*!< DAC interrupt */ |
| 81 | CMP0_IRQ = 40, /*!< Analog comparator 0 interrupt */ |
| 82 | CMP_IRQn = CMP0_IRQ, /*!< Optional alias for CMP0_IRQ */ |
| 83 | CMP1_IRQ = 41, /*!< Analog comparator 1 interrupt */ |
| 84 | CMP2_IRQ = 42, /*!< Analog comparator 2 interrupt */ |
| 85 | CMP3_IRQ = 43, /*!< Analog comparator 3 interrupt */ |
| 86 | QEI_IRQn = 44, /*!< QEI interrupt */ |
| 87 | RTC_ALARM_IRQn = 45, /*!< RTC alarm interrupt */ |
| 88 | RTC_WAKE_IRQn = 46, /*!< RTC wake-up interrupt */ |
| 89 | #endif |
| 90 | |
| 91 | /* un-overridden irq handler */ |
| 92 | void lpc_dummy_irq(void) |
| 93 | { |
| 94 | arm_cm_irq_entry(); |
| 95 | |
| 96 | panic("unhandled irq\n"); |
| 97 | } |
| 98 | |
| 99 | extern void lpc_uart_irq(void); |
| 100 | |
| 101 | /* a list of default handlers that are simply aliases to the dummy handler */ |
| 102 | #define DEFAULT_HANDLER(x) \ |
| 103 | void lpc_##x##_irq(void) __WEAK_ALIAS("lpc_dummy_irq") |
| 104 | |
| 105 | DEFAULT_HANDLER(WDT); |
| 106 | DEFAULT_HANDLER(BOD); |
| 107 | DEFAULT_HANDLER(FMC); |
| 108 | DEFAULT_HANDLER(FLASHEEPROM); |
| 109 | DEFAULT_HANDLER(DMA); |
| 110 | DEFAULT_HANDLER(GINT0); |
| 111 | DEFAULT_HANDLER(GINT1); |
| 112 | DEFAULT_HANDLER(PIN_INT0); |
| 113 | DEFAULT_HANDLER(PIN_INT1); |
| 114 | DEFAULT_HANDLER(PIN_INT2); |
| 115 | DEFAULT_HANDLER(PIN_INT3); |
| 116 | DEFAULT_HANDLER(PIN_INT4); |
| 117 | DEFAULT_HANDLER(PIN_INT5); |
| 118 | DEFAULT_HANDLER(PIN_INT6); |
| 119 | DEFAULT_HANDLER(PIN_INT7); |
| 120 | DEFAULT_HANDLER(RITIMER); |
| 121 | DEFAULT_HANDLER(SCT0); |
| 122 | DEFAULT_HANDLER(SCT1); |
| 123 | DEFAULT_HANDLER(SCT2); |
| 124 | DEFAULT_HANDLER(SCT3); |
| 125 | DEFAULT_HANDLER(MRT); |
| 126 | DEFAULT_HANDLER(UART0); |
| 127 | DEFAULT_HANDLER(UART1); |
| 128 | DEFAULT_HANDLER(UART2); |
| 129 | DEFAULT_HANDLER(I2C0); |
| 130 | DEFAULT_HANDLER(SPI0); |
| 131 | DEFAULT_HANDLER(SPI1); |
| 132 | DEFAULT_HANDLER(CAN); |
| 133 | DEFAULT_HANDLER(USB0); |
| 134 | DEFAULT_HANDLER(USB0_FIQ); |
| 135 | DEFAULT_HANDLER(USB_WAKEUP); |
| 136 | DEFAULT_HANDLER(ADC0_SEQA); |
| 137 | DEFAULT_HANDLER(ADC0_SEQB); |
| 138 | DEFAULT_HANDLER(ADC0_THCMP); |
| 139 | DEFAULT_HANDLER(ADC0_OVR); |
| 140 | DEFAULT_HANDLER(ADC1_SEQA); |
| 141 | DEFAULT_HANDLER(ADC1_SEQB); |
| 142 | DEFAULT_HANDLER(ADC1_THCMP); |
| 143 | DEFAULT_HANDLER(ADC1_OVR); |
| 144 | DEFAULT_HANDLER(DAC); |
| 145 | DEFAULT_HANDLER(CMP0); |
| 146 | DEFAULT_HANDLER(CMP1); |
| 147 | DEFAULT_HANDLER(CMP2); |
| 148 | DEFAULT_HANDLER(CMP3); |
| 149 | DEFAULT_HANDLER(QEI); |
| 150 | DEFAULT_HANDLER(RTC_ALARM); |
| 151 | DEFAULT_HANDLER(RTC_WAKE); |
| 152 | |
| 153 | #define VECTAB_ENTRY(x) lpc_##x##_irq |
| 154 | |
| 155 | const void * const __SECTION(".text.boot.vectab2") vectab2[] = { |
| 156 | VECTAB_ENTRY(WDT), |
| 157 | VECTAB_ENTRY(BOD), |
| 158 | VECTAB_ENTRY(FMC), |
| 159 | VECTAB_ENTRY(FLASHEEPROM), |
| 160 | VECTAB_ENTRY(DMA), |
| 161 | VECTAB_ENTRY(GINT0), |
| 162 | VECTAB_ENTRY(GINT1), |
| 163 | VECTAB_ENTRY(PIN_INT0), |
| 164 | VECTAB_ENTRY(PIN_INT1), |
| 165 | VECTAB_ENTRY(PIN_INT2), |
| 166 | VECTAB_ENTRY(PIN_INT3), |
| 167 | VECTAB_ENTRY(PIN_INT4), |
| 168 | VECTAB_ENTRY(PIN_INT5), |
| 169 | VECTAB_ENTRY(PIN_INT6), |
| 170 | VECTAB_ENTRY(PIN_INT7), |
| 171 | VECTAB_ENTRY(RITIMER), |
| 172 | VECTAB_ENTRY(SCT0), |
| 173 | VECTAB_ENTRY(SCT1), |
| 174 | VECTAB_ENTRY(SCT2), |
| 175 | VECTAB_ENTRY(SCT3), |
| 176 | VECTAB_ENTRY(MRT), |
| 177 | VECTAB_ENTRY(UART0), |
| 178 | VECTAB_ENTRY(UART1), |
| 179 | VECTAB_ENTRY(UART2), |
| 180 | VECTAB_ENTRY(I2C0), |
| 181 | VECTAB_ENTRY(SPI0), |
| 182 | VECTAB_ENTRY(SPI1), |
| 183 | VECTAB_ENTRY(CAN), |
| 184 | VECTAB_ENTRY(USB0), |
| 185 | VECTAB_ENTRY(USB0_FIQ), |
| 186 | VECTAB_ENTRY(USB_WAKEUP), |
| 187 | VECTAB_ENTRY(ADC0_SEQA), |
| 188 | VECTAB_ENTRY(ADC0_SEQB), |
| 189 | VECTAB_ENTRY(ADC0_THCMP), |
| 190 | VECTAB_ENTRY(ADC0_OVR), |
| 191 | VECTAB_ENTRY(ADC1_SEQA), |
| 192 | VECTAB_ENTRY(ADC1_SEQB), |
| 193 | VECTAB_ENTRY(ADC1_THCMP), |
| 194 | VECTAB_ENTRY(ADC1_OVR), |
| 195 | VECTAB_ENTRY(DAC), |
| 196 | VECTAB_ENTRY(CMP0), |
| 197 | VECTAB_ENTRY(CMP1), |
| 198 | VECTAB_ENTRY(CMP2), |
| 199 | VECTAB_ENTRY(CMP3), |
| 200 | VECTAB_ENTRY(QEI), |
| 201 | VECTAB_ENTRY(RTC_ALARM), |
| 202 | VECTAB_ENTRY(RTC_WAKE), |
| 203 | }; |