Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

usb_ep_queue(9) [centos man page]

USB_EP_QUEUE(9) 					      Kernel Mode Gadget API						   USB_EP_QUEUE(9)

NAME
usb_ep_queue - queues (submits) an I/O request to an endpoint. SYNOPSIS
int usb_ep_queue(struct usb_ep * ep, struct usb_request * req, gfp_t gfp_flags); ARGUMENTS
ep the endpoint associated with the request req the request being submitted gfp_flags GFP_* flags to use in case the lower level driver couldn't pre-allocate all necessary memory with the request. DESCRIPTION
This tells the device controller to perform the specified request through that endpoint (reading or writing a buffer). When the request completes, including being canceled by usb_ep_dequeue, the request's completion routine is called to return the request to the driver. Any endpoint (except control endpoints like ep0) may have more than one transfer request queued; they complete in FIFO order. Once a gadget driver submits a request, that request may not be examined or modified until it is given back to that driver through the completion callback. Each request is turned into one or more packets. The controller driver never merges adjacent requests into the same packet. OUT transfers will sometimes use data that's already buffered in the hardware. Drivers can rely on the fact that the first byte of the request's buffer always corresponds to the first byte of some USB packet, for both IN and OUT transfers. Bulk endpoints can queue any amount of data; the transfer is packetized automatically. The last packet will be short if the request doesn't fill it out completely. Zero length packets (ZLPs) should be avoided in portable protocols since not all usb hardware can successfully handle zero length packets. (ZLPs may be explicitly written, and may be implicitly written if the request 'zero' flag is set.) Bulk endpoints may also be used for interrupt transfers; but the reverse is not true, and some endpoints won't support every interrupt transfer. (Such as 768 byte packets.) Interrupt-only endpoints are less functional than bulk endpoints, for example by not supporting queueing or not handling buffers that are larger than the endpoint's maxpacket size. They may also treat data toggle differently. Control endpoints ... after getting a setup callback, the driver queues one response (even if it would be zero length). That enables the status ack, after transferring data as specified in the response. Setup functions may return negative error codes to generate protocol stalls. (Note that some USB device controllers disallow protocol stall responses in some cases.) When control responses are deferred (the response is written after the setup callback returns), then usb_ep_set_halt may be used on ep0 to trigger protocol stalls. Depending on the controller, it may not be possible to trigger a status-stage protocol stall when the data stage is over, that is, from within the response's completion routine. For periodic endpoints, like interrupt or isochronous ones, the usb host arranges to poll once per interval, and the gadget driver usually will have queued some data to transfer at that time. Returns zero, or a negative error code. Endpoints that are not enabled report errors; errors will also be reported when the usb peripheral is disconnected. AUTHOR
David Brownell <dbrownell@users.sourceforge.net> Author. COPYRIGHT
Kernel Hackers Manual 3.10 June 2014 USB_EP_QUEUE(9)

Check Out this Related Man Page

USB_UNLINK_URB(9)						   USB Core APIs						 USB_UNLINK_URB(9)

NAME
usb_unlink_urb - abort/cancel a transfer request for an endpoint SYNOPSIS
int usb_unlink_urb(struct urb * urb); ARGUMENTS
urb pointer to urb describing a previously submitted request, may be NULL DESCRIPTION
This routine cancels an in-progress request. URBs complete only once per submission, and may be canceled only once per submission. Successful cancellation means termination of urb will be expedited and the completion handler will be called with a status code indicating that the request has been canceled (rather than any other code). Drivers should not call this routine or related routines, such as usb_kill_urb or usb_unlink_anchored_urbs, after their disconnect method has returned. The disconnect function should synchronize with a driver's I/O routines to insure that all URB-related activity has completed before it returns. This request is always asynchronous. Success is indicated by returning -EINPROGRESS, at which time the URB will probably not yet have been given back to the device driver. When it is eventually called, the completion function will see urb->status == -ECONNRESET. Failure is indicated by usb_unlink_urb returning any other value. Unlinking will fail when urb is not currently "linked" (i.e., it was never submitted, or it was unlinked before, or the hardware is already finished with it), even if the completion handler has not yet run. UNLINKING AND ENDPOINT QUEUES
[The behaviors and guarantees described below do not apply to virtual root hubs but only to endpoint queues for physical USB devices.] Host Controller Drivers (HCDs) place all the URBs for a particular endpoint in a queue. Normally the queue advances as the controller hardware processes each request. But when an URB terminates with an error its queue generally stops (see below), at least until that URB's completion routine returns. It is guaranteed that a stopped queue will not restart until all its unlinked URBs have been fully retired, with their completion routines run, even if that's not until some time after the original completion handler returns. The same behavior and guarantee apply when an URB terminates because it was unlinked. Bulk and interrupt endpoint queues are guaranteed to stop whenever an URB terminates with any sort of error, including -ECONNRESET, -ENOENT, and -EREMOTEIO. Control endpoint queues behave the same way except that they are not guaranteed to stop for -EREMOTEIO errors. Queues for isochronous endpoints are treated differently, because they must advance at fixed rates. Such queues do not stop when an URB encounters an error or is unlinked. An unlinked isochronous URB may leave a gap in the stream of packets; it is undefined whether such gaps can be filled in. Note that early termination of an URB because a short packet was received will generate a -EREMOTEIO error if and only if the URB_SHORT_NOT_OK flag is set. By setting this flag, USB device drivers can build deep queues for large or complex bulk transfers and clean them up reliably after any sort of aborted transfer by unlinking all pending URBs at the first fault. When a control URB terminates with an error other than -EREMOTEIO, it is quite likely that the status stage of the transfer will not take place. COPYRIGHT
Kernel Hackers Manual 2.6. July 2010 USB_UNLINK_URB(9)
Man Page