1 | /* states.h |
---|
2 | * |
---|
3 | * This include file contains thread execution state information. |
---|
4 | * |
---|
5 | * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. |
---|
6 | * On-Line Applications Research Corporation (OAR). |
---|
7 | * All rights assigned to U.S. Government, 1994. |
---|
8 | * |
---|
9 | * This material may be reproduced by or for the U.S. Government pursuant |
---|
10 | * to the copyright license under the clause at DFARS 252.227-7013. This |
---|
11 | * notice must appear in all copies of this file and its derivatives. |
---|
12 | * |
---|
13 | * $Id$ |
---|
14 | */ |
---|
15 | |
---|
16 | #ifndef __RTEMS_STATES_h |
---|
17 | #define __RTEMS_STATES_h |
---|
18 | |
---|
19 | #ifdef __cplusplus |
---|
20 | extern "C" { |
---|
21 | #endif |
---|
22 | |
---|
23 | /* |
---|
24 | * The following type defines the control block used to manage a |
---|
25 | * thread's state. |
---|
26 | */ |
---|
27 | |
---|
28 | typedef unsigned32 States_Control; |
---|
29 | |
---|
30 | /* |
---|
31 | * The following constants define the individual states which may be |
---|
32 | * be used to compose and manipulate a thread's state. |
---|
33 | */ |
---|
34 | |
---|
35 | #define STATES_ALL_SET 0xffff /* all states */ |
---|
36 | #define STATES_READY 0x0000 /* ready to run */ |
---|
37 | #define STATES_DORMANT 0x0001 /* created but not started */ |
---|
38 | #define STATES_SUSPENDED 0x0002 /* waiting to be resumed */ |
---|
39 | #define STATES_TRANSIENT 0x0004 /* thread in transition */ |
---|
40 | #define STATES_DELAYING 0x0008 /* wait for timeout */ |
---|
41 | #define STATES_WAITING_FOR_BUFFER 0x0010 /* wait for partition buffer */ |
---|
42 | #define STATES_WAITING_FOR_SEGMENT 0x0020 /* wait for region segment */ |
---|
43 | #define STATES_WAITING_FOR_MESSAGE 0x0040 /* wait for message */ |
---|
44 | #define STATES_WAITING_FOR_EVENT 0x0080 /* wait for event */ |
---|
45 | #define STATES_WAITING_FOR_SEMAPHORE 0x0100 /* wait for semaphore */ |
---|
46 | #define STATES_WAITING_FOR_MUTEX 0x0200 /* wait for mutex */ |
---|
47 | #define STATES_WAITING_FOR_TIME 0x0400 /* wait for specific TOD */ |
---|
48 | #define STATES_WAITING_FOR_RPC_REPLY 0x0800 /* wait for rpc reply */ |
---|
49 | #define STATES_WAITING_FOR_PERIOD 0x1000 /* rate monotonic delay */ |
---|
50 | |
---|
51 | #define STATES_LOCALLY_BLOCKED ( STATES_WAITING_FOR_BUFFER | \ |
---|
52 | STATES_WAITING_FOR_SEGMENT | \ |
---|
53 | STATES_WAITING_FOR_MESSAGE | \ |
---|
54 | STATES_WAITING_FOR_MUTEX | \ |
---|
55 | STATES_WAITING_FOR_SEMAPHORE ) |
---|
56 | |
---|
57 | #define STATES_WAITING_ON_THREAD_QUEUE \ |
---|
58 | ( STATES_LOCALLY_BLOCKED | \ |
---|
59 | STATES_WAITING_FOR_RPC_REPLY ) |
---|
60 | |
---|
61 | #define STATES_BLOCKED ( STATES_DELAYING | \ |
---|
62 | STATES_WAITING_FOR_TIME | \ |
---|
63 | STATES_WAITING_FOR_PERIOD | \ |
---|
64 | STATES_WAITING_FOR_EVENT | \ |
---|
65 | STATES_WAITING_ON_THREAD_QUEUE ) |
---|
66 | |
---|
67 | /* |
---|
68 | * _States_Set |
---|
69 | * |
---|
70 | * DESCRIPTION: |
---|
71 | * |
---|
72 | * This function sets the given states_to_set into the current_state |
---|
73 | * passed in. The result is returned to the user in current_state. |
---|
74 | */ |
---|
75 | |
---|
76 | STATIC INLINE States_Control _States_Set ( |
---|
77 | States_Control states_to_set, |
---|
78 | States_Control current_state |
---|
79 | ); |
---|
80 | |
---|
81 | /* |
---|
82 | * _States_Clear |
---|
83 | * |
---|
84 | * DESCRIPTION: |
---|
85 | * |
---|
86 | * This function clears the given states_to_clear into the current_state |
---|
87 | * passed in. The result is returned to the user in current_state. |
---|
88 | */ |
---|
89 | |
---|
90 | STATIC INLINE States_Control _States_Clear ( |
---|
91 | States_Control states_to_clear, |
---|
92 | States_Control current_state |
---|
93 | ); |
---|
94 | |
---|
95 | /* |
---|
96 | * _States_Is_ready |
---|
97 | * |
---|
98 | * DESCRIPTION: |
---|
99 | * |
---|
100 | * This function returns TRUE if the_states indicates that the |
---|
101 | * state is READY, and FALSE otherwise. |
---|
102 | */ |
---|
103 | |
---|
104 | STATIC INLINE boolean _States_Is_ready ( |
---|
105 | States_Control the_states |
---|
106 | ); |
---|
107 | |
---|
108 | /* |
---|
109 | * _States_Is_only_dormant |
---|
110 | * |
---|
111 | * DESCRIPTION: |
---|
112 | * |
---|
113 | * This function returns TRUE if the DORMANT state is the ONLY state |
---|
114 | * set in the_states, and FALSE otherwise. |
---|
115 | */ |
---|
116 | |
---|
117 | STATIC INLINE boolean _States_Is_only_dormant ( |
---|
118 | States_Control the_states |
---|
119 | ); |
---|
120 | |
---|
121 | /* |
---|
122 | * _States_Is_dormant |
---|
123 | * |
---|
124 | * DESCRIPTION: |
---|
125 | * |
---|
126 | * This function returns TRUE if the DORMANT state is set in |
---|
127 | * the_states, and FALSE otherwise. |
---|
128 | */ |
---|
129 | |
---|
130 | STATIC INLINE boolean _States_Is_dormant ( |
---|
131 | States_Control the_states |
---|
132 | ); |
---|
133 | |
---|
134 | /* |
---|
135 | * _States_Is_suspended |
---|
136 | * |
---|
137 | * DESCRIPTION: |
---|
138 | * |
---|
139 | * This function returns TRUE if the SUSPENDED state is set in |
---|
140 | * the_states, and FALSE otherwise. |
---|
141 | */ |
---|
142 | |
---|
143 | STATIC INLINE boolean _States_Is_suspended ( |
---|
144 | States_Control the_states |
---|
145 | ); |
---|
146 | |
---|
147 | /* |
---|
148 | * _States_Is_Transient |
---|
149 | * |
---|
150 | * DESCRIPTION: |
---|
151 | * |
---|
152 | * This function returns TRUE if the TRANSIENT state is set in |
---|
153 | * the_states, and FALSE otherwise. |
---|
154 | */ |
---|
155 | |
---|
156 | STATIC INLINE boolean _States_Is_transient ( |
---|
157 | States_Control the_states |
---|
158 | ); |
---|
159 | |
---|
160 | /* |
---|
161 | * _States_Is_delaying |
---|
162 | * |
---|
163 | * DESCRIPTION: |
---|
164 | * |
---|
165 | * This function returns TRUE if the DELAYING state is set in |
---|
166 | * the_states, and FALSE otherwise. |
---|
167 | */ |
---|
168 | |
---|
169 | STATIC INLINE boolean _States_Is_delaying ( |
---|
170 | States_Control the_states |
---|
171 | ); |
---|
172 | |
---|
173 | /* |
---|
174 | * _States_Is_waiting_for_buffer |
---|
175 | * |
---|
176 | * DESCRIPTION: |
---|
177 | * |
---|
178 | * This function returns TRUE if the WAITING_FOR_BUFFER state is set in |
---|
179 | * the_states, and FALSE otherwise. |
---|
180 | */ |
---|
181 | |
---|
182 | STATIC INLINE boolean _States_Is_waiting_for_buffer ( |
---|
183 | States_Control the_states |
---|
184 | ); |
---|
185 | |
---|
186 | /* |
---|
187 | * _States_Is_waiting_for_segment |
---|
188 | * |
---|
189 | * DESCRIPTION: |
---|
190 | * |
---|
191 | * This function returns TRUE if the WAITING_FOR_SEGMENT state is set in |
---|
192 | * the_states, and FALSE otherwise. |
---|
193 | */ |
---|
194 | |
---|
195 | STATIC INLINE boolean _States_Is_waiting_for_segment ( |
---|
196 | States_Control the_states |
---|
197 | ); |
---|
198 | |
---|
199 | /* |
---|
200 | * _States_Is_waiting_for_message |
---|
201 | * |
---|
202 | * DESCRIPTION: |
---|
203 | * |
---|
204 | * This function returns TRUE if the WAITING_FOR_MESSAGE state is set in |
---|
205 | * the_states, and FALSE otherwise. |
---|
206 | */ |
---|
207 | |
---|
208 | STATIC INLINE boolean _States_Is_waiting_for_message ( |
---|
209 | States_Control the_states |
---|
210 | ); |
---|
211 | |
---|
212 | /* |
---|
213 | * _States_Is_waiting_for_event |
---|
214 | * |
---|
215 | * DESCRIPTION: |
---|
216 | * |
---|
217 | * This function returns TRUE if the WAITING_FOR_EVENT state is set in |
---|
218 | * the_states, and FALSE otherwise. |
---|
219 | */ |
---|
220 | |
---|
221 | STATIC INLINE boolean _States_Is_waiting_for_event ( |
---|
222 | States_Control the_states |
---|
223 | ); |
---|
224 | |
---|
225 | /* |
---|
226 | * _States_Is_waiting_for_mutex |
---|
227 | * |
---|
228 | * DESCRIPTION: |
---|
229 | * |
---|
230 | * This function returns TRUE if the WAITING_FOR_MUTEX state |
---|
231 | * is set in the_states, and FALSE otherwise. |
---|
232 | */ |
---|
233 | |
---|
234 | STATIC INLINE boolean _States_Is_waiting_for_mutex ( |
---|
235 | States_Control the_states |
---|
236 | ); |
---|
237 | |
---|
238 | /* |
---|
239 | * _States_Is_waiting_for_semaphore |
---|
240 | * |
---|
241 | * DESCRIPTION: |
---|
242 | * |
---|
243 | * This function returns TRUE if the WAITING_FOR_SEMAPHORE state |
---|
244 | * is set in the_states, and FALSE otherwise. |
---|
245 | */ |
---|
246 | |
---|
247 | STATIC INLINE boolean _States_Is_waiting_for_semaphore ( |
---|
248 | States_Control the_states |
---|
249 | ); |
---|
250 | |
---|
251 | /* |
---|
252 | * _States_Is_waiting_for_time |
---|
253 | * |
---|
254 | * DESCRIPTION: |
---|
255 | * |
---|
256 | * This function returns TRUE if the WAITING_FOR_TIME state is set in |
---|
257 | * the_states, and FALSE otherwise. |
---|
258 | */ |
---|
259 | |
---|
260 | STATIC INLINE boolean _States_Is_waiting_for_time ( |
---|
261 | States_Control the_states |
---|
262 | ); |
---|
263 | |
---|
264 | /* |
---|
265 | * _States_Is_waiting_for_rpc_reply |
---|
266 | * |
---|
267 | * DESCRIPTION: |
---|
268 | * |
---|
269 | * This function returns TRUE if the WAITING_FOR_TIME state is set in |
---|
270 | * the_states, and FALSE otherwise. |
---|
271 | */ |
---|
272 | |
---|
273 | STATIC INLINE boolean _States_Is_waiting_for_rpc_reply ( |
---|
274 | States_Control the_states |
---|
275 | ); |
---|
276 | |
---|
277 | /* |
---|
278 | * _States_Is_waiting_for_period |
---|
279 | * |
---|
280 | * DESCRIPTION: |
---|
281 | * |
---|
282 | * This function returns TRUE if the WAITING_FOR_PERIOD state is set in |
---|
283 | * the_states, and FALSE otherwise. |
---|
284 | */ |
---|
285 | |
---|
286 | STATIC INLINE boolean _States_Is_waiting_for_period ( |
---|
287 | States_Control the_states |
---|
288 | ); |
---|
289 | |
---|
290 | /* |
---|
291 | * _States_Is_locally_blocked |
---|
292 | * |
---|
293 | * DESCRIPTION: |
---|
294 | * |
---|
295 | * This function returns TRUE if one of the states which indicates |
---|
296 | * that a task is blocked waiting for a local resource is set in |
---|
297 | * the_states, and FALSE otherwise. |
---|
298 | */ |
---|
299 | |
---|
300 | STATIC INLINE boolean _States_Is_locally_blocked ( |
---|
301 | States_Control the_states |
---|
302 | ); |
---|
303 | |
---|
304 | /* |
---|
305 | * _States_Is_waiting_on_thread_queue |
---|
306 | * |
---|
307 | * DESCRIPTION: |
---|
308 | * |
---|
309 | * This function returns TRUE if one of the states which indicates |
---|
310 | * that a task is blocked waiting for a local resource is set in |
---|
311 | * the_states, and FALSE otherwise. |
---|
312 | */ |
---|
313 | |
---|
314 | STATIC INLINE boolean _States_Is_waiting_on_thread_queue ( |
---|
315 | States_Control the_states |
---|
316 | ); |
---|
317 | |
---|
318 | /* |
---|
319 | * _States_Is_blocked |
---|
320 | * |
---|
321 | * DESCRIPTION: |
---|
322 | * |
---|
323 | * This function returns TRUE if one of the states which indicates |
---|
324 | * that a task is blocked is set in the_states, and FALSE otherwise. |
---|
325 | */ |
---|
326 | |
---|
327 | STATIC INLINE boolean _States_Is_blocked ( |
---|
328 | States_Control the_states |
---|
329 | ); |
---|
330 | |
---|
331 | /* |
---|
332 | * _States_Are_set |
---|
333 | * |
---|
334 | * DESCRIPTION: |
---|
335 | * |
---|
336 | * This function returns TRUE if any of the states in the mask |
---|
337 | * are set in the_states, and FALSE otherwise. |
---|
338 | */ |
---|
339 | |
---|
340 | STATIC INLINE boolean _States_Are_set ( |
---|
341 | States_Control the_states, |
---|
342 | States_Control mask |
---|
343 | ); |
---|
344 | |
---|
345 | #include <rtems/core/states.inl> |
---|
346 | |
---|
347 | #ifdef __cplusplus |
---|
348 | } |
---|
349 | #endif |
---|
350 | |
---|
351 | #endif |
---|
352 | /* end of include file */ |
---|