The unified diff between revisions [8760ae92..] and [9ca449dd..] is displayed below. It can also be downloaded as a raw diff.
This diff has been restricted to the following files: 'interrupt.h'
# # old_revision [8760ae9232295422550b79f09e55122390704b3c] # new_revision [9ca449dd7941ad52e33bdcb5c28b2ba35d54219a] # # add_file "interrupt.h" # content [56b191b60c258a1d20ddf786c75868f6269709f1] # ============================================================ --- /dev/null +++ interrupt.h 56b191b60c258a1d20ddf786c75868f6269709f1 @@ -0,0 +1,53 @@ +#ifndef __INTERRUPT_H +#define __INTERRUPT_H + +#include "swi.h" + +#define VICVectAddr (*(volatile unsigned int *)0xFFFFF030) + +#define I_WDT 0 + +#define I_ARMCore0 2 +#define I_ARMCore1 3 +#define I_TIMER0 4 +#define I_TIMER1 5 +#define I_UART0 6 +#define I_UART1 7 + +#define I_I2C0 9 +#define I_SPI0 10 +#define I_SPI1 11 +#define I_SSP 11 +#define I_PLL 12 +#define I_RTC 13 +#define I_EINT0 14 +#define I_EINT1 15 +#define I_EINT2 16 + +#define I_AD0 18 +#define I_I2C1 19 + +#define I_TIMER2 26 +#define I_TIMER3 27 + +/* Assign interrupt priorities here to avoid clashes */ + +#define I_PRIORITY_I2C0 0 +#define I_PRIORITY_UART0 1 +#define I_PRIORITY_TIMER3 2 +#define I_PRIORITY_TIMER0 3 +#define I_PRIORITY_SPI1 4 + +#define interrupt_clear() do { VICVectAddr = 0xff; } while (0) + +void init_interrupt(void); +void interrupt_register_code(unsigned int source, unsigned int priority, + void(*handler)(void)); + +#define interrupt_register(x, fn) \ + interrupt_register_code(I_##x, I_PRIORITY_##x, fn) + +#define interrupt_block() swi_call(SWI_INTERRUPT_BLOCK) +#define interrupt_unblock() swi_call(SWI_INTERRUPT_UNBLOCK) + +#endif /* __INTERRUPT_H */