1 <!-- Copyright (C) 2003 Red Hat, Inc. -->
2 <!-- This material may be distributed only subject to the terms -->
3 <!-- and conditions set forth in the Open Publication License, v1.0 -->
4 <!-- or later (the latest version is presently available at -->
5 <!-- http://www.opencontent.org/openpub/). -->
6 <!-- Distribution of the work or derivative of the work in any -->
7 <!-- standard (paper) book form is prohibited unless prior -->
8 <!-- permission is obtained from the copyright holder. -->
13 ><meta name="MSSmartTagsPreventParsing" content="TRUE">
16 CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
19 TITLE="eCos Reference Manual"
20 HREF="ecos-ref.html"><LINK
22 TITLE="I/O Package (Device Drivers)"
26 HREF="io-package-intro.html"><LINK
28 TITLE="Serial driver details"
29 HREF="io-serial-driver-details.html"></HEAD
40 SUMMARY="Header navigation table"
49 >eCos Reference Manual</TH
57 HREF="io-package-intro.html"
71 HREF="io-serial-driver-details.html"
84 NAME="IO-USER-API">Chapter 15. User API</H1
86 >All functions, except <TT
90 require an I/O “handle”.</P
92 >All functions return a value of the type <SPAN
96 error condition is detected, this value will be negative and the
97 absolute value indicates the actual error, as specified in
100 >cyg/error/codes.h</TT
101 >. The only other legal return
105 >. All other function arguments
106 are pointers (references). This allows the drivers to pass information
107 efficiently, both into and out of the driver. The most striking
108 example of this is the “length” value passed to the read
109 and write functions. This parameter contains the desired length of
110 data on input to the function and the actual transferred length on
119 CLASS="PROGRAMLISTING"
120 >// Lookup a device and return its handle
141 >This function maps a device name onto an appropriate handle. If the
142 named device is not in the system, then the error
146 > is returned. If the device is found, then
147 the handle for the device is returned by way of the handle pointer
161 CLASS="PROGRAMLISTING"
162 >// Write data to a device
189 >This function sends data to a device. The size of data to send is
195 > and the actual size sent will
196 be returned in the same place.</P
204 CLASS="PROGRAMLISTING"
205 >// Read data from a device
232 >This function receives data from a device. The desired size of data to
233 receive is contained in <TT
239 size obtained will be returned in the same place.</P
247 CLASS="PROGRAMLISTING"
248 >// Get the configuration of a device
251 >cyg_io_get_config</TT
281 >This function is used to obtain run-time configuration about a
282 device. The type of information retrieved is specified by the
288 >. The data will be returned in the given
289 buffer. The value of <TT
295 amount of data requested, which must be at least as large as the size
296 appropriate to the selected key. The actual size of data retrieved is
302 >. The appropriate key values
303 differ for each driver and are all listed in the file
306 ><cyg/io/config_keys.h></TT
315 CLASS="PROGRAMLISTING"
316 >// Change the configuration of a device
319 >cyg_io_set_config</TT
349 >This function is used to manipulate or change the run-time
350 configuration of a device. The type of information is specified by the
356 >. The data will be obtained from the given
357 buffer. The value of <TT
363 amount of data provided, which must match the size appropriate to the
364 selected key. The appropriate key values differ for each driver and
365 are all listed in the file
368 ><cyg/io/config_keys.h></TT
376 SUMMARY="Footer navigation table"
387 HREF="io-package-intro.html"
405 HREF="io-serial-driver-details.html"
429 >Serial driver details</TD