#include <linux/module.h>
#include <linux/pci.h>
#include <linux/dma-mapping.h>
#include <linux/kernel.h>
#include <linux/delay.h>
#include <linux/dmapool.h>
#include <linux/ioport.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/timer.h>
#include <linux/list.h>
#include <linux/interrupt.h>
#include <linux/moduleparam.h>
#include <linux/device.h>
#include <linux/usb/ch9.h>
#include <linux/usb/gadget.h>
#include <linux/usb/otg.h>
#include <linux/pm.h>
#include <linux/io.h>
#include <linux/irq.h>
#include <asm/unaligned.h>
#include <linux/platform_device.h>
#include <linux/usb/composite.h>
#include "bdc.h"
#include "bdc_ep.h"
#include "bdc_cmd.h"
#include "bdc_dbg.h"
static const char * const ep0_state_string[] = …;
static void ep_bd_list_free(struct bdc_ep *ep, u32 num_tabs)
{ … }
static inline void chain_table(struct bd_table *prev_table,
struct bd_table *next_table,
u32 bd_p_tab)
{ … }
static int ep_bd_list_alloc(struct bdc_ep *ep)
{ … }
static inline int bd_needed_req(struct bdc_req *req)
{ … }
static int bd_add_to_bdi(struct bdc_ep *ep, dma_addr_t bd_dma_addr)
{ … }
static int bdi_to_tbi(struct bdc_ep *ep, int bdi)
{ … }
static inline int find_end_bdi(struct bdc_ep *ep, int next_hwd_bdi)
{ … }
static int bd_available_ep(struct bdc_ep *ep)
{ … }
void bdc_notify_xfr(struct bdc *bdc, u32 epnum)
{ … }
static struct bdc_bd *bdi_to_bd(struct bdc_ep *ep, int bdi)
{ … }
static void ep_bdlist_eqp_adv(struct bdc_ep *ep)
{ … }
static int setup_first_bd_ep0(struct bdc *bdc, struct bdc_req *req, u32 *dword3)
{ … }
static int setup_bd_list_xfr(struct bdc *bdc, struct bdc_req *req, int num_bds)
{ … }
static int bdc_queue_xfr(struct bdc *bdc, struct bdc_req *req)
{ … }
static void bdc_req_complete(struct bdc_ep *ep, struct bdc_req *req,
int status)
{ … }
int bdc_ep_disable(struct bdc_ep *ep)
{ … }
int bdc_ep_enable(struct bdc_ep *ep)
{ … }
static int ep0_queue_status_stage(struct bdc *bdc)
{ … }
static int ep0_queue(struct bdc_ep *ep, struct bdc_req *req)
{ … }
static int ep0_queue_data_stage(struct bdc *bdc)
{ … }
static int ep_queue(struct bdc_ep *ep, struct bdc_req *req)
{ … }
static int ep_dequeue(struct bdc_ep *ep, struct bdc_req *req)
{ … }
static int ep_set_halt(struct bdc_ep *ep, u32 value)
{ … }
void bdc_free_ep(struct bdc *bdc)
{ … }
static int bdc_set_test_mode(struct bdc *bdc)
{ … }
static void handle_xsr_succ_status(struct bdc *bdc, struct bdc_ep *ep,
struct bdc_sr *sreport)
{ … }
void bdc_xsf_ep0_setup_recv(struct bdc *bdc, struct bdc_sr *sreport)
{ … }
static void ep0_stall(struct bdc *bdc)
{ … }
static int ep0_set_address(struct bdc *bdc, struct usb_ctrlrequest *ctrl)
{ … }
static int ep0_handle_feature_dev(struct bdc *bdc, u16 wValue,
u16 wIndex, bool set)
{ … }
static int ep0_handle_feature(struct bdc *bdc,
struct usb_ctrlrequest *setup_pkt, bool set)
{ … }
static int ep0_handle_status(struct bdc *bdc,
struct usb_ctrlrequest *setup_pkt)
{ … }
static void ep0_set_sel_cmpl(struct usb_ep *_ep, struct usb_request *_req)
{ … }
static int ep0_set_sel(struct bdc *bdc,
struct usb_ctrlrequest *setup_pkt)
{ … }
static int ep0_queue_zlp(struct bdc *bdc)
{ … }
static int handle_control_request(struct bdc *bdc)
{ … }
void bdc_xsf_ep0_data_start(struct bdc *bdc, struct bdc_sr *sreport)
{ … }
void bdc_xsf_ep0_status_start(struct bdc *bdc, struct bdc_sr *sreport)
{ … }
static void ep0_xsf_complete(struct bdc *bdc, struct bdc_sr *sreport)
{ … }
void bdc_sr_xsf(struct bdc *bdc, struct bdc_sr *sreport)
{ … }
static int bdc_gadget_ep_queue(struct usb_ep *_ep,
struct usb_request *_req, gfp_t gfp_flags)
{ … }
static int bdc_gadget_ep_dequeue(struct usb_ep *_ep,
struct usb_request *_req)
{ … }
static int bdc_gadget_ep_set_halt(struct usb_ep *_ep, int value)
{ … }
static struct usb_request *bdc_gadget_alloc_request(struct usb_ep *_ep,
gfp_t gfp_flags)
{ … }
static void bdc_gadget_free_request(struct usb_ep *_ep,
struct usb_request *_req)
{ … }
static int bdc_gadget_ep_enable(struct usb_ep *_ep,
const struct usb_endpoint_descriptor *desc)
{ … }
static int bdc_gadget_ep_disable(struct usb_ep *_ep)
{ … }
static const struct usb_ep_ops bdc_gadget_ep_ops = …;
static int init_ep(struct bdc *bdc, u32 epnum, u32 dir)
{ … }
int bdc_init_ep(struct bdc *bdc)
{ … }