source: rtems/cpukit/rtems/inline/rtems/rtems/attr.inl @ 5870ac55

4.104.114.84.95
Last change on this file since 5870ac55 was 5870ac55, checked in by Joel Sherrill <joel.sherrill@…>, on 01/05/00 at 22:19:21

Added support for simple binary semaphores in addition to the high
power binary/mutex style semaphores already supported by RTEMS. This
was done at the request of Eric Norum <eric@…> in support
of his effort to port EPICS to RTEMS. This change consisted of
changing the nesting_allowed boolean into a lock_nesting_behavior
enumerated value as well as allowing the core mutex object to optionally
support ensuring that the holder of a binary semaphore released it.
Finally, a more subtle enhancement was to allow the non-holder to release
a priority inheritance/ceiling mutex and still allow the holding task
to return to its original priority.

  • Property mode set to 100644
File size: 4.3 KB
Line 
1/*  inline/attr.inl
2 *
3 *  This include file contains all of the inlined routines associated
4 *  with attributes.
5 *
6 *  COPYRIGHT (c) 1989-1999.
7 *  On-Line Applications Research Corporation (OAR).
8 *
9 *  The license and distribution terms for this file may be
10 *  found in the file LICENSE in this distribution or at
11 *  http://www.OARcorp.com/rtems/license.html.
12 *
13 *  $Id$
14 */
15
16#ifndef __INLINE_ATTRIBUTES_inl
17#define __INLINE_ATTRIBUTES_inl
18
19/*PAGE
20 *
21 *  _Attributes_Set
22 *
23 *  DESCRIPTION:
24 *
25 *  This function sets the requested new_attributes in the attribute_set
26 *  passed in.  The result is returned to the user.
27 */
28
29RTEMS_INLINE_ROUTINE rtems_attribute _Attributes_Set (
30   rtems_attribute new_attributes,
31   rtems_attribute attribute_set
32)
33{
34  return attribute_set | new_attributes;
35}
36
37/*PAGE
38 *
39 *  _Attributes_Clear
40 *
41 *  DESCRIPTION:
42 *
43 *  This function clears the requested new_attributes in the attribute_set
44 *  passed in.  The result is returned to the user.
45 */
46
47RTEMS_INLINE_ROUTINE rtems_attribute _Attributes_Clear (
48   rtems_attribute attribute_set,
49   rtems_attribute mask
50)
51{
52  return attribute_set & ~mask;
53}
54
55/*PAGE
56 *
57 *  _Attributes_Is_floating_point
58 *
59 *  DESCRIPTION:
60 *
61 *  This function returns TRUE if the floating point attribute is
62 *  enabled in the attribute_set and FALSE otherwise.
63 */
64
65RTEMS_INLINE_ROUTINE boolean _Attributes_Is_floating_point(
66  rtems_attribute attribute_set
67)
68{
69   return ( attribute_set & RTEMS_FLOATING_POINT );
70}
71
72/*PAGE
73 *
74 *  _Attributes_Is_global
75 *
76 *  DESCRIPTION:
77 *
78 *  This function returns TRUE if the global object attribute is
79 *  enabled in the attribute_set and FALSE otherwise.
80 */
81
82#if defined(RTEMS_MULTIPROCESSING)
83RTEMS_INLINE_ROUTINE boolean _Attributes_Is_global(
84  rtems_attribute attribute_set
85)
86{
87   return ( attribute_set & RTEMS_GLOBAL );
88}
89#endif
90
91/*PAGE
92 *
93 *  _Attributes_Is_priority
94 *
95 *  DESCRIPTION:
96 *
97 *  This function returns TRUE if the priority attribute is
98 *  enabled in the attribute_set and FALSE otherwise.
99 */
100
101RTEMS_INLINE_ROUTINE boolean _Attributes_Is_priority(
102  rtems_attribute attribute_set
103)
104{
105   return ( attribute_set & RTEMS_PRIORITY );
106}
107
108/*PAGE
109 *
110 *  _Attributes_Is_binary_semaphore
111 *
112 *  DESCRIPTION:
113 *
114 *  This function returns TRUE if the binary semaphore attribute is
115 *  enabled in the attribute_set and FALSE otherwise.
116 */
117
118RTEMS_INLINE_ROUTINE boolean _Attributes_Is_binary_semaphore(
119  rtems_attribute attribute_set
120)
121{
122  return ((attribute_set & RTEMS_SEMAPHORE_CLASS) == RTEMS_BINARY_SEMAPHORE);
123}
124
125/*PAGE
126 *
127 *  _Attributes_Is_simple_binary_semaphore
128 *
129 *  DESCRIPTION:
130 *
131 *  This function returns TRUE if the simple binary semaphore attribute is
132 *  enabled in the attribute_set and FALSE otherwise.
133 */
134
135RTEMS_INLINE_ROUTINE boolean _Attributes_Is_simple_binary_semaphore(
136  rtems_attribute attribute_set
137)
138{
139  return
140    ((attribute_set & RTEMS_SEMAPHORE_CLASS) == RTEMS_SIMPLE_BINARY_SEMAPHORE);
141
142
143/*PAGE
144 *
145 *  _Attributes_Is_counting_semaphore
146 *
147 *  DESCRIPTION:
148 *
149 *  This function returns TRUE if the counting semaphore attribute is
150 *  enabled in the attribute_set and FALSE otherwise.
151 */
152
153RTEMS_INLINE_ROUTINE boolean _Attributes_Is_counting_semaphore(
154  rtems_attribute attribute_set
155)
156{
157  return ((attribute_set & RTEMS_SEMAPHORE_CLASS) == RTEMS_COUNTING_SEMAPHORE);
158}
159
160/*PAGE
161 *
162 *  _Attributes_Is_inherit_priority
163 *
164 *  DESCRIPTION:
165 *
166 *  This function returns TRUE if the priority inheritance attribute
167 *  is enabled in the attribute_set and FALSE otherwise.
168 */
169
170RTEMS_INLINE_ROUTINE boolean _Attributes_Is_inherit_priority(
171  rtems_attribute attribute_set
172)
173{
174   return ( attribute_set & RTEMS_INHERIT_PRIORITY );
175}
176
177/*PAGE
178 *
179 *  _Attributes_Is_priority_ceiling
180 *
181 *  DESCRIPTION:
182 *
183 *  This function returns TRUE if the priority ceiling attribute
184 *  is enabled in the attribute_set and FALSE otherwise.
185 */
186 
187RTEMS_INLINE_ROUTINE boolean _Attributes_Is_priority_ceiling(
188  rtems_attribute attribute_set
189)
190{
191   return ( attribute_set & RTEMS_PRIORITY_CEILING );
192}
193
194/*PAGE
195 *
196 *  _Attributes_Is_system_task
197 *
198 *  DESCRIPTION:
199 *
200 *  This function returns TRUE if the system task attribute
201 *  is enabled in the attribute_set and FALSE otherwise.
202 */
203 
204RTEMS_INLINE_ROUTINE boolean _Attributes_Is_system_task(
205  rtems_attribute attribute_set
206)
207{
208   return ( attribute_set & RTEMS_PRIORITY_CEILING );
209}
210
211#endif
212/* end of include file */
Note: See TracBrowser for help on using the repository browser.