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