📄 dwc_otg_regs.h
字号:
/** * Pointers to the DMA Descriptors for EP0 Control * transfers (virtual and physical) */ /** 2 descriptors for SETUP packets */ uint32_t dma_setup_desc_addr[2]; dwc_otg_dma_desc_t *setup_desc_addr[2]; /** Pointer to Descriptor with latest SETUP packet */ dwc_otg_dma_desc_t *psetup; /** Index of current SETUP handler descriptor */ uint32_t setup_desc_index; /** Descriptor for Data In or Status In phases */ uint32_t dma_in_desc_addr; dwc_otg_dma_desc_t *in_desc_addr;; /** Descriptor for Data Out or Status Out phases */ uint32_t dma_out_desc_addr; dwc_otg_dma_desc_t *out_desc_addr; /** Setup Packet Detected - if set clear NAK when queueing */ uint32_t spd;} dwc_otg_dev_if_t;/////////////////////////////////////////////////// Host Mode Register Structures///** * The Host Global Registers structure defines the size and relative * field offsets for the Host Mode Global Registers. Host Global * Registers offsets 400h-7FFh.*/typedef struct dwc_otg_host_global_regs { /** Host Configuration Register. <i>Offset: 400h</i> */ volatile uint32_t hcfg; /** Host Frame Interval Register. <i>Offset: 404h</i> */ volatile uint32_t hfir; /** Host Frame Number / Frame Remaining Register. <i>Offset: 408h</i> */ volatile uint32_t hfnum; /** Reserved. <i>Offset: 40Ch</i> */ uint32_t reserved40C; /** Host Periodic Transmit FIFO/ Queue Status Register. <i>Offset: 410h</i> */ volatile uint32_t hptxsts; /** Host All Channels Interrupt Register. <i>Offset: 414h</i> */ volatile uint32_t haint; /** Host All Channels Interrupt Mask Register. <i>Offset: 418h</i> */ volatile uint32_t haintmsk;} dwc_otg_host_global_regs_t;/** * This union represents the bit fields in the Host Configuration Register. * Read the register into the <i>d32</i> member then set/clear the bits using * the <i>b</i>it elements. Write the <i>d32</i> member to the hcfg register. */typedef union hcfg_data { /** raw register data */ uint32_t d32; /** register bits */ struct { /** FS/LS Phy Clock Select */ unsigned fslspclksel:2;#define DWC_HCFG_30_60_MHZ 0#define DWC_HCFG_48_MHZ 1#define DWC_HCFG_6_MHZ 2 /** FS/LS Only Support */ unsigned fslssupp:1; } b;} hcfg_data_t;/** * This union represents the bit fields in the Host Frame Remaing/Number * Register. */typedef union hfir_data { /** raw register data */ uint32_t d32; /** register bits */ struct { unsigned frint:16; unsigned reserved:16; } b;} hfir_data_t;/** * This union represents the bit fields in the Host Frame Remaing/Number * Register. */typedef union hfnum_data { /** raw register data */ uint32_t d32; /** register bits */ struct { unsigned frnum:16;#define DWC_HFNUM_MAX_FRNUM 0x3FFF unsigned frrem:16; } b;} hfnum_data_t;typedef union hptxsts_data { /** raw register data */ uint32_t d32; /** register bits */ struct { unsigned ptxfspcavail:16; unsigned ptxqspcavail:8; /** Top of the Periodic Transmit Request Queue * - bit 24 - Terminate (last entry for the selected channel) * - bits 26:25 - Token Type * - 2'b00 - Zero length * - 2'b01 - Ping * - 2'b10 - Disable * - bits 30:27 - Channel Number * - bit 31 - Odd/even microframe */ unsigned ptxqtop_terminate:1; unsigned ptxqtop_token:2; unsigned ptxqtop_chnum:4; unsigned ptxqtop_odd:1; } b;} hptxsts_data_t;/** * This union represents the bit fields in the Host Port Control and Status * Register. Read the register into the <i>d32</i> member then set/clear the * bits using the <i>b</i>it elements. Write the <i>d32</i> member to the * hprt0 register. */typedef union hprt0_data { /** raw register data */ uint32_t d32; /** register bits */ struct { unsigned prtconnsts:1; unsigned prtconndet:1; unsigned prtena:1; unsigned prtenchng:1; unsigned prtovrcurract:1; unsigned prtovrcurrchng:1; unsigned prtres:1; unsigned prtsusp:1; unsigned prtrst:1; unsigned reserved9:1; unsigned prtlnsts:2; unsigned prtpwr:1; unsigned prttstctl:4; unsigned prtspd:2;#define DWC_HPRT0_PRTSPD_HIGH_SPEED 0#define DWC_HPRT0_PRTSPD_FULL_SPEED 1#define DWC_HPRT0_PRTSPD_LOW_SPEED 2 unsigned reserved19_31:13; } b;} hprt0_data_t;/** * This union represents the bit fields in the Host All Interrupt * Register. */typedef union haint_data { /** raw register data */ uint32_t d32; /** register bits */ struct { unsigned ch0:1; unsigned ch1:1; unsigned ch2:1; unsigned ch3:1; unsigned ch4:1; unsigned ch5:1; unsigned ch6:1; unsigned ch7:1; unsigned ch8:1; unsigned ch9:1; unsigned ch10:1; unsigned ch11:1; unsigned ch12:1; unsigned ch13:1; unsigned ch14:1; unsigned ch15:1; unsigned reserved:16; } b; struct { unsigned chint:16; unsigned reserved:16; } b2;} haint_data_t;/** * This union represents the bit fields in the Host All Interrupt * Register. */typedef union haintmsk_data { /** raw register data */ uint32_t d32; /** register bits */ struct { unsigned ch0:1; unsigned ch1:1; unsigned ch2:1; unsigned ch3:1; unsigned ch4:1; unsigned ch5:1; unsigned ch6:1; unsigned ch7:1; unsigned ch8:1; unsigned ch9:1; unsigned ch10:1; unsigned ch11:1; unsigned ch12:1; unsigned ch13:1; unsigned ch14:1; unsigned ch15:1; unsigned reserved:16; } b; struct { unsigned chint:16; unsigned reserved:16; } b2;} haintmsk_data_t;/** * Host Channel Specific Registers. <i>500h-5FCh</i> */typedef struct dwc_otg_hc_regs { /** Host Channel 0 Characteristic Register. <i>Offset: 500h + (chan_num * 20h) + 00h</i> */ volatile uint32_t hcchar; /** Host Channel 0 Split Control Register. <i>Offset: 500h + (chan_num * 20h) + 04h</i> */ volatile uint32_t hcsplt; /** Host Channel 0 Interrupt Register. <i>Offset: 500h + (chan_num * 20h) + 08h</i> */ volatile uint32_t hcint; /** Host Channel 0 Interrupt Mask Register. <i>Offset: 500h + (chan_num * 20h) + 0Ch</i> */ volatile uint32_t hcintmsk; /** Host Channel 0 Transfer Size Register. <i>Offset: 500h + (chan_num * 20h) + 10h</i> */ volatile uint32_t hctsiz; /** Host Channel 0 DMA Address Register. <i>Offset: 500h + (chan_num * 20h) + 14h</i> */ volatile uint32_t hcdma; /** Reserved. <i>Offset: 500h + (chan_num * 20h) + 18h - 500h + (chan_num * 20h) + 1Ch</i> */ uint32_t reserved[2];} dwc_otg_hc_regs_t;/** * This union represents the bit fields in the Host Channel Characteristics * Register. Read the register into the <i>d32</i> member then set/clear the * bits using the <i>b</i>it elements. Write the <i>d32</i> member to the * hcchar register. */typedef union hcchar_data { /** raw register data */ uint32_t d32; /** register bits */ struct { /** Maximum packet size in bytes */ unsigned mps:11; /** Endpoint number */ unsigned epnum:4; /** 0: OUT, 1: IN */ unsigned epdir:1; unsigned reserved:1; /** 0: Full/high speed device, 1: Low speed device */ unsigned lspddev:1; /** 0: Control, 1: Isoc, 2: Bulk, 3: Intr */ unsigned eptype:2; /** Packets per frame for periodic transfers. 0 is reserved. */ unsigned multicnt:2; /** Device address */ unsigned devaddr:7; /** * Frame to transmit periodic transaction. * 0: even, 1: odd */ unsigned oddfrm:1; /** Channel disable */ unsigned chdis:1; /** Channel enable */ unsigned chen:1; } b;} hcchar_data_t;typedef union hcsplt_data { /** raw register data */ uint32_t d32; /** register bits */ struct { /** Port Address */ unsigned prtaddr:7; /** Hub Address */ unsigned hubaddr:7; /** Transaction Position */ unsigned xactpos:2;#define DWC_HCSPLIT_XACTPOS_MID 0#define DWC_HCSPLIT_XACTPOS_END 1#define DWC_HCSPLIT_XACTPOS_BEGIN 2#define DWC_HCSPLIT_XACTPOS_ALL 3 /** Do Complete Split */ unsigned compsplt:1; /** Reserved */ unsigned reserved:14; /** Split Enble */ unsigned spltena:1; } b;} hcsplt_data_t;/** * This union represents the bit fields in the Host All Interrupt * Register. */typedef union hcint_data { /** raw register data */ uint32_t d32; /** register bits */ struct { /** Transfer Complete */ unsigned xfercomp:1; /** Channel Halted */ unsigned chhltd:1; /** AHB Error */ unsigned ahberr:1; /** STALL Response Received */ unsigned stall:1; /** NAK Response Received */ unsigned nak:1; /** ACK Response Received */ unsigned ack:1; /** NYET Response Received */ unsigned nyet:1; /** Transaction Err */ unsigned xacterr:1; /** Babble Error */ unsigned bblerr:1; /** Frame Overrun */ unsigned frmovrun:1; /** Data Toggle Error */ unsigned datatglerr:1; /** Reserved */ unsigned reserved:21; } b;} hcint_data_t;/** * This union represents the bit fields in the Host Channel Transfer Size * Register. Read the register into the <i>d32</i> member then set/clear the * bits using the <i>b</i>it elements. Write the <i>d32</i> member to the * hcchar register. */typedef union hctsiz_data { /** raw register data */ uint32_t d32; /** register bits */ struct { /** Total transfer size in bytes */ unsigned xfersize:19; /** Data packets to transfer */ unsigned pktcnt:10; /** * Packet ID for next data packet * 0: DATA0 * 1: DATA2 * 2: DATA1 * 3: MDATA (non-Control), SETUP (Control) */ unsigned pid:2;#define DWC_HCTSIZ_DATA0 0#define DWC_HCTSIZ_DATA1 2#define DWC_HCTSIZ_DATA2 1#define DWC_HCTSIZ_MDATA 3#define DWC_HCTSIZ_SETUP 3 /** Do PING protocol when 1 */ unsigned dopng:1; } b;} hctsiz_data_t;/** * This union represents the bit fields in the Host Channel Interrupt Mask * Register. Read the register into the <i>d32</i> member then set/clear the * bits using the <i>b</i>it elements. Write the <i>d32</i> member to the * hcintmsk register. */typedef union hcintmsk_data { /** raw register data */ uint32_t d32; /** register bits */ struct { unsigned xfercompl:1; unsigned chhltd:1; unsigned ahberr:1; unsigned stall:1; unsigned nak:1; unsigned ack:1; unsigned nyet:1; unsigned xacterr:1; unsigned bblerr:1; unsigned frmovrun:1; unsigned datatglerr:1; unsigned reserved:21; } b;} hcintmsk_data_t;/** OTG Host Interface Structure. * * The OTG Host Interface Structure structure contains information * needed to manage the DWC_otg controller acting in host mode. It * represents the programming view of the host-specific aspects of the * controller. */typedef struct dwc_otg_host_if { /** Host Global Registers starting at offset 400h.*/ dwc_otg_host_global_regs_t *host_global_regs;#define DWC_OTG_HOST_GLOBAL_REG_OFFSET 0x400 /** Host Port 0 Control and Status Register */ volatile uint32_t *hprt0;#define DWC_OTG_HOST_PORT_REGS_OFFSET 0x440 /** Host Channel Specific Registers at offsets 500h-5FCh. */ dwc_otg_hc_regs_t *hc_regs[MAX_EPS_CHANNELS];#define DWC_OTG_HOST_CHAN_REGS_OFFSET 0x500#define DWC_OTG_CHAN_REGS_OFFSET 0x20 /* Host configuration information */ /** Number of Host Channels (range: 1-16) */ uint8_t num_host_channels; /** Periodic EPs supported (0: no, 1: yes) */ uint8_t perio_eps_supported; /** Periodic Tx FIFO Size (Only 1 host periodic Tx FIFO) */ uint16_t perio_tx_fifo_size;} dwc_otg_host_if_t;/** * This union represents the bit fields in the Power and Clock Gating 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 pcgcctl_data { /** raw register data */ uint32_t d32; /** register bits */ struct { /** Stop Pclk */ unsigned stoppclk:1; /** Gate Hclk */ unsigned gatehclk:1; /** Power Clamp */ unsigned pwrclmp:1; /** Reset Power Down Modules */ unsigned rstpdwnmodule:1; /** PHY Suspended */ unsigned physuspended:1; unsigned reserved:27; } b;} pcgcctl_data_t;#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -