RTEMS CPU Kit with SuperCore  4.11.2
statesimpl.h
Go to the documentation of this file.
1 
10 /*
11  * COPYRIGHT (c) 1989-2012.
12  * On-Line Applications Research Corporation (OAR).
13  *
14  * The license and distribution terms for this file may be
15  * found in the file LICENSE in this distribution or at
16  * http://www.rtems.org/license/LICENSE.
17  */
18 
19 #ifndef _RTEMS_SCORE_STATESIMPL_H
20 #define _RTEMS_SCORE_STATESIMPL_H
21 
22 #include <rtems/score/states.h>
23 #include <rtems/score/basedefs.h>
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
34 /*
35  * The following constants define the individual states which may be
36  * be used to compose and manipulate a thread's state.
37  */
38 
40 #define STATES_READY 0x00000
41 
42 #define STATES_DORMANT 0x00001
43 
44 #define STATES_SUSPENDED 0x00002
45 
46 #define STATES_DELAYING 0x00008
47 
48 #define STATES_WAITING_FOR_TIME 0x00010
49 
50 #define STATES_WAITING_FOR_BUFFER 0x00020
51 
52 #define STATES_WAITING_FOR_SEGMENT 0x00040
53 
54 #define STATES_WAITING_FOR_MESSAGE 0x00080
55 
56 #define STATES_WAITING_FOR_EVENT 0x00100
57 
58 #define STATES_WAITING_FOR_SEMAPHORE 0x00200
59 
60 #define STATES_WAITING_FOR_MUTEX 0x00400
61 
62 #define STATES_WAITING_FOR_CONDITION_VARIABLE 0x00800
63 
64 #define STATES_WAITING_FOR_JOIN_AT_EXIT 0x01000
65 
66 #define STATES_WAITING_FOR_RPC_REPLY 0x02000
67 
68 #define STATES_WAITING_FOR_PERIOD 0x04000
69 
70 #define STATES_WAITING_FOR_SIGNAL 0x08000
71 
72 #define STATES_WAITING_FOR_BARRIER 0x10000
73 
74 #define STATES_WAITING_FOR_RWLOCK 0x20000
75 
76 #define STATES_WAITING_FOR_SYSTEM_EVENT 0x40000
77 
78 #define STATES_WAITING_FOR_BSD_WAKEUP 0x80000
79 
80 #define STATES_WAITING_FOR_TERMINATION 0x100000
81 
82 #define STATES_ZOMBIE 0x200000
83 
84 #define STATES_MIGRATING 0x400000
85 
86 #define STATES_RESTARTING 0x800000
87 
88 #define STATES_WAITING_FOR_JOIN 0x1000000
89 
93 #define STATES_INTERRUPTIBLE_BY_SIGNAL 0x10000000
94 
96 #define STATES_LOCALLY_BLOCKED ( STATES_WAITING_FOR_BUFFER | \
97  STATES_WAITING_FOR_SEGMENT | \
98  STATES_WAITING_FOR_MESSAGE | \
99  STATES_WAITING_FOR_SEMAPHORE | \
100  STATES_WAITING_FOR_MUTEX | \
101  STATES_WAITING_FOR_CONDITION_VARIABLE | \
102  STATES_WAITING_FOR_JOIN | \
103  STATES_WAITING_FOR_SIGNAL | \
104  STATES_WAITING_FOR_BARRIER | \
105  STATES_WAITING_FOR_BSD_WAKEUP | \
106  STATES_WAITING_FOR_RWLOCK )
107 
109 #define STATES_BLOCKED ( STATES_DELAYING | \
110  STATES_LOCALLY_BLOCKED | \
111  STATES_WAITING_FOR_TIME | \
112  STATES_WAITING_FOR_PERIOD | \
113  STATES_WAITING_FOR_EVENT | \
114  STATES_WAITING_FOR_RPC_REPLY | \
115  STATES_WAITING_FOR_SYSTEM_EVENT | \
116  STATES_INTERRUPTIBLE_BY_SIGNAL )
117 
119 #define STATES_ALL_SET 0xffffffff
120 
131  States_Control states_to_set,
132  States_Control current_state
133 )
134 {
135  return (current_state | states_to_set);
136 }
137 
148  States_Control states_to_clear,
149  States_Control current_state
150 )
151 {
152  return (current_state & ~states_to_clear);
153 }
154 
164  States_Control the_states
165 )
166 {
167  return (the_states == STATES_READY);
168 }
169 
179  States_Control the_states
180 )
181 {
182  return (the_states == STATES_DORMANT);
183 }
184 
194  States_Control the_states
195 )
196 {
197  return (the_states & STATES_DORMANT);
198 }
199 
209  States_Control the_states
210 )
211 {
212  return (the_states & STATES_SUSPENDED);
213 }
214 
224  States_Control the_states
225 )
226 {
227  return (the_states & STATES_DELAYING);
228 }
229 
239  States_Control the_states
240 )
241 {
242  return (the_states & STATES_WAITING_FOR_BUFFER);
243 }
244 
254  States_Control the_states
255 )
256 {
257  return (the_states & STATES_WAITING_FOR_SEGMENT);
258 }
259 
269  States_Control the_states
270 )
271 {
272  return (the_states & STATES_WAITING_FOR_MESSAGE);
273 }
274 
284  States_Control the_states
285 )
286 {
287  return (the_states & STATES_WAITING_FOR_EVENT);
288 }
289 
299  States_Control the_states
300 )
301 {
302  return (the_states & STATES_WAITING_FOR_SYSTEM_EVENT);
303 }
304 
314  States_Control the_states
315 )
316 {
317  return (the_states & STATES_WAITING_FOR_MUTEX);
318 }
319 
329  States_Control the_states
330 )
331 {
332  return (the_states & STATES_WAITING_FOR_SEMAPHORE);
333 }
334 
344  States_Control the_states
345 )
346 {
347  return (the_states & STATES_WAITING_FOR_TIME);
348 }
349 
359  States_Control the_states
360 )
361 {
362  return (the_states & STATES_WAITING_FOR_RPC_REPLY);
363 }
364 
374  States_Control the_states
375 )
376 {
377  return (the_states & STATES_WAITING_FOR_PERIOD);
378 }
379 
389  States_Control the_states
390 )
391 {
392  return (the_states & STATES_INTERRUPTIBLE_BY_SIGNAL);
393 
394 }
406  States_Control the_states
407 )
408 {
409  return (the_states & STATES_LOCALLY_BLOCKED);
410 }
411 
422  States_Control the_states
423 )
424 {
425  return (the_states & STATES_BLOCKED);
426 }
427 
438  States_Control the_states,
439  States_Control mask
440 )
441 {
442  return ( (the_states & mask) != STATES_READY);
443 }
444 
447 #ifdef __cplusplus
448 }
449 #endif
450 
451 #endif
452 /* end of include file */
RTEMS_INLINE_ROUTINE bool _States_Is_waiting_for_event(States_Control the_states)
This function returns true if the WAITING_FOR_EVENT state is set in the_states, and false otherwise...
Definition: statesimpl.h:283
RTEMS_INLINE_ROUTINE bool _States_Is_locally_blocked(States_Control the_states)
This function returns true if one of the states which indicates that a task is blocked waiting for a ...
Definition: statesimpl.h:405
#define STATES_DELAYING
This macro corresponds to a task which is waiting for a timeout.
Definition: statesimpl.h:46
#define STATES_WAITING_FOR_BUFFER
This macro corresponds to a task waiting for a variable length buffer.
Definition: statesimpl.h:50
RTEMS_INLINE_ROUTINE bool _States_Is_dormant(States_Control the_states)
This function returns true if the DORMANT state is set in the_states, and false otherwise.
Definition: statesimpl.h:193
#define RTEMS_INLINE_ROUTINE
The following (in conjunction with compiler arguments) are used to choose between the use of static i...
Definition: basedefs.h:135
#define STATES_BLOCKED
This macro corresponds to a task waiting which is blocked.
Definition: statesimpl.h:109
#define STATES_READY
This macro corresponds to a task being ready.
Definition: statesimpl.h:40
Thread Execution State Information.
#define STATES_WAITING_FOR_TIME
This macro corresponds to a task waiting until a specific TOD.
Definition: statesimpl.h:48
#define STATES_WAITING_FOR_SEGMENT
This macro corresponds to a task waiting for a fixed size segment.
Definition: statesimpl.h:52
#define STATES_WAITING_FOR_EVENT
This macro corresponds to a task waiting for an event.
Definition: statesimpl.h:56
#define STATES_WAITING_FOR_PERIOD
This macro corresponds to a task waiting for a period.
Definition: statesimpl.h:68
RTEMS_INLINE_ROUTINE bool _States_Is_waiting_for_message(States_Control the_states)
This function returns true if the WAITING_FOR_MESSAGE state is set in the_states, and false otherwise...
Definition: statesimpl.h:268
#define STATES_LOCALLY_BLOCKED
This macro corresponds to a task waiting for a local object operation.
Definition: statesimpl.h:96
#define STATES_DORMANT
This macro corresponds to a task being created but not yet started.
Definition: statesimpl.h:42
RTEMS_INLINE_ROUTINE bool _States_Is_waiting_for_system_event(States_Control the_states)
This function returns true if the WAITING_FOR_SYSTEM_EVENT state is set in the_states, and false otherwise.
Definition: statesimpl.h:298
RTEMS_INLINE_ROUTINE bool _States_Is_blocked(States_Control the_states)
This function returns true if one of the states which indicates that a task is blocked is set in the_...
Definition: statesimpl.h:421
#define STATES_WAITING_FOR_MESSAGE
This macro corresponds to a task waiting for a message.
Definition: statesimpl.h:54
RTEMS_INLINE_ROUTINE bool _States_Is_waiting_for_mutex(States_Control the_states)
This function returns true if the WAITING_FOR_MUTEX state is set in the_states, and false otherwise...
Definition: statesimpl.h:313
RTEMS_INLINE_ROUTINE bool _States_Is_only_dormant(States_Control the_states)
This function returns true if the DORMANT state is the ONLY state set in the_states, and false otherwise.
Definition: statesimpl.h:178
RTEMS_INLINE_ROUTINE bool _States_Is_suspended(States_Control the_states)
This function returns true if the SUSPENDED state is set in the_states, and false otherwise...
Definition: statesimpl.h:208
RTEMS_INLINE_ROUTINE bool _States_Are_set(States_Control the_states, States_Control mask)
This function returns true if any of the states in the mask are set in the_states, and false otherwise.
Definition: statesimpl.h:437
RTEMS_INLINE_ROUTINE bool _States_Is_interruptible_by_signal(States_Control the_states)
This function returns true if the task&#39;s state is set in way that allows it to be interrupted by a si...
Definition: statesimpl.h:388
RTEMS_INLINE_ROUTINE bool _States_Is_waiting_for_period(States_Control the_states)
This function returns true if the WAITING_FOR_PERIOD state is set in the_states, and false otherwise...
Definition: statesimpl.h:373
RTEMS_INLINE_ROUTINE bool _States_Is_waiting_for_semaphore(States_Control the_states)
This function returns true if the WAITING_FOR_SEMAPHORE state is set in the_states, and false otherwise.
Definition: statesimpl.h:328
RTEMS_INLINE_ROUTINE States_Control _States_Clear(States_Control states_to_clear, States_Control current_state)
This function clears the given states_to_clear into the current_state passed in.
Definition: statesimpl.h:147
uint32_t States_Control
The following type defines the control block used to manage a thread&#39;s state.
Definition: states.h:41
#define STATES_SUSPENDED
This macro corresponds to a task being suspended.
Definition: statesimpl.h:44
RTEMS_INLINE_ROUTINE bool _States_Is_waiting_for_rpc_reply(States_Control the_states)
This function returns true if the WAITING_FOR_TIME state is set in the_states, and false otherwise...
Definition: statesimpl.h:358
#define STATES_WAITING_FOR_SEMAPHORE
This macro corresponds to a task waiting for a semaphore.
Definition: statesimpl.h:58
RTEMS_INLINE_ROUTINE bool _States_Is_ready(States_Control the_states)
This function returns true if the_states indicates that the state is READY, and false otherwise...
Definition: statesimpl.h:163
Basic Definitions.
#define STATES_WAITING_FOR_MUTEX
This macro corresponds to a task waiting for a mutex.
Definition: statesimpl.h:60
#define STATES_WAITING_FOR_RPC_REPLY
This macro corresponds to a task waiting for a reply to an MPCI request.
Definition: statesimpl.h:66
#define STATES_WAITING_FOR_SYSTEM_EVENT
This macro corresponds to a task waiting for a system event.
Definition: statesimpl.h:76
RTEMS_INLINE_ROUTINE bool _States_Is_waiting_for_segment(States_Control the_states)
This function returns true if the WAITING_FOR_SEGMENT state is set in the_states, and false otherwise...
Definition: statesimpl.h:253
RTEMS_INLINE_ROUTINE bool _States_Is_delaying(States_Control the_states)
This function returns true if the DELAYING state is set in the_states, and false otherwise.
Definition: statesimpl.h:223
#define STATES_INTERRUPTIBLE_BY_SIGNAL
This macro corresponds to a task which is in an interruptible blocking state.
Definition: statesimpl.h:93
RTEMS_INLINE_ROUTINE bool _States_Is_waiting_for_buffer(States_Control the_states)
This function returns true if the WAITING_FOR_BUFFER state is set in the_states, and false otherwise...
Definition: statesimpl.h:238
RTEMS_INLINE_ROUTINE States_Control _States_Set(States_Control states_to_set, States_Control current_state)
This function sets the given states_to_set into the current_state passed in.
Definition: statesimpl.h:130
RTEMS_INLINE_ROUTINE bool _States_Is_waiting_for_time(States_Control the_states)
This function returns true if the WAITING_FOR_TIME state is set in the_states, and false otherwise...
Definition: statesimpl.h:343