1USB_BUFFER_MAP_SG(9) USB Core APIs USB_BUFFER_MAP_SG(9)
2
3
4
6 usb_buffer_map_sg - create scatterlist DMA mapping(s) for an endpoint
7
9 int usb_buffer_map_sg(const struct usb_device * dev, int is_in,
10 struct scatterlist * sg, int nents);
11
13 dev
14 device to which the scatterlist will be mapped
15
16 is_in
17 mapping transfer direction
18
19 sg
20 the scatterlist to map
21
22 nents
23 the number of entries in the scatterlist
24
26 Return value is either < 0 (indicating no buffers could be mapped), or
27 the number of DMA mapping array entries in the scatterlist.
28
29 The caller is responsible for placing the resulting DMA addresses from
30 the scatterlist into URB transfer buffer pointers, and for setting the
31 URB_NO_TRANSFER_DMA_MAP transfer flag in each of those URBs.
32
33 Top I/O rates come from queuing URBs, instead of waiting for each one
34 to complete before starting the next I/O. This is particularly easy to
35 do with scatterlists. Just allocate and submit one URB for each DMA
36 mapping entry returned, stopping on the first error or when all
37 succeed. Better yet, use the usb_sg_*() calls, which do that (and more)
38 for you.
39
40 This call would normally be used when translating scatterlist requests,
41 rather than usb_buffer_map, since on some hardware (with IOMMUs) it may
42 be able to coalesce mappings for improved I/O efficiency.
43
44 Reverse the effect of this call with usb_buffer_unmap_sg.
45
47Kernel Hackers Manual 2.6. November 2011 USB_BUFFER_MAP_SG(9)