Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
mod_gadget.c File Reference
#include <linux/delay.h>
#include <linux/dma-mapping.h>
#include <linux/io.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/usb/ch9.h>
#include <linux/usb/gadget.h>
#include "common.h"

Go to the source code of this file.

Data Structures

struct  usbhsg_request
 
struct  usbhsg_uep
 
struct  usbhsg_gpriv
 
struct  usbhsg_recip_handle
 

Macros

#define EP_NAME_SIZE   8
 
#define USBHSG_STATUS_STARTED   (1 << 0)
 
#define USBHSG_STATUS_REGISTERD   (1 << 1)
 
#define USBHSG_STATUS_WEDGE   (1 << 2)
 
#define USBHSG_STATUS_SELF_POWERED   (1 << 3)
 
#define usbhsg_priv_to_gpriv(priv)
 
#define __usbhsg_for_each_uep(start, pos, g, i)
 
#define usbhsg_for_each_uep(pos, gpriv, i)   __usbhsg_for_each_uep(1, pos, gpriv, i)
 
#define usbhsg_for_each_uep_with_dcp(pos, gpriv, i)   __usbhsg_for_each_uep(0, pos, gpriv, i)
 
#define usbhsg_gadget_to_gpriv(g)   container_of(g, struct usbhsg_gpriv, gadget)
 
#define usbhsg_req_to_ureq(r)   container_of(r, struct usbhsg_request, req)
 
#define usbhsg_ep_to_uep(e)   container_of(e, struct usbhsg_uep, ep)
 
#define usbhsg_gpriv_to_dev(gp)   usbhs_priv_to_dev((gp)->mod.priv)
 
#define usbhsg_gpriv_to_priv(gp)   ((gp)->mod.priv)
 
#define usbhsg_gpriv_to_dcp(gp)   ((gp)->uep)
 
#define usbhsg_gpriv_to_nth_uep(gp, i)   ((gp)->uep + i)
 
#define usbhsg_uep_to_gpriv(u)   ((u)->gpriv)
 
#define usbhsg_uep_to_pipe(u)   ((u)->pipe)
 
#define usbhsg_pipe_to_uep(p)   ((p)->mod_private)
 
#define usbhsg_is_dcp(u)   ((u) == usbhsg_gpriv_to_dcp((u)->gpriv))
 
#define usbhsg_ureq_to_pkt(u)   (&(u)->pkt)
 
#define usbhsg_pkt_to_ureq(i)   container_of(i, struct usbhsg_request, pkt)
 
#define usbhsg_is_not_connected(gp)   ((gp)->gadget.speed == USB_SPEED_UNKNOWN)
 
#define usbhsg_status_init(gp)   do {(gp)->status = 0; } while (0)
 
#define usbhsg_status_set(gp, b)   (gp->status |= b)
 
#define usbhsg_status_clr(gp, b)   (gp->status &= ~b)
 
#define usbhsg_status_has(gp, b)   (gp->status & b)
 

Functions

int usbhs_mod_gadget_probe (struct usbhs_priv *priv)
 
void usbhs_mod_gadget_remove (struct usbhs_priv *priv)
 

Variables

struct usbhsg_recip_handle req_clear_feature
 
struct usbhsg_recip_handle req_set_feature
 
struct usbhsg_recip_handle req_get_status
 

Macro Definition Documentation

#define __usbhsg_for_each_uep (   start,
  pos,
  g,
  i 
)
Value:
for (i = start, pos = (g)->uep + i; \
i < (g)->uep_size; \
i++, pos = (g)->uep + i)

Definition at line 79 of file mod_gadget.c.

#define EP_NAME_SIZE   8

Definition at line 34 of file mod_gadget.c.

#define usbhsg_ep_to_uep (   e)    container_of(e, struct usbhsg_uep, ep)

Definition at line 96 of file mod_gadget.c.

#define usbhsg_for_each_uep (   pos,
  gpriv,
  i 
)    __usbhsg_for_each_uep(1, pos, gpriv, i)

Definition at line 84 of file mod_gadget.c.

#define usbhsg_for_each_uep_with_dcp (   pos,
  gpriv,
  i 
)    __usbhsg_for_each_uep(0, pos, gpriv, i)

Definition at line 87 of file mod_gadget.c.

#define usbhsg_gadget_to_gpriv (   g)    container_of(g, struct usbhsg_gpriv, gadget)

