source: rtems/c/src/exec/score/headers/states.h @ 63edbb3f

4.104.114.84.95
Last change on this file since 63edbb3f was ac7d5ef0, checked in by Joel Sherrill <joel.sherrill@…>, on 05/11/95 at 17:39:37

Initial revision

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