Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions
gadget.c File Reference
#include <linux/kernel.h>
#include <linux/delay.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/list.h>
#include <linux/dma-mapping.h>
#include <linux/usb/ch9.h>
#include <linux/usb/gadget.h>
#include "core.h"
#include "gadget.h"
#include "io.h"

Go to the source code of this file.

Functions

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)
 
int dwc3_gadget_resize_tx_fifos (struct dwc3 *dwc)
 
void dwc3_gadget_giveback (struct dwc3_ep *dep, struct dwc3_request *req, int status)
 
int dwc3_send_gadget_generic_command (struct dwc3 *dwc, int cmd, u32 param)
 
int dwc3_send_gadget_ep_cmd (struct dwc3 *dwc, unsigned ep, unsigned cmd, struct dwc3_gadget_ep_cmd_params *params)
 
int __dwc3_gadget_ep_set_halt (struct dwc3_ep *dep, int value)
 
int __devinit dwc3_gadget_init (struct dwc3 *dwc)
 
void dwc3_gadget_exit (struct dwc3 *dwc)
 

Function Documentation

int __dwc3_gadget_ep_set_halt ( struct dwc3_ep dep,
int  value 
)

Definition at line 1205 of file gadget.c.

void dwc3_gadget_exit ( struct dwc3 dwc)

Definition at line 2527 of file gadget.c.

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

Definition at line 240 of file gadget.c.

int __devinit dwc3_gadget_init ( struct dwc3 dwc)

dwc3_gadget_init - Initializes gadget related registers : pointer to our controller context structure

Returns 0 on success otherwise negative errno.

Definition at line 2377 of file gadget.c.

int dwc3_gadget_resize_tx_fifos ( struct dwc3 dwc)

dwc3_gadget_resize_tx_fifos - reallocate fifo spaces for current use-case : pointer to our context structure

This function will a best effort FIFO allocation in order to improve FIFO usage and throughput, while still allowing us to enable as many endpoints as possible.

Keep in mind that this operation will be highly dependent on the configured size for RAM1 - which contains TxFifo -, the amount of endpoints enabled on coreConsultant tool, and the width of the Master Bus.

In the ideal world, we would always be able to satisfy the following equation:

((512 + 2 * MDWIDTH-Bytes) + (Number of IN Endpoints - 1) * \ (3 * (1024 + MDWIDTH-Bytes) + MDWIDTH-Bytes)) / MDWIDTH-Bytes

Unfortunately, due to many variables that's not always the case.

Definition at line 171 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.