[ac7d5ef0] | 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 | * |
---|
[08311cc3] | 17 | * COPYRIGHT (c) 1989-1999. |
---|
[ac7d5ef0] | 18 | * On-Line Applications Research Corporation (OAR). |
---|
| 19 | * |
---|
[98e4ebf5] | 20 | * The license and distribution terms for this file may be |
---|
| 21 | * found in the file LICENSE in this distribution or at |
---|
[03f2154e] | 22 | * http://www.OARcorp.com/rtems/license.html. |
---|
[ac7d5ef0] | 23 | * |
---|
| 24 | * $Id$ |
---|
| 25 | */ |
---|
| 26 | |
---|
| 27 | #ifndef __RTEMS_IO_h |
---|
| 28 | #define __RTEMS_IO_h |
---|
| 29 | |
---|
| 30 | #ifdef __cplusplus |
---|
| 31 | extern "C" { |
---|
| 32 | #endif |
---|
| 33 | |
---|
[3a4ae6c] | 34 | #include <rtems/rtems/status.h> |
---|
[ac7d5ef0] | 35 | |
---|
| 36 | /* |
---|
[3a4ae6c] | 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. |
---|
[ac7d5ef0] | 46 | */ |
---|
[3a4ae6c] | 47 | |
---|
| 48 | typedef unsigned32 rtems_device_major_number; |
---|
| 49 | typedef unsigned32 rtems_device_minor_number; |
---|
| 50 | |
---|
| 51 | typedef rtems_status_code rtems_device_driver; |
---|
| 52 | |
---|
| 53 | typedef rtems_device_driver ( *rtems_device_driver_entry )( |
---|
| 54 | rtems_device_major_number, |
---|
| 55 | rtems_device_minor_number, |
---|
| 56 | void * |
---|
| 57 | ); |
---|
[ac7d5ef0] | 58 | |
---|
[3a4ae6c] | 59 | typedef struct { |
---|
[2e61938] | 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 */ |
---|
[3a4ae6c] | 66 | } rtems_driver_address_table; |
---|
| 67 | |
---|
[ac7d5ef0] | 68 | /* |
---|
[b06e68ef] | 69 | * Table for the io device names |
---|
[ac7d5ef0] | 70 | */ |
---|
| 71 | |
---|
[b06e68ef] | 72 | typedef struct { |
---|
| 73 | char *device_name; |
---|
| 74 | unsigned32 device_name_length; |
---|
| 75 | rtems_device_major_number major; |
---|
| 76 | rtems_device_minor_number minor; |
---|
| 77 | } rtems_driver_name_t; |
---|
| 78 | |
---|
[3a4ae6c] | 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 | */ |
---|
[b06e68ef] | 87 | |
---|
[c627b2a3] | 88 | SAPI_EXTERN unsigned32 _IO_Number_of_drivers; |
---|
| 89 | SAPI_EXTERN rtems_driver_address_table *_IO_Driver_address_table; |
---|
| 90 | SAPI_EXTERN unsigned32 _IO_Number_of_devices; |
---|
| 91 | SAPI_EXTERN rtems_driver_name_t *_IO_Driver_name_table; |
---|
[ac7d5ef0] | 92 | |
---|
| 93 | /* |
---|
| 94 | * _IO_Manager_initialization |
---|
| 95 | * |
---|
| 96 | * DESCRIPTION: |
---|
| 97 | * |
---|
| 98 | * This routine performs the initialization necessary for this manager. |
---|
| 99 | */ |
---|
| 100 | |
---|
[4ff1920] | 101 | void _IO_Manager_initialization( |
---|
[ac7d5ef0] | 102 | rtems_driver_address_table *driver_table, |
---|
[3a4ae6c] | 103 | unsigned32 number_of_drivers, |
---|
| 104 | unsigned32 number_of_devices |
---|
[ac7d5ef0] | 105 | ); |
---|
| 106 | |
---|
[b06e68ef] | 107 | /* |
---|
| 108 | * rtems_io_register_name |
---|
| 109 | * |
---|
| 110 | * DESCRIPTION: |
---|
| 111 | * |
---|
| 112 | * Associate a name with a driver. |
---|
| 113 | * |
---|
| 114 | */ |
---|
| 115 | |
---|
| 116 | rtems_status_code rtems_io_register_name( |
---|
[c4808ca] | 117 | char *device_name, |
---|
| 118 | rtems_device_major_number major, |
---|
| 119 | rtems_device_minor_number minor |
---|
[b06e68ef] | 120 | ); |
---|
| 121 | |
---|
| 122 | |
---|
| 123 | /* |
---|
| 124 | * rtems_io_lookup_name |
---|
| 125 | * |
---|
| 126 | * DESCRIPTION: |
---|
| 127 | * |
---|
| 128 | * Find what driver "owns" this name |
---|
| 129 | */ |
---|
| 130 | |
---|
| 131 | rtems_status_code rtems_io_lookup_name( |
---|
[c4808ca] | 132 | const char *name, |
---|
| 133 | rtems_driver_name_t **device_info |
---|
[b06e68ef] | 134 | ); |
---|
| 135 | |
---|
| 136 | |
---|
[ac7d5ef0] | 137 | /* |
---|
| 138 | * rtems_io_initialize |
---|
| 139 | * |
---|
| 140 | * DESCRIPTION: |
---|
| 141 | * |
---|
| 142 | * This routine implements the rtems_io_initialize directive. It is invoked |
---|
| 143 | * to initialize a device driver or an individual device. |
---|
| 144 | */ |
---|
| 145 | |
---|
| 146 | rtems_status_code rtems_io_initialize( |
---|
| 147 | rtems_device_major_number major, |
---|
| 148 | rtems_device_minor_number minor, |
---|
[c4808ca] | 149 | void *argument |
---|
[ac7d5ef0] | 150 | ); |
---|
| 151 | |
---|
| 152 | /* |
---|
| 153 | * rtems_io_open |
---|
| 154 | * |
---|
| 155 | * DESCRIPTION: |
---|
| 156 | * |
---|
| 157 | * This routine implements the rtems_io_open directive. It is invoked |
---|
| 158 | * to open a device. |
---|
| 159 | */ |
---|
| 160 | |
---|
| 161 | rtems_status_code rtems_io_open( |
---|
| 162 | rtems_device_major_number major, |
---|
| 163 | rtems_device_minor_number minor, |
---|
[c4808ca] | 164 | void *argument |
---|
[ac7d5ef0] | 165 | ); |
---|
| 166 | |
---|
| 167 | /* |
---|
| 168 | * rtems_io_close |
---|
| 169 | * |
---|
| 170 | * DESCRIPTION: |
---|
| 171 | * |
---|
| 172 | * This routine implements the rtems_io_close directive. It is invoked |
---|
| 173 | * to close a device. |
---|
| 174 | */ |
---|
| 175 | |
---|
| 176 | rtems_status_code rtems_io_close( |
---|
| 177 | rtems_device_major_number major, |
---|
| 178 | rtems_device_minor_number minor, |
---|
[c4808ca] | 179 | void *argument |
---|
[ac7d5ef0] | 180 | ); |
---|
| 181 | |
---|
| 182 | /* |
---|
| 183 | * rtems_io_read |
---|
| 184 | * |
---|
| 185 | * DESCRIPTION: |
---|
| 186 | * |
---|
| 187 | * This routine implements the rtems_io_read directive. It is invoked |
---|
| 188 | * to read from a device. |
---|
| 189 | */ |
---|
| 190 | |
---|
| 191 | rtems_status_code rtems_io_read( |
---|
| 192 | rtems_device_major_number major, |
---|
| 193 | rtems_device_minor_number minor, |
---|
[c4808ca] | 194 | void *argument |
---|
[ac7d5ef0] | 195 | ); |
---|
| 196 | |
---|
| 197 | /* |
---|
| 198 | * rtems_io_write |
---|
| 199 | * |
---|
| 200 | * DESCRIPTION: |
---|
| 201 | * |
---|
| 202 | * This routine implements the rtems_io_write directive. It is invoked |
---|
| 203 | * to write to a device. |
---|
| 204 | */ |
---|
| 205 | |
---|
| 206 | rtems_status_code rtems_io_write( |
---|
| 207 | rtems_device_major_number major, |
---|
| 208 | rtems_device_minor_number minor, |
---|
[c4808ca] | 209 | void *argument |
---|
[ac7d5ef0] | 210 | ); |
---|
| 211 | |
---|
| 212 | /* |
---|
| 213 | * rtems_io_control |
---|
| 214 | * |
---|
| 215 | * DESCRIPTION: |
---|
| 216 | * |
---|
| 217 | * This routine implements the rtems_io_control directive. It is invoked |
---|
| 218 | * to perform a device specific operation on a device. |
---|
| 219 | */ |
---|
| 220 | |
---|
| 221 | rtems_status_code rtems_io_control( |
---|
| 222 | rtems_device_major_number major, |
---|
| 223 | rtems_device_minor_number minor, |
---|
[c4808ca] | 224 | void *argument |
---|
[ac7d5ef0] | 225 | ); |
---|
| 226 | |
---|
| 227 | /* |
---|
| 228 | * _IO_Initialize_all_drivers |
---|
| 229 | * |
---|
| 230 | * DESCRIPTION: |
---|
| 231 | * |
---|
| 232 | * This routine initializes all of the device drivers configured |
---|
| 233 | * in the Device Driver Address Table. |
---|
| 234 | */ |
---|
| 235 | |
---|
| 236 | void _IO_Initialize_all_drivers( void ); |
---|
| 237 | |
---|
| 238 | #ifdef __cplusplus |
---|
| 239 | } |
---|
| 240 | #endif |
---|
| 241 | |
---|
| 242 | #endif |
---|
| 243 | /* end of include file */ |
---|