2 * Copyright © 2013 Keith Packard <keithp@keithp.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 2 of the License.
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
21 extern void main(void);
22 extern char __stack__;
23 extern char __text_start__, __text_end__;
24 extern char __data_start__, __data_end__;
25 extern char __bss_start__, __bss_end__;
27 /* Interrupt functions */
29 void lpc_halt_isr(void)
31 ao_panic(AO_PANIC_CRASH);
34 void lpc_ignore_isr(void)
42 memcpy(&__data_start__, &__text_end__, &__data_end__ - &__data_start__);
43 memset(&__bss_start__, '\0', &__bss_end__ - &__bss_start__);
47 #define STRINGIFY(x) #x
50 void __attribute__ ((weak)) lpc_ ## name ## _isr(void); \
51 _Pragma(STRINGIFY(weak lpc_ ## name ## _isr = lpc_ignore_isr))
53 #define isr_halt(name) \
54 void __attribute__ ((weak)) lpc_ ## name ## _isr(void); \
55 _Pragma(STRINGIFY(weak lpc_ ## name ## _isr = lpc_halt_isr))
67 isr(pin_int0) /* IRQ0 */
71 isr(pin_int4) /* IRQ4 */
81 isr(ct16b0) /* IRQ16 */
97 #define i(addr,name) [(addr)/4] = lpc_ ## name ## _isr
98 #define c(addr,value) [(addr)/4] = (value)
100 __attribute__ ((section(".interrupt")))
101 const void *lpc_interrupt_vector[] = {
119 i(0x40, pin_int0), /* IRQ0 */
123 i(0x50, pin_int4), /* IRQ4 */
128 i(0x60, gint0), /* IRQ8 */
132 i(0x70, hardfault), /* IRQ12 */
137 i(0x80, ct16b0), /* IRQ16 */
141 i(0x90, ssp0), /* IRQ20 */
146 i(0xa0, adc), /* IRQ24 */
151 i(0xb0, hardfault), /* IRQ28 */