1 | /* |
---|
2 | * @(#)mpci.c 1.6 - 95/08/02 |
---|
3 | * |
---|
4 | * |
---|
5 | * RTEMS MPCI Config display support |
---|
6 | * |
---|
7 | * TODO |
---|
8 | * |
---|
9 | * $Id$ |
---|
10 | */ |
---|
11 | |
---|
12 | |
---|
13 | #include <rtems.h> |
---|
14 | #include "monitor.h" |
---|
15 | |
---|
16 | #include <stdio.h> |
---|
17 | #include <stdlib.h> /* strtoul() */ |
---|
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 | void *config_void |
---|
30 | ) |
---|
31 | { |
---|
32 | rtems_configuration_table *c = _Configuration_Table; |
---|
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 | mt->initialization); |
---|
51 | |
---|
52 | rtems_monitor_symbol_canonical_by_value(&canonical_mpci->get_packet, |
---|
53 | mt->get_packet); |
---|
54 | rtems_monitor_symbol_canonical_by_value(&canonical_mpci->return_packet, |
---|
55 | mt->return_packet); |
---|
56 | rtems_monitor_symbol_canonical_by_value(&canonical_mpci->send_packet, |
---|
57 | mt->send_packet); |
---|
58 | rtems_monitor_symbol_canonical_by_value(&canonical_mpci->receive_packet, |
---|
59 | 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 | 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 | rtems_configuration_table *c = _Configuration_Table; |
---|
75 | int n = rtems_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 | boolean verbose |
---|
97 | ) |
---|
98 | { |
---|
99 | printf("\ |
---|
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 | boolean verbose |
---|
113 | ) |
---|
114 | { |
---|
115 | unsigned32 length = 0; |
---|
116 | |
---|
117 | length += rtems_monitor_pad(2, length); |
---|
118 | length += printf(" %d", monitor_mpci->node); |
---|
119 | length += rtems_monitor_pad(11, length); |
---|
120 | length += printf("%d", 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(monitor_mpci->maximum_packet_size); |
---|
133 | |
---|
134 | printf("\n"); |
---|
135 | length = 0; |
---|
136 | length += rtems_monitor_pad(DATACOL, length); |
---|
137 | |
---|
138 | length += printf("init: "); |
---|
139 | length += rtems_monitor_symbol_dump(&monitor_mpci->initialization, verbose); |
---|
140 | |
---|
141 | printf("\n"); |
---|
142 | length = 0; |
---|
143 | length += rtems_monitor_pad(DATACOL, length); |
---|
144 | |
---|
145 | length += printf("get: "); |
---|
146 | length += rtems_monitor_symbol_dump(&monitor_mpci->get_packet, verbose); |
---|
147 | length += printf("; return: "); |
---|
148 | length += rtems_monitor_symbol_dump(&monitor_mpci->return_packet, verbose); |
---|
149 | |
---|
150 | printf("\n"); |
---|
151 | length = 0; |
---|
152 | length += rtems_monitor_pad(DATACOL, length); |
---|
153 | |
---|
154 | length += printf("send: "); |
---|
155 | length += rtems_monitor_symbol_dump(&monitor_mpci->send_packet, verbose); |
---|
156 | length += printf("; receive: "); |
---|
157 | length += rtems_monitor_symbol_dump(&monitor_mpci->receive_packet, verbose); |
---|
158 | |
---|
159 | printf("\n"); |
---|
160 | length = 0; |
---|
161 | } |
---|