Services are provided to decompose an object Id into its subordinate components. The following services are used to do this:
rtems.object_id_get_api
rtems.object_id_get_class
rtems.object_id_get_node
rtems.object_id_get_index
The following C language example illustrates the decomposition of an Id and printing the values.
void printObjectId(rtems_id id) { printf( "API=%d Class=%d Node=%d Index=%d\n", rtems_object_id_get_api(id), rtems_object_id_get_class(id), rtems_object_id_get_node(id), rtems_object_id_get_index(id) ); }
This prints the components of the Ids as integers.
It is also possible to construct an arbitrary Id using
the rtems.build_id
service. The following
C language example illustrates how to construct the
"next Id."
rtems_id nextObjectId(rtems_id id) { return rtems_build_id( rtems_object_id_get_api(id), rtems_object_id_get_class(id), rtems_object_id_get_node(id), rtems_object_id_get_index(id) + 1 ); }
Note that this Id may not be valid in this system or associated with an allocated object.
Copyright © 1988-2008 OAR Corporation