Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Fields
usb_request Struct Reference

#include <gadget.h>

Data Fields

voidbuf
 
unsigned length
 
dma_addr_t dma
 
struct scatterlistsg
 
unsigned num_sgs
 
unsigned num_mapped_sgs
 
unsigned stream_id:16
 
unsigned no_interrupt:1
 
unsigned zero:1
 
unsigned short_not_ok:1
 
void(* complete )(struct usb_ep *ep, struct usb_request *req)
 
voidcontext
 
struct list_head list
 
int status
 
unsigned actual
 

Detailed Description

struct usb_request - describes one i/o request : Buffer used for data. Always provide this; some controllers only use PIO, or don't use DMA for some endpoints. : DMA address corresponding to 'buf'. If you don't set this field, and the usb controller needs one, it is responsible for mapping and unmapping the buffer. : a scatterlist for SG-capable controllers. : number of SG entries : number of SG entries mapped to DMA (internal) : Length of that data : The stream id, when USB3.0 bulk streams are being used : If true, hints that no completion irq is needed. Helpful sometimes with deep request queues that are handled directly by DMA controllers. : If true, when writing data, makes the last packet be "short" by adding a zero length packet as needed; : When reading data, makes short packets be treated as errors (queue stops advancing till cleanup). : Function called when request completes, so this request and its buffer may be re-used. The function will always be called with interrupts disabled, and it must not sleep. Reads terminate with a short packet, or when the buffer fills, whichever comes first. When writes terminate, some data bytes will usually still be in flight (often in a hardware fifo). Errors (for reads or writes) stop the queue from advancing until the completion function returns, so that any transfers invalidated by the error may first be dequeued. : For use by the completion callback : For use by the gadget driver. : Reports completion code, zero or a negative errno. Normally, faults block the transfer queue from advancing until the completion callback returns. Code "-ESHUTDOWN" indicates completion caused by device disconnect, or when the driver disabled the endpoint. : Reports bytes transferred to/from the buffer. For reads (OUT transfers) this may be less than the requested length. If the short_not_ok flag is set, short reads are treated as errors even when status otherwise indicates successful completion. Note that for writes (IN transfers) some data bytes may still reside in a device-side FIFO when the request is reported as complete.

These are allocated/freed through the endpoint they're used with. The hardware's driver can add extra per-request data to the memory it returns, which often avoids separate memory allocations (potential failures), later when the request is queued.

Request flags affect request handling, such as whether a zero length packet is written (the "zero" flag), whether a short read should be treated as an error (blocking request queue advance, the "short_not_ok" flag), or hinting that an interrupt is not required (the "no_interrupt" flag, for use with deep request queues).

Bulk endpoints can use any size buffers, and can also be used for interrupt transfers. interrupt-only endpoints can be much less functional.

NOTE: this is analogous to 'struct urb' on the host side, except that it's thinner and promotes more pre-allocation.

Definition at line 90 of file gadget.h.

Field Documentation

unsigned actual

Definition at line 110 of file gadget.h.

Definition at line 91 of file gadget.h.

void(* complete)(struct usb_ep *ep, struct usb_request *req)

Definition at line 104 of file gadget.h.

Definition at line 106 of file gadget.h.

Definition at line 93 of file gadget.h.

unsigned length

Definition at line 92 of file gadget.h.

Definition at line 107 of file gadget.h.

unsigned no_interrupt

Definition at line 100 of file gadget.h.

unsigned num_mapped_sgs

Definition at line 97 of file gadget.h.

unsigned num_sgs

Definition at line 96 of file gadget.h.

Definition at line 95 of file gadget.h.

unsigned short_not_ok

Definition at line 102 of file gadget.h.

Definition at line 109 of file gadget.h.

unsigned stream_id

Definition at line 99 of file gadget.h.

unsigned zero

Definition at line 101 of file gadget.h.


The documentation for this struct was generated from the following file: