source: rtems/cpukit/include/rtems/score/statesimpl.h @ 5ba93a5

5
Last change on this file since 5ba93a5 was 5ba93a5, checked in by Andreas Dachsberger <andreas.dachsberger@…>, on 04/16/19 at 06:07:09

doxygen: score: adjust doc in statesimpl.h to doxygen guidelines

Update #3706.

  • Property mode set to 100644
File size: 10.1 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup RTEMSScoreStates
5 *
6 * @brief Inlined Routines Associated with Thread State Information
7 *
8 * This file contains the static inline implementation of the inlined
9 * routines associated with thread state information.
10 */
11
12/*
13 *  COPYRIGHT (c) 1989-2012.
14 *  On-Line Applications Research Corporation (OAR).
15 *
16 *  The license and distribution terms for this file may be
17 *  found in the file LICENSE in this distribution or at
18 *  http://www.rtems.org/license/LICENSE.
19 */
20
21#ifndef _RTEMS_SCORE_STATESIMPL_H
22#define _RTEMS_SCORE_STATESIMPL_H
23
24#include <rtems/score/states.h>
25#include <rtems/score/basedefs.h>
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
31/**
32 * @addtogroup RTEMSScoreStates
33 *
34 * @{
35 */
36
37/*
38 *  The following constants define the individual states which may be
39 *  be used to compose and manipulate a thread's state.  More frequently used
40 *  states should use lower value bits to ease the use of immediate values on
41 *  RISC architectures.
42 */
43
44/** This macro corresponds to a task being ready. */
45#define STATES_READY                           0x00000000
46
47/** This macro corresponds to a task waiting for a mutex. */
48#define STATES_WAITING_FOR_MUTEX               0x00000001
49
50/** This macro corresponds to a task waiting for a semaphore. */
51#define STATES_WAITING_FOR_SEMAPHORE           0x00000002
52
53/** This macro corresponds to a task waiting for an event. */
54#define STATES_WAITING_FOR_EVENT               0x00000004
55
56/** This macro corresponds to a task waiting for a system event. */
57#define STATES_WAITING_FOR_SYSTEM_EVENT        0x00000008
58
59/** This macro corresponds to a task waiting for a message. */
60#define STATES_WAITING_FOR_MESSAGE             0x00000010
61
62/** This macro corresponds to a task waiting for a condition variable. */
63#define STATES_WAITING_FOR_CONDITION_VARIABLE  0x00000020
64
65/** This macro corresponds to a task waiting for a futex. */
66#define STATES_WAITING_FOR_FUTEX               0x00000040
67
68/** This macro corresponds to a task waiting for BSD wakeup. */
69#define STATES_WAITING_FOR_BSD_WAKEUP          0x00000080
70
71/**
72 * @brief This macro corresponds to a task which is waiting for a relative or
73 * absolute timeout.
74 */
75#define STATES_WAITING_FOR_TIME                0x00000100
76
77/** This macro corresponds to a task waiting for a period. */
78#define STATES_WAITING_FOR_PERIOD              0x00000200
79
80/** This macro corresponds to a task waiting for a signal. */
81#define STATES_WAITING_FOR_SIGNAL              0x00000400
82
83/** This macro corresponds to a task waiting for a barrier. */
84#define STATES_WAITING_FOR_BARRIER             0x00000800
85
86/** This macro corresponds to a task waiting for a RWLock. */
87#define STATES_WAITING_FOR_RWLOCK              0x00001000
88
89/** This macro corresponds to a task waiting for a join while exiting. */
90#define STATES_WAITING_FOR_JOIN_AT_EXIT        0x00002000
91
92/** This macro corresponds to a task waiting for a join. */
93#define STATES_WAITING_FOR_JOIN                0x00004000
94
95/** This macro corresponds to a task being suspended. */
96#define STATES_SUSPENDED                       0x00008000
97
98/** This macro corresponds to a task waiting for a fixed size segment. */
99#define STATES_WAITING_FOR_SEGMENT             0x00010000
100
101/** This macro corresponds to a task those life is changing. */
102#define STATES_LIFE_IS_CHANGING                0x00020000
103
104/** This macro corresponds to a task being held by the debugger. */
105#define STATES_DEBUGGER                        0x08000000
106
107/** This macro corresponds to a task which is in an interruptible
108 *  blocking state.
109 */
110#define STATES_INTERRUPTIBLE_BY_SIGNAL         0x10000000
111
112/** This macro corresponds to a task waiting for a reply to an MPCI request. */
113#define STATES_WAITING_FOR_RPC_REPLY           0x20000000
114
115/** This macro corresponds to a task being a zombie. */
116#define STATES_ZOMBIE                          0x40000000
117
118/** This macro corresponds to a task being created but not yet started. */
119#define STATES_DORMANT                         0x80000000
120
121/** This macro corresponds to a task waiting for a local object operation. */
122#define STATES_LOCALLY_BLOCKED ( STATES_WAITING_FOR_SEGMENT            | \
123                                 STATES_WAITING_FOR_MESSAGE            | \
124                                 STATES_WAITING_FOR_SEMAPHORE          | \
125                                 STATES_WAITING_FOR_MUTEX              | \
126                                 STATES_WAITING_FOR_CONDITION_VARIABLE | \
127                                 STATES_WAITING_FOR_JOIN               | \
128                                 STATES_WAITING_FOR_SIGNAL             | \
129                                 STATES_WAITING_FOR_BARRIER            | \
130                                 STATES_WAITING_FOR_BSD_WAKEUP         | \
131                                 STATES_WAITING_FOR_FUTEX              | \
132                                 STATES_WAITING_FOR_RWLOCK             )
133
134/** This macro corresponds to a task waiting which is blocked. */
135#define STATES_BLOCKED         ( STATES_LOCALLY_BLOCKED         | \
136                                 STATES_WAITING_FOR_TIME        | \
137                                 STATES_WAITING_FOR_PERIOD      | \
138                                 STATES_WAITING_FOR_EVENT       | \
139                                 STATES_WAITING_FOR_RPC_REPLY   | \
140                                 STATES_WAITING_FOR_SYSTEM_EVENT | \
141                                 STATES_INTERRUPTIBLE_BY_SIGNAL )
142
143/** All state bits set to one (provided for _Thread_Start()) */
144#define STATES_ALL_SET 0xffffffff
145
146/**
147 * @brief Returns the result of setting the states to set to the given state.
148 *
149 * This function sets the given @a states_to_set into the @a current_state
150 * passed in.  The result is returned to the user in @a current_state.
151 *
152 * @param states_to_set The state bits to set.
153 * @param current_state The state set to add them to.
154 *
155 * @return This method returns the updated states value.
156 */
157RTEMS_INLINE_ROUTINE States_Control _States_Set (
158  States_Control states_to_set,
159  States_Control current_state
160)
161{
162   return (current_state | states_to_set);
163}
164
165/**
166 * @brief Clears the states into the passed current state and returns the result.
167 *
168 * This function clears the given @a states_to_clear into the @a current_state
169 * passed in.  The result is returned to the user in @a current_state.
170 *
171 * @param states_to_clear The state bits to clear.
172 * @param current_state The state set to remove them from.
173 *
174 * @return This method returns the updated states value.
175 */
176RTEMS_INLINE_ROUTINE States_Control _States_Clear (
177  States_Control states_to_clear,
178  States_Control current_state
179)
180{
181   return (current_state & ~states_to_clear);
182}
183
184/**
185 * @brief Checks if the state is ready.
186 *
187 * This function returns true if the_states indicates that the
188 * state is READY, and false otherwise.
189 *
190 * @param the_states The task state set to test.
191 *
192 * @retval true The state is ready.
193 * @retval false The state is not ready.
194 */
195RTEMS_INLINE_ROUTINE bool _States_Is_ready (
196  States_Control the_states
197)
198{
199   return (the_states == STATES_READY);
200}
201
202/**
203 * @brief Checks if DORMANT state is set.
204 *
205 * This function returns true if the DORMANT state is set in
206 * @a the_states, and false otherwise.
207 *
208 * @param the_states The task state set to test.
209 *
210 * @retval true DORMANT state is set in @a the_states.
211 * @retval false DORMANT state is not set in @a the_states.
212 */
213RTEMS_INLINE_ROUTINE bool _States_Is_dormant (
214  States_Control the_states
215)
216{
217   return (the_states & STATES_DORMANT);
218}
219
220/**
221 * @brief Checks if SUSPENDED state is set.
222 *
223 * This function returns true if the SUSPENDED state is set in
224 * @a the_states, and false otherwise.
225 *
226 * @param the_states The task state set to test.
227 *
228 * @retval true SUSPENDED state is set in @a the_states.
229 * @retval false SUSPENDED state is not set in @a the_states.
230 */
231RTEMS_INLINE_ROUTINE bool _States_Is_suspended (
232  States_Control the_states
233)
234{
235   return (the_states & STATES_SUSPENDED);
236}
237
238/**
239 * @brief Checks if WAITING_FOR_TIME state is set.
240 *
241 * This function returns true if the WAITING_FOR_TIME state is set in
242 * @a the_states, and false otherwise.
243 *
244 * @param the_states The task state set to test.
245 *
246 * @retval true WAITING_FOR_TIME state is set in @a the_states.
247 * @retval false WAITING_FOR_TIME state is not set in @a the_states.
248 */
249RTEMS_INLINE_ROUTINE bool _States_Is_waiting_for_rpc_reply (
250  States_Control the_states
251)
252{
253   return (the_states & STATES_WAITING_FOR_RPC_REPLY);
254}
255
256/**
257 * @brief Checks if WAITING_FOR_JOIN_AT_EXIT state is set.
258 *
259 * This function returns true if the WAITING_FOR_JOIN_AT_EXIT state is set in
260 * @a the_states, and false otherwise.
261 *
262 * @param the_states The task state set to test.
263 *
264 * @retval true WAITING_FOR_JOIN_AT_EXIT state is set in @a the_states.
265 * @retval false WAITING_FOR_JOIN_AT_EXIT state is not set in @a the_states.
266 */
267RTEMS_INLINE_ROUTINE bool _States_Is_waiting_for_join_at_exit(
268  States_Control the_states
269)
270{
271   return ( the_states & STATES_WAITING_FOR_JOIN_AT_EXIT ) != 0;
272}
273
274/**
275 * @brief Checks if the state is set to be interruptible.
276 *
277 * This function returns true if the task's state is set in
278 * way that allows it to be interrupted by a signal.
279 *
280 * @param the_states The task state set to test.
281 *
282 * @retval true @a the_states is interruptible.
283 * @retval false @a the_states is not interruptible.
284 */
285RTEMS_INLINE_ROUTINE bool _States_Is_interruptible_by_signal (
286  States_Control the_states
287)
288{
289   return (the_states & STATES_INTERRUPTIBLE_BY_SIGNAL);
290
291}
292
293/**
294 * @brief Checks if the state is blocked waiting on a local resource.
295 *
296 * This function returns true if one of the states which indicates
297 * that a task is blocked waiting for a local resource is set in
298 * the_states, and false otherwise.
299 *
300 * @param the_states The task state set to test.
301 *
302 * @retval true The state indicates that the task is blocked waiting on a local
303 *      resource.
304 * @retval false The state indicates that the task is not blocked waiting on a
305 *      local resource.
306 */
307RTEMS_INLINE_ROUTINE bool _States_Is_locally_blocked (
308  States_Control the_states
309)
310{
311   return (the_states & STATES_LOCALLY_BLOCKED);
312}
313
314/** @} */
315
316#ifdef __cplusplus
317}
318#endif
319
320#endif
321/* end of include file */
Note: See TracBrowser for help on using the repository browser.