source: rtems/c/src/lib/libmisc/monitor/mon-dname.c @ 8bdcfc4

4.104.114.84.95
Last change on this file since 8bdcfc4 was 3a4ae6c, checked in by Joel Sherrill <joel.sherrill@…>, on Sep 11, 1995 at 7:35:39 PM

The word "RTEMS" almost completely removed from the core.

Configuration Table Template file added and all tests
modified to use this. All gvar.h and conftbl.h files
removed from test directories.

Configuration parameter maximum_devices added.

Core semaphore and mutex handlers added and RTEMS API Semaphore
Manager updated to reflect this.

Initialization sequence changed to invoke API specific initialization
routines. Initialization tasks table now owned by RTEMS Tasks Manager.

Added user extension for post-switch.

Utilized user extensions to implement API specific functionality
like signal dispatching.

Added extensions to the System Initialization Thread so that an
API can register a function to be invoked while the system
is being initialized. These are largely equivalent to the
pre-driver and post-driver hooks.

Added the Modules file oar-go32_p5, modified oar-go32, and modified
the file make/custom/go32.cfg to look at an environment varable which
determines what CPU model is being used.

All BSPs updated to reflect named devices and clock driver's IOCTL
used by the Shared Memory Driver. Also merged clock isr into
main file and removed ckisr.c where possible.

Updated spsize to reflect new and moved variables.

Makefiles for the executive source and include files updated to show
break down of files into Core, RTEMS API, and Neither.

Header and inline files installed into subdirectory based on whether
logically in the Core or a part of the RTEMS API.

  • Property mode set to 100644
File size: 2.8 KB
Line 
1/*
2 *      @(#)dname.c     1.3 - 95/07/31
3 *     
4 *
5 * RTEMS monitor driver names support.
6 *
7 * There are 2 "driver" things the monitor knows about.
8 *
9 *    1. Regular RTEMS drivers.
10 *         This is a table indexed by major device number and
11 *         containing driver entry points only.
12 *
13 *    2. Driver name table.
14 *         A separate table of names for drivers.
15 *         The table converts driver names to a major number
16 *         as index into the driver table and a minor number
17 *         for an argument to driver.
18 *
19 *  Drivers are displayed with 'driver' command.
20 *  Names are displayed with 'dname' command.
21 *
22 *  $Id$
23 */
24
25#include <rtems.h>
26
27#include "monitor.h"
28
29#include <stdio.h>
30#include <stdlib.h>             /* strtoul() */
31#include <string.h>             /* strncpy() */
32
33#define DATACOL 15
34#define CONTCOL DATACOL         /* continued col */
35
36void
37rtems_monitor_dname_canonical(
38    rtems_monitor_dname_t  *canonical_dname,
39    void                  *dname_void
40)
41{
42    rtems_driver_name_t    *np = (rtems_driver_name_t *) dname_void;
43
44    (void) strncpy(canonical_dname->name_string, np->device_name, sizeof(canonical_dname->name_string));
45    canonical_dname->major = np->major;
46    canonical_dname->minor = np->minor;
47}   
48
49void *
50rtems_monitor_dname_next(
51    void                   *object_information,
52    rtems_monitor_dname_t  *canonical_dname,
53    rtems_id               *next_id
54)
55{
56    int n = rtems_get_index(*next_id);
57    rtems_driver_name_t    *table = object_information;
58    rtems_driver_name_t    *np = 0;
59
60/* XXX should we be using _IO_Number_of_devices */
61    for (np = table + n ; n<_IO_Number_of_devices; n++, np++)
62        if (np->device_name)
63            goto done;
64   
65    *next_id = RTEMS_OBJECT_ID_FINAL;
66    return 0;
67
68done:
69    _Thread_Disable_dispatch();
70
71    /*
72     * dummy up a fake id and name for this item
73     */
74
75    canonical_dname->id = n;
76    canonical_dname->name = rtems_build_name('-', '-', '-', '-');
77
78    *next_id += 1;
79    return np;
80}   
81
82void
83rtems_monitor_dname_dump_header(
84    boolean verbose
85)
86{
87    printf("\
88  Major:Minor   Name\n");
89/*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
900         1         2         3         4         5         6         7       */
91    rtems_monitor_separator();
92}
93
94void
95rtems_monitor_dname_dump(
96    rtems_monitor_dname_t *monitor_dname,
97    boolean                 verbose
98)
99{
100    unsigned32             length = 0;
101
102    length += rtems_monitor_pad(6, length);
103    length += rtems_monitor_dump_hex(monitor_dname->major);
104    length += printf(":");
105    length += rtems_monitor_dump_hex(monitor_dname->minor);
106
107    length += rtems_monitor_pad(16, length);
108    length += printf("%.*s",
109                     (int) sizeof(monitor_dname->name_string),
110                     (char *) monitor_dname->name_string);
111
112    length += printf("\n");
113    length = 0;
114}
Note: See TracBrowser for help on using the repository browser.