1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>usb_sg_wait</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="The Linux-USB Host Side API"><link rel="up" href="usbcore.html" title="Chapter 5. USB Core APIs"><link rel="prev" href="API-usb-sg-init.html" title="usb_sg_init"><link rel="next" href="API-usb-sg-cancel.html" title="usb_sg_cancel"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"><span class="phrase">usb_sg_wait</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-usb-sg-init.html">Prev</a> </td><th width="60%" align="center">Chapter 5. USB Core APIs</th><td width="20%" align="right"> <a accesskey="n" href="API-usb-sg-cancel.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="API-usb-sg-wait"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>usb_sg_wait — 2 synchronously execute scatter/gather request 3 </p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">void <b class="fsfunc">usb_sg_wait </b>(</code></td><td>struct usb_sg_request * <var class="pdparam">io</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1"><a name="idp1116187172"></a><h2>Arguments</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="parameter"><code>io</code></em></span></dt><dd><p> 4 request block handle, as initialized with <code class="function">usb_sg_init</code>. 5 some fields become accessible when this call returns. 6 </p></dd></dl></div></div><div class="refsect1"><a name="idp1116189140"></a><h2>Context</h2><p> 7 !in_interrupt () 8</p></div><div class="refsect1"><a name="idp1116189716"></a><h2>Description</h2><p> 9 This function blocks until the specified I/O operation completes. It 10 leverages the grouping of the related I/O requests to get good transfer 11 rates, by queueing the requests. At higher speeds, such queuing can 12 significantly improve USB throughput. 13 </p><p> 14 15 There are three kinds of completion for this function. 16 (1) success, where io->status is zero. The number of io->bytes 17 transferred is as requested. 18 (2) error, where io->status is a negative errno value. The number 19 of io->bytes transferred before the error is usually less 20 than requested, and can be nonzero. 21 (3) cancellation, a type of error with status -ECONNRESET that 22 is initiated by <code class="function">usb_sg_cancel</code>. 23 </p><p> 24 25 When this function returns, all memory allocated through <code class="function">usb_sg_init</code> or 26 this call will have been freed. The request block parameter may still be 27 passed to <code class="function">usb_sg_cancel</code>, or it may be freed. It could also be 28 reinitialized and then reused. 29</p></div><div class="refsect1"><a name="idp1116192492"></a><h2>Data Transfer Rates</h2><p> 30 </p><p> 31 32 Bulk transfers are valid for full or high speed endpoints. 33 The best full speed data rate is 19 packets of 64 bytes each 34 per frame, or 1216 bytes per millisecond. 35 The best high speed data rate is 13 packets of 512 bytes each 36 per microframe, or 52 KBytes per millisecond. 37 </p><p> 38 39 The reason to use interrupt transfers through this API would most likely 40 be to reserve high speed bandwidth, where up to 24 KBytes per millisecond 41 could be transferred. That capability is less useful for low or full 42 speed interrupt endpoints, which allow at most one packet per millisecond, 43 of at most 8 or 64 bytes (respectively). 44 </p><p> 45 46 It is not necessary to call this function to reserve bandwidth for devices 47 under an xHCI host controller, as the bandwidth is reserved when the 48 configuration or interface alt setting is selected. 49</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="API-usb-sg-init.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="usbcore.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="API-usb-sg-cancel.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">usb_sg_init</span> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> <span class="phrase">usb_sg_cancel</span></td></tr></table></div></body></html> 50