Definition at line 90 of file mod_gadget.c.

#define usbhsg_gpriv_to_dcp (   gp)    ((gp)->uep)

Definition at line 99 of file mod_gadget.c.

#define usbhsg_gpriv_to_dev (   gp)    usbhs_priv_to_dev((gp)->mod.priv)

Definition at line 97 of file mod_gadget.c.

#define usbhsg_gpriv_to_nth_uep (   gp,
  i 
)    ((gp)->uep + i)

Definition at line 100 of file mod_gadget.c.

#define usbhsg_gpriv_to_priv (   gp)    ((gp)->mod.priv)

Definition at line 98 of file mod_gadget.c.

#define usbhsg_is_dcp (   u)    ((u) == usbhsg_gpriv_to_dcp((u)->gpriv))

Definition at line 104 of file mod_gadget.c.

#define usbhsg_is_not_connected (   gp)    ((gp)->gadget.speed == USB_SPEED_UNKNOWN)

Definition at line 110 of file mod_gadget.c.

#define usbhsg_pipe_to_uep (   p)    ((p)->mod_private)

Definition at line 103 of file mod_gadget.c.

#define usbhsg_pkt_to_ureq (   i)    container_of(i, struct usbhsg_request, pkt)

Definition at line 107 of file mod_gadget.c.

#define usbhsg_priv_to_gpriv (   priv)
Value:

Definition at line 74 of file mod_gadget.c.

#define usbhsg_req_to_ureq (   r)    container_of(r, struct usbhsg_request, req)

Definition at line 93 of file mod_gadget.c.

#define usbhsg_status_clr (   gp,
  b 
)    (gp->status &= ~b)

Definition at line 115 of file mod_gadget.c.

#define usbhsg_status_has (   gp,
  b 
)    (gp->status & b)

Definition at line 116 of file mod_gadget.c.

#define usbhsg_status_init (   gp)    do {(gp)->status = 0; } while (0)

Definition at line 113 of file mod_gadget.c.

#define USBHSG_STATUS_REGISTERD   (1 << 1)

Definition at line 56 of file mod_gadget.c.

#define USBHSG_STATUS_SELF_POWERED   (1 << 3)

Definition at line 58 of file mod_gadget.c.

#define usbhsg_status_set (   gp,
  b 
)    (gp->status |= b)

Definition at line 114 of file mod_gadget.c.

#define USBHSG_STATUS_STARTED   (1 << 0)

Definition at line 55 of file mod_gadget.c.

#define USBHSG_STATUS_WEDGE   (1 << 2)

Definition at line 57 of file mod_gadget.c.

#define usbhsg_uep_to_gpriv (   u)    ((u)->gpriv)

Definition at line 101 of file mod_gadget.c.

#define usbhsg_uep_to_pipe (   u)    ((u)->pipe)

Definition at line 102 of file mod_gadget.c.

#define usbhsg_ureq_to_pkt (   u)    (&(u)->pkt)

Definition at line 106 of file mod_gadget.c.

Function Documentation

int usbhs_mod_gadget_probe ( struct usbhs_priv priv)

Definition at line 927 of file mod_gadget.c.

void usbhs_mod_gadget_remove ( struct usbhs_priv priv)

Definition at line 1028 of file mod_gadget.c.

Variable Documentation

struct usbhsg_recip_handle req_clear_feature
Initial value:
= {
.name = "clear feature",
.device = usbhsg_recip_handler_std_control_done,
.interface = usbhsg_recip_handler_std_control_done,
.endpoint = usbhsg_recip_handler_std_clear_endpoint,
}

Definition at line 233 of file mod_gadget.c.

struct usbhsg_recip_handle req_get_status
Initial value:
= {
.name = "get status",
.device = usbhsg_recip_handler_std_get_device,
.interface = usbhsg_recip_handler_std_get_interface,
.endpoint = usbhsg_recip_handler_std_get_endpoint,
}

Definition at line 375 of file mod_gadget.c.

struct usbhsg_recip_handle req_set_feature
Initial value:
= {
.name = "set feature",
.device = usbhsg_recip_handler_std_set_device,
.interface = usbhsg_recip_handler_std_control_done,
.endpoint = usbhsg_recip_handler_std_set_endpoint,
}

Definition at line 274 of file mod_gadget.c.