18#ifndef __VSF_MUSB_FDRC_HW_H__
19#define __VSF_MUSB_FDRC_HW_H__
25#if (VSF_USE_USB_DEVICE == ENABLED && VSF_USBD_USE_DCD_MUSB_FDRC == ENABLED) \
26 || (VSF_USE_USB_HOST == ENABLED && VSF_USBH_USE_HCD_MUSB_FDRC == ENABLED)
35#define MUSB_POWER_ISOUPDATE ((uint8_t)(1 << 7))
36#define MUSB_POWER_RESET ((uint8_t)(1 << 3))
37#define MSUB_POWER_RESUME ((uint8_t)(1 << 2))
38#define MSUB_POWER_SUSPENDM ((uint8_t)(1 << 1))
39#define MUSB_POWER_ENABLESUSPEND ((uint8_t)(1 << 0))
42#define MUSB_INTRUSB_VBUSERROR ((uint8_t)(1 << 7))
43#define MUSB_INTRUSB_SESSREQ ((uint8_t)(1 << 6))
44#define MUSB_INTRUSB_DISCON ((uint8_t)(1 << 5))
45#define MUSB_INTRUSB_CONN ((uint8_t)(1 << 4))
46#define MUSB_INTRUSB_SOF ((uint8_t)(1 << 3))
47#define MUSB_INTRUSB_RESET ((uint8_t)(1 << 2))
48#define MUSB_INTRUSB_RESUME ((uint8_t)(1 << 1))
49#define MUSB_INTRUSB_SUSPEND ((uint8_t)(1 << 0))
52#define MUSB_INTRUSBE_DISCON ((uint8_t)(1 << 5))
53#define MUSB_INTRUSBE_CONN ((uint8_t)(1 << 4))
54#define MUSB_INTRUSBE_SOF ((uint8_t)(1 << 3))
55#define MUSB_INTRUSBE_RESET ((uint8_t)(1 << 2))
56#define MUSB_INTRUSBE_RESUME ((uint8_t)(1 << 1))
57#define MUSB_INTRUSBE_SUSPEND ((uint8_t)(1 << 0))
60#define MUSB_DEVCTL_BDEVICE ((uint8_t)(1 << 7))
61#define MUSB_DEVCTL_FSDEV ((uint8_t)(1 << 6))
62#define MUSB_DEVCTL_LSDEV ((uint8_t)(1 << 5))
63#define MUSB_DEVCTL_HOSTMODE ((uint8_t)(1 << 2))
64#define MUSB_DEVCTL_HOSTREQ ((uint8_t)(1 << 1))
65#define MUSB_DEVCTL_SESSION ((uint8_t)(1 << 0))
68#define MUSBD_CSR0_SERVICEDSETUPEND ((uint8_t)(1 << 7))
69#define MUSBD_CSR0_SERVICEDRXPKGRDY ((uint8_t)(1 << 6))
70#define MUSBD_CSR0_SENDSTALL ((uint8_t)(1 << 5))
71#define MUSBD_CSR0_SETUPEND ((uint8_t)(1 << 4))
72#define MUSBD_CSR0_DATAEND ((uint8_t)(1 << 3))
73#define MUSBD_CSR0_SENTSTALL ((uint8_t)(1 << 2))
74#define MUSBD_CSR0_TXPKTRDY ((uint8_t)(1 << 1))
75#define MUSBD_CSR0_RXPKTRDY ((uint8_t)(1 << 0))
77#define MUSBH_CSR0_NAKTIMEOUT ((uint8_t)(1 << 7))
78#define MUSBH_CSR0_STATUSPKT ((uint8_t)(1 << 6))
79#define MUSBH_CSR0_REQPKT ((uint8_t)(1 << 5))
80#define MUSBH_CSR0_ERROR ((uint8_t)(1 << 4))
81#define MUSBH_CSR0_SETUPPKT ((uint8_t)(1 << 3))
82#define MUSBH_CSR0_RXSTALL ((uint8_t)(1 << 2))
83#define MUSBH_CSR0_TXPKTRDY ((uint8_t)(1 << 1))
84#define MUSBH_CSR0_RXPKTRDY ((uint8_t)(1 << 0))
85#define MUSBH_CSR0_ERRMASK (MUSBH_CSR0_NAKTIMEOUT | MUSBH_CSR0_ERROR | MUSBH_CSR0_RXSTALL)
88#define MUSBD_TXCSR1_CLRDATATOG ((uint8_t)(1 << 6))
89#define MUSBD_TXCSR1_SENTSTALL ((uint8_t)(1 << 5))
90#define MUSBD_TXCSR1_SENDSTALL ((uint8_t)(1 << 4))
91#define MUSBD_TXCSR1_FLUSHFIFO ((uint8_t)(1 << 3))
92#define MUSBD_TXCSR1_UNDERRUN ((uint8_t)(1 << 2))
93#define MUSBD_TXCSR1_FIFONOTEMPTY ((uint8_t)(1 << 1))
94#define MUSBD_TXCSR1_TXPKTRDY ((uint8_t)(1 << 0))
96#define MUSBH_TXCSR1_NAKTIMEOUT ((uint8_t)(1 << 7))
97#define MUSBH_TXCSR1_CLRDATATOG ((uint8_t)(1 << 6))
98#define MUSBH_TXCSR1_RXSTALL ((uint8_t)(1 << 5))
99#define MUSBH_TXCSR1_FLUSHFIFO ((uint8_t)(1 << 3))
100#define MUSBH_TXCSR1_ERROR ((uint8_t)(1 << 2))
101#define MUSBH_TXCSR1_FIFONOTEMPTY ((uint8_t)(1 << 1))
102#define MUSBH_TXCSR1_TXPKTRDY ((uint8_t)(1 << 0))
103#define MUSBH_TXCSR1_ERRMASK (MUSBH_TXCSR1_NAKTIMEOUT | MUSBH_TXCSR1_RXSTALL | MUSBH_TXCSR1_ERROR)
106#define MUSB_TXCSR2_AUTOSET ((uint8_t)(1 << 7))
107#define MUSBD_TXCSR2_ISO ((uint8_t)(1 << 6))
108#define MUSB_TXCSR2_MODE ((uint8_t)(1 << 5))
109#define MUSB_TXCSR2_DMAEN ((uint8_t)(1 << 4))
110#define MUSB_TXCSR2_FRCDATATOG ((uint8_t)(1 << 3))
111#define MUSB_TXCSR2_DMAMODE ((uint8_t)(1 << 2))
114#define MUSBD_RXCSR1_CLRDATATOG ((uint8_t)(1 << 7))
115#define MUSBD_RXCSR1_SENTSTALL ((uint8_t)(1 << 6))
116#define MUSBD_RXCSR1_SENDSTALL ((uint8_t)(1 << 5))
117#define MUSBD_RXCSR1_FLUSHFIFO ((uint8_t)(1 << 4))
118#define MUSBD_RXCSR1_DATAERROR ((uint8_t)(1 << 3))
119#define MUSBD_RXCSR1_OVERRUN ((uint8_t)(1 << 2))
120#define MUSBD_RXCSR1_FIFOFULL ((uint8_t)(1 << 1))
121#define MUSBD_RXCSR1_RXPKTRDY ((uint8_t)(1 << 0))
123#define MUSBH_RXCSR1_CLRDATATOG ((uint8_t)(1 << 7))
124#define MUSBH_RXCSR1_RXSTALL ((uint8_t)(1 << 6))
125#define MUSBH_RXCSR1_REQPKT ((uint8_t)(1 << 5))
126#define MUSBH_RXCSR1_FLUSHFIFO ((uint8_t)(1 << 4))
127#define MUSBH_RXCSR1_DATAERROR ((uint8_t)(1 << 3))
128#define MUSBH_RXCSR1_NAKTIMEOUT ((uint8_t)(1 << 3))
129#define MUSBH_RXCSR1_ERROR ((uint8_t)(1 << 2))
130#define MUSBH_RXCSR1_FIFOFULL ((uint8_t)(1 << 1))
131#define MUSBH_RXCSR1_RXPKTRDY ((uint8_t)(1 << 0))
132#define MUSBH_RXCSR1_ERRMASK (MUSBH_RXCSR1_RXSTALL | MUSBH_RXCSR1_DATAERROR | MUSBH_RXCSR1_NAKTIMEOUT | MUSBH_RXCSR1_ERROR)
135#define MUSB_RXCSR2_AUTOCLEAR ((uint8_t)(1 << 7))
136#define MUSBD_RXCSR2_ISO ((uint8_t)(1 << 6))
137#define MUSBH_RXCSR2_AUTOREQ ((uint8_t)(1 << 6))
138#define MUSB_RXCSR2_DMAEN ((uint8_t)(1 << 5))
139#define MUSB_RXCSR2_DMAMODE ((uint8_t)(1 << 4))
144#if VSF_MUSB_FDRC_REG_WIDTH == 32
146#elif VSF_MUSB_FDRC_REG_WIDTH == 16
152#ifndef VSF_MUSB_FDRC_PRIV_REG_T
196#if defined(VSF_MUSB_FDRC_DYNAMIC_FIFO)
198typedef struct vk_musb_fdrc_epn_dynfifo_reg_t {
203} vk_musb_fdrc_epn_dynfifo_reg_t;
204#elif defined(VSF_MUSB_FDRC_DYNAMIC_FIFO2)
207typedef struct vk_musb_fdrc_epn_dynfifo_reg_t {
238#if defined(VSF_MUSB_FDRC_DYNAMIC_FIFO) || defined(VSF_MUSB_FDRC_DYNAMIC_FIFO2)
239 vk_musb_fdrc_epn_dynfifo_reg_t *DynFIFO;
242#if defined(VSF_MUSB_FDRC_NO_EP_IDX) || defined(VSF_MUSB_FDRC_NO_HWFIFO)
245#if defined(VSF_MUSB_FDRC_NO_EP_IDX)
247 void * (*get_ep_reg)(
void *param,
uint8_t ep);
249#if defined(VSF_MUSB_FDRC_NO_HWFIFO)
261#if defined(VSF_MUSB_FDRC_NO_EP_IDX)
264#if defined(VSF_MUSB_FDRC_NO_HWFIFO)
265# ifndef VSF_MUSB_FDRC_FIFO_SIZE
266# warning no hw fifo, VSF_MUSB_FDRC_FIFO_SIZE(not defined by user) is used to defined the size of user fifo, default 1K
267# define VSF_MUSB_FDRC_FIFO_SIZE (1024)
276#if (VSF_USE_USB_DEVICE == ENABLED && VSF_USBD_USE_DCD_MUSB_FDRC == ENABLED)
283#if (VSF_USE_USB_HOST == ENABLED && VSF_USBH_USE_HCD_MUSB_FDRC == ENABLED)
#define VSF_CAL_ALIGN(__N)
Definition __compiler.h:179
unsigned short uint16_t
Definition lvgl.h:41
unsigned int uint32_t
Definition lvgl.h:43
unsigned char uint8_t
Definition lvgl.h:40
unsigned long long uint64_t
Definition stdint.h:11
unsigned short uint_fast16_t
Definition stdint.h:25
Definition vsf_template_usb.h:408
Definition vsf_template_usb.h:446
Definition vsf_musb_fdrc_hw.h:153
volatile vk_musb_reg_t FAddr
Definition vsf_musb_fdrc_hw.h:154
volatile vk_musb_reg_t Frame2
Definition vsf_musb_fdrc_hw.h:167
volatile vk_musb_reg_t Power
Definition vsf_musb_fdrc_hw.h:155
volatile vk_musb_reg_t IntrRx2
Definition vsf_musb_fdrc_hw.h:159
volatile vk_musb_reg_t IntrUSBE
Definition vsf_musb_fdrc_hw.h:165
volatile vk_musb_reg_t IntrTx1
Definition vsf_musb_fdrc_hw.h:156
volatile vk_musb_reg_t Frame1
Definition vsf_musb_fdrc_hw.h:166
volatile vk_musb_reg_t IntrTx2
Definition vsf_musb_fdrc_hw.h:157
volatile vk_musb_reg_t Index
Definition vsf_musb_fdrc_hw.h:168
volatile vk_musb_reg_t IntrUSB
Definition vsf_musb_fdrc_hw.h:160
volatile vk_musb_reg_t IntrTx1E
Definition vsf_musb_fdrc_hw.h:161
volatile vk_musb_reg_t IntrRx1E
Definition vsf_musb_fdrc_hw.h:163
volatile vk_musb_reg_t IntrTx2E
Definition vsf_musb_fdrc_hw.h:162
volatile vk_musb_reg_t DevCtl
Definition vsf_musb_fdrc_hw.h:169
volatile vk_musb_reg_t IntrRx1
Definition vsf_musb_fdrc_hw.h:158
volatile vk_musb_reg_t IntrRx2E
Definition vsf_musb_fdrc_hw.h:164
Definition vsf_musb_fdrc_hw.h:277
Definition vsf_musb_fdrc_hw.h:173
volatile vk_musb_reg_t Reserved1[3]
Definition vsf_musb_fdrc_hw.h:177
volatile vk_musb_reg_t Reserved0
Definition vsf_musb_fdrc_hw.h:174
volatile vk_musb_reg_t Count0
Definition vsf_musb_fdrc_hw.h:178
volatile vk_musb_reg_t CSR02
Definition vsf_musb_fdrc_hw.h:176
volatile vk_musb_reg_t CSR0
Definition vsf_musb_fdrc_hw.h:175
Definition vsf_musb_fdrc_hw.h:181
volatile vk_musb_reg_t TxCSR1
Definition vsf_musb_fdrc_hw.h:183
volatile vk_musb_reg_t RxCount2
Definition vsf_musb_fdrc_hw.h:189
volatile vk_musb_reg_t TxMAXP
Definition vsf_musb_fdrc_hw.h:182
volatile vk_musb_reg_t RxCount1
Definition vsf_musb_fdrc_hw.h:188
volatile vk_musb_reg_t RxCSR1
Definition vsf_musb_fdrc_hw.h:186
volatile vk_musb_reg_t RxMAXP
Definition vsf_musb_fdrc_hw.h:185
volatile vk_musb_reg_t TxType
Definition vsf_musb_fdrc_hw.h:190
volatile vk_musb_reg_t RxCSR2
Definition vsf_musb_fdrc_hw.h:187
volatile vk_musb_reg_t TxCSR2
Definition vsf_musb_fdrc_hw.h:184
volatile vk_musb_reg_t TxInterval
Definition vsf_musb_fdrc_hw.h:191
volatile vk_musb_reg_t RxInterval
Definition vsf_musb_fdrc_hw.h:193
volatile vk_musb_reg_t RxType
Definition vsf_musb_fdrc_hw.h:192
Definition vsf_musb_fdrc_hw.h:284
Definition vsf_musb_fdrc_hw.h:234
vk_musb_fdrc_ep_reg_t * EP
Definition vsf_musb_fdrc_hw.h:236
vk_musb_fdrc_fifo_reg_t * FIFO
Definition vsf_musb_fdrc_hw.h:237
vk_musb_fdrc_common_reg_t * Common
Definition vsf_musb_fdrc_hw.h:235
Definition vsf_musb_fdrc_hw.h:255
vk_musb_fdrc_reg_info_t
Definition vsf_musb_fdrc_hw.h:257
vk_musb_fdrc_reg_info_t info
Definition vsf_musb_fdrc_hw.h:258
Definition vsf_musb_fdrc_hw.h:229
vk_musb_fdrc_ep0_reg_t EP0
Definition vsf_musb_fdrc_hw.h:230
vk_musb_fdrc_epn_reg_t EPN
Definition vsf_musb_fdrc_hw.h:231
Definition vsf_musb_fdrc_hw.h:215
volatile uint32_t FIFO3
Definition vsf_musb_fdrc_hw.h:220
volatile uint32_t FIFO2
Definition vsf_musb_fdrc_hw.h:219
volatile uint32_t FIFO0
Definition vsf_musb_fdrc_hw.h:217
volatile uint32_t FIFO[8]
Definition vsf_musb_fdrc_hw.h:226
volatile uint32_t FIFO5
Definition vsf_musb_fdrc_hw.h:222
volatile uint32_t FIFO6
Definition vsf_musb_fdrc_hw.h:223
volatile uint32_t FIFO7
Definition vsf_musb_fdrc_hw.h:224
volatile uint32_t FIFO1
Definition vsf_musb_fdrc_hw.h:218
volatile uint32_t FIFO4
Definition vsf_musb_fdrc_hw.h:221
uint32_t size
Definition vsf_memfs.h:50
uint8_t vk_musb_reg_t
Definition vsf_musb_fdrc_hw.h:149
struct vk_romfs_header_t VSF_CAL_PACKED