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