[b06e68ef] | 1 | /* |
---|
[8389628] | 2 | * RTEMS Monitor init task support |
---|
[b06e68ef] | 3 | */ |
---|
| 4 | |
---|
[550c3df7] | 5 | #ifdef HAVE_CONFIG_H |
---|
| 6 | #include "config.h" |
---|
| 7 | #endif |
---|
| 8 | |
---|
[b06e68ef] | 9 | #include <rtems.h> |
---|
[5beb562] | 10 | #include <rtems/monitor.h> |
---|
[b06e68ef] | 11 | |
---|
[cbd849c] | 12 | #include <inttypes.h> |
---|
[b06e68ef] | 13 | #include <stdio.h> |
---|
| 14 | |
---|
| 15 | /* |
---|
| 16 | * As above, but just for init tasks |
---|
| 17 | */ |
---|
| 18 | void |
---|
| 19 | rtems_monitor_init_task_canonical( |
---|
| 20 | rtems_monitor_init_task_t *canonical_itask, |
---|
[ed8be1ae] | 21 | const void *itask_void |
---|
[b06e68ef] | 22 | ) |
---|
| 23 | { |
---|
[ed8be1ae] | 24 | const rtems_initialization_tasks_table *rtems_itask = itask_void; |
---|
[aed742c] | 25 | |
---|
[b06e68ef] | 26 | rtems_monitor_symbol_canonical_by_value(&canonical_itask->entry, |
---|
[be95da0] | 27 | (void *) rtems_itask->entry_point); |
---|
[b06e68ef] | 28 | |
---|
| 29 | canonical_itask->argument = rtems_itask->argument; |
---|
| 30 | canonical_itask->stack_size = rtems_itask->stack_size; |
---|
| 31 | canonical_itask->priority = rtems_itask->initial_priority; |
---|
| 32 | canonical_itask->modes = rtems_itask->mode_set; |
---|
| 33 | canonical_itask->attributes = rtems_itask->attribute_set; |
---|
| 34 | } |
---|
| 35 | |
---|
[ed8be1ae] | 36 | const void * |
---|
[b06e68ef] | 37 | rtems_monitor_init_task_next( |
---|
[f97536d] | 38 | void *object_info RTEMS_UNUSED, |
---|
[b06e68ef] | 39 | rtems_monitor_init_task_t *canonical_init_task, |
---|
| 40 | rtems_id *next_id |
---|
| 41 | ) |
---|
| 42 | { |
---|
| 43 | rtems_initialization_tasks_table *itask; |
---|
[6c06288] | 44 | uint32_t n = rtems_object_id_get_index(*next_id); |
---|
[b06e68ef] | 45 | |
---|
[aac75d3b] | 46 | if (n >= Configuration_RTEMS_API.number_of_initialization_tasks) |
---|
[b06e68ef] | 47 | goto failed; |
---|
[aed742c] | 48 | |
---|
[df91dd9] | 49 | _Objects_Allocator_lock(); |
---|
[b06e68ef] | 50 | |
---|
[aac75d3b] | 51 | itask = Configuration_RTEMS_API.User_initialization_tasks_table + n; |
---|
[b06e68ef] | 52 | |
---|
| 53 | /* |
---|
| 54 | * dummy up a fake id and name for this item |
---|
| 55 | */ |
---|
| 56 | |
---|
| 57 | canonical_init_task->id = n; |
---|
| 58 | canonical_init_task->name = itask->name; |
---|
| 59 | |
---|
| 60 | *next_id += 1; |
---|
[ed8be1ae] | 61 | return (const void *) itask; |
---|
[b06e68ef] | 62 | |
---|
| 63 | failed: |
---|
| 64 | *next_id = RTEMS_OBJECT_ID_FINAL; |
---|
| 65 | return 0; |
---|
| 66 | } |
---|
| 67 | |
---|
| 68 | |
---|
| 69 | void |
---|
| 70 | rtems_monitor_init_task_dump_header( |
---|
[f97536d] | 71 | bool verbose RTEMS_UNUSED |
---|
[b06e68ef] | 72 | ) |
---|
| 73 | { |
---|
[714f06c] | 74 | fprintf(stdout,"\ |
---|
[b06e68ef] | 75 | # NAME ENTRY ARGUMENT PRIO MODES ATTRIBUTES STACK SIZE\n"); |
---|
| 76 | /*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 |
---|
| 77 | 0 1 2 3 4 5 6 7 */ |
---|
| 78 | rtems_monitor_separator(); |
---|
| 79 | } |
---|
| 80 | |
---|
| 81 | /* |
---|
| 82 | */ |
---|
| 83 | |
---|
| 84 | void |
---|
| 85 | rtems_monitor_init_task_dump( |
---|
| 86 | rtems_monitor_init_task_t *monitor_itask, |
---|
[2326f0d] | 87 | bool verbose |
---|
[b06e68ef] | 88 | ) |
---|
| 89 | { |
---|
| 90 | int length = 0; |
---|
| 91 | |
---|
| 92 | length += rtems_monitor_dump_decimal(monitor_itask->id); |
---|
| 93 | |
---|
| 94 | length += rtems_monitor_pad(7, length); |
---|
[bd5762d] | 95 | length += rtems_monitor_dump_name(monitor_itask->id); |
---|
[b06e68ef] | 96 | |
---|
| 97 | length += rtems_monitor_pad(14, length); |
---|
| 98 | length += rtems_monitor_symbol_dump(&monitor_itask->entry, verbose); |
---|
| 99 | |
---|
| 100 | length += rtems_monitor_pad(25, length); |
---|
[0893220] | 101 | length += fprintf(stdout,"%" PRId32 " [0x%" PRIx32 "]", |
---|
[cbd849c] | 102 | monitor_itask->argument, monitor_itask->argument); |
---|
[b06e68ef] | 103 | |
---|
| 104 | length += rtems_monitor_pad(39, length); |
---|
| 105 | length += rtems_monitor_dump_priority(monitor_itask->priority); |
---|
| 106 | |
---|
| 107 | length += rtems_monitor_pad(46, length); |
---|
| 108 | length += rtems_monitor_dump_modes(monitor_itask->modes); |
---|
| 109 | |
---|
| 110 | length += rtems_monitor_pad(54, length); |
---|
| 111 | length += rtems_monitor_dump_attributes(monitor_itask->attributes); |
---|
[aed742c] | 112 | |
---|
[b06e68ef] | 113 | length += rtems_monitor_pad(66, length); |
---|
[cbd849c] | 114 | length += fprintf(stdout,"%" PRId32 " [0x%" PRIx32 "]", |
---|
| 115 | monitor_itask->stack_size, monitor_itask->stack_size); |
---|
[b06e68ef] | 116 | |
---|
[714f06c] | 117 | fprintf(stdout,"\n"); |
---|
[b06e68ef] | 118 | } |
---|