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