1 | /* asr.h |
---|
2 | * |
---|
3 | * This include file contains all the constants and structures associated |
---|
4 | * with the Asynchronous Signal Handler. This Handler provides the low-level |
---|
5 | * support required by the Signal Manager. |
---|
6 | * |
---|
7 | * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. |
---|
8 | * On-Line Applications Research Corporation (OAR). |
---|
9 | * All rights assigned to U.S. Government, 1994. |
---|
10 | * |
---|
11 | * This material may be reproduced by or for the U.S. Government pursuant |
---|
12 | * to the copyright license under the clause at DFARS 252.227-7013. This |
---|
13 | * notice must appear in all copies of this file and its derivatives. |
---|
14 | * |
---|
15 | * $Id$ |
---|
16 | */ |
---|
17 | |
---|
18 | #ifndef __RTEMS_ASR_h |
---|
19 | #define __RTEMS_ASR_h |
---|
20 | |
---|
21 | #ifdef __cplusplus |
---|
22 | extern "C" { |
---|
23 | #endif |
---|
24 | |
---|
25 | #include <rtems/modes.h> |
---|
26 | |
---|
27 | /* |
---|
28 | * |
---|
29 | * The following type defines the control block used to manage |
---|
30 | * each signal set. |
---|
31 | */ |
---|
32 | |
---|
33 | typedef unsigned32 rtems_signal_set; |
---|
34 | |
---|
35 | /* |
---|
36 | * Return type for ASR Handler |
---|
37 | */ |
---|
38 | |
---|
39 | typedef void rtems_asr; |
---|
40 | |
---|
41 | /* |
---|
42 | * The following type corresponds to the applications asynchronous |
---|
43 | * signal processing routine. |
---|
44 | */ |
---|
45 | |
---|
46 | typedef rtems_asr ( *rtems_asr_entry )( |
---|
47 | rtems_signal_set |
---|
48 | ); |
---|
49 | |
---|
50 | /* |
---|
51 | * |
---|
52 | * The following defines the control structure used to manage |
---|
53 | * signals. Each thread has a copy of this record. |
---|
54 | */ |
---|
55 | |
---|
56 | typedef struct { |
---|
57 | rtems_asr_entry handler; /* address of RTEMS_ASR */ |
---|
58 | rtems_mode mode_set; /* RTEMS_ASR mode */ |
---|
59 | rtems_signal_set signals_posted; /* signal set */ |
---|
60 | rtems_signal_set signals_pending; /* pending signal set */ |
---|
61 | unsigned32 nest_level; /* nest level of RTEMS_ASR */ |
---|
62 | } ASR_Information; |
---|
63 | |
---|
64 | /* |
---|
65 | * The following constants define the individual signals which may |
---|
66 | * be used to compose a signal set. |
---|
67 | */ |
---|
68 | |
---|
69 | #define RTEMS_SIGNAL_0 0x00000001 |
---|
70 | #define RTEMS_SIGNAL_1 0x00000002 |
---|
71 | #define RTEMS_SIGNAL_2 0x00000004 |
---|
72 | #define RTEMS_SIGNAL_3 0x00000008 |
---|
73 | #define RTEMS_SIGNAL_4 0x00000010 |
---|
74 | #define RTEMS_SIGNAL_5 0x00000020 |
---|
75 | #define RTEMS_SIGNAL_6 0x00000040 |
---|
76 | #define RTEMS_SIGNAL_7 0x00000080 |
---|
77 | #define RTEMS_SIGNAL_8 0x00000100 |
---|
78 | #define RTEMS_SIGNAL_9 0x00000200 |
---|
79 | #define RTEMS_SIGNAL_10 0x00000400 |
---|
80 | #define RTEMS_SIGNAL_11 0x00000800 |
---|
81 | #define RTEMS_SIGNAL_12 0x00001000 |
---|
82 | #define RTEMS_SIGNAL_13 0x00002000 |
---|
83 | #define RTEMS_SIGNAL_14 0x00004000 |
---|
84 | #define RTEMS_SIGNAL_15 0x00008000 |
---|
85 | #define RTEMS_SIGNAL_16 0x00010000 |
---|
86 | #define RTEMS_SIGNAL_17 0x00020000 |
---|
87 | #define RTEMS_SIGNAL_18 0x00040000 |
---|
88 | #define RTEMS_SIGNAL_19 0x00080000 |
---|
89 | #define RTEMS_SIGNAL_20 0x00100000 |
---|
90 | #define RTEMS_SIGNAL_21 0x00200000 |
---|
91 | #define RTEMS_SIGNAL_22 0x00400000 |
---|
92 | #define RTEMS_SIGNAL_23 0x00800000 |
---|
93 | #define RTEMS_SIGNAL_24 0x01000000 |
---|
94 | #define RTEMS_SIGNAL_25 0x02000000 |
---|
95 | #define RTEMS_SIGNAL_26 0x04000000 |
---|
96 | #define RTEMS_SIGNAL_27 0x08000000 |
---|
97 | #define RTEMS_SIGNAL_28 0x10000000 |
---|
98 | #define RTEMS_SIGNAL_29 0x20000000 |
---|
99 | #define RTEMS_SIGNAL_30 0x40000000 |
---|
100 | #define RTEMS_SIGNAL_31 0x80000000 |
---|
101 | |
---|
102 | /* |
---|
103 | * _ASR_Initialize |
---|
104 | * |
---|
105 | * DESCRIPTION: |
---|
106 | * |
---|
107 | * This routine initializes the given RTEMS_ASR information record. |
---|
108 | */ |
---|
109 | |
---|
110 | STATIC INLINE void _ASR_Initialize ( |
---|
111 | ASR_Information *information |
---|
112 | ); |
---|
113 | |
---|
114 | /* |
---|
115 | * _ASR_Swap_signals |
---|
116 | * |
---|
117 | * DESCRIPTION: |
---|
118 | * |
---|
119 | * This routine atomically swaps the pending and posted signal |
---|
120 | * sets. This is done when the thread alters its mode in such a |
---|
121 | * way that the RTEMS_ASR disable/enable flag changes. |
---|
122 | */ |
---|
123 | |
---|
124 | STATIC INLINE void _ASR_Swap_signals ( |
---|
125 | ASR_Information *information |
---|
126 | ); |
---|
127 | |
---|
128 | /* |
---|
129 | * _ASR_Is_null_handler |
---|
130 | * |
---|
131 | * DESCRIPTION: |
---|
132 | * |
---|
133 | * This function returns TRUE if the given asr_handler is NULL and |
---|
134 | * FALSE otherwise. |
---|
135 | */ |
---|
136 | |
---|
137 | STATIC INLINE boolean _ASR_Is_null_handler ( |
---|
138 | rtems_asr_entry asr_handler |
---|
139 | ); |
---|
140 | |
---|
141 | /* |
---|
142 | * _ASR_Are_signals_pending |
---|
143 | * |
---|
144 | * DESCRIPTION: |
---|
145 | * |
---|
146 | * This function returns TRUE if there are signals pending in the |
---|
147 | * given RTEMS_ASR information record and FALSE otherwise. |
---|
148 | */ |
---|
149 | |
---|
150 | STATIC INLINE boolean _ASR_Are_signals_pending ( |
---|
151 | ASR_Information *information |
---|
152 | ); |
---|
153 | |
---|
154 | /* |
---|
155 | * _ASR_Post_signals |
---|
156 | * |
---|
157 | * DESCRIPTION: |
---|
158 | * |
---|
159 | * This routine posts the given signals into the signal_set |
---|
160 | * passed in. The result is returned to the user in signal_set. |
---|
161 | * |
---|
162 | * NOTE: This must be implemented as a macro. |
---|
163 | */ |
---|
164 | |
---|
165 | STATIC INLINE void _ASR_Post_signals( |
---|
166 | rtems_signal_set signals, |
---|
167 | rtems_signal_set *signal_set |
---|
168 | ); |
---|
169 | |
---|
170 | #include <rtems/asr.inl> |
---|
171 | |
---|
172 | #ifdef __cplusplus |
---|
173 | } |
---|
174 | #endif |
---|
175 | |
---|
176 | #endif |
---|
177 | /* end of include file */ |
---|