source: rtems/cpukit/libmisc/monitor/mon-dname.c @ 2cc9367

4.104.114.84.95
Last change on this file since 2cc9367 was 550c3df7, checked in by Ralf Corsepius <ralf.corsepius@…>, on 07/08/03 at 08:39:16

2003-07-08 Ralf Corsepius <corsepiu@…>

  • capture/capture-cli.c: Add config-header support.
  • capture/capture.c: Add config-header support.
  • cpuuse/cpuuse.c: Add config-header support.
  • devnull/devnull.c: Add config-header support.
  • dummy/dummy.c: Add config-header support.
  • dumpbuf/dumpbuf.c: Add config-header support.
  • monitor/mon-command.c: Add config-header support.
  • monitor/mon-config.c: Add config-header support.
  • monitor/mon-dname.c: Add config-header support.
  • monitor/mon-driver.c: Add config-header support.
  • monitor/mon-extension.c: Add config-header support.
  • monitor/mon-itask.c: Add config-header support.
  • monitor/mon-manager.c: Add config-header support.
  • monitor/mon-monitor.c: Add config-header support.
  • monitor/mon-mpci.c: Add config-header support.
  • monitor/mon-object.c: Add config-header support.
  • monitor/mon-prmisc.c: Add config-header support.
  • monitor/mon-queue.c: Add config-header support.
  • monitor/mon-server.c: Add config-header support.
  • monitor/mon-symbols.c: Add config-header support.
  • monitor/mon-task.c: Add config-header support.
  • mw-fb/mw_fb.c: Add config-header support.
  • mw-fb/mw_uid.c: Add config-header support.
  • rtmonuse/rtmonuse.c: Add config-header support.
  • serdbg/serdbg.c: Add config-header support.
  • serdbg/serdbgio.c: Add config-header support.
  • serdbg/termios_printk.c: Add config-header support.
  • shell/cmds.c: Add config-header support.
  • stackchk/check.c: Add config-header support.
  • untar/untar.c: Add config-header support.
  • Property mode set to 100644
File size: 2.9 KB
Line 
1/*
2 * RTEMS monitor driver names 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 'dname' 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#include <string.h>             /* strncpy() */
34
35#define DATACOL 15
36#define CONTCOL DATACOL         /* continued col */
37
38void
39rtems_monitor_dname_canonical(
40    rtems_monitor_dname_t  *canonical_dname,
41    void                  *dname_void
42)
43{
44    rtems_driver_name_t    *np = (rtems_driver_name_t *) dname_void;
45
46    (void) strncpy(canonical_dname->name_string, np->device_name, sizeof(canonical_dname->name_string));
47    canonical_dname->major = np->major;
48    canonical_dname->minor = np->minor;
49}   
50
51void *
52rtems_monitor_dname_next(
53    void                   *object_information,
54    rtems_monitor_dname_t  *canonical_dname,
55    rtems_id               *next_id
56)
57{
58    rtems_unsigned32      n = rtems_get_index(*next_id);
59    rtems_driver_name_t  *table = _IO_Driver_name_table;
60    rtems_driver_name_t  *np = 0;
61
62/* XXX should we be using _IO_Number_of_devices */
63    for (np = table + n ; n<_IO_Number_of_devices; n++, np++)
64        if (np->device_name)
65            goto done;
66   
67    *next_id = RTEMS_OBJECT_ID_FINAL;
68    return 0;
69
70done:
71    _Thread_Disable_dispatch();
72
73    /*
74     * dummy up a fake id and name for this item
75     */
76
77    canonical_dname->id = n;
78    canonical_dname->name = rtems_build_name('-', '-', '-', '-');
79
80    *next_id += 1;
81    return np;
82}   
83
84void
85rtems_monitor_dname_dump_header(
86    boolean verbose
87)
88{
89    printf("\
90  Major:Minor   Name\n");
91/*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
920         1         2         3         4         5         6         7       */
93    rtems_monitor_separator();
94}
95
96void
97rtems_monitor_dname_dump(
98    rtems_monitor_dname_t *monitor_dname,
99    boolean                 verbose
100)
101{
102    unsigned32             length = 0;
103
104    length += rtems_monitor_pad(6, length);
105    length += rtems_monitor_dump_hex(monitor_dname->major);
106    length += printf(":");
107    length += rtems_monitor_dump_hex(monitor_dname->minor);
108
109    length += rtems_monitor_pad(16, length);
110    length += printf("%.*s",
111                     (int) sizeof(monitor_dname->name_string),
112                     (char *) monitor_dname->name_string);
113
114    length += printf("\n");
115    length = 0;
116}
Note: See TracBrowser for help on using the repository browser.