Beispiel #1
0
static rtems_id
rtems_monitor_object_canonical_next_remote(
    rtems_monitor_object_type_t type,
    rtems_id            id,
    void               *canonical
)
{
    rtems_id                        next_id;
    rtems_status_code               status;
    rtems_monitor_server_request_t  request;
    rtems_monitor_server_response_t response;

    /*
     * Send request
     */

    request.command = RTEMS_MONITOR_SERVER_CANONICAL;
    request.argument0 = (uint32_t) type;
    request.argument1 = (uint32_t) id;

    status = rtems_monitor_server_request(
      rtems_object_id_get_node(id), &request, &response);
    if (status != RTEMS_SUCCESSFUL)
        goto failed;

    /*
     * process response
     */

    next_id = (rtems_id) response.result0;
    if (next_id != RTEMS_OBJECT_ID_FINAL)
        (void) memcpy(canonical, &response.payload, response.result1);

    return next_id;

failed:
    return RTEMS_OBJECT_ID_FINAL;

}
Beispiel #2
0
void
rtems_monitor_init(
    uint32_t   monitor_flags
)
{
    rtems_status_code status;

    rtems_monitor_kill();

    status = rtems_task_create(RTEMS_MONITOR_NAME,
                               1,
                               RTEMS_MINIMUM_STACK_SIZE * 2,
                               RTEMS_INTERRUPT_LEVEL(0),
                               RTEMS_DEFAULT_ATTRIBUTES,
                               &rtems_monitor_task_id);
    if (status != RTEMS_SUCCESSFUL)
    {
        rtems_error(status, "could not create monitor task");
        return;
    }

    rtems_monitor_node = rtems_object_id_get_node(rtems_monitor_task_id);
    rtems_monitor_default_node = rtems_monitor_node;

    rtems_monitor_server_init(monitor_flags);

    if (!(monitor_flags & RTEMS_MONITOR_NOTASK)) {
      /*
       * Start the monitor task itself
       */
      status = rtems_task_start(
        rtems_monitor_task_id, rtems_monitor_task, monitor_flags);
      if (status != RTEMS_SUCCESSFUL) {
        rtems_error(status, "could not start monitor");
        return;
      }
   }
}
Beispiel #3
0
rtems_id
rtems_monitor_id_fixup(
    rtems_id            id,
    uint32_t            default_node,
    rtems_monitor_object_type_t type
)
{
    uint32_t    node;

    node = rtems_object_id_get_node(id);
    if (node == 0)
    {
        if (rtems_object_id_get_class(id) != OBJECTS_CLASSIC_NO_CLASS)
            type = rtems_object_id_get_class(id);

        id = rtems_build_id(
          OBJECTS_CLASSIC_API,
          type,
          default_node,
          rtems_object_id_get_index(id)
        );
    }
    return id;
}
Beispiel #4
0
void
rtems_monitor_object_cmd(
    int                                argc,
    char                             **argv,
    const rtems_monitor_command_arg_t *command_arg,
    bool                               verbose
)
{
    int arg;
    const rtems_monitor_object_info_t *info = 0;
    rtems_monitor_object_type_t  type;

    /* what is the default type? */
    type = command_arg->monitor_object;

    if (argc == 1)
    {
        if (type == RTEMS_MONITOR_OBJECT_INVALID)
        {
            fprintf(stdout,"A type must be specified to \"dump all\"\n");
            goto done;
        }

        info = rtems_monitor_object_lookup(type);
        if (info == 0)
            goto not_found;

        if (info->dump_header)
            info->dump_header(verbose);
        rtems_monitor_object_dump_all(info, verbose);
    }
    else
    {
        uint32_t            default_node = rtems_monitor_default_node;
        rtems_monitor_object_type_t last_type = RTEMS_MONITOR_OBJECT_INVALID;
        rtems_id            id;

        for (arg=1; argv[arg]; arg++)
        {
            id = (rtems_id) strtoul(argv[arg], 0, 16);
            id = rtems_monitor_id_fixup(id, default_node, type);
            type = (rtems_monitor_object_type_t) rtems_object_id_get_class(id);

            /*
             * Allow the item type to change in the middle
             * of the command.  If the type changes, then
             * just dump out a new header and keep on going.
             */
            if (type != last_type)
            {
                info = rtems_monitor_object_lookup(type);
                if (info == 0)
                    goto not_found;

                if (info->dump_header)
                    info->dump_header(verbose);
            }

            if (info == 0)
            {
not_found:      fprintf(stdout,"Invalid or unsupported type %d\n", type);
                goto done;
            }

            rtems_monitor_object_dump_1(info, id, verbose);

            default_node = rtems_object_id_get_node(id);

            last_type = type;
        }
    }
done:
    return;
}