Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
udc-core.c File Reference
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/device.h>
#include <linux/list.h>
#include <linux/err.h>
#include <linux/dma-mapping.h>
#include <linux/usb/ch9.h>
#include <linux/usb/gadget.h>

Go to the source code of this file.

Data Structures

struct  usb_udc
 

Macros

#define USB_UDC_SPEED_ATTR(name, param)
 
#define USB_UDC_ATTR(name)
 

Functions

int usb_gadget_map_request (struct usb_gadget *gadget, struct usb_request *req, int is_in)
 
 EXPORT_SYMBOL_GPL (usb_gadget_map_request)
 
void usb_gadget_unmap_request (struct usb_gadget *gadget, struct usb_request *req, int is_in)
 
 EXPORT_SYMBOL_GPL (usb_gadget_unmap_request)
 
int usb_add_gadget_udc (struct device *parent, struct usb_gadget *gadget)
 
 EXPORT_SYMBOL_GPL (usb_add_gadget_udc)
 
void usb_del_gadget_udc (struct usb_gadget *gadget)
 
 EXPORT_SYMBOL_GPL (usb_del_gadget_udc)
 
int usb_gadget_probe_driver (struct usb_gadget_driver *driver)
 
 EXPORT_SYMBOL_GPL (usb_gadget_probe_driver)
 
int usb_gadget_unregister_driver (struct usb_gadget_driver *driver)
 
 EXPORT_SYMBOL_GPL (usb_gadget_unregister_driver)
 
 subsys_initcall (usb_udc_init)
 
 module_exit (usb_udc_exit)
 
 MODULE_DESCRIPTION ("UDC Framework")
 
 MODULE_AUTHOR ("Felipe Balbi <[email protected]>")
 
 MODULE_LICENSE ("GPL v2")
 

Macro Definition Documentation

#define USB_UDC_ATTR (   name)
Value:
ssize_t usb_udc_##name##_show(struct device *dev, \
struct device_attribute *attr, char *buf) \
{ \
struct usb_gadget *gadget = udc->gadget; \
\
return snprintf(buf, PAGE_SIZE, "%d\n", gadget->name); \
} \
static DEVICE_ATTR(name, S_IRUGO, usb_udc_##name##_show, NULL)

Definition at line 452 of file udc-core.c.

#define USB_UDC_SPEED_ATTR (   name,
  param 
)
Value:
ssize_t usb_udc_##param##_show(struct device *dev, \
struct device_attribute *attr, char *buf) \
{ \
return snprintf(buf, PAGE_SIZE, "%s\n", \
usb_speed_string(udc->gadget->param)); \
} \
static DEVICE_ATTR(name, S_IRUSR, usb_udc_##param##_show, NULL)

Definition at line 429 of file udc-core.c.

Function Documentation

EXPORT_SYMBOL_GPL ( usb_gadget_map_request  )
EXPORT_SYMBOL_GPL ( usb_gadget_unmap_request  )
EXPORT_SYMBOL_GPL ( usb_add_gadget_udc  )
EXPORT_SYMBOL_GPL ( usb_del_gadget_udc  )
EXPORT_SYMBOL_GPL ( usb_gadget_probe_driver  )
EXPORT_SYMBOL_GPL ( usb_gadget_unregister_driver  )
MODULE_AUTHOR ( "Felipe Balbi <[email protected]>"  )
MODULE_DESCRIPTION ( "UDC Framework"  )
module_exit ( usb_udc_exit  )
MODULE_LICENSE ( "GPL v2 )
subsys_initcall ( usb_udc_init  )
int usb_add_gadget_udc ( struct device parent,
struct usb_gadget gadget 
)

usb_add_gadget_udc - adds a new gadget to the udc class driver list : the parent device to this udc. Usually the controller driver's device. : the gadget to be added to the list

Returns zero on success, negative errno otherwise.

Definition at line 207 of file udc-core.c.

void usb_del_gadget_udc ( struct usb_gadget gadget)

usb_del_gadget_udc - deletes from udc_list : the gadget to be removed.

This, will call usb_gadget_unregister_driver() if the is still busy.

Definition at line 284 of file udc-core.c.

int usb_gadget_map_request ( struct usb_gadget gadget,
struct usb_request req,
int  is_in 
)

Definition at line 53 of file udc-core.c.

int usb_gadget_probe_driver ( struct usb_gadget_driver driver)

usb_gadget_probe_driver - probe a gadget driver : the driver being registered Context: can sleep

Call this in your gadget driver's module initialization function, to tell the underlying usb controller driver about your driver. The () function will be called to bind it to a gadget before this registration call returns. It's expected that the () function will be in init sections.

Definition at line 314 of file udc-core.c.

void usb_gadget_unmap_request ( struct usb_gadget gadget,
struct usb_request req,
int  is_in 
)

Definition at line 84 of file udc-core.c.

int usb_gadget_unregister_driver ( struct usb_gadget_driver driver)

usb_gadget_unregister_driver - unregister a gadget driver :the driver being unregistered Context: can sleep

Call this in your gadget driver's module cleanup function, to tell the underlying usb controller that your driver is going away. If the controller is connected to a USB host, it will first disconnect(). The driver is also requested to unbind() and clean up any device state, before this procedure finally returns. It's expected that the unbind() functions will in in exit sections, so may not be linked in some kernels.

Definition at line 372 of file udc-core.c.