1 | /* |
---|
2 | * Interrupt handler Header file |
---|
3 | * |
---|
4 | * Copyright (c) 2006 by Ray <rayx.cn@gmail.com> to support LPC ARM |
---|
5 | * |
---|
6 | * The license and distribution terms for this file may be |
---|
7 | * found in the file LICENSE in this distribution or at |
---|
8 | * |
---|
9 | * http://www.rtems.com/license/LICENSE. |
---|
10 | * |
---|
11 | * |
---|
12 | * $Id$ |
---|
13 | */ |
---|
14 | |
---|
15 | #ifndef __IRQ_H__ |
---|
16 | #define __IRQ_H__ |
---|
17 | |
---|
18 | #ifdef __cplusplus |
---|
19 | extern "C" { |
---|
20 | #endif |
---|
21 | |
---|
22 | /* define that can be useful (the values are just examples) */ |
---|
23 | #ifndef __asm__ |
---|
24 | |
---|
25 | /* |
---|
26 | * Include some preprocessor value also used by assember code |
---|
27 | */ |
---|
28 | |
---|
29 | #include <rtems.h> |
---|
30 | #include <lpc22xx.h> |
---|
31 | |
---|
32 | extern void default_int_handler(); |
---|
33 | /*********************************************************************** |
---|
34 | * Constants |
---|
35 | **********************************************************************/ |
---|
36 | |
---|
37 | /* possible interrupt sources on the LPC22xx */ |
---|
38 | #define LPC22xx_INTERRUPT_WDINT 0 /* Watchdog int. 0 */ |
---|
39 | #define LPC22xx_INTERRUPT_RSV0 1 /* Reserved int. 1 */ |
---|
40 | #define LPC22xx_INTERRUPT_DBGRX 2 /* Embedded ICE DbgCommRx receive */ |
---|
41 | #define LPC22xx_INTERRUPT_DBGTX 3 /* Embedded ICE DbgCommRx Transmit*/ |
---|
42 | #define LPC22xx_INTERRUPT_TIMER0 4 /* Timer 0 */ |
---|
43 | #define LPC22xx_INTERRUPT_TIMER1 5 /* Timer 1 */ |
---|
44 | #define LPC22xx_INTERRUPT_UART0 6 /* UART 0 */ |
---|
45 | #define LPC22xx_INTERRUPT_UART1 7 /* UART 1 */ |
---|
46 | #define LPC22xx_INTERRUPT_PWM0 8 /* PWM */ |
---|
47 | #define LPC22xx_INTERRUPT_I2C 9 /* I2C */ |
---|
48 | #define LPC22xx_INTERRUPT_SPI0 10 /* SPI0 */ |
---|
49 | #define LPC22xx_INTERRUPT_SPI1 11 /* SPI1 */ |
---|
50 | #define LPC22xx_INTERRUPT_PLL 12 /* PLL */ |
---|
51 | #define LPC22xx_INTERRUPT_RTC 13 /* RTC */ |
---|
52 | #define LPC22xx_INTERRUPT_EINT0 14 /* Externel Interrupt 0 */ |
---|
53 | #define LPC22xx_INTERRUPT_EINT1 15 /* Externel Interrupt 1 */ |
---|
54 | #define LPC22xx_INTERRUPT_EINT2 16 /* Externel Interrupt 2 */ |
---|
55 | #define LPC22xx_INTERRUPT_EINT3 17 /* Externel Interrupt 3 */ |
---|
56 | #define LPC22xx_INTERRUPT_ADC 18 /* AD Converter */ |
---|
57 | /* Following interrupt used by lpc229x */ |
---|
58 | #define LPC22xx_INTERRUPT_CANERR 19 /* CAN LUTerr interrupt */ |
---|
59 | #define LPC22xx_INTERRUPT_CAN1TX 20 /* CAN1 Tx interrupt */ |
---|
60 | #define LPC22xx_INTERRUPT_CAN1RX 21 /* CAN1 Rx interrupt */ |
---|
61 | #define LPC22xx_INTERRUPT_CAN2TX 22 /* CAN2 Tx interrupt */ |
---|
62 | #define LPC22xx_INTERRUPT_CAN2RX 23 /* CAN2 Rx interrupt */ |
---|
63 | #define LPC22xx_INTERRUPT_CAN3TX 24 /* CAN1 Tx interrupt */ |
---|
64 | #define LPC22xx_INTERRUPT_CAN3RX 25 /* CAN1 Rx interrupt */ |
---|
65 | #define LPC22xx_INTERRUPT_CAN4TX 26 /* CAN2 Tx interrupt */ |
---|
66 | #define LPC22xx_INTERRUPT_CAN4RX 27 /* CAN2 Rx interrupt */ |
---|
67 | #define BSP_MAX_INT 28 |
---|
68 | |
---|
69 | #define UNDEFINED_INSTRUCTION_VECTOR_ADDR (*(u_long *)0x00000004L) |
---|
70 | #define SOFTWARE_INTERRUPT_VECTOR_ADDR (*(u_long *)0x00000008L) |
---|
71 | #define PREFETCH_ABORT_VECTOR_ADDR (*(u_long *)0x0000000CL) |
---|
72 | #define DATA_ABORT_VECTOR_ADDR (*(u_long *)0x00000010L) |
---|
73 | #define IRQ_VECTOR_ADDR (*(u_long *)0x00000018L) |
---|
74 | #define FIQ_VECTOR_ADDR (*(u_long *)0x0000001CL) |
---|
75 | |
---|
76 | #define DATA_ABORT_ISR_ADDR (*(u_long *)0x00000030L) |
---|
77 | #define IRQ_ISR_ADDR (*(u_long *)0x00000038L) |
---|
78 | #define FIQ_ISR_ADDR (*(u_long *)0x0000003CL) |
---|
79 | |
---|
80 | |
---|
81 | typedef unsigned char rtems_irq_level; |
---|
82 | typedef unsigned char rtems_irq_trigger; |
---|
83 | |
---|
84 | typedef unsigned int rtems_irq_number; |
---|
85 | struct __rtems_irq_connect_data__; /* forward declaratiuon */ |
---|
86 | |
---|
87 | typedef void (*rtems_irq_hdl) (void); |
---|
88 | typedef void (*rtems_irq_enable) (const struct __rtems_irq_connect_data__*); |
---|
89 | typedef void (*rtems_irq_disable) (const struct __rtems_irq_connect_data__*); |
---|
90 | typedef int (*rtems_irq_is_enabled)(const struct __rtems_irq_connect_data__*); |
---|
91 | |
---|
92 | //extern rtems_irq_hdl bsp_vector_table[BSP_MAX_INT]; |
---|
93 | #define VECTOR_TABLE VICVectAddrBase |
---|
94 | |
---|
95 | typedef struct __rtems_irq_connect_data__ { |
---|
96 | /* IRQ line */ |
---|
97 | rtems_irq_number name; |
---|
98 | |
---|
99 | /* Handler */ |
---|
100 | rtems_irq_hdl hdl; |
---|
101 | |
---|
102 | /* function for enabling interrupts at device level. */ |
---|
103 | rtems_irq_enable on; |
---|
104 | |
---|
105 | /* function for disabling interrupts at device level. */ |
---|
106 | rtems_irq_disable off; |
---|
107 | |
---|
108 | /* Function to test if interrupt is enabled */ |
---|
109 | rtems_irq_is_enabled isOn; |
---|
110 | |
---|
111 | /* priority level of interrupt */ |
---|
112 | rtems_irq_level irqLevel; |
---|
113 | |
---|
114 | /* Trigger method (rising/falling edge or high/low level) */ |
---|
115 | rtems_irq_trigger irqTrigger; |
---|
116 | } rtems_irq_connect_data; |
---|
117 | |
---|
118 | /* |
---|
119 | * function to initialize the interrupt for a specific BSP |
---|
120 | */ |
---|
121 | void BSP_rtems_irq_mngt_init(); |
---|
122 | |
---|
123 | |
---|
124 | /* |
---|
125 | * function to connect a particular irq handler. |
---|
126 | */ |
---|
127 | int BSP_install_rtems_irq_handler (const rtems_irq_connect_data*); |
---|
128 | |
---|
129 | /* |
---|
130 | * function to get the current RTEMS irq handler for ptr->name. |
---|
131 | */ |
---|
132 | int BSP_get_current_rtems_irq_handler (rtems_irq_connect_data* ptr); |
---|
133 | |
---|
134 | /* |
---|
135 | * function to disconnect the RTEMS irq handler for ptr->name. |
---|
136 | */ |
---|
137 | int BSP_remove_rtems_irq_handler (const rtems_irq_connect_data*); |
---|
138 | |
---|
139 | #endif /* __asm__ */ |
---|
140 | |
---|
141 | #ifdef __cplusplus |
---|
142 | } |
---|
143 | #endif |
---|
144 | |
---|
145 | #endif /* __IRQ_H__ */ |
---|