OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [libmisc/] [monitor/] [mon-driver.c] - Blame information for rev 173

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*
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: mon-driver.c,v 1.2 2001-09-27 12:01:43 chris Exp $
20
 */
21
 
22
#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__
23
#include <rtems.h>
24
 
25
#include <rtems/monitor.h>
26
 
27
#include <stdio.h>
28
#include <stdlib.h>             /* strtoul() */
29
 
30
#define DATACOL 15
31
#define CONTCOL DATACOL         /* continued col */
32
 
33
 
34
void
35
rtems_monitor_driver_canonical(
36
    rtems_monitor_driver_t *canonical_driver,
37
    void                   *driver_void
38
)
39
{
40
    rtems_driver_address_table *d = (rtems_driver_address_table *) driver_void;
41
 
42
    rtems_monitor_symbol_canonical_by_value(&canonical_driver->initialization,
43
                                            (void *) d->initialization);
44
 
45
    rtems_monitor_symbol_canonical_by_value(&canonical_driver->open,
46
                                            (void *) d->open);
47
    rtems_monitor_symbol_canonical_by_value(&canonical_driver->close,
48
                                            (void *) d->close);
49
    rtems_monitor_symbol_canonical_by_value(&canonical_driver->read,
50
                                            (void *) d->read);
51
    rtems_monitor_symbol_canonical_by_value(&canonical_driver->write,
52
                                            (void *) d->write);
53
    rtems_monitor_symbol_canonical_by_value(&canonical_driver->control,
54
                                            (void *) d->control);
55
}
56
 
57
 
58
void *
59
rtems_monitor_driver_next(
60
    void                  *object_info,
61
    rtems_monitor_driver_t *canonical_driver,
62
    rtems_id              *next_id
63
)
64
{
65
    rtems_configuration_table *c = _Configuration_Table;
66
    rtems_unsigned32 n = rtems_get_index(*next_id);
67
 
68
    if (n >= c->number_of_device_drivers)
69
        goto failed;
70
 
71
    _Thread_Disable_dispatch();
72
 
73
    /*
74
     * dummy up a fake id and name for this item
75
     */
76
 
77
    canonical_driver->id = n;
78
    canonical_driver->name = rtems_build_name('-', '-', '-', '-');
79
 
80
    *next_id += 1;
81
    return (void *) (c->Device_driver_table + n);
82
 
83
failed:
84
    *next_id = RTEMS_OBJECT_ID_FINAL;
85
    return 0;
86
}
87
 
88
 
89
void
90
rtems_monitor_driver_dump_header(
91
    boolean verbose
92
)
93
{
94
    printf("\
95
  Major      Entry points\n");
96
/*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
97
 
98
    rtems_monitor_separator();
99
}
100
 
101
void
102
rtems_monitor_driver_dump(
103
    rtems_monitor_driver_t *monitor_driver,
104
    boolean                 verbose
105
)
106
{
107
    unsigned32          length = 0;
108
 
109
    length += printf("  %d", monitor_driver->id);
110
 
111
    length += rtems_monitor_pad(13, length);
112
    length += printf("init: ");
113
    length += rtems_monitor_symbol_dump(&monitor_driver->initialization, verbose);
114
    length += printf(";  control: ");
115
    length += rtems_monitor_symbol_dump(&monitor_driver->control, verbose);
116
    length += printf("\n");
117
    length = 0;
118
 
119
    length += rtems_monitor_pad(13, length);
120
 
121
    length += printf("open: ");
122
    length += rtems_monitor_symbol_dump(&monitor_driver->open, verbose);
123
    length += printf(";  close: ");
124
    length += rtems_monitor_symbol_dump(&monitor_driver->close, verbose);
125
    length += printf("\n");
126
    length = 0;
127
 
128
    length += rtems_monitor_pad(13, length);
129
 
130
    length += printf("read: ");
131
    length += rtems_monitor_symbol_dump(&monitor_driver->read, verbose);
132
    length += printf(";  write: ");
133
    length += rtems_monitor_symbol_dump(&monitor_driver->write, verbose);
134
    length += printf("\n");
135
    length = 0;
136
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.