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