|
|
1.1 root 1: /*
2: * Mach Operating System
3: * Copyright (c) 1993,1991,1990,1989 Carnegie Mellon University
4: * All Rights Reserved.
5: *
6: * Permission to use, copy, modify and distribute this software and its
7: * documentation is hereby granted, provided that both the copyright
8: * notice and this permission notice appear in all copies of the
9: * software, derivative works or modified versions, and any portions
10: * thereof, and that both notices appear in supporting documentation.
11: *
12: * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
13: * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
14: * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
15: *
16: * Carnegie Mellon requests users of this software to return to
17: *
18: * Software Distribution Coordinator or [email protected]
19: * School of Computer Science
20: * Carnegie Mellon University
21: * Pittsburgh PA 15213-3890
22: *
23: * any improvements or extensions that they make and grant Carnegie Mellon
24: * the rights to redistribute these changes.
25: */
26: /*
27: * Author: David B. Golub, Carnegie Mellon University
28: * Date: 8/88
29: */
30:
31: #ifndef _DEVICE_CONF_H_
32: #define _DEVICE_CONF_H_
33:
34: #include <mach/machine/vm_types.h>
1.1.1.3 ! root 35: #include <sys/types.h>
! 36: #include <mach/port.h>
! 37: #include <mach/vm_prot.h>
! 38:
! 39: struct io_req;
! 40: typedef struct io_req *io_req_t;
! 41:
! 42: typedef int io_return_t;
1.1 root 43:
44: /*
45: * Operations list for major device types.
46: */
47: struct dev_ops {
1.1.1.3 ! root 48: char * d_name; /* name for major device */
! 49: int (*d_open)(dev_t, int, io_req_t);/* open device */
! 50: void (*d_close)(dev_t, int); /* close device */
! 51: int (*d_read)(dev_t, io_req_t); /* read */
! 52: int (*d_write)(dev_t, io_req_t); /* write */
! 53: int (*d_getstat)(dev_t, int, int *, natural_t *); /* get status/control */
! 54: int (*d_setstat)(dev_t, int, int *, natural_t); /* set status/control */
! 55: int (*d_mmap)(dev_t, vm_offset_t, vm_prot_t); /* map memory */
! 56: int (*d_async_in)(); /* asynchronous input setup */
! 57: int (*d_reset)(); /* reset device */
! 58: int (*d_port_death)(dev_t, mach_port_t);
1.1 root 59: /* clean up reply ports */
60: int d_subdev; /* number of sub-devices per
61: unit */
62: int (*d_dev_info)(); /* driver info for kernel */
63: };
64: typedef struct dev_ops *dev_ops_t;
65:
66: /*
67: * Routines for null entries.
68: */
1.1.1.3 ! root 69: extern int nulldev(void); /* no operation - OK */
! 70: extern int nulldev_open(dev_t dev, int flag, io_req_t ior);
! 71: extern void nulldev_close(dev_t dev, int flags);
! 72: extern int nulldev_read(dev_t dev, io_req_t ior);
! 73: extern int nulldev_write(dev_t dev, io_req_t ior);
! 74: extern io_return_t nulldev_getstat(dev_t dev, int flavor, int *data, natural_t *count);
! 75: extern io_return_t nulldev_setstat(dev_t dev, int flavor, int *data, natural_t count);
! 76: extern io_return_t nulldev_portdeath(dev_t dev, mach_port_t port);
! 77: extern int nodev(void); /* no operation - error */
! 78: extern int nomap(dev_t dev, vm_offset_t off, int prot); /* no operation - error */
1.1 root 79:
80: /*
81: * Flavor constants for d_dev_info routine
82: */
83: #define D_INFO_BLOCK_SIZE 1
84:
85: /*
86: * Head of list of attached devices
87: */
88: extern struct dev_ops dev_name_list[];
89: extern int dev_name_count;
90:
91: /*
92: * Macro to search device list
93: */
94: #define dev_search(dp) \
95: for (dp = dev_name_list; \
96: dp < &dev_name_list[dev_name_count]; \
97: dp++)
98:
99: /*
100: * Indirection vectors for certain devices.
101: */
102: struct dev_indirect {
103: char * d_name; /* name for device */
104: dev_ops_t d_ops; /* operations (major device) */
105: int d_unit; /* and unit number */
106: };
107: typedef struct dev_indirect *dev_indirect_t;
108:
109: /*
110: * List of indirect devices.
111: */
112: extern struct dev_indirect dev_indirect_list[];
113: extern int dev_indirect_count;
114:
115: /*
116: * Macro to search indirect list
117: */
118: #define dev_indirect_search(di) \
119: for (di = dev_indirect_list; \
120: di < &dev_indirect_list[dev_indirect_count]; \
121: di++)
122:
123: #endif /* _DEVICE_CONF_H_ */
124:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.