source: rtems/cpukit/sapi/include/rtems/io.h @ 52399be

4.104.114.84.95
Last change on this file since 52399be was 52399be, checked in by Ralf Corsepius <ralf.corsepius@…>, on 01/18/05 at 12:30:44

2005-01-18 Ralf Corsepius <ralf.corsepius@…>

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