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 not started */ |
---|
38 | #define STATES_SUSPENDED 0x0002 /* waiting for resume */ |
---|
39 | #define STATES_TRANSIENT 0x0004 /* thread in transition */ |
---|
40 | #define STATES_DELAYING 0x0008 /* wait for timeout */ |
---|
41 | #define STATES_WAITING_FOR_TIME 0x0010 /* wait for TOD */ |
---|
42 | #define STATES_WAITING_FOR_BUFFER 0x0020 |
---|
43 | #define STATES_WAITING_FOR_SEGMENT 0x0040 |
---|
44 | #define STATES_WAITING_FOR_MESSAGE 0x0080 |
---|
45 | #define STATES_WAITING_FOR_EVENT 0x0100 |
---|
46 | #define STATES_WAITING_FOR_SEMAPHORE 0x0200 |
---|
47 | #define STATES_WAITING_FOR_MUTEX 0x0400 |
---|
48 | #define STATES_WAITING_FOR_CONDITION_VARIABLE 0x0800 |
---|
49 | #define STATES_WAITING_FOR_RPC_REPLY 0x1000 |
---|
50 | #define STATES_WAITING_FOR_PERIOD 0x2000 |
---|
51 | |
---|
52 | #define STATES_LOCALLY_BLOCKED ( STATES_WAITING_FOR_BUFFER | \ |
---|
53 | STATES_WAITING_FOR_SEGMENT | \ |
---|
54 | STATES_WAITING_FOR_MESSAGE | \ |
---|
55 | STATES_WAITING_FOR_MUTEX | \ |
---|
56 | STATES_WAITING_FOR_CONDITION_VARIABLE | \ |
---|
57 | STATES_WAITING_FOR_SEMAPHORE ) |
---|
58 | |
---|
59 | #define STATES_WAITING_ON_THREAD_QUEUE \ |
---|
60 | ( STATES_LOCALLY_BLOCKED | \ |
---|
61 | STATES_WAITING_FOR_RPC_REPLY ) |
---|
62 | |
---|
63 | #define STATES_BLOCKED ( STATES_DELAYING | \ |
---|
64 | STATES_WAITING_FOR_TIME | \ |
---|
65 | STATES_WAITING_FOR_PERIOD | \ |
---|
66 | STATES_WAITING_FOR_EVENT | \ |
---|
67 | STATES_WAITING_ON_THREAD_QUEUE ) |
---|
68 | |
---|
69 | /* |
---|
70 | * _States_Set |
---|
71 | * |
---|
72 | * DESCRIPTION: |
---|
73 | * |
---|
74 | * This function sets the given states_to_set into the current_state |
---|
75 | * passed in. The result is returned to the user in current_state. |
---|
76 | */ |
---|
77 | |
---|
78 | STATIC INLINE States_Control _States_Set ( |
---|
79 | States_Control states_to_set, |
---|
80 | States_Control current_state |
---|
81 | ); |
---|
82 | |
---|
83 | /* |
---|
84 | * _States_Clear |
---|
85 | * |
---|
86 | * DESCRIPTION: |
---|
87 | * |
---|
88 | * This function clears the given states_to_clear into the current_state |
---|
89 | * passed in. The result is returned to the user in current_state. |
---|
90 | */ |
---|
91 | |
---|
92 | STATIC INLINE States_Control _States_Clear ( |
---|
93 | States_Control states_to_clear, |
---|
94 | States_Control current_state |
---|
95 | ); |
---|
96 | |
---|
97 | /* |
---|
98 | * _States_Is_ready |
---|
99 | * |
---|
100 | * DESCRIPTION: |
---|
101 | * |
---|
102 | * This function returns TRUE if the_states indicates that the |
---|
103 | * state is READY, and FALSE otherwise. |
---|
104 | */ |
---|
105 | |
---|
106 | STATIC INLINE boolean _States_Is_ready ( |
---|
107 | States_Control the_states |
---|
108 | ); |
---|
109 | |
---|
110 | /* |
---|
111 | * _States_Is_only_dormant |
---|
112 | * |
---|
113 | * DESCRIPTION: |
---|
114 | * |
---|
115 | * This function returns TRUE if the DORMANT state is the ONLY state |
---|
116 | * set in the_states, and FALSE otherwise. |
---|
117 | */ |
---|
118 | |
---|
119 | STATIC INLINE boolean _States_Is_only_dormant ( |
---|
120 | States_Control the_states |
---|
121 | ); |
---|
122 | |
---|
123 | /* |
---|
124 | * _States_Is_dormant |
---|
125 | * |
---|
126 | * DESCRIPTION: |
---|
127 | * |
---|
128 | * This function returns TRUE if the DORMANT state is set in |
---|
129 | * the_states, and FALSE otherwise. |
---|
130 | */ |
---|
131 | |
---|
132 | STATIC INLINE boolean _States_Is_dormant ( |
---|
133 | States_Control the_states |
---|
134 | ); |
---|
135 | |
---|
136 | /* |
---|
137 | * _States_Is_suspended |
---|
138 | * |
---|
139 | * DESCRIPTION: |
---|
140 | * |
---|
141 | * This function returns TRUE if the SUSPENDED state is set in |
---|
142 | * the_states, and FALSE otherwise. |
---|
143 | */ |
---|
144 | |
---|
145 | STATIC INLINE boolean _States_Is_suspended ( |
---|
146 | States_Control the_states |
---|
147 | ); |
---|
148 | |
---|
149 | /* |
---|
150 | * _States_Is_Transient |
---|
151 | * |
---|
152 | * DESCRIPTION: |
---|
153 | * |
---|
154 | * This function returns TRUE if the TRANSIENT state is set in |
---|
155 | * the_states, and FALSE otherwise. |
---|
156 | */ |
---|
157 | |
---|
158 | STATIC INLINE boolean _States_Is_transient ( |
---|
159 | States_Control the_states |
---|
160 | ); |
---|
161 | |
---|
162 | /* |
---|
163 | * _States_Is_delaying |
---|
164 | * |
---|
165 | * DESCRIPTION: |
---|
166 | * |
---|
167 | * This function returns TRUE if the DELAYING state is set in |
---|
168 | * the_states, and FALSE otherwise. |
---|
169 | */ |
---|
170 | |
---|
171 | STATIC INLINE boolean _States_Is_delaying ( |
---|
172 | States_Control the_states |
---|
173 | ); |
---|
174 | |
---|
175 | /* |
---|
176 | * _States_Is_waiting_for_buffer |
---|
177 | * |
---|
178 | * DESCRIPTION: |
---|
179 | * |
---|
180 | * This function returns TRUE if the WAITING_FOR_BUFFER state is set in |
---|
181 | * the_states, and FALSE otherwise. |
---|
182 | */ |
---|
183 | |
---|
184 | STATIC INLINE boolean _States_Is_waiting_for_buffer ( |
---|
185 | States_Control the_states |
---|
186 | ); |
---|
187 | |
---|
188 | /* |
---|
189 | * _States_Is_waiting_for_segment |
---|
190 | * |
---|
191 | * DESCRIPTION: |
---|
192 | * |
---|
193 | * This function returns TRUE if the WAITING_FOR_SEGMENT state is set in |
---|
194 | * the_states, and FALSE otherwise. |
---|
195 | */ |
---|
196 | |
---|
197 | STATIC INLINE boolean _States_Is_waiting_for_segment ( |
---|
198 | States_Control the_states |
---|
199 | ); |
---|
200 | |
---|
201 | /* |
---|
202 | * _States_Is_waiting_for_message |
---|
203 | * |
---|
204 | * DESCRIPTION: |
---|
205 | * |
---|
206 | * This function returns TRUE if the WAITING_FOR_MESSAGE state is set in |
---|
207 | * the_states, and FALSE otherwise. |
---|
208 | */ |
---|
209 | |
---|
210 | STATIC INLINE boolean _States_Is_waiting_for_message ( |
---|
211 | States_Control the_states |
---|
212 | ); |
---|
213 | |
---|
214 | /* |
---|
215 | * _States_Is_waiting_for_event |
---|
216 | * |
---|
217 | * DESCRIPTION: |
---|
218 | * |
---|
219 | * This function returns TRUE if the WAITING_FOR_EVENT state is set in |
---|
220 | * the_states, and FALSE otherwise. |
---|
221 | */ |
---|
222 | |
---|
223 | STATIC INLINE boolean _States_Is_waiting_for_event ( |
---|
224 | States_Control the_states |
---|
225 | ); |
---|
226 | |
---|
227 | /* |
---|
228 | * _States_Is_waiting_for_mutex |
---|
229 | * |
---|
230 | * DESCRIPTION: |
---|
231 | * |
---|
232 | * This function returns TRUE if the WAITING_FOR_MUTEX state |
---|
233 | * is set in the_states, and FALSE otherwise. |
---|
234 | */ |
---|
235 | |
---|
236 | STATIC INLINE boolean _States_Is_waiting_for_mutex ( |
---|
237 | States_Control the_states |
---|
238 | ); |
---|
239 | |
---|
240 | /* |
---|
241 | * _States_Is_waiting_for_semaphore |
---|
242 | * |
---|
243 | * DESCRIPTION: |
---|
244 | * |
---|
245 | * This function returns TRUE if the WAITING_FOR_SEMAPHORE state |
---|
246 | * is set in the_states, and FALSE otherwise. |
---|
247 | */ |
---|
248 | |
---|
249 | STATIC INLINE boolean _States_Is_waiting_for_semaphore ( |
---|
250 | States_Control the_states |
---|
251 | ); |
---|
252 | |
---|
253 | /* |
---|
254 | * _States_Is_waiting_for_time |
---|
255 | * |
---|
256 | * DESCRIPTION: |
---|
257 | * |
---|
258 | * This function returns TRUE if the WAITING_FOR_TIME state is set in |
---|
259 | * the_states, and FALSE otherwise. |
---|
260 | */ |
---|
261 | |
---|
262 | STATIC INLINE boolean _States_Is_waiting_for_time ( |
---|
263 | States_Control the_states |
---|
264 | ); |
---|
265 | |
---|
266 | /* |
---|
267 | * _States_Is_waiting_for_rpc_reply |
---|
268 | * |
---|
269 | * DESCRIPTION: |
---|
270 | * |
---|
271 | * This function returns TRUE if the WAITING_FOR_TIME state is set in |
---|
272 | * the_states, and FALSE otherwise. |
---|
273 | */ |
---|
274 | |
---|
275 | STATIC INLINE boolean _States_Is_waiting_for_rpc_reply ( |
---|
276 | States_Control the_states |
---|
277 | ); |
---|
278 | |
---|
279 | /* |
---|
280 | * _States_Is_waiting_for_period |
---|
281 | * |
---|
282 | * DESCRIPTION: |
---|
283 | * |
---|
284 | * This function returns TRUE if the WAITING_FOR_PERIOD state is set in |
---|
285 | * the_states, and FALSE otherwise. |
---|
286 | */ |
---|
287 | |
---|
288 | STATIC INLINE boolean _States_Is_waiting_for_period ( |
---|
289 | States_Control the_states |
---|
290 | ); |
---|
291 | |
---|
292 | /* |
---|
293 | * _States_Is_locally_blocked |
---|
294 | * |
---|
295 | * DESCRIPTION: |
---|
296 | * |
---|
297 | * This function returns TRUE if one of the states which indicates |
---|
298 | * that a task is blocked waiting for a local resource is set in |
---|
299 | * the_states, and FALSE otherwise. |
---|
300 | */ |
---|
301 | |
---|
302 | STATIC INLINE boolean _States_Is_locally_blocked ( |
---|
303 | States_Control the_states |
---|
304 | ); |
---|
305 | |
---|
306 | /* |
---|
307 | * _States_Is_waiting_on_thread_queue |
---|
308 | * |
---|
309 | * DESCRIPTION: |
---|
310 | * |
---|
311 | * This function returns TRUE if one of the states which indicates |
---|
312 | * that a task is blocked waiting for a local resource is set in |
---|
313 | * the_states, and FALSE otherwise. |
---|
314 | */ |
---|
315 | |
---|
316 | STATIC INLINE boolean _States_Is_waiting_on_thread_queue ( |
---|
317 | States_Control the_states |
---|
318 | ); |
---|
319 | |
---|
320 | /* |
---|
321 | * _States_Is_blocked |
---|
322 | * |
---|
323 | * DESCRIPTION: |
---|
324 | * |
---|
325 | * This function returns TRUE if one of the states which indicates |
---|
326 | * that a task is blocked is set in the_states, and FALSE otherwise. |
---|
327 | */ |
---|
328 | |
---|
329 | STATIC INLINE boolean _States_Is_blocked ( |
---|
330 | States_Control the_states |
---|
331 | ); |
---|
332 | |
---|
333 | /* |
---|
334 | * _States_Are_set |
---|
335 | * |
---|
336 | * DESCRIPTION: |
---|
337 | * |
---|
338 | * This function returns TRUE if any of the states in the mask |
---|
339 | * are set in the_states, and FALSE otherwise. |
---|
340 | */ |
---|
341 | |
---|
342 | STATIC INLINE boolean _States_Are_set ( |
---|
343 | States_Control the_states, |
---|
344 | States_Control mask |
---|
345 | ); |
---|
346 | |
---|
347 | #include <rtems/score/states.inl> |
---|
348 | |
---|
349 | #ifdef __cplusplus |
---|
350 | } |
---|
351 | #endif |
---|
352 | |
---|
353 | #endif |
---|
354 | /* end of include file */ |
---|