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

4.104.115
Last change on this file since cd8b8c3 was cd8b8c3, checked in by Ralf Corsepius <ralf.corsepius@…>, on 02/05/09 at 04:53:51

Move extern "C" brace after includes.

  • Property mode set to 100644
File size: 5.9 KB
RevLine 
[b96254f]1/**
2 * @file rtems/io.h
[ac7d5ef0]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
[b96254f]17 */
18 
19/*
[790b50b]20 *  COPYRIGHT (c) 1989-2008.
[ac7d5ef0]21 *  On-Line Applications Research Corporation (OAR).
22 *
[98e4ebf5]23 *  The license and distribution terms for this file may be
24 *  found in the file LICENSE in this distribution or at
[2ba508b]25 *  http://www.rtems.com/license/LICENSE.
[ac7d5ef0]26 *
27 *  $Id$
28 */
29
[092f142a]30#ifndef _RTEMS_IO_H
31#define _RTEMS_IO_H
[ac7d5ef0]32
[9c556023]33#ifndef SAPI_IO_EXTERN
34#define SAPI_IO_EXTERN extern
35#endif
36
[cd8b8c3]37#include <rtems/rtems/status.h>
38
[ac7d5ef0]39#ifdef __cplusplus
40extern "C" {
41#endif
42
43/*
[3a4ae6c]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.
[ac7d5ef0]53 */
[8486081]54
[8bd41178]55typedef uint32_t   rtems_device_major_number;
56typedef uint32_t   rtems_device_minor_number;
[8486081]57
[3a4ae6c]58typedef rtems_status_code rtems_device_driver;
[8486081]59
[3a4ae6c]60typedef rtems_device_driver ( *rtems_device_driver_entry )(
61                 rtems_device_major_number,
62                 rtems_device_minor_number,
63                 void *
64             );
[ac7d5ef0]65
[3a4ae6c]66typedef struct {
[2e61938]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 */
[3a4ae6c]73}   rtems_driver_address_table;
[8486081]74
[ac7d5ef0]75/*
[b06e68ef]76 * Table for the io device names
[ac7d5ef0]77 */
78
[b06e68ef]79typedef struct {
80    char                     *device_name;
[52399be]81    size_t                    device_name_length;
[b06e68ef]82    rtems_device_major_number major;
83    rtems_device_minor_number minor;
84} rtems_driver_name_t;
85
[3a4ae6c]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 */
[b06e68ef]94
[9c556023]95SAPI_IO_EXTERN uint32_t                    _IO_Number_of_drivers;
96SAPI_IO_EXTERN rtems_driver_address_table *_IO_Driver_address_table;
[ac7d5ef0]97
98/*
99 *  _IO_Manager_initialization
100 *
101 *  DESCRIPTION:
102 *
103 *  This routine performs the initialization necessary for this manager.
104 */
105
[790b50b]106void _IO_Manager_initialization(void);
[ac7d5ef0]107
[059a3714]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,
[bf95ccb5]119    const rtems_driver_address_table *driver_table,
[059a3714]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
[b06e68ef]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(
[b3444695]146    const char                *device_name,
[c4808ca]147    rtems_device_major_number  major,
148    rtems_device_minor_number  minor
[b06e68ef]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(
[c4808ca]161    const char           *name,
[590cae7]162    rtems_driver_name_t  *device_info
[b06e68ef]163);
164
165
[ac7d5ef0]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,
[c4808ca]178  void                      *argument
[ac7d5ef0]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,
[c4808ca]193  void                      *argument
[ac7d5ef0]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,
[c4808ca]208  void                      *argument
[ac7d5ef0]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,
[c4808ca]223  void                      *argument
[ac7d5ef0]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,
[c4808ca]238  void                      *argument
[ac7d5ef0]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,
[c4808ca]253  void                      *argument
[ac7d5ef0]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.