[b06e68ef] | 1 | /* |
---|
| 2 | * @(#)config.c 1.5 - 95/08/02 |
---|
| 3 | * |
---|
| 4 | * |
---|
| 5 | * RTEMS Config display support |
---|
| 6 | * |
---|
| 7 | * TODO |
---|
| 8 | * |
---|
| 9 | * $Id$ |
---|
| 10 | */ |
---|
| 11 | |
---|
| 12 | |
---|
[e6424462] | 13 | #define __RTEMS_VIOLATE_KERNEL_VISIBILITY__ |
---|
[b06e68ef] | 14 | #include <rtems.h> |
---|
| 15 | #include "monitor.h" |
---|
| 16 | |
---|
| 17 | #include <stdio.h> |
---|
| 18 | #include <stdlib.h> /* strtoul() */ |
---|
| 19 | |
---|
| 20 | #define DATACOL 15 |
---|
| 21 | #define CONTCOL DATACOL /* continued col */ |
---|
| 22 | |
---|
| 23 | /* |
---|
| 24 | * Fill in entire monitor config table |
---|
| 25 | * for sending to a remote monitor or printing on the local system |
---|
| 26 | */ |
---|
| 27 | |
---|
| 28 | void |
---|
| 29 | rtems_monitor_config_canonical( |
---|
| 30 | rtems_monitor_config_t *canonical_config, |
---|
| 31 | void *config_void |
---|
| 32 | ) |
---|
| 33 | { |
---|
| 34 | rtems_configuration_table *c = (rtems_configuration_table *) config_void; |
---|
| 35 | |
---|
| 36 | canonical_config->work_space_start = c->work_space_start; |
---|
| 37 | canonical_config->work_space_size = c->work_space_size; |
---|
| 38 | canonical_config->maximum_tasks = c->maximum_tasks; |
---|
| 39 | canonical_config->maximum_timers = c->maximum_timers; |
---|
| 40 | canonical_config->maximum_semaphores = c->maximum_semaphores; |
---|
| 41 | canonical_config->maximum_message_queues = c->maximum_message_queues; |
---|
| 42 | canonical_config->maximum_partitions = c->maximum_partitions; |
---|
| 43 | canonical_config->maximum_regions = c->maximum_regions; |
---|
| 44 | canonical_config->maximum_ports = c->maximum_ports; |
---|
| 45 | canonical_config->maximum_periods = c->maximum_periods; |
---|
| 46 | canonical_config->maximum_extensions = c->maximum_extensions; |
---|
| 47 | canonical_config->microseconds_per_tick = c->microseconds_per_tick; |
---|
| 48 | canonical_config->ticks_per_timeslice = c->ticks_per_timeslice; |
---|
| 49 | canonical_config->number_of_initialization_tasks = c->number_of_initialization_tasks; |
---|
| 50 | } |
---|
| 51 | |
---|
| 52 | /* |
---|
| 53 | * This is easy, since there is only 1 (altho we could get them from |
---|
| 54 | * other nodes...) |
---|
| 55 | */ |
---|
| 56 | |
---|
| 57 | void * |
---|
| 58 | rtems_monitor_config_next( |
---|
| 59 | void *object_info, |
---|
| 60 | rtems_monitor_config_t *canonical_config, |
---|
| 61 | rtems_id *next_id |
---|
| 62 | ) |
---|
| 63 | { |
---|
| 64 | rtems_configuration_table *c = _Configuration_Table; |
---|
| 65 | int n = rtems_get_index(*next_id); |
---|
| 66 | |
---|
| 67 | if (n >= 1) |
---|
| 68 | goto failed; |
---|
| 69 | |
---|
| 70 | _Thread_Disable_dispatch(); |
---|
| 71 | |
---|
| 72 | *next_id += 1; |
---|
| 73 | return (void *) c; |
---|
| 74 | |
---|
| 75 | failed: |
---|
| 76 | *next_id = RTEMS_OBJECT_ID_FINAL; |
---|
| 77 | return 0; |
---|
| 78 | } |
---|
| 79 | |
---|
| 80 | |
---|
| 81 | void |
---|
| 82 | rtems_monitor_config_dump_header( |
---|
| 83 | boolean verbose |
---|
| 84 | ) |
---|
| 85 | { |
---|
| 86 | printf("\ |
---|
| 87 | INITIAL (startup) Configuration Info\n"); |
---|
| 88 | /*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 |
---|
| 89 | 0 1 2 3 4 5 6 7 */ |
---|
| 90 | rtems_monitor_separator(); |
---|
| 91 | } |
---|
| 92 | |
---|
| 93 | |
---|
| 94 | void |
---|
| 95 | rtems_monitor_config_dump( |
---|
| 96 | rtems_monitor_config_t *monitor_config, |
---|
| 97 | boolean verbose |
---|
| 98 | ) |
---|
| 99 | { |
---|
| 100 | unsigned32 length = 0; |
---|
| 101 | |
---|
| 102 | length = 0; |
---|
| 103 | length += printf("WORKSPACE"); |
---|
| 104 | length += rtems_monitor_pad(DATACOL, length); |
---|
| 105 | length += printf("start: 0x%x; size: 0x%x\n", |
---|
| 106 | (unsigned32) monitor_config->work_space_start, |
---|
| 107 | monitor_config->work_space_size); |
---|
| 108 | |
---|
| 109 | length = 0; |
---|
| 110 | length += printf("TIME"); |
---|
| 111 | length += rtems_monitor_pad(DATACOL, length); |
---|
| 112 | length += printf("usec/tick: %d; tick/timeslice: %d; tick/sec: %d\n", |
---|
| 113 | monitor_config->microseconds_per_tick, |
---|
| 114 | monitor_config->ticks_per_timeslice, |
---|
| 115 | 1000000 / monitor_config->microseconds_per_tick); |
---|
| 116 | |
---|
| 117 | length = 0; |
---|
| 118 | length += printf("MAXIMUMS"); |
---|
| 119 | length += rtems_monitor_pad(DATACOL, length); |
---|
| 120 | length += printf("tasks: %d; timers: %d; sems: %d; que's: %d; ext's: %d\n", |
---|
| 121 | monitor_config->maximum_tasks, |
---|
| 122 | monitor_config->maximum_timers, |
---|
| 123 | monitor_config->maximum_semaphores, |
---|
| 124 | monitor_config->maximum_message_queues, |
---|
| 125 | monitor_config->maximum_extensions); |
---|
| 126 | length = 0; |
---|
| 127 | length += rtems_monitor_pad(CONTCOL, length); |
---|
| 128 | length += printf("partitions: %d; regions: %d; ports: %d; periods: %d\n", |
---|
| 129 | monitor_config->maximum_partitions, |
---|
| 130 | monitor_config->maximum_regions, |
---|
| 131 | monitor_config->maximum_ports, |
---|
| 132 | monitor_config->maximum_periods); |
---|
| 133 | } |
---|