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