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

4.104.114.84.95
Last change on this file since fc4675f0 was be95da0, checked in by Joel Sherrill <joel.sherrill@…>, on 09/18/96 at 20:55:13

casts added to numerous arguments, prototypes corrected, and
proper include files added.

  • Property mode set to 100644
File size: 3.9 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#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__
23#include <rtems.h>
24
25#include "monitor.h"
26
27#include <stdio.h>
28#include <stdlib.h>             /* strtoul() */
29
30#define DATACOL 15
31#define CONTCOL DATACOL         /* continued col */
32
33
34void
35rtems_monitor_driver_canonical(
36    rtems_monitor_driver_t *canonical_driver,
37    void                   *driver_void
38)
39{
40    rtems_driver_address_table *d = (rtems_driver_address_table *) driver_void;
41
42    rtems_monitor_symbol_canonical_by_value(&canonical_driver->initialization,
43                                            (void *) d->initialization);
44
45    rtems_monitor_symbol_canonical_by_value(&canonical_driver->open,
46                                            (void *) d->open);
47    rtems_monitor_symbol_canonical_by_value(&canonical_driver->close,
48                                            (void *) d->close);
49    rtems_monitor_symbol_canonical_by_value(&canonical_driver->read,
50                                            (void *) d->read);
51    rtems_monitor_symbol_canonical_by_value(&canonical_driver->write,
52                                            (void *) d->write);
53    rtems_monitor_symbol_canonical_by_value(&canonical_driver->control,
54                                            (void *) d->control);
55}
56
57
58void *
59rtems_monitor_driver_next(
60    void                  *object_info,
61    rtems_monitor_driver_t *canonical_driver,
62    rtems_id              *next_id
63)
64{
65    rtems_configuration_table *c = _Configuration_Table;
66    int n = rtems_get_index(*next_id);
67
68    if (n >= c->number_of_device_drivers)
69        goto failed;
70   
71    _Thread_Disable_dispatch();
72
73    /*
74     * dummy up a fake id and name for this item
75     */
76
77    canonical_driver->id = n;
78    canonical_driver->name = rtems_build_name('-', '-', '-', '-');
79
80    *next_id += 1;
81    return (void *) (c->Device_driver_table + n);
82
83failed:
84    *next_id = RTEMS_OBJECT_ID_FINAL;
85    return 0;
86}
87
88
89void
90rtems_monitor_driver_dump_header(
91    boolean verbose
92)
93{
94    printf("\
95  Major      Entry points\n");
96/*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
970         1         2         3         4         5         6         7       */
98    rtems_monitor_separator();
99}
100
101void
102rtems_monitor_driver_dump(
103    rtems_monitor_driver_t *monitor_driver,
104    boolean                 verbose
105)
106{
107    unsigned32          length = 0;
108
109    length += printf("  %d", monitor_driver->id);
110
111    length += rtems_monitor_pad(13, length);
112    length += printf("init: ");
113    length += rtems_monitor_symbol_dump(&monitor_driver->initialization, verbose);
114    length += printf(";  control: ");
115    length += rtems_monitor_symbol_dump(&monitor_driver->control, verbose);
116    length += printf("\n");
117    length = 0;
118
119    length += rtems_monitor_pad(13, length);
120
121    length += printf("open: ");
122    length += rtems_monitor_symbol_dump(&monitor_driver->open, verbose);
123    length += printf(";  close: ");
124    length += rtems_monitor_symbol_dump(&monitor_driver->close, verbose);
125    length += printf("\n");
126    length = 0;
127
128    length += rtems_monitor_pad(13, length);
129
130    length += printf("read: ");
131    length += rtems_monitor_symbol_dump(&monitor_driver->read, verbose);
132    length += printf(";  write: ");
133    length += rtems_monitor_symbol_dump(&monitor_driver->write, verbose);
134    length += printf("\n");
135    length = 0;
136}
Note: See TracBrowser for help on using the repository browser.