source: rtems/cpukit/libmisc/monitor/mon-driver.c @ 2b40808c

4.104.115
Last change on this file since 2b40808c was 031deada, checked in by Ralf Corsepius <ralf.corsepius@…>, on 01/02/09 at 13:04:13

Add attribute((unused)) to unused function args.

  • Property mode set to 100644
File size: 4.1 KB
Line 
1/*
2 * RTEMS monitor IO (device drivers) support
3 *
4 * There are 2 "driver" things the monitor knows about.
5 *
6 *    1. Regular RTEMS drivers.
7 *         This is a table indexed by major device number and
8 *         containing driver entry points only.
9 *
10 *    2. Driver name table.
11 *         A separate table of names for drivers.
12 *         The table converts driver names to a major number
13 *         as index into the driver table and a minor number
14 *         for an argument to driver.
15 *
16 *  Drivers are displayed with 'driver' command.
17 *  Names are displayed with 'name' command.
18 *
19 *  $Id$
20 */
21
22#ifdef HAVE_CONFIG_H
23#include "config.h"
24#endif
25
26#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__
27#include <rtems.h>
28
29#include <rtems/monitor.h>
30
31#include <stdio.h>
32#include <stdlib.h>             /* strtoul() */
33#include <inttypes.h>
34
35#define DATACOL 15
36#define CONTCOL DATACOL         /* continued col */
37
38
39void
40rtems_monitor_driver_canonical(
41    rtems_monitor_driver_t *canonical_driver,
42    void                   *driver_void
43)
44{
45    rtems_driver_address_table *d = (rtems_driver_address_table *) driver_void;
46
47    rtems_monitor_symbol_canonical_by_value(&canonical_driver->initialization,
48                                            (void *) d->initialization_entry);
49
50    rtems_monitor_symbol_canonical_by_value(&canonical_driver->open,
51                                            (void *) d->open_entry);
52    rtems_monitor_symbol_canonical_by_value(&canonical_driver->close,
53                                            (void *) d->close_entry);
54    rtems_monitor_symbol_canonical_by_value(&canonical_driver->read,
55                                            (void *) d->read_entry);
56    rtems_monitor_symbol_canonical_by_value(&canonical_driver->write,
57                                            (void *) d->write_entry);
58    rtems_monitor_symbol_canonical_by_value(&canonical_driver->control,
59                                            (void *) d->control_entry);
60}
61
62
63void *
64rtems_monitor_driver_next(
65    void                  *object_info __attribute__((unused)),
66    rtems_monitor_driver_t *canonical_driver,
67    rtems_id              *next_id
68)
69{
70    rtems_configuration_table *c = &Configuration;
71    uint32_t   n = rtems_object_id_get_index(*next_id);
72
73    if (n >= c->number_of_device_drivers)
74        goto failed;
75
76    _Thread_Disable_dispatch();
77
78    /*
79     * dummy up a fake id and name for this item
80     */
81
82    canonical_driver->id = n;
83    canonical_driver->name = rtems_build_name('-', '-', '-', '-');
84
85    *next_id += 1;
86    return (void *) (c->Device_driver_table + n);
87
88failed:
89    *next_id = RTEMS_OBJECT_ID_FINAL;
90    return 0;
91}
92
93
94void
95rtems_monitor_driver_dump_header(
96    bool verbose __attribute__((unused))
97)
98{
99    fprintf(stdout,"\
100  Major      Entry points\n");
101/*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
1020         1         2         3         4         5         6         7       */
103    rtems_monitor_separator();
104}
105
106void
107rtems_monitor_driver_dump(
108    rtems_monitor_driver_t *monitor_driver,
109    bool                    verbose
110)
111{
112    uint32_t            length = 0;
113
114    length += fprintf(stdout,"  %" PRId32 "", monitor_driver->id);
115
116    length += rtems_monitor_pad(13, length);
117    length += fprintf(stdout,"init: ");
118    length += rtems_monitor_symbol_dump(&monitor_driver->initialization, verbose);
119    length += fprintf(stdout,";  control: ");
120    length += rtems_monitor_symbol_dump(&monitor_driver->control, verbose);
121    length += fprintf(stdout,"\n");
122    length = 0;
123
124    length += rtems_monitor_pad(13, length);
125
126    length += fprintf(stdout,"open: ");
127    length += rtems_monitor_symbol_dump(&monitor_driver->open, verbose);
128    length += fprintf(stdout,";  close: ");
129    length += rtems_monitor_symbol_dump(&monitor_driver->close, verbose);
130    length += fprintf(stdout,"\n");
131    length = 0;
132
133    length += rtems_monitor_pad(13, length);
134
135    length += fprintf(stdout,"read: ");
136    length += rtems_monitor_symbol_dump(&monitor_driver->read, verbose);
137    length += fprintf(stdout,";  write: ");
138    length += rtems_monitor_symbol_dump(&monitor_driver->write, verbose);
139    length += fprintf(stdout,"\n");
140    length = 0;
141}
Note: See TracBrowser for help on using the repository browser.