source: rtems/cpukit/sapi/include/rtems/io.h @ 8486081

4.104.114.84.95
Last change on this file since 8486081 was 8486081, checked in by Ralf Corsepius <ralf.corsepius@…>, on 04/16/04 at 11:54:29

Remove stray white spaces.

  • Property mode set to 100644
File size: 6.1 KB
Line 
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-1999.
18 *  On-Line Applications Research Corporation (OAR).
19 *
20 *  The license and distribution terms for this file may be
21 *  found in the file LICENSE in this distribution or at
22 *  http://www.rtems.com/license/LICENSE.
23 *
24 *  $Id$
25 */
26
27#ifndef __RTEMS_IO_h
28#define __RTEMS_IO_h
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#include <rtems/rtems/status.h>
35
36/*
37 *
38 *  The following defines the types for:
39 *
40 *    + major and minor numbers
41 *    + the return type of a device driver entry
42 *    + a pointer to a device driver entry
43 *    + an entry in the the Device Driver Address Table.  Each entry in this
44 *      table corresponds to an application provided device driver and
45 *      defines the entry points for that device driver.
46 */
47
48typedef uint32_t   rtems_device_major_number;
49typedef uint32_t   rtems_device_minor_number;
50
51typedef rtems_status_code rtems_device_driver;
52
53typedef rtems_device_driver ( *rtems_device_driver_entry )(
54                 rtems_device_major_number,
55                 rtems_device_minor_number,
56                 void *
57             );
58
59typedef struct {
60  rtems_device_driver_entry initialization_entry; /* initialization procedure */
61  rtems_device_driver_entry open_entry;        /* open request procedure */
62  rtems_device_driver_entry close_entry;       /* close request procedure */
63  rtems_device_driver_entry read_entry;        /* read request procedure */
64  rtems_device_driver_entry write_entry;       /* write request procedure */
65  rtems_device_driver_entry control_entry;     /* special functions procedure */
66}   rtems_driver_address_table;
67
68/*
69 * Table for the io device names
70 */
71
72typedef struct {
73    char                     *device_name;
74    uint32_t                  device_name_length;
75    rtems_device_major_number major;
76    rtems_device_minor_number minor;
77} rtems_driver_name_t;
78
79/*
80 *  This is the table of device names.
81 */
82
83/*
84 *  The following declare the data required to manage the Driver
85 *  Address Table and Device Name Table.
86 */
87
88SAPI_EXTERN uint32_t                    _IO_Number_of_drivers;
89SAPI_EXTERN rtems_driver_address_table *_IO_Driver_address_table;
90SAPI_EXTERN uint32_t                    _IO_Number_of_devices;
91SAPI_EXTERN rtems_driver_name_t        *_IO_Driver_name_table;
92
93/*
94 *  _IO_Manager_initialization
95 *
96 *  DESCRIPTION:
97 *
98 *  This routine performs the initialization necessary for this manager.
99 */
100
101void _IO_Manager_initialization(
102  rtems_driver_address_table *driver_table,
103  uint32_t                    drivers_in_table,
104  uint32_t                    number_of_drivers,
105  uint32_t                    number_of_devices
106);
107
108/*
109 *  rtems_io_register_driver
110 *
111 *  DESCRIPTION:
112 *
113 *  Register a driver into the device driver table.
114 *
115 */
116
117rtems_status_code rtems_io_register_driver(
118    rtems_device_major_number   major,
119    rtems_driver_address_table *driver_table,
120    rtems_device_major_number  *registered_major
121);
122
123/*
124 *  rtems_io_unregister_driver
125 *
126 *  DESCRIPTION:
127 *
128 *  Unregister a driver from the device driver table.
129 *
130 */
131
132rtems_status_code rtems_io_unregister_driver(
133    rtems_device_major_number major
134);
135
136/*
137 *  rtems_io_register_name
138 *
139 *  DESCRIPTION:
140 *
141 *  Associate a name with a driver.
142 *
143 */
144
145rtems_status_code rtems_io_register_name(
146    char                      *device_name,
147    rtems_device_major_number  major,
148    rtems_device_minor_number  minor
149);
150
151
152/*
153 *  rtems_io_lookup_name
154 *
155 *  DESCRIPTION:
156 *
157 *  Find what driver "owns" this name
158 */
159
160rtems_status_code rtems_io_lookup_name(
161    const char           *name,
162    rtems_driver_name_t  *device_info
163);
164
165
166/*
167 *  rtems_io_initialize
168 *
169 *  DESCRIPTION:
170 *
171 *  This routine implements the rtems_io_initialize directive.  It is invoked
172 *  to initialize a device driver or an individual device.
173 */
174
175rtems_status_code rtems_io_initialize(
176  rtems_device_major_number  major,
177  rtems_device_minor_number  minor,
178  void                      *argument
179);
180
181/*
182 *  rtems_io_open
183 *
184 *  DESCRIPTION:
185 *
186 *  This routine implements the rtems_io_open directive.  It is invoked
187 *  to open a device.
188 */
189
190rtems_status_code rtems_io_open(
191  rtems_device_major_number  major,
192  rtems_device_minor_number  minor,
193  void                      *argument
194);
195
196/*
197 *  rtems_io_close
198 *
199 *  DESCRIPTION:
200 *
201 *  This routine implements the rtems_io_close directive.  It is invoked
202 *  to close a device.
203 */
204
205rtems_status_code rtems_io_close(
206  rtems_device_major_number  major,
207  rtems_device_minor_number  minor,
208  void                      *argument
209);
210
211/*
212 *  rtems_io_read
213 *
214 *  DESCRIPTION:
215 *
216 *  This routine implements the rtems_io_read directive.  It is invoked
217 *  to read from a device.
218 */
219
220rtems_status_code rtems_io_read(
221  rtems_device_major_number  major,
222  rtems_device_minor_number  minor,
223  void                      *argument
224);
225
226/*
227 *  rtems_io_write
228 *
229 *  DESCRIPTION:
230 *
231 *  This routine implements the rtems_io_write directive.  It is invoked
232 *  to write to a device.
233 */
234
235rtems_status_code rtems_io_write(
236  rtems_device_major_number  major,
237  rtems_device_minor_number  minor,
238  void                      *argument
239);
240
241/*
242 *  rtems_io_control
243 *
244 *  DESCRIPTION:
245 *
246 *  This routine implements the rtems_io_control directive.  It is invoked
247 *  to perform a device specific operation on a device.
248 */
249
250rtems_status_code rtems_io_control(
251  rtems_device_major_number  major,
252  rtems_device_minor_number  minor,
253  void                      *argument
254);
255
256/*
257 *  _IO_Initialize_all_drivers
258 *
259 *  DESCRIPTION:
260 *
261 *  This routine initializes all of the device drivers configured
262 *  in the Device Driver Address Table.
263 */
264
265void _IO_Initialize_all_drivers( void );
266
267#ifdef __cplusplus
268}
269#endif
270
271#endif
272/* end of include file */
Note: See TracBrowser for help on using the repository browser.