Sophie

Sophie

distrib > CentOS > 6 > i386 > by-pkgid > 2c51d8eb79f8810ada971ee8c30ce1e5 > files > 1412

kernel-doc-2.6.32-71.14.1.el6.noarch.rpm

<?xml version="1.0" encoding="ANSI_X3.4-1968" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968" /><title>struct usb_function</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.2" /><link rel="home" href="index.html" title="USB Gadget API for Linux" /><link rel="up" href="ch03s05.html" title="Composite Device Framework" /><link rel="prev" href="ch03s05.html" title="Composite Device Framework" /><link rel="next" href="re53.html" title="ep_choose" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"><span>struct usb_function</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch03s05.html">Prev</a>&#160;</td><th width="60%" align="center">Composite Device Framework</th><td width="20%" align="right">&#160;<a accesskey="n" href="re53.html">Next</a></td></tr></table><hr /></div><div class="refentry" title="struct usb_function"><a id="API-struct-usb-function"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>struct usb_function &#8212; 
  describes one function of a configuration
 </p></div><div class="refsynopsisdiv" title="Synopsis"><h2>Synopsis</h2><pre class="programlisting">
struct usb_function {
  const char * name;
  struct usb_gadget_strings ** strings;
  struct usb_descriptor_header ** descriptors;
  struct usb_descriptor_header ** hs_descriptors;
  struct usb_configuration * config;
  int (* bind) (struct usb_configuration *,struct usb_function *);
  void (* unbind) (struct usb_configuration *,struct usb_function *);
  int (* set_alt) (struct usb_function *,unsigned interface, unsigned alt);
  int (* get_alt) (struct usb_function *,unsigned interface);
  void (* disable) (struct usb_function *);
  int (* setup) (struct usb_function *,const struct usb_ctrlrequest *);
  void (* suspend) (struct usb_function *);
  void (* resume) (struct usb_function *);
};  </pre></div><div class="refsect1" title="Members"><a id="id2997776"></a><h2>Members</h2><div class="variablelist"><dl><dt><span class="term">name</span></dt><dd><p>
For diagnostics, identifies the function.
      </p></dd><dt><span class="term">strings</span></dt><dd><p>
tables of strings, keyed by identifiers assigned during <code class="function">bind</code>
and by language IDs provided in control requests
      </p></dd><dt><span class="term">descriptors</span></dt><dd><p>
Table of full (or low) speed descriptors, using interface and
string identifiers assigned during <em class="parameter"><code>bind</code></em>().  If this pointer is null,
the function will not be available at full speed (or at low speed).
      </p></dd><dt><span class="term">hs_descriptors</span></dt><dd><p>
Table of high speed descriptors, using interface and
string identifiers assigned during <em class="parameter"><code>bind</code></em>().  If this pointer is null,
the function will not be available at high speed.
      </p></dd><dt><span class="term">config</span></dt><dd><p>
assigned when <em class="parameter"><code>usb_add_function</code></em>() is called; this is the
configuration with which this function is associated.
      </p></dd><dt><span class="term">bind</span></dt><dd><p>
Before the gadget can register, all of its functions <code class="function">bind</code> to the
available resources including string and interface identifiers used
in interface or class descriptors; endpoints; I/O buffers; and so on.
      </p></dd><dt><span class="term">unbind</span></dt><dd><p>
Reverses <em class="parameter"><code>bind</code></em>; called as a side effect of unregistering the
driver which added this function.
      </p></dd><dt><span class="term">set_alt</span></dt><dd><p>
(REQUIRED) Reconfigures altsettings; function drivers may
initialize usb_ep.driver data at this time (when it is used).
Note that setting an interface to its current altsetting resets
interface state, and that all interfaces have a disabled state.
      </p></dd><dt><span class="term">get_alt</span></dt><dd><p>
Returns the active altsetting.  If this is not provided,
then only altsetting zero is supported.
      </p></dd><dt><span class="term">disable</span></dt><dd><p>
(REQUIRED) Indicates the function should be disabled.  Reasons
include host resetting or reconfiguring the gadget, and disconnection.
      </p></dd><dt><span class="term">setup</span></dt><dd><p>
Used for interface-specific control requests.
      </p></dd><dt><span class="term">suspend</span></dt><dd><p>
Notifies functions when the host stops sending USB traffic.
      </p></dd><dt><span class="term">resume</span></dt><dd><p>
Notifies functions when the host restarts USB traffic.
      </p></dd></dl></div></div><div class="refsect1" title="Description"><a id="id2997985"></a><h2>Description</h2><p>
   A single USB function uses one or more interfaces, and should in most
   cases support operation at both full and high speeds.  Each function is
   associated by <em class="parameter"><code>usb_add_function</code></em>() with a one configuration; that function
   causes <em class="parameter"><code>bind</code></em>() to be called so resources can be allocated as part of
   setting up a gadget driver.  Those resources include endpoints, which
   should be allocated using <em class="parameter"><code>usb_ep_autoconfig</code></em>().
   </p><p>

   To support dual speed operation, a function driver provides descriptors
   for both high and full speed operation.  Except in rare cases that don't
   involve bulk endpoints, each speed needs different endpoint descriptors.
   </p><p>

   Function drivers choose their own strategies for managing instance data.
   The simplest strategy just declares it "static', which means the function
   can only be activated once.  If the function needs to be exposed in more
   than one configuration at a given speed, it needs to support multiple
   usb_function structures (one for each configuration).
   </p><p>

   A more complex strategy might encapsulate a <em class="parameter"><code>usb_function</code></em> structure inside
   a driver-specific instance structure to allows multiple activations.  An
   example of multiple activations might be a CDC ACM function that supports
   two or more distinct instances within the same configuration, providing
   several independent logical data links to a USB host.
</p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch03s05.html">Prev</a>&#160;</td><td width="20%" align="center"><a accesskey="u" href="ch03s05.html">Up</a></td><td width="40%" align="right">&#160;<a accesskey="n" href="re53.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Composite Device Framework&#160;</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">&#160;<span>ep_choose</span></td></tr></table></div></body></html>