1 | /** |
---|
2 | * @file rtems/rtems/object.h |
---|
3 | * |
---|
4 | * This include file defines Classic API interfaces to Object Services. |
---|
5 | */ |
---|
6 | |
---|
7 | /* COPYRIGHT (c) 1989-2011. |
---|
8 | * On-Line Applications Research Corporation (OAR). |
---|
9 | * |
---|
10 | * The license and distribution terms for this file may be |
---|
11 | * found in the file LICENSE in this distribution or at |
---|
12 | * http://www.rtems.com/license/LICENSE. |
---|
13 | * |
---|
14 | * $Id$ |
---|
15 | */ |
---|
16 | |
---|
17 | #ifndef _RTEMS_RTEMS_OBJECT_H |
---|
18 | #define _RTEMS_RTEMS_OBJECT_H |
---|
19 | |
---|
20 | #include <stdint.h> |
---|
21 | #include <rtems/score/object.h> |
---|
22 | #include <rtems/rtems/status.h> |
---|
23 | #include <rtems/rtems/types.h> |
---|
24 | |
---|
25 | #ifdef __cplusplus |
---|
26 | extern "C" { |
---|
27 | #endif |
---|
28 | |
---|
29 | /** |
---|
30 | * @defgroup ClassicClassInfo Object Class Information |
---|
31 | * |
---|
32 | * @ingroup ClassicRTEMS |
---|
33 | * |
---|
34 | * This encapsulates functionality which XXX |
---|
35 | */ |
---|
36 | /**@{*/ |
---|
37 | |
---|
38 | /** |
---|
39 | * This structure is used to return information to the application |
---|
40 | * about the objects configured for a specific API/Class combination. |
---|
41 | */ |
---|
42 | typedef struct { |
---|
43 | /** This field is the minimum valid object Id for this class. */ |
---|
44 | rtems_id minimum_id; |
---|
45 | /** This field is the maximum valid object Id for this class. */ |
---|
46 | rtems_id maximum_id; |
---|
47 | /** This field is the number of object instances configured for this class. */ |
---|
48 | uint32_t maximum; |
---|
49 | /** This field indicates if the class is configured for auto-extend. */ |
---|
50 | bool auto_extend; |
---|
51 | /** This field is the number of currently unallocated objects. */ |
---|
52 | uint32_t unallocated; |
---|
53 | } rtems_object_api_class_information; |
---|
54 | |
---|
55 | /** |
---|
56 | * @brief Build Object Id |
---|
57 | * |
---|
58 | * This function returns an object id composed of the |
---|
59 | * specified @a api, @a class, @a node, |
---|
60 | * and @a index. |
---|
61 | * |
---|
62 | * @param[in] _api indicates the api to use for the Id |
---|
63 | * @param[in] _class indicates the class to use for the Id |
---|
64 | * @param[in] _node indicates the node to use for the Id |
---|
65 | * @param[in] _index indicates the index to use for the Id |
---|
66 | * |
---|
67 | * @return This method returns an object Id built from the |
---|
68 | * specified values. |
---|
69 | * |
---|
70 | * @note A body is also provided. |
---|
71 | */ |
---|
72 | #define rtems_build_id( _api, _class, _node, _index ) \ |
---|
73 | _Objects_Build_id( _api, _class, _node, _index ) |
---|
74 | |
---|
75 | /** |
---|
76 | * @brief Build Thirty-Two Bit Object Name |
---|
77 | * |
---|
78 | * This function returns an object name composed of the four characters |
---|
79 | * C1, C2, C3, and C4. |
---|
80 | * |
---|
81 | * @param[in] _C1 is the first character of the name |
---|
82 | * @param[in] _C2 is the second character of the name |
---|
83 | * @param[in] _C3 is the third character of the name |
---|
84 | * @param[in] _C4 is the fourth character of the name |
---|
85 | * |
---|
86 | * @note This must be implemented as a macro for use in |
---|
87 | * Configuration Tables. A body is also provided. |
---|
88 | * |
---|
89 | */ |
---|
90 | #define rtems_build_name( _C1, _C2, _C3, _C4 ) \ |
---|
91 | _Objects_Build_name( _C1, _C2, _C3, _C4 ) |
---|
92 | |
---|
93 | /** |
---|
94 | * @brief Obtain name of object |
---|
95 | * |
---|
96 | * This directive returns the name associated with the specified |
---|
97 | * object ID. |
---|
98 | * |
---|
99 | * @param[in] id is the Id of the object to obtain the name of. |
---|
100 | * @param[out] name will be set to the name of the object |
---|
101 | * |
---|
102 | * @note The object must be have a name of the 32-bit form. |
---|
103 | * |
---|
104 | * @return @a *name will contain user defined object name |
---|
105 | * @return @a RTEMS_SUCCESSFUL - if successful |
---|
106 | * @return error code - if unsuccessful |
---|
107 | */ |
---|
108 | rtems_status_code rtems_object_get_classic_name( |
---|
109 | rtems_id id, |
---|
110 | rtems_name *name |
---|
111 | ); |
---|
112 | |
---|
113 | /** |
---|
114 | * @brief Obtain Object Name as String |
---|
115 | * |
---|
116 | * This directive returns the name associated with the specified |
---|
117 | * object ID. |
---|
118 | * |
---|
119 | * @param[in] id is the Id of the object to obtain the name of |
---|
120 | * @param[in] length is the length of the output name buffer |
---|
121 | * @param[out] name will be set to the name of the object |
---|
122 | * |
---|
123 | * @return @a *name will contain user defined object name |
---|
124 | * @return @a name - if successful |
---|
125 | * @return @a NULL - if unsuccessful |
---|
126 | */ |
---|
127 | char *rtems_object_get_name( |
---|
128 | rtems_id id, |
---|
129 | size_t length, |
---|
130 | char *name |
---|
131 | ); |
---|
132 | |
---|
133 | /** |
---|
134 | * @brief Set Name of Object |
---|
135 | * |
---|
136 | * This method allows the caller to set the name of an |
---|
137 | * object. This can be used to set the name of objects |
---|
138 | * which do not have a naming scheme per their API. |
---|
139 | * |
---|
140 | * @param[in] id is the Id of the object to obtain the name of |
---|
141 | * @param[out] name will be set to the name of the object |
---|
142 | * |
---|
143 | * @return @a *name will contain user defined object name |
---|
144 | * @return @a RTEMS_SUCCESSFUL - if successful |
---|
145 | * @return error code - if unsuccessful |
---|
146 | */ |
---|
147 | rtems_status_code rtems_object_set_name( |
---|
148 | rtems_id id, |
---|
149 | const char *name |
---|
150 | ); |
---|
151 | |
---|
152 | /** |
---|
153 | * @brief Get API Portion of Object Id |
---|
154 | * |
---|
155 | * This function returns the API portion of the Id. |
---|
156 | * |
---|
157 | * @param[in] _id is the Id of the object to obtain the API from |
---|
158 | * |
---|
159 | * @return This method returns the API portion of the provided |
---|
160 | * @a _id. |
---|
161 | * |
---|
162 | * @note This method does NOT validate the @a _id provided. |
---|
163 | * |
---|
164 | * @note A body is also provided. |
---|
165 | */ |
---|
166 | #define rtems_object_id_get_api( _id ) \ |
---|
167 | _Objects_Get_API( _id ) |
---|
168 | |
---|
169 | /** |
---|
170 | * @brief Get Class Portion of Object Id |
---|
171 | * |
---|
172 | * This function returns the class portion of the ID. |
---|
173 | * |
---|
174 | * @param[in] _id is the Id of the object to obtain the class from |
---|
175 | * |
---|
176 | * @return This method returns the class portion of the provided |
---|
177 | * @a _id. |
---|
178 | * |
---|
179 | * @note This method does NOT validate the @a _id provided. |
---|
180 | * |
---|
181 | * @note A body is also provided. |
---|
182 | */ |
---|
183 | #define rtems_object_id_get_class( _id ) \ |
---|
184 | _Objects_Get_class( _id ) |
---|
185 | |
---|
186 | /** |
---|
187 | * @brief Get Node Portion of Object Id |
---|
188 | * |
---|
189 | * This function returns the node portion of the ID. |
---|
190 | * |
---|
191 | * @param[in] _id is the Id of the object to obtain the node from |
---|
192 | * |
---|
193 | * @return This method returns the node portion of the provided |
---|
194 | * @a _id. |
---|
195 | * |
---|
196 | * @note This method does NOT validate the @a _id provided. |
---|
197 | * |
---|
198 | * @note A body is also provided. |
---|
199 | */ |
---|
200 | #define rtems_object_id_get_node( _id ) \ |
---|
201 | _Objects_Get_node( _id ) |
---|
202 | |
---|
203 | /** |
---|
204 | * @brief Get Index Portion of Object Id |
---|
205 | * |
---|
206 | * This function returns the index portion of the ID. |
---|
207 | * |
---|
208 | * @param[in] _id is the Id of the object to obtain the index from |
---|
209 | * |
---|
210 | * @return This method returns the index portion of the provided |
---|
211 | * @a _id. |
---|
212 | * |
---|
213 | * @note This method does NOT validate the @a _id provided. |
---|
214 | * |
---|
215 | * @note A body is also provided. |
---|
216 | */ |
---|
217 | #define rtems_object_id_get_index( _id ) \ |
---|
218 | _Objects_Get_index( _id ) |
---|
219 | |
---|
220 | /** |
---|
221 | * @brief Get Lowest Valid API Index |
---|
222 | * |
---|
223 | * This method returns the lowest valid value for the API |
---|
224 | * portion of an RTEMS object Id. |
---|
225 | * |
---|
226 | * @return This method returns the least valid value for |
---|
227 | * the API portion of an RTEMS object Id. |
---|
228 | * |
---|
229 | * @note A body is also provided. |
---|
230 | */ |
---|
231 | #define rtems_object_id_api_minimum() \ |
---|
232 | OBJECTS_INTERNAL_API |
---|
233 | |
---|
234 | /** |
---|
235 | * @brief Get Highest Valid API Index |
---|
236 | * |
---|
237 | * This method returns the highest valid value for the API |
---|
238 | * portion of an RTEMS object Id. |
---|
239 | * |
---|
240 | * @return This method returns the greatest valid value for |
---|
241 | * the API portion of an RTEMS object Id. |
---|
242 | * |
---|
243 | * @note A body is also provided. |
---|
244 | */ |
---|
245 | #define rtems_object_id_api_maximum() \ |
---|
246 | OBJECTS_APIS_LAST |
---|
247 | |
---|
248 | /** |
---|
249 | * @brief Get Lowest Valid Class Value |
---|
250 | * |
---|
251 | * This method returns the lowest valid value Class for the |
---|
252 | * specified @a api. Each API supports a different number |
---|
253 | * of object classes. |
---|
254 | * |
---|
255 | * @param[in] api is the API to obtain the minimum class of |
---|
256 | * |
---|
257 | * @return This method returns the least valid value for |
---|
258 | * class number for the specified @a api. |
---|
259 | */ |
---|
260 | int rtems_object_api_minimum_class( |
---|
261 | int api |
---|
262 | ); |
---|
263 | |
---|
264 | /** |
---|
265 | * @brief Get Highest Valid Class Value |
---|
266 | * |
---|
267 | * This method returns the highest valid value Class for the |
---|
268 | * specified @a api. Each API supports a different number |
---|
269 | * of object classes. |
---|
270 | * |
---|
271 | * @param[in] api is the API to obtain the maximum class of |
---|
272 | * |
---|
273 | * @return This method returns the greatet valid value for |
---|
274 | * class number for the specified @a api. |
---|
275 | */ |
---|
276 | int rtems_object_api_maximum_class( |
---|
277 | int api |
---|
278 | ); |
---|
279 | |
---|
280 | |
---|
281 | /** |
---|
282 | * @brief Get Highest Valid Class Value |
---|
283 | * |
---|
284 | * This method returns the lowest valid value Class for the |
---|
285 | * specified @a api. Each API supports a different number |
---|
286 | * of object classes. |
---|
287 | * |
---|
288 | * @param[in] api is the API to obtain the maximum class of |
---|
289 | * |
---|
290 | * @return This method returns the least valid value for |
---|
291 | * class number for the specified @a api. |
---|
292 | */ |
---|
293 | int rtems_object_id_api_maximum_class( |
---|
294 | int api |
---|
295 | ); |
---|
296 | |
---|
297 | /** |
---|
298 | * @brief Get API Name |
---|
299 | * |
---|
300 | * This method returns a string containing the name of the |
---|
301 | * specified @a api. |
---|
302 | * |
---|
303 | * @param[in] api is the API to obtain the name of |
---|
304 | * |
---|
305 | * @return If successful, this method returns the name of |
---|
306 | * the specified @a api. Otherwise, it returns |
---|
307 | * the string "BAD API" |
---|
308 | */ |
---|
309 | const char *rtems_object_get_api_name( |
---|
310 | int api |
---|
311 | ); |
---|
312 | |
---|
313 | /** |
---|
314 | * @brief Get Class Name |
---|
315 | * |
---|
316 | * This method returns a string containing the name of the |
---|
317 | * @a class from the specified @a api. |
---|
318 | * |
---|
319 | * @param[in] the_api is the API for the class |
---|
320 | * @param[in] the_class is the class to obtain the name of |
---|
321 | * |
---|
322 | * @return If successful, this method returns the name of |
---|
323 | * the specified @a class. Otherwise, it returns |
---|
324 | * the string "BAD CLASS" |
---|
325 | */ |
---|
326 | const char *rtems_object_get_api_class_name( |
---|
327 | int the_api, |
---|
328 | int the_class |
---|
329 | ); |
---|
330 | |
---|
331 | /** |
---|
332 | * @brief Get Class Name |
---|
333 | * |
---|
334 | * This method returns a string containing the name of the |
---|
335 | * @a the_class from the specified @a api. |
---|
336 | * |
---|
337 | * @param[in] the_api is the API for the class |
---|
338 | * @param[in] the_class is the class to obtain information about |
---|
339 | * @param[in] info points to the information structure to fill in |
---|
340 | * |
---|
341 | * @return If successful, this method returns the name of |
---|
342 | * RTEMS_SUCCESSFUL with @a *info filled in. Otherwise, |
---|
343 | * a status is returned to indicate the error. |
---|
344 | * |
---|
345 | */ |
---|
346 | rtems_status_code rtems_object_get_class_information( |
---|
347 | int the_api, |
---|
348 | int the_class, |
---|
349 | rtems_object_api_class_information *info |
---|
350 | ); |
---|
351 | |
---|
352 | #ifdef __cplusplus |
---|
353 | } |
---|
354 | #endif |
---|
355 | |
---|
356 | /**@}*/ |
---|
357 | |
---|
358 | #endif |
---|
359 | /* end of include file */ |
---|