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. -->
12 >Halted Endpoints</TITLE
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="eCos USB Slave Support"
23 HREF="io-usb-slave.html"><LINK
25 TITLE="Sending Data to the Host"
26 HREF="usbs-start-tx.html"><LINK
28 TITLE="Control Endpoints"
29 HREF="usbs-control.html"></HEAD
40 SUMMARY="Header navigation table"
49 >eCos Reference Manual</TH
57 HREF="usbs-start-tx.html"
71 HREF="usbs-control.html"
82 NAME="USBS-HALT">Halted Endpoints</H1
90 >Halted Endpoints -- Support for Halting and Halted Endpoints</DIV
92 CLASS="REFSYNOPSISDIV"
108 CLASS="FUNCSYNOPSISINFO"
109 >#include <cyg/io/usb/usbs.h></PRE
117 >cyg_bool usbs_rx_endpoint_halted</CODE
118 >(usbs_rx_endpoint* ep);</CODE
124 >void usbs_set_rx_endpoint_halted</CODE
125 >(usbs_rx_endpoint* ep, cyg_bool new_state);</CODE
131 >void usbs_start_rx_endpoint_wait</CODE
132 >(usbs_rx_endpoint* ep, void (*)(void*, int) complete_fn, void * complete_data);</CODE
139 usbs_tx_endpoint_halted</CODE
140 >(usbs_tx_endpoint* ep);</CODE
146 >void usbs_set_tx_endpoint_halted</CODE
147 >(usbs_tx_endpoint* ep, cyg_bool new_state);</CODE
153 >void usbs_start_tx_endpoint_wait</CODE
154 >(usbs_tx_endpoint* ep, void (*)(void*, int) complete_fn, void * complete_data);</CODE
171 >Normal USB traffic involves straightforward handshakes, with either an
175 > to indicate that a packet was transferred
176 without errors, or a <TT
179 > if an error occurred, or
180 if a peripheral is currently unable to process another packet from the
181 host, or has no packet to send to the host. There is a third form of
185 >, which indicates that the
186 endpoint is currently <SPAN
194 >When an endpoint is halted it means that the host-side code needs to
195 take some sort of recovery action before communication over that
196 endpoint can resume. The exact circumstances under which this can
197 happen are not defined by the USB specification, but one example would
198 be a protocol violation if say the peripheral attempted to transmit
199 more data to the host than was permitted by the protocol in use. The
200 host can use the standard control messages get-status, set-feature and
201 clear-feature to examine and manipulate the halted status of a given
202 endpoint. There are USB-specific functions which can be used inside
203 the peripheral to achieve the same effect. Once an endpoint has been
204 halted the host can then interact with the peripheral using class or
205 vendor control messages to perform appropriate recovery, and then the
206 halted condition can be cleared.</P
208 >Halting an endpoint does not constitute a device state change, and
209 there is no mechanism by which higher-level code can be informed
210 immediately. However, any ongoing receive or transmit operations will
211 be aborted with an <TT
215 receives or transmits will fail immediately with the same error.</P
217 >There are six functions to support halted endpoints, one set for
218 receive endpoints and another for transmit endpoints, with both sets
219 behaving in essentially the same way. The first,
222 >usbs_rx_endpoint_halted</TT
223 >, can be used to determine
224 whether or not an endpoint is currently halted: it takes a single
225 argument that identifies the endpoint of interest. The second
228 >usbs_set_rx_endpoint_halted</TT
230 used to change the halted condition of an endpoint: it takes two
231 arguments; one to identify the endpoint and another to specify the new
232 state. The last function
235 >usbs_start_rx_endpoint_wait</TT
236 > operates in much the
239 >usbs_start_rx_buffer</TT
241 endpoint is no longer halted the device driver will invoke the
242 supplied completion function with a status of 0. The completion
243 function has the same signature as that for a transfer operation.
244 Often it will be possible to use a single completion function and have
245 the foreground code invoke either
248 >usbs_start_rx_buffer</TT
252 >usbs_start_rx_endpoint_wait</TT
254 current state of the endpoint.</P
261 SUMMARY="Footer navigation table"
272 HREF="usbs-start-tx.html"
290 HREF="usbs-control.html"
300 >Sending Data to the Host</TD
306 HREF="io-usb-slave.html"
314 >Control Endpoints</TD