1 | /* states.inl |
---|
2 | * |
---|
3 | * This file contains the macro implementation of the inlined |
---|
4 | * routines associated with thread state information. |
---|
5 | * |
---|
6 | * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. |
---|
7 | * On-Line Applications Research Corporation (OAR). |
---|
8 | * All rights assigned to U.S. Government, 1994. |
---|
9 | * |
---|
10 | * This material may be reproduced by or for the U.S. Government pursuant |
---|
11 | * to the copyright license under the clause at DFARS 252.227-7013. This |
---|
12 | * notice must appear in all copies of this file and its derivatives. |
---|
13 | * |
---|
14 | * $Id$ |
---|
15 | */ |
---|
16 | |
---|
17 | #ifndef __STATES_inl |
---|
18 | #define __STATES_inl |
---|
19 | |
---|
20 | /*PAGE |
---|
21 | * |
---|
22 | * _States_Set |
---|
23 | * |
---|
24 | * DESCRIPTION: |
---|
25 | * |
---|
26 | * This function sets the given states_to_set into the current_state |
---|
27 | * passed in. The result is returned to the user in current_state. |
---|
28 | */ |
---|
29 | |
---|
30 | RTEMS_INLINE_ROUTINE States_Control _States_Set ( |
---|
31 | States_Control states_to_set, |
---|
32 | States_Control current_state |
---|
33 | ) |
---|
34 | { |
---|
35 | return (current_state | states_to_set); |
---|
36 | } |
---|
37 | |
---|
38 | /*PAGE |
---|
39 | * |
---|
40 | * _States_Clear |
---|
41 | * |
---|
42 | * DESCRIPTION: |
---|
43 | * |
---|
44 | * This function clears the given states_to_clear into the current_state |
---|
45 | * passed in. The result is returned to the user in current_state. |
---|
46 | */ |
---|
47 | |
---|
48 | RTEMS_INLINE_ROUTINE States_Control _States_Clear ( |
---|
49 | States_Control states_to_clear, |
---|
50 | States_Control current_state |
---|
51 | ) |
---|
52 | { |
---|
53 | return (current_state & ~states_to_clear); |
---|
54 | } |
---|
55 | |
---|
56 | /*PAGE |
---|
57 | * |
---|
58 | * _States_Is_ready |
---|
59 | * |
---|
60 | * DESCRIPTION: |
---|
61 | * |
---|
62 | * This function returns TRUE if the_states indicates that the |
---|
63 | * state is READY, and FALSE otherwise. |
---|
64 | */ |
---|
65 | |
---|
66 | RTEMS_INLINE_ROUTINE boolean _States_Is_ready ( |
---|
67 | States_Control the_states |
---|
68 | ) |
---|
69 | { |
---|
70 | return (the_states == STATES_READY); |
---|
71 | } |
---|
72 | |
---|
73 | /*PAGE |
---|
74 | * |
---|
75 | * _States_Is_only_dormant |
---|
76 | * |
---|
77 | * DESCRIPTION: |
---|
78 | * |
---|
79 | * This function returns TRUE if the DORMANT state is the ONLY state |
---|
80 | * set in the_states, and FALSE otherwise. |
---|
81 | */ |
---|
82 | |
---|
83 | RTEMS_INLINE_ROUTINE boolean _States_Is_only_dormant ( |
---|
84 | States_Control the_states |
---|
85 | ) |
---|
86 | { |
---|
87 | return (the_states == STATES_DORMANT); |
---|
88 | } |
---|
89 | |
---|
90 | /*PAGE |
---|
91 | * |
---|
92 | * _States_Is_dormant |
---|
93 | * |
---|
94 | * DESCRIPTION: |
---|
95 | * |
---|
96 | * This function returns TRUE if the DORMANT state is set in |
---|
97 | * the_states, and FALSE otherwise. |
---|
98 | */ |
---|
99 | |
---|
100 | RTEMS_INLINE_ROUTINE boolean _States_Is_dormant ( |
---|
101 | States_Control the_states |
---|
102 | ) |
---|
103 | { |
---|
104 | return (the_states & STATES_DORMANT); |
---|
105 | } |
---|
106 | |
---|
107 | /*PAGE |
---|
108 | * |
---|
109 | * _States_Is_suspended |
---|
110 | * |
---|
111 | * DESCRIPTION: |
---|
112 | * |
---|
113 | * This function returns TRUE if the SUSPENDED state is set in |
---|
114 | * the_states, and FALSE otherwise. |
---|
115 | */ |
---|
116 | |
---|
117 | RTEMS_INLINE_ROUTINE boolean _States_Is_suspended ( |
---|
118 | States_Control the_states |
---|
119 | ) |
---|
120 | { |
---|
121 | return (the_states & STATES_SUSPENDED); |
---|
122 | } |
---|
123 | |
---|
124 | /*PAGE |
---|
125 | * |
---|
126 | * _States_Is_Transient |
---|
127 | * |
---|
128 | * DESCRIPTION: |
---|
129 | * |
---|
130 | * This function returns TRUE if the TRANSIENT state is set in |
---|
131 | * the_states, and FALSE otherwise. |
---|
132 | */ |
---|
133 | |
---|
134 | RTEMS_INLINE_ROUTINE boolean _States_Is_transient ( |
---|
135 | States_Control the_states |
---|
136 | ) |
---|
137 | { |
---|
138 | return (the_states & STATES_TRANSIENT); |
---|
139 | } |
---|
140 | |
---|
141 | /*PAGE |
---|
142 | * |
---|
143 | * _States_Is_delaying |
---|
144 | * |
---|
145 | * DESCRIPTION: |
---|
146 | * |
---|
147 | * This function returns TRUE if the DELAYING state is set in |
---|
148 | * the_states, and FALSE otherwise. |
---|
149 | */ |
---|
150 | |
---|
151 | RTEMS_INLINE_ROUTINE boolean _States_Is_delaying ( |
---|
152 | States_Control the_states |
---|
153 | ) |
---|
154 | { |
---|
155 | return (the_states & STATES_DELAYING); |
---|
156 | } |
---|
157 | |
---|
158 | /*PAGE |
---|
159 | * |
---|
160 | * _States_Is_waiting_for_buffer |
---|
161 | * |
---|
162 | * DESCRIPTION: |
---|
163 | * |
---|
164 | * This function returns TRUE if the WAITING_FOR_BUFFER state is set in |
---|
165 | * the_states, and FALSE otherwise. |
---|
166 | */ |
---|
167 | |
---|
168 | RTEMS_INLINE_ROUTINE boolean _States_Is_waiting_for_buffer ( |
---|
169 | States_Control the_states |
---|
170 | ) |
---|
171 | { |
---|
172 | return (the_states & STATES_WAITING_FOR_BUFFER); |
---|
173 | } |
---|
174 | |
---|
175 | /*PAGE |
---|
176 | * |
---|
177 | * _States_Is_waiting_for_segment |
---|
178 | * |
---|
179 | * DESCRIPTION: |
---|
180 | * |
---|
181 | * This function returns TRUE if the WAITING_FOR_SEGMENT state is set in |
---|
182 | * the_states, and FALSE otherwise. |
---|
183 | */ |
---|
184 | |
---|
185 | RTEMS_INLINE_ROUTINE boolean _States_Is_waiting_for_segment ( |
---|
186 | States_Control the_states |
---|
187 | ) |
---|
188 | { |
---|
189 | return (the_states & STATES_WAITING_FOR_SEGMENT); |
---|
190 | } |
---|
191 | |
---|
192 | /*PAGE |
---|
193 | * |
---|
194 | * _States_Is_waiting_for_message |
---|
195 | * |
---|
196 | * DESCRIPTION: |
---|
197 | * |
---|
198 | * This function returns TRUE if the WAITING_FOR_MESSAGE state is set in |
---|
199 | * the_states, and FALSE otherwise. |
---|
200 | */ |
---|
201 | |
---|
202 | RTEMS_INLINE_ROUTINE boolean _States_Is_waiting_for_message ( |
---|
203 | States_Control the_states |
---|
204 | ) |
---|
205 | { |
---|
206 | return (the_states & STATES_WAITING_FOR_MESSAGE); |
---|
207 | } |
---|
208 | |
---|
209 | /*PAGE |
---|
210 | * |
---|
211 | * _States_Is_waiting_for_event |
---|
212 | * |
---|
213 | * DESCRIPTION: |
---|
214 | * |
---|
215 | * This function returns TRUE if the WAITING_FOR_EVENT state is set in |
---|
216 | * the_states, and FALSE otherwise. |
---|
217 | */ |
---|
218 | |
---|
219 | RTEMS_INLINE_ROUTINE boolean _States_Is_waiting_for_event ( |
---|
220 | States_Control the_states |
---|
221 | ) |
---|
222 | { |
---|
223 | return (the_states & STATES_WAITING_FOR_EVENT); |
---|
224 | } |
---|
225 | |
---|
226 | /*PAGE |
---|
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 | RTEMS_INLINE_ROUTINE boolean _States_Is_waiting_for_mutex ( |
---|
237 | States_Control the_states |
---|
238 | ) |
---|
239 | { |
---|
240 | return (the_states & STATES_WAITING_FOR_MUTEX); |
---|
241 | } |
---|
242 | |
---|
243 | /*PAGE |
---|
244 | * |
---|
245 | * _States_Is_waiting_for_semaphore |
---|
246 | * |
---|
247 | * DESCRIPTION: |
---|
248 | * |
---|
249 | * This function returns TRUE if the WAITING_FOR_SEMAPHORE state |
---|
250 | * is set in the_states, and FALSE otherwise. |
---|
251 | */ |
---|
252 | |
---|
253 | RTEMS_INLINE_ROUTINE boolean _States_Is_waiting_for_semaphore ( |
---|
254 | States_Control the_states |
---|
255 | ) |
---|
256 | { |
---|
257 | return (the_states & STATES_WAITING_FOR_SEMAPHORE); |
---|
258 | } |
---|
259 | |
---|
260 | /*PAGE |
---|
261 | * |
---|
262 | * _States_Is_waiting_for_time |
---|
263 | * |
---|
264 | * DESCRIPTION: |
---|
265 | * |
---|
266 | * This function returns TRUE if the WAITING_FOR_TIME state is set in |
---|
267 | * the_states, and FALSE otherwise. |
---|
268 | */ |
---|
269 | |
---|
270 | RTEMS_INLINE_ROUTINE boolean _States_Is_waiting_for_time ( |
---|
271 | States_Control the_states |
---|
272 | ) |
---|
273 | { |
---|
274 | return (the_states & STATES_WAITING_FOR_TIME); |
---|
275 | } |
---|
276 | |
---|
277 | /*PAGE |
---|
278 | * |
---|
279 | * _States_Is_waiting_for_rpc_reply |
---|
280 | * |
---|
281 | * DESCRIPTION: |
---|
282 | * |
---|
283 | * This function returns TRUE if the WAITING_FOR_TIME state is set in |
---|
284 | * the_states, and FALSE otherwise. |
---|
285 | */ |
---|
286 | |
---|
287 | RTEMS_INLINE_ROUTINE boolean _States_Is_waiting_for_rpc_reply ( |
---|
288 | States_Control the_states |
---|
289 | ) |
---|
290 | { |
---|
291 | return (the_states & STATES_WAITING_FOR_RPC_REPLY); |
---|
292 | } |
---|
293 | |
---|
294 | /*PAGE |
---|
295 | * |
---|
296 | * _States_Is_waiting_for_period |
---|
297 | * |
---|
298 | * DESCRIPTION: |
---|
299 | * |
---|
300 | * This function returns TRUE if the WAITING_FOR_PERIOD state is set in |
---|
301 | * the_states, and FALSE otherwise. |
---|
302 | */ |
---|
303 | |
---|
304 | RTEMS_INLINE_ROUTINE boolean _States_Is_waiting_for_period ( |
---|
305 | States_Control the_states |
---|
306 | ) |
---|
307 | { |
---|
308 | return (the_states & STATES_WAITING_FOR_PERIOD); |
---|
309 | } |
---|
310 | |
---|
311 | /*PAGE |
---|
312 | * |
---|
313 | * _States_Is_locally_blocked |
---|
314 | * |
---|
315 | * DESCRIPTION: |
---|
316 | * |
---|
317 | * This function returns TRUE if one of the states which indicates |
---|
318 | * that a task is blocked waiting for a local resource is set in |
---|
319 | * the_states, and FALSE otherwise. |
---|
320 | */ |
---|
321 | |
---|
322 | RTEMS_INLINE_ROUTINE boolean _States_Is_locally_blocked ( |
---|
323 | States_Control the_states |
---|
324 | ) |
---|
325 | { |
---|
326 | return (the_states & STATES_LOCALLY_BLOCKED); |
---|
327 | } |
---|
328 | |
---|
329 | /*PAGE |
---|
330 | * |
---|
331 | * _States_Is_waiting_on_thread_queue |
---|
332 | * |
---|
333 | * DESCRIPTION: |
---|
334 | * |
---|
335 | * This function returns TRUE if one of the states which indicates |
---|
336 | * that a task is blocked waiting for a local resource is set in |
---|
337 | * the_states, and FALSE otherwise. |
---|
338 | */ |
---|
339 | |
---|
340 | RTEMS_INLINE_ROUTINE boolean _States_Is_waiting_on_thread_queue ( |
---|
341 | States_Control the_states |
---|
342 | ) |
---|
343 | { |
---|
344 | return (the_states & STATES_WAITING_ON_THREAD_QUEUE); |
---|
345 | } |
---|
346 | |
---|
347 | /*PAGE |
---|
348 | * |
---|
349 | * _States_Is_blocked |
---|
350 | * |
---|
351 | * DESCRIPTION: |
---|
352 | * |
---|
353 | * This function returns TRUE if one of the states which indicates |
---|
354 | * that a task is blocked is set in the_states, and FALSE otherwise. |
---|
355 | */ |
---|
356 | |
---|
357 | RTEMS_INLINE_ROUTINE boolean _States_Is_blocked ( |
---|
358 | States_Control the_states |
---|
359 | ) |
---|
360 | { |
---|
361 | return (the_states & STATES_BLOCKED); |
---|
362 | } |
---|
363 | |
---|
364 | /*PAGE |
---|
365 | * |
---|
366 | * |
---|
367 | * _States_Are_set |
---|
368 | * |
---|
369 | * DESCRIPTION: |
---|
370 | * |
---|
371 | * This function returns TRUE if any of the states in the mask |
---|
372 | * are set in the_states, and FALSE otherwise. |
---|
373 | */ |
---|
374 | |
---|
375 | RTEMS_INLINE_ROUTINE boolean _States_Are_set ( |
---|
376 | States_Control the_states, |
---|
377 | States_Control mask |
---|
378 | ) |
---|
379 | { |
---|
380 | return ( (the_states & mask) != STATES_READY); |
---|
381 | } |
---|
382 | |
---|
383 | #endif |
---|
384 | /* end of include file */ |
---|