source: rtems/cpukit/libmisc/monitor/mon-mpci.c @ df91dd9

Last change on this file since df91dd9 was df91dd9, checked in by Sebastian Huber <sebastian.huber@…>, on Mar 14, 2016 at 11:31:12 AM

monitor: Use object allocator lock

Use object allocator lock instead of disabled thread dispatching.

Update #2555.

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