Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions
epautoconf.c File Reference
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/types.h>
#include <linux/device.h>
#include <linux/ctype.h>
#include <linux/string.h>
#include <linux/usb/ch9.h>
#include <linux/usb/gadget.h>
#include "gadget_chips.h"

Go to the source code of this file.

Functions

struct usb_epusb_ep_autoconfig_ss (struct usb_gadget *gadget, struct usb_endpoint_descriptor *desc, struct usb_ss_ep_comp_descriptor *ep_comp)
 
 EXPORT_SYMBOL_GPL (usb_ep_autoconfig_ss)
 
struct usb_epusb_ep_autoconfig (struct usb_gadget *gadget, struct usb_endpoint_descriptor *desc)
 
 EXPORT_SYMBOL_GPL (usb_ep_autoconfig)
 
void usb_ep_autoconfig_reset (struct usb_gadget *gadget)
 
 EXPORT_SYMBOL_GPL (usb_ep_autoconfig_reset)
 

Function Documentation

EXPORT_SYMBOL_GPL ( usb_ep_autoconfig_ss  )
EXPORT_SYMBOL_GPL ( usb_ep_autoconfig  )
EXPORT_SYMBOL_GPL ( usb_ep_autoconfig_reset  )
struct usb_ep* usb_ep_autoconfig ( struct usb_gadget gadget,
struct usb_endpoint_descriptor desc 
)
read

usb_ep_autoconfig() - choose an endpoint matching the descriptor : The device to which the endpoint must belong. : Endpoint descriptor, with endpoint direction and transfer mode initialized. For periodic transfers, the maximum packet size must also be initialized. This is modified on success.

By choosing an endpoint to use with the specified descriptor, this routine simplifies writing gadget drivers that work with multiple USB device controllers. The endpoint would be passed later to usb_ep_enable(), along with some descriptor.

That second descriptor won't always be the same as the first one. For example, isochronous endpoints can be autoconfigured for high bandwidth, and then used in several lower bandwidth altsettings. Also, high and full speed descriptors will be different.

Be sure to examine and test the results of autoconfiguration on your hardware. This code may not make the best choices about how to use the USB controller, and it can't know all the restrictions that may apply. Some combinations of driver and hardware won't be able to autoconfigure.

On success, this returns an un-claimed usb_ep, and modifies the endpoint descriptor bEndpointAddress. For bulk endpoints, the wMaxPacket value is initialized as if the endpoint were used at full speed. To prevent the endpoint from being returned by a later autoconfig call, claim it by assigning ep->driver_data to some non-null value.

On failure, this returns a null endpoint descriptor.

Definition at line 352 of file epautoconf.c.

void usb_ep_autoconfig_reset ( struct usb_gadget gadget)

usb_ep_autoconfig_reset - reset endpoint autoconfig state : device for which autoconfig state will be reset

Use this for devices where one configuration may need to assign endpoint resources very differently from the next one. It clears state such as ep->driver_data and the record of assigned endpoints used by usb_ep_autoconfig().

Definition at line 370 of file epautoconf.c.

struct usb_ep* usb_ep_autoconfig_ss ( struct usb_gadget gadget,
struct usb_endpoint_descriptor desc,
struct usb_ss_ep_comp_descriptor ep_comp 
)
read

usb_ep_autoconfig_ss() - choose an endpoint matching the ep descriptor and ep companion descriptor : The device to which the endpoint must belong. : Endpoint descriptor, with endpoint direction and transfer mode initialized. For periodic transfers, the maximum packet size must also be initialized. This is modified on success. : Endpoint companion descriptor, with the required number of streams. Will be modified when the chosen EP supports a different number of streams.

This routine replaces the usb_ep_autoconfig when needed superspeed enhancments. If such enhancemnets are required, the FD should call usb_ep_autoconfig_ss directly and provide the additional ep_comp parameter.

By choosing an endpoint to use with the specified descriptor, this routine simplifies writing gadget drivers that work with multiple USB device controllers. The endpoint would be passed later to usb_ep_enable(), along with some descriptor.

That second descriptor won't always be the same as the first one. For example, isochronous endpoints can be autoconfigured for high bandwidth, and then used in several lower bandwidth altsettings. Also, high and full speed descriptors will be different.

Be sure to examine and test the results of autoconfiguration on your hardware. This code may not make the best choices about how to use the USB controller, and it can't know all the restrictions that may apply. Some combinations of driver and hardware won't be able to autoconfigure.

On success, this returns an un-claimed usb_ep, and modifies the endpoint descriptor bEndpointAddress. For bulk endpoints, the wMaxPacket value is initialized as if the endpoint were used at full speed and the bmAttribute field in the ep companion descriptor is updated with the assigned number of streams if it is different from the original value. To prevent the endpoint from being returned by a later autoconfig call, claim it by assigning ep->driver_data to some non-null value.

On failure, this returns a null endpoint descriptor.

Definition at line 248 of file epautoconf.c.