1 | /* |
---|
2 | * RTEMS MPCI Config display support |
---|
3 | * |
---|
4 | * TODO |
---|
5 | * |
---|
6 | * $Id$ |
---|
7 | */ |
---|
8 | |
---|
9 | #ifdef HAVE_CONFIG_H |
---|
10 | #include "config.h" |
---|
11 | #endif |
---|
12 | |
---|
13 | #define __RTEMS_VIOLATE_KERNEL_VISIBILITY__ |
---|
14 | #include <rtems.h> |
---|
15 | #include <rtems/monitor.h> |
---|
16 | |
---|
17 | #include <stdio.h> |
---|
18 | #include <stdlib.h> /* strtoul() */ |
---|
19 | #include <inttypes.h> |
---|
20 | |
---|
21 | #define DATACOL 15 |
---|
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_mpci_canonical( |
---|
30 | rtems_monitor_mpci_t *canonical_mpci, |
---|
31 | void *config_void |
---|
32 | ) |
---|
33 | { |
---|
34 | rtems_configuration_table *c = _Configuration_Table; |
---|
35 | rtems_multiprocessing_table *m; |
---|
36 | rtems_mpci_table *mt; |
---|
37 | |
---|
38 | m = c->User_multiprocessing_table; |
---|
39 | if (m == 0) |
---|
40 | return; |
---|
41 | mt = m->User_mpci_table; |
---|
42 | |
---|
43 | canonical_mpci->node = m->node; |
---|
44 | canonical_mpci->maximum_nodes = m->maximum_nodes; |
---|
45 | canonical_mpci->maximum_global_objects = m->maximum_global_objects; |
---|
46 | canonical_mpci->maximum_proxies = m->maximum_proxies; |
---|
47 | |
---|
48 | canonical_mpci->default_timeout = mt->default_timeout; |
---|
49 | canonical_mpci->maximum_packet_size = mt->maximum_packet_size; |
---|
50 | |
---|
51 | rtems_monitor_symbol_canonical_by_value(&canonical_mpci->initialization, |
---|
52 | (void *) mt->initialization); |
---|
53 | |
---|
54 | rtems_monitor_symbol_canonical_by_value(&canonical_mpci->get_packet, |
---|
55 | (void *) mt->get_packet); |
---|
56 | rtems_monitor_symbol_canonical_by_value(&canonical_mpci->return_packet, |
---|
57 | (void *) mt->return_packet); |
---|
58 | rtems_monitor_symbol_canonical_by_value(&canonical_mpci->send_packet, |
---|
59 | (void *) mt->send_packet); |
---|
60 | rtems_monitor_symbol_canonical_by_value(&canonical_mpci->receive_packet, |
---|
61 | (void *) mt->receive_packet); |
---|
62 | } |
---|
63 | |
---|
64 | /* |
---|
65 | * This is easy, since there is only 1 (altho we could get them from |
---|
66 | * other nodes...) |
---|
67 | */ |
---|
68 | |
---|
69 | void * |
---|
70 | rtems_monitor_mpci_next( |
---|
71 | void *object_info, |
---|
72 | rtems_monitor_mpci_t *canonical_mpci, |
---|
73 | rtems_id *next_id |
---|
74 | ) |
---|
75 | { |
---|
76 | rtems_configuration_table *c = _Configuration_Table; |
---|
77 | int n = rtems_object_id_get_index(*next_id); |
---|
78 | |
---|
79 | if (n >= 1) |
---|
80 | goto failed; |
---|
81 | |
---|
82 | if ( ! c->User_multiprocessing_table) |
---|
83 | goto failed; |
---|
84 | |
---|
85 | _Thread_Disable_dispatch(); |
---|
86 | |
---|
87 | *next_id += 1; |
---|
88 | return (void *) c; |
---|
89 | |
---|
90 | failed: |
---|
91 | *next_id = RTEMS_OBJECT_ID_FINAL; |
---|
92 | return 0; |
---|
93 | } |
---|
94 | |
---|
95 | |
---|
96 | void |
---|
97 | rtems_monitor_mpci_dump_header( |
---|
98 | boolean verbose |
---|
99 | ) |
---|
100 | { |
---|
101 | fprintf(stdout,"\ |
---|
102 | max max max default max\n\ |
---|
103 | node nodes globals proxies timeout pktsize\n"); |
---|
104 | /*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 |
---|
105 | 0 1 2 3 4 5 6 7 */ |
---|
106 | |
---|
107 | rtems_monitor_separator(); |
---|
108 | } |
---|
109 | |
---|
110 | |
---|
111 | void |
---|
112 | rtems_monitor_mpci_dump( |
---|
113 | rtems_monitor_mpci_t *monitor_mpci, |
---|
114 | boolean verbose |
---|
115 | ) |
---|
116 | { |
---|
117 | uint32_t length = 0; |
---|
118 | |
---|
119 | length += rtems_monitor_pad(2, length); |
---|
120 | length += fprintf(stdout," %" PRId32 , monitor_mpci->node); |
---|
121 | length += rtems_monitor_pad(11, length); |
---|
122 | length += fprintf(stdout,"%" PRId32, monitor_mpci->maximum_nodes); |
---|
123 | |
---|
124 | length += rtems_monitor_pad(18, length); |
---|
125 | length += rtems_monitor_dump_decimal(monitor_mpci->maximum_global_objects); |
---|
126 | |
---|
127 | length += rtems_monitor_pad(28, length); |
---|
128 | length += rtems_monitor_dump_decimal(monitor_mpci->maximum_proxies); |
---|
129 | |
---|
130 | length += rtems_monitor_pad(37, length); |
---|
131 | length += rtems_monitor_dump_decimal(monitor_mpci->default_timeout); |
---|
132 | |
---|
133 | length += rtems_monitor_pad(46, length); |
---|
134 | length += rtems_monitor_dump_decimal(monitor_mpci->maximum_packet_size); |
---|
135 | |
---|
136 | fprintf(stdout,"\n"); |
---|
137 | length = 0; |
---|
138 | length += rtems_monitor_pad(DATACOL, length); |
---|
139 | |
---|
140 | length += fprintf(stdout,"init: "); |
---|
141 | length += rtems_monitor_symbol_dump(&monitor_mpci->initialization, verbose); |
---|
142 | |
---|
143 | fprintf(stdout,"\n"); |
---|
144 | length = 0; |
---|
145 | length += rtems_monitor_pad(DATACOL, length); |
---|
146 | |
---|
147 | length += fprintf(stdout,"get: "); |
---|
148 | length += rtems_monitor_symbol_dump(&monitor_mpci->get_packet, verbose); |
---|
149 | length += fprintf(stdout,"; return: "); |
---|
150 | length += rtems_monitor_symbol_dump(&monitor_mpci->return_packet, verbose); |
---|
151 | |
---|
152 | fprintf(stdout,"\n"); |
---|
153 | length = 0; |
---|
154 | length += rtems_monitor_pad(DATACOL, length); |
---|
155 | |
---|
156 | length += fprintf(stdout,"send: "); |
---|
157 | length += rtems_monitor_symbol_dump(&monitor_mpci->send_packet, verbose); |
---|
158 | length += fprintf(stdout,"; receive: "); |
---|
159 | length += rtems_monitor_symbol_dump(&monitor_mpci->receive_packet, verbose); |
---|
160 | |
---|
161 | fprintf(stdout,"\n"); |
---|
162 | length = 0; |
---|
163 | } |
---|