📄 io-serial-driver-details.html
字号:
CLASS="LITERAL"
>CYGOPT_IO_SERIAL_SUPPORT_NONBLOCKING</TT
>
to be enabled, and the specific device to be set to non-blocking
mode for reads (see <TT
CLASS="FUNCTION"
>cyg_io_set_config()</TT
>).</P
><P
>In blocking mode, the call will not return until the requested
amount of data has been read.</P
><P
>In non-blocking mode, data waiting in the device buffer is copied to
<TT
CLASS="PARAMETER"
><I
>buf</I
></TT
>, and the call returns immediately. If there
was enough data in the buffer to fulfill the request,
<TT
CLASS="LITERAL"
>ENOERR</TT
> is returned. If only part of the request
could be fulfilled, <TT
CLASS="LITERAL"
>-EAGAIN</TT
> is returned and the
caller must try again. On return, <TT
CLASS="PARAMETER"
><I
>*len</I
></TT
> contains
the number of characters actually received.</P
><P
>The call can also return <TT
CLASS="LITERAL"
>-EINTR</TT
> if interrupted via
the <TT
CLASS="FUNCTION"
>cyg_io_get_config()</TT
>/<TT
CLASS="LITERAL"
>ABORT</TT
>
key.</P
></DIV
><DIV
CLASS="SECTION"
><H3
CLASS="SECTION"
><A
NAME="IO-SERIAL-CYG-GET-CONFIG">cyg_io_get_config</H3
><TABLE
BORDER="5"
BGCOLOR="#E0E0F0"
WIDTH="70%"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
>cyg_io_get_config(handle, key, buf, len)</PRE
></TD
></TR
></TABLE
><P
>This function returns current [runtime] information
about the device and/or driver. </P
><P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
><TT
CLASS="LITERAL"
>CYG_IO_GET_CONFIG_SERIAL_INFO</TT
></DT
><DD
><P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
>Buf type:</DT
><DD
><P
>cyg_serial_info_t</P
></DD
><DT
>Function:</DT
><DD
><P
> This function retrieves the current state of the driver
and hardware. This information contains fields for
hardware baud rate, number of stop bits, and parity
mode. It also includes a set of flags that control the
port, such as hardware flow control.
</P
></DD
></DL
></DIV
></DD
><DT
><TT
CLASS="LITERAL"
>CYG_IO_GET_CONFIG_SERIAL_BUFFER_INFO</TT
></DT
><DD
><P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
>Buf type:</DT
><DD
><P
>cyg_serial_buf_info_t</P
></DD
><DT
>Function:</DT
><DD
><P
> This function retrieves the current state of the
software buffers in the serial drivers. For both
receive and transmit buffers it returns the total
buffer size and the current number of bytes occupied in
the buffer. It does not take into account any buffering
such as FIFOs or holding registers that the serial
device itself may have.
</P
></DD
></DL
></DIV
></DD
><DT
><TT
CLASS="LITERAL"
>CYG_IO_GET_CONFIG_SERIAL_OUTPUT_DRAIN</TT
></DT
><DD
><P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
>Buf type:</DT
><DD
><P
>void *</P
></DD
><DT
>Function:</DT
><DD
><P
> This function waits for any buffered output to
complete. This function only completes when there is no
more data remaining to be sent to the device.
</P
></DD
></DL
></DIV
></DD
><DT
><TT
CLASS="LITERAL"
>CYG_IO_GET_CONFIG_SERIAL_OUTPUT_FLUSH</TT
></DT
><DD
><P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
>Buf type:</DT
><DD
><P
>void *</P
></DD
><DT
>Function:</DT
><DD
><P
> This function discards any buffered output for the
device.
</P
></DD
></DL
></DIV
></DD
><DT
><TT
CLASS="LITERAL"
>CYG_IO_GET_CONFIG_SERIAL_INPUT_DRAIN</TT
></DT
><DD
><P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
>Buf type:</DT
><DD
><P
>void *</P
></DD
><DT
>Function:</DT
><DD
><P
>This function discards any buffered input for the
device.</P
></DD
></DL
></DIV
></DD
><DT
><TT
CLASS="LITERAL"
>CYG_IO_GET_CONFIG_SERIAL_ABORT</TT
></DT
><DD
><P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
>Buf type:</DT
><DD
><P
> void*</P
></DD
><DT
>Function:</DT
><DD
><P
>This function will cause any pending read or write calls on
this device to return with <TT
CLASS="LITERAL"
>-EABORT</TT
>.</P
></DD
></DL
></DIV
></DD
><DT
><TT
CLASS="LITERAL"
>CYG_IO_GET_CONFIG_SERIAL_READ_BLOCKING</TT
></DT
><DD
><P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
>Buf type:</DT
><DD
><P
> cyg_uint32 (values 0 or 1)</P
></DD
><DT
>Function:</DT
><DD
><P
>This function will read back the blocking-mode
setting for read calls on this device. This call is only
available if the configuration option
<TT
CLASS="LITERAL"
>CYGOPT_IO_SERIAL_SUPPORT_NONBLOCKING</TT
> is
enabled.</P
></DD
></DL
></DIV
></DD
><DT
><TT
CLASS="LITERAL"
>CYG_IO_GET_CONFIG_SERIAL_WRITE_BLOCKING</TT
></DT
><DD
><P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
>Buf type:</DT
><DD
><P
> cyg_uint32 (values 0 or 1)</P
></DD
><DT
>Function:</DT
><DD
><P
> This function will read back the blocking-mode
setting for write calls on this device. This call is only
available if the configuration option
<TT
CLASS="LITERAL"
>CYGOPT_IO_SERIAL_SUPPORT_NONBLOCKING</TT
> is enabled.</P
></DD
></DL
></DIV
></DD
></DL
></DIV
></DIV
><DIV
CLASS="SECTION"
><H3
CLASS="SECTION"
><A
NAME="IO-SERIAL-CYG-SET-CONFIG">cyg_io_set_config</H3
><TABLE
BORDER="5"
BGCOLOR="#E0E0F0"
WIDTH="70%"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
>cyg_io_set_config(handle, key, buf,len)</PRE
></TD
></TR
></TABLE
><P
>This function is used to update or change runtime configuration
of a port. </P
><P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
><TT
CLASS="LITERAL"
>CYG_IO_SET_CONFIG_SERIAL_INFO</TT
></DT
><DD
><P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
>Buf type:</DT
><DD
><P
>cyg_serial_info_t</P
></DD
><DT
>Function:</DT
><DD
><P
>This function updates the information for the driver
and hardware. The information contains fields for
hardware baud rate, number of stop bits, and parity
mode. It also includes a set of flags that control the
port, such as hardware flow control.
</P
></DD
></DL
></DIV
></DD
><DT
><TT
CLASS="LITERAL"
>CYG_IO_SET_CONFIG_SERIAL_READ_BLOCKING</TT
></DT
><DD
><P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
>Buf type:</DT
><DD
><P
> cyg_uint32 (values 0 or 1)</P
></DD
><DT
>Function:</DT
><DD
><P
>This function will set the blocking-mode for read
calls on this device. This call is only available if the
configuration option <TT
CLASS="LITERAL"
>CYGOPT_IO_SERIAL_SUPPORT_NONBLOCKING</TT
>
is enabled.
</P
></DD
></DL
></DIV
></DD
><DT
><TT
CLASS="LITERAL"
>CYG_IO_SET_CONFIG_SERIAL_WRITE_BLOCKING</TT
></DT
><DD
><P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
>Buf type:</DT
><DD
><P
>cyg_uint32 (values 0 or 1)</P
></DD
><DT
>Function:</DT
><DD
><P
>This function will set the blocking-mode for write
calls on this device. This call is only available if the
configuration option <TT
CLASS="LITERAL"
>CYGOPT_IO_SERIAL_SUPPORT_NONBLOCKING</TT
>
is enabled.
</P
></DD
></DL
></DIV
></DD
></DL
></DIV
></DIV
></DIV
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="io-user-api.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="ecos-ref.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="io-tty-driver.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>User API</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="io.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>TTY driver</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -