source: rtems/cpukit/include/rtems/rtems/object.h @ a6689fb1

Last change on this file since a6689fb1 was a6689fb1, checked in by Sebastian Huber <sebastian.huber@…>, on 01/22/21 at 15:01:46

Improve file header comment in generated files

  • Property mode set to 100644
File size: 18.6 KB
Line 
1/* SPDX-License-Identifier: BSD-2-Clause */
2
3/**
4 * @file
5 *
6 * @brief This header file provides the Object Services API.
7 */
8
9/*
10 * Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
11 * Copyright (C) 1988, 2009 On-Line Applications Research Corporation (OAR)
12 *
13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions
15 * are met:
16 * 1. Redistributions of source code must retain the above copyright
17 *    notice, this list of conditions and the following disclaimer.
18 * 2. Redistributions in binary form must reproduce the above copyright
19 *    notice, this list of conditions and the following disclaimer in the
20 *    documentation and/or other materials provided with the distribution.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
26 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 * POSSIBILITY OF SUCH DAMAGE.
33 */
34
35/*
36 * This file is part of the RTEMS quality process and was automatically
37 * generated.  If you find something that needs to be fixed or
38 * worded better please post a report or patch to an RTEMS mailing list
39 * or raise a bug report:
40 *
41 * https://www.rtems.org/bugs.html
42 *
43 * For information on updating and regenerating please refer to the How-To
44 * section in the Software Requirements Engineering chapter of the
45 * RTEMS Software Engineering manual.  The manual is provided as a part of
46 * a release.  For development sources please refer to the online
47 * documentation at:
48 *
49 * https://docs.rtems.org
50 */
51
52/* Generated from spec:/rtems/object/if/header */
53
54#ifndef _RTEMS_RTEMS_OBJECT_H
55#define _RTEMS_RTEMS_OBJECT_H
56
57#include <stdbool.h>
58#include <stddef.h>
59#include <stdint.h>
60#include <rtems/rtems/status.h>
61#include <rtems/rtems/types.h>
62#include <rtems/score/object.h>
63
64#ifdef __cplusplus
65extern "C" {
66#endif
67
68/* Generated from spec:/rtems/object/if/group */
69
70/**
71 * @defgroup RTEMSAPIClassicObject Object Services
72 *
73 * @ingroup RTEMSAPIClassic
74 *
75 * @brief RTEMS provides a collection of services to assist in the management
76 *   and usage of the objects created and utilized via other managers.  These
77 *   services assist in the manipulation of RTEMS objects independent of the
78 *   API used to create them.
79 */
80
81/* Generated from spec:/rtems/object/if/api-class-information */
82
83/**
84 * @ingroup RTEMSAPIClassicObject
85 *
86 * @brief This structure is used to return information to the application about
87 *   the objects configured for a specific API/Class combination.
88 */
89typedef struct {
90  /**
91   * @brief This member contains the minimum valid object identifier for this
92   *   class.
93   */
94  rtems_id minimum_id;
95
96  /**
97   * @brief This member contains the maximum valid object identifier for this
98   *   class.
99   */
100  rtems_id maximum_id;
101
102  /**
103   * @brief This member contains the maximum number of active objects configured
104   *   for this class.
105   */
106  uint32_t maximum;
107
108  /**
109   * @brief This member is true, if this class is configured for automatic object
110   *   extension, otherwise it is false.
111   */
112  bool auto_extend;
113
114  /**
115   * @brief This member contains the number of currently inactive objects of this
116   *   class.
117   */
118  uint32_t unallocated;
119} rtems_object_api_class_information;
120
121/* Generated from spec:/rtems/object/if/id-final */
122
123/**
124 * @ingroup RTEMSAPIClassicObject
125 *
126 * @brief This constant represents the highest object identifier value.
127 */
128#define RTEMS_OBJECT_ID_FINAL OBJECTS_ID_FINAL
129
130/* Generated from spec:/rtems/object/if/id-final-index */
131
132/**
133 * @ingroup RTEMSAPIClassicObject
134 *
135 * @brief This constant represents the highest value for the index component of
136 *   an object identifier.
137 */
138#define RTEMS_OBJECT_ID_FINAL_INDEX OBJECTS_ID_FINAL_INDEX
139
140/* Generated from spec:/rtems/object/if/id-initial */
141
142/**
143 * @ingroup RTEMSAPIClassicObject
144 *
145 * @brief Builds the object identifier with the lowest index from the API,
146 *   class, and MPCI node components.
147 *
148 * This directive is strictly local and does not impact task scheduling.
149 *
150 * @param _api is the API of the object identifier to build.
151 *
152 * @param _class is the class of the object identifier to build.
153 *
154 * @param _node is the MPCI node of the object identifier to build.
155 *
156 * @return Returns the object identifier with the lowest index built from the
157 *   API, class, and MPCI node components.
158 */
159#define RTEMS_OBJECT_ID_INITIAL( _api, _class, _node ) \
160  OBJECTS_ID_INITIAL( _api, _class, _node )
161
162/* Generated from spec:/rtems/object/if/id-initial-index */
163
164/**
165 * @ingroup RTEMSAPIClassicObject
166 *
167 * @brief This constant represents the lowest value for the index component of
168 *   an object identifier.
169 */
170#define RTEMS_OBJECT_ID_INITIAL_INDEX OBJECTS_ID_INITIAL_INDEX
171
172/* Generated from spec:/rtems/object/if/search-all-nodes */
173
174/**
175 * @ingroup RTEMSAPIClassicObject
176 *
177 * @brief This constant indicates that an object name to identifier search
178 *   should search through all MPCI nodes of the system.
179 */
180#define RTEMS_SEARCH_ALL_NODES OBJECTS_SEARCH_ALL_NODES
181
182/* Generated from spec:/rtems/object/if/search-local-node */
183
184/**
185 * @ingroup RTEMSAPIClassicObject
186 *
187 * @brief This constant indicates that an object name to identifier search
188 *   should search only the local MPCI node of the system.
189 */
190#define RTEMS_SEARCH_LOCAL_NODE OBJECTS_SEARCH_LOCAL_NODE
191
192/* Generated from spec:/rtems/object/if/search-other-nodes */
193
194/**
195 * @ingroup RTEMSAPIClassicObject
196 *
197 * @brief This constant indicates that an object name to identifier search
198 *   should search through all MPCI nodes of the system except the local node.
199 */
200#define RTEMS_SEARCH_OTHER_NODES OBJECTS_SEARCH_OTHER_NODES
201
202/* Generated from spec:/rtems/object/if/who-am-i */
203
204/**
205 * @ingroup RTEMSAPIClassicObject
206 *
207 * @brief This constant indicates that an object name to identifier search is
208 *   being asked for the identifier of the currently executing task.
209 */
210#define RTEMS_WHO_AM_I OBJECTS_WHO_AM_I
211
212/* Generated from spec:/rtems/object/if/build-id */
213
214/**
215 * @ingroup RTEMSAPIClassicObject
216 *
217 * @brief Builds the object identifier from the API, class, MPCI node, and
218 *   index components.
219 *
220 * This directive is strictly local and does not impact task scheduling.
221 *
222 * @param _api is the API of the object identifier to build.
223 *
224 * @param _class is the class of the object identifier to build.
225 *
226 * @param _node is the MPCI node of the object identifier to build.
227 *
228 * @param _index is the index of the object identifier to build.
229 *
230 * @return Returns the object identifier built from the API, class, MPCI node,
231 *   and index components.
232 */
233#define rtems_build_id( _api, _class, _node, _index ) \
234  _Objects_Build_id( _api, _class, _node, _index )
235
236/* Generated from spec:/rtems/object/if/build-name */
237
238/**
239 * @ingroup RTEMSAPIClassicObject
240 *
241 * @brief Builds the object name composed of the four characters.
242 *
243 * This directive takes the four characters provided as arguments and composes
244 * a 32-bit object name with ``_c1`` in the most significant 8-bits and ``_c4``
245 * in the least significant 8-bits.
246 *
247 * This directive is strictly local and does not impact task scheduling.
248 *
249 * @param _c1 is the first character of the name.
250 *
251 * @param _c2 is the second character of the name.
252 *
253 * @param _c3 is the third character of the name.
254 *
255 * @param _c4 is the fourth character of the name.
256 *
257 * @return Returns the object name composed of the four characters.
258 */
259#define rtems_build_name( _c1, _c2, _c3, _c4 ) \
260  _Objects_Build_name( _c1, _c2, _c3, _c4 )
261
262/* Generated from spec:/rtems/object/if/get-classic-name */
263
264/**
265 * @ingroup RTEMSAPIClassicObject
266 *
267 * @brief Gets the object name associated with the object identifier.
268 *
269 * This directive is strictly local and does not impact task scheduling.
270 *
271 * @param id is the object identifier to get the name.
272 *
273 * @param[out] name is the pointer to an object name variable.  The object name
274 *   associated with the object identifier will be stored in this variable, in
275 *   case of a successful operation.
276 *
277 * @retval ::RTEMS_SUCCESSFUL The requested operation was successful.
278 *
279 * @retval ::RTEMS_INVALID_ADDRESS The ``name`` parameter was NULL.
280 *
281 * @retval ::RTEMS_INVALID_ID There was no object information available for the
282 *   object identifier.
283 *
284 * @retval ::RTEMS_INVALID_ID The object name associated with the object
285 *   identifier was a string.
286 *
287 * @retval ::RTEMS_INVALID_ID There was no object associated with the object
288 *   identifier.
289 */
290rtems_status_code rtems_object_get_classic_name(
291  rtems_id    id,
292  rtems_name *name
293);
294
295/* Generated from spec:/rtems/object/if/get-name */
296
297/**
298 * @ingroup RTEMSAPIClassicObject
299 *
300 * @brief Gets the object name associated with the object identifier as a
301 *   string.
302 *
303 * The object name is stored in the name buffer.  If the name buffer length is
304 * greater than zero, then the stored object name will be ``NUL`` terminated.
305 * The stored object name may be truncated to fit the length.  There is no
306 * indication if a truncation occurred.  Every attempt is made to return name
307 * as a printable string even if the object has the Classic API 32-bit integer
308 * style name.
309 *
310 * This directive may cause the calling task to be preempted due to an obtain
311 * and release of the object allocator mutex.
312 *
313 * @param id is the object identifier to get the name.
314 *
315 * @param length is the buffer length in bytes.
316 *
317 * @param[out] name is the pointer to a buffer of the specified length.
318 *
319 * @retval NULL The ``length`` parameter was 0.
320 *
321 * @retval NULL The ``name`` parameter was NULL.
322 *
323 * @retval NULL There was no object information available for the object
324 *   identifier.
325 *
326 * @retval NULL There was no object associated with the object identifier.
327 *
328 * @return Returns the ``name`` parameter value, if there is an object name
329 *   associated with the object identifier.
330 */
331char *rtems_object_get_name( rtems_id id, size_t length, char *name );
332
333/* Generated from spec:/rtems/object/if/set-name */
334
335/**
336 * @ingroup RTEMSAPIClassicObject
337 *
338 * @brief Sets the object name of the object associated with the object
339 *   identifier.
340 *
341 * This directive will set the object name based upon the user string.
342 *
343 * This directive may cause the calling task to be preempted due to an obtain
344 * and release of the object allocator mutex.
345 *
346 * This directive can be used to set the name of objects which do not have a
347 * naming scheme per their API.
348 *
349 * If the object specified by ``id`` is of a class that has a string name, this
350 * directive will free the existing name to the RTEMS Workspace and allocate
351 * enough memory from the RTEMS Workspace to make a copy of the string located
352 * at ``name``.
353 *
354 * If the object specified by ``id`` is of a class that has a 32-bit integer
355 * style name, then the first four characters in ``name`` will be used to
356 * construct the name.
357 *
358 * @param id is the object identifier of the object to set the name.
359 *
360 * @param name is the object name to set.
361 *
362 * @retval ::RTEMS_SUCCESSFUL The requested operation was successful.
363 *
364 * @retval ::RTEMS_INVALID_ADDRESS The ``name`` parameter was NULL.
365 *
366 * @retval ::RTEMS_INVALID_ID There was no object information available for the
367 *   object identifier.
368 *
369 * @retval ::RTEMS_INVALID_ID There was no object associated with the object
370 *   identifier.
371 *
372 * @retval ::RTEMS_NO_MEMORY There was no memory available to duplicate the
373 *   name.
374 */
375rtems_status_code rtems_object_set_name( rtems_id id, const char *name );
376
377/* Generated from spec:/rtems/object/if/id-get-api */
378
379/**
380 * @ingroup RTEMSAPIClassicObject
381 *
382 * @brief Gets the API component of the object identifier.
383 *
384 * This directive is strictly local and does not impact task scheduling.
385 *
386 * This directive does not validate the object identifier provided in ``_id``.
387 *
388 * A body is also provided.
389 *
390 * @param _id is the object identifier with the API component to get.
391 *
392 * @return Returns the API component of the object identifier.
393 */
394#define rtems_object_id_get_api( _id ) _Objects_Get_API( _id )
395
396/* Generated from spec:/rtems/object/if/id-get-class */
397
398/**
399 * @ingroup RTEMSAPIClassicObject
400 *
401 * @brief Gets the class component of the object identifier.
402 *
403 * This directive is strictly local and does not impact task scheduling.
404 *
405 * This directive does not validate the object identifier provided in ``_id``.
406 *
407 * A body is also provided.
408 *
409 * @param _id is the object identifier with the class component to get.
410 *
411 * @return Returns the class component of the object identifier.
412 */
413#define rtems_object_id_get_class( _id ) _Objects_Get_class( _id )
414
415/* Generated from spec:/rtems/object/if/id-get-node */
416
417/**
418 * @ingroup RTEMSAPIClassicObject
419 *
420 * @brief Gets the MPCI node component of the object identifier.
421 *
422 * This directive is strictly local and does not impact task scheduling.
423 *
424 * This directive does not validate the object identifier provided in ``_id``.
425 *
426 * A body is also provided.
427 *
428 * @param _id is the object identifier with the MPCI node component to get.
429 *
430 * @return Returns the MPCI node component of the object identifier.
431 */
432#define rtems_object_id_get_node( _id ) _Objects_Get_node( _id )
433
434/* Generated from spec:/rtems/object/if/id-get-index */
435
436/**
437 * @ingroup RTEMSAPIClassicObject
438 *
439 * @brief Gets the index component of the object identifier.
440 *
441 * This directive is strictly local and does not impact task scheduling.
442 *
443 * This directive does not validate the object identifier provided in ``_id``.
444 *
445 * A body is also provided.
446 *
447 * @param _id is the object identifier with the index component to get.
448 *
449 * @return Returns the index component of the object identifier.
450 */
451#define rtems_object_id_get_index( _id ) _Objects_Get_index( _id )
452
453/* Generated from spec:/rtems/object/if/id-api-minimum */
454
455/**
456 * @ingroup RTEMSAPIClassicObject
457 *
458 * @brief Gets the lowest valid value for the API component of an object
459 *   identifier.
460 *
461 * This directive is strictly local and does not impact task scheduling.
462 *
463 * A body is also provided.
464 *
465 * @return Returns the lowest valid value for the API component of an object
466 *   identifier.
467 */
468#define rtems_object_id_api_minimum() OBJECTS_INTERNAL_API
469
470/* Generated from spec:/rtems/object/if/id-api-maximum */
471
472/**
473 * @ingroup RTEMSAPIClassicObject
474 *
475 * @brief Gets the highest valid value for the API component of an object
476 *   identifier.
477 *
478 * This directive is strictly local and does not impact task scheduling.
479 *
480 * A body is also provided.
481 *
482 * @return Returns the highest valid value for the API component of an object
483 *   identifier.
484 */
485#define rtems_object_id_api_maximum() OBJECTS_APIS_LAST
486
487/* Generated from spec:/rtems/object/if/api-minimum-class */
488
489/**
490 * @ingroup RTEMSAPIClassicObject
491 *
492 * @brief Gets the lowest valid class value of the object API.
493 *
494 * This directive is strictly local and does not impact task scheduling.
495 *
496 * @param api is the object API to get the lowest valid class value.
497 *
498 * @retval -1 The object API was invalid.
499 *
500 * @return Returns the lowest valid class value of the object API.
501 */
502int rtems_object_api_minimum_class( int api );
503
504/* Generated from spec:/rtems/object/if/api-maximum-class */
505
506/**
507 * @ingroup RTEMSAPIClassicObject
508 *
509 * @brief Gets the highest valid class value of the object API.
510 *
511 * This directive is strictly local and does not impact task scheduling.
512 *
513 * @param api is the object API to get the highest valid class value.
514 *
515 * @retval 0 The object API was invalid.
516 *
517 * @return Returns the highest valid class value of the object API.
518 */
519int rtems_object_api_maximum_class( int api );
520
521/* Generated from spec:/rtems/object/if/get-api-name */
522
523/**
524 * @ingroup RTEMSAPIClassicObject
525 *
526 * @brief Gets a descriptive name of the object API.
527 *
528 * This directive is strictly local and does not impact task scheduling.
529 *
530 * The string returned is from constant space.  Do not modify or free it.
531 *
532 * @param api is the object API to get the name.
533 *
534 * @retval "BAD API" The API was invalid.
535 *
536 * @return Returns a descriptive name of the API, if the API was valid.
537 */
538const char *rtems_object_get_api_name( int api );
539
540/* Generated from spec:/rtems/object/if/get-api-class-name */
541
542/**
543 * @ingroup RTEMSAPIClassicObject
544 *
545 * @brief Gets a descriptive name of the object class of the object API.
546 *
547 * This directive is strictly local and does not impact task scheduling.
548 *
549 * The string returned is from constant space.  Do not modify or free it.
550 *
551 * @param the_api is the object API of the object class.
552 *
553 * @param the_class is the object class of the object API to get the name.
554 *
555 * @retval "BAD API" The API was invalid.
556 *
557 * @retval "BAD CLASS" The class of the API was invalid.
558 *
559 * @return Returns a descriptive name of the class of the API, if the class of
560 *   the API and the API were valid.
561 */
562const char *rtems_object_get_api_class_name( int the_api, int the_class );
563
564/* Generated from spec:/rtems/object/if/get-class-information */
565
566/**
567 * @ingroup RTEMSAPIClassicObject
568 *
569 * @brief Gets the object class information of the object class of the object
570 *   API.
571 *
572 * This directive is strictly local and does not impact task scheduling.
573 *
574 * @param the_api is the object API of the object class.
575 *
576 * @param the_class is the object class of the object API to get the class
577 *   information.
578 *
579 * @param info is the pointer to an object class information variable.  The
580 *   object class information of the class of the API will be stored in this
581 *   variable, in case of a successful operation.
582 *
583 * @retval ::RTEMS_SUCCESSFUL The requested operation was successful.
584 *
585 * @retval ::RTEMS_INVALID_ADDRESS The ``info`` parameter was NULL.
586 *
587 * @retval ::RTEMS_INVALID_NUMBER The class of the API or the API was invalid.
588 */
589rtems_status_code rtems_object_get_class_information(
590  int                                 the_api,
591  int                                 the_class,
592  rtems_object_api_class_information *info
593);
594
595/* Generated from spec:/rtems/object/if/get-local-node */
596
597/**
598 * @ingroup RTEMSAPIClassicObject
599 *
600 * @brief Gets the local MPCI node number.
601 *
602 * This directive is strictly local and does not impact task scheduling.
603 *
604 * @return Returns the local MPCI node number.
605 */
606static inline uint16_t rtems_object_get_local_node( void )
607{
608  return _Objects_Local_node;
609}
610
611#ifdef __cplusplus
612}
613#endif
614
615#endif /* _RTEMS_RTEMS_OBJECT_H */
Note: See TracBrowser for help on using the repository browser.