1 | /* io.h |
---|
2 | * |
---|
3 | * This include file contains all the constants and structures associated |
---|
4 | * with the Input/Output Manager. This manager provides a well defined |
---|
5 | * mechanism for accessing device drivers and a structured methodology for |
---|
6 | * organizing device drivers. |
---|
7 | * |
---|
8 | * Directives provided are: |
---|
9 | * |
---|
10 | * + initialize a device driver |
---|
11 | * + open a device driver |
---|
12 | * + close a device driver |
---|
13 | * + read from a device driver |
---|
14 | * + write to a device driver |
---|
15 | * + special device services |
---|
16 | * |
---|
17 | * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. |
---|
18 | * On-Line Applications Research Corporation (OAR). |
---|
19 | * All rights assigned to U.S. Government, 1994. |
---|
20 | * |
---|
21 | * This material may be reproduced by or for the U.S. Government pursuant |
---|
22 | * to the copyright license under the clause at DFARS 252.227-7013. This |
---|
23 | * notice must appear in all copies of this file and its derivatives. |
---|
24 | * |
---|
25 | * $Id$ |
---|
26 | */ |
---|
27 | |
---|
28 | #ifndef __RTEMS_IO_h |
---|
29 | #define __RTEMS_IO_h |
---|
30 | |
---|
31 | #ifdef __cplusplus |
---|
32 | extern "C" { |
---|
33 | #endif |
---|
34 | |
---|
35 | #include <rtems/config.h> |
---|
36 | |
---|
37 | /* |
---|
38 | * The following declare the data required to manage the Device Driver |
---|
39 | * Address Table. |
---|
40 | */ |
---|
41 | |
---|
42 | EXTERN unsigned32 _IO_Number_of_drivers; |
---|
43 | EXTERN rtems_driver_address_table *_IO_Driver_address_table; |
---|
44 | |
---|
45 | /* |
---|
46 | * Table for the io device names |
---|
47 | */ |
---|
48 | |
---|
49 | typedef struct { |
---|
50 | char *device_name; |
---|
51 | unsigned32 device_name_length; |
---|
52 | rtems_device_major_number major; |
---|
53 | rtems_device_minor_number minor; |
---|
54 | } rtems_driver_name_t; |
---|
55 | |
---|
56 | /*XXX this really should be allocated some better way... */ |
---|
57 | /*XXX it should probably be a chain and use a 'maximum' drivers field |
---|
58 | * in config table */ |
---|
59 | #define RTEMS_MAX_DRIVER_NAMES 20 |
---|
60 | EXTERN rtems_driver_name_t rtems_driver_name_table[RTEMS_MAX_DRIVER_NAMES]; |
---|
61 | |
---|
62 | |
---|
63 | /* |
---|
64 | * _IO_Manager_initialization |
---|
65 | * |
---|
66 | * DESCRIPTION: |
---|
67 | * |
---|
68 | * This routine performs the initialization necessary for this manager. |
---|
69 | */ |
---|
70 | |
---|
71 | STATIC INLINE void _IO_Manager_initialization( |
---|
72 | rtems_driver_address_table *driver_table, |
---|
73 | unsigned32 number_of_drivers |
---|
74 | ); |
---|
75 | |
---|
76 | /* |
---|
77 | * rtems_io_register_name |
---|
78 | * |
---|
79 | * DESCRIPTION: |
---|
80 | * |
---|
81 | * Associate a name with a driver. |
---|
82 | * |
---|
83 | */ |
---|
84 | |
---|
85 | rtems_status_code rtems_io_register_name( |
---|
86 | char *device_name, |
---|
87 | rtems_device_major_number major, |
---|
88 | rtems_device_minor_number minor |
---|
89 | ); |
---|
90 | |
---|
91 | |
---|
92 | /* |
---|
93 | * rtems_io_lookup_name |
---|
94 | * |
---|
95 | * DESCRIPTION: |
---|
96 | * |
---|
97 | * Find what driver "owns" this name |
---|
98 | */ |
---|
99 | |
---|
100 | rtems_status_code rtems_io_lookup_name( |
---|
101 | const char *pathname, |
---|
102 | rtems_driver_name_t **rnp |
---|
103 | ); |
---|
104 | |
---|
105 | |
---|
106 | /* |
---|
107 | * rtems_io_initialize |
---|
108 | * |
---|
109 | * DESCRIPTION: |
---|
110 | * |
---|
111 | * This routine implements the rtems_io_initialize directive. It is invoked |
---|
112 | * to initialize a device driver or an individual device. |
---|
113 | */ |
---|
114 | |
---|
115 | rtems_status_code rtems_io_initialize( |
---|
116 | rtems_device_major_number major, |
---|
117 | rtems_device_minor_number minor, |
---|
118 | void *argument |
---|
119 | ); |
---|
120 | |
---|
121 | /* |
---|
122 | * rtems_io_open |
---|
123 | * |
---|
124 | * DESCRIPTION: |
---|
125 | * |
---|
126 | * This routine implements the rtems_io_open directive. It is invoked |
---|
127 | * to open a device. |
---|
128 | */ |
---|
129 | |
---|
130 | rtems_status_code rtems_io_open( |
---|
131 | rtems_device_major_number major, |
---|
132 | rtems_device_minor_number minor, |
---|
133 | void *argument |
---|
134 | ); |
---|
135 | |
---|
136 | /* |
---|
137 | * rtems_io_close |
---|
138 | * |
---|
139 | * DESCRIPTION: |
---|
140 | * |
---|
141 | * This routine implements the rtems_io_close directive. It is invoked |
---|
142 | * to close a device. |
---|
143 | */ |
---|
144 | |
---|
145 | rtems_status_code rtems_io_close( |
---|
146 | rtems_device_major_number major, |
---|
147 | rtems_device_minor_number minor, |
---|
148 | void *argument |
---|
149 | ); |
---|
150 | |
---|
151 | /* |
---|
152 | * rtems_io_read |
---|
153 | * |
---|
154 | * DESCRIPTION: |
---|
155 | * |
---|
156 | * This routine implements the rtems_io_read directive. It is invoked |
---|
157 | * to read from a device. |
---|
158 | */ |
---|
159 | |
---|
160 | rtems_status_code rtems_io_read( |
---|
161 | rtems_device_major_number major, |
---|
162 | rtems_device_minor_number minor, |
---|
163 | void *argument |
---|
164 | ); |
---|
165 | |
---|
166 | /* |
---|
167 | * rtems_io_write |
---|
168 | * |
---|
169 | * DESCRIPTION: |
---|
170 | * |
---|
171 | * This routine implements the rtems_io_write directive. It is invoked |
---|
172 | * to write to a device. |
---|
173 | */ |
---|
174 | |
---|
175 | rtems_status_code rtems_io_write( |
---|
176 | rtems_device_major_number major, |
---|
177 | rtems_device_minor_number minor, |
---|
178 | void *argument |
---|
179 | ); |
---|
180 | |
---|
181 | /* |
---|
182 | * rtems_io_control |
---|
183 | * |
---|
184 | * DESCRIPTION: |
---|
185 | * |
---|
186 | * This routine implements the rtems_io_control directive. It is invoked |
---|
187 | * to perform a device specific operation on a device. |
---|
188 | */ |
---|
189 | |
---|
190 | rtems_status_code rtems_io_control( |
---|
191 | rtems_device_major_number major, |
---|
192 | rtems_device_minor_number minor, |
---|
193 | void *argument |
---|
194 | ); |
---|
195 | |
---|
196 | /* |
---|
197 | * _IO_Initialize_all_drivers |
---|
198 | * |
---|
199 | * DESCRIPTION: |
---|
200 | * |
---|
201 | * This routine initializes all of the device drivers configured |
---|
202 | * in the Device Driver Address Table. |
---|
203 | */ |
---|
204 | |
---|
205 | void _IO_Initialize_all_drivers( void ); |
---|
206 | |
---|
207 | #include <rtems/io.inl> |
---|
208 | |
---|
209 | #ifdef __cplusplus |
---|
210 | } |
---|
211 | #endif |
---|
212 | |
---|
213 | #endif |
---|
214 | /* end of include file */ |
---|