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

4.104.114.84.95
Last change on this file since 738a9ae was 550c3df7, checked in by Ralf Corsepius <ralf.corsepius@…>, on 07/08/03 at 08:39:16

2003-07-08 Ralf Corsepius <corsepiu@…>

  • capture/capture-cli.c: Add config-header support.
  • capture/capture.c: Add config-header support.
  • cpuuse/cpuuse.c: Add config-header support.
  • devnull/devnull.c: Add config-header support.
  • dummy/dummy.c: Add config-header support.
  • dumpbuf/dumpbuf.c: Add config-header support.
  • monitor/mon-command.c: Add config-header support.
  • monitor/mon-config.c: Add config-header support.
  • monitor/mon-dname.c: Add config-header support.
  • monitor/mon-driver.c: Add config-header support.
  • monitor/mon-extension.c: Add config-header support.
  • monitor/mon-itask.c: Add config-header support.
  • monitor/mon-manager.c: Add config-header support.
  • monitor/mon-monitor.c: Add config-header support.
  • monitor/mon-mpci.c: Add config-header support.
  • monitor/mon-object.c: Add config-header support.
  • monitor/mon-prmisc.c: Add config-header support.
  • monitor/mon-queue.c: Add config-header support.
  • monitor/mon-server.c: Add config-header support.
  • monitor/mon-symbols.c: Add config-header support.
  • monitor/mon-task.c: Add config-header support.
  • mw-fb/mw_fb.c: Add config-header support.
  • mw-fb/mw_uid.c: Add config-header support.
  • rtmonuse/rtmonuse.c: Add config-header support.
  • serdbg/serdbg.c: Add config-header support.
  • serdbg/serdbgio.c: Add config-header support.
  • serdbg/termios_printk.c: Add config-header support.
  • shell/cmds.c: Add config-header support.
  • stackchk/check.c: Add config-header support.
  • untar/untar.c: Add config-header support.
  • Property mode set to 100644
File size: 4.0 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
34#define DATACOL 15
35#define CONTCOL DATACOL         /* continued col */
36
37
38void
39rtems_monitor_driver_canonical(
40    rtems_monitor_driver_t *canonical_driver,
41    void                   *driver_void
42)
43{
44    rtems_driver_address_table *d = (rtems_driver_address_table *) driver_void;
45
46    rtems_monitor_symbol_canonical_by_value(&canonical_driver->initialization,
47                                            (void *) d->initialization_entry);
48
49    rtems_monitor_symbol_canonical_by_value(&canonical_driver->open,
50                                            (void *) d->open_entry);
51    rtems_monitor_symbol_canonical_by_value(&canonical_driver->close,
52                                            (void *) d->close_entry);
53    rtems_monitor_symbol_canonical_by_value(&canonical_driver->read,
54                                            (void *) d->read_entry);
55    rtems_monitor_symbol_canonical_by_value(&canonical_driver->write,
56                                            (void *) d->write_entry);
57    rtems_monitor_symbol_canonical_by_value(&canonical_driver->control,
58                                            (void *) d->control_entry);
59}
60
61
62void *
63rtems_monitor_driver_next(
64    void                  *object_info,
65    rtems_monitor_driver_t *canonical_driver,
66    rtems_id              *next_id
67)
68{
69    rtems_configuration_table *c = _Configuration_Table;
70    rtems_unsigned32 n = rtems_get_index(*next_id);
71
72    if (n >= c->number_of_device_drivers)
73        goto failed;
74   
75    _Thread_Disable_dispatch();
76
77    /*
78     * dummy up a fake id and name for this item
79     */
80
81    canonical_driver->id = n;
82    canonical_driver->name = rtems_build_name('-', '-', '-', '-');
83
84    *next_id += 1;
85    return (void *) (c->Device_driver_table + n);
86
87failed:
88    *next_id = RTEMS_OBJECT_ID_FINAL;
89    return 0;
90}
91
92
93void
94rtems_monitor_driver_dump_header(
95    boolean verbose
96)
97{
98    printf("\
99  Major      Entry points\n");
100/*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
1010         1         2         3         4         5         6         7       */
102    rtems_monitor_separator();
103}
104
105void
106rtems_monitor_driver_dump(
107    rtems_monitor_driver_t *monitor_driver,
108    boolean                 verbose
109)
110{
111    unsigned32          length = 0;
112
113    length += printf("  %d", monitor_driver->id);
114
115    length += rtems_monitor_pad(13, length);
116    length += printf("init: ");
117    length += rtems_monitor_symbol_dump(&monitor_driver->initialization, verbose);
118    length += printf(";  control: ");
119    length += rtems_monitor_symbol_dump(&monitor_driver->control, verbose);
120    length += printf("\n");
121    length = 0;
122
123    length += rtems_monitor_pad(13, length);
124
125    length += printf("open: ");
126    length += rtems_monitor_symbol_dump(&monitor_driver->open, verbose);
127    length += printf(";  close: ");
128    length += rtems_monitor_symbol_dump(&monitor_driver->close, verbose);
129    length += printf("\n");
130    length = 0;
131
132    length += rtems_monitor_pad(13, length);
133
134    length += printf("read: ");
135    length += rtems_monitor_symbol_dump(&monitor_driver->read, verbose);
136    length += printf(";  write: ");
137    length += rtems_monitor_symbol_dump(&monitor_driver->write, verbose);
138    length += printf("\n");
139    length = 0;
140}
Note: See TracBrowser for help on using the repository browser.