Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
gadget.h File Reference
#include <linux/list.h>
#include <linux/usb/gadget.h>
#include "io.h"

Go to the source code of this file.

Data Structures

struct  dwc3_gadget_ep_cmd_params
 

Macros

#define to_dwc3_ep(ep)   (container_of(ep, struct dwc3_ep, endpoint))
 
#define gadget_to_dwc(g)   (container_of(g, struct dwc3, gadget))
 
#define DWC3_DEPCFG_INT_NUM(n)   ((n) << 0)
 
#define DWC3_DEPCFG_XFER_COMPLETE_EN   (1 << 8)
 
#define DWC3_DEPCFG_XFER_IN_PROGRESS_EN   (1 << 9)
 
#define DWC3_DEPCFG_XFER_NOT_READY_EN   (1 << 10)
 
#define DWC3_DEPCFG_FIFO_ERROR_EN   (1 << 11)
 
#define DWC3_DEPCFG_STREAM_EVENT_EN   (1 << 13)
 
#define DWC3_DEPCFG_BINTERVAL_M1(n)   ((n) << 16)
 
#define DWC3_DEPCFG_STREAM_CAPABLE   (1 << 24)
 
#define DWC3_DEPCFG_EP_NUMBER(n)   ((n) << 25)
 
#define DWC3_DEPCFG_BULK_BASED   (1 << 30)
 
#define DWC3_DEPCFG_FIFO_BASED   (1 << 31)
 
#define DWC3_DEPCFG_EP_TYPE(n)   ((n) << 1)
 
#define DWC3_DEPCFG_MAX_PACKET_SIZE(n)   ((n) << 3)
 
#define DWC3_DEPCFG_FIFO_NUMBER(n)   ((n) << 17)
 
#define DWC3_DEPCFG_BURST_SIZE(n)   ((n) << 22)
 
#define DWC3_DEPCFG_DATA_SEQ_NUM(n)   ((n) << 26)
 
#define DWC3_DEPCFG_IGN_SEQ_NUM   (1 << 31)
 
#define DWC3_DEPCFG_ACTION_INIT   (0 << 30)
 
#define DWC3_DEPCFG_ACTION_RESTORE   (1 << 30)
 
#define DWC3_DEPCFG_ACTION_MODIFY   (2 << 30)
 
#define DWC3_DEPXFERCFG_NUM_XFER_RES(n)   ((n) & 0xffff)
 
#define to_dwc3_request(r)   (container_of(r, struct dwc3_request, request))
 

Functions

void dwc3_gadget_giveback (struct dwc3_ep *dep, struct dwc3_request *req, int status)
 
int dwc3_gadget_set_test_mode (struct dwc3 *dwc, int mode)
 
int dwc3_gadget_set_link_state (struct dwc3 *dwc, enum dwc3_link_state state)
 
void dwc3_ep0_interrupt (struct dwc3 *dwc, const struct dwc3_event_depevt *event)
 
void dwc3_ep0_out_start (struct dwc3 *dwc)
 
int dwc3_gadget_ep0_set_halt (struct usb_ep *ep, int value)
 
int dwc3_gadget_ep0_queue (struct usb_ep *ep, struct usb_request *request, gfp_t gfp_flags)
 
int __dwc3_gadget_ep_set_halt (struct dwc3_ep *dep, int value)
 
int dwc3_send_gadget_ep_cmd (struct dwc3 *dwc, unsigned ep, unsigned cmd, struct dwc3_gadget_ep_cmd_params *params)
 
int dwc3_send_gadget_generic_command (struct dwc3 *dwc, int cmd, u32 param)
 

Macro Definition Documentation

#define DWC3_DEPCFG_ACTION_INIT   (0 << 30)

Definition at line 72 of file gadget.h.

#define DWC3_DEPCFG_ACTION_MODIFY   (2 << 30)

Definition at line 74 of file gadget.h.

#define DWC3_DEPCFG_ACTION_RESTORE   (1 << 30)

Definition at line 73 of file gadget.h.

#define DWC3_DEPCFG_BINTERVAL_M1 (   n)    ((n) << 16)

Definition at line 57 of file gadget.h.

#define DWC3_DEPCFG_BULK_BASED   (1 << 30)

Definition at line 60 of file gadget.h.

#define DWC3_DEPCFG_BURST_SIZE (   n)    ((n) << 22)

Definition at line 67 of file gadget.h.

#define DWC3_DEPCFG_DATA_SEQ_NUM (   n)    ((n) << 26)

Definition at line 68 of file gadget.h.

#define DWC3_DEPCFG_EP_NUMBER (   n)    ((n) << 25)

Definition at line 59 of file gadget.h.

#define DWC3_DEPCFG_EP_TYPE (   n)    ((n) << 1)

Definition at line 64 of file gadget.h.

#define DWC3_DEPCFG_FIFO_BASED   (1 << 31)

Definition at line 61 of file gadget.h.

#define DWC3_DEPCFG_FIFO_ERROR_EN   (1 << 11)

Definition at line 55 of file gadget.h.

#define DWC3_DEPCFG_FIFO_NUMBER (   n)    ((n) << 17)

Definition at line 66 of file gadget.h.

#define DWC3_DEPCFG_IGN_SEQ_NUM   (1 << 31)

Definition at line 70 of file gadget.h.

#define DWC3_DEPCFG_INT_NUM (   n)    ((n) << 0)

Definition at line 51 of file gadget.h.

#define DWC3_DEPCFG_MAX_PACKET_SIZE (   n)    ((n) << 3)

Definition at line 65 of file gadget.h.

#define DWC3_DEPCFG_STREAM_CAPABLE   (1 << 24)

Definition at line 58 of file gadget.h.

#define DWC3_DEPCFG_STREAM_EVENT_EN   (1 << 13)

Definition at line 56 of file gadget.h.

#define DWC3_DEPCFG_XFER_COMPLETE_EN   (1 << 8)

Definition at line 52 of file gadget.h.

#define DWC3_DEPCFG_XFER_IN_PROGRESS_EN   (1 << 9)

Definition at line 53 of file gadget.h.

#define DWC3_DEPCFG_XFER_NOT_READY_EN   (1 << 10)

Definition at line 54 of file gadget.h.

#define DWC3_DEPXFERCFG_NUM_XFER_RES (   n)    ((n) & 0xffff)

Definition at line 77 of file gadget.h.

#define gadget_to_dwc (   g)    (container_of(g, struct dwc3, gadget))

Definition at line 48 of file gadget.h.

#define to_dwc3_ep (   ep)    (container_of(ep, struct dwc3_ep, endpoint))

Definition at line 47 of file gadget.h.

#define to_dwc3_request (   r)    (container_of(r, struct dwc3_request, request))

Definition at line 87 of file gadget.h.

Function Documentation

int __dwc3_gadget_ep_set_halt ( struct dwc3_ep dep,
int  value 
)

Definition at line 1205 of file gadget.c.

void dwc3_ep0_interrupt ( struct dwc3 dwc,
const struct dwc3_event_depevt event 
)

Definition at line 1029 of file ep0.c.

void dwc3_ep0_out_start ( struct dwc3 dwc)

Definition at line 298 of file ep0.c.

int dwc3_gadget_ep0_queue ( struct usb_ep ep,
struct usb_request request,
gfp_t  gfp_flags 
)

Definition at line 226 of file ep0.c.

int dwc3_gadget_ep0_set_halt ( struct usb_ep ep,
int  value 
)

Definition at line 288 of file ep0.c.

void dwc3_gadget_giveback ( struct dwc3_ep dep,
struct dwc3_request req,
int  status 
)

Definition at line 240 of file gadget.c.

int dwc3_gadget_set_link_state ( struct dwc3 dwc,
enum dwc3_link_state  state 
)

dwc3_gadget_set_link_state - Sets USB Link to a particular State : pointer to our context structure : the state to put link into

Caller should take care of locking. This function will return 0 on success or -ETIMEDOUT.

Definition at line 98 of file gadget.c.

int dwc3_gadget_set_test_mode ( struct dwc3 dwc,
int  mode 
)

gadget.c - DesignWare USB3 DRD Controller Gadget Framework Link

Copyright (C) 2010-2011 Texas Instruments Incorporated - http://www.ti.com

Authors: Felipe Balbi balbi.nosp@m.@ti..nosp@m.com, Sebastian Andrzej Siewior bigea.nosp@m.sy@l.nosp@m.inutr.nosp@m.onix.nosp@m..de

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions, and the following disclaimer, without modification.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. The names of the above-listed copyright holders may not be used to endorse or promote products derived from this software without specific prior written permission.

ALTERNATIVELY, this software may be distributed under the terms of the GNU General Public License ("GPL") version 2, as published by the Free Software Foundation.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. dwc3_gadget_set_test_mode - Enables USB2 Test Modes : pointer to our context structure : the mode to set (J, K SE0 NAK, Force Enable)

Caller should take care of locking. This function will return 0 on success or -EINVAL if wrong Test Selector is passed

Definition at line 66 of file gadget.c.

int dwc3_send_gadget_ep_cmd ( struct dwc3 dwc,
unsigned  ep,
unsigned  cmd,
struct dwc3_gadget_ep_cmd_params params 
)

Definition at line 334 of file gadget.c.

int dwc3_send_gadget_generic_command ( struct dwc3 dwc,
int  cmd,
u32  param 
)

Definition at line 307 of file gadget.c.