source: rtems/doc/user/io.t @ 75e22db

4.104.114.84.95
Last change on this file since 75e22db was 75e22db, checked in by Joel Sherrill <joel.sherrill@…>, on 03/27/98 at 16:47:53

Completed sweep adding directive and constant prefixes.

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