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

4.104.114.84.95
Last change on this file since b06e68ef was b06e68ef, checked in by Joel Sherrill <joel.sherrill@…>, on Aug 17, 1995 at 7:51:51 PM

Numerous miscellaneous features incorporated from Tony Bennett
(tbennett@…) including the following major additions:

+ variable length messages
+ named devices
+ debug monitor
+ association tables/variables

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