⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 usbs-halt.html

📁 有关ecos2。0介绍了实时嵌入式的结构以及线程调度的实现和内存的管理等
💻 HTML
字号:
<!-- Copyright (C) 2003 Red Hat, Inc.                                --><!-- This material may be distributed only subject to the terms      --><!-- and conditions set forth in the Open Publication License, v1.0  --><!-- or later (the latest version is presently available at          --><!-- http://www.opencontent.org/openpub/).                           --><!-- Distribution of the work or derivative of the work in any       --><!-- standard (paper) book form is prohibited unless prior           --><!-- permission is obtained from the copyright holder.               --><HTML><HEAD><TITLE>Halted Endpoints</TITLE><meta name="MSSmartTagsPreventParsing" content="TRUE"><METANAME="GENERATOR"CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+"><LINKREL="HOME"TITLE="eCos Reference Manual"HREF="ecos-ref.html"><LINKREL="UP"TITLE="eCos USB Slave Support"HREF="io-usb-slave.html"><LINKREL="PREVIOUS"TITLE="Sending Data to the Host"HREF="usbs-start-tx.html"><LINKREL="NEXT"TITLE="Control Endpoints"HREF="usbs-control.html"></HEAD><BODYCLASS="REFENTRY"BGCOLOR="#FFFFFF"TEXT="#000000"LINK="#0000FF"VLINK="#840084"ALINK="#0000FF"><DIVCLASS="NAVHEADER"><TABLESUMMARY="Header navigation table"WIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><THCOLSPAN="3"ALIGN="center">eCos Reference Manual</TH></TR><TR><TDWIDTH="10%"ALIGN="left"VALIGN="bottom"><AHREF="usbs-start-tx.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="80%"ALIGN="center"VALIGN="bottom"></TD><TDWIDTH="10%"ALIGN="right"VALIGN="bottom"><AHREF="usbs-control.html"ACCESSKEY="N">Next</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><H1><ANAME="USBS-HALT">Halted Endpoints</H1><DIVCLASS="REFNAMEDIV"><ANAME="AEN16457"></A><H2>Name</H2>Halted Endpoints&nbsp;--&nbsp;Support for Halting and Halted Endpoints</DIV><DIVCLASS="REFSYNOPSISDIV"><ANAME="AEN16460"><H2>Synopsis</H2><DIVCLASS="FUNCSYNOPSIS"><ANAME="AEN16461"><P></P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="FUNCSYNOPSISINFO">#include &lt;cyg/io/usb/usbs.h&gt;</PRE></TD></TR></TABLE><P><CODE><CODECLASS="FUNCDEF">cyg_bool usbs_rx_endpoint_halted</CODE>(usbs_rx_endpoint* ep);</CODE></P><P><CODE><CODECLASS="FUNCDEF">void usbs_set_rx_endpoint_halted</CODE>(usbs_rx_endpoint* ep, cyg_bool new_state);</CODE></P><P><CODE><CODECLASS="FUNCDEF">void usbs_start_rx_endpoint_wait</CODE>(usbs_rx_endpoint* ep, void (*)(void*, int) complete_fn, void * complete_data);</CODE></P><P><CODE><CODECLASS="FUNCDEF">cyg_boolusbs_tx_endpoint_halted</CODE>(usbs_tx_endpoint* ep);</CODE></P><P><CODE><CODECLASS="FUNCDEF">void usbs_set_tx_endpoint_halted</CODE>(usbs_tx_endpoint* ep, cyg_bool new_state);</CODE></P><P><CODE><CODECLASS="FUNCDEF">void usbs_start_tx_endpoint_wait</CODE>(usbs_tx_endpoint* ep, void (*)(void*, int) complete_fn, void * complete_data);</CODE></P><P></P></DIV></DIV><DIVCLASS="REFSECT1"><ANAME="AEN16505"></A><H2><TTCLASS="FUNCTION">Description</TT></H2><P>Normal USB traffic involves straightforward handshakes, with either an<TTCLASS="LITERAL">ACK</TT> to indicate that a packet was transferredwithout errors, or a <TTCLASS="LITERAL">NAK</TT> if an error occurred, orif a peripheral is currently unable to process another packet from thehost, or has no packet to send to the host. There is a third form ofhandshake, a <TTCLASS="LITERAL">STALL</TT>, which indicates that theendpoint is currently <SPANCLASS="emphasis"><ICLASS="EMPHASIS">halted</I></SPAN>.</P><P>When an endpoint is halted it means that the host-side code needs totake some sort of recovery action before communication over thatendpoint can resume. The exact circumstances under which this canhappen are not defined by the USB specification, but one example wouldbe a protocol violation if say the peripheral attempted to transmitmore data to the host than was permitted by the protocol in use. Thehost can use the standard control messages get-status, set-feature andclear-feature to examine and manipulate the halted status of a givenendpoint. There are USB-specific functions which can be used insidethe peripheral to achieve the same effect. Once an endpoint has beenhalted the host can then interact with the peripheral using class orvendor control messages to perform appropriate recovery, and then thehalted condition can be cleared.</P><P>Halting an endpoint does not constitute a device state change, andthere is no mechanism by which higher-level code can be informedimmediately. However, any ongoing receive or transmit operations willbe aborted with an <TTCLASS="LITERAL">-EAGAIN</TT> error, and any newreceives or transmits will fail immediately with the same error.</P><P>There are six functions to support halted endpoints, one set forreceive endpoints and another for transmit endpoints, with both setsbehaving in essentially the same way. The first,<TTCLASS="FUNCTION">usbs_rx_endpoint_halted</TT>, can be used to determinewhether or not an endpoint is currently halted: it takes a singleargument that identifies the endpoint of interest. The secondfunction, <TTCLASS="FUNCTION">usbs_set_rx_endpoint_halted</TT>, can beused to change the halted condition of an endpoint: it takes twoarguments; one to identify the endpoint and another to specify the newstate. The last function<TTCLASS="FUNCTION">usbs_start_rx_endpoint_wait</TT> operates in much thesame way as <TTCLASS="FUNCTION">usbs_start_rx_buffer</TT>: when theendpoint is no longer halted the device driver will invoke thesupplied completion function with a status of 0. The completionfunction has the same signature as that for a transfer operation.Often it will be possible to use a single completion function and havethe foreground code invoke either<TTCLASS="FUNCTION">usbs_start_rx_buffer</TT> or<TTCLASS="FUNCTION">usbs_start_rx_endpoint_wait</TT> depending on thecurrent state of the endpoint.</P></DIV><DIVCLASS="NAVFOOTER"><HRALIGN="LEFT"WIDTH="100%"><TABLESUMMARY="Footer navigation table"WIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top"><AHREF="usbs-start-tx.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="ecos-ref.html"ACCESSKEY="H">Home</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top"><AHREF="usbs-control.html"ACCESSKEY="N">Next</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top">Sending Data to the Host</TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="io-usb-slave.html"ACCESSKEY="U">Up</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top">Control Endpoints</TD></TR></TABLE></DIV></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -