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

4.115
Last change on this file since ae75429 was ae75429, checked in by Sebastian Huber <sebastian.huber@…>, on 08/06/13 at 14:10:26

PR766: Delete RTEMS_VIOLATE_KERNEL_VISIBILITY

  • Property mode set to 100644
File size: 4.2 KB
RevLine 
[b06e68ef]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
[550c3df7]20#ifdef HAVE_CONFIG_H
21#include "config.h"
22#endif
23
[b06e68ef]24#include <rtems.h>
[5beb562]25#include <rtems/monitor.h>
[b06e68ef]26
27#include <stdio.h>
28#include <stdlib.h>             /* strtoul() */
[3523321]29#include <inttypes.h>
[b06e68ef]30
31#define DATACOL 15
32#define CONTCOL DATACOL         /* continued col */
33
34
35void
36rtems_monitor_driver_canonical(
37    rtems_monitor_driver_t *canonical_driver,
[ed8be1ae]38    const void             *driver_void
[b06e68ef]39)
40{
[ed8be1ae]41    const rtems_driver_address_table *d = (const rtems_driver_address_table *) driver_void;
[b06e68ef]42
43    rtems_monitor_symbol_canonical_by_value(&canonical_driver->initialization,
[f6630d4]44                                            (void *) d->initialization_entry);
[b06e68ef]45
46    rtems_monitor_symbol_canonical_by_value(&canonical_driver->open,
[f6630d4]47                                            (void *) d->open_entry);
[b06e68ef]48    rtems_monitor_symbol_canonical_by_value(&canonical_driver->close,
[f6630d4]49                                            (void *) d->close_entry);
[b06e68ef]50    rtems_monitor_symbol_canonical_by_value(&canonical_driver->read,
[f6630d4]51                                            (void *) d->read_entry);
[b06e68ef]52    rtems_monitor_symbol_canonical_by_value(&canonical_driver->write,
[f6630d4]53                                            (void *) d->write_entry);
[b06e68ef]54    rtems_monitor_symbol_canonical_by_value(&canonical_driver->control,
[f6630d4]55                                            (void *) d->control_entry);
[b06e68ef]56}
57
58
[ed8be1ae]59const void *
[b06e68ef]60rtems_monitor_driver_next(
[031deada]61    void                  *object_info __attribute__((unused)),
[b06e68ef]62    rtems_monitor_driver_t *canonical_driver,
63    rtems_id              *next_id
64)
65{
[ed8be1ae]66    const rtems_configuration_table *c = &Configuration;
[6c06288]67    uint32_t   n = rtems_object_id_get_index(*next_id);
[b06e68ef]68
69    if (n >= c->number_of_device_drivers)
70        goto failed;
[aed742c]71
[b06e68ef]72    _Thread_Disable_dispatch();
73
74    /*
75     * dummy up a fake id and name for this item
76     */
77
78    canonical_driver->id = n;
79    canonical_driver->name = rtems_build_name('-', '-', '-', '-');
80
81    *next_id += 1;
[ed8be1ae]82    return (const void *) (c->Device_driver_table + n);
[b06e68ef]83
84failed:
85    *next_id = RTEMS_OBJECT_ID_FINAL;
86    return 0;
87}
88
89
90void
91rtems_monitor_driver_dump_header(
[031deada]92    bool verbose __attribute__((unused))
[b06e68ef]93)
94{
[714f06c]95    fprintf(stdout,"\
[b06e68ef]96  Major      Entry points\n");
97/*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
980         1         2         3         4         5         6         7       */
99    rtems_monitor_separator();
100}
101
102void
103rtems_monitor_driver_dump(
104    rtems_monitor_driver_t *monitor_driver,
[2326f0d]105    bool                    verbose
[b06e68ef]106)
107{
[3e08d4e]108    uint32_t            length = 0;
[b06e68ef]109
[7093646b]110#if defined(RTEMS_USE_16_BIT_OBJECT)
111    length += fprintf(stdout,"  %" PRId16 "", monitor_driver->id);
112#else
[3523321]113    length += fprintf(stdout,"  %" PRId32 "", monitor_driver->id);
[7093646b]114#endif
[b06e68ef]115    length += rtems_monitor_pad(13, length);
[714f06c]116    length += fprintf(stdout,"init: ");
[b06e68ef]117    length += rtems_monitor_symbol_dump(&monitor_driver->initialization, verbose);
[714f06c]118    length += fprintf(stdout,";  control: ");
[b06e68ef]119    length += rtems_monitor_symbol_dump(&monitor_driver->control, verbose);
[714f06c]120    length += fprintf(stdout,"\n");
[b06e68ef]121    length = 0;
122
123    length += rtems_monitor_pad(13, length);
124
[714f06c]125    length += fprintf(stdout,"open: ");
[b06e68ef]126    length += rtems_monitor_symbol_dump(&monitor_driver->open, verbose);
[714f06c]127    length += fprintf(stdout,";  close: ");
[b06e68ef]128    length += rtems_monitor_symbol_dump(&monitor_driver->close, verbose);
[714f06c]129    length += fprintf(stdout,"\n");
[b06e68ef]130    length = 0;
131
132    length += rtems_monitor_pad(13, length);
133
[714f06c]134    length += fprintf(stdout,"read: ");
[b06e68ef]135    length += rtems_monitor_symbol_dump(&monitor_driver->read, verbose);
[714f06c]136    length += fprintf(stdout,";  write: ");
[b06e68ef]137    length += rtems_monitor_symbol_dump(&monitor_driver->write, verbose);
[714f06c]138    length += fprintf(stdout,"\n");
[b06e68ef]139    length = 0;
140}
Note: See TracBrowser for help on using the repository browser.