⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dwc_otg_regs.h

📁 host usb 主设备程序 支持sd卡 mouse keyboard 的最单单的驱动程序 gcc编译
💻 H
📖 第 1 页 / 共 4 页
字号:
		/** OUT Endpoint bits */		unsigned out:16;	} ep;	struct {		/** IN Endpoint bits */		unsigned inep0:1;		unsigned inep1:1;		unsigned inep2:1;		unsigned inep3:1;		unsigned inep4:1;		unsigned inep5:1;		unsigned inep6:1;		unsigned inep7:1;		unsigned inep8:1;		unsigned inep9:1;		unsigned inep10:1;		unsigned inep11:1;		unsigned inep12:1;		unsigned inep13:1;		unsigned inep14:1;		unsigned inep15:1;		/** OUT Endpoint bits */		unsigned outep0:1;		unsigned outep1:1;		unsigned outep2:1;		unsigned outep3:1;		unsigned outep4:1;		unsigned outep5:1;		unsigned outep6:1;		unsigned outep7:1;		unsigned outep8:1;		unsigned outep9:1;		unsigned outep10:1;		unsigned outep11:1;		unsigned outep12:1;		unsigned outep13:1;		unsigned outep14:1;		unsigned outep15:1;	} b;} daint_data_t;/** * This union represents the bit fields in the Device IN Token Queue * Read Registers. * - Read the register into the <i>d32</i> member. * - READ-ONLY Register */typedef union dtknq1_data {	/** raw register data */	uint32_t d32;	/** register bits */	struct {		/** In Token Queue Write Pointer */		unsigned intknwptr:5;		/** Reserved */		unsigned reserved05_06:2;		/** write pointer has wrapped. */		unsigned wrap_bit:1;		/** EP Numbers of IN Tokens 0 ... 4 */		unsigned epnums0_5:24;	} b;} dtknq1_data_t;/** * This union represents Threshold control Register * - Read and write the register into the <i>d32</i> member. * - READ-WRITABLE Register */typedef union dthrctl_data {	/** raw register data */	uint32_t d32;	/** register bits */	struct {		/** non ISO Tx Thr. Enable */		unsigned non_iso_thr_en:1;		/** ISO Tx Thr. Enable */		unsigned iso_thr_en:1;		/** Tx Thr. Length */		unsigned tx_thr_len:9;		/** Reserved */		unsigned reserved11_15:5;		/** Rx Thr. Enable */		unsigned rx_thr_en:1;		/** Rx Thr. Length */		unsigned rx_thr_len:9;		/** Reserved */		unsigned reserved26_31:6;	} b;} dthrctl_data_t;/** * Device Logical IN Endpoint-Specific Registers. <i>Offsets * 900h-AFCh</i> * * There will be one set of endpoint registers per logical endpoint * implemented. * * <i>These registers are visible only in Device mode and must not be * accessed in Host mode, as the results are unknown.</i> */typedef struct dwc_otg_dev_in_ep_regs {	/** Device IN Endpoint Control Register. <i>Offset:900h +	 * (ep_num * 20h) + 00h</i> */	volatile uint32_t diepctl;	/** Reserved. <i>Offset:900h + (ep_num * 20h) + 04h</i> */	uint32_t reserved04;	/** Device IN Endpoint Interrupt Register. <i>Offset:900h +	 * (ep_num * 20h) + 08h</i> */	volatile uint32_t diepint;	/** Reserved. <i>Offset:900h + (ep_num * 20h) + 0Ch</i> */	uint32_t reserved0C;	/** Device IN Endpoint Transfer Size	 * Register. <i>Offset:900h + (ep_num * 20h) + 10h</i> */	volatile uint32_t dieptsiz;	/** Device IN Endpoint DMA Address Register. <i>Offset:900h +	 * (ep_num * 20h) + 14h</i> */	volatile uint32_t diepdma;	/** Device IN Endpoint Transmit FIFO Status Register. <i>Offset:900h +	 * (ep_num * 20h) + 18h</i> */	volatile uint32_t dtxfsts;	/** Device IN Endpoint DMA Buffer Register. <i>Offset:900h +	 * (ep_num * 20h) + 1Ch</i> */	volatile uint32_t diepdmab;} dwc_otg_dev_in_ep_regs_t;/** * Device Logical OUT Endpoint-Specific Registers. <i>Offsets: * B00h-CFCh</i> * * There will be one set of endpoint registers per logical endpoint * implemented. * * <i>These registers are visible only in Device mode and must not be * accessed in Host mode, as the results are unknown.</i> */typedef struct dwc_otg_dev_out_ep_regs {	/** Device OUT Endpoint Control Register. <i>Offset:B00h +	 * (ep_num * 20h) + 00h</i> */	volatile uint32_t doepctl;	/** Device OUT Endpoint Frame number Register.	<i>Offset:	 * B00h + (ep_num * 20h) + 04h</i> */	volatile uint32_t doepfn;	/** Device OUT Endpoint Interrupt Register. <i>Offset:B00h +	 * (ep_num * 20h) + 08h</i> */	volatile uint32_t doepint;	/** Reserved. <i>Offset:B00h + (ep_num * 20h) + 0Ch</i> */	uint32_t reserved0C;	/** Device OUT Endpoint Transfer Size Register. <i>Offset:	 * B00h + (ep_num * 20h) + 10h</i> */	volatile uint32_t doeptsiz;	/** Device OUT Endpoint DMA Address Register. <i>Offset:B00h	 * + (ep_num * 20h) + 14h</i> */	volatile uint32_t doepdma;	/** Device OUT Endpoint DMA Buffer Register. <i>Offset:B00h	 * + (ep_num * 20h) + 18h</i> */	uint32_t doepdmab;	/** Reserved. <i>Offset:B00h + 	 * (ep_num * 20h) + 1Ch</i> */	uint32_t unused;} dwc_otg_dev_out_ep_regs_t;/** * This union represents the bit fields in the Device EP Control * Register.  Read the register into the <i>d32</i> member then * set/clear the bits using the <i>b</i>it elements. */typedef union depctl_data {	/** raw register data */	uint32_t d32;	/** register bits */	struct {		/** Maximum Packet Size		 * IN/OUT EPn		 * IN/OUT EP0 - 2 bits		 *	 2'b00: 64 Bytes		 *	 2'b01: 32		 *	 2'b10: 16		 *	 2'b11: 8 */		unsigned mps:11;#define DWC_DEP0CTL_MPS_64	 0#define DWC_DEP0CTL_MPS_32	 1#define DWC_DEP0CTL_MPS_16	 2#define DWC_DEP0CTL_MPS_8	 3		/** Next Endpoint		 * IN EPn/IN EP0		 * OUT EPn/OUT EP0 - reserved */		unsigned nextep:4;		/** USB Active Endpoint */		unsigned usbactep:1;		/** Endpoint DPID (INTR/Bulk IN and OUT endpoints)		 * This field contains the PID of the packet going to		 * be received or transmitted on this endpoint. The		 * application should program the PID of the first		 * packet going to be received or transmitted on this		 * endpoint , after the endpoint is		 * activated. Application use the SetD1PID and		 * SetD0PID fields of this register to program either		 * D0 or D1 PID.		 *		 * The encoding for this field is		 *	 - 0: D0		 *	 - 1: D1		 */		unsigned dpid:1;		/** NAK Status */		unsigned naksts:1;		/** Endpoint Type		 *	2'b00: Control		 *	2'b01: Isochronous		 *	2'b10: Bulk		 *	2'b11: Interrupt */		unsigned eptype:2;		/** Snoop Mode		 * OUT EPn/OUT EP0		 * IN EPn/IN EP0 - reserved */		unsigned snp:1;		/** Stall Handshake */		unsigned stall:1;		/** Tx Fifo Number		 * IN EPn/IN EP0		 * OUT EPn/OUT EP0 - reserved */		unsigned txfnum:4;		/** Clear NAK */		unsigned cnak:1;		/** Set NAK */		unsigned snak:1;		/** Set DATA0 PID (INTR/Bulk IN and OUT endpoints)		 * Writing to this field sets the Endpoint DPID (DPID)		 * field in this register to DATA0. Set Even		 * (micro)frame (SetEvenFr) (ISO IN and OUT Endpoints)		 * Writing to this field sets the Even/Odd		 * (micro)frame (EO_FrNum) field to even (micro)		 * frame.		 */		unsigned setd0pid:1;		/** Set DATA1 PID (INTR/Bulk IN and OUT endpoints)		 * Writing to this field sets the Endpoint DPID (DPID)		 * field in this register to DATA1 Set Odd		 * (micro)frame (SetOddFr) (ISO IN and OUT Endpoints)		 * Writing to this field sets the Even/Odd		 * (micro)frame (EO_FrNum) field to odd (micro) frame.		 */		unsigned setd1pid:1;		/** Endpoint Disable */		unsigned epdis:1;		/** Endpoint Enable */		unsigned epena:1;	} b;} depctl_data_t;/** * This union represents the bit fields in the Device EP Transfer * Size Register.  Read the register into the <i>d32</i> member then * set/clear the bits using the <i>b</i>it elements. */typedef union deptsiz_data {		/** raw register data */	uint32_t d32;		/** register bits */	struct {		/** Transfer size */		unsigned xfersize:19;		/** Packet Count */		unsigned pktcnt:10;		/** Multi Count - Periodic IN endpoints */		unsigned mc:2;		unsigned reserved:1;	} b;} deptsiz_data_t;/** * This union represents the bit fields in the Device EP 0 Transfer * Size Register.  Read the register into the <i>d32</i> member then * set/clear the bits using the <i>b</i>it elements. */typedef union deptsiz0_data {		/** raw register data */	uint32_t d32;		/** register bits */	struct {		/** Transfer size */		unsigned xfersize:7;				/** Reserved */		unsigned reserved7_18:12;		/** Packet Count */		unsigned pktcnt:1;				/** Reserved */		unsigned reserved20_28:9;				/**Setup Packet Count (DOEPTSIZ0 Only) */		unsigned supcnt:2;		unsigned reserved31;	} b;} deptsiz0_data_t;/////////////////////////////////////////////////// DMA Descriptor Specific Structures///** Buffer status definitions */#define BS_HOST_READY	0x0#define BS_DMA_BUSY		0x1#define BS_DMA_DONE		0x2#define BS_HOST_BUSY	0x3/** Receive/Transmit status definitions */#define RTS_SUCCESS		0x0#define RTS_BUFFLUSH	0x1#define RTS_RESERVED	0x2#define RTS_BUFERR		0x3/** * This union represents the bit fields in the non-ISO DMA Descriptor * status quadlet. Read the quadlet into the <i>d32</i> member then * set/clear the bits using the <i>b</i>it elements. */typedef union desc_sts_data {		/** raw register data */	uint32_t d32;		/** quadlet bits */	struct {		/** Received number of bytes */		unsigned bytes:16;		unsigned reserved16_22:7;		/** Multiple Transfer - only for OUT EPs */		unsigned mtrf:1;		/** Setup Packet received - only for OUT EPs */		unsigned sr:1;		/** Interrupt On Complete */		unsigned ioc:1;		/** Short Packet */		unsigned sp:1;		/** Last */		unsigned l:1;		/** Receive Status */		unsigned sts:2;		/** Buffer Status */		unsigned bs:2;	} b;} desc_sts_data_t;/** * DMA Descriptor structure * * DMA Descriptor structure contains two quadlets: * Status quadlet and Data buffer pointer. */typedef struct dwc_otg_dma_desc {	/** DMA Descriptor status quadlet */	desc_sts_data_t status;	/** DMA Descriptor data buffer pointer */	uint32_t *buf;} dwc_otg_dma_desc_t;#ifdef _EN_ISOC_/** * This union represents the bit fields in the ISO OUT DMA * DMA Descriptor status quadlet. Read the quadlet into the <i>d32</i> * member then set/clear the bits using the <i>b</i>it elements. */typedef union iso_out_sts_data {		/** raw register data */	uint32_t d32;		/** quadlet bits */	struct {		/** Received number of bytes */		unsigned rxbytes:11;		unsigned reserved11:1;		/** Frame Number */		unsigned framenum:11;		/** Received ISO Data PID */		unsigned pid:2;		/** Interrupt On Complete */		unsigned ioc:1;		/** Short Packet */		unsigned sp:1;		/** Last */		unsigned l:1;		/** Receive Status */		unsigned rxsts:2;		/** Buffer Status */		unsigned bs:2;	} b;} iso_out_sts_data_t;/** * This union represents the bit fields in the ISO IN DMA * DMA Descriptor status quadlet. Read the quadlet into the <i>d32</i> * member then set/clear the bits using the <i>b</i>it elements. */typedef union iso_in_sts_data {		/** raw register data */	uint32_t d32;		/** quadlet bits */	struct {		/** Transmited number of bytes */		unsigned txbytes:12;		/** Frame Number */		unsigned framenum:11;		/** Transmited ISO Data PID */		unsigned pid:2;		/** Interrupt On Complete */		unsigned ioc:1;		/** Short Packet */		unsigned sp:1;		/** Last */		unsigned l:1;		/** Transmit Status */		unsigned txsts:2;		/** Buffer Status */		unsigned bs:2;	} b;} iso_in_sts_data_t;/** * ISO DMA Descriptor structure * * DMA Descriptor structure contains two quadlets: * Status quadlet and Data buffer pointer. */typedef struct dwc_otg_iso_dma_desc {	/** DMA Descriptor status quadlet */	uint32_t status;	/** DMA Descriptor data buffer pointer */	uint32_t *buf;} dwc_otg_iso_dma_desc_t;#endif				//_EN_ISOC_/** Maximum number of Periodic FIFOs */#define MAX_PERIO_FIFOS 15/** Maximum number of Periodic FIFOs */#define MAX_TX_FIFOS 15/** Maximum number of Endpoints/HostChannels */#define MAX_EPS_CHANNELS 16/** * The dwc_otg_dev_if structure contains information needed to manage * the DWC_otg controller acting in device mode. It represents the * programming view of the device-specific aspects of the controller. */typedef struct dwc_otg_dev_if {	/** Pointer to device Global registers.	 * Device Global Registers starting at offset 800h	 */	dwc_otg_device_global_regs_t *dev_global_regs;#define DWC_DEV_GLOBAL_REG_OFFSET 0x800	/**	 * Device Logical IN Endpoint-Specific Registers 900h-AFCh	 */	dwc_otg_dev_in_ep_regs_t *in_ep_regs[MAX_EPS_CHANNELS];#define DWC_DEV_IN_EP_REG_OFFSET 0x900#define DWC_EP_REG_OFFSET 0x20	/** Device Logical OUT Endpoint-Specific Registers B00h-CFCh */	dwc_otg_dev_out_ep_regs_t *out_ep_regs[MAX_EPS_CHANNELS];#define DWC_DEV_OUT_EP_REG_OFFSET 0xB00	/* Device configuration information */	uint8_t speed;				 /**< Device Speed	0: Unknown, 1: LS, 2:FS, 3: HS */	uint8_t num_in_eps;		 /**< Number # of Tx EP range: 0-15 exept ep0 */	uint8_t num_out_eps;		 /**< Number # of Rx EP range: 0-15 exept ep 0*/	/** Size of periodic FIFOs (Bytes) */	uint16_t perio_tx_fifo_size[MAX_PERIO_FIFOS];	/** Size of Tx FIFOs (Bytes) */	uint16_t tx_fifo_size[MAX_TX_FIFOS];	/** Thresholding enable flags and length varaiables **/	uint16_t rx_thr_en;	uint16_t iso_tx_thr_en;	uint16_t non_iso_tx_thr_en;	uint16_t rx_thr_length;	uint16_t tx_thr_length;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -