1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @ingroup ClassicAttributesImpl |
---|
5 | * |
---|
6 | * @brief Classic Attributes Implementation |
---|
7 | */ |
---|
8 | |
---|
9 | /* |
---|
10 | * COPYRIGHT (c) 1989-2008. |
---|
11 | * On-Line Applications Research Corporation (OAR). |
---|
12 | * |
---|
13 | * The license and distribution terms for this file may be |
---|
14 | * found in the file LICENSE in this distribution or at |
---|
15 | * http://www.rtems.org/license/LICENSE. |
---|
16 | */ |
---|
17 | |
---|
18 | #ifndef _RTEMS_RTEMS_ATTR_INL |
---|
19 | #define _RTEMS_RTEMS_ATTR_INL |
---|
20 | |
---|
21 | #include <rtems/rtems/attr.h> |
---|
22 | #include <rtems/score/cpu.h> |
---|
23 | |
---|
24 | #ifdef __cplusplus |
---|
25 | extern "C" { |
---|
26 | #endif |
---|
27 | |
---|
28 | /** |
---|
29 | * @defgroup ClassicAttributesImpl Classic Attributes Implementation |
---|
30 | * |
---|
31 | * @ingroup ClassicAttributes |
---|
32 | * |
---|
33 | * @{ |
---|
34 | */ |
---|
35 | |
---|
36 | /****************** Forced Attributes in Configuration ****************/ |
---|
37 | |
---|
38 | /** |
---|
39 | * This attribute constant indicates the attributes that are not |
---|
40 | * supportable given the hardware configuration. |
---|
41 | */ |
---|
42 | #define ATTRIBUTES_NOT_SUPPORTED 0 |
---|
43 | |
---|
44 | /** |
---|
45 | * This attribute constant indicates the attributes that are |
---|
46 | * required given the hardware configuration. |
---|
47 | */ |
---|
48 | #if ( CPU_ALL_TASKS_ARE_FP == TRUE ) |
---|
49 | #define ATTRIBUTES_REQUIRED RTEMS_FLOATING_POINT |
---|
50 | #else |
---|
51 | #define ATTRIBUTES_REQUIRED 0 |
---|
52 | #endif |
---|
53 | |
---|
54 | /** |
---|
55 | * @brief Sets the requested new_attributes in the attribute_set passed in. |
---|
56 | * |
---|
57 | * This function sets the requested new_attributes in the attribute_set |
---|
58 | * passed in. The result is returned to the user. |
---|
59 | */ |
---|
60 | RTEMS_INLINE_ROUTINE rtems_attribute _Attributes_Set ( |
---|
61 | rtems_attribute new_attributes, |
---|
62 | rtems_attribute attribute_set |
---|
63 | ) |
---|
64 | { |
---|
65 | return attribute_set | new_attributes; |
---|
66 | } |
---|
67 | |
---|
68 | /** |
---|
69 | * @brief Clears the requested new_attributes in the attribute_set |
---|
70 | * passed in. |
---|
71 | * |
---|
72 | * This function clears the requested new_attributes in the attribute_set |
---|
73 | * passed in. The result is returned to the user. |
---|
74 | */ |
---|
75 | RTEMS_INLINE_ROUTINE rtems_attribute _Attributes_Clear ( |
---|
76 | rtems_attribute attribute_set, |
---|
77 | rtems_attribute mask |
---|
78 | ) |
---|
79 | { |
---|
80 | return attribute_set & ~mask; |
---|
81 | } |
---|
82 | |
---|
83 | /** |
---|
84 | * @brief Checks if the floating point attribute is |
---|
85 | * enabled in the attribute_set. |
---|
86 | * |
---|
87 | * This function returns TRUE if the floating point attribute is |
---|
88 | * enabled in the attribute_set and FALSE otherwise. |
---|
89 | */ |
---|
90 | RTEMS_INLINE_ROUTINE bool _Attributes_Is_floating_point( |
---|
91 | rtems_attribute attribute_set |
---|
92 | ) |
---|
93 | { |
---|
94 | return ( attribute_set & RTEMS_FLOATING_POINT ) ? true : false; |
---|
95 | } |
---|
96 | |
---|
97 | #if defined(RTEMS_MULTIPROCESSING) |
---|
98 | /** |
---|
99 | * @brief Checks if the global object attribute is enabled in |
---|
100 | * the attribute_set. |
---|
101 | * |
---|
102 | * This function returns TRUE if the global object attribute is |
---|
103 | * enabled in the attribute_set and FALSE otherwise. |
---|
104 | */ |
---|
105 | RTEMS_INLINE_ROUTINE bool _Attributes_Is_global( |
---|
106 | rtems_attribute attribute_set |
---|
107 | ) |
---|
108 | { |
---|
109 | return ( attribute_set & RTEMS_GLOBAL ) ? true : false; |
---|
110 | } |
---|
111 | #endif |
---|
112 | |
---|
113 | /** |
---|
114 | * @brief Checks if the priority attribute is enabled in the attribute_set. |
---|
115 | * |
---|
116 | * This function returns TRUE if the priority attribute is |
---|
117 | * enabled in the attribute_set and FALSE otherwise. |
---|
118 | */ |
---|
119 | RTEMS_INLINE_ROUTINE bool _Attributes_Is_priority( |
---|
120 | rtems_attribute attribute_set |
---|
121 | ) |
---|
122 | { |
---|
123 | return ( attribute_set & RTEMS_PRIORITY ) ? true : false; |
---|
124 | } |
---|
125 | |
---|
126 | /** |
---|
127 | * @brief Checks if the binary semaphore attribute is |
---|
128 | * enabled in the attribute_set. |
---|
129 | * |
---|
130 | * This function returns TRUE if the binary semaphore attribute is |
---|
131 | * enabled in the attribute_set and FALSE otherwise. |
---|
132 | */ |
---|
133 | RTEMS_INLINE_ROUTINE bool _Attributes_Is_binary_semaphore( |
---|
134 | rtems_attribute attribute_set |
---|
135 | ) |
---|
136 | { |
---|
137 | return ((attribute_set & RTEMS_SEMAPHORE_CLASS) == RTEMS_BINARY_SEMAPHORE); |
---|
138 | } |
---|
139 | |
---|
140 | /** |
---|
141 | * @brief Checks if the simple binary semaphore attribute is |
---|
142 | * enabled in the attribute_set |
---|
143 | * |
---|
144 | * This function returns TRUE if the simple binary semaphore attribute is |
---|
145 | * enabled in the attribute_set and FALSE otherwise. |
---|
146 | */ |
---|
147 | RTEMS_INLINE_ROUTINE bool _Attributes_Is_simple_binary_semaphore( |
---|
148 | rtems_attribute attribute_set |
---|
149 | ) |
---|
150 | { |
---|
151 | return |
---|
152 | ((attribute_set & RTEMS_SEMAPHORE_CLASS) == RTEMS_SIMPLE_BINARY_SEMAPHORE); |
---|
153 | } |
---|
154 | |
---|
155 | /** |
---|
156 | * @brief Checks if the counting semaphore attribute is |
---|
157 | * enabled in the attribute_set |
---|
158 | * |
---|
159 | * This function returns TRUE if the counting semaphore attribute is |
---|
160 | * enabled in the attribute_set and FALSE otherwise. |
---|
161 | */ |
---|
162 | RTEMS_INLINE_ROUTINE bool _Attributes_Is_counting_semaphore( |
---|
163 | rtems_attribute attribute_set |
---|
164 | ) |
---|
165 | { |
---|
166 | return ((attribute_set & RTEMS_SEMAPHORE_CLASS) == RTEMS_COUNTING_SEMAPHORE); |
---|
167 | } |
---|
168 | |
---|
169 | /** |
---|
170 | * @brief Checks if the priority inheritance attribute |
---|
171 | * is enabled in the attribute_set |
---|
172 | * |
---|
173 | * This function returns TRUE if the priority inheritance attribute |
---|
174 | * is enabled in the attribute_set and FALSE otherwise. |
---|
175 | */ |
---|
176 | RTEMS_INLINE_ROUTINE bool _Attributes_Is_inherit_priority( |
---|
177 | rtems_attribute attribute_set |
---|
178 | ) |
---|
179 | { |
---|
180 | return ( attribute_set & RTEMS_INHERIT_PRIORITY ) ? true : false; |
---|
181 | } |
---|
182 | |
---|
183 | /** |
---|
184 | * @brief Returns true if the attribute set has at most one protocol, and false |
---|
185 | * otherwise. |
---|
186 | * |
---|
187 | * The protocols are RTEMS_INHERIT_PRIORITY, RTEMS_PRIORITY_CEILING and |
---|
188 | * RTEMS_MULTIPROCESSOR_RESOURCE_SHARING. |
---|
189 | */ |
---|
190 | RTEMS_INLINE_ROUTINE bool _Attributes_Has_at_most_one_protocol( |
---|
191 | rtems_attribute attribute_set |
---|
192 | ) |
---|
193 | { |
---|
194 | attribute_set &= RTEMS_INHERIT_PRIORITY | RTEMS_PRIORITY_CEILING |
---|
195 | | RTEMS_MULTIPROCESSOR_RESOURCE_SHARING; |
---|
196 | |
---|
197 | return ( attribute_set & ( attribute_set - 1 ) ) == 0; |
---|
198 | } |
---|
199 | |
---|
200 | /** |
---|
201 | * @brief Checks if the priority ceiling attribute |
---|
202 | * is enabled in the attribute_set |
---|
203 | * |
---|
204 | * This function returns TRUE if the priority ceiling attribute |
---|
205 | * is enabled in the attribute_set and FALSE otherwise. |
---|
206 | */ |
---|
207 | RTEMS_INLINE_ROUTINE bool _Attributes_Is_priority_ceiling( |
---|
208 | rtems_attribute attribute_set |
---|
209 | ) |
---|
210 | { |
---|
211 | return ( attribute_set & RTEMS_PRIORITY_CEILING ) ? true : false; |
---|
212 | } |
---|
213 | |
---|
214 | /** |
---|
215 | * @brief Checks if the Multiprocessor Resource Sharing Protocol attribute |
---|
216 | * is enabled in the attribute_set |
---|
217 | * |
---|
218 | * This function returns TRUE if the Multiprocessor Resource Sharing Protocol |
---|
219 | * attribute is enabled in the attribute_set and FALSE otherwise. |
---|
220 | */ |
---|
221 | RTEMS_INLINE_ROUTINE bool _Attributes_Is_multiprocessor_resource_sharing( |
---|
222 | rtems_attribute attribute_set |
---|
223 | ) |
---|
224 | { |
---|
225 | return ( attribute_set & RTEMS_MULTIPROCESSOR_RESOURCE_SHARING ) != 0; |
---|
226 | } |
---|
227 | |
---|
228 | /** |
---|
229 | * @brief Checks if the barrier automatic release |
---|
230 | * attribute is enabled in the attribute_set |
---|
231 | * |
---|
232 | * This function returns TRUE if the barrier automatic release |
---|
233 | * attribute is enabled in the attribute_set and FALSE otherwise. |
---|
234 | */ |
---|
235 | RTEMS_INLINE_ROUTINE bool _Attributes_Is_barrier_automatic( |
---|
236 | rtems_attribute attribute_set |
---|
237 | ) |
---|
238 | { |
---|
239 | return ( attribute_set & RTEMS_BARRIER_AUTOMATIC_RELEASE ) ? true : false; |
---|
240 | } |
---|
241 | |
---|
242 | /** |
---|
243 | * @brief Checks if the system task attribute |
---|
244 | * is enabled in the attribute_set. |
---|
245 | * |
---|
246 | * This function returns TRUE if the system task attribute |
---|
247 | * is enabled in the attribute_set and FALSE otherwise. |
---|
248 | */ |
---|
249 | RTEMS_INLINE_ROUTINE bool _Attributes_Is_system_task( |
---|
250 | rtems_attribute attribute_set |
---|
251 | ) |
---|
252 | { |
---|
253 | return ( attribute_set & RTEMS_SYSTEM_TASK ) ? true : false; |
---|
254 | } |
---|
255 | |
---|
256 | /**@}*/ |
---|
257 | |
---|
258 | #ifdef __cplusplus |
---|
259 | } |
---|
260 | #endif |
---|
261 | |
---|
262 | #endif |
---|
263 | /* end of include file */ |
---|