source: rtems/c/src/exec/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
RevLine 
[ac7d5ef0]1/*  inline/attr.inl
2 *
3 *  This include file contains all of the inlined routines associated
4 *  with attributes.
5 *
[08311cc3]6 *  COPYRIGHT (c) 1989-1999.
[ac7d5ef0]7 *  On-Line Applications Research Corporation (OAR).
8 *
[98e4ebf5]9 *  The license and distribution terms for this file may be
10 *  found in the file LICENSE in this distribution or at
[03f2154e]11 *  http://www.OARcorp.com/rtems/license.html.
[ac7d5ef0]12 *
13 *  $Id$
14 */
15
16#ifndef __INLINE_ATTRIBUTES_inl
17#define __INLINE_ATTRIBUTES_inl
18
19/*PAGE
20 *
21 *  _Attributes_Set
[1a8fde6c]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.
[ac7d5ef0]27 */
28
[503dc058]29RTEMS_INLINE_ROUTINE rtems_attribute _Attributes_Set (
[ac7d5ef0]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
[1a8fde6c]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.
[ac7d5ef0]45 */
46
[503dc058]47RTEMS_INLINE_ROUTINE rtems_attribute _Attributes_Clear (
[ac7d5ef0]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 *
[1a8fde6c]59 *  DESCRIPTION:
60 *
61 *  This function returns TRUE if the floating point attribute is
62 *  enabled in the attribute_set and FALSE otherwise.
[ac7d5ef0]63 */
64
[503dc058]65RTEMS_INLINE_ROUTINE boolean _Attributes_Is_floating_point(
[ac7d5ef0]66  rtems_attribute attribute_set
67)
68{
69   return ( attribute_set & RTEMS_FLOATING_POINT );
70}
71
72/*PAGE
73 *
74 *  _Attributes_Is_global
75 *
[1a8fde6c]76 *  DESCRIPTION:
77 *
78 *  This function returns TRUE if the global object attribute is
79 *  enabled in the attribute_set and FALSE otherwise.
[ac7d5ef0]80 */
81
[97e2729d]82#if defined(RTEMS_MULTIPROCESSING)
[503dc058]83RTEMS_INLINE_ROUTINE boolean _Attributes_Is_global(
[ac7d5ef0]84  rtems_attribute attribute_set
85)
86{
87   return ( attribute_set & RTEMS_GLOBAL );
88}
[97e2729d]89#endif
[ac7d5ef0]90
91/*PAGE
92 *
93 *  _Attributes_Is_priority
94 *
[1a8fde6c]95 *  DESCRIPTION:
96 *
97 *  This function returns TRUE if the priority attribute is
98 *  enabled in the attribute_set and FALSE otherwise.
[ac7d5ef0]99 */
100
[503dc058]101RTEMS_INLINE_ROUTINE boolean _Attributes_Is_priority(
[ac7d5ef0]102  rtems_attribute attribute_set
103)
104{
105   return ( attribute_set & RTEMS_PRIORITY );
106}
107
108/*PAGE
109 *
110 *  _Attributes_Is_binary_semaphore
111 *
[1a8fde6c]112 *  DESCRIPTION:
113 *
114 *  This function returns TRUE if the binary semaphore attribute is
115 *  enabled in the attribute_set and FALSE otherwise.
[ac7d5ef0]116 */
117
[503dc058]118RTEMS_INLINE_ROUTINE boolean _Attributes_Is_binary_semaphore(
[ac7d5ef0]119  rtems_attribute attribute_set
120)
121{
[5870ac55]122  return ((attribute_set & RTEMS_SEMAPHORE_CLASS) == RTEMS_BINARY_SEMAPHORE);
[ac7d5ef0]123}
124
125/*PAGE
126 *
[5870ac55]127 *  _Attributes_Is_simple_binary_semaphore
[ac7d5ef0]128 *
[1a8fde6c]129 *  DESCRIPTION:
130 *
[5870ac55]131 *  This function returns TRUE if the simple binary semaphore attribute is
132 *  enabled in the attribute_set and FALSE otherwise.
[ac7d5ef0]133 */
134
[5870ac55]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(
[ac7d5ef0]154  rtems_attribute attribute_set
155)
156{
[5870ac55]157  return ((attribute_set & RTEMS_SEMAPHORE_CLASS) == RTEMS_COUNTING_SEMAPHORE);
[ac7d5ef0]158}
159
[3a4ae6c]160/*PAGE
161 *
[5870ac55]162 *  _Attributes_Is_inherit_priority
[3a4ae6c]163 *
[1a8fde6c]164 *  DESCRIPTION:
165 *
[5870ac55]166 *  This function returns TRUE if the priority inheritance attribute
[1a8fde6c]167 *  is enabled in the attribute_set and FALSE otherwise.
[3a4ae6c]168 */
[5870ac55]169
170RTEMS_INLINE_ROUTINE boolean _Attributes_Is_inherit_priority(
[3a4ae6c]171  rtems_attribute attribute_set
172)
173{
[5870ac55]174   return ( attribute_set & RTEMS_INHERIT_PRIORITY );
[3a4ae6c]175}
176
[7d91d72]177/*PAGE
178 *
[5870ac55]179 *  _Attributes_Is_priority_ceiling
[7d91d72]180 *
181 *  DESCRIPTION:
182 *
[5870ac55]183 *  This function returns TRUE if the priority ceiling attribute
[7d91d72]184 *  is enabled in the attribute_set and FALSE otherwise.
185 */
186 
[5870ac55]187RTEMS_INLINE_ROUTINE boolean _Attributes_Is_priority_ceiling(
[7d91d72]188  rtems_attribute attribute_set
189)
190{
[5870ac55]191   return ( attribute_set & RTEMS_PRIORITY_CEILING );
[7d91d72]192}
193
[7a035ebc]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
[ac7d5ef0]211#endif
212/* end of include file */
Note: See TracBrowser for help on using the repository browser.