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

Last change on this file since 59e7209f was 59e7209f, checked in by Sebastian Huber <sebastian.huber@…>, on Nov 16, 2018 at 6:06:12 AM

score: Remove support for RTEMS_USE_16_BIT_OBJECT

The RTEMS_USE_16_BIT_OBJECT define is not set by an RTEMS port. Remove
support for 16-bit object identifiers. If someone really wants to use
RTEMS on a 16-bit target, then it is better to use self-contained
objects instead of playing around with object identifier optimizations.

Update #3603.

  • 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
20#ifdef HAVE_CONFIG_H
21#include "config.h"
22#endif
23
24#include <rtems.h>
25#include <rtems/ioimpl.h>
26#include <rtems/monitor.h>
27
28#include <stdio.h>
29#include <stdlib.h>             /* strtoul() */
30#include <inttypes.h>
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    const void             *driver_void
40)
41{
42    const rtems_driver_address_table *d = (const rtems_driver_address_table *) driver_void;
43
44    rtems_monitor_symbol_canonical_by_value(&canonical_driver->initialization,
45                                            (void *) d->initialization_entry);
46
47    rtems_monitor_symbol_canonical_by_value(&canonical_driver->open,
48                                            (void *) d->open_entry);
49    rtems_monitor_symbol_canonical_by_value(&canonical_driver->close,
50                                            (void *) d->close_entry);
51    rtems_monitor_symbol_canonical_by_value(&canonical_driver->read,
52                                            (void *) d->read_entry);
53    rtems_monitor_symbol_canonical_by_value(&canonical_driver->write,
54                                            (void *) d->write_entry);
55    rtems_monitor_symbol_canonical_by_value(&canonical_driver->control,
56                                            (void *) d->control_entry);
57}
58
59
60const void *
61rtems_monitor_driver_next(
62    void                  *object_info RTEMS_UNUSED,
63    rtems_monitor_driver_t *canonical_driver,
64    rtems_id              *next_id
65)
66{
67    uint32_t   n = rtems_object_id_get_index(*next_id);
68
69    if (n >= _IO_Number_of_drivers)
70        goto failed;
71
72    _Objects_Allocator_lock();
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;
82    return (const void *) (&_IO_Driver_address_table[n]);
83
84failed:
85    *next_id = RTEMS_OBJECT_ID_FINAL;
86    return 0;
87}
88
89
90void
91rtems_monitor_driver_dump_header(
92    bool verbose RTEMS_UNUSED
93)
94{
95    fprintf(stdout,"\
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,
105    bool                    verbose
106)
107{
108    uint32_t            length = 0;
109
110    length += fprintf(stdout,"  %" PRId32 "", monitor_driver->id);
111    length += rtems_monitor_pad(13, length);
112    length += fprintf(stdout,"init: ");
113    length += rtems_monitor_symbol_dump(&monitor_driver->initialization, verbose);
114    length += fprintf(stdout,";  control: ");
115    length += rtems_monitor_symbol_dump(&monitor_driver->control, verbose);
116    length += fprintf(stdout,"\n");
117    length = 0;
118
119    length += rtems_monitor_pad(13, length);
120
121    length += fprintf(stdout,"open: ");
122    length += rtems_monitor_symbol_dump(&monitor_driver->open, verbose);
123    length += fprintf(stdout,";  close: ");
124    length += rtems_monitor_symbol_dump(&monitor_driver->close, verbose);
125    length += fprintf(stdout,"\n");
126    length = 0;
127
128    length += rtems_monitor_pad(13, length);
129
130    length += fprintf(stdout,"read: ");
131    length += rtems_monitor_symbol_dump(&monitor_driver->read, verbose);
132    length += fprintf(stdout,";  write: ");
133    length += rtems_monitor_symbol_dump(&monitor_driver->write, verbose);
134    length += fprintf(stdout,"\n");
135    length = 0;
136}
Note: See TracBrowser for help on using the repository browser.