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

4.104.114.95
Last change on this file since bf95ccb5 was bf95ccb5, checked in by Thomas Doerfler <Thomas.Doerfler@…>, on 05/27/08 at 10:34:15

Added const qualifier to various pointers and data tables to

reduce size of data area.
IMFS: Fixed creation of symbolic links to avoid a compiler warning.
DOSFS: Use LibBlock? instead of read() to read the boot record.

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