OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [doc/] [html/] [ref/] [io-serial-driver-details.html] - Diff between revs 28 and 174

Only display areas with differences | Details | Blame | View Log

Rev 28 Rev 174
<!-- Copyright (C) 2003 Red Hat, Inc.                                -->
<!-- Copyright (C) 2003 Red Hat, Inc.                                -->
<!-- This material may be distributed only subject to the terms      -->
<!-- This material may be distributed only subject to the terms      -->
<!-- and conditions set forth in the Open Publication License, v1.0  -->
<!-- and conditions set forth in the Open Publication License, v1.0  -->
<!-- or later (the latest version is presently available at          -->
<!-- or later (the latest version is presently available at          -->
<!-- http://www.opencontent.org/openpub/).                           -->
<!-- http://www.opencontent.org/openpub/).                           -->
<!-- Distribution of the work or derivative of the work in any       -->
<!-- Distribution of the work or derivative of the work in any       -->
<!-- standard (paper) book form is prohibited unless prior           -->
<!-- standard (paper) book form is prohibited unless prior           -->
<!-- permission is obtained from the copyright holder.               -->
<!-- permission is obtained from the copyright holder.               -->
<HTML
<HTML
><HEAD
><HEAD
><TITLE
><TITLE
>Serial driver details</TITLE
>Serial driver details</TITLE
><meta name="MSSmartTagsPreventParsing" content="TRUE">
><meta name="MSSmartTagsPreventParsing" content="TRUE">
<META
<META
NAME="GENERATOR"
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
"><LINK
REL="HOME"
REL="HOME"
TITLE="eCos Reference Manual"
TITLE="eCos Reference Manual"
HREF="ecos-ref.html"><LINK
HREF="ecos-ref.html"><LINK
REL="UP"
REL="UP"
TITLE="I/O Package (Device Drivers)"
TITLE="I/O Package (Device Drivers)"
HREF="io.html"><LINK
HREF="io.html"><LINK
REL="PREVIOUS"
REL="PREVIOUS"
TITLE="User API"
TITLE="User API"
HREF="io-user-api.html"><LINK
HREF="io-user-api.html"><LINK
REL="NEXT"
REL="NEXT"
TITLE=" TTY driver"
TITLE=" TTY driver"
HREF="io-tty-driver.html"></HEAD
HREF="io-tty-driver.html"></HEAD
><BODY
><BODY
CLASS="CHAPTER"
CLASS="CHAPTER"
BGCOLOR="#FFFFFF"
BGCOLOR="#FFFFFF"
TEXT="#000000"
TEXT="#000000"
LINK="#0000FF"
LINK="#0000FF"
VLINK="#840084"
VLINK="#840084"
ALINK="#0000FF"
ALINK="#0000FF"
><DIV
><DIV
CLASS="NAVHEADER"
CLASS="NAVHEADER"
><TABLE
><TABLE
SUMMARY="Header navigation table"
SUMMARY="Header navigation table"
WIDTH="100%"
WIDTH="100%"
BORDER="0"
BORDER="0"
CELLPADDING="0"
CELLPADDING="0"
CELLSPACING="0"
CELLSPACING="0"
><TR
><TR
><TH
><TH
COLSPAN="3"
COLSPAN="3"
ALIGN="center"
ALIGN="center"
>eCos Reference Manual</TH
>eCos Reference Manual</TH
></TR
></TR
><TR
><TR
><TD
><TD
WIDTH="10%"
WIDTH="10%"
ALIGN="left"
ALIGN="left"
VALIGN="bottom"
VALIGN="bottom"
><A
><A
HREF="io-user-api.html"
HREF="io-user-api.html"
ACCESSKEY="P"
ACCESSKEY="P"
>Prev</A
>Prev</A
></TD
></TD
><TD
><TD
WIDTH="80%"
WIDTH="80%"
ALIGN="center"
ALIGN="center"
VALIGN="bottom"
VALIGN="bottom"
></TD
></TD
><TD
><TD
WIDTH="10%"
WIDTH="10%"
ALIGN="right"
ALIGN="right"
VALIGN="bottom"
VALIGN="bottom"
><A
><A
HREF="io-tty-driver.html"
HREF="io-tty-driver.html"
ACCESSKEY="N"
ACCESSKEY="N"
>Next</A
>Next</A
></TD
></TD
></TR
></TR
></TABLE
></TABLE
><HR
><HR
ALIGN="LEFT"
ALIGN="LEFT"
WIDTH="100%"></DIV
WIDTH="100%"></DIV
><DIV
><DIV
CLASS="CHAPTER"
CLASS="CHAPTER"
><H1
><H1
><A
><A
NAME="IO-SERIAL-DRIVER-DETAILS">Chapter 16. Serial driver details</H1
NAME="IO-SERIAL-DRIVER-DETAILS">Chapter 16. Serial driver details</H1
><DIV
><DIV
CLASS="TOC"
CLASS="TOC"
><DL
><DL
><DT
><DT
><B
><B
>Table of Contents</B
>Table of Contents</B
></DT
></DT
><DT
><DT
><A
><A
HREF="io-serial-driver-details.html#IO-SIMPLE-SERIAL-DRIVER"
HREF="io-serial-driver-details.html#IO-SIMPLE-SERIAL-DRIVER"
>Raw Serial Driver</A
>Raw Serial Driver</A
></DT
></DT
><DT
><DT
><A
><A
HREF="io-tty-driver.html"
HREF="io-tty-driver.html"
>TTY driver</A
>TTY driver</A
></DT
></DT
></DL
></DL
></DIV
></DIV
><P
><P
>Two different classes of serial drivers are provided as a standard
>Two different classes of serial drivers are provided as a standard
part of the eCos system. These are described as &#8220;raw
part of the eCos system. These are described as &#8220;raw
serial&#8221; (serial) and &#8220;tty-like&#8221; (tty).</P
serial&#8221; (serial) and &#8220;tty-like&#8221; (tty).</P
><DIV
><DIV
CLASS="SECTION"
CLASS="SECTION"
><H1
><H1
CLASS="SECTION"
CLASS="SECTION"
><A
><A
NAME="IO-SIMPLE-SERIAL-DRIVER">Raw Serial Driver</H1
NAME="IO-SIMPLE-SERIAL-DRIVER">Raw Serial Driver</H1
><P
><P
>Use the include file <TT
>Use the include file <TT
CLASS="FILENAME"
CLASS="FILENAME"
>&lt;cyg/io/serialio.h&gt;</TT
>&lt;cyg/io/serialio.h&gt;</TT
> for
> for
this driver.</P
this driver.</P
><P
><P
>The raw serial driver is capable of sending
>The raw serial driver is capable of sending
and receiving blocks of raw data to a serial device. Controls are
and receiving blocks of raw data to a serial device. Controls are
provided to configure the actual hardware, but there is no manipulation
provided to configure the actual hardware, but there is no manipulation
of the data by this driver.</P
of the data by this driver.</P
><P
><P
>There may be many instances of this driver in a given system,
>There may be many instances of this driver in a given system,
one for each serial channel. Each channel corresponds to a physical
one for each serial channel. Each channel corresponds to a physical
device and there will typically be a device module created for this
device and there will typically be a device module created for this
purpose. The device modules themselves are configurable, allowing
purpose. The device modules themselves are configurable, allowing
specification of the actual hardware details, as well as such details
specification of the actual hardware details, as well as such details
as whether the channel should be buffered by the serial driver,
as whether the channel should be buffered by the serial driver,
etc.</P
etc.</P
><DIV
><DIV
CLASS="SECTION"
CLASS="SECTION"
><H2
><H2
CLASS="SECTION"
CLASS="SECTION"
><A
><A
NAME="AEN10475">Runtime Configuration</H2
NAME="AEN10475">Runtime Configuration</H2
><P
><P
>Runtime configuration is achieved by exchanging data structures with
>Runtime configuration is achieved by exchanging data structures with
the driver via the <TT
the driver via the <TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>cyg_io_set_config()</TT
>cyg_io_set_config()</TT
> and
> and
<TT
<TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>cyg_io_get_config()</TT
>cyg_io_get_config()</TT
> functions.</P
> functions.</P
><TABLE
><TABLE
BORDER="5"
BORDER="5"
BGCOLOR="#E0E0F0"
BGCOLOR="#E0E0F0"
WIDTH="70%"
WIDTH="70%"
><TR
><TR
><TD
><TD
><PRE
><PRE
CLASS="PROGRAMLISTING"
CLASS="PROGRAMLISTING"
>typedef struct {
>typedef struct {
 cyg_serial_baud_rate_t baud;
 cyg_serial_baud_rate_t baud;
 cyg_serial_stop_bits_t stop;
 cyg_serial_stop_bits_t stop;
 cyg_serial_parity_t parity;
 cyg_serial_parity_t parity;
 cyg_serial_word_length_t word_length;
 cyg_serial_word_length_t word_length;
 cyg_uint32 flags;
 cyg_uint32 flags;
} cyg_serial_info_t;</PRE
} cyg_serial_info_t;</PRE
></TD
></TD
></TR
></TR
></TABLE
></TABLE
><P
><P
>The field <TT
>The field <TT
CLASS="STRUCTFIELD"
CLASS="STRUCTFIELD"
><I
><I
>word_length</I
>word_length</I
></TT
></TT
> contains the number of data bits per word
> contains the number of data bits per word
(character). This must be one of the values:</P
(character). This must be one of the values:</P
><TABLE
><TABLE
BORDER="5"
BORDER="5"
BGCOLOR="#E0E0F0"
BGCOLOR="#E0E0F0"
WIDTH="70%"
WIDTH="70%"
><TR
><TR
><TD
><TD
><PRE
><PRE
CLASS="PROGRAMLISTING"
CLASS="PROGRAMLISTING"
> CYGNUM_SERIAL_WORD_LENGTH_5
> CYGNUM_SERIAL_WORD_LENGTH_5
 CYGNUM_SERIAL_WORD_LENGTH_6
 CYGNUM_SERIAL_WORD_LENGTH_6
 CYGNUM_SERIAL_WORD_LENGTH_7
 CYGNUM_SERIAL_WORD_LENGTH_7
 CYGNUM_SERIAL_WORD_LENGTH_8</PRE
 CYGNUM_SERIAL_WORD_LENGTH_8</PRE
></TD
></TD
></TR
></TR
></TABLE
></TABLE
><P
><P
>The field <TT
>The field <TT
CLASS="STRUCTFIELD"
CLASS="STRUCTFIELD"
><I
><I
>baud</I
>baud</I
></TT
></TT
> contains a baud rate selection.  This must be
> contains a baud rate selection.  This must be
one of the values:</P
one of the values:</P
><TABLE
><TABLE
BORDER="5"
BORDER="5"
BGCOLOR="#E0E0F0"
BGCOLOR="#E0E0F0"
WIDTH="70%"
WIDTH="70%"
><TR
><TR
><TD
><TD
><PRE
><PRE
CLASS="PROGRAMLISTING"
CLASS="PROGRAMLISTING"
> CYGNUM_SERIAL_BAUD_50
> CYGNUM_SERIAL_BAUD_50
 CYGNUM_SERIAL_BAUD_75
 CYGNUM_SERIAL_BAUD_75
 CYGNUM_SERIAL_BAUD_110
 CYGNUM_SERIAL_BAUD_110
 CYGNUM_SERIAL_BAUD_134_5
 CYGNUM_SERIAL_BAUD_134_5
 CYGNUM_SERIAL_BAUD_150
 CYGNUM_SERIAL_BAUD_150
 CYGNUM_SERIAL_BAUD_200
 CYGNUM_SERIAL_BAUD_200
 CYGNUM_SERIAL_BAUD_300
 CYGNUM_SERIAL_BAUD_300
 CYGNUM_SERIAL_BAUD_600
 CYGNUM_SERIAL_BAUD_600
 CYGNUM_SERIAL_BAUD_1200
 CYGNUM_SERIAL_BAUD_1200
 CYGNUM_SERIAL_BAUD_1800
 CYGNUM_SERIAL_BAUD_1800
 CYGNUM_SERIAL_BAUD_2400
 CYGNUM_SERIAL_BAUD_2400
 CYGNUM_SERIAL_BAUD_3600
 CYGNUM_SERIAL_BAUD_3600
 CYGNUM_SERIAL_BAUD_4800
 CYGNUM_SERIAL_BAUD_4800
 CYGNUM_SERIAL_BAUD_7200
 CYGNUM_SERIAL_BAUD_7200
 CYGNUM_SERIAL_BAUD_9600
 CYGNUM_SERIAL_BAUD_9600
 CYGNUM_SERIAL_BAUD_14400
 CYGNUM_SERIAL_BAUD_14400
 CYGNUM_SERIAL_BAUD_19200
 CYGNUM_SERIAL_BAUD_19200
 CYGNUM_SERIAL_BAUD_38400
 CYGNUM_SERIAL_BAUD_38400
 CYGNUM_SERIAL_BAUD_57600
 CYGNUM_SERIAL_BAUD_57600
 CYGNUM_SERIAL_BAUD_115200
 CYGNUM_SERIAL_BAUD_115200
 CYGNUM_SERIAL_BAUD_234000</PRE
 CYGNUM_SERIAL_BAUD_234000</PRE
></TD
></TD
></TR
></TR
></TABLE
></TABLE
><P
><P
>The field <TT
>The field <TT
CLASS="STRUCTFIELD"
CLASS="STRUCTFIELD"
><I
><I
>stop</I
>stop</I
></TT
></TT
> contains the number of stop bits. This must be
> contains the number of stop bits. This must be
one of the values:</P
one of the values:</P
><TABLE
><TABLE
BORDER="5"
BORDER="5"
BGCOLOR="#E0E0F0"
BGCOLOR="#E0E0F0"
WIDTH="70%"
WIDTH="70%"
><TR
><TR
><TD
><TD
><PRE
><PRE
CLASS="PROGRAMLISTING"
CLASS="PROGRAMLISTING"
> CYGNUM_SERIAL_STOP_1
> CYGNUM_SERIAL_STOP_1
 CYGNUM_SERIAL_STOP_1_5
 CYGNUM_SERIAL_STOP_1_5
 CYGNUM_SERIAL_STOP_2</PRE
 CYGNUM_SERIAL_STOP_2</PRE
></TD
></TD
></TR
></TR
></TABLE
></TABLE
><DIV
><DIV
CLASS="NOTE"
CLASS="NOTE"
><BLOCKQUOTE
><BLOCKQUOTE
CLASS="NOTE"
CLASS="NOTE"
><P
><P
><B
><B
>Note: </B
>Note: </B
>On most hardware, a selection of 1.5 stop bits is only valid
>On most hardware, a selection of 1.5 stop bits is only valid
if the word (character) length is 5.</P
if the word (character) length is 5.</P
></BLOCKQUOTE
></BLOCKQUOTE
></DIV
></DIV
><P
><P
>The field <TT
>The field <TT
CLASS="STRUCTFIELD"
CLASS="STRUCTFIELD"
><I
><I
>parity</I
>parity</I
></TT
></TT
> contains the parity mode.  This must be one of
> contains the parity mode.  This must be one of
the values: </P
the values: </P
><TABLE
><TABLE
BORDER="5"
BORDER="5"
BGCOLOR="#E0E0F0"
BGCOLOR="#E0E0F0"
WIDTH="70%"
WIDTH="70%"
><TR
><TR
><TD
><TD
><PRE
><PRE
CLASS="PROGRAMLISTING"
CLASS="PROGRAMLISTING"
> CYGNUM_SERIAL_PARITY_NONE
> CYGNUM_SERIAL_PARITY_NONE
 CYGNUM_SERIAL_PARITY_EVEN
 CYGNUM_SERIAL_PARITY_EVEN
 CYGNUM_SERIAL_PARITY_ODD
 CYGNUM_SERIAL_PARITY_ODD
 CYGNUM_SERIAL_PARITY_MARK
 CYGNUM_SERIAL_PARITY_MARK
 CYGNUM_SERIAL_PARITY_SPACE</PRE
 CYGNUM_SERIAL_PARITY_SPACE</PRE
></TD
></TD
></TR
></TR
></TABLE
></TABLE
><P
><P
>The field <TT
>The field <TT
CLASS="STRUCTFIELD"
CLASS="STRUCTFIELD"
><I
><I
>flags</I
>flags</I
></TT
></TT
> is a bitmask which controls the behavior of the
> is a bitmask which controls the behavior of the
serial device driver. It should be built from the values
serial device driver. It should be built from the values
<TT
<TT
CLASS="LITERAL"
CLASS="LITERAL"
>CYG_SERIAL_FLAGS_xxx</TT
>CYG_SERIAL_FLAGS_xxx</TT
> defined below:</P
> defined below:</P
><TABLE
><TABLE
BORDER="5"
BORDER="5"
BGCOLOR="#E0E0F0"
BGCOLOR="#E0E0F0"
WIDTH="70%"
WIDTH="70%"
><TR
><TR
><TD
><TD
><PRE
><PRE
CLASS="PROGRAMLISTING"
CLASS="PROGRAMLISTING"
>#define CYG_SERIAL_FLAGS_RTSCTS 0x0001</PRE
>#define CYG_SERIAL_FLAGS_RTSCTS 0x0001</PRE
></TD
></TD
></TR
></TR
></TABLE
></TABLE
><P
><P
>If this bit is set then the port is placed in &#8220;hardware
>If this bit is set then the port is placed in &#8220;hardware
handshake&#8221; mode. In this mode, the CTS and RTS pins control
handshake&#8221; mode. In this mode, the CTS and RTS pins control
when data is allowed to be sent/received at the port. This
when data is allowed to be sent/received at the port. This
bit is ignored if the hardware does not support this level of
bit is ignored if the hardware does not support this level of
handshake.</P
handshake.</P
><TABLE
><TABLE
BORDER="5"
BORDER="5"
BGCOLOR="#E0E0F0"
BGCOLOR="#E0E0F0"
WIDTH="70%"
WIDTH="70%"
><TR
><TR
><TD
><TD
><PRE
><PRE
CLASS="PROGRAMLISTING"
CLASS="PROGRAMLISTING"
>typedef struct {
>typedef struct {
  cyg_int32 rx_bufsize;
  cyg_int32 rx_bufsize;
  cyg_int32 rx_count;
  cyg_int32 rx_count;
  cyg_int32 tx_bufsize;
  cyg_int32 tx_bufsize;
  cyg_int32 tx_count;
  cyg_int32 tx_count;
} cyg_serial_buf_info_t;     </PRE
} cyg_serial_buf_info_t;     </PRE
></TD
></TD
></TR
></TR
></TABLE
></TABLE
><P
><P
>The field <TT
>The field <TT
CLASS="STRUCTFIELD"
CLASS="STRUCTFIELD"
><I
><I
>rx_bufsize</I
>rx_bufsize</I
></TT
></TT
> contains
> contains
the total size of the incoming data buffer. This is set to zero on
the total size of the incoming data buffer. This is set to zero on
devices that do not support buffering (i.e. polled devices).</P
devices that do not support buffering (i.e. polled devices).</P
><P
><P
>The field <TT
>The field <TT
CLASS="STRUCTFIELD"
CLASS="STRUCTFIELD"
><I
><I
>rx_count</I
>rx_count</I
></TT
></TT
> contains the
> contains the
number of bytes currently occupied in the incoming data buffer.
number of bytes currently occupied in the incoming data buffer.
This is set to zero on devices that do not support buffering (i.e. polled
This is set to zero on devices that do not support buffering (i.e. polled
devices).</P
devices).</P
><P
><P
>The field <TT
>The field <TT
CLASS="STRUCTFIELD"
CLASS="STRUCTFIELD"
><I
><I
>tx_bufsize</I
>tx_bufsize</I
></TT
></TT
> contains the
> contains the
total size of the transmit data buffer. This is set to zero on devices
total size of the transmit data buffer. This is set to zero on devices
that do not support buffering (i.e. polled devices).</P
that do not support buffering (i.e. polled devices).</P
><P
><P
>The field <TT
>The field <TT
CLASS="STRUCTFIELD"
CLASS="STRUCTFIELD"
><I
><I
>tx_count</I
>tx_count</I
></TT
></TT
> contains the
> contains the
number of bytes currently occupied in the transmit data buffer.  This
number of bytes currently occupied in the transmit data buffer.  This
is set to zero on devices that do not support buffering (i.e. polled
is set to zero on devices that do not support buffering (i.e. polled
devices).</P
devices).</P
></DIV
></DIV
><DIV
><DIV
CLASS="SECTION"
CLASS="SECTION"
><H2
><H2
CLASS="SECTION"
CLASS="SECTION"
><A
><A
NAME="AEN10510">API Details</H2
NAME="AEN10510">API Details</H2
><DIV
><DIV
CLASS="SECTION"
CLASS="SECTION"
><H3
><H3
CLASS="SECTION"
CLASS="SECTION"
><A
><A
NAME="IO-SERIAL-CYG-IO-WRITE">cyg_io_write</H3
NAME="IO-SERIAL-CYG-IO-WRITE">cyg_io_write</H3
><TABLE
><TABLE
BORDER="5"
BORDER="5"
BGCOLOR="#E0E0F0"
BGCOLOR="#E0E0F0"
WIDTH="70%"
WIDTH="70%"
><TR
><TR
><TD
><TD
><PRE
><PRE
CLASS="PROGRAMLISTING"
CLASS="PROGRAMLISTING"
>cyg_io_write(handle, buf, len)</PRE
>cyg_io_write(handle, buf, len)</PRE
></TD
></TD
></TR
></TR
></TABLE
></TABLE
><P
><P
>Send the data from <TT
>Send the data from <TT
CLASS="PARAMETER"
CLASS="PARAMETER"
><I
><I
>buf</I
>buf</I
></TT
></TT
> to the device. The
> to the device. The
driver maintains a buffer to hold the data. The size of the
driver maintains a buffer to hold the data. The size of the
intermediate buffer is configurable within the interface module. The
intermediate buffer is configurable within the interface module. The
data is not modified at all while it is being buffered. On return,
data is not modified at all while it is being buffered. On return,
<TT
<TT
CLASS="PARAMETER"
CLASS="PARAMETER"
><I
><I
>*len</I
>*len</I
></TT
></TT
> contains the amount of characters actually
> contains the amount of characters actually
consumed .</P
consumed .</P
><P
><P
>It is possible to configure the write call to be blocking
>It is possible to configure the write call to be blocking
(default) or non-blocking. Non-blocking mode requires both the configuration
(default) or non-blocking. Non-blocking mode requires both the configuration
option <TT
option <TT
CLASS="LITERAL"
CLASS="LITERAL"
>CYGOPT_IO_SERIAL_SUPPORT_NONBLOCKING</TT
>CYGOPT_IO_SERIAL_SUPPORT_NONBLOCKING</TT
>
>
to be enabled, and the specific device to be set to non-blocking
to be enabled, and the specific device to be set to non-blocking
mode for writes (see <TT
mode for writes (see <TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>cyg_io_set_config()</TT
>cyg_io_set_config()</TT
>).</P
>).</P
><P
><P
>In blocking mode, the call will not return until there is space in the
>In blocking mode, the call will not return until there is space in the
buffer and the entire contents of <TT
buffer and the entire contents of <TT
CLASS="PARAMETER"
CLASS="PARAMETER"
><I
><I
>buf</I
>buf</I
></TT
></TT
> have been
> have been
consumed.</P
consumed.</P
><P
><P
>In non-blocking mode, as much as possible gets consumed from
>In non-blocking mode, as much as possible gets consumed from
<TT
<TT
CLASS="PARAMETER"
CLASS="PARAMETER"
><I
><I
>buf</I
>buf</I
></TT
></TT
>. If everything was consumed, the call
>. If everything was consumed, the call
returns <TT
returns <TT
CLASS="LITERAL"
CLASS="LITERAL"
>ENOERR</TT
>ENOERR</TT
>. If only part of the
>. If only part of the
<TT
<TT
CLASS="PARAMETER"
CLASS="PARAMETER"
><I
><I
>buf</I
>buf</I
></TT
></TT
> contents was consumed,
> contents was consumed,
<TT
<TT
CLASS="LITERAL"
CLASS="LITERAL"
>-EAGAIN</TT
>-EAGAIN</TT
> is returned and the caller must try
> is returned and the caller must try
again. On return, <TT
again. On return, <TT
CLASS="PARAMETER"
CLASS="PARAMETER"
><I
><I
>*len</I
>*len</I
></TT
></TT
> contains the number of characters actually
> contains the number of characters actually
consumed .</P
consumed .</P
><P
><P
>The call can also return <TT
>The call can also return <TT
CLASS="LITERAL"
CLASS="LITERAL"
>-EINTR</TT
>-EINTR</TT
> if interrupted
> if interrupted
via the <TT
via the <TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>cyg_io_get_config()</TT
>cyg_io_get_config()</TT
>/<TT
>/<TT
CLASS="LITERAL"
CLASS="LITERAL"
>ABORT</TT
>ABORT</TT
> key.</P
> key.</P
></DIV
></DIV
><DIV
><DIV
CLASS="SECTION"
CLASS="SECTION"
><H3
><H3
CLASS="SECTION"
CLASS="SECTION"
><A
><A
NAME="IO-SERIAL-CYG-IO-READ">cyg_io_read</H3
NAME="IO-SERIAL-CYG-IO-READ">cyg_io_read</H3
><TABLE
><TABLE
BORDER="5"
BORDER="5"
BGCOLOR="#E0E0F0"
BGCOLOR="#E0E0F0"
WIDTH="70%"
WIDTH="70%"
><TR
><TR
><TD
><TD
><PRE
><PRE
CLASS="PROGRAMLISTING"
CLASS="PROGRAMLISTING"
>cyg_io_read(handle, buf, len)</PRE
>cyg_io_read(handle, buf, len)</PRE
></TD
></TD
></TR
></TR
></TABLE
></TABLE
><P
><P
>Receive data into the buffer, <TT
>Receive data into the buffer, <TT
CLASS="PARAMETER"
CLASS="PARAMETER"
><I
><I
>buf</I
>buf</I
></TT
></TT
>, from the
>, from the
device. No manipulation of the data is performed before being
device. No manipulation of the data is performed before being
transferred.  An interrupt driven interface module will support data
transferred.  An interrupt driven interface module will support data
arriving when no read is pending by buffering the data in the serial
arriving when no read is pending by buffering the data in the serial
driver.  Again, this buffering is completely configurable. On return,
driver.  Again, this buffering is completely configurable. On return,
<TT
<TT
CLASS="PARAMETER"
CLASS="PARAMETER"
><I
><I
>*len</I
>*len</I
></TT
></TT
> contains the number of characters actually
> contains the number of characters actually
received.</P
received.</P
><P
><P
>It is possible to configure the read call to be blocking (default)
>It is possible to configure the read call to be blocking (default)
or  non-blocking. Non-blocking mode requires both the configuration
or  non-blocking. Non-blocking mode requires both the configuration
option  <TT
option  <TT
CLASS="LITERAL"
CLASS="LITERAL"
>CYGOPT_IO_SERIAL_SUPPORT_NONBLOCKING</TT
>CYGOPT_IO_SERIAL_SUPPORT_NONBLOCKING</TT
>
>
to be enabled, and the specific device to be set to non-blocking
to be enabled, and the specific device to be set to non-blocking
mode for reads (see <TT
mode for reads (see <TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>cyg_io_set_config()</TT
>cyg_io_set_config()</TT
>).</P
>).</P
><P
><P
>In blocking mode, the call will not return until the requested
>In blocking mode, the call will not return until the requested
amount of data has been read.</P
amount of data has been read.</P
><P
><P
>In non-blocking mode, data waiting in the device buffer is copied to
>In non-blocking mode, data waiting in the device buffer is copied to
<TT
<TT
CLASS="PARAMETER"
CLASS="PARAMETER"
><I
><I
>buf</I
>buf</I
></TT
></TT
>, and the call returns immediately. If there
>, and the call returns immediately. If there
was enough data in the buffer to fulfill the request,
was enough data in the buffer to fulfill the request,
<TT
<TT
CLASS="LITERAL"
CLASS="LITERAL"
>ENOERR</TT
>ENOERR</TT
> is returned.  If only part of the request
> is returned.  If only part of the request
could be fulfilled, <TT
could be fulfilled, <TT
CLASS="LITERAL"
CLASS="LITERAL"
>-EAGAIN</TT
>-EAGAIN</TT
> is returned and the
> is returned and the
caller must try again. On return, <TT
caller must try again. On return, <TT
CLASS="PARAMETER"
CLASS="PARAMETER"
><I
><I
>*len</I
>*len</I
></TT
></TT
> contains
> contains
the number of characters actually received.</P
the number of characters actually received.</P
><P
><P
>The call can also return <TT
>The call can also return <TT
CLASS="LITERAL"
CLASS="LITERAL"
>-EINTR</TT
>-EINTR</TT
> if interrupted via
> if interrupted via
the <TT
the <TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>cyg_io_get_config()</TT
>cyg_io_get_config()</TT
>/<TT
>/<TT
CLASS="LITERAL"
CLASS="LITERAL"
>ABORT</TT
>ABORT</TT
>
>
key.</P
key.</P
></DIV
></DIV
><DIV
><DIV
CLASS="SECTION"
CLASS="SECTION"
><H3
><H3
CLASS="SECTION"
CLASS="SECTION"
><A
><A
NAME="IO-SERIAL-CYG-GET-CONFIG">cyg_io_get_config</H3
NAME="IO-SERIAL-CYG-GET-CONFIG">cyg_io_get_config</H3
><TABLE
><TABLE
BORDER="5"
BORDER="5"
BGCOLOR="#E0E0F0"
BGCOLOR="#E0E0F0"
WIDTH="70%"
WIDTH="70%"
><TR
><TR
><TD
><TD
><PRE
><PRE
CLASS="PROGRAMLISTING"
CLASS="PROGRAMLISTING"
>cyg_io_get_config(handle, key, buf, len)</PRE
>cyg_io_get_config(handle, key, buf, len)</PRE
></TD
></TD
></TR
></TR
></TABLE
></TABLE
><P
><P
>This function returns current [runtime] information
>This function returns current [runtime] information
about the device and/or driver. </P
about the device and/or driver. </P
><P
><P
></P
></P
><DIV
><DIV
CLASS="VARIABLELIST"
CLASS="VARIABLELIST"
><DL
><DL
><DT
><DT
><TT
><TT
CLASS="LITERAL"
CLASS="LITERAL"
>CYG_IO_GET_CONFIG_SERIAL_INFO</TT
>CYG_IO_GET_CONFIG_SERIAL_INFO</TT
></DT
></DT
><DD
><DD
><P
><P
></P
></P
><DIV
><DIV
CLASS="VARIABLELIST"
CLASS="VARIABLELIST"
><DL
><DL
><DT
><DT
>Buf type:</DT
>Buf type:</DT
><DD
><DD
><P
><P
>cyg_serial_info_t</P
>cyg_serial_info_t</P
></DD
></DD
><DT
><DT
>Function:</DT
>Function:</DT
><DD
><DD
><P
><P
>              This function retrieves the current state of the driver
>              This function retrieves the current state of the driver
              and hardware. This information contains fields for
              and hardware. This information contains fields for
              hardware baud rate, number of stop bits, and parity
              hardware baud rate, number of stop bits, and parity
              mode. It also includes a set of flags that control the
              mode. It also includes a set of flags that control the
              port, such as hardware flow control.
              port, such as hardware flow control.
            </P
            </P
></DD
></DD
></DL
></DL
></DIV
></DIV
></DD
></DD
><DT
><DT
><TT
><TT
CLASS="LITERAL"
CLASS="LITERAL"
>CYG_IO_GET_CONFIG_SERIAL_BUFFER_INFO</TT
>CYG_IO_GET_CONFIG_SERIAL_BUFFER_INFO</TT
></DT
></DT
><DD
><DD
><P
><P
></P
></P
><DIV
><DIV
CLASS="VARIABLELIST"
CLASS="VARIABLELIST"
><DL
><DL
><DT
><DT
>Buf type:</DT
>Buf type:</DT
><DD
><DD
><P
><P
>cyg_serial_buf_info_t</P
>cyg_serial_buf_info_t</P
></DD
></DD
><DT
><DT
>Function:</DT
>Function:</DT
><DD
><DD
><P
><P
>               This function retrieves the current state of the
>               This function retrieves the current state of the
               software buffers in the serial drivers. For both
               software buffers in the serial drivers. For both
               receive and transmit buffers it returns the total
               receive and transmit buffers it returns the total
               buffer size and the current number of bytes occupied in
               buffer size and the current number of bytes occupied in
               the buffer. It does not take into account any buffering
               the buffer. It does not take into account any buffering
               such as FIFOs or holding registers that the serial
               such as FIFOs or holding registers that the serial
               device itself may have.
               device itself may have.
             </P
             </P
></DD
></DD
></DL
></DL
></DIV
></DIV
></DD
></DD
><DT
><DT
><TT
><TT
CLASS="LITERAL"
CLASS="LITERAL"
>CYG_IO_GET_CONFIG_SERIAL_OUTPUT_DRAIN</TT
>CYG_IO_GET_CONFIG_SERIAL_OUTPUT_DRAIN</TT
></DT
></DT
><DD
><DD
><P
><P
></P
></P
><DIV
><DIV
CLASS="VARIABLELIST"
CLASS="VARIABLELIST"
><DL
><DL
><DT
><DT
>Buf type:</DT
>Buf type:</DT
><DD
><DD
><P
><P
>void *</P
>void *</P
></DD
></DD
><DT
><DT
>Function:</DT
>Function:</DT
><DD
><DD
><P
><P
>              This function waits for any buffered output to
>              This function waits for any buffered output to
              complete. This function only completes when there is no
              complete. This function only completes when there is no
              more data remaining to be sent to the device.
              more data remaining to be sent to the device.
            </P
            </P
></DD
></DD
></DL
></DL
></DIV
></DIV
></DD
></DD
><DT
><DT
><TT
><TT
CLASS="LITERAL"
CLASS="LITERAL"
>CYG_IO_GET_CONFIG_SERIAL_OUTPUT_FLUSH</TT
>CYG_IO_GET_CONFIG_SERIAL_OUTPUT_FLUSH</TT
></DT
></DT
><DD
><DD
><P
><P
></P
></P
><DIV
><DIV
CLASS="VARIABLELIST"
CLASS="VARIABLELIST"
><DL
><DL
><DT
><DT
>Buf type:</DT
>Buf type:</DT
><DD
><DD
><P
><P
>void *</P
>void *</P
></DD
></DD
><DT
><DT
>Function:</DT
>Function:</DT
><DD
><DD
><P
><P
>              This function discards any buffered output for the
>              This function discards any buffered output for the
              device.
              device.
            </P
            </P
></DD
></DD
></DL
></DL
></DIV
></DIV
></DD
></DD
><DT
><DT
><TT
><TT
CLASS="LITERAL"
CLASS="LITERAL"
>CYG_IO_GET_CONFIG_SERIAL_INPUT_DRAIN</TT
>CYG_IO_GET_CONFIG_SERIAL_INPUT_DRAIN</TT
></DT
></DT
><DD
><DD
><P
><P
></P
></P
><DIV
><DIV
CLASS="VARIABLELIST"
CLASS="VARIABLELIST"
><DL
><DL
><DT
><DT
>Buf type:</DT
>Buf type:</DT
><DD
><DD
><P
><P
>void *</P
>void *</P
></DD
></DD
><DT
><DT
>Function:</DT
>Function:</DT
><DD
><DD
><P
><P
>This function discards any buffered input for the
>This function discards any buffered input for the
            device.</P
            device.</P
></DD
></DD
></DL
></DL
></DIV
></DIV
></DD
></DD
><DT
><DT
><TT
><TT
CLASS="LITERAL"
CLASS="LITERAL"
>CYG_IO_GET_CONFIG_SERIAL_ABORT</TT
>CYG_IO_GET_CONFIG_SERIAL_ABORT</TT
></DT
></DT
><DD
><DD
><P
><P
></P
></P
><DIV
><DIV
CLASS="VARIABLELIST"
CLASS="VARIABLELIST"
><DL
><DL
><DT
><DT
>Buf type:</DT
>Buf type:</DT
><DD
><DD
><P
><P
> void*</P
> void*</P
></DD
></DD
><DT
><DT
>Function:</DT
>Function:</DT
><DD
><DD
><P
><P
>This function will cause any pending read or write calls on
>This function will cause any pending read or write calls on
            this device to return with <TT
            this device to return with <TT
CLASS="LITERAL"
CLASS="LITERAL"
>-EABORT</TT
>-EABORT</TT
>.</P
>.</P
></DD
></DD
></DL
></DL
></DIV
></DIV
></DD
></DD
><DT
><DT
><TT
><TT
CLASS="LITERAL"
CLASS="LITERAL"
>CYG_IO_GET_CONFIG_SERIAL_READ_BLOCKING</TT
>CYG_IO_GET_CONFIG_SERIAL_READ_BLOCKING</TT
></DT
></DT
><DD
><DD
><P
><P
></P
></P
><DIV
><DIV
CLASS="VARIABLELIST"
CLASS="VARIABLELIST"
><DL
><DL
><DT
><DT
>Buf type:</DT
>Buf type:</DT
><DD
><DD
><P
><P
> cyg_uint32 (values 0 or 1)</P
> cyg_uint32 (values 0 or 1)</P
></DD
></DD
><DT
><DT
>Function:</DT
>Function:</DT
><DD
><DD
><P
><P
>This function will read back the blocking-mode
>This function will read back the blocking-mode
            setting for read calls on this device. This call is only
            setting for read calls on this device. This call is only
            available if the configuration option
            available if the configuration option
            <TT
            <TT
CLASS="LITERAL"
CLASS="LITERAL"
>CYGOPT_IO_SERIAL_SUPPORT_NONBLOCKING</TT
>CYGOPT_IO_SERIAL_SUPPORT_NONBLOCKING</TT
> is
> is
            enabled.</P
            enabled.</P
></DD
></DD
></DL
></DL
></DIV
></DIV
></DD
></DD
><DT
><DT
><TT
><TT
CLASS="LITERAL"
CLASS="LITERAL"
>CYG_IO_GET_CONFIG_SERIAL_WRITE_BLOCKING</TT
>CYG_IO_GET_CONFIG_SERIAL_WRITE_BLOCKING</TT
></DT
></DT
><DD
><DD
><P
><P
></P
></P
><DIV
><DIV
CLASS="VARIABLELIST"
CLASS="VARIABLELIST"
><DL
><DL
><DT
><DT
>Buf type:</DT
>Buf type:</DT
><DD
><DD
><P
><P
> cyg_uint32 (values 0 or 1)</P
> cyg_uint32 (values 0 or 1)</P
></DD
></DD
><DT
><DT
>Function:</DT
>Function:</DT
><DD
><DD
><P
><P
>            This function will read back the blocking-mode
>            This function will read back the blocking-mode
            setting for write calls on this device. This call is only
            setting for write calls on this device. This call is only
            available if the configuration option
            available if the configuration option
            <TT
            <TT
CLASS="LITERAL"
CLASS="LITERAL"
>CYGOPT_IO_SERIAL_SUPPORT_NONBLOCKING</TT
>CYGOPT_IO_SERIAL_SUPPORT_NONBLOCKING</TT
> is enabled.</P
> is enabled.</P
></DD
></DD
></DL
></DL
></DIV
></DIV
></DD
></DD
></DL
></DL
></DIV
></DIV
></DIV
></DIV
><DIV
><DIV
CLASS="SECTION"
CLASS="SECTION"
><H3
><H3
CLASS="SECTION"
CLASS="SECTION"
><A
><A
NAME="IO-SERIAL-CYG-SET-CONFIG">cyg_io_set_config</H3
NAME="IO-SERIAL-CYG-SET-CONFIG">cyg_io_set_config</H3
><TABLE
><TABLE
BORDER="5"
BORDER="5"
BGCOLOR="#E0E0F0"
BGCOLOR="#E0E0F0"
WIDTH="70%"
WIDTH="70%"
><TR
><TR
><TD
><TD
><PRE
><PRE
CLASS="PROGRAMLISTING"
CLASS="PROGRAMLISTING"
>cyg_io_set_config(handle, key, buf,len)</PRE
>cyg_io_set_config(handle, key, buf,len)</PRE
></TD
></TD
></TR
></TR
></TABLE
></TABLE
><P
><P
>This function is used to update or change runtime configuration
>This function is used to update or change runtime configuration
of a port. </P
of a port. </P
><P
><P
></P
></P
><DIV
><DIV
CLASS="VARIABLELIST"
CLASS="VARIABLELIST"
><DL
><DL
><DT
><DT
><TT
><TT
CLASS="LITERAL"
CLASS="LITERAL"
>CYG_IO_SET_CONFIG_SERIAL_INFO</TT
>CYG_IO_SET_CONFIG_SERIAL_INFO</TT
></DT
></DT
><DD
><DD
><P
><P
></P
></P
><DIV
><DIV
CLASS="VARIABLELIST"
CLASS="VARIABLELIST"
><DL
><DL
><DT
><DT
>Buf type:</DT
>Buf type:</DT
><DD
><DD
><P
><P
>cyg_serial_info_t</P
>cyg_serial_info_t</P
></DD
></DD
><DT
><DT
>Function:</DT
>Function:</DT
><DD
><DD
><P
><P
>This function updates the information for the driver
>This function updates the information for the driver
            and hardware.  The information contains fields for
            and hardware.  The information contains fields for
            hardware baud rate, number of stop bits, and parity
            hardware baud rate, number of stop bits, and parity
            mode. It also includes a set of flags that control the
            mode. It also includes a set of flags that control the
            port, such as hardware flow control.
            port, such as hardware flow control.
            </P
            </P
></DD
></DD
></DL
></DL
></DIV
></DIV
></DD
></DD
><DT
><DT
><TT
><TT
CLASS="LITERAL"
CLASS="LITERAL"
>CYG_IO_SET_CONFIG_SERIAL_READ_BLOCKING</TT
>CYG_IO_SET_CONFIG_SERIAL_READ_BLOCKING</TT
></DT
></DT
><DD
><DD
><P
><P
></P
></P
><DIV
><DIV
CLASS="VARIABLELIST"
CLASS="VARIABLELIST"
><DL
><DL
><DT
><DT
>Buf type:</DT
>Buf type:</DT
><DD
><DD
><P
><P
> cyg_uint32 (values 0 or 1)</P
> cyg_uint32 (values 0 or 1)</P
></DD
></DD
><DT
><DT
>Function:</DT
>Function:</DT
><DD
><DD
><P
><P
>This function will set the blocking-mode for read
>This function will set the blocking-mode for read
            calls on this device. This call is only available if the
            calls on this device. This call is only available if the
            configuration option <TT
            configuration option <TT
CLASS="LITERAL"
CLASS="LITERAL"
>CYGOPT_IO_SERIAL_SUPPORT_NONBLOCKING</TT
>CYGOPT_IO_SERIAL_SUPPORT_NONBLOCKING</TT
>
>
            is enabled.
            is enabled.
            </P
            </P
></DD
></DD
></DL
></DL
></DIV
></DIV
></DD
></DD
><DT
><DT
><TT
><TT
CLASS="LITERAL"
CLASS="LITERAL"
>CYG_IO_SET_CONFIG_SERIAL_WRITE_BLOCKING</TT
>CYG_IO_SET_CONFIG_SERIAL_WRITE_BLOCKING</TT
></DT
></DT
><DD
><DD
><P
><P
></P
></P
><DIV
><DIV
CLASS="VARIABLELIST"
CLASS="VARIABLELIST"
><DL
><DL
><DT
><DT
>Buf type:</DT
>Buf type:</DT
><DD
><DD
><P
><P
>cyg_uint32 (values 0 or 1)</P
>cyg_uint32 (values 0 or 1)</P
></DD
></DD
><DT
><DT
>Function:</DT
>Function:</DT
><DD
><DD
><P
><P
>This function will set the blocking-mode for write
>This function will set the blocking-mode for write
            calls on this device. This call is only available if the
            calls on this device. This call is only available if the
            configuration option <TT
            configuration option <TT
CLASS="LITERAL"
CLASS="LITERAL"
>CYGOPT_IO_SERIAL_SUPPORT_NONBLOCKING</TT
>CYGOPT_IO_SERIAL_SUPPORT_NONBLOCKING</TT
>
>
            is enabled.
            is enabled.
            </P
            </P
></DD
></DD
></DL
></DL
></DIV
></DIV
></DD
></DD
></DL
></DL
></DIV
></DIV
></DIV
></DIV
></DIV
></DIV
></DIV
></DIV
></DIV
></DIV
><DIV
><DIV
CLASS="NAVFOOTER"
CLASS="NAVFOOTER"
><HR
><HR
ALIGN="LEFT"
ALIGN="LEFT"
WIDTH="100%"><TABLE
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
SUMMARY="Footer navigation table"
WIDTH="100%"
WIDTH="100%"
BORDER="0"
BORDER="0"
CELLPADDING="0"
CELLPADDING="0"
CELLSPACING="0"
CELLSPACING="0"
><TR
><TR
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="left"
ALIGN="left"
VALIGN="top"
VALIGN="top"
><A
><A
HREF="io-user-api.html"
HREF="io-user-api.html"
ACCESSKEY="P"
ACCESSKEY="P"
>Prev</A
>Prev</A
></TD
></TD
><TD
><TD
WIDTH="34%"
WIDTH="34%"
ALIGN="center"
ALIGN="center"
VALIGN="top"
VALIGN="top"
><A
><A
HREF="ecos-ref.html"
HREF="ecos-ref.html"
ACCESSKEY="H"
ACCESSKEY="H"
>Home</A
>Home</A
></TD
></TD
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="right"
ALIGN="right"
VALIGN="top"
VALIGN="top"
><A
><A
HREF="io-tty-driver.html"
HREF="io-tty-driver.html"
ACCESSKEY="N"
ACCESSKEY="N"
>Next</A
>Next</A
></TD
></TD
></TR
></TR
><TR
><TR
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="left"
ALIGN="left"
VALIGN="top"
VALIGN="top"
>User API</TD
>User API</TD
><TD
><TD
WIDTH="34%"
WIDTH="34%"
ALIGN="center"
ALIGN="center"
VALIGN="top"
VALIGN="top"
><A
><A
HREF="io.html"
HREF="io.html"
ACCESSKEY="U"
ACCESSKEY="U"
>Up</A
>Up</A
></TD
></TD
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="right"
ALIGN="right"
VALIGN="top"
VALIGN="top"
>TTY driver</TD
>TTY driver</TD
></TR
></TR
></TABLE
></TABLE
></DIV
></DIV
></BODY
></BODY
></HTML
></HTML
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.