Deleted Added
full compact
usbdi.9 (219100) usbdi.9 (233648)
1.\"
2.\" Copyright (c) 2005 Ian Dowse <iedowse@FreeBSD.org>
3.\" All rights reserved.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24.\" SUCH DAMAGE.
25.\"
1.\"
2.\" Copyright (c) 2005 Ian Dowse <iedowse@FreeBSD.org>
3.\" All rights reserved.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24.\" SUCH DAMAGE.
25.\"
26.\" $FreeBSD: head/share/man/man9/usbdi.9 219100 2011-02-28 17:23:15Z hselasky $
26.\" $FreeBSD: head/share/man/man9/usbdi.9 233648 2012-03-29 05:02:12Z eadler $
27.Dd June 24, 2009
28.Dt USBDI 9
29.Os
30.Sh NAME
31.Nm usb_fifo_alloc_buffer ,
32.Nm usb_fifo_attach ,
33.Nm usb_fifo_detach ,
34.Nm usb_fifo_free_buffer ,

--- 139 unchanged lines hidden (view full) ---

174softc. This pointer is used to initialize "xfer->priv_mtx".
175This function returns
176zero upon success. A non-zero return value indicates failure.
177.
178.Pp
179.
180.Fn usbd_transfer_unsetup
181This function will release the given USB transfers and all allocated
27.Dd June 24, 2009
28.Dt USBDI 9
29.Os
30.Sh NAME
31.Nm usb_fifo_alloc_buffer ,
32.Nm usb_fifo_attach ,
33.Nm usb_fifo_detach ,
34.Nm usb_fifo_free_buffer ,

--- 139 unchanged lines hidden (view full) ---

174softc. This pointer is used to initialize "xfer->priv_mtx".
175This function returns
176zero upon success. A non-zero return value indicates failure.
177.
178.Pp
179.
180.Fn usbd_transfer_unsetup
181This function will release the given USB transfers and all allocated
182resources associated with these USB transfers.
182resources associated with these USB transfers.
183.Fa pxfer
184is a pointer to an array of USB transfer pointers, that may be NULL,
185that should be freed by the USB system.
186.Fa n_setup
187is a number telling the USB system how many USB transfers should be
188unsetup.
189.
190This function can sleep waiting for USB transfers to complete.

--- 87 unchanged lines hidden (view full) ---

278void
279usb_default_callback(struct usb_xfer *xfer, usb_error_t error)
280{
281 int actlen;
282
283 usbd_xfer_status(xfer, &actlen, NULL, NULL, NULL);
284
285 switch (USB_GET_STATE(xfer)) {
183.Fa pxfer
184is a pointer to an array of USB transfer pointers, that may be NULL,
185that should be freed by the USB system.
186.Fa n_setup
187is a number telling the USB system how many USB transfers should be
188unsetup.
189.
190This function can sleep waiting for USB transfers to complete.

--- 87 unchanged lines hidden (view full) ---

278void
279usb_default_callback(struct usb_xfer *xfer, usb_error_t error)
280{
281 int actlen;
282
283 usbd_xfer_status(xfer, &actlen, NULL, NULL, NULL);
284
285 switch (USB_GET_STATE(xfer)) {
286 case USB_ST_SETUP:
286 case USB_ST_SETUP:
287 /*
288 * Setup xfer frame lengths/count and data
289 */
290 usbd_transfer_submit(xfer);
291 break;
292
287 /*
288 * Setup xfer frame lengths/count and data
289 */
290 usbd_transfer_submit(xfer);
291 break;
292
293 case USB_ST_TRANSFERRED:
294 /*
293 case USB_ST_TRANSFERRED:
294 /*
295 * Read usb frame data, if any.
296 * "actlen" has the total length for all frames
297 * transferred.
298 */
299 break;
300
301 default: /* Error */
302 /*
295 * Read usb frame data, if any.
296 * "actlen" has the total length for all frames
297 * transferred.
298 */
299 break;
300
301 default: /* Error */
302 /*
303 * Print error message and clear stall
303 * Print error message and clear stall
304 * for example.
305 */
306 break;
307 }
304 * for example.
305 */
306 break;
307 }
308 /*
309 * Here it is safe to do something without the private
308 /*
309 * Here it is safe to do something without the private
310 * USB mutex locked.
311 */
312 return;
313}
314.Ed
315.
316.Sh USB CONTROL TRANSFERS
317An USB control transfer has three parts.
318.
319First the SETUP packet, then DATA packet(s) and then a STATUS
320packet.
321.
322The SETUP packet is always pointed to by frame 0 and the
310 * USB mutex locked.
311 */
312 return;
313}
314.Ed
315.
316.Sh USB CONTROL TRANSFERS
317An USB control transfer has three parts.
318.
319First the SETUP packet, then DATA packet(s) and then a STATUS
320packet.
321.
322The SETUP packet is always pointed to by frame 0 and the
323length is set by
323length is set by
324.Fn usbd_xfer_frame_len
325also if there should not be
326sent any SETUP packet! If an USB control transfer has no DATA stage,
327then the number of frames should be set to 1.
328.
329Else the default number of frames is 2.
330.
331.Bd -literal -offset indent

--- 38 unchanged lines hidden (view full) ---

370.Ed
371.Sh USB TRANSFER CONFIG
372To simply the search for endpoints the
373.Nm usb
374module defines a USB config structure where it is possible to specify
375the characteristics of the wanted endpoint.
376.Bd -literal -offset indent
377
324.Fn usbd_xfer_frame_len
325also if there should not be
326sent any SETUP packet! If an USB control transfer has no DATA stage,
327then the number of frames should be set to 1.
328.
329Else the default number of frames is 2.
330.
331.Bd -literal -offset indent

--- 38 unchanged lines hidden (view full) ---

370.Ed
371.Sh USB TRANSFER CONFIG
372To simply the search for endpoints the
373.Nm usb
374module defines a USB config structure where it is possible to specify
375the characteristics of the wanted endpoint.
376.Bd -literal -offset indent
377
378struct usb_config {
378struct usb_config {
379 bufsize,
380 callback
381 direction,
382 endpoint,
383 frames,
384 index flags,
385 interval,
386 timeout,

--- 255 unchanged lines hidden ---
379 bufsize,
380 callback
381 direction,
382 endpoint,
383 frames,
384 index flags,
385 interval,
386 timeout,

--- 255 unchanged lines hidden ---