source: rtems/cpukit/score/inline/rtems/score/states.inl @ 6390256

4.104.115
Last change on this file since 6390256 was 6390256, checked in by Ralf Corsepius <ralf.corsepius@…>, on 12/22/08 at 09:22:17

Eliminate TRUE/FALSE.

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