RTEMS Logo

RTEMS 4.9.2 On-Line Library


Object Services Printing an Object Id

PREV UP NEXT Bookshelf RTEMS C User's Guide

27.3.2: Printing an Object Id

RTEMS also provides services to associate the API and Class portions of an Object Id with strings. This allows the application developer to provide more information about an object in diagnostic messages.

In the following C language example, an Id is decomposed into its constituent parts and "pretty-printed."

void prettyPrintObjectId(rtems_id id)
{
  uint32_t tmpAPI, tmpClass;

  tmpAPI   = rtems_object_id_get_api(id),
  tmpClass = rtems_object_id_get_class(id),

  printf(
    "API=%s Class=%s Node=%d Index=%d\n",
    rtems_object_get_api_name(tmpAPI),
    rtems_object_get_api_class_name(tmpAPI, tmpClass),
    rtems_object_id_get_node(id),
    rtems_object_id_get_index(id)
  );
}


PREV UP NEXT Bookshelf RTEMS C User's Guide

Copyright © 1988-2008 OAR Corporation