1 | /* |
---|
2 | * RTEMS Config display support |
---|
3 | * |
---|
4 | * TODO |
---|
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 <inttypes.h> |
---|
15 | #include <stdio.h> |
---|
16 | #include <stdlib.h> /* strtoul() */ |
---|
17 | |
---|
18 | #define DATACOL 15 |
---|
19 | #define CONTCOL DATACOL /* continued col */ |
---|
20 | |
---|
21 | /* |
---|
22 | * Fill in entire monitor config table |
---|
23 | * for sending to a remote monitor or printing on the local system |
---|
24 | */ |
---|
25 | |
---|
26 | void |
---|
27 | rtems_monitor_config_canonical( |
---|
28 | rtems_monitor_config_t *canonical_config, |
---|
29 | const void *config_void |
---|
30 | ) |
---|
31 | { |
---|
32 | const rtems_configuration_table *c = |
---|
33 | (const rtems_configuration_table *) config_void; |
---|
34 | rtems_api_configuration_table *r = &Configuration_RTEMS_API; |
---|
35 | |
---|
36 | canonical_config->work_space_size = c->work_space_size; |
---|
37 | canonical_config->maximum_tasks = rtems_configuration_get_maximum_tasks(); |
---|
38 | canonical_config->maximum_timers = rtems_configuration_get_maximum_timers(); |
---|
39 | canonical_config->maximum_semaphores = rtems_configuration_get_maximum_semaphores(); |
---|
40 | canonical_config->maximum_message_queues = rtems_configuration_get_maximum_message_queues(); |
---|
41 | canonical_config->maximum_partitions = rtems_configuration_get_maximum_partitions(); |
---|
42 | canonical_config->maximum_regions = rtems_configuration_get_maximum_regions(); |
---|
43 | canonical_config->maximum_ports = rtems_configuration_get_maximum_ports(); |
---|
44 | canonical_config->maximum_periods = rtems_configuration_get_maximum_periods(); |
---|
45 | canonical_config->maximum_extensions = rtems_configuration_get_maximum_extensions(); |
---|
46 | canonical_config->microseconds_per_tick = c->microseconds_per_tick; |
---|
47 | canonical_config->ticks_per_timeslice = c->ticks_per_timeslice; |
---|
48 | canonical_config->number_of_initialization_tasks = r->number_of_initialization_tasks; |
---|
49 | } |
---|
50 | |
---|
51 | /* |
---|
52 | * This is easy, since there is only 1 (altho we could get them from |
---|
53 | * other nodes...) |
---|
54 | */ |
---|
55 | |
---|
56 | const void * |
---|
57 | rtems_monitor_config_next( |
---|
58 | void *object_info RTEMS_UNUSED, |
---|
59 | rtems_monitor_config_t *canonical_config RTEMS_UNUSED, |
---|
60 | rtems_id *next_id |
---|
61 | ) |
---|
62 | { |
---|
63 | const rtems_configuration_table *c = &Configuration; |
---|
64 | int n = rtems_object_id_get_index(*next_id); |
---|
65 | |
---|
66 | if (n >= 1) |
---|
67 | goto failed; |
---|
68 | |
---|
69 | _Objects_Allocator_lock(); |
---|
70 | |
---|
71 | *next_id += 1; |
---|
72 | return (const void *) c; |
---|
73 | |
---|
74 | failed: |
---|
75 | *next_id = RTEMS_OBJECT_ID_FINAL; |
---|
76 | return 0; |
---|
77 | } |
---|
78 | |
---|
79 | |
---|
80 | void |
---|
81 | rtems_monitor_config_dump_header( |
---|
82 | bool verbose RTEMS_UNUSED |
---|
83 | ) |
---|
84 | { |
---|
85 | fprintf(stdout,"\ |
---|
86 | INITIAL (startup) Configuration Info\n"); |
---|
87 | /*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 |
---|
88 | 0 1 2 3 4 5 6 7 */ |
---|
89 | rtems_monitor_separator(); |
---|
90 | } |
---|
91 | |
---|
92 | |
---|
93 | int |
---|
94 | rtems_monitor_config_dump( |
---|
95 | rtems_monitor_config_t *monitor_config, |
---|
96 | bool verbose RTEMS_UNUSED |
---|
97 | ) |
---|
98 | { |
---|
99 | int length = 0; |
---|
100 | |
---|
101 | length = 0; |
---|
102 | length += fprintf(stdout,"WORKSPACE"); |
---|
103 | length += rtems_monitor_pad(DATACOL, length); |
---|
104 | length += fprintf(stdout,"start: %p; size: 0x%" PRIx32 " (%" PRId32 ")\n", |
---|
105 | monitor_config->work_space_start, |
---|
106 | monitor_config->work_space_size, |
---|
107 | monitor_config->work_space_size); |
---|
108 | |
---|
109 | length = 0; |
---|
110 | length += fprintf(stdout,"TIME"); |
---|
111 | length += rtems_monitor_pad(DATACOL, length); |
---|
112 | length += fprintf(stdout,"usec/tick: %" PRId32 "; tick/timeslice: %" PRId32 "; tick/sec: %" PRId32 "\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 += fprintf(stdout,"MAXIMUMS"); |
---|
119 | length += rtems_monitor_pad(DATACOL, length); |
---|
120 | length += fprintf(stdout,"tasks: %" PRId32 "%c; timers: %" PRId32 "%c; sems: %" PRId32 "%c; que's: %" PRId32 "%c; ext's: %" PRId32 "%c;\n", |
---|
121 | monitor_config->maximum_tasks & ~OBJECTS_UNLIMITED_OBJECTS, |
---|
122 | (monitor_config->maximum_tasks & OBJECTS_UNLIMITED_OBJECTS) == 0 ? ' ' : '+', |
---|
123 | monitor_config->maximum_timers & ~OBJECTS_UNLIMITED_OBJECTS, |
---|
124 | (monitor_config->maximum_timers & OBJECTS_UNLIMITED_OBJECTS) == 0 ? ' ' : '+', |
---|
125 | monitor_config->maximum_semaphores & ~OBJECTS_UNLIMITED_OBJECTS, |
---|
126 | (monitor_config->maximum_semaphores & OBJECTS_UNLIMITED_OBJECTS) == 0 ? ' ' : '+', |
---|
127 | monitor_config->maximum_message_queues & ~OBJECTS_UNLIMITED_OBJECTS, |
---|
128 | (monitor_config->maximum_message_queues & OBJECTS_UNLIMITED_OBJECTS) == 0 ? ' ' : '+', |
---|
129 | monitor_config->maximum_extensions & ~OBJECTS_UNLIMITED_OBJECTS, |
---|
130 | (monitor_config->maximum_extensions & OBJECTS_UNLIMITED_OBJECTS) == 0 ? ' ' : '+'); |
---|
131 | length = 0; |
---|
132 | length += rtems_monitor_pad(CONTCOL, length); |
---|
133 | length += fprintf(stdout,"partitions: %" PRId32 "%c; regions: %" PRId32 "%c; ports: %" PRId32 "%c; periods: %" PRId32 "%c;\n", |
---|
134 | monitor_config->maximum_partitions & ~OBJECTS_UNLIMITED_OBJECTS, |
---|
135 | (monitor_config->maximum_partitions & OBJECTS_UNLIMITED_OBJECTS) == 0 ? ' ' : '+', |
---|
136 | monitor_config->maximum_regions & ~OBJECTS_UNLIMITED_OBJECTS, |
---|
137 | (monitor_config->maximum_regions & OBJECTS_UNLIMITED_OBJECTS) == 0 ? ' ' : '+', |
---|
138 | monitor_config->maximum_ports & ~OBJECTS_UNLIMITED_OBJECTS, |
---|
139 | (monitor_config->maximum_ports & OBJECTS_UNLIMITED_OBJECTS) == 0 ? ' ' : '+', |
---|
140 | monitor_config->maximum_periods & ~OBJECTS_UNLIMITED_OBJECTS, |
---|
141 | (monitor_config->maximum_periods & OBJECTS_UNLIMITED_OBJECTS) == 0 ? ' ' : '+'); |
---|
142 | return length; |
---|
143 | } |
---|