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