1 | /** |
---|
2 | * @file rtems/score/states.inl |
---|
3 | * |
---|
4 | * This file contains the macro implementation of the inlined |
---|
5 | * routines associated with thread state information. |
---|
6 | */ |
---|
7 | |
---|
8 | /* |
---|
9 | * COPYRIGHT (c) 1989-2004. |
---|
10 | * On-Line Applications Research Corporation (OAR). |
---|
11 | * |
---|
12 | * The license and distribution terms for this file may be |
---|
13 | * found in the file LICENSE in this distribution or at |
---|
14 | * http://www.rtems.com/license/LICENSE. |
---|
15 | * |
---|
16 | * $Id$ |
---|
17 | */ |
---|
18 | |
---|
19 | #ifndef _RTEMS_SCORE_STATES_H |
---|
20 | # error "Never use <rtems/score/states.inl> directly; include <rtems/score/states.h> instead." |
---|
21 | #endif |
---|
22 | |
---|
23 | #ifndef _RTEMS_SCORE_STATES_INL |
---|
24 | #define _RTEMS_SCORE_STATES_INL |
---|
25 | |
---|
26 | /** |
---|
27 | * @addtogroup ScoreStates |
---|
28 | * @{ |
---|
29 | */ |
---|
30 | |
---|
31 | /** |
---|
32 | * This function sets the given states_to_set into the current_state |
---|
33 | * passed in. The result is returned to the user in current_state. |
---|
34 | */ |
---|
35 | |
---|
36 | RTEMS_INLINE_ROUTINE States_Control _States_Set ( |
---|
37 | States_Control states_to_set, |
---|
38 | States_Control current_state |
---|
39 | ) |
---|
40 | { |
---|
41 | return (current_state | states_to_set); |
---|
42 | } |
---|
43 | |
---|
44 | /** |
---|
45 | * This function clears the given states_to_clear into the current_state |
---|
46 | * passed in. The result is returned to the user in current_state. |
---|
47 | */ |
---|
48 | |
---|
49 | RTEMS_INLINE_ROUTINE States_Control _States_Clear ( |
---|
50 | States_Control states_to_clear, |
---|
51 | States_Control current_state |
---|
52 | ) |
---|
53 | { |
---|
54 | return (current_state & ~states_to_clear); |
---|
55 | } |
---|
56 | |
---|
57 | /** |
---|
58 | * This function returns true if the_states indicates that the |
---|
59 | * state is READY, and false otherwise. |
---|
60 | */ |
---|
61 | |
---|
62 | RTEMS_INLINE_ROUTINE bool _States_Is_ready ( |
---|
63 | States_Control the_states |
---|
64 | ) |
---|
65 | { |
---|
66 | return (the_states == STATES_READY); |
---|
67 | } |
---|
68 | |
---|
69 | /** |
---|
70 | * This function returns true if the DORMANT state is the ONLY state |
---|
71 | * set in the_states, and false otherwise. |
---|
72 | */ |
---|
73 | |
---|
74 | RTEMS_INLINE_ROUTINE bool _States_Is_only_dormant ( |
---|
75 | States_Control the_states |
---|
76 | ) |
---|
77 | { |
---|
78 | return (the_states == STATES_DORMANT); |
---|
79 | } |
---|
80 | |
---|
81 | /** |
---|
82 | * This function returns true if the DORMANT state is set in |
---|
83 | * the_states, and false otherwise. |
---|
84 | */ |
---|
85 | |
---|
86 | RTEMS_INLINE_ROUTINE bool _States_Is_dormant ( |
---|
87 | States_Control the_states |
---|
88 | ) |
---|
89 | { |
---|
90 | return (the_states & STATES_DORMANT); |
---|
91 | } |
---|
92 | |
---|
93 | /** |
---|
94 | * This function returns true if the SUSPENDED state is set in |
---|
95 | * the_states, and false otherwise. |
---|
96 | */ |
---|
97 | |
---|
98 | RTEMS_INLINE_ROUTINE bool _States_Is_suspended ( |
---|
99 | States_Control the_states |
---|
100 | ) |
---|
101 | { |
---|
102 | return (the_states & STATES_SUSPENDED); |
---|
103 | } |
---|
104 | |
---|
105 | /** |
---|
106 | * This function returns true if the TRANSIENT state is set in |
---|
107 | * the_states, and false otherwise. |
---|
108 | */ |
---|
109 | |
---|
110 | RTEMS_INLINE_ROUTINE bool _States_Is_transient ( |
---|
111 | States_Control the_states |
---|
112 | ) |
---|
113 | { |
---|
114 | return (the_states & STATES_TRANSIENT); |
---|
115 | } |
---|
116 | |
---|
117 | /** |
---|
118 | * This function returns true if the DELAYING state is set in |
---|
119 | * the_states, and false otherwise. |
---|
120 | */ |
---|
121 | |
---|
122 | RTEMS_INLINE_ROUTINE bool _States_Is_delaying ( |
---|
123 | States_Control the_states |
---|
124 | ) |
---|
125 | { |
---|
126 | return (the_states & STATES_DELAYING); |
---|
127 | } |
---|
128 | |
---|
129 | /** |
---|
130 | * This function returns true if the WAITING_FOR_BUFFER state is set in |
---|
131 | * the_states, and false otherwise. |
---|
132 | */ |
---|
133 | |
---|
134 | RTEMS_INLINE_ROUTINE bool _States_Is_waiting_for_buffer ( |
---|
135 | States_Control the_states |
---|
136 | ) |
---|
137 | { |
---|
138 | return (the_states & STATES_WAITING_FOR_BUFFER); |
---|
139 | } |
---|
140 | |
---|
141 | /** |
---|
142 | * This function returns true if the WAITING_FOR_SEGMENT state is set in |
---|
143 | * the_states, and false otherwise. |
---|
144 | */ |
---|
145 | |
---|
146 | RTEMS_INLINE_ROUTINE bool _States_Is_waiting_for_segment ( |
---|
147 | States_Control the_states |
---|
148 | ) |
---|
149 | { |
---|
150 | return (the_states & STATES_WAITING_FOR_SEGMENT); |
---|
151 | } |
---|
152 | |
---|
153 | /** |
---|
154 | * This function returns true if the WAITING_FOR_MESSAGE state is set in |
---|
155 | * the_states, and false otherwise. |
---|
156 | */ |
---|
157 | |
---|
158 | RTEMS_INLINE_ROUTINE bool _States_Is_waiting_for_message ( |
---|
159 | States_Control the_states |
---|
160 | ) |
---|
161 | { |
---|
162 | return (the_states & STATES_WAITING_FOR_MESSAGE); |
---|
163 | } |
---|
164 | |
---|
165 | /** |
---|
166 | * This function returns true if the WAITING_FOR_EVENT state is set in |
---|
167 | * the_states, and false otherwise. |
---|
168 | */ |
---|
169 | |
---|
170 | RTEMS_INLINE_ROUTINE bool _States_Is_waiting_for_event ( |
---|
171 | States_Control the_states |
---|
172 | ) |
---|
173 | { |
---|
174 | return (the_states & STATES_WAITING_FOR_EVENT); |
---|
175 | } |
---|
176 | |
---|
177 | /** |
---|
178 | * This function returns true if the WAITING_FOR_MUTEX state |
---|
179 | * is set in the_states, and false otherwise. |
---|
180 | */ |
---|
181 | |
---|
182 | RTEMS_INLINE_ROUTINE bool _States_Is_waiting_for_mutex ( |
---|
183 | States_Control the_states |
---|
184 | ) |
---|
185 | { |
---|
186 | return (the_states & STATES_WAITING_FOR_MUTEX); |
---|
187 | } |
---|
188 | |
---|
189 | /** |
---|
190 | * This function returns true if the WAITING_FOR_SEMAPHORE state |
---|
191 | * is set in the_states, and false otherwise. |
---|
192 | */ |
---|
193 | |
---|
194 | RTEMS_INLINE_ROUTINE bool _States_Is_waiting_for_semaphore ( |
---|
195 | States_Control the_states |
---|
196 | ) |
---|
197 | { |
---|
198 | return (the_states & STATES_WAITING_FOR_SEMAPHORE); |
---|
199 | } |
---|
200 | |
---|
201 | /** |
---|
202 | * This function returns true if the WAITING_FOR_TIME state is set in |
---|
203 | * the_states, and false otherwise. |
---|
204 | */ |
---|
205 | |
---|
206 | RTEMS_INLINE_ROUTINE bool _States_Is_waiting_for_time ( |
---|
207 | States_Control the_states |
---|
208 | ) |
---|
209 | { |
---|
210 | return (the_states & STATES_WAITING_FOR_TIME); |
---|
211 | } |
---|
212 | |
---|
213 | /** |
---|
214 | * This function returns true if the WAITING_FOR_TIME state is set in |
---|
215 | * the_states, and false otherwise. |
---|
216 | */ |
---|
217 | |
---|
218 | RTEMS_INLINE_ROUTINE bool _States_Is_waiting_for_rpc_reply ( |
---|
219 | States_Control the_states |
---|
220 | ) |
---|
221 | { |
---|
222 | return (the_states & STATES_WAITING_FOR_RPC_REPLY); |
---|
223 | } |
---|
224 | |
---|
225 | /** |
---|
226 | * This function returns true if the WAITING_FOR_PERIOD state is set in |
---|
227 | * the_states, and false otherwise. |
---|
228 | */ |
---|
229 | |
---|
230 | RTEMS_INLINE_ROUTINE bool _States_Is_waiting_for_period ( |
---|
231 | States_Control the_states |
---|
232 | ) |
---|
233 | { |
---|
234 | return (the_states & STATES_WAITING_FOR_PERIOD); |
---|
235 | } |
---|
236 | |
---|
237 | /** |
---|
238 | * This function returns true if one of the states which indicates |
---|
239 | * that a task is blocked waiting for a local resource is set in |
---|
240 | * the_states, and false otherwise. |
---|
241 | */ |
---|
242 | |
---|
243 | RTEMS_INLINE_ROUTINE bool _States_Is_locally_blocked ( |
---|
244 | States_Control the_states |
---|
245 | ) |
---|
246 | { |
---|
247 | return (the_states & STATES_LOCALLY_BLOCKED); |
---|
248 | } |
---|
249 | |
---|
250 | /** |
---|
251 | * This function returns true if one of the states which indicates |
---|
252 | * that a task is blocked waiting for a local resource is set in |
---|
253 | * the_states, and false otherwise. |
---|
254 | */ |
---|
255 | |
---|
256 | RTEMS_INLINE_ROUTINE bool _States_Is_waiting_on_thread_queue ( |
---|
257 | States_Control the_states |
---|
258 | ) |
---|
259 | { |
---|
260 | return (the_states & STATES_WAITING_ON_THREAD_QUEUE); |
---|
261 | } |
---|
262 | |
---|
263 | /** |
---|
264 | * This function returns true if one of the states which indicates |
---|
265 | * that a task is blocked is set in the_states, and false otherwise. |
---|
266 | */ |
---|
267 | |
---|
268 | RTEMS_INLINE_ROUTINE bool _States_Is_blocked ( |
---|
269 | States_Control the_states |
---|
270 | ) |
---|
271 | { |
---|
272 | return (the_states & STATES_BLOCKED); |
---|
273 | } |
---|
274 | |
---|
275 | /** |
---|
276 | * This function returns true if any of the states in the mask |
---|
277 | * are set in the_states, and false otherwise. |
---|
278 | */ |
---|
279 | |
---|
280 | RTEMS_INLINE_ROUTINE bool _States_Are_set ( |
---|
281 | States_Control the_states, |
---|
282 | States_Control mask |
---|
283 | ) |
---|
284 | { |
---|
285 | return ( (the_states & mask) != STATES_READY); |
---|
286 | } |
---|
287 | |
---|
288 | /**@}*/ |
---|
289 | |
---|
290 | #endif |
---|
291 | /* end of include file */ |
---|