1 | /** |
---|
2 | * @file rtems/score/isr.h |
---|
3 | * |
---|
4 | * @brief Data Related to the Management of Processor Interrupt Levels |
---|
5 | * |
---|
6 | * This include file contains all the constants and structures associated |
---|
7 | * with the management of processor interrupt levels. This handler |
---|
8 | * supports interrupt critical sections, vectoring of user interrupt |
---|
9 | * handlers, nesting of interrupts, and manipulating interrupt levels. |
---|
10 | */ |
---|
11 | |
---|
12 | /* |
---|
13 | * COPYRIGHT (c) 1989-2012. |
---|
14 | * On-Line Applications Research Corporation (OAR). |
---|
15 | * |
---|
16 | * The license and distribution terms for this file may be |
---|
17 | * found in the file LICENSE in this distribution or at |
---|
18 | * http://www.rtems.org/license/LICENSE. |
---|
19 | */ |
---|
20 | |
---|
21 | #ifndef _RTEMS_SCORE_ISR_H |
---|
22 | #define _RTEMS_SCORE_ISR_H |
---|
23 | |
---|
24 | #include <rtems/score/isrlevel.h> |
---|
25 | |
---|
26 | /** |
---|
27 | * @defgroup ScoreISR ISR Handler |
---|
28 | * |
---|
29 | * @ingroup Score |
---|
30 | * |
---|
31 | * This handler encapsulates functionality which provides the foundation |
---|
32 | * ISR services used in all of the APIs supported by RTEMS. |
---|
33 | * |
---|
34 | * The ISR Nest level counter variable is maintained as part of the |
---|
35 | * per cpu data structure. |
---|
36 | */ |
---|
37 | /**@{*/ |
---|
38 | |
---|
39 | #ifdef __cplusplus |
---|
40 | extern "C" { |
---|
41 | #endif |
---|
42 | |
---|
43 | /** |
---|
44 | * The following type defines the type used to manage the vectors. |
---|
45 | */ |
---|
46 | typedef uint32_t ISR_Vector_number; |
---|
47 | |
---|
48 | /** |
---|
49 | * Return type for ISR Handler |
---|
50 | */ |
---|
51 | typedef void ISR_Handler; |
---|
52 | |
---|
53 | #if (CPU_SIMPLE_VECTORED_INTERRUPTS == FALSE) |
---|
54 | |
---|
55 | typedef void * ISR_Handler_entry; |
---|
56 | |
---|
57 | #else |
---|
58 | /** |
---|
59 | * Pointer to an ISR Handler |
---|
60 | */ |
---|
61 | #if (CPU_ISR_PASSES_FRAME_POINTER == TRUE) |
---|
62 | typedef ISR_Handler ( *ISR_Handler_entry )( |
---|
63 | ISR_Vector_number, |
---|
64 | CPU_Interrupt_frame * |
---|
65 | ); |
---|
66 | #else |
---|
67 | typedef ISR_Handler ( *ISR_Handler_entry )( |
---|
68 | ISR_Vector_number |
---|
69 | ); |
---|
70 | #endif |
---|
71 | |
---|
72 | /** |
---|
73 | * The following declares the Vector Table. Application |
---|
74 | * interrupt service routines are vectored by the ISR Handler via this table. |
---|
75 | */ |
---|
76 | extern ISR_Handler_entry _ISR_Vector_table[ CPU_INTERRUPT_NUMBER_OF_VECTORS ]; |
---|
77 | #endif |
---|
78 | |
---|
79 | /** |
---|
80 | * @brief Global symbol with a value equal to the configure interrupt stack size. |
---|
81 | * |
---|
82 | * This global symbol is defined by the application configuration option |
---|
83 | * CONFIGURE_INIT_TASK_STACK_SIZE via <rtems/confdefs.h>. |
---|
84 | */ |
---|
85 | RTEMS_DECLARE_GLOBAL_SYMBOL( _ISR_Stack_size ); |
---|
86 | |
---|
87 | /** |
---|
88 | * @brief The interrupt stack area begin. |
---|
89 | * |
---|
90 | * The interrupt stack area is defined by the application configuration via |
---|
91 | * <rtems/confdefs.h>. The size of the area depends on |
---|
92 | * CONFIGURE_INIT_TASK_STACK_SIZE and CONFIGURE_MAXIMUM_PROCESSORS. |
---|
93 | */ |
---|
94 | extern char _ISR_Stack_area_begin[]; |
---|
95 | |
---|
96 | /** |
---|
97 | * @brief The interrupt stack area end. |
---|
98 | * |
---|
99 | * The interrupt stack area is defined by the application configuration via |
---|
100 | * <rtems/confdefs.h>. The size of the area depends on |
---|
101 | * CONFIGURE_INIT_TASK_STACK_SIZE and CONFIGURE_MAXIMUM_PROCESSORS. |
---|
102 | */ |
---|
103 | extern const char _ISR_Stack_area_end[]; |
---|
104 | |
---|
105 | /** |
---|
106 | * @brief Initialize the ISR handler. |
---|
107 | * |
---|
108 | * This routine performs the initialization necessary for the ISR handler. |
---|
109 | */ |
---|
110 | void _ISR_Handler_initialization ( void ); |
---|
111 | |
---|
112 | /** |
---|
113 | * @brief Install interrupt handler vector. |
---|
114 | * |
---|
115 | * This routine installs new_handler as the interrupt service routine |
---|
116 | * for the specified vector. The previous interrupt service routine is |
---|
117 | * returned as old_handler. |
---|
118 | * |
---|
119 | * LM32 Specific Information: |
---|
120 | * XXX document implementation including references if appropriate |
---|
121 | * |
---|
122 | * @param[in] _vector is the vector number |
---|
123 | * @param[in] _new_handler is ISR handler to install |
---|
124 | * @param[in] _old_handler is a pointer to a variable which will be set |
---|
125 | * to the old handler |
---|
126 | * |
---|
127 | * @retval *_old_handler will be set to the old ISR handler |
---|
128 | */ |
---|
129 | #define _ISR_Install_vector( _vector, _new_handler, _old_handler ) \ |
---|
130 | _CPU_ISR_install_vector( _vector, _new_handler, _old_handler ) |
---|
131 | |
---|
132 | /** |
---|
133 | * @brief ISR interrupt dispatcher. |
---|
134 | * |
---|
135 | * This routine is the interrupt dispatcher. ALL interrupts |
---|
136 | * are vectored to this routine so that minimal context can be saved |
---|
137 | * and setup performed before the application's high-level language |
---|
138 | * interrupt service routine is invoked. After the application's |
---|
139 | * interrupt service routine returns control to this routine, it |
---|
140 | * will determine if a thread dispatch is necessary. If so, it will |
---|
141 | * ensure that the necessary thread scheduling operations are |
---|
142 | * performed when the outermost interrupt service routine exits. |
---|
143 | * |
---|
144 | * @note Typically implemented in assembly language. |
---|
145 | */ |
---|
146 | void _ISR_Handler( void ); |
---|
147 | |
---|
148 | /** |
---|
149 | * @brief Checks if an ISR in progress. |
---|
150 | * |
---|
151 | * This function returns true if the processor is currently servicing |
---|
152 | * and interrupt and false otherwise. A return value of true indicates |
---|
153 | * that the caller is an interrupt service routine, NOT a thread. |
---|
154 | * |
---|
155 | * @retval This methods returns true when called from an ISR. |
---|
156 | */ |
---|
157 | bool _ISR_Is_in_progress( void ); |
---|
158 | |
---|
159 | #ifdef __cplusplus |
---|
160 | } |
---|
161 | #endif |
---|
162 | |
---|
163 | /**@}*/ |
---|
164 | |
---|
165 | #endif |
---|
166 | /* end of include file */ |
---|