[b06e68ef] | 1 | /* |
---|
| 2 | * @(#)task.c 1.9 - 95/08/01 |
---|
| 3 | * |
---|
| 4 | * |
---|
| 5 | * RTEMS Monitor task support |
---|
| 6 | * |
---|
| 7 | * $Id$ |
---|
| 8 | */ |
---|
| 9 | |
---|
| 10 | #include <rtems.h> |
---|
| 11 | #include "monitor.h" |
---|
| 12 | |
---|
| 13 | #include <stdio.h> |
---|
| 14 | |
---|
| 15 | void |
---|
| 16 | rtems_monitor_task_canonical( |
---|
| 17 | rtems_monitor_task_t *canonical_task, |
---|
| 18 | void *thread_void |
---|
| 19 | ) |
---|
| 20 | { |
---|
| 21 | Thread_Control *rtems_thread = (Thread_Control *) thread_void; |
---|
| 22 | |
---|
| 23 | canonical_task->entry = rtems_thread->Start.entry_point; |
---|
| 24 | canonical_task->argument = rtems_thread->Start.initial_argument; |
---|
| 25 | canonical_task->stack = rtems_thread->Start.Initial_stack.area; |
---|
| 26 | canonical_task->stack_size = rtems_thread->Start.Initial_stack.size; |
---|
| 27 | canonical_task->priority = rtems_thread->current_priority; |
---|
| 28 | canonical_task->state = rtems_thread->current_state; |
---|
| 29 | canonical_task->wait_id = rtems_thread->Wait.id; |
---|
| 30 | canonical_task->events = rtems_thread->pending_events; |
---|
| 31 | canonical_task->modes = rtems_thread->current_modes; |
---|
| 32 | canonical_task->attributes = rtems_thread->attribute_set; |
---|
| 33 | (void) memcpy(canonical_task->notepad, rtems_thread->Notepads, sizeof(canonical_task->notepad)); |
---|
| 34 | (void) memcpy(&canonical_task->wait_args, &rtems_thread->Wait.Extra, sizeof(canonical_task->wait_args)); |
---|
| 35 | } |
---|
| 36 | |
---|
| 37 | |
---|
| 38 | void |
---|
| 39 | rtems_monitor_task_dump_header( |
---|
| 40 | boolean verbose |
---|
| 41 | ) |
---|
| 42 | { |
---|
| 43 | printf("\ |
---|
| 44 | ID NAME PRIO STAT MODES EVENTS WAITID WAITARG NOTES\n"); |
---|
| 45 | /*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 |
---|
| 46 | 0 1 2 3 4 5 6 7 */ |
---|
| 47 | |
---|
| 48 | rtems_monitor_separator(); |
---|
| 49 | } |
---|
| 50 | |
---|
| 51 | /* |
---|
| 52 | */ |
---|
| 53 | |
---|
| 54 | void |
---|
| 55 | rtems_monitor_task_dump( |
---|
| 56 | rtems_monitor_task_t *monitor_task, |
---|
| 57 | boolean verbose |
---|
| 58 | ) |
---|
| 59 | { |
---|
| 60 | int length = 0; |
---|
| 61 | |
---|
| 62 | length += rtems_monitor_dump_id(monitor_task->id); |
---|
| 63 | length += rtems_monitor_pad(11, length); |
---|
| 64 | length += rtems_monitor_dump_name(monitor_task->name); |
---|
| 65 | length += rtems_monitor_pad(18, length); |
---|
| 66 | length += rtems_monitor_dump_priority(monitor_task->priority); |
---|
| 67 | length += rtems_monitor_pad(24, length); |
---|
| 68 | length += rtems_monitor_dump_state(monitor_task->state); |
---|
| 69 | length += rtems_monitor_pad(31, length); |
---|
| 70 | length += rtems_monitor_dump_modes(monitor_task->modes); |
---|
| 71 | length += rtems_monitor_pad(39, length); |
---|
| 72 | length += rtems_monitor_dump_events(monitor_task->events); |
---|
| 73 | if (monitor_task->wait_id) |
---|
| 74 | { |
---|
| 75 | length += rtems_monitor_pad(47, length); |
---|
| 76 | length += rtems_monitor_dump_id(monitor_task->wait_id); |
---|
| 77 | length += rtems_monitor_pad(57, length); |
---|
| 78 | length += rtems_monitor_dump_hex(monitor_task->wait_args); |
---|
| 79 | } |
---|
| 80 | |
---|
| 81 | length += rtems_monitor_pad(65, length); |
---|
| 82 | length += rtems_monitor_dump_notepad(monitor_task->notepad); |
---|
| 83 | printf("\n"); |
---|
| 84 | } |
---|
| 85 | |
---|