source: rtems/cpukit/rtems/include/rtems/rtems/object.h @ 91b8fb9e

4.104.114.95
Last change on this file since 91b8fb9e was 91b8fb9e, checked in by Joel Sherrill <joel.sherrill@…>, on 01/31/08 at 14:14:27

2008-01-31 Joel Sherrill <joel.sherrill@…>

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