summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libmisc/monitor/mon-config.c
blob: f5c9f6f093dc2547726aa6b870557f77b7d06416 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
/*
 * RTEMS Config display support
 *
 * TODO
 *
 *  $Id$
 */


#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__
#include <rtems.h>
#include "monitor.h"

#include <stdio.h>
#include <stdlib.h>             /* strtoul() */

#define DATACOL 15
#define CONTCOL DATACOL		/* continued col */

/*
 * Fill in entire monitor config table
 * for sending to a remote monitor or printing on the local system
 */

void
rtems_monitor_config_canonical(
    rtems_monitor_config_t *canonical_config,
    void                   *config_void
)
{
    rtems_configuration_table *c = (rtems_configuration_table *) config_void;

    canonical_config->work_space_start = c->work_space_start;
    canonical_config->work_space_size = c->work_space_size;
    canonical_config->maximum_tasks = c->maximum_tasks;
    canonical_config->maximum_timers = c->maximum_timers;
    canonical_config->maximum_semaphores = c->maximum_semaphores;
    canonical_config->maximum_message_queues = c->maximum_message_queues;
    canonical_config->maximum_partitions = c->maximum_partitions;
    canonical_config->maximum_regions = c->maximum_regions;
    canonical_config->maximum_ports = c->maximum_ports;
    canonical_config->maximum_periods = c->maximum_periods;
    canonical_config->maximum_extensions = c->maximum_extensions;
    canonical_config->microseconds_per_tick = c->microseconds_per_tick;
    canonical_config->ticks_per_timeslice = c->ticks_per_timeslice;
    canonical_config->number_of_initialization_tasks = c->number_of_initialization_tasks;
}    

/*
 * This is easy, since there is only 1 (altho we could get them from
 *    other nodes...)
 */

void *
rtems_monitor_config_next(
    void                  *object_info,
    rtems_monitor_config_t *canonical_config,
    rtems_id              *next_id
)
{
    rtems_configuration_table *c = _Configuration_Table;
    int n = rtems_get_index(*next_id);

    if (n >= 1)
        goto failed;
    
    _Thread_Disable_dispatch();

    *next_id += 1;
    return (void *) c;

failed:
    *next_id = RTEMS_OBJECT_ID_FINAL;
    return 0;
}


void
rtems_monitor_config_dump_header(
    boolean verbose
)
{
    printf("\
INITIAL (startup) Configuration Info\n");
/*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
0         1         2         3         4         5         6         7       */
    rtems_monitor_separator();
}


void
rtems_monitor_config_dump(
    rtems_monitor_config_t *monitor_config,
    boolean                 verbose
)
{
    unsigned32   length = 0;

    length = 0;
    length += printf("WORKSPACE");
    length += rtems_monitor_pad(DATACOL, length);
    length += printf("start: 0x%x;  size: 0x%x\n",
                     (unsigned32) monitor_config->work_space_start,
                     monitor_config->work_space_size);

    length = 0;
    length += printf("TIME");
    length += rtems_monitor_pad(DATACOL, length);
    length += printf("usec/tick: %d;  tick/timeslice: %d;  tick/sec: %d\n",
                     monitor_config->microseconds_per_tick,
                     monitor_config->ticks_per_timeslice,
                     1000000 / monitor_config->microseconds_per_tick);

    length = 0;
    length += printf("MAXIMUMS");
    length += rtems_monitor_pad(DATACOL, length);
    length += printf("tasks: %d;  timers: %d;  sems: %d;  que's: %d;  ext's: %d\n",
                     monitor_config->maximum_tasks,
                     monitor_config->maximum_timers,
                     monitor_config->maximum_semaphores,
                     monitor_config->maximum_message_queues,
                     monitor_config->maximum_extensions);
    length = 0;
    length += rtems_monitor_pad(CONTCOL, length);
    length += printf("partitions: %d;  regions: %d;  ports: %d;  periods: %d\n",
                     monitor_config->maximum_partitions,
                     monitor_config->maximum_regions,
                     monitor_config->maximum_ports,
                     monitor_config->maximum_periods);
}