source: rtems/cpukit/libmisc/monitor/mon-config.c @ f26145b

4.104.114.84.95
Last change on this file since f26145b was cbd849c, checked in by Ralf Corsepius <ralf.corsepius@…>, on 11/01/04 at 13:14:33

2004-11-01 Ralf Corsepius <ralf_corsepius@…>

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