1 |
1026 |
ivang |
@c
|
2 |
|
|
@c COPYRIGHT (c) 1988-2002.
|
3 |
|
|
@c On-Line Applications Research Corporation (OAR).
|
4 |
|
|
@c All rights reserved.
|
5 |
|
|
@c
|
6 |
|
|
@c io.t,v 1.16 2002/04/03 17:58:39 joel Exp
|
7 |
|
|
@c
|
8 |
|
|
|
9 |
|
|
@chapter I/O Manager
|
10 |
|
|
|
11 |
|
|
@cindex device drivers
|
12 |
|
|
@cindex IO Manager
|
13 |
|
|
|
14 |
|
|
@section Introduction
|
15 |
|
|
|
16 |
|
|
The input/output interface manager provides a
|
17 |
|
|
well-defined mechanism for accessing device drivers and a
|
18 |
|
|
structured methodology for organizing device drivers. The
|
19 |
|
|
directives provided by the I/O manager are:
|
20 |
|
|
|
21 |
|
|
@itemize @bullet
|
22 |
|
|
@item @code{@value{DIRPREFIX}io_initialize} - Initialize a device driver
|
23 |
|
|
@item @code{@value{DIRPREFIX}io_register_name} - Register a device name
|
24 |
|
|
@item @code{@value{DIRPREFIX}io_lookup_name} - Look up a device name
|
25 |
|
|
@item @code{@value{DIRPREFIX}io_open} - Open a device
|
26 |
|
|
@item @code{@value{DIRPREFIX}io_close} - Close a device
|
27 |
|
|
@item @code{@value{DIRPREFIX}io_read} - Read from a device
|
28 |
|
|
@item @code{@value{DIRPREFIX}io_write} - Write to a device
|
29 |
|
|
@item @code{@value{DIRPREFIX}io_control} - Special device services
|
30 |
|
|
@end itemize
|
31 |
|
|
|
32 |
|
|
@section Background
|
33 |
|
|
|
34 |
|
|
@subsection Device Driver Table
|
35 |
|
|
|
36 |
|
|
@cindex Device Driver Table
|
37 |
|
|
|
38 |
|
|
Each application utilizing the RTEMS I/O manager must specify the
|
39 |
|
|
address of a Device Driver Table in its Configuration Table. This table
|
40 |
|
|
contains each device driver's entry points that is to be initialised by
|
41 |
|
|
RTEMS during initialization. Each device driver may contain the
|
42 |
|
|
following entry points:
|
43 |
|
|
|
44 |
|
|
@itemize @bullet
|
45 |
|
|
@item Initialization
|
46 |
|
|
@item Open
|
47 |
|
|
@item Close
|
48 |
|
|
@item Read
|
49 |
|
|
@item Write
|
50 |
|
|
@item Control
|
51 |
|
|
@end itemize
|
52 |
|
|
|
53 |
|
|
If the device driver does not support a particular
|
54 |
|
|
entry point, then that entry in the Configuration Table should
|
55 |
|
|
be NULL. RTEMS will return
|
56 |
|
|
@code{@value{RPREFIX}SUCCESSFUL} as the executive's and
|
57 |
|
|
zero (0) as the device driver's return code for these device
|
58 |
|
|
driver entry points.
|
59 |
|
|
|
60 |
|
|
Applications can register and unregister drivers with the RTEMS I/O
|
61 |
|
|
manager avoiding the need to have all drivers statically defined and
|
62 |
|
|
linked into this table.
|
63 |
|
|
|
64 |
|
|
The @file{confdefs.h} entry @code{CONFIGURE_MAXIMUM_DRIVERS} configures
|
65 |
|
|
the number of driver slots available to the application.
|
66 |
|
|
|
67 |
|
|
@subsection Major and Minor Device Numbers
|
68 |
|
|
|
69 |
|
|
@cindex major device number
|
70 |
|
|
@cindex minor device number
|
71 |
|
|
|
72 |
|
|
Each call to the I/O manager must provide a device's
|
73 |
|
|
major and minor numbers as arguments. The major number is the
|
74 |
|
|
index of the requested driver's entry points in the Device
|
75 |
|
|
Driver Table, and is used to select a specific device driver.
|
76 |
|
|
The exact usage of the minor number is driver specific, but is
|
77 |
|
|
commonly used to distinguish between a number of devices
|
78 |
|
|
controlled by the same driver.
|
79 |
|
|
|
80 |
|
|
@findex rtems_device_major_number
|
81 |
|
|
@findex rtems_device_minor_number
|
82 |
|
|
|
83 |
|
|
The data types @code{@value{DIRPREFIX}device_major_number} and
|
84 |
|
|
@code{@value{DIRPREFIX}device_minor_number} are used to
|
85 |
|
|
manipulate device major and minor numbers, respectively.
|
86 |
|
|
|
87 |
|
|
@subsection Device Names
|
88 |
|
|
|
89 |
|
|
@cindex device names
|
90 |
|
|
|
91 |
|
|
The I/O Manager provides facilities to associate a
|
92 |
|
|
name with a particular device. Directives are provided to
|
93 |
|
|
register the name of a device and to look up the major/minor
|
94 |
|
|
number pair associated with a device name.
|
95 |
|
|
|
96 |
|
|
@subsection Device Driver Environment
|
97 |
|
|
|
98 |
|
|
Application developers, as well as device driver
|
99 |
|
|
developers, must be aware of the following regarding the RTEMS
|
100 |
|
|
I/O Manager:
|
101 |
|
|
|
102 |
|
|
@itemize @bullet
|
103 |
|
|
@item A device driver routine executes in the context of the
|
104 |
|
|
invoking task. Thus if the driver blocks, the invoking task
|
105 |
|
|
blocks.
|
106 |
|
|
|
107 |
|
|
@item The device driver is free to change the modes of the
|
108 |
|
|
invoking task, although the driver should restore them to their
|
109 |
|
|
original values.
|
110 |
|
|
|
111 |
|
|
@item Device drivers may be invoked from ISRs.
|
112 |
|
|
|
113 |
|
|
@item Only local device drivers are accessible through the I/O
|
114 |
|
|
manager.
|
115 |
|
|
|
116 |
|
|
@item A device driver routine may invoke all other RTEMS
|
117 |
|
|
directives, including I/O directives, on both local and global
|
118 |
|
|
objects.
|
119 |
|
|
|
120 |
|
|
@end itemize
|
121 |
|
|
|
122 |
|
|
Although the RTEMS I/O manager provides a framework
|
123 |
|
|
for device drivers, it makes no assumptions regarding the
|
124 |
|
|
construction or operation of a device driver.
|
125 |
|
|
|
126 |
|
|
@subsection Runtime Driver Registration
|
127 |
|
|
|
128 |
|
|
@cindex runtime driver registration
|
129 |
|
|
|
130 |
|
|
Board support package and application developers can select wether a
|
131 |
|
|
device driver is statically entered into the default device table or
|
132 |
|
|
registered at runtime.
|
133 |
|
|
|
134 |
|
|
Dynamic registration helps applications where:
|
135 |
|
|
|
136 |
|
|
@enumerate
|
137 |
|
|
@item The BSP and kernel libraries are common to a range of applications
|
138 |
|
|
for a specific target platform. An application may be built upon a
|
139 |
|
|
common library with all drivers. The application selects and registers
|
140 |
|
|
the drivers. Uniform driver name lookup protects the application.
|
141 |
|
|
@item The type and range of drivers may vary as the application probes a
|
142 |
|
|
bus during initialization.
|
143 |
|
|
@item Support for hot swap bus system such as Compact PCI.
|
144 |
|
|
@item Support for runtime loadable driver modules.
|
145 |
|
|
@end enumerate
|
146 |
|
|
|
147 |
|
|
@subsection Device Driver Interface
|
148 |
|
|
|
149 |
|
|
@cindex device driver interface
|
150 |
|
|
|
151 |
|
|
When an application invokes an I/O manager directive,
|
152 |
|
|
RTEMS determines which device driver entry point must be
|
153 |
|
|
invoked. The information passed by the application to RTEMS is
|
154 |
|
|
then passed to the correct device driver entry point. RTEMS
|
155 |
|
|
will invoke each device driver entry point assuming it is
|
156 |
|
|
compatible with the following prototype:
|
157 |
|
|
|
158 |
|
|
@ifset is-C
|
159 |
|
|
@example
|
160 |
|
|
rtems_device_driver io_entry(
|
161 |
|
|
rtems_device_major_number major,
|
162 |
|
|
rtems_device_minor_number minor,
|
163 |
|
|
void *argument_block
|
164 |
|
|
);
|
165 |
|
|
@end example
|
166 |
|
|
@end ifset
|
167 |
|
|
|
168 |
|
|
@ifset is-Ada
|
169 |
|
|
@example
|
170 |
|
|
function IO_Entry (
|
171 |
|
|
Major : in RTEMS.Device_Major_Number;
|
172 |
|
|
Minor : in RTEMS.Device_Major_Number;
|
173 |
|
|
Argument_Block : in RTEMS.Address
|
174 |
|
|
) return RTEMS.Status_Code;
|
175 |
|
|
@end example
|
176 |
|
|
@end ifset
|
177 |
|
|
|
178 |
|
|
The format and contents of the parameter block are
|
179 |
|
|
device driver and entry point dependent.
|
180 |
|
|
|
181 |
|
|
It is recommended that a device driver avoid
|
182 |
|
|
generating error codes which conflict with those used by
|
183 |
|
|
application components. A common technique used to generate
|
184 |
|
|
driver specific error codes is to make the most significant part
|
185 |
|
|
of the status indicate a driver specific code.
|
186 |
|
|
|
187 |
|
|
@subsection Device Driver Initialization
|
188 |
|
|
|
189 |
|
|
RTEMS automatically initializes all device drivers
|
190 |
|
|
when multitasking is initiated via the
|
191 |
|
|
@code{@value{DIRPREFIX}initialize_executive}
|
192 |
|
|
directive. RTEMS initializes the device drivers by invoking
|
193 |
|
|
each device driver initialization entry point with the following
|
194 |
|
|
parameters:
|
195 |
|
|
|
196 |
|
|
@table @asis
|
197 |
|
|
@item major
|
198 |
|
|
the major device number for this device driver.
|
199 |
|
|
|
200 |
|
|
@item minor
|
201 |
|
|
zero.
|
202 |
|
|
|
203 |
|
|
@item argument_block
|
204 |
|
|
will point to the Configuration Table.
|
205 |
|
|
|
206 |
|
|
@end table
|
207 |
|
|
|
208 |
|
|
The returned status will be ignored by RTEMS. If the driver
|
209 |
|
|
cannot successfully initialize the device, then it should invoke
|
210 |
|
|
the fatal_error_occurred directive.
|
211 |
|
|
|
212 |
|
|
@section Operations
|
213 |
|
|
|
214 |
|
|
@subsection Register and Lookup Name
|
215 |
|
|
|
216 |
|
|
The @code{@value{DIRPREFIX}io_register} directive associates a name with the
|
217 |
|
|
specified device (i.e. major/minor number pair). Device names
|
218 |
|
|
are typically registered as part of the device driver
|
219 |
|
|
initialization sequence. The @code{@value{DIRPREFIX}io_lookup}
|
220 |
|
|
directive is used to
|
221 |
|
|
determine the major/minor number pair associated with the
|
222 |
|
|
specified device name. The use of these directives frees the
|
223 |
|
|
application from being dependent on the arbitrary assignment of
|
224 |
|
|
major numbers in a particular application. No device naming
|
225 |
|
|
conventions are dictated by RTEMS.
|
226 |
|
|
|
227 |
|
|
@subsection Accessing an Device Driver
|
228 |
|
|
|
229 |
|
|
The I/O manager provides directives which enable the
|
230 |
|
|
application program to utilize device drivers in a standard
|
231 |
|
|
manner. There is a direct correlation between the RTEMS I/O
|
232 |
|
|
manager directives
|
233 |
|
|
@code{@value{DIRPREFIX}io_initialize},
|
234 |
|
|
@code{@value{DIRPREFIX}io_open},
|
235 |
|
|
@code{@value{DIRPREFIX}io_close},
|
236 |
|
|
@code{@value{DIRPREFIX}io_read},
|
237 |
|
|
@code{@value{DIRPREFIX}io_write}, and
|
238 |
|
|
@code{@value{DIRPREFIX}io_control}
|
239 |
|
|
and the underlying device driver entry points.
|
240 |
|
|
|
241 |
|
|
@section Directives
|
242 |
|
|
|
243 |
|
|
This section details the I/O manager's directives. A
|
244 |
|
|
subsection is dedicated to each of this manager's directives and
|
245 |
|
|
describes the calling sequence, related constants, usage, and
|
246 |
|
|
status codes.
|
247 |
|
|
|
248 |
|
|
@c
|
249 |
|
|
@c
|
250 |
|
|
@c
|
251 |
|
|
@page
|
252 |
|
|
@subsection IO_REGISTER_DRIVER - Register a device driver
|
253 |
|
|
|
254 |
|
|
@cindex register a device driver
|
255 |
|
|
|
256 |
|
|
@subheading CALLING SEQUENCE:
|
257 |
|
|
|
258 |
|
|
@ifset is-C
|
259 |
|
|
@findex rtems_io_register_driver
|
260 |
|
|
@example
|
261 |
|
|
rtems_status_code rtems_io_register_driver(
|
262 |
|
|
rtems_device_major_number major,
|
263 |
|
|
rtems_driver_address_table *driver_table,
|
264 |
|
|
rtems_device_major_number *registered_major
|
265 |
|
|
);
|
266 |
|
|
@end example
|
267 |
|
|
@end ifset
|
268 |
|
|
|
269 |
|
|
@ifset is-Ada
|
270 |
|
|
@example
|
271 |
|
|
No Ada implementation.
|
272 |
|
|
@end example
|
273 |
|
|
@end ifset
|
274 |
|
|
|
275 |
|
|
@subheading DIRECTIVE STATUS CODES:
|
276 |
|
|
@code{@value{RPREFIX}SUCCESSFUL} - successfully registered@*
|
277 |
|
|
@code{@value{RPREFIX}INVALID_NUMBER} - invalid major device number@*
|
278 |
|
|
@code{@value{RPREFIX}TOO_MANY} - no available major device table slot@*
|
279 |
|
|
@code{@value{RPREFIX}RESOURCE_IN_USE} - major device number entry in use
|
280 |
|
|
|
281 |
|
|
@subheading DESCRIPTION:
|
282 |
|
|
|
283 |
|
|
This directive attempts to add a new device driver to the Device Driver
|
284 |
|
|
Table. The user can specify a specific major device number via the
|
285 |
|
|
directive's @code{major} parameter, or let the registration routine find
|
286 |
|
|
the next available major device number by specifing a major number of
|
287 |
|
|
@code{0}. The selected major device number is returned via the
|
288 |
|
|
@code{registered_major} directive parameter. The directive automatically
|
289 |
|
|
allocation major device numbers from the highest value down.
|
290 |
|
|
|
291 |
|
|
This directive automatically invokes the IO_INITIALIZE directive if
|
292 |
|
|
the driver address table has an initialization and open entry.
|
293 |
|
|
|
294 |
|
|
The directive returns @value{RPREFIX}TOO_MANY if Device Driver Table is
|
295 |
|
|
full, and @value{RPREFIX}RESOURCE_IN_USE if a specific major device
|
296 |
|
|
number is requested and it is already in use.
|
297 |
|
|
|
298 |
|
|
@subheading NOTES:
|
299 |
|
|
|
300 |
|
|
The Device Driver Table size is specified in the Configuration Table
|
301 |
|
|
condiguration. This needs to be set to maximum size the application
|
302 |
|
|
requires.
|
303 |
|
|
|
304 |
|
|
|
305 |
|
|
@c
|
306 |
|
|
@c
|
307 |
|
|
@c
|
308 |
|
|
@page
|
309 |
|
|
@subsection IO_UNREGISTER_DRIVER - Unregister a device driver
|
310 |
|
|
|
311 |
|
|
@cindex unregister a device driver
|
312 |
|
|
|
313 |
|
|
@subheading CALLING SEQUENCE:
|
314 |
|
|
|
315 |
|
|
@ifset is-C
|
316 |
|
|
@findex rtems_io_unregister_driver
|
317 |
|
|
@example
|
318 |
|
|
rtems_status_code rtems_io_register_driver(
|
319 |
|
|
rtems_device_major_number major
|
320 |
|
|
);
|
321 |
|
|
@end example
|
322 |
|
|
@end ifset
|
323 |
|
|
|
324 |
|
|
@ifset is-Ada
|
325 |
|
|
@example
|
326 |
|
|
No Ada implementation.
|
327 |
|
|
@end example
|
328 |
|
|
@end ifset
|
329 |
|
|
|
330 |
|
|
@subheading DIRECTIVE STATUS CODES:
|
331 |
|
|
@code{@value{RPREFIX}SUCCESSFUL} - successfully registered@*
|
332 |
|
|
@code{@value{RPREFIX}INVALID_NUMBER} - invalid major device number
|
333 |
|
|
|
334 |
|
|
@subheading DESCRIPTION:
|
335 |
|
|
|
336 |
|
|
This directive removes a device driver from the Device Driver Table.
|
337 |
|
|
|
338 |
|
|
@subheading NOTES:
|
339 |
|
|
|
340 |
|
|
Currently no specific checks are made and the driver is not closed.
|
341 |
|
|
|
342 |
|
|
|
343 |
|
|
@c
|
344 |
|
|
@c
|
345 |
|
|
@c
|
346 |
|
|
@page
|
347 |
|
|
@subsection IO_INITIALIZE - Initialize a device driver
|
348 |
|
|
|
349 |
|
|
@cindex initialize a device driver
|
350 |
|
|
|
351 |
|
|
@subheading CALLING SEQUENCE:
|
352 |
|
|
|
353 |
|
|
@ifset is-C
|
354 |
|
|
@findex rtems_io_initialize
|
355 |
|
|
@example
|
356 |
|
|
rtems_status_code rtems_io_initialize(
|
357 |
|
|
rtems_device_major_number major,
|
358 |
|
|
rtems_device_minor_number minor,
|
359 |
|
|
void *argument
|
360 |
|
|
);
|
361 |
|
|
@end example
|
362 |
|
|
@end ifset
|
363 |
|
|
|
364 |
|
|
@ifset is-Ada
|
365 |
|
|
@example
|
366 |
|
|
procedure IO_Initialize (
|
367 |
|
|
Major : in RTEMS.Device_Major_Number;
|
368 |
|
|
Minor : in RTEMS.Device_Minor_Number;
|
369 |
|
|
Argument : in RTEMS.Address;
|
370 |
|
|
Return_Value : out RTEMS.Unsigned32;
|
371 |
|
|
Result : out RTEMS.Status_Codes
|
372 |
|
|
);
|
373 |
|
|
@end example
|
374 |
|
|
@end ifset
|
375 |
|
|
|
376 |
|
|
@subheading DIRECTIVE STATUS CODES:
|
377 |
|
|
@code{@value{RPREFIX}SUCCESSFUL} - successfully initialized@*
|
378 |
|
|
@code{@value{RPREFIX}INVALID_NUMBER} - invalid major device number
|
379 |
|
|
|
380 |
|
|
@subheading DESCRIPTION:
|
381 |
|
|
|
382 |
|
|
This directive calls the device driver initialization
|
383 |
|
|
routine specified in the Device Driver Table for this major
|
384 |
|
|
number. This directive is automatically invoked for each device
|
385 |
|
|
driver when multitasking is initiated via the
|
386 |
|
|
initialize_executive directive.
|
387 |
|
|
|
388 |
|
|
A device driver initialization module is responsible
|
389 |
|
|
for initializing all hardware and data structures associated
|
390 |
|
|
with a device. If necessary, it can allocate memory to be used
|
391 |
|
|
during other operations.
|
392 |
|
|
|
393 |
|
|
@subheading NOTES:
|
394 |
|
|
|
395 |
|
|
This directive may or may not cause the calling task
|
396 |
|
|
to be preempted. This is dependent on the device driver being
|
397 |
|
|
initialized.
|
398 |
|
|
|
399 |
|
|
@c
|
400 |
|
|
@c
|
401 |
|
|
@c
|
402 |
|
|
@page
|
403 |
|
|
@subsection IO_REGISTER_NAME - Register a device
|
404 |
|
|
|
405 |
|
|
@cindex register device
|
406 |
|
|
|
407 |
|
|
@subheading CALLING SEQUENCE:
|
408 |
|
|
|
409 |
|
|
@ifset is-C
|
410 |
|
|
@findex rtems_io_register_name
|
411 |
|
|
@example
|
412 |
|
|
rtems_status_code rtems_io_register_name(
|
413 |
|
|
char *name,
|
414 |
|
|
rtems_device_major_number major,
|
415 |
|
|
rtems_device_minor_number minor
|
416 |
|
|
);
|
417 |
|
|
@end example
|
418 |
|
|
@end ifset
|
419 |
|
|
|
420 |
|
|
@ifset is-Ada
|
421 |
|
|
@example
|
422 |
|
|
procedure IO_Register_Name (
|
423 |
|
|
Name : in String;
|
424 |
|
|
Major : in RTEMS.Device_Major_Number;
|
425 |
|
|
Minor : in RTEMS.Device_Minor_Number;
|
426 |
|
|
Result : out RTEMS.Status_Codes
|
427 |
|
|
);
|
428 |
|
|
@end example
|
429 |
|
|
@end ifset
|
430 |
|
|
|
431 |
|
|
@subheading DIRECTIVE STATUS CODES:
|
432 |
|
|
@code{@value{RPREFIX}SUCCESSFUL} - successfully initialized@*
|
433 |
|
|
@code{@value{RPREFIX}TOO_MANY} - too many devices registered
|
434 |
|
|
|
435 |
|
|
@subheading DESCRIPTION:
|
436 |
|
|
|
437 |
|
|
This directive associates name with the specified
|
438 |
|
|
major/minor number pair.
|
439 |
|
|
|
440 |
|
|
@subheading NOTES:
|
441 |
|
|
|
442 |
|
|
This directive will not cause the calling task to be
|
443 |
|
|
preempted.
|
444 |
|
|
|
445 |
|
|
@c
|
446 |
|
|
@c
|
447 |
|
|
@c
|
448 |
|
|
@page
|
449 |
|
|
@subsection IO_LOOKUP_NAME - Lookup a device
|
450 |
|
|
|
451 |
|
|
@cindex lookup device major and minor number
|
452 |
|
|
|
453 |
|
|
@subheading CALLING SEQUENCE:
|
454 |
|
|
|
455 |
|
|
@ifset is-C
|
456 |
|
|
@findex rtems_io_lookup_name
|
457 |
|
|
@example
|
458 |
|
|
rtems_status_code rtems_io_lookup_name(
|
459 |
|
|
const char *name,
|
460 |
|
|
rtems_driver_name_t **device_info
|
461 |
|
|
);
|
462 |
|
|
@end example
|
463 |
|
|
@end ifset
|
464 |
|
|
|
465 |
|
|
@ifset is-Ada
|
466 |
|
|
@example
|
467 |
|
|
procedure IO_Lookup_Name (
|
468 |
|
|
Name : in String;
|
469 |
|
|
Device_Info : out RTEMS.Driver_Name_t;
|
470 |
|
|
Result : out RTEMS.Status_Codes
|
471 |
|
|
);
|
472 |
|
|
@end example
|
473 |
|
|
@end ifset
|
474 |
|
|
|
475 |
|
|
@subheading DIRECTIVE STATUS CODES:
|
476 |
|
|
@code{@value{RPREFIX}SUCCESSFUL} - successfully initialized@*
|
477 |
|
|
@code{@value{RPREFIX}UNSATISFIED} - name not registered
|
478 |
|
|
|
479 |
|
|
@subheading DESCRIPTION:
|
480 |
|
|
|
481 |
|
|
This directive returns the major/minor number pair
|
482 |
|
|
associated with the given device name in device_info.
|
483 |
|
|
|
484 |
|
|
@subheading NOTES:
|
485 |
|
|
|
486 |
|
|
This directive will not cause the calling task to be
|
487 |
|
|
preempted.
|
488 |
|
|
|
489 |
|
|
@c
|
490 |
|
|
@c
|
491 |
|
|
@c
|
492 |
|
|
@page
|
493 |
|
|
@subsection IO_OPEN - Open a device
|
494 |
|
|
|
495 |
|
|
@cindex open a devive
|
496 |
|
|
|
497 |
|
|
@subheading CALLING SEQUENCE:
|
498 |
|
|
|
499 |
|
|
@ifset is-C
|
500 |
|
|
@findex rtems_io_open
|
501 |
|
|
@example
|
502 |
|
|
rtems_status_code rtems_io_open(
|
503 |
|
|
rtems_device_major_number major,
|
504 |
|
|
rtems_device_minor_number minor,
|
505 |
|
|
void *argument
|
506 |
|
|
);
|
507 |
|
|
@end example
|
508 |
|
|
@end ifset
|
509 |
|
|
|
510 |
|
|
@ifset is-Ada
|
511 |
|
|
@example
|
512 |
|
|
procedure IO_Open (
|
513 |
|
|
Major : in RTEMS.Device_Major_Number;
|
514 |
|
|
Minor : in RTEMS.Device_Minor_Number;
|
515 |
|
|
Argument : in RTEMS.Address;
|
516 |
|
|
Return_Value : out RTEMS.Unsigned32;
|
517 |
|
|
Result : out RTEMS.Status_Codes
|
518 |
|
|
);
|
519 |
|
|
@end example
|
520 |
|
|
@end ifset
|
521 |
|
|
|
522 |
|
|
@subheading DIRECTIVE STATUS CODES:
|
523 |
|
|
@code{@value{RPREFIX}SUCCESSFUL} - successfully initialized@*
|
524 |
|
|
@code{@value{RPREFIX}INVALID_NUMBER} - invalid major device number
|
525 |
|
|
|
526 |
|
|
@subheading DESCRIPTION:
|
527 |
|
|
|
528 |
|
|
This directive calls the device driver open routine
|
529 |
|
|
specified in the Device Driver Table for this major number. The
|
530 |
|
|
open entry point is commonly used by device drivers to provide
|
531 |
|
|
exclusive access to a device.
|
532 |
|
|
|
533 |
|
|
@subheading NOTES:
|
534 |
|
|
|
535 |
|
|
This directive may or may not cause the calling task
|
536 |
|
|
to be preempted. This is dependent on the device driver being
|
537 |
|
|
invoked.
|
538 |
|
|
|
539 |
|
|
@c
|
540 |
|
|
@c
|
541 |
|
|
@c
|
542 |
|
|
@page
|
543 |
|
|
@subsection IO_CLOSE - Close a device
|
544 |
|
|
|
545 |
|
|
@cindex close a device
|
546 |
|
|
|
547 |
|
|
@subheading CALLING SEQUENCE:
|
548 |
|
|
|
549 |
|
|
@ifset is-C
|
550 |
|
|
@findex rtems_io_close
|
551 |
|
|
@example
|
552 |
|
|
rtems_status_code rtems_io_close(
|
553 |
|
|
rtems_device_major_number major,
|
554 |
|
|
rtems_device_minor_number minor,
|
555 |
|
|
void *argument
|
556 |
|
|
);
|
557 |
|
|
@end example
|
558 |
|
|
@end ifset
|
559 |
|
|
|
560 |
|
|
@ifset is-Ada
|
561 |
|
|
@example
|
562 |
|
|
procedure IO_Close (
|
563 |
|
|
Major : in RTEMS.Device_Major_Number;
|
564 |
|
|
Minor : in RTEMS.Device_Minor_Number;
|
565 |
|
|
Argument : in RTEMS.Address;
|
566 |
|
|
Return_Value : out RTEMS.Unsigned32;
|
567 |
|
|
Result : out RTEMS.Status_Codes
|
568 |
|
|
);
|
569 |
|
|
@end example
|
570 |
|
|
@end ifset
|
571 |
|
|
|
572 |
|
|
@subheading DIRECTIVE STATUS CODES:
|
573 |
|
|
@code{@value{RPREFIX}SUCCESSFUL} - successfully initialized@*
|
574 |
|
|
@code{@value{RPREFIX}INVALID_NUMBER} - invalid major device number
|
575 |
|
|
|
576 |
|
|
@subheading DESCRIPTION:
|
577 |
|
|
|
578 |
|
|
This directive calls the device driver close routine
|
579 |
|
|
specified in the Device Driver Table for this major number. The
|
580 |
|
|
close entry point is commonly used by device drivers to
|
581 |
|
|
relinquish exclusive access to a device.
|
582 |
|
|
|
583 |
|
|
@subheading NOTES:
|
584 |
|
|
|
585 |
|
|
This directive may or may not cause the calling task
|
586 |
|
|
to be preempted. This is dependent on the device driver being
|
587 |
|
|
invoked.
|
588 |
|
|
|
589 |
|
|
@c
|
590 |
|
|
@c
|
591 |
|
|
@c
|
592 |
|
|
@page
|
593 |
|
|
@subsection IO_READ - Read from a device
|
594 |
|
|
|
595 |
|
|
@cindex read from a device
|
596 |
|
|
|
597 |
|
|
@subheading CALLING SEQUENCE:
|
598 |
|
|
|
599 |
|
|
@ifset is-C
|
600 |
|
|
@findex rtems_io_read
|
601 |
|
|
@example
|
602 |
|
|
rtems_status_code rtems_io_read(
|
603 |
|
|
rtems_device_major_number major,
|
604 |
|
|
rtems_device_minor_number minor,
|
605 |
|
|
void *argument
|
606 |
|
|
);
|
607 |
|
|
@end example
|
608 |
|
|
@end ifset
|
609 |
|
|
|
610 |
|
|
@ifset is-Ada
|
611 |
|
|
@example
|
612 |
|
|
procedure IO_Read (
|
613 |
|
|
Major : in RTEMS.Device_Major_Number;
|
614 |
|
|
Minor : in RTEMS.Device_Minor_Number;
|
615 |
|
|
Argument : in RTEMS.Address;
|
616 |
|
|
Return_Value : out RTEMS.Unsigned32;
|
617 |
|
|
Result : out RTEMS.Status_Codes
|
618 |
|
|
);
|
619 |
|
|
@end example
|
620 |
|
|
@end ifset
|
621 |
|
|
|
622 |
|
|
@subheading DIRECTIVE STATUS CODES:
|
623 |
|
|
@code{@value{RPREFIX}SUCCESSFUL} - successfully initialized@*
|
624 |
|
|
@code{@value{RPREFIX}INVALID_NUMBER} - invalid major device number
|
625 |
|
|
|
626 |
|
|
@subheading DESCRIPTION:
|
627 |
|
|
|
628 |
|
|
This directive calls the device driver read routine
|
629 |
|
|
specified in the Device Driver Table for this major number.
|
630 |
|
|
Read operations typically require a buffer address as part of
|
631 |
|
|
the argument parameter block. The contents of this buffer will
|
632 |
|
|
be replaced with data from the device.
|
633 |
|
|
|
634 |
|
|
@subheading NOTES:
|
635 |
|
|
|
636 |
|
|
This directive may or may not cause the calling task
|
637 |
|
|
to be preempted. This is dependent on the device driver being
|
638 |
|
|
invoked.
|
639 |
|
|
|
640 |
|
|
@c
|
641 |
|
|
@c
|
642 |
|
|
@c
|
643 |
|
|
@page
|
644 |
|
|
@subsection IO_WRITE - Write to a device
|
645 |
|
|
|
646 |
|
|
@cindex write to a device
|
647 |
|
|
|
648 |
|
|
@subheading CALLING SEQUENCE:
|
649 |
|
|
|
650 |
|
|
@ifset is-C
|
651 |
|
|
@findex rtems_io_write
|
652 |
|
|
@example
|
653 |
|
|
rtems_status_code rtems_io_write(
|
654 |
|
|
rtems_device_major_number major,
|
655 |
|
|
rtems_device_minor_number minor,
|
656 |
|
|
void *argument
|
657 |
|
|
);
|
658 |
|
|
@end example
|
659 |
|
|
@end ifset
|
660 |
|
|
|
661 |
|
|
@ifset is-Ada
|
662 |
|
|
@example
|
663 |
|
|
procedure IO_Write (
|
664 |
|
|
Major : in RTEMS.Device_Major_Number;
|
665 |
|
|
Minor : in RTEMS.Device_Minor_Number;
|
666 |
|
|
Argument : in RTEMS.Address;
|
667 |
|
|
Return_Value : out RTEMS.Unsigned32;
|
668 |
|
|
Result : out RTEMS.Status_Codes
|
669 |
|
|
);
|
670 |
|
|
@end example
|
671 |
|
|
@end ifset
|
672 |
|
|
|
673 |
|
|
@subheading DIRECTIVE STATUS CODES:
|
674 |
|
|
@code{@value{RPREFIX}SUCCESSFUL} - successfully initialized@*
|
675 |
|
|
@code{@value{RPREFIX}INVALID_NUMBER} - invalid major device number
|
676 |
|
|
|
677 |
|
|
@subheading DESCRIPTION:
|
678 |
|
|
|
679 |
|
|
This directive calls the device driver write routine
|
680 |
|
|
specified in the Device Driver Table for this major number.
|
681 |
|
|
Write operations typically require a buffer address as part of
|
682 |
|
|
the argument parameter block. The contents of this buffer will
|
683 |
|
|
be sent to the device.
|
684 |
|
|
|
685 |
|
|
@subheading NOTES:
|
686 |
|
|
|
687 |
|
|
This directive may or may not cause the calling task
|
688 |
|
|
to be preempted. This is dependent on the device driver being
|
689 |
|
|
invoked.
|
690 |
|
|
|
691 |
|
|
@c
|
692 |
|
|
@c
|
693 |
|
|
@c
|
694 |
|
|
@page
|
695 |
|
|
@subsection IO_CONTROL - Special device services
|
696 |
|
|
|
697 |
|
|
@cindex special device services
|
698 |
|
|
@cindex IO Control
|
699 |
|
|
|
700 |
|
|
@subheading CALLING SEQUENCE:
|
701 |
|
|
|
702 |
|
|
@ifset is-C
|
703 |
|
|
@findex rtems_io_control
|
704 |
|
|
@example
|
705 |
|
|
rtems_status_code rtems_io_control(
|
706 |
|
|
rtems_device_major_number major,
|
707 |
|
|
rtems_device_minor_number minor,
|
708 |
|
|
void *argument
|
709 |
|
|
);
|
710 |
|
|
@end example
|
711 |
|
|
@end ifset
|
712 |
|
|
|
713 |
|
|
@ifset is-Ada
|
714 |
|
|
@example
|
715 |
|
|
procedure IO_Control (
|
716 |
|
|
Major : in RTEMS.Device_Major_Number;
|
717 |
|
|
Minor : in RTEMS.Device_Minor_Number;
|
718 |
|
|
Argument : in RTEMS.Address;
|
719 |
|
|
Return_Value : out RTEMS.Unsigned32;
|
720 |
|
|
Result : out RTEMS.Status_Codes
|
721 |
|
|
);
|
722 |
|
|
@end example
|
723 |
|
|
@end ifset
|
724 |
|
|
|
725 |
|
|
@subheading DIRECTIVE STATUS CODES:
|
726 |
|
|
@code{@value{RPREFIX}SUCCESSFUL} - successfully initialized@*
|
727 |
|
|
@code{@value{RPREFIX}INVALID_NUMBER} - invalid major device number
|
728 |
|
|
|
729 |
|
|
@subheading DESCRIPTION:
|
730 |
|
|
|
731 |
|
|
This directive calls the device driver I/O control
|
732 |
|
|
routine specified in the Device Driver Table for this major
|
733 |
|
|
number. The exact functionality of the driver entry called by
|
734 |
|
|
this directive is driver dependent. It should not be assumed
|
735 |
|
|
that the control entries of two device drivers are compatible.
|
736 |
|
|
For example, an RS-232 driver I/O control operation may change
|
737 |
|
|
the baud rate of a serial line, while an I/O control operation
|
738 |
|
|
for a floppy disk driver may cause a seek operation.
|
739 |
|
|
|
740 |
|
|
@subheading NOTES:
|
741 |
|
|
|
742 |
|
|
This directive may or may not cause the calling task
|
743 |
|
|
to be preempted. This is dependent on the device driver being
|
744 |
|
|
invoked.
|
745 |
|
|
|
746 |
|
|
|
747 |
|
|
|