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

4.104.114.84.95
Last change on this file since f26145b was 714f06c, checked in by Ralf Corsepius <ralf.corsepius@…>, on 04/17/04 at 08:12:02

2004-04-17 Ralf Corsepius <ralf_corsepius@…>

  • libmisc/capture/capture-cli.c, libmisc/cpuuse/cpuuse.c, libmisc/dumpbuf/dumpbuf.c, libmisc/fsmount/fsmount.c, libmisc/monitor/mon-command.c, libmisc/monitor/mon-config.c, libmisc/monitor/mon-dname.c, libmisc/monitor/mon-driver.c, libmisc/monitor/mon-extension.c, libmisc/monitor/mon-itask.c, libmisc/monitor/mon-monitor.c, libmisc/monitor/mon-mpci.c, libmisc/monitor/mon-object.c, libmisc/monitor/mon-prmisc.c, libmisc/monitor/mon-queue.c, libmisc/monitor/mon-symbols.c, libmisc/monitor/mon-task.c, libmisc/rtmonuse/rtmonuse.c, libmisc/shell/cmds.c, libmisc/shell/shell.c, libmisc/shell/shell.h, libmisc/stackchk/check.c, libmisc/untar/untar.c: Use fprintf(stdout,...) instead of printf.
  • 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    uint32_t   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    fprintf(stdout,"\
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    uint32_t            length = 0;
112
113    length += fprintf(stdout,"  %d", monitor_driver->id);
114
115    length += rtems_monitor_pad(13, length);
116    length += fprintf(stdout,"init: ");
117    length += rtems_monitor_symbol_dump(&monitor_driver->initialization, verbose);
118    length += fprintf(stdout,";  control: ");
119    length += rtems_monitor_symbol_dump(&monitor_driver->control, verbose);
120    length += fprintf(stdout,"\n");
121    length = 0;
122
123    length += rtems_monitor_pad(13, length);
124
125    length += fprintf(stdout,"open: ");
126    length += rtems_monitor_symbol_dump(&monitor_driver->open, verbose);
127    length += fprintf(stdout,";  close: ");
128    length += rtems_monitor_symbol_dump(&monitor_driver->close, verbose);
129    length += fprintf(stdout,"\n");
130    length = 0;
131
132    length += rtems_monitor_pad(13, length);
133
134    length += fprintf(stdout,"read: ");
135    length += rtems_monitor_symbol_dump(&monitor_driver->read, verbose);
136    length += fprintf(stdout,";  write: ");
137    length += rtems_monitor_symbol_dump(&monitor_driver->write, verbose);
138    length += fprintf(stdout,"\n");
139    length = 0;
140}
Note: See TracBrowser for help on using the repository browser.