drivers/usb/gadget/udc/bdc/bdc.h

Source file repositories/reference/linux-study-clean/drivers/usb/gadget/udc/bdc/bdc.h

File Facts

System
Linux kernel
Corpus path
drivers/usb/gadget/udc/bdc/bdc.h
Extension
.h
Size
12348 bytes
Lines
490
Domain
Driver Families
Bucket
drivers/usb
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

struct bdc_bd {
	__le32 offset[4];
};

/* Status report in Status report ring(srr) */
struct bdc_sr {
	__le32 offset[4];
};

/* bd_table: contiguous bd's in a table */
struct bd_table {
	struct bdc_bd *start_bd;
	/* dma address of start bd of table*/
	dma_addr_t dma;
};

/*
 * Each endpoint has a bdl(buffer descriptor list), bdl consists of 1 or more bd
 * table's chained to each other through a chain bd, every table has equal
 * number of bds. the software uses bdi(bd index) to refer to particular bd in
 * the list.
 */
struct bd_list {
	/* Array of bd table pointers*/
	struct bd_table **bd_table_array;
	/* How many tables chained to each other */
	int num_tabs;
	/* Max_bdi = num_tabs * num_bds_table - 1 */
	int max_bdi;
	/* current enq bdi from sw point of view */
	int eqp_bdi;
	/* current deq bdi from sw point of view */
	int hwd_bdi;
	/* numbers of bds per table */
	int num_bds_table;
};

struct bdc_req;

/* Representation of a transfer, one transfer can have multiple bd's */
struct bd_transfer {
	struct bdc_req *req;
	/* start bd index */
	int start_bdi;
	/* this will be the next hw dqp when this transfer completes */
	int next_hwd_bdi;
	/* number of bds in this transfer */
	int num_bds;
};

/*
 * Representation of a gadget request, every gadget request is contained
 * by 1 bd_transfer.
 */
struct bdc_req {
	struct usb_request	usb_req;
	struct list_head	queue;
	struct bdc_ep		*ep;
	/* only one Transfer per request */
	struct bd_transfer bd_xfr;
	int	epnum;
};

/* scratchpad buffer needed by bdc hardware */
struct bdc_scratchpad {
	dma_addr_t sp_dma;
	void *buff;
	u32 size;
};

/* endpoint representation */
struct bdc_ep {
	struct usb_ep	usb_ep;
	struct list_head queue;
	struct bdc *bdc;
	u8  ep_type;
	u8  dir;
	u8  ep_num;
	const struct usb_ss_ep_comp_descriptor	*comp_desc;
	const struct usb_endpoint_descriptor	*desc;
	unsigned int flags;
	char name[20];
	/* endpoint bd list*/
	struct bd_list bd_list;
	/*
	 * HW generates extra event for multi bd tranfers, this flag helps in
	 * ignoring the extra event
	 */
	bool ignore_next_sr;
};

Annotation

Implementation Notes