source: rtems/cpukit/libmisc/monitor/mon-task.c @ ed8be1ae

4.115
Last change on this file since ed8be1ae was ed8be1ae, checked in by Sebastian Huber <sebastian.huber@…>, on 11/06/12 at 12:46:03

monitor: Add const qualifier

  • Property mode set to 100644
File size: 3.3 KB
Line 
1/*
2 * RTEMS Monitor task support
3 */
4
5#ifdef HAVE_CONFIG_H
6#include "config.h"
7#endif
8
9#include <rtems.h>
10#include <rtems/monitor.h>
11
12#include <stdio.h>
13#include <string.h>    /* memcpy() */
14
15void
16rtems_monitor_task_canonical(
17    rtems_monitor_task_t  *canonical_task,
18    const void            *thread_void
19)
20{
21    const Thread_Control *rtems_thread = (const Thread_Control *) thread_void;
22    RTEMS_API_Control    *api;
23
24    api = rtems_thread->API_Extensions[ THREAD_API_RTEMS ];
25
26    canonical_task->entry = rtems_thread->Start.entry_point;
27    canonical_task->argument = rtems_thread->Start.numeric_argument;
28    canonical_task->stack = rtems_thread->Start.Initial_stack.area;
29    canonical_task->stack_size = rtems_thread->Start.Initial_stack.size;
30    canonical_task->priority = rtems_thread->current_priority;
31    canonical_task->state = rtems_thread->current_state;
32    canonical_task->wait_id = rtems_thread->Wait.id;
33    canonical_task->events = api->Event.pending_events;
34    /*
35     * FIXME: make this optionally cpu_time_executed
36     */
37#if 0
38    canonical_task->ticks = rtems_thread->cpu_time_executed;
39#else
40    canonical_task->ticks = 0;
41#endif
42
43/* XXX modes and attributes only exist in the RTEMS API .. */
44/* XXX not directly in the core thread.. they will have to be derived */
45/* XXX if they are important enough to include anymore.   */
46    canonical_task->modes = 0; /* XXX FIX ME.... rtems_thread->current_modes; */
47    canonical_task->attributes = 0 /* XXX FIX ME rtems_thread->API_Extensions[ THREAD_API_RTEMS ]->attribute_set */;
48    (void) memcpy(canonical_task->notepad, api ->Notepads, sizeof(canonical_task->notepad));
49/* XXX more to fix */
50/*
51    (void) memcpy(&canonical_task->wait_args, &rtems_thread->Wait.Extra, sizeof(canonical_task->wait_args));
52*/
53}
54
55
56void
57rtems_monitor_task_dump_header(
58    bool verbose __attribute__((unused))
59)
60{
61    fprintf(stdout,"\
62  ID       NAME           PRI  STATE MODES   EVENTS    WAITID  WAITARG  NOTES\n\
63");
64/*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
650         1         2         3         4         5         6         7       */
66
67    rtems_monitor_separator();
68}
69
70/*
71 */
72
73void
74rtems_monitor_task_dump(
75    rtems_monitor_task_t *monitor_task,
76    bool                  verbose __attribute__((unused))
77)
78{
79    int length = 0;
80
81    length += rtems_monitor_dump_id(monitor_task->id);
82    length += rtems_monitor_pad(11, length);
83    length += rtems_monitor_dump_name(monitor_task->id);
84    length += rtems_monitor_pad(26, length);
85    length += rtems_monitor_dump_priority(monitor_task->priority);
86    length += rtems_monitor_pad(29, length);
87    length += rtems_monitor_dump_state(monitor_task->state);
88    length += rtems_monitor_pad(37, length);
89    length += rtems_monitor_dump_modes(monitor_task->modes);
90    length += rtems_monitor_pad(45, length);
91    length += rtems_monitor_dump_events(monitor_task->events);
92    if (monitor_task->wait_id)
93    {
94        length += rtems_monitor_pad(54, length);
95        length += rtems_monitor_dump_id(monitor_task->wait_id);
96        length += rtems_monitor_pad(63, length);
97        length += rtems_monitor_dump_hex(monitor_task->wait_args);
98    }
99
100    length += rtems_monitor_pad(72, length);
101    length += rtems_monitor_dump_notepad(monitor_task->notepad);
102    fprintf(stdout,"\n");
103}
Note: See TracBrowser for help on using the repository browser.