source: rtems/cpukit/rtems/include/rtems/rtems/object.h @ 484a769

4.104.114.95
Last change on this file since 484a769 was 484a769, checked in by Ralf Corsepius <ralf.corsepius@…>, on 09/04/08 at 17:46:39

Convert to "bool".

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