1 /*
2  * Copyright (c) 2021-2024 HPMicro
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 
8 
9 #ifndef HPM_USB_H
10 #define HPM_USB_H
11 
12 #define __R volatile const /* Define "read-only" permission */
13 #define __RW volatile      /* Define "read-write" permission */
14 #define __W volatile       /* Define "write-only" permission */
15 
16 typedef struct {
17     __R  uint8_t  RESERVED0[128];              /* 0x0 - 0x7F: Reserved */
18     __RW uint32_t GPTIMER0LD;                  /* 0x80: General Purpose Timer #0 Load Register */
19     __RW uint32_t GPTIMER0CTRL;                /* 0x84: General Purpose Timer #0 Controller Register */
20     __RW uint32_t GPTIMER1LD;                  /* 0x88: General Purpose Timer #1 Load Register */
21     __RW uint32_t GPTIMER1CTRL;                /* 0x8C: General Purpose Timer #1 Controller Register */
22     __RW uint32_t SBUSCFG;                     /* 0x90: System Bus Config Register */
23     __R  uint8_t  RESERVED1[172];              /* 0x94 - 0x13F: Reserved */
24     __RW uint32_t USBCMD;                      /* 0x140: USB Command Register */
25     __RW uint32_t USBSTS;                      /* 0x144: USB Status Register */
26     __RW uint32_t USBINTR;                     /* 0x148: Interrupt Enable Register */
27     __RW uint32_t FRINDEX;                     /* 0x14C: USB Frame Index Register */
28     __R  uint8_t  RESERVED2[4];                /* 0x150 - 0x153: Reserved */
29     union {
30         __RW uint32_t DEVICEADDR;              /* 0x154: Device Address Register */
31         __RW uint32_t PERIODICLISTBASE;        /* 0x154: Frame List Base Address Register */
32     };
33     union {
34         __RW uint32_t ASYNCLISTADDR;           /* 0x158: Next Asynch. Address Register */
35         __RW uint32_t ENDPTLISTADDR;           /* 0x158: Endpoint List Address Register */
36     };
37     __R  uint8_t  RESERVED3[4];                /* 0x15C - 0x15F: Reserved */
38     __RW uint32_t BURSTSIZE;                   /* 0x160: Programmable Burst Size Register */
39     __RW uint32_t TXFILLTUNING;                /* 0x164: TX FIFO Fill Tuning Register */
40     __R  uint8_t  RESERVED4[16];               /* 0x168 - 0x177: Reserved */
41     __RW uint32_t ENDPTNAK;                    /* 0x178: Endpoint NAK Register */
42     __RW uint32_t ENDPTNAKEN;                  /* 0x17C: Endpoint NAK Enable Register */
43     __R  uint8_t  RESERVED5[4];                /* 0x180 - 0x183: Reserved */
44     __RW uint32_t PORTSC1;                     /* 0x184: Port Status & Control */
45     __R  uint8_t  RESERVED6[28];               /* 0x188 - 0x1A3: Reserved */
46     __RW uint32_t OTGSC;                       /* 0x1A4: On-The-Go Status & control Register */
47     __RW uint32_t USBMODE;                     /* 0x1A8: USB Device Mode Register */
48     __RW uint32_t ENDPTSETUPSTAT;              /* 0x1AC: Endpoint Setup Status Register */
49     __RW uint32_t ENDPTPRIME;                  /* 0x1B0: Endpoint Prime Register */
50     __RW uint32_t ENDPTFLUSH;                  /* 0x1B4: Endpoint Flush Register */
51     __R  uint32_t ENDPTSTAT;                   /* 0x1B8: Endpoint Status Register */
52     __RW uint32_t ENDPTCOMPLETE;               /* 0x1BC: Endpoint Complete Register */
53     __RW uint32_t ENDPTCTRL[8];                /* 0x1C0 - 0x1DC: Endpoint Control0 Register... Endpoint Control7 Register */
54 } CHIPIDEA_TypeDef;
55 
56 
57 /* Bitfield definition for register: GPTIMER0LD */
58 /*
59  * GPTLD (RW)
60  *
61  * GPTLD
62  * General Purpose Timer Load Value
63  * These bit fields are loaded to GPTCNT bits when GPTRST bit is set '1b'.
64  * This value represents the time in microseconds minus 1 for the timer duration.
65  * Example: for a one millisecond timer, load 1000-1=999 or 0x0003E7.
66  * NOTE: Max value is 0xFFFFFF or 16.777215 seconds.
67  */
68 #define USB_GPTIMER0LD_GPTLD_MASK (0xFFFFFFUL)
69 #define USB_GPTIMER0LD_GPTLD_SHIFT (0U)
70 #define USB_GPTIMER0LD_GPTLD_SET(x) (((uint32_t)(x) << USB_GPTIMER0LD_GPTLD_SHIFT) & USB_GPTIMER0LD_GPTLD_MASK)
71 #define USB_GPTIMER0LD_GPTLD_GET(x) (((uint32_t)(x) & USB_GPTIMER0LD_GPTLD_MASK) >> USB_GPTIMER0LD_GPTLD_SHIFT)
72 
73 /* Bitfield definition for register: GPTIMER0CTRL */
74 /*
75  * GPTRUN (RW)
76  *
77  * GPTRUN
78  * General Purpose Timer Run
79  * GPTCNT bits are not effected when setting or clearing this bit.
80  * 0 - Stop counting
81  * 1 - Run
82  */
83 #define USB_GPTIMER0CTRL_GPTRUN_MASK (0x80000000UL)
84 #define USB_GPTIMER0CTRL_GPTRUN_SHIFT (31U)
85 #define USB_GPTIMER0CTRL_GPTRUN_SET(x) (((uint32_t)(x) << USB_GPTIMER0CTRL_GPTRUN_SHIFT) & USB_GPTIMER0CTRL_GPTRUN_MASK)
86 #define USB_GPTIMER0CTRL_GPTRUN_GET(x) (((uint32_t)(x) & USB_GPTIMER0CTRL_GPTRUN_MASK) >> USB_GPTIMER0CTRL_GPTRUN_SHIFT)
87 
88 /*
89  * GPTRST (WO)
90  *
91  * GPTRST
92  * General Purpose Timer Reset
93  * 0 - No action
94  * 1 - Load counter value from GPTLD bits in n_GPTIMER0LD
95  */
96 #define USB_GPTIMER0CTRL_GPTRST_MASK (0x40000000UL)
97 #define USB_GPTIMER0CTRL_GPTRST_SHIFT (30U)
98 #define USB_GPTIMER0CTRL_GPTRST_SET(x) (((uint32_t)(x) << USB_GPTIMER0CTRL_GPTRST_SHIFT) & USB_GPTIMER0CTRL_GPTRST_MASK)
99 #define USB_GPTIMER0CTRL_GPTRST_GET(x) (((uint32_t)(x) & USB_GPTIMER0CTRL_GPTRST_MASK) >> USB_GPTIMER0CTRL_GPTRST_SHIFT)
100 
101 /*
102  * GPTMODE (RW)
103  *
104  * GPTMODE
105  * General Purpose Timer Mode
106  * In one shot mode, the timer will count down to zero, generate an interrupt, and stop until the counter is
107  * reset by software;
108  * In repeat mode, the timer will count down to zero, generate an interrupt and automatically reload the
109  * counter value from GPTLD bits to start again.
110  * 0 - One Shot Mode
111  * 1 - Repeat Mode
112  */
113 #define USB_GPTIMER0CTRL_GPTMODE_MASK (0x1000000UL)
114 #define USB_GPTIMER0CTRL_GPTMODE_SHIFT (24U)
115 #define USB_GPTIMER0CTRL_GPTMODE_SET(x) (((uint32_t)(x) << USB_GPTIMER0CTRL_GPTMODE_SHIFT) & USB_GPTIMER0CTRL_GPTMODE_MASK)
116 #define USB_GPTIMER0CTRL_GPTMODE_GET(x) (((uint32_t)(x) & USB_GPTIMER0CTRL_GPTMODE_MASK) >> USB_GPTIMER0CTRL_GPTMODE_SHIFT)
117 
118 /*
119  * GPTCNT (RO)
120  *
121  * GPTCNT
122  * General Purpose Timer Counter.
123  * This field is the count value of the countdown timer.
124  */
125 #define USB_GPTIMER0CTRL_GPTCNT_MASK (0xFFFFFFUL)
126 #define USB_GPTIMER0CTRL_GPTCNT_SHIFT (0U)
127 #define USB_GPTIMER0CTRL_GPTCNT_GET(x) (((uint32_t)(x) & USB_GPTIMER0CTRL_GPTCNT_MASK) >> USB_GPTIMER0CTRL_GPTCNT_SHIFT)
128 
129 /* Bitfield definition for register: GPTIMER1LD */
130 /*
131  * GPTLD (RW)
132  *
133  * GPTLD
134  * General Purpose Timer Load Value
135  * These bit fields are loaded to GPTCNT bits when GPTRST bit is set '1b'.
136  * This value represents the time in microseconds minus 1 for the timer duration.
137  * Example: for a one millisecond timer, load 1000-1=999 or 0x0003E7.
138  * NOTE: Max value is 0xFFFFFF or 16.777215 seconds.
139  */
140 #define USB_GPTIMER1LD_GPTLD_MASK (0xFFFFFFUL)
141 #define USB_GPTIMER1LD_GPTLD_SHIFT (0U)
142 #define USB_GPTIMER1LD_GPTLD_SET(x) (((uint32_t)(x) << USB_GPTIMER1LD_GPTLD_SHIFT) & USB_GPTIMER1LD_GPTLD_MASK)
143 #define USB_GPTIMER1LD_GPTLD_GET(x) (((uint32_t)(x) & USB_GPTIMER1LD_GPTLD_MASK) >> USB_GPTIMER1LD_GPTLD_SHIFT)
144 
145 /* Bitfield definition for register: GPTIMER1CTRL */
146 /*
147  * GPTRUN (RW)
148  *
149  * GPTRUN
150  * General Purpose Timer Run
151  * GPTCNT bits are not effected when setting or clearing this bit.
152  * 0 - Stop counting
153  * 1 - Run
154  */
155 #define USB_GPTIMER1CTRL_GPTRUN_MASK (0x80000000UL)
156 #define USB_GPTIMER1CTRL_GPTRUN_SHIFT (31U)
157 #define USB_GPTIMER1CTRL_GPTRUN_SET(x) (((uint32_t)(x) << USB_GPTIMER1CTRL_GPTRUN_SHIFT) & USB_GPTIMER1CTRL_GPTRUN_MASK)
158 #define USB_GPTIMER1CTRL_GPTRUN_GET(x) (((uint32_t)(x) & USB_GPTIMER1CTRL_GPTRUN_MASK) >> USB_GPTIMER1CTRL_GPTRUN_SHIFT)
159 
160 /*
161  * GPTRST (WO)
162  *
163  * GPTRST
164  * General Purpose Timer Reset
165  * 0 - No action
166  * 1 - Load counter value from GPTLD bits in USB_n_GPTIMER1LD
167  */
168 #define USB_GPTIMER1CTRL_GPTRST_MASK (0x40000000UL)
169 #define USB_GPTIMER1CTRL_GPTRST_SHIFT (30U)
170 #define USB_GPTIMER1CTRL_GPTRST_SET(x) (((uint32_t)(x) << USB_GPTIMER1CTRL_GPTRST_SHIFT) & USB_GPTIMER1CTRL_GPTRST_MASK)
171 #define USB_GPTIMER1CTRL_GPTRST_GET(x) (((uint32_t)(x) & USB_GPTIMER1CTRL_GPTRST_MASK) >> USB_GPTIMER1CTRL_GPTRST_SHIFT)
172 
173 /*
174  * GPTMODE (RW)
175  *
176  * GPTMODE
177  * General Purpose Timer Mode
178  * In one shot mode, the timer will count down to zero, generate an interrupt, and stop until the counter is
179  * reset by software. In repeat mode, the timer will count down to zero, generate an interrupt and
180  * automatically reload the counter value from GPTLD bits to start again.
181  * 0 - One Shot Mode
182  * 1 - Repeat Mode
183  */
184 #define USB_GPTIMER1CTRL_GPTMODE_MASK (0x1000000UL)
185 #define USB_GPTIMER1CTRL_GPTMODE_SHIFT (24U)
186 #define USB_GPTIMER1CTRL_GPTMODE_SET(x) (((uint32_t)(x) << USB_GPTIMER1CTRL_GPTMODE_SHIFT) & USB_GPTIMER1CTRL_GPTMODE_MASK)
187 #define USB_GPTIMER1CTRL_GPTMODE_GET(x) (((uint32_t)(x) & USB_GPTIMER1CTRL_GPTMODE_MASK) >> USB_GPTIMER1CTRL_GPTMODE_SHIFT)
188 
189 /*
190  * GPTCNT (RO)
191  *
192  * GPTCNT
193  * General Purpose Timer Counter.
194  * This field is the count value of the countdown timer.
195  */
196 #define USB_GPTIMER1CTRL_GPTCNT_MASK (0xFFFFFFUL)
197 #define USB_GPTIMER1CTRL_GPTCNT_SHIFT (0U)
198 #define USB_GPTIMER1CTRL_GPTCNT_GET(x) (((uint32_t)(x) & USB_GPTIMER1CTRL_GPTCNT_MASK) >> USB_GPTIMER1CTRL_GPTCNT_SHIFT)
199 
200 /* Bitfield definition for register: SBUSCFG */
201 /*
202  * AHBBRST (RW)
203  *
204  * AHBBRST
205  * AHB master interface Burst configuration
206  * These bits control AHB master transfer type sequence (or priority).
207  * NOTE: This register overrides n_BURSTSIZE register when its value is not zero.
208  * 000 - Incremental burst of unspecified length only
209  * 001 - INCR4 burst, then single transfer
210  * 010 - INCR8 burst, INCR4 burst, then single transfer
211  * 011 - INCR16 burst, INCR8 burst, INCR4 burst, then single transfer
212  * 100 - Reserved, don't use
213  * 101 - INCR4 burst, then incremental burst of unspecified length
214  * 110 - INCR8 burst, INCR4 burst, then incremental burst of unspecified length
215  * 111 - INCR16 burst, INCR8 burst, INCR4 burst, then incremental burst of unspecified length
216  */
217 #define USB_SBUSCFG_AHBBRST_MASK (0x7U)
218 #define USB_SBUSCFG_AHBBRST_SHIFT (0U)
219 #define USB_SBUSCFG_AHBBRST_SET(x) (((uint32_t)(x) << USB_SBUSCFG_AHBBRST_SHIFT) & USB_SBUSCFG_AHBBRST_MASK)
220 #define USB_SBUSCFG_AHBBRST_GET(x) (((uint32_t)(x) & USB_SBUSCFG_AHBBRST_MASK) >> USB_SBUSCFG_AHBBRST_SHIFT)
221 
222 /* Bitfield definition for register: USBCMD */
223 /*
224  * ITC (RW)
225  *
226  * ITC
227  * Interrupt Threshold Control -Read/Write.
228  * The system software uses this field to set the maximum rate at which the host/device controller will issue interrupts.
229  * ITC contains the maximum interrupt interval measured in micro-frames. Valid values are
230  * shown below.
231  * Value Maximum Interrupt Interval
232  * 00000000 - Immediate (no threshold)
233  * 00000001 - 1 micro-frame
234  * 00000010 - 2 micro-frames
235  * 00000100 - 4 micro-frames
236  * 00001000 - 8 micro-frames
237  * 00010000 - 16 micro-frames
238  * 00100000 - 32 micro-frames
239  * 01000000 - 64 micro-frames
240  */
241 #define USB_USBCMD_ITC_MASK (0xFF0000UL)
242 #define USB_USBCMD_ITC_SHIFT (16U)
243 #define USB_USBCMD_ITC_SET(x) (((uint32_t)(x) << USB_USBCMD_ITC_SHIFT) & USB_USBCMD_ITC_MASK)
244 #define USB_USBCMD_ITC_GET(x) (((uint32_t)(x) & USB_USBCMD_ITC_MASK) >> USB_USBCMD_ITC_SHIFT)
245 
246 /*
247  * FS_2 (RW)
248  *
249  * FS_2
250  * Frame List Size - (Read/Write or Read Only). [host mode only]
251  * This field is Read/Write only if Programmable Frame List Flag in the HCCPARAMS registers is set to one.
252  * This field specifies the size of the frame list that controls which bits in the Frame Index Register should be used for the Frame List Current index.
253  * NOTE: This field is made up from USBCMD bits 15, 3 and 2.
254  * Value Meaning
255  * 0b000 - 1024 elements (4096 bytes) Default value
256  * 0b001 - 512 elements (2048 bytes)
257  * 0b010 - 256 elements (1024 bytes)
258  * 0b011 - 128 elements (512 bytes)
259  * 0b100 - 64 elements (256 bytes)
260  * 0b101 - 32 elements (128 bytes)
261  * 0b110 - 16 elements (64 bytes)
262  * 0b111 - 8 elements (32 bytes)
263  */
264 #define USB_USBCMD_FS_2_MASK (0x8000U)
265 #define USB_USBCMD_FS_2_SHIFT (15U)
266 #define USB_USBCMD_FS_2_SET(x) (((uint32_t)(x) << USB_USBCMD_FS_2_SHIFT) & USB_USBCMD_FS_2_MASK)
267 #define USB_USBCMD_FS_2_GET(x) (((uint32_t)(x) & USB_USBCMD_FS_2_MASK) >> USB_USBCMD_FS_2_SHIFT)
268 
269 /*
270  * ATDTW (RW)
271  *
272  * ATDTW
273  * Add dTD TripWire - Read/Write. [device mode only]
274  * This bit is used as a semaphore to ensure proper addition of a new dTD to an active (primed) endpoint's
275  * linked list. This bit is set and cleared by software.
276  * This bit would also be cleared by hardware when state machine is hazard region for which adding a dTD
277  * to a primed endpoint may go unrecognized.
278  */
279 #define USB_USBCMD_ATDTW_MASK (0x4000U)
280 #define USB_USBCMD_ATDTW_SHIFT (14U)
281 #define USB_USBCMD_ATDTW_SET(x) (((uint32_t)(x) << USB_USBCMD_ATDTW_SHIFT) & USB_USBCMD_ATDTW_MASK)
282 #define USB_USBCMD_ATDTW_GET(x) (((uint32_t)(x) & USB_USBCMD_ATDTW_MASK) >> USB_USBCMD_ATDTW_SHIFT)
283 
284 /*
285  * SUTW (RW)
286  *
287  * SUTW
288  * Setup TripWire - Read/Write. [device mode only]
289  * This bit is used as a semaphore to ensure that the setup data payload of 8 bytes is extracted from a QH by the DCD without being corrupted.
290  * If the setup lockout mode is off (SLOM bit in USB core register n_USBMODE, see USBMODE ) then
291  * there is a hazard when new setup data arrives while the DCD is copying the setup data payload
292  * from the QH for a previous setup packet. This bit is set and cleared by software.
293  * This bit would also be cleared by hardware when a hazard detected.
294  */
295 #define USB_USBCMD_SUTW_MASK (0x2000U)
296 #define USB_USBCMD_SUTW_SHIFT (13U)
297 #define USB_USBCMD_SUTW_SET(x) (((uint32_t)(x) << USB_USBCMD_SUTW_SHIFT) & USB_USBCMD_SUTW_MASK)
298 #define USB_USBCMD_SUTW_GET(x) (((uint32_t)(x) & USB_USBCMD_SUTW_MASK) >> USB_USBCMD_SUTW_SHIFT)
299 
300 /*
301  * ASPE (RW)
302  *
303  * ASPE
304  * Asynchronous Schedule Park Mode Enable - Read/Write.
305  * If the Asynchronous Park Capability bit in the HCCPARAMS register is a one, then this bit defaults to a 1h and is R/W.
306  * Otherwise the bit must be a zero and is RO. Software uses this bit to enable or disable Park mode.
307  * When this bit is one, Park mode is enabled. When this bit is a zero, Park mode is disabled.
308  * NOTE: ASPE bit reset value: '0b' for OTG controller .
309  */
310 #define USB_USBCMD_ASPE_MASK (0x800U)
311 #define USB_USBCMD_ASPE_SHIFT (11U)
312 #define USB_USBCMD_ASPE_SET(x) (((uint32_t)(x) << USB_USBCMD_ASPE_SHIFT) & USB_USBCMD_ASPE_MASK)
313 #define USB_USBCMD_ASPE_GET(x) (((uint32_t)(x) & USB_USBCMD_ASPE_MASK) >> USB_USBCMD_ASPE_SHIFT)
314 
315 /*
316  * ASP (RW)
317  *
318  * ASP
319  * Asynchronous Schedule Park Mode Count - Read/Write.
320  * If the Asynchronous Park Capability bit in the HCCPARAMS register is a one, then this field defaults to 3h and is R/W. Otherwise it defaults to zero and is Read-Only.
321  * It contains a count of the number of successive transactions the host controller is allowed to
322  * execute from a high-speed queue head on the Asynchronous schedule before continuing traversal of the Asynchronous schedule.
323  * Valid values are 1h to 3h. Software must not write a zero to this bit when Park Mode Enable is a one as this will result in undefined behavior.
324  * This field is set to 3h in all controller core.
325  */
326 #define USB_USBCMD_ASP_MASK (0x300U)
327 #define USB_USBCMD_ASP_SHIFT (8U)
328 #define USB_USBCMD_ASP_SET(x) (((uint32_t)(x) << USB_USBCMD_ASP_SHIFT) & USB_USBCMD_ASP_MASK)
329 #define USB_USBCMD_ASP_GET(x) (((uint32_t)(x) & USB_USBCMD_ASP_MASK) >> USB_USBCMD_ASP_SHIFT)
330 
331 /*
332  * IAA (RW)
333  *
334  * IAA
335  * Interrupt on Async Advance Doorbell - Read/Write.
336  * This bit is used as a doorbell by software to tell the host controller to issue an interrupt the next time it advances asynchronous schedule. Software must write a 1 to this bit to ring the doorbell.
337  * When the host controller has evicted all appropriate cached schedule states,
338  * it sets the Interrupt on Async Advance status bit in the USBSTS register.
339  * If the Interrupt on Sync Advance Enable bit in the USBINTR register is one, then the host controller will assert an interrupt at the next interrupt threshold.
340  * The host controller sets this bit to zero after it has set the Interrupt on Sync Advance status bit in the USBSTS register to one.
341  * Software should not write a one to this bit when the asynchronous  schedule is inactive. Doing so will yield undefined results.
342  * This bit is only used in host mode. Writing a one to this bit when device mode is selected will have undefined results.
343  */
344 #define USB_USBCMD_IAA_MASK (0x40U)
345 #define USB_USBCMD_IAA_SHIFT (6U)
346 #define USB_USBCMD_IAA_SET(x) (((uint32_t)(x) << USB_USBCMD_IAA_SHIFT) & USB_USBCMD_IAA_MASK)
347 #define USB_USBCMD_IAA_GET(x) (((uint32_t)(x) & USB_USBCMD_IAA_MASK) >> USB_USBCMD_IAA_SHIFT)
348 
349 /*
350  * ASE (RW)
351  *
352  * ASE
353  * Asynchronous Schedule Enable - Read/Write. Default 0b.
354  * This bit controls whether the host controller skips processing the Asynchronous Schedule.
355  * Only the host controller uses this bit.
356  * Values Meaning
357  * 0 - Do not process the Asynchronous Schedule.
358  * 1 - Use the ASYNCLISTADDR register to access the Asynchronous Schedule.
359  */
360 #define USB_USBCMD_ASE_MASK (0x20U)
361 #define USB_USBCMD_ASE_SHIFT (5U)
362 #define USB_USBCMD_ASE_SET(x) (((uint32_t)(x) << USB_USBCMD_ASE_SHIFT) & USB_USBCMD_ASE_MASK)
363 #define USB_USBCMD_ASE_GET(x) (((uint32_t)(x) & USB_USBCMD_ASE_MASK) >> USB_USBCMD_ASE_SHIFT)
364 
365 /*
366  * PSE (RW)
367  *
368  * PSE
369  * Periodic Schedule Enable- Read/Write. Default 0b.
370  * This bit controls whether the host controller skips processing the Periodic Schedule.
371  * Only the host controller uses this bit.
372  * Values Meaning
373  * 0 - Do not process the Periodic Schedule
374  * 1 - Use the PERIODICLISTBASE register to access the Periodic Schedule.
375  */
376 #define USB_USBCMD_PSE_MASK (0x10U)
377 #define USB_USBCMD_PSE_SHIFT (4U)
378 #define USB_USBCMD_PSE_SET(x) (((uint32_t)(x) << USB_USBCMD_PSE_SHIFT) & USB_USBCMD_PSE_MASK)
379 #define USB_USBCMD_PSE_GET(x) (((uint32_t)(x) & USB_USBCMD_PSE_MASK) >> USB_USBCMD_PSE_SHIFT)
380 
381 /*
382  * FS_1 (RW)
383  *
384  * FS_1
385  * See description at bit 15
386  */
387 #define USB_USBCMD_FS_1_MASK (0xCU)
388 #define USB_USBCMD_FS_1_SHIFT (2U)
389 #define USB_USBCMD_FS_1_SET(x) (((uint32_t)(x) << USB_USBCMD_FS_1_SHIFT) & USB_USBCMD_FS_1_MASK)
390 #define USB_USBCMD_FS_1_GET(x) (((uint32_t)(x) & USB_USBCMD_FS_1_MASK) >> USB_USBCMD_FS_1_SHIFT)
391 
392 /*
393  * RST (RW)
394  *
395  * RST
396  * Controller Reset (RESET) - Read/Write. Software uses this bit to reset the controller.
397  * This bit is set to zero by the Host/Device Controller when the reset process is complete. Software cannot terminate the reset process early by writing a zero to this register.
398  * Host operation mode:
399  * When software writes a one to this bit, the Controller resets its internal pipelines, timers, counters, state machines etc. to their initial value.
400  * Any transaction currently in progress on USB is immediately terminated. A USB reset is not driven on downstream ports.
401  * Software should not set this bit to a one when the HCHalted bit in the USBSTS register is a zero.
402  * Attempting to reset an actively running host controller will result in undefined behavior.
403  * Device operation mode:
404  * When software writes a one to this bit, the Controller resets its internal pipelines, timers, counters, state machines etc. to their initial value.
405  * Writing a one to this bit when the device is in the attached state is not recommended, because the effect on an attached host is undefined.
406  * In order to ensure that the device is not in an attached state before initiating a device controller reset, all primed endpoints should be flushed and the USBCMD Run/Stop bit should be set to 0.
407  */
408 #define USB_USBCMD_RST_MASK (0x2U)
409 #define USB_USBCMD_RST_SHIFT (1U)
410 #define USB_USBCMD_RST_SET(x) (((uint32_t)(x) << USB_USBCMD_RST_SHIFT) & USB_USBCMD_RST_MASK)
411 #define USB_USBCMD_RST_GET(x) (((uint32_t)(x) & USB_USBCMD_RST_MASK) >> USB_USBCMD_RST_SHIFT)
412 
413 /*
414  * RS (RW)
415  *
416  * RS
417  * Run/Stop (RS) - Read/Write. Default 0b. 1=Run. 0=Stop.
418  * Host operation mode:
419  * When set to '1b', the Controller proceeds with the execution of the schedule. The Controller continues execution as long as this bit is set to a one.
420  * When this bit is set to 0, the Host Controller completes the current transaction on the USB and then halts.
421  * The HC Halted bit in the status register indicates when the Controller has finished the transaction and has entered the stopped state.
422  * Software should not write a one to this field unless the controller is in the Halted state (that is, HCHalted in the USBSTS register is a one).
423  * Device operation mode:
424  * Writing a one to this bit will cause the controller to enable a pull-up on D+ and initiate an attach event.
425  * This control bit is not directly connected to the pull-up enable, as the pull-up will become disabled upon transitioning into high-speed mode.
426  * Software should use this bit to prevent an attach event before the controller has been properly initialized. Writing a 0 to this will cause a detach event.
427  */
428 #define USB_USBCMD_RS_MASK (0x1U)
429 #define USB_USBCMD_RS_SHIFT (0U)
430 #define USB_USBCMD_RS_SET(x) (((uint32_t)(x) << USB_USBCMD_RS_SHIFT) & USB_USBCMD_RS_MASK)
431 #define USB_USBCMD_RS_GET(x) (((uint32_t)(x) & USB_USBCMD_RS_MASK) >> USB_USBCMD_RS_SHIFT)
432 
433 /* Bitfield definition for register: USBSTS */
434 /*
435  * TI1 (RWC)
436  *
437  * TI1
438  * General Purpose Timer Interrupt 1(GPTINT1)--R/WC.
439  * This bit is set when the counter in the GPTIMER1CTRL register transitions to zero, writing a one to this
440  * bit will clear it.
441  */
442 #define USB_USBSTS_TI1_MASK (0x2000000UL)
443 #define USB_USBSTS_TI1_SHIFT (25U)
444 #define USB_USBSTS_TI1_SET(x) (((uint32_t)(x) << USB_USBSTS_TI1_SHIFT) & USB_USBSTS_TI1_MASK)
445 #define USB_USBSTS_TI1_GET(x) (((uint32_t)(x) & USB_USBSTS_TI1_MASK) >> USB_USBSTS_TI1_SHIFT)
446 
447 /*
448  * TI0 (RWC)
449  *
450  * TI0
451  * General Purpose Timer Interrupt 0(GPTINT0)--R/WC.
452  * This bit is set when the counter in the GPTIMER0CTRL register transitions to zero, writing a one to this
453  * bit clears it.
454  */
455 #define USB_USBSTS_TI0_MASK (0x1000000UL)
456 #define USB_USBSTS_TI0_SHIFT (24U)
457 #define USB_USBSTS_TI0_SET(x) (((uint32_t)(x) << USB_USBSTS_TI0_SHIFT) & USB_USBSTS_TI0_MASK)
458 #define USB_USBSTS_TI0_GET(x) (((uint32_t)(x) & USB_USBSTS_TI0_MASK) >> USB_USBSTS_TI0_SHIFT)
459 
460 /*
461  * UPI (RWC)
462  *
463  * USB Host Periodic Interrupt – RWC. Default = 0b.
464  * This bit is set by the Host Controller when the cause of an interrupt is a completion of a USB transaction
465  * where the Transfer Descriptor (TD) has an interrupt on complete (IOC) bit set and the TD was from the periodic schedule.
466  * This bit is also set by the Host Controller when a short packet is detected and the packet is on the periodic schedule.
467  * A short packet is when the actual number of bytes received was less than expected.
468  * This bit is not used by the device controller and will always be zero.
469  */
470 #define USB_USBSTS_UPI_MASK (0x80000UL)
471 #define USB_USBSTS_UPI_SHIFT (19U)
472 #define USB_USBSTS_UPI_SET(x) (((uint32_t)(x) << USB_USBSTS_UPI_SHIFT) & USB_USBSTS_UPI_MASK)
473 #define USB_USBSTS_UPI_GET(x) (((uint32_t)(x) & USB_USBSTS_UPI_MASK) >> USB_USBSTS_UPI_SHIFT)
474 
475 /*
476  * UAI (RWC)
477  *
478  * USB Host Asynchronous Interrupt – RWC. Default = 0b.
479  * This bit is set by the Host Controller when the cause of an interrupt is a completion of a USB transaction
480  * where the Transfer Descriptor (TD) has an interrupt on complete (IOC) bit set AND the TD was from the asynchronous schedule.
481  * This bit is also set by the Host when a short packet is detected and the packet is on the asynchronous schedule.
482  * A short packet is when the actual number of bytes received was less than expected.
483  * This bit is not used by the device controller and will always be zero
484  */
485 #define USB_USBSTS_UAI_MASK (0x40000UL)
486 #define USB_USBSTS_UAI_SHIFT (18U)
487 #define USB_USBSTS_UAI_SET(x) (((uint32_t)(x) << USB_USBSTS_UAI_SHIFT) & USB_USBSTS_UAI_MASK)
488 #define USB_USBSTS_UAI_GET(x) (((uint32_t)(x) & USB_USBSTS_UAI_MASK) >> USB_USBSTS_UAI_SHIFT)
489 
490 /*
491  * NAKI (RO)
492  *
493  * NAKI
494  * NAK Interrupt Bit--RO.
495  * This bit is set by hardware when for a particular endpoint both the TX/RX Endpoint NAK bit and
496  * corresponding TX/RX Endpoint NAK Enable bit are set. This bit is automatically cleared by hardware
497  * when all Enabled TX/RX Endpoint NAK bits are cleared.
498  */
499 #define USB_USBSTS_NAKI_MASK (0x10000UL)
500 #define USB_USBSTS_NAKI_SHIFT (16U)
501 #define USB_USBSTS_NAKI_GET(x) (((uint32_t)(x) & USB_USBSTS_NAKI_MASK) >> USB_USBSTS_NAKI_SHIFT)
502 
503 /*
504  * AS (RO)
505  *
506  * AS
507  * Asynchronous Schedule Status - Read Only.
508  * This bit reports the current real status of the Asynchronous Schedule. When set to zero the asynchronous schedule status is disabled and if set to one the status is enabled.
509  * The Host Controller is not required to immediately disable or enable the Asynchronous Schedule when software transitions the Asynchronous Schedule Enable bit in the USBCMD register.
510  * When this bit and the Asynchronous Schedule Enable bit are the same value, the Asynchronous Schedule is either enabled (1) or disabled (0).
511  * Only used in the host operation mode.
512  */
513 #define USB_USBSTS_AS_MASK (0x8000U)
514 #define USB_USBSTS_AS_SHIFT (15U)
515 #define USB_USBSTS_AS_GET(x) (((uint32_t)(x) & USB_USBSTS_AS_MASK) >> USB_USBSTS_AS_SHIFT)
516 
517 /*
518  * PS (RO)
519  *
520  * PS
521  * Periodic Schedule Status - Read Only.
522  * This bit reports the current real status of the Periodic Schedule. When set to zero the periodic schedule is disabled, and if set to one the status is enabled.
523  * The Host Controller is not required to immediately disable or enable the Periodic Schedule when software transitions the Periodic Schedule Enable bit in the USBCMD register.
524  * When this bit and the Periodic Schedule Enable bit are the same value, the Periodic Schedule is either enabled (1) or disabled (0).
525  * Only used in the host operation mode.
526  */
527 #define USB_USBSTS_PS_MASK (0x4000U)
528 #define USB_USBSTS_PS_SHIFT (14U)
529 #define USB_USBSTS_PS_GET(x) (((uint32_t)(x) & USB_USBSTS_PS_MASK) >> USB_USBSTS_PS_SHIFT)
530 
531 /*
532  * RCL (RO)
533  *
534  * RCL
535  * Reclamation - Read Only.
536  * This is a read-only status bit used to detect an empty asynchronous schedule.
537  * Only used in the host operation mode.
538  */
539 #define USB_USBSTS_RCL_MASK (0x2000U)
540 #define USB_USBSTS_RCL_SHIFT (13U)
541 #define USB_USBSTS_RCL_GET(x) (((uint32_t)(x) & USB_USBSTS_RCL_MASK) >> USB_USBSTS_RCL_SHIFT)
542 
543 /*
544  * HCH (RO)
545  *
546  * HCH
547  * HCHaIted - Read Only.
548  * This bit is a zero whenever the Run/Stop bit is a one.
549  *  The Controller sets this bit to one after it has stopped executing because of the Run/Stop bit being set to 0,
550  *  either by software or by the Controller hardware (for example, an internal error).
551  * Only used in the host operation mode.
552  * Default value is '0b' for OTG core .
553  * This is because OTG core is not operating as host in default. Please see CM bit in USB_n_USBMODE
554  * register.
555  * NOTE: HCH bit reset value: '0b' for OTG controller core .
556  */
557 #define USB_USBSTS_HCH_MASK (0x1000U)
558 #define USB_USBSTS_HCH_SHIFT (12U)
559 #define USB_USBSTS_HCH_GET(x) (((uint32_t)(x) & USB_USBSTS_HCH_MASK) >> USB_USBSTS_HCH_SHIFT)
560 
561 /*
562  * SLI (RWC)
563  *
564  * SLI
565  * DCSuspend - R/WC.
566  * When a controller enters a suspend state from an active state, this bit will be set to a one. The device controller clears the bit upon exiting from a suspend state.
567  * Only used in device operation mode.
568  */
569 #define USB_USBSTS_SLI_MASK (0x100U)
570 #define USB_USBSTS_SLI_SHIFT (8U)
571 #define USB_USBSTS_SLI_SET(x) (((uint32_t)(x) << USB_USBSTS_SLI_SHIFT) & USB_USBSTS_SLI_MASK)
572 #define USB_USBSTS_SLI_GET(x) (((uint32_t)(x) & USB_USBSTS_SLI_MASK) >> USB_USBSTS_SLI_SHIFT)
573 
574 /*
575  * SRI (RWC)
576  *
577  * SRI
578  * SOF Received - R/WC.
579  * When the device controller detects a Start Of (micro) Frame, this bit will be set to a one.
580  * When a SOF is extremely late, the device controller will automatically set this bit to indicate that an SOF was expected.
581  * Therefore, this bit will be set roughly every 1ms in device FS mode and every 125ms in HS mode and will be synchronized to the actual SOF that is received.
582  * Because the device controller is initialized to FS before connect, this bit will be set at an interval of 1ms during the prelude to connect and chirp.
583  * In host mode, this bit will be set every 125us and can be used by host controller driver as a time base.
584  * Software writes a 1 to this bit to clear it.
585  */
586 #define USB_USBSTS_SRI_MASK (0x80U)
587 #define USB_USBSTS_SRI_SHIFT (7U)
588 #define USB_USBSTS_SRI_SET(x) (((uint32_t)(x) << USB_USBSTS_SRI_SHIFT) & USB_USBSTS_SRI_MASK)
589 #define USB_USBSTS_SRI_GET(x) (((uint32_t)(x) & USB_USBSTS_SRI_MASK) >> USB_USBSTS_SRI_SHIFT)
590 
591 /*
592  * URI (RWC)
593  *
594  * URI
595  * USB Reset Received - R/WC.
596  * When the device controller detects a USB Reset and enters the default state, this bit will be set to a one.
597  * Software can write a 1 to this bit to clear the USB Reset Received status bit.
598  * Only used in device operation mode.
599  */
600 #define USB_USBSTS_URI_MASK (0x40U)
601 #define USB_USBSTS_URI_SHIFT (6U)
602 #define USB_USBSTS_URI_SET(x) (((uint32_t)(x) << USB_USBSTS_URI_SHIFT) & USB_USBSTS_URI_MASK)
603 #define USB_USBSTS_URI_GET(x) (((uint32_t)(x) & USB_USBSTS_URI_MASK) >> USB_USBSTS_URI_SHIFT)
604 
605 /*
606  * AAI (RWC)
607  *
608  * AAI
609  * Interrupt on Async Advance - R/WC.
610  * System software can force the host controller to issue an interrupt the next time the host controller advances the asynchronous schedule
611  * by writing a one to the Interrupt on Async Advance Doorbell bit in the n_USBCMD register. This status bit indicates the assertion of that interrupt source.
612  * Only used in host operation mode.
613  */
614 #define USB_USBSTS_AAI_MASK (0x20U)
615 #define USB_USBSTS_AAI_SHIFT (5U)
616 #define USB_USBSTS_AAI_SET(x) (((uint32_t)(x) << USB_USBSTS_AAI_SHIFT) & USB_USBSTS_AAI_MASK)
617 #define USB_USBSTS_AAI_GET(x) (((uint32_t)(x) & USB_USBSTS_AAI_MASK) >> USB_USBSTS_AAI_SHIFT)
618 
619 /*
620  * SEI (RWC)
621  *
622  * System Error – RWC. Default = 0b.
623  * In the BVCI implementation of the USBHS core, this bit is not used, and will always be cleared to '0b'.
624  * In the AMBA implementation, this bit will be set to '1b' when an Error response is seen by the master interface (HRESP[1:0]=ERROR)
625  */
626 #define USB_USBSTS_SEI_MASK (0x10U)
627 #define USB_USBSTS_SEI_SHIFT (4U)
628 #define USB_USBSTS_SEI_SET(x) (((uint32_t)(x) << USB_USBSTS_SEI_SHIFT) & USB_USBSTS_SEI_MASK)
629 #define USB_USBSTS_SEI_GET(x) (((uint32_t)(x) & USB_USBSTS_SEI_MASK) >> USB_USBSTS_SEI_SHIFT)
630 
631 /*
632  * FRI (RWC)
633  *
634  * FRI
635  * Frame List Rollover - R/WC.
636  * The Host Controller sets this bit to a one when the Frame List Index rolls over from its maximum value to
637  * zero. The exact value at which the rollover occurs depends on the frame list size. For example. If the
638  * frame list size (as programmed in the Frame List Size field of the USB_n_USBCMD register) is 1024, the
639  * Frame Index Register rolls over every time FRINDEX [13] toggles. Similarly, if the size is 512, the Host
640  * Controller sets this bit to a one every time FHINDEX [12] toggles.
641  * Only used in host operation mode.
642  */
643 #define USB_USBSTS_FRI_MASK (0x8U)
644 #define USB_USBSTS_FRI_SHIFT (3U)
645 #define USB_USBSTS_FRI_SET(x) (((uint32_t)(x) << USB_USBSTS_FRI_SHIFT) & USB_USBSTS_FRI_MASK)
646 #define USB_USBSTS_FRI_GET(x) (((uint32_t)(x) & USB_USBSTS_FRI_MASK) >> USB_USBSTS_FRI_SHIFT)
647 
648 /*
649  * PCI (RWC)
650  *
651  * PCI
652  * Port Change Detect - R/WC.
653  * The Host Controller sets this bit to a one when on any port a Connect Status occurs, a Port Enable/Disable Change occurs,
654  * or the Force Port Resume bit is set as the result of a J-K transition on the suspended port.
655  * The Device Controller sets this bit to a one when the port controller enters the full or high-speed operational state.
656  * When the port controller exits the full or high-speed operation states due to Reset or Suspend events,
657  * the notification mechanisms are the USB Reset Received bit and the DCSuspend bits Respectively.
658  */
659 #define USB_USBSTS_PCI_MASK (0x4U)
660 #define USB_USBSTS_PCI_SHIFT (2U)
661 #define USB_USBSTS_PCI_SET(x) (((uint32_t)(x) << USB_USBSTS_PCI_SHIFT) & USB_USBSTS_PCI_MASK)
662 #define USB_USBSTS_PCI_GET(x) (((uint32_t)(x) & USB_USBSTS_PCI_MASK) >> USB_USBSTS_PCI_SHIFT)
663 
664 /*
665  * UEI (RWC)
666  *
667  * UEI
668  * USB Error Interrupt (USBERRINT) - R/WC.
669  * When completion of a USB transaction results in an error condition, this bit is set by the Host/Device Controller.
670  * This bit is set along with the USBINT bit, if the TD on which the error interrupt occurred also had its interrupt on complete (IOC) bit set.
671  */
672 #define USB_USBSTS_UEI_MASK (0x2U)
673 #define USB_USBSTS_UEI_SHIFT (1U)
674 #define USB_USBSTS_UEI_SET(x) (((uint32_t)(x) << USB_USBSTS_UEI_SHIFT) & USB_USBSTS_UEI_MASK)
675 #define USB_USBSTS_UEI_GET(x) (((uint32_t)(x) & USB_USBSTS_UEI_MASK) >> USB_USBSTS_UEI_SHIFT)
676 
677 /*
678  * UI (RWC)
679  *
680  * UI
681  * USB Interrupt (USBINT) - R/WC.
682  * This bit is set by the Host/Device Controller when the cause of an interrupt is a completion of a USB
683  * transaction where the Transfer Descriptor (TD) has an interrupt on complete (IOC) bit set.
684  * This bit is also set by the Host/Device Controller when a short packet is detected. A short packet is when
685  * the actual number of bytes received was less than the expected number of bytes.
686  */
687 #define USB_USBSTS_UI_MASK (0x1U)
688 #define USB_USBSTS_UI_SHIFT (0U)
689 #define USB_USBSTS_UI_SET(x) (((uint32_t)(x) << USB_USBSTS_UI_SHIFT) & USB_USBSTS_UI_MASK)
690 #define USB_USBSTS_UI_GET(x) (((uint32_t)(x) & USB_USBSTS_UI_MASK) >> USB_USBSTS_UI_SHIFT)
691 
692 /* Bitfield definition for register: USBINTR */
693 /*
694  * TIE1 (RW)
695  *
696  * TIE1
697  * General Purpose Timer #1 Interrupt Enable
698  * When this bit is one and the TI1 bit in n_USBSTS register is a one the controller will issue an interrupt.
699  */
700 #define USB_USBINTR_TIE1_MASK (0x2000000UL)
701 #define USB_USBINTR_TIE1_SHIFT (25U)
702 #define USB_USBINTR_TIE1_SET(x) (((uint32_t)(x) << USB_USBINTR_TIE1_SHIFT) & USB_USBINTR_TIE1_MASK)
703 #define USB_USBINTR_TIE1_GET(x) (((uint32_t)(x) & USB_USBINTR_TIE1_MASK) >> USB_USBINTR_TIE1_SHIFT)
704 
705 /*
706  * TIE0 (RW)
707  *
708  * TIE0
709  * General Purpose Timer #0 Interrupt Enable
710  * When this bit is one and the TI0 bit in n_USBSTS register is a one the controller will issue an interrupt.
711  */
712 #define USB_USBINTR_TIE0_MASK (0x1000000UL)
713 #define USB_USBINTR_TIE0_SHIFT (24U)
714 #define USB_USBINTR_TIE0_SET(x) (((uint32_t)(x) << USB_USBINTR_TIE0_SHIFT) & USB_USBINTR_TIE0_MASK)
715 #define USB_USBINTR_TIE0_GET(x) (((uint32_t)(x) & USB_USBINTR_TIE0_MASK) >> USB_USBINTR_TIE0_SHIFT)
716 
717 /*
718  * UPIE (RW)
719  *
720  * UPIE
721  * USB Host Periodic Interrupt Enable
722  * When this bit is one, and the UPI bit in the n_USBSTS register is one, host controller will issue an
723  * interrupt at the next interrupt threshold.
724  */
725 #define USB_USBINTR_UPIE_MASK (0x80000UL)
726 #define USB_USBINTR_UPIE_SHIFT (19U)
727 #define USB_USBINTR_UPIE_SET(x) (((uint32_t)(x) << USB_USBINTR_UPIE_SHIFT) & USB_USBINTR_UPIE_MASK)
728 #define USB_USBINTR_UPIE_GET(x) (((uint32_t)(x) & USB_USBINTR_UPIE_MASK) >> USB_USBINTR_UPIE_SHIFT)
729 
730 /*
731  * UAIE (RW)
732  *
733  * UAIE
734  * USB Host Asynchronous Interrupt Enable
735  * When this bit is one, and the UAI bit in the n_USBSTS register is one, host controller will issue an
736  * interrupt at the next interrupt threshold.
737  */
738 #define USB_USBINTR_UAIE_MASK (0x40000UL)
739 #define USB_USBINTR_UAIE_SHIFT (18U)
740 #define USB_USBINTR_UAIE_SET(x) (((uint32_t)(x) << USB_USBINTR_UAIE_SHIFT) & USB_USBINTR_UAIE_MASK)
741 #define USB_USBINTR_UAIE_GET(x) (((uint32_t)(x) & USB_USBINTR_UAIE_MASK) >> USB_USBINTR_UAIE_SHIFT)
742 
743 /*
744  * NAKE (RO)
745  *
746  * NAKE
747  * NAK Interrupt Enable
748  * When this bit is one and the NAKI bit in n_USBSTS register is a one the controller will issue an interrupt.
749  */
750 #define USB_USBINTR_NAKE_MASK (0x10000UL)
751 #define USB_USBINTR_NAKE_SHIFT (16U)
752 #define USB_USBINTR_NAKE_GET(x) (((uint32_t)(x) & USB_USBINTR_NAKE_MASK) >> USB_USBINTR_NAKE_SHIFT)
753 
754 /*
755  * SLE (RW)
756  *
757  * SLE
758  * Sleep Interrupt Enable
759  * When this bit is one and the SLI bit in n_n_USBSTS register is a one the controller will issue an interrupt.
760  * Only used in device operation mode.
761  */
762 #define USB_USBINTR_SLE_MASK (0x100U)
763 #define USB_USBINTR_SLE_SHIFT (8U)
764 #define USB_USBINTR_SLE_SET(x) (((uint32_t)(x) << USB_USBINTR_SLE_SHIFT) & USB_USBINTR_SLE_MASK)
765 #define USB_USBINTR_SLE_GET(x) (((uint32_t)(x) & USB_USBINTR_SLE_MASK) >> USB_USBINTR_SLE_SHIFT)
766 
767 /*
768  * SRE (RW)
769  *
770  * SRE
771  * SOF Received Interrupt Enable
772  * When this bit is one and the SRI bit in n_USBSTS register is a one the controller will issue an interrupt.
773  */
774 #define USB_USBINTR_SRE_MASK (0x80U)
775 #define USB_USBINTR_SRE_SHIFT (7U)
776 #define USB_USBINTR_SRE_SET(x) (((uint32_t)(x) << USB_USBINTR_SRE_SHIFT) & USB_USBINTR_SRE_MASK)
777 #define USB_USBINTR_SRE_GET(x) (((uint32_t)(x) & USB_USBINTR_SRE_MASK) >> USB_USBINTR_SRE_SHIFT)
778 
779 /*
780  * URE (RW)
781  *
782  * URE
783  * USB Reset Interrupt Enable
784  * When this bit is one and the URI bit in n_USBSTS register is a one the controller will issue an interrupt.
785  * Only used in device operation mode.
786  */
787 #define USB_USBINTR_URE_MASK (0x40U)
788 #define USB_USBINTR_URE_SHIFT (6U)
789 #define USB_USBINTR_URE_SET(x) (((uint32_t)(x) << USB_USBINTR_URE_SHIFT) & USB_USBINTR_URE_MASK)
790 #define USB_USBINTR_URE_GET(x) (((uint32_t)(x) & USB_USBINTR_URE_MASK) >> USB_USBINTR_URE_SHIFT)
791 
792 /*
793  * AAE (RW)
794  *
795  * AAE
796  * Async Advance Interrupt Enable
797  * When this bit is one and the AAI bit in n_USBSTS register is a one the controller will issue an interrupt.
798  * Only used in host operation mode.
799  */
800 #define USB_USBINTR_AAE_MASK (0x20U)
801 #define USB_USBINTR_AAE_SHIFT (5U)
802 #define USB_USBINTR_AAE_SET(x) (((uint32_t)(x) << USB_USBINTR_AAE_SHIFT) & USB_USBINTR_AAE_MASK)
803 #define USB_USBINTR_AAE_GET(x) (((uint32_t)(x) & USB_USBINTR_AAE_MASK) >> USB_USBINTR_AAE_SHIFT)
804 
805 /*
806  * SEE (RW)
807  *
808  * SEE
809  * System Error Interrupt Enable
810  * When this bit is one and the SEI bit in n_USBSTS register is a one the controller will issue an interrupt.
811  * Only used in host operation mode.
812  */
813 #define USB_USBINTR_SEE_MASK (0x10U)
814 #define USB_USBINTR_SEE_SHIFT (4U)
815 #define USB_USBINTR_SEE_SET(x) (((uint32_t)(x) << USB_USBINTR_SEE_SHIFT) & USB_USBINTR_SEE_MASK)
816 #define USB_USBINTR_SEE_GET(x) (((uint32_t)(x) & USB_USBINTR_SEE_MASK) >> USB_USBINTR_SEE_SHIFT)
817 
818 /*
819  * FRE (RW)
820  *
821  * FRE
822  * Frame List Rollover Interrupt Enable
823  * When this bit is one and the FRI bit in n_USBSTS register is a one the controller will issue an interrupt.
824  * Only used in host operation mode.
825  */
826 #define USB_USBINTR_FRE_MASK (0x8U)
827 #define USB_USBINTR_FRE_SHIFT (3U)
828 #define USB_USBINTR_FRE_SET(x) (((uint32_t)(x) << USB_USBINTR_FRE_SHIFT) & USB_USBINTR_FRE_MASK)
829 #define USB_USBINTR_FRE_GET(x) (((uint32_t)(x) & USB_USBINTR_FRE_MASK) >> USB_USBINTR_FRE_SHIFT)
830 
831 /*
832  * PCE (RW)
833  *
834  * PCE
835  * Port Change Detect Interrupt Enable
836  * When this bit is one and the PCI bit in n_USBSTS register is a one the controller will issue an interrupt.
837  */
838 #define USB_USBINTR_PCE_MASK (0x4U)
839 #define USB_USBINTR_PCE_SHIFT (2U)
840 #define USB_USBINTR_PCE_SET(x) (((uint32_t)(x) << USB_USBINTR_PCE_SHIFT) & USB_USBINTR_PCE_MASK)
841 #define USB_USBINTR_PCE_GET(x) (((uint32_t)(x) & USB_USBINTR_PCE_MASK) >> USB_USBINTR_PCE_SHIFT)
842 
843 /*
844  * UEE (RWC)
845  *
846  * UEE
847  * USB Error Interrupt Enable
848  * When this bit is one and the UEI bit in n_USBSTS register is a one the controller will issue an interrupt.
849  */
850 #define USB_USBINTR_UEE_MASK (0x2U)
851 #define USB_USBINTR_UEE_SHIFT (1U)
852 #define USB_USBINTR_UEE_SET(x) (((uint32_t)(x) << USB_USBINTR_UEE_SHIFT) & USB_USBINTR_UEE_MASK)
853 #define USB_USBINTR_UEE_GET(x) (((uint32_t)(x) & USB_USBINTR_UEE_MASK) >> USB_USBINTR_UEE_SHIFT)
854 
855 /*
856  * UE (RW)
857  *
858  * UE
859  * USB Interrupt Enable
860  * When this bit is one and the UI bit in n_USBSTS register is a one the controller will issue an interrupt.
861  */
862 #define USB_USBINTR_UE_MASK (0x1U)
863 #define USB_USBINTR_UE_SHIFT (0U)
864 #define USB_USBINTR_UE_SET(x) (((uint32_t)(x) << USB_USBINTR_UE_SHIFT) & USB_USBINTR_UE_MASK)
865 #define USB_USBINTR_UE_GET(x) (((uint32_t)(x) & USB_USBINTR_UE_MASK) >> USB_USBINTR_UE_SHIFT)
866 
867 /* Bitfield definition for register: FRINDEX */
868 /*
869  * FRINDEX (RW)
870  *
871  * FRINDEX
872  * Frame Index.
873  * The value, in this register, increments at the end of each time frame (micro-frame). Bits [N: 3] are used for the Frame List current index.
874  * This means that each location of the frame list is accessed 8 times (frames or micro-frames) before moving to the next index.
875  * The following illustrates values of N based on the value of the Frame List Size field in the USBCMD register, when used in host mode.
876  * USBCMD [Frame List Size] Number Elements N
877  * In device mode the value is the current frame number of the last frame transmitted. It is not used as an index.
878  * In either mode bits 2:0 indicate the current microframe.
879  * The bit field values description below is represented as (Frame List Size) Number Elements N.
880  * 00000000000000 - (1024) 12
881  * 00000000000001 - (512) 11
882  * 00000000000010 - (256) 10
883  * 00000000000011 - (128) 9
884  * 00000000000100 - (64) 8
885  * 00000000000101 - (32) 7
886  * 00000000000110 - (16) 6
887  * 00000000000111 - (8) 5
888  */
889 #define USB_FRINDEX_FRINDEX_MASK (0x3FFFU)
890 #define USB_FRINDEX_FRINDEX_SHIFT (0U)
891 #define USB_FRINDEX_FRINDEX_SET(x) (((uint32_t)(x) << USB_FRINDEX_FRINDEX_SHIFT) & USB_FRINDEX_FRINDEX_MASK)
892 #define USB_FRINDEX_FRINDEX_GET(x) (((uint32_t)(x) & USB_FRINDEX_FRINDEX_MASK) >> USB_FRINDEX_FRINDEX_SHIFT)
893 
894 /* Bitfield definition for register: DEVICEADDR */
895 /*
896  * USBADR (RW)
897  *
898  * USBADR
899  * Device Address.
900  * These bits correspond to the USB device address
901  */
902 #define USB_DEVICEADDR_USBADR_MASK (0xFE000000UL)
903 #define USB_DEVICEADDR_USBADR_SHIFT (25U)
904 #define USB_DEVICEADDR_USBADR_SET(x) (((uint32_t)(x) << USB_DEVICEADDR_USBADR_SHIFT) & USB_DEVICEADDR_USBADR_MASK)
905 #define USB_DEVICEADDR_USBADR_GET(x) (((uint32_t)(x) & USB_DEVICEADDR_USBADR_MASK) >> USB_DEVICEADDR_USBADR_SHIFT)
906 
907 /*
908  * USBADRA (RW)
909  *
910  * USBADRA
911  * Device Address Advance. Default=0.
912  * When this bit is '0', any writes to USBADR are instantaneous.
913  *  When this bit is written to a '1' at the same time or before USBADR is written, the write to the USBADR field is staged and held in a hidden register.
914  * After an IN occurs on endpoint 0 and is ACKed, USBADR will be loaded from the holding register.
915  * Hardware will automatically clear this bit on the following conditions:
916  * 1) IN is ACKed to endpoint 0. (USBADR is updated from staging register).
917  * 2) OUT/SETUP occur to endpoint 0. (USBADR is not updated).
918  * 3) Device Reset occurs (USBADR is reset to 0).
919  * NOTE: After the status phase of the SET_ADDRESS descriptor, the DCD has 2 ms to program the USBADR field.
920  * This mechanism will ensure this specification is met when the DCD can not write of the device address within 2ms from the SET_ADDRESS status phase.
921  * If the DCD writes the USBADR with USBADRA=1 after the SET_ADDRESS data phase (before the prime of the status phase),
922  * the USBADR will be programmed instantly at the correct time and meet the 2ms USB requirement.
923  */
924 #define USB_DEVICEADDR_USBADRA_MASK (0x1000000UL)
925 #define USB_DEVICEADDR_USBADRA_SHIFT (24U)
926 #define USB_DEVICEADDR_USBADRA_SET(x) (((uint32_t)(x) << USB_DEVICEADDR_USBADRA_SHIFT) & USB_DEVICEADDR_USBADRA_MASK)
927 #define USB_DEVICEADDR_USBADRA_GET(x) (((uint32_t)(x) & USB_DEVICEADDR_USBADRA_MASK) >> USB_DEVICEADDR_USBADRA_SHIFT)
928 
929 /* Bitfield definition for register: PERIODICLISTBASE */
930 /*
931  * BASEADR (RW)
932  *
933  * BASEADR
934  * Base Address (Low).
935  * These bits correspond to memory address signals [31:12], respectively.
936  * Only used by the host controller.
937  */
938 #define USB_PERIODICLISTBASE_BASEADR_MASK (0xFFFFF000UL)
939 #define USB_PERIODICLISTBASE_BASEADR_SHIFT (12U)
940 #define USB_PERIODICLISTBASE_BASEADR_SET(x) (((uint32_t)(x) << USB_PERIODICLISTBASE_BASEADR_SHIFT) & USB_PERIODICLISTBASE_BASEADR_MASK)
941 #define USB_PERIODICLISTBASE_BASEADR_GET(x) (((uint32_t)(x) & USB_PERIODICLISTBASE_BASEADR_MASK) >> USB_PERIODICLISTBASE_BASEADR_SHIFT)
942 
943 /* Bitfield definition for register: ASYNCLISTADDR */
944 /*
945  * ASYBASE (RW)
946  *
947  * ASYBASE
948  * Link Pointer Low (LPL).
949  * These bits correspond to memory address signals [31:5], respectively. This field may only reference a
950  * Queue Head (QH).
951  * Only used by the host controller.
952  */
953 #define USB_ASYNCLISTADDR_ASYBASE_MASK (0xFFFFFFE0UL)
954 #define USB_ASYNCLISTADDR_ASYBASE_SHIFT (5U)
955 #define USB_ASYNCLISTADDR_ASYBASE_SET(x) (((uint32_t)(x) << USB_ASYNCLISTADDR_ASYBASE_SHIFT) & USB_ASYNCLISTADDR_ASYBASE_MASK)
956 #define USB_ASYNCLISTADDR_ASYBASE_GET(x) (((uint32_t)(x) & USB_ASYNCLISTADDR_ASYBASE_MASK) >> USB_ASYNCLISTADDR_ASYBASE_SHIFT)
957 
958 /* Bitfield definition for register: ENDPTLISTADDR */
959 /*
960  * EPBASE (RW)
961  *
962  * EPBASE
963  * Endpoint List Pointer(Low). These bits correspond to memory address signals [31:11], respectively.
964  * This field will reference a list of up to 32 Queue Head (QH) (that is, one queue head per endpoint & direction).
965  */
966 #define USB_ENDPTLISTADDR_EPBASE_MASK (0xFFFFF800UL)
967 #define USB_ENDPTLISTADDR_EPBASE_SHIFT (11U)
968 #define USB_ENDPTLISTADDR_EPBASE_SET(x) (((uint32_t)(x) << USB_ENDPTLISTADDR_EPBASE_SHIFT) & USB_ENDPTLISTADDR_EPBASE_MASK)
969 #define USB_ENDPTLISTADDR_EPBASE_GET(x) (((uint32_t)(x) & USB_ENDPTLISTADDR_EPBASE_MASK) >> USB_ENDPTLISTADDR_EPBASE_SHIFT)
970 
971 /* Bitfield definition for register: BURSTSIZE */
972 /*
973  * TXPBURST (RW)
974  *
975  * TXPBURST
976  * Programmable TX Burst Size.
977  * Default value is determined by TXBURST bits in n_HWTXBUF.
978  * This register represents the maximum length of a the burst in 32-bit words while moving data from system
979  * memory to the USB bus.
980  */
981 #define USB_BURSTSIZE_TXPBURST_MASK (0xFF00U)
982 #define USB_BURSTSIZE_TXPBURST_SHIFT (8U)
983 #define USB_BURSTSIZE_TXPBURST_SET(x) (((uint32_t)(x) << USB_BURSTSIZE_TXPBURST_SHIFT) & USB_BURSTSIZE_TXPBURST_MASK)
984 #define USB_BURSTSIZE_TXPBURST_GET(x) (((uint32_t)(x) & USB_BURSTSIZE_TXPBURST_MASK) >> USB_BURSTSIZE_TXPBURST_SHIFT)
985 
986 /*
987  * RXPBURST (RW)
988  *
989  * RXPBURST
990  * Programmable RX Burst Size.
991  * Default value is determined by TXBURST bits in n_HWRXBUF.
992  * This register represents the maximum length of a the burst in 32-bit words while moving data from the
993  * USB bus to system memory.
994  */
995 #define USB_BURSTSIZE_RXPBURST_MASK (0xFFU)
996 #define USB_BURSTSIZE_RXPBURST_SHIFT (0U)
997 #define USB_BURSTSIZE_RXPBURST_SET(x) (((uint32_t)(x) << USB_BURSTSIZE_RXPBURST_SHIFT) & USB_BURSTSIZE_RXPBURST_MASK)
998 #define USB_BURSTSIZE_RXPBURST_GET(x) (((uint32_t)(x) & USB_BURSTSIZE_RXPBURST_MASK) >> USB_BURSTSIZE_RXPBURST_SHIFT)
999 
1000 /* Bitfield definition for register: TXFILLTUNING */
1001 /*
1002  * TXFIFOTHRES (RW)
1003  *
1004  * TXFIFOTHRES
1005  * FIFO Burst Threshold. (Read/Write)
1006  * This register controls the number of data bursts that are posted to the TX latency FIFO in host mode before the packet begins on to the bus.
1007  * The minimum value is 2 and this value should be a low as possible to maximize USB performance.
1008  * A higher value can be used in systems with unpredictable latency and/or insufficient bandwidth
1009  * where the FIFO may underrun because the data transferred from the latency FIFO to USB occurs before it can be replenished from system memory.
1010  * This value is ignored if the Stream Disable bit in USB_n_USBMODE register is set.
1011  */
1012 #define USB_TXFILLTUNING_TXFIFOTHRES_MASK (0x3F0000UL)
1013 #define USB_TXFILLTUNING_TXFIFOTHRES_SHIFT (16U)
1014 #define USB_TXFILLTUNING_TXFIFOTHRES_SET(x) (((uint32_t)(x) << USB_TXFILLTUNING_TXFIFOTHRES_SHIFT) & USB_TXFILLTUNING_TXFIFOTHRES_MASK)
1015 #define USB_TXFILLTUNING_TXFIFOTHRES_GET(x) (((uint32_t)(x) & USB_TXFILLTUNING_TXFIFOTHRES_MASK) >> USB_TXFILLTUNING_TXFIFOTHRES_SHIFT)
1016 
1017 /*
1018  * TXSCHHEALTH (RWC)
1019  *
1020  * TXSCHHEALTH
1021  * Scheduler Health Counter. (Read/Write To Clear)
1022  * Table continues on the next page
1023  * This register increments when the host controller fails to fill the TX latency FIFO to the level programmed by TXFIFOTHRES
1024  * before running out of time to send the packet before the next Start-Of-Frame.
1025  * This health counter measures the number of times this occurs to provide feedback to selecting a proper TXSCHOH.
1026  * Writing to this register will clear the counter and this counter will max. at 31.
1027  */
1028 #define USB_TXFILLTUNING_TXSCHHEALTH_MASK (0x1F00U)
1029 #define USB_TXFILLTUNING_TXSCHHEALTH_SHIFT (8U)
1030 #define USB_TXFILLTUNING_TXSCHHEALTH_SET(x) (((uint32_t)(x) << USB_TXFILLTUNING_TXSCHHEALTH_SHIFT) & USB_TXFILLTUNING_TXSCHHEALTH_MASK)
1031 #define USB_TXFILLTUNING_TXSCHHEALTH_GET(x) (((uint32_t)(x) & USB_TXFILLTUNING_TXSCHHEALTH_MASK) >> USB_TXFILLTUNING_TXSCHHEALTH_SHIFT)
1032 
1033 /*
1034  * TXSCHOH (RW)
1035  *
1036  * TXSCHOH
1037  * Scheduler Overhead. (Read/Write) [Default = 0]
1038  * This register adds an additional fixed offset to the schedule time estimator described above as Tff.
1039  * As an approximation, the value chosen for this register should limit the number of back-off events captured
1040  * in the TXSCHHEALTH to less than 10 per second in a highly utilized bus.
1041  * Choosing a value that is too high for this register is not desired as it can needlessly reduce USB utilization.
1042  * The time unit represented in this register is 1.267us when a device is connected in High-Speed Mode.
1043  * The time unit represented in this register is 6.333us when a device is connected in Low/Full Speed Mode.
1044  * Default value is '08h' for OTG controller core .
1045  */
1046 #define USB_TXFILLTUNING_TXSCHOH_MASK (0x7FU)
1047 #define USB_TXFILLTUNING_TXSCHOH_SHIFT (0U)
1048 #define USB_TXFILLTUNING_TXSCHOH_SET(x) (((uint32_t)(x) << USB_TXFILLTUNING_TXSCHOH_SHIFT) & USB_TXFILLTUNING_TXSCHOH_MASK)
1049 #define USB_TXFILLTUNING_TXSCHOH_GET(x) (((uint32_t)(x) & USB_TXFILLTUNING_TXSCHOH_MASK) >> USB_TXFILLTUNING_TXSCHOH_SHIFT)
1050 
1051 /* Bitfield definition for register: ENDPTNAK */
1052 /*
1053  * EPTN (RWC)
1054  *
1055  * EPTN
1056  * TX Endpoint NAK - R/WC.
1057  * Each TX endpoint has 1 bit in this field. The bit is set when the
1058  * device sends a NAK handshake on a received IN token for the corresponding endpoint.
1059  * Bit [N] - Endpoint #[N], N is 0-7
1060  */
1061 #define USB_ENDPTNAK_EPTN_MASK (0xFFFF0000UL)
1062 #define USB_ENDPTNAK_EPTN_SHIFT (16U)
1063 #define USB_ENDPTNAK_EPTN_SET(x) (((uint32_t)(x) << USB_ENDPTNAK_EPTN_SHIFT) & USB_ENDPTNAK_EPTN_MASK)
1064 #define USB_ENDPTNAK_EPTN_GET(x) (((uint32_t)(x) & USB_ENDPTNAK_EPTN_MASK) >> USB_ENDPTNAK_EPTN_SHIFT)
1065 
1066 /*
1067  * EPRN (RWC)
1068  *
1069  * EPRN
1070  * RX Endpoint NAK - R/WC.
1071  * Each RX endpoint has 1 bit in this field. The bit is set when the
1072  * device sends a NAK handshake on a received OUT or PING token for the corresponding endpoint.
1073  * Bit [N] - Endpoint #[N], N is 0-7
1074  */
1075 #define USB_ENDPTNAK_EPRN_MASK (0xFFFFU)
1076 #define USB_ENDPTNAK_EPRN_SHIFT (0U)
1077 #define USB_ENDPTNAK_EPRN_SET(x) (((uint32_t)(x) << USB_ENDPTNAK_EPRN_SHIFT) & USB_ENDPTNAK_EPRN_MASK)
1078 #define USB_ENDPTNAK_EPRN_GET(x) (((uint32_t)(x) & USB_ENDPTNAK_EPRN_MASK) >> USB_ENDPTNAK_EPRN_SHIFT)
1079 
1080 /* Bitfield definition for register: ENDPTNAKEN */
1081 /*
1082  * EPTNE (RW)
1083  *
1084  * EPTNE
1085  * TX Endpoint NAK Enable - R/W.
1086  * Each bit is an enable bit for the corresponding TX Endpoint NAK bit. If this bit is set and the
1087  * corresponding TX Endpoint NAK bit is set, the NAK Interrupt bit is set.
1088  * Bit [N] - Endpoint #[N], N is 0-7
1089  */
1090 #define USB_ENDPTNAKEN_EPTNE_MASK (0xFFFF0000UL)
1091 #define USB_ENDPTNAKEN_EPTNE_SHIFT (16U)
1092 #define USB_ENDPTNAKEN_EPTNE_SET(x) (((uint32_t)(x) << USB_ENDPTNAKEN_EPTNE_SHIFT) & USB_ENDPTNAKEN_EPTNE_MASK)
1093 #define USB_ENDPTNAKEN_EPTNE_GET(x) (((uint32_t)(x) & USB_ENDPTNAKEN_EPTNE_MASK) >> USB_ENDPTNAKEN_EPTNE_SHIFT)
1094 
1095 /*
1096  * EPRNE (RW)
1097  *
1098  * EPRNE
1099  * RX Endpoint NAK Enable - R/W.
1100  * Each bit is an enable bit for the corresponding RX Endpoint NAK bit. If this bit is set and the
1101  * corresponding RX Endpoint NAK bit is set, the NAK Interrupt bit is set.
1102  * Bit [N] - Endpoint #[N], N is 0-7
1103  */
1104 #define USB_ENDPTNAKEN_EPRNE_MASK (0xFFFFU)
1105 #define USB_ENDPTNAKEN_EPRNE_SHIFT (0U)
1106 #define USB_ENDPTNAKEN_EPRNE_SET(x) (((uint32_t)(x) << USB_ENDPTNAKEN_EPRNE_SHIFT) & USB_ENDPTNAKEN_EPRNE_MASK)
1107 #define USB_ENDPTNAKEN_EPRNE_GET(x) (((uint32_t)(x) & USB_ENDPTNAKEN_EPRNE_MASK) >> USB_ENDPTNAKEN_EPRNE_SHIFT)
1108 
1109 /* Bitfield definition for register: PORTSC1 */
1110 /*
1111  * STS (RW)
1112  *
1113  * STS
1114  * Serial Transceiver Select
1115  * 1 Serial Interface Engine is selected
1116  * 0 Parallel Interface signals is selected
1117  * Serial Interface Engine can be used in combination with UTMI+/ULPI physical interface to provide FS/LS signaling instead of the parallel interface signals.
1118  * When this bit is set '1b', serial interface engine will be used instead of parallel interface signals.
1119  */
1120 #define USB_PORTSC1_STS_MASK (0x20000000UL)
1121 #define USB_PORTSC1_STS_SHIFT (29U)
1122 #define USB_PORTSC1_STS_SET(x) (((uint32_t)(x) << USB_PORTSC1_STS_SHIFT) & USB_PORTSC1_STS_MASK)
1123 #define USB_PORTSC1_STS_GET(x) (((uint32_t)(x) & USB_PORTSC1_STS_MASK) >> USB_PORTSC1_STS_SHIFT)
1124 
1125 /*
1126  * PTW (RW)
1127  *
1128  * PTW
1129  * Parallel Transceiver Width
1130  * This bit has no effect if serial interface engine is used.
1131  * 0 - Select the 8-bit UTMI interface [60MHz]
1132  * 1 - Select the 16-bit UTMI interface [30MHz]
1133  */
1134 #define USB_PORTSC1_PTW_MASK (0x10000000UL)
1135 #define USB_PORTSC1_PTW_SHIFT (28U)
1136 #define USB_PORTSC1_PTW_SET(x) (((uint32_t)(x) << USB_PORTSC1_PTW_SHIFT) & USB_PORTSC1_PTW_MASK)
1137 #define USB_PORTSC1_PTW_GET(x) (((uint32_t)(x) & USB_PORTSC1_PTW_MASK) >> USB_PORTSC1_PTW_SHIFT)
1138 
1139 /*
1140  * PSPD (RO)
1141  *
1142  * PSPD
1143  * Port Speed - Read Only.
1144  * This register field indicates the speed at which the port is operating.
1145  * 00 - Full Speed
1146  * 01 - Low Speed
1147  * 10 - High Speed
1148  * 11 - Undefined
1149  */
1150 #define USB_PORTSC1_PSPD_MASK (0xC000000UL)
1151 #define USB_PORTSC1_PSPD_SHIFT (26U)
1152 #define USB_PORTSC1_PSPD_GET(x) (((uint32_t)(x) & USB_PORTSC1_PSPD_MASK) >> USB_PORTSC1_PSPD_SHIFT)
1153 
1154 /*
1155  * PFSC (RW)
1156  *
1157  * PFSC
1158  * Port Force Full Speed Connect - Read/Write. Default = 0b.
1159  * When this bit is set to '1b', the port will be forced to only connect at Full Speed, It disables the chirp
1160  * sequence that allows the port to identify itself as High Speed.
1161  * 0 - Normal operation
1162  * 1 - Forced to full speed
1163  */
1164 #define USB_PORTSC1_PFSC_MASK (0x1000000UL)
1165 #define USB_PORTSC1_PFSC_SHIFT (24U)
1166 #define USB_PORTSC1_PFSC_SET(x) (((uint32_t)(x) << USB_PORTSC1_PFSC_SHIFT) & USB_PORTSC1_PFSC_MASK)
1167 #define USB_PORTSC1_PFSC_GET(x) (((uint32_t)(x) & USB_PORTSC1_PFSC_MASK) >> USB_PORTSC1_PFSC_SHIFT)
1168 
1169 /*
1170  * PHCD (RW)
1171  *
1172  * PHCD
1173  * PHY Low Power Suspend - Clock Disable (PLPSCD) - Read/Write. Default = 0b.
1174  * When this bit is set to '1b', the PHY clock is disabled. Reading this bit will indicate the status of the PHY
1175  * clock.
1176  * NOTE: The PHY clock cannot be disabled if it is being used as the system clock.
1177  * In device mode, The PHY can be put into Low Power Suspend when the device is not running (USBCMD
1178  * Run/Stop=0b) or the host has signalled suspend (PORTSC1 SUSPEND=1b). PHY Low power suspend
1179  * will be cleared automatically when the host initials resume. Before forcing a resume from the device, the
1180  * device controller driver must clear this bit.
1181  * In host mode, the PHY can be put into Low Power Suspend when the downstream device has been put
1182  * into suspend mode or when no downstream device is connected. Low power suspend is completely
1183  * under the control of software.
1184  * 0 - Enable PHY clock
1185  * 1 - Disable PHY clock
1186  */
1187 #define USB_PORTSC1_PHCD_MASK (0x800000UL)
1188 #define USB_PORTSC1_PHCD_SHIFT (23U)
1189 #define USB_PORTSC1_PHCD_SET(x) (((uint32_t)(x) << USB_PORTSC1_PHCD_SHIFT) & USB_PORTSC1_PHCD_MASK)
1190 #define USB_PORTSC1_PHCD_GET(x) (((uint32_t)(x) & USB_PORTSC1_PHCD_MASK) >> USB_PORTSC1_PHCD_SHIFT)
1191 
1192 /*
1193  * WKOC (RW)
1194  *
1195  * WKOC
1196  * Wake on Over-current Enable (WKOC_E) - Read/Write. Default = 0b.
1197  * Writing this bit to a one enables the port to be sensitive to over-current conditions as wake-up events.
1198  * This field is zero if Port Power(PORTSC1) is zero.
1199  */
1200 #define USB_PORTSC1_WKOC_MASK (0x400000UL)
1201 #define USB_PORTSC1_WKOC_SHIFT (22U)
1202 #define USB_PORTSC1_WKOC_SET(x) (((uint32_t)(x) << USB_PORTSC1_WKOC_SHIFT) & USB_PORTSC1_WKOC_MASK)
1203 #define USB_PORTSC1_WKOC_GET(x) (((uint32_t)(x) & USB_PORTSC1_WKOC_MASK) >> USB_PORTSC1_WKOC_SHIFT)
1204 
1205 /*
1206  * WKDC (RW)
1207  *
1208  * WKDC
1209  * Wake on Disconnect Enable (WKDSCNNT_E) - Read/Write. Default=0b. Writing this bit to a one enables
1210  * the port to be sensitive to device disconnects as wake-up events.
1211  * This field is zero if Port Power(PORTSC1) is zero or in device mode.
1212  */
1213 #define USB_PORTSC1_WKDC_MASK (0x200000UL)
1214 #define USB_PORTSC1_WKDC_SHIFT (21U)
1215 #define USB_PORTSC1_WKDC_SET(x) (((uint32_t)(x) << USB_PORTSC1_WKDC_SHIFT) & USB_PORTSC1_WKDC_MASK)
1216 #define USB_PORTSC1_WKDC_GET(x) (((uint32_t)(x) & USB_PORTSC1_WKDC_MASK) >> USB_PORTSC1_WKDC_SHIFT)
1217 
1218 /*
1219  * WKCN (RW)
1220  *
1221  * WKCN
1222  * Wake on Connect Enable (WKCNNT_E) - Read/Write. Default=0b.
1223  * Writing this bit to a one enables the port to be sensitive to device connects as wake-up events.
1224  * This field is zero if Port Power(PORTSC1) is zero or in device mode.
1225  */
1226 #define USB_PORTSC1_WKCN_MASK (0x100000UL)
1227 #define USB_PORTSC1_WKCN_SHIFT (20U)
1228 #define USB_PORTSC1_WKCN_SET(x) (((uint32_t)(x) << USB_PORTSC1_WKCN_SHIFT) & USB_PORTSC1_WKCN_MASK)
1229 #define USB_PORTSC1_WKCN_GET(x) (((uint32_t)(x) & USB_PORTSC1_WKCN_MASK) >> USB_PORTSC1_WKCN_SHIFT)
1230 
1231 /*
1232  * PTC (RW)
1233  *
1234  * PTC
1235  * Port Test Control - Read/Write. Default = 0000b.
1236  * Refer to Port Test Mode for the operational model for using these test modes and the USB Specification Revision 2.0, Chapter 7 for details on each test mode.
1237  * The FORCE_ENABLE_FS and FORCE ENABLE_LS are extensions to the test mode support specified in the EHCI specification.
1238  * Writing the PTC field to any of the FORCE_ENABLE_{HS/FS/LS} values will force the port into the connected and enabled state at the selected speed.
1239  * Writing the PTC field back to TEST_MODE_DISABLE will allow the port state machines to progress normally from that point.
1240  * NOTE: Low speed operations are not supported as a peripheral device.
1241  * Any other value than zero indicates that the port is operating in test mode.
1242  * Value Specific Test
1243  * 0000 - TEST_MODE_DISABLE
1244  * 0001 - J_STATE
1245  * 0010 - K_STATE
1246  * 0011 - SE0 (host) / NAK (device)
1247  * 0100 - Packet
1248  * 0101 - FORCE_ENABLE_HS
1249  * 0110 - FORCE_ENABLE_FS
1250  * 0111 - FORCE_ENABLE_LS
1251  * 1000-1111 - Reserved
1252  */
1253 #define USB_PORTSC1_PTC_MASK (0xF0000UL)
1254 #define USB_PORTSC1_PTC_SHIFT (16U)
1255 #define USB_PORTSC1_PTC_SET(x) (((uint32_t)(x) << USB_PORTSC1_PTC_SHIFT) & USB_PORTSC1_PTC_MASK)
1256 #define USB_PORTSC1_PTC_GET(x) (((uint32_t)(x) & USB_PORTSC1_PTC_MASK) >> USB_PORTSC1_PTC_SHIFT)
1257 
1258 /*
1259  * PP (RW)
1260  *
1261  * PP
1262  * Port Power (PP)-Read/Write or Read Only.
1263  * The function of this bit depends on the value of the Port Power Switching (PPC) field in the HCSPARAMS register. The behavior is as follows:
1264  * PPC
1265  * PP Operation
1266  * 0
1267  * 1b Read Only - Host controller does not have port power control switches. Each port is hard-wired to power.
1268  * 1
1269  * 1b/0b - Read/Write. OTG controller requires port power control switches. This bit represents the current setting of the switch (0=off, 1=on).
1270  * When power is not available on a port (that is, PP equals a 0), the port is non-functional and will not report attaches, detaches, etc.
1271  * When an over-current condition is detected on a powered port and PPC is a one,
1272  * the PP bit in each affected port may be transitional by the host controller driver from a one to a zero (removing power from the port).
1273  * This feature is implemented in all controller cores (PPC = 1).
1274  */
1275 #define USB_PORTSC1_PP_MASK (0x1000U)
1276 #define USB_PORTSC1_PP_SHIFT (12U)
1277 #define USB_PORTSC1_PP_SET(x) (((uint32_t)(x) << USB_PORTSC1_PP_SHIFT) & USB_PORTSC1_PP_MASK)
1278 #define USB_PORTSC1_PP_GET(x) (((uint32_t)(x) & USB_PORTSC1_PP_MASK) >> USB_PORTSC1_PP_SHIFT)
1279 
1280 /*
1281  * LS (RO)
1282  *
1283  * LS
1284  * Line Status-Read Only. These bits reflect the current logical levels of the D+ (bit 11) and D- (bit 10) signal
1285  * lines.
1286  * In host mode, the use of linestate by the host controller driver is not necessary (unlike EHCI), because
1287  * the port controller state machine and the port routing manage the connection of LS and FS.
1288  * In device mode, the use of linestate by the device controller driver is not necessary.
1289  * The encoding of the bits are:
1290  * Bits [11:10] Meaning
1291  * 00 - SE0
1292  * 01 - K-state
1293  * 10 - J-state
1294  * 11 - Undefined
1295  */
1296 #define USB_PORTSC1_LS_MASK (0xC00U)
1297 #define USB_PORTSC1_LS_SHIFT (10U)
1298 #define USB_PORTSC1_LS_GET(x) (((uint32_t)(x) & USB_PORTSC1_LS_MASK) >> USB_PORTSC1_LS_SHIFT)
1299 
1300 /*
1301  * HSP (RO)
1302  *
1303  * HSP
1304  * High-Speed Port - Read Only. Default = 0b.
1305  * When the bit is one, the host/device connected to the port is in high-speed mode and if set to zero, the
1306  * host/device connected to the port is not in a high-speed mode.
1307  * NOTE: HSP is redundant with PSPD(bit 27, 26) but remained for compatibility.
1308  */
1309 #define USB_PORTSC1_HSP_MASK (0x200U)
1310 #define USB_PORTSC1_HSP_SHIFT (9U)
1311 #define USB_PORTSC1_HSP_GET(x) (((uint32_t)(x) & USB_PORTSC1_HSP_MASK) >> USB_PORTSC1_HSP_SHIFT)
1312 
1313 /*
1314  * PR (RW)
1315  *
1316  * PR
1317  * Port Reset - Read/Write or Read Only. Default = 0b.
1318  * In Host Mode: Read/Write. 1=Port is in Reset. 0=Port is not in Reset. Default 0.
1319  * When software writes a one to this bit the bus-reset sequence as defined in the USB Specification Revision 2.0 is started.
1320  * This bit will automatically change to zero after the reset sequence is complete.
1321  * This behavior is different from EHCI where the host controller driver is required to set this bit to a zero after the reset duration is timed in the driver.
1322  * In Device Mode: This bit is a read only status bit. Device reset from the USB bus is also indicated in the USBSTS register.
1323  */
1324 #define USB_PORTSC1_PR_MASK (0x100U)
1325 #define USB_PORTSC1_PR_SHIFT (8U)
1326 #define USB_PORTSC1_PR_SET(x) (((uint32_t)(x) << USB_PORTSC1_PR_SHIFT) & USB_PORTSC1_PR_MASK)
1327 #define USB_PORTSC1_PR_GET(x) (((uint32_t)(x) & USB_PORTSC1_PR_MASK) >> USB_PORTSC1_PR_SHIFT)
1328 
1329 /*
1330  * SUSP (RW)
1331  *
1332  * SUSP
1333  * Suspend - Read/Write or Read Only. Default = 0b.
1334  * 1=Port in suspend state. 0=Port not in suspend state.
1335  * In Host Mode: Read/Write.
1336  * Port Enabled Bit and Suspend bit of this register define the port states as follows:
1337  * Bits [Port Enabled, Suspend] Port State
1338  * 0x Disable
1339  * 10 Enable
1340  * 11 Suspend
1341  * When in suspend state, downstream propagation of data is blocked on this port, except for port reset.
1342  * The blocking occurs at the end of the current transaction if a transaction was in progress when this bit was written to 1.
1343  * In the suspend state, the port is sensitive to resume detection.
1344  * Note that the bit status does not change until the port is suspended and that there may be a delay in suspending a port if there is a transaction currently in progress on the USB.
1345  * The host controller will unconditionally set this bit to zero when software sets the Force Port Resume bit to zero. The host controller ignores a write of zero to this bit.
1346  * If host software sets this bit to a one when the port is not enabled (that is, Port enabled bit is a zero) the results are undefined.
1347  * This field is zero if Port Power(PORTSC1) is zero in host mode.
1348  * In Device Mode: Read Only.
1349  * In device mode this bit is a read only status bit.
1350  */
1351 #define USB_PORTSC1_SUSP_MASK (0x80U)
1352 #define USB_PORTSC1_SUSP_SHIFT (7U)
1353 #define USB_PORTSC1_SUSP_SET(x) (((uint32_t)(x) << USB_PORTSC1_SUSP_SHIFT) & USB_PORTSC1_SUSP_MASK)
1354 #define USB_PORTSC1_SUSP_GET(x) (((uint32_t)(x) & USB_PORTSC1_SUSP_MASK) >> USB_PORTSC1_SUSP_SHIFT)
1355 
1356 /*
1357  * FPR (RW)
1358  *
1359  * FPR
1360  * Force Port Resume -Read/Write. 1= Resume detected/driven on port. 0=No resume (K-state) detected driven on port. Default = 0.
1361  * In Host Mode:
1362  * Software sets this bit to one to drive resume signaling. The Host Controller sets this bit to one if a J-to-K transition is detected while the port is in the Suspend state.
1363  * When this bit transitions to a one because a J-to-K transition is detected, the Port Change Detect bit in the USBSTS register is also set to one.
1364  * This bit will automatically change to zero after the resume sequence is complete.
1365  * This behavior is different from EHCI where the host controller driver is required to set this bit to a zero after the resume duration is timed in the driver.
1366  * Note that when the Host controller owns the port, the resume sequence follows the defined sequence documented in the USB Specification Revision 2.0.
1367  * The resume signaling (Full-speed 'K') is driven on the port as long as this bit remains a one. This bit will remain a one until the port has switched to the high-speed idle.
1368  * Writing a zero has no effect because the port controller will time the resume operation, clear the bit the port control state switches to HS or FS idle.
1369  * This field is zero if Port Power(PORTSC1) is zero in host mode.
1370  * This bit is not-EHCI compatible.
1371  * In Device mode:
1372  * After the device has been in Suspend State for 5ms or more, software must set this bit to one to drive resume signaling before clearing.
1373  * The Device Controller will set this bit to one if a J-to-K transition is detected while the port is in the Suspend state.
1374  * The bit will be cleared when the device returns to normal operation.
1375  *  Also, when this bit wil be cleared because a K-to-J transition detected, the Port Change Detect bit in the USBSTS register is also set to one.
1376  */
1377 #define USB_PORTSC1_FPR_MASK (0x40U)
1378 #define USB_PORTSC1_FPR_SHIFT (6U)
1379 #define USB_PORTSC1_FPR_SET(x) (((uint32_t)(x) << USB_PORTSC1_FPR_SHIFT) & USB_PORTSC1_FPR_MASK)
1380 #define USB_PORTSC1_FPR_GET(x) (((uint32_t)(x) & USB_PORTSC1_FPR_MASK) >> USB_PORTSC1_FPR_SHIFT)
1381 
1382 /*
1383  * OCC (RW)
1384  *
1385  * OCC
1386  * Over-current Change-R/WC. Default=0.
1387  * This bit is set '1b' by hardware when there is a change to Over-current Active. Software can clear this bit by writing a one to this bit position.
1388  */
1389 #define USB_PORTSC1_OCC_MASK (0x20U)
1390 #define USB_PORTSC1_OCC_SHIFT (5U)
1391 #define USB_PORTSC1_OCC_SET(x) (((uint32_t)(x) << USB_PORTSC1_OCC_SHIFT) & USB_PORTSC1_OCC_MASK)
1392 #define USB_PORTSC1_OCC_GET(x) (((uint32_t)(x) & USB_PORTSC1_OCC_MASK) >> USB_PORTSC1_OCC_SHIFT)
1393 
1394 /*
1395  * OCA (RO)
1396  *
1397  * OCA
1398  * Over-current Active-Read Only. Default 0.
1399  * This bit will automatically transition from one to zero when the over current condition is removed.
1400  * 0 - This port does not have an over-current condition.
1401  * 1 - This port currently has an over-current condition
1402  */
1403 #define USB_PORTSC1_OCA_MASK (0x10U)
1404 #define USB_PORTSC1_OCA_SHIFT (4U)
1405 #define USB_PORTSC1_OCA_GET(x) (((uint32_t)(x) & USB_PORTSC1_OCA_MASK) >> USB_PORTSC1_OCA_SHIFT)
1406 
1407 /*
1408  * PEC (RWC)
1409  *
1410  * PEC
1411  * Port Enable/Disable Change-R/WC. 1=Port enabled/disabled status has changed. 0=No change. Default = 0.
1412  * In Host Mode:
1413  * For the root hub, this bit is set to a one only when a port is disabled due to disconnect on the port or
1414  * due to the appropriate conditions existing at the EOF2 point (See Chapter 11 of the USB Specification).
1415  * Software clears this by writing a one to it.
1416  * This field is zero if Port Power(PORTSC1) is zero.
1417  * In Device mode:
1418  * The device port is always enabled, so this bit is always '0b'.
1419  */
1420 #define USB_PORTSC1_PEC_MASK (0x8U)
1421 #define USB_PORTSC1_PEC_SHIFT (3U)
1422 #define USB_PORTSC1_PEC_SET(x) (((uint32_t)(x) << USB_PORTSC1_PEC_SHIFT) & USB_PORTSC1_PEC_MASK)
1423 #define USB_PORTSC1_PEC_GET(x) (((uint32_t)(x) & USB_PORTSC1_PEC_MASK) >> USB_PORTSC1_PEC_SHIFT)
1424 
1425 /*
1426  * PE (RWC)
1427  *
1428  * PE
1429  * Port Enabled/Disabled-Read/Write. 1=Enable. 0=Disable. Default 0.
1430  * In Host Mode:
1431  * Ports can only be enabled by the host controller as a part of the reset and enable. Software cannot enable a port by writing a one to this field.
1432  * Ports can be disabled by either a fault condition (disconnect event or other fault condition) or by the host software.
1433  * Note that the bit status does not change until the port state actually changes. There may be a delay in disabling or enabling a port due to other host controller and bus events.
1434  * When the port is disabled, (0b) downstream propagation of data is blocked except for reset.
1435  * This field is zero if Port Power(PORTSC1) is zero in host mode.
1436  * In Device Mode:
1437  * The device port is always enabled, so this bit is always '1b'.
1438  */
1439 #define USB_PORTSC1_PE_MASK (0x4U)
1440 #define USB_PORTSC1_PE_SHIFT (2U)
1441 #define USB_PORTSC1_PE_SET(x) (((uint32_t)(x) << USB_PORTSC1_PE_SHIFT) & USB_PORTSC1_PE_MASK)
1442 #define USB_PORTSC1_PE_GET(x) (((uint32_t)(x) & USB_PORTSC1_PE_MASK) >> USB_PORTSC1_PE_SHIFT)
1443 
1444 /*
1445  * CSC (RWC)
1446  *
1447  * CSC
1448  * Connect Status Change-R/WC. 1 =Change in Current Connect Status. 0=No change. Default 0.
1449  * In Host Mode:
1450  * Indicates a change has occurred in the port's Current Connect Status.
1451  * The host/device controller sets this bit for all changes to the port device connect status, even if system software has not cleared an existing connect status change.
1452  * For example, the insertion status changes twice before system software has cleared the changed condition,
1453  * hub hardware will be 'setting' an already-set bit (that is, the bit will remain set). Software clears this bit by writing a one to it.
1454  * This field is zero if Port Power(PORTSC1) is zero in host mode.
1455  * In Device Mode:
1456  * This bit is undefined in device controller mode.
1457  */
1458 #define USB_PORTSC1_CSC_MASK (0x2U)
1459 #define USB_PORTSC1_CSC_SHIFT (1U)
1460 #define USB_PORTSC1_CSC_SET(x) (((uint32_t)(x) << USB_PORTSC1_CSC_SHIFT) & USB_PORTSC1_CSC_MASK)
1461 #define USB_PORTSC1_CSC_GET(x) (((uint32_t)(x) & USB_PORTSC1_CSC_MASK) >> USB_PORTSC1_CSC_SHIFT)
1462 
1463 /*
1464  * CCS (RWC)
1465  *
1466  * CCS
1467  * Current Connect Status-Read Only.
1468  * In Host Mode:
1469  * 1=Device is present on port. 0=No device is present. Default = 0.
1470  * This value reflects the current state of the port, and may not correspond directly to the event that caused the Connect Status Change bit (Bit 1) to be set.
1471  * This field is zero if Port Power(PORTSC1) is zero in host mode.
1472  * In Device Mode:
1473  * 1=Attached. 0=Not Attached. Default=0.
1474  * A one indicates that the device successfully attached and is operating in either high speed or full speed as indicated by the High Speed Port bit in this register.
1475  * A zero indicates that the device did not attach successfully or was forcibly disconnected by the software writing a zero to the Run bit in the USBCMD register.
1476  * It does not state the device being disconnected or Suspended.
1477  */
1478 #define USB_PORTSC1_CCS_MASK (0x1U)
1479 #define USB_PORTSC1_CCS_SHIFT (0U)
1480 #define USB_PORTSC1_CCS_SET(x) (((uint32_t)(x) << USB_PORTSC1_CCS_SHIFT) & USB_PORTSC1_CCS_MASK)
1481 #define USB_PORTSC1_CCS_GET(x) (((uint32_t)(x) & USB_PORTSC1_CCS_MASK) >> USB_PORTSC1_CCS_SHIFT)
1482 
1483 /* Bitfield definition for register: OTGSC */
1484 /*
1485  * ASVIE (RW)
1486  *
1487  * ASVIE
1488  * A Session Valid Interrupt Enable - Read/Write.
1489  */
1490 #define USB_OTGSC_ASVIE_MASK (0x4000000UL)
1491 #define USB_OTGSC_ASVIE_SHIFT (26U)
1492 #define USB_OTGSC_ASVIE_SET(x) (((uint32_t)(x) << USB_OTGSC_ASVIE_SHIFT) & USB_OTGSC_ASVIE_MASK)
1493 #define USB_OTGSC_ASVIE_GET(x) (((uint32_t)(x) & USB_OTGSC_ASVIE_MASK) >> USB_OTGSC_ASVIE_SHIFT)
1494 
1495 /*
1496  * AVVIE (RW)
1497  *
1498  * AVVIE
1499  * A VBus Valid Interrupt Enable - Read/Write.
1500  * Setting this bit enables the A VBus valid interrupt.
1501  */
1502 #define USB_OTGSC_AVVIE_MASK (0x2000000UL)
1503 #define USB_OTGSC_AVVIE_SHIFT (25U)
1504 #define USB_OTGSC_AVVIE_SET(x) (((uint32_t)(x) << USB_OTGSC_AVVIE_SHIFT) & USB_OTGSC_AVVIE_MASK)
1505 #define USB_OTGSC_AVVIE_GET(x) (((uint32_t)(x) & USB_OTGSC_AVVIE_MASK) >> USB_OTGSC_AVVIE_SHIFT)
1506 
1507 /*
1508  * IDIE (RW)
1509  *
1510  * IDIE
1511  * USB ID Interrupt Enable - Read/Write.
1512  * Setting this bit enables the USB ID interrupt.
1513  */
1514 #define USB_OTGSC_IDIE_MASK (0x1000000UL)
1515 #define USB_OTGSC_IDIE_SHIFT (24U)
1516 #define USB_OTGSC_IDIE_SET(x) (((uint32_t)(x) << USB_OTGSC_IDIE_SHIFT) & USB_OTGSC_IDIE_MASK)
1517 #define USB_OTGSC_IDIE_GET(x) (((uint32_t)(x) & USB_OTGSC_IDIE_MASK) >> USB_OTGSC_IDIE_SHIFT)
1518 
1519 /*
1520  * ASVIS (RWC)
1521  *
1522  * ASVIS
1523  * A Session Valid Interrupt Status - Read/Write to Clear.
1524  * This bit is set when VBus has either risen above or fallen below the A session valid threshold.
1525  * Software must write a one to clear this bit.
1526  */
1527 #define USB_OTGSC_ASVIS_MASK (0x40000UL)
1528 #define USB_OTGSC_ASVIS_SHIFT (18U)
1529 #define USB_OTGSC_ASVIS_SET(x) (((uint32_t)(x) << USB_OTGSC_ASVIS_SHIFT) & USB_OTGSC_ASVIS_MASK)
1530 #define USB_OTGSC_ASVIS_GET(x) (((uint32_t)(x) & USB_OTGSC_ASVIS_MASK) >> USB_OTGSC_ASVIS_SHIFT)
1531 
1532 /*
1533  * AVVIS (RWC)
1534  *
1535  * AVVIS
1536  * A VBus Valid Interrupt Status - Read/Write to Clear.
1537  * This bit is set when VBus has either risen above or fallen below the VBus valid threshold on an A device.
1538  * Software must write a one to clear this bit.
1539  */
1540 #define USB_OTGSC_AVVIS_MASK (0x20000UL)
1541 #define USB_OTGSC_AVVIS_SHIFT (17U)
1542 #define USB_OTGSC_AVVIS_SET(x) (((uint32_t)(x) << USB_OTGSC_AVVIS_SHIFT) & USB_OTGSC_AVVIS_MASK)
1543 #define USB_OTGSC_AVVIS_GET(x) (((uint32_t)(x) & USB_OTGSC_AVVIS_MASK) >> USB_OTGSC_AVVIS_SHIFT)
1544 
1545 /*
1546  * IDIS (RWC)
1547  *
1548  * IDIS
1549  * USB ID Interrupt Status - Read/Write.
1550  * This bit is set when a change on the ID input has been detected.
1551  * Software must write a one to clear this bit.
1552  */
1553 #define USB_OTGSC_IDIS_MASK (0x10000UL)
1554 #define USB_OTGSC_IDIS_SHIFT (16U)
1555 #define USB_OTGSC_IDIS_SET(x) (((uint32_t)(x) << USB_OTGSC_IDIS_SHIFT) & USB_OTGSC_IDIS_MASK)
1556 #define USB_OTGSC_IDIS_GET(x) (((uint32_t)(x) & USB_OTGSC_IDIS_MASK) >> USB_OTGSC_IDIS_SHIFT)
1557 
1558 /*
1559  * ASV (RO)
1560  *
1561  * ASV
1562  * A Session Valid - Read Only.
1563  * Indicates VBus is above the A session valid threshold.
1564  */
1565 #define USB_OTGSC_ASV_MASK (0x400U)
1566 #define USB_OTGSC_ASV_SHIFT (10U)
1567 #define USB_OTGSC_ASV_GET(x) (((uint32_t)(x) & USB_OTGSC_ASV_MASK) >> USB_OTGSC_ASV_SHIFT)
1568 
1569 /*
1570  * AVV (RO)
1571  *
1572  * AVV
1573  * A VBus Valid - Read Only.
1574  * Indicates VBus is above the A VBus valid threshold.
1575  */
1576 #define USB_OTGSC_AVV_MASK (0x200U)
1577 #define USB_OTGSC_AVV_SHIFT (9U)
1578 #define USB_OTGSC_AVV_GET(x) (((uint32_t)(x) & USB_OTGSC_AVV_MASK) >> USB_OTGSC_AVV_SHIFT)
1579 
1580 /*
1581  * ID (RO)
1582  *
1583  * ID
1584  * USB ID - Read Only.
1585  * 0 = A device, 1 = B device
1586  */
1587 #define USB_OTGSC_ID_MASK (0x100U)
1588 #define USB_OTGSC_ID_SHIFT (8U)
1589 #define USB_OTGSC_ID_GET(x) (((uint32_t)(x) & USB_OTGSC_ID_MASK) >> USB_OTGSC_ID_SHIFT)
1590 
1591 /*
1592  * IDPU (RW)
1593  *
1594  * IDPU
1595  * ID Pullup - Read/Write
1596  * This bit provide control over the ID pull-up resistor; 0 = off, 1 = on [default]. When this bit is 0, the ID input
1597  * will not be sampled.
1598  */
1599 #define USB_OTGSC_IDPU_MASK (0x20U)
1600 #define USB_OTGSC_IDPU_SHIFT (5U)
1601 #define USB_OTGSC_IDPU_SET(x) (((uint32_t)(x) << USB_OTGSC_IDPU_SHIFT) & USB_OTGSC_IDPU_MASK)
1602 #define USB_OTGSC_IDPU_GET(x) (((uint32_t)(x) & USB_OTGSC_IDPU_MASK) >> USB_OTGSC_IDPU_SHIFT)
1603 
1604 /*
1605  * VC (RW)
1606  *
1607  * VC
1608  * VBUS Charge - Read/Write.
1609  * Setting this bit causes the VBus line to be charged. This is used for VBus pulsing during SRP.
1610  */
1611 #define USB_OTGSC_VC_MASK (0x2U)
1612 #define USB_OTGSC_VC_SHIFT (1U)
1613 #define USB_OTGSC_VC_SET(x) (((uint32_t)(x) << USB_OTGSC_VC_SHIFT) & USB_OTGSC_VC_MASK)
1614 #define USB_OTGSC_VC_GET(x) (((uint32_t)(x) & USB_OTGSC_VC_MASK) >> USB_OTGSC_VC_SHIFT)
1615 
1616 /*
1617  * VD (RW)
1618  *
1619  * VD
1620  * VBUS_Discharge - Read/Write.
1621  * Setting this bit causes VBus to discharge through a resistor.
1622  */
1623 #define USB_OTGSC_VD_MASK (0x1U)
1624 #define USB_OTGSC_VD_SHIFT (0U)
1625 #define USB_OTGSC_VD_SET(x) (((uint32_t)(x) << USB_OTGSC_VD_SHIFT) & USB_OTGSC_VD_MASK)
1626 #define USB_OTGSC_VD_GET(x) (((uint32_t)(x) & USB_OTGSC_VD_MASK) >> USB_OTGSC_VD_SHIFT)
1627 
1628 /* Bitfield definition for register: USBMODE */
1629 /*
1630  * SDIS (RW)
1631  *
1632  * SDIS
1633  * Stream Disable Mode. (0 - Inactive [default]; 1 - Active)
1634  * Device Mode: Setting to a '1' disables double priming on both RX and TX for low bandwidth systems.
1635  * This mode ensures that when the RX and TX buffers are sufficient to contain an entire packet that the standard double buffering scheme is disabled to prevent overruns/underruns in bandwidth limited systems.
1636  * Note: In High Speed Mode, all packets received are responded to with a NYET handshake when stream disable is active.
1637  * Host Mode: Setting to a '1' ensures that overruns/underruns of the latency FIFO are eliminated for low bandwidth systems
1638  * where the RX and TX buffers are sufficient to contain the entire packet. Enabling stream disable also has the effect of ensuring the TX latency is filled to capacity before the packet is launched onto the USB.
1639  * NOTE: Time duration to pre-fill the FIFO becomes significant when stream disable is active. See TXFILLTUNING and TXTTFILLTUNING [MPH Only] to characterize the adjustments needed for
1640  * the scheduler when using this feature.
1641  * NOTE: The use of this feature substantially limits of the overall USB performance that can be achieved.
1642  */
1643 #define USB_USBMODE_SDIS_MASK (0x10U)
1644 #define USB_USBMODE_SDIS_SHIFT (4U)
1645 #define USB_USBMODE_SDIS_SET(x) (((uint32_t)(x) << USB_USBMODE_SDIS_SHIFT) & USB_USBMODE_SDIS_MASK)
1646 #define USB_USBMODE_SDIS_GET(x) (((uint32_t)(x) & USB_USBMODE_SDIS_MASK) >> USB_USBMODE_SDIS_SHIFT)
1647 
1648 /*
1649  * SLOM (RW)
1650  *
1651  * SLOM
1652  * Setup Lockout Mode. In device mode, this bit controls behavior of the setup lock mechanism. See Control Endpoint Operation Model .
1653  * 0 - Setup Lockouts On (default);
1654  * 1 - Setup Lockouts Off. DCD requires use of Setup Data Buffer Tripwire in USBCMD.
1655  */
1656 #define USB_USBMODE_SLOM_MASK (0x8U)
1657 #define USB_USBMODE_SLOM_SHIFT (3U)
1658 #define USB_USBMODE_SLOM_SET(x) (((uint32_t)(x) << USB_USBMODE_SLOM_SHIFT) & USB_USBMODE_SLOM_MASK)
1659 #define USB_USBMODE_SLOM_GET(x) (((uint32_t)(x) & USB_USBMODE_SLOM_MASK) >> USB_USBMODE_SLOM_SHIFT)
1660 
1661 /*
1662  * ES (RW)
1663  *
1664  * ES
1665  * Endian Select - Read/Write. This bit can change the byte alignment of the transfer buffers to match the
1666  * host microprocessor. The bit fields in the microprocessor interface and the data structures are unaffected
1667  * by the value of this bit because they are based upon the 32-bit word.
1668  * Bit Meaning
1669  * 0 - Little Endian [Default]
1670  * 1 - Big Endian
1671  */
1672 #define USB_USBMODE_ES_MASK (0x4U)
1673 #define USB_USBMODE_ES_SHIFT (2U)
1674 #define USB_USBMODE_ES_SET(x) (((uint32_t)(x) << USB_USBMODE_ES_SHIFT) & USB_USBMODE_ES_MASK)
1675 #define USB_USBMODE_ES_GET(x) (((uint32_t)(x) & USB_USBMODE_ES_MASK) >> USB_USBMODE_ES_SHIFT)
1676 
1677 /*
1678  * CM (RW)
1679  *
1680  * CM
1681  * Controller Mode - R/WO. Controller mode is defaulted to the proper mode for host only and device only
1682  * implementations. For those designs that contain both host & device capability, the controller defaults to
1683  * an idle state and needs to be initialized to the desired operating mode after reset. For combination host/
1684  * device controllers, this register can only be written once after reset. If it is necessary to switch modes,
1685  * software must reset the controller by writing to the RESET bit in the USBCMD register before
1686  * reprogramming this register.
1687  * For OTG controller core, reset value is '00b'.
1688  * 00 - Idle [Default for combination host/device]
1689  * 01 - Reserved
1690  * 10 - Device Controller [Default for device only controller]
1691  * 11 - Host Controller [Default for host only controller]
1692  */
1693 #define USB_USBMODE_CM_MASK (0x3U)
1694 #define USB_USBMODE_CM_SHIFT (0U)
1695 #define USB_USBMODE_CM_SET(x) (((uint32_t)(x) << USB_USBMODE_CM_SHIFT) & USB_USBMODE_CM_MASK)
1696 #define USB_USBMODE_CM_GET(x) (((uint32_t)(x) & USB_USBMODE_CM_MASK) >> USB_USBMODE_CM_SHIFT)
1697 
1698 /* Bitfield definition for register: ENDPTSETUPSTAT */
1699 /*
1700  * ENDPTSETUPSTAT (RWC)
1701  *
1702  * ENDPTSETUPSTAT
1703  * Setup Endpoint Status. For every setup transaction that is received, a corresponding bit in this register is set to one.
1704  * Software must clear or acknowledge the setup transfer by writing a one to a respective bit after it has read the setup data from Queue head.
1705  * The response to a setup packet as in the order of operations and total response time is crucial to limit bus time outs while the setup lock out mechanism is engaged.
1706  * This register is only used in device mode.
1707  */
1708 #define USB_ENDPTSETUPSTAT_ENDPTSETUPSTAT_MASK (0xFFFFU)
1709 #define USB_ENDPTSETUPSTAT_ENDPTSETUPSTAT_SHIFT (0U)
1710 #define USB_ENDPTSETUPSTAT_ENDPTSETUPSTAT_SET(x) (((uint32_t)(x) << USB_ENDPTSETUPSTAT_ENDPTSETUPSTAT_SHIFT) & USB_ENDPTSETUPSTAT_ENDPTSETUPSTAT_MASK)
1711 #define USB_ENDPTSETUPSTAT_ENDPTSETUPSTAT_GET(x) (((uint32_t)(x) & USB_ENDPTSETUPSTAT_ENDPTSETUPSTAT_MASK) >> USB_ENDPTSETUPSTAT_ENDPTSETUPSTAT_SHIFT)
1712 
1713 /* Bitfield definition for register: ENDPTPRIME */
1714 /*
1715  * PETB (RWS)
1716  *
1717  * PETB
1718  * Prime Endpoint Transmit Buffer - R/WS. For each endpoint a corresponding bit is used to request that a
1719  * buffer is prepared for a transmit operation in order to respond to a USB IN/INTERRUPT transaction.
1720  * Software should write a one to the corresponding bit when posting a new transfer descriptor to an
1721  * endpoint queue head. Hardware automatically uses this bit to begin parsing for a new transfer descriptor
1722  * from the queue head and prepare a transmit buffer. Hardware clears this bit when the associated
1723  * endpoint(s) is (are) successfully primed.
1724  * NOTE: These bits are momentarily set by hardware during hardware re-priming operations when a dTD
1725  * is retired, and the dQH is updated.
1726  * PETB[N] - Endpoint #N, N is in 0..7
1727  */
1728 #define USB_ENDPTPRIME_PETB_MASK (0xFFFF0000UL)
1729 #define USB_ENDPTPRIME_PETB_SHIFT (16U)
1730 #define USB_ENDPTPRIME_PETB_SET(x) (((uint32_t)(x) << USB_ENDPTPRIME_PETB_SHIFT) & USB_ENDPTPRIME_PETB_MASK)
1731 #define USB_ENDPTPRIME_PETB_GET(x) (((uint32_t)(x) & USB_ENDPTPRIME_PETB_MASK) >> USB_ENDPTPRIME_PETB_SHIFT)
1732 
1733 /*
1734  * PERB (RWS)
1735  *
1736  * PERB
1737  * Prime Endpoint Receive Buffer - R/WS. For each endpoint, a corresponding bit is used to request a buffer prepare for a receive operation for when a USB host initiates a USB OUT transaction.
1738  * Software should write a one to the corresponding bit whenever posting a new transfer descriptor to an endpoint queue head.
1739  * Hardware automatically uses this bit to begin parsing for a new transfer descriptor from the queue head and prepare a receive buffer.
1740  * Hardware clears this bit when the associated endpoint(s) is (are) successfully primed.
1741  * NOTE: These bits are momentarily set by hardware during hardware re-priming operations when a dTD
1742  * is retired, and the dQH is updated.
1743  * PERB[N] - Endpoint #N, N is in 0..7
1744  */
1745 #define USB_ENDPTPRIME_PERB_MASK (0xFFFFU)
1746 #define USB_ENDPTPRIME_PERB_SHIFT (0U)
1747 #define USB_ENDPTPRIME_PERB_SET(x) (((uint32_t)(x) << USB_ENDPTPRIME_PERB_SHIFT) & USB_ENDPTPRIME_PERB_MASK)
1748 #define USB_ENDPTPRIME_PERB_GET(x) (((uint32_t)(x) & USB_ENDPTPRIME_PERB_MASK) >> USB_ENDPTPRIME_PERB_SHIFT)
1749 
1750 /* Bitfield definition for register: ENDPTFLUSH */
1751 /*
1752  * FETB (RWS)
1753  *
1754  * FETB
1755  * Flush Endpoint Transmit Buffer - R/WS. Writing one to a bit(s) in this register causes the associated endpoint(s) to clear any primed buffers.
1756  * If a packet is in progress for one of the associated endpoints, then that transfer continues until completion.
1757  * Hardware clears this register after the endpoint flush operation is successful.
1758  * FETB[N] - Endpoint #N, N is in 0..7
1759  */
1760 #define USB_ENDPTFLUSH_FETB_MASK (0xFFFF0000UL)
1761 #define USB_ENDPTFLUSH_FETB_SHIFT (16U)
1762 #define USB_ENDPTFLUSH_FETB_SET(x) (((uint32_t)(x) << USB_ENDPTFLUSH_FETB_SHIFT) & USB_ENDPTFLUSH_FETB_MASK)
1763 #define USB_ENDPTFLUSH_FETB_GET(x) (((uint32_t)(x) & USB_ENDPTFLUSH_FETB_MASK) >> USB_ENDPTFLUSH_FETB_SHIFT)
1764 
1765 /*
1766  * FERB (RWS)
1767  *
1768  * FERB
1769  * Flush Endpoint Receive Buffer - R/WS. Writing one to a bit(s) causes the associated endpoint(s) to clear any primed buffers.
1770  *  If a packet is in progress for one of the associated endpoints, then that transfer continues until completion.
1771  * Hardware clears this register after the endpoint flush operation is successful.
1772  * FERB[N] - Endpoint #N, N is in 0..7
1773  */
1774 #define USB_ENDPTFLUSH_FERB_MASK (0xFFFFU)
1775 #define USB_ENDPTFLUSH_FERB_SHIFT (0U)
1776 #define USB_ENDPTFLUSH_FERB_SET(x) (((uint32_t)(x) << USB_ENDPTFLUSH_FERB_SHIFT) & USB_ENDPTFLUSH_FERB_MASK)
1777 #define USB_ENDPTFLUSH_FERB_GET(x) (((uint32_t)(x) & USB_ENDPTFLUSH_FERB_MASK) >> USB_ENDPTFLUSH_FERB_SHIFT)
1778 
1779 /* Bitfield definition for register: ENDPTSTAT */
1780 /*
1781  * ETBR (RO)
1782  *
1783  * ETBR
1784  * Endpoint Transmit Buffer Ready -- Read Only. One bit for each endpoint indicates status of the respective endpoint buffer.
1785  * This bit is set to one by the hardware as a response to receiving a command from a corresponding bit in the ENDPTPRIME register.
1786  * There is always a delay between setting a bit in the ENDPTPRIME register and endpoint indicating ready.
1787  * This delay time varies based upon the current USB traffic and the number of bits set in the ENDPRIME register.
1788  * Buffer ready is cleared by USB reset, by the USB DMA system, or through the ENDPTFLUSH register.
1789  * NOTE: These bits are momentarily cleared by hardware during hardware endpoint re-priming operations when a dTD is retired, and the dQH is updated.
1790  * ETBR[N] - Endpoint #N, N is in 0..7
1791  */
1792 #define USB_ENDPTSTAT_ETBR_MASK (0xFFFF0000UL)
1793 #define USB_ENDPTSTAT_ETBR_SHIFT (16U)
1794 #define USB_ENDPTSTAT_ETBR_GET(x) (((uint32_t)(x) & USB_ENDPTSTAT_ETBR_MASK) >> USB_ENDPTSTAT_ETBR_SHIFT)
1795 
1796 /*
1797  * ERBR (RO)
1798  *
1799  * ERBR
1800  * Endpoint Receive Buffer Ready -- Read Only. One bit for each endpoint indicates status of the respective
1801  * endpoint buffer. This bit is set to a one by the hardware as a response to receiving a command from a
1802  * corresponding bit in the ENDPRIME register. There is always a delay between setting a bit in the
1803  * ENDPRIME register and endpoint indicating ready. This delay time varies based upon the current USB
1804  * traffic and the number of bits set in the ENDPRIME register. Buffer ready is cleared by USB reset, by the
1805  * USB DMA system, or through the ENDPTFLUSH register.
1806  * NOTE: These bits are momentarily cleared by hardware during hardware endpoint re-priming operations
1807  * when a dTD is retired, and the dQH is updated.
1808  * ERBR[N] - Endpoint #N, N is in 0..7
1809  */
1810 #define USB_ENDPTSTAT_ERBR_MASK (0xFFFFU)
1811 #define USB_ENDPTSTAT_ERBR_SHIFT (0U)
1812 #define USB_ENDPTSTAT_ERBR_GET(x) (((uint32_t)(x) & USB_ENDPTSTAT_ERBR_MASK) >> USB_ENDPTSTAT_ERBR_SHIFT)
1813 
1814 /* Bitfield definition for register: ENDPTCOMPLETE */
1815 /*
1816  * ETCE (RWC)
1817  *
1818  * ETCE
1819  * Endpoint Transmit Complete Event - R/WC. Each bit indicates a transmit event (IN/INTERRUPT) occurred and software should read the corresponding endpoint queue to determine the endpoint status.
1820  * If the corresponding IOC bit is set in the Transfer Descriptor, then this bit is set simultaneously with the USBINT . Writing one clears the corresponding bit in this register.
1821  * ETCE[N] - Endpoint #N, N is in 0..7
1822  */
1823 #define USB_ENDPTCOMPLETE_ETCE_MASK (0xFFFF0000UL)
1824 #define USB_ENDPTCOMPLETE_ETCE_SHIFT (16U)
1825 #define USB_ENDPTCOMPLETE_ETCE_SET(x) (((uint32_t)(x) << USB_ENDPTCOMPLETE_ETCE_SHIFT) & USB_ENDPTCOMPLETE_ETCE_MASK)
1826 #define USB_ENDPTCOMPLETE_ETCE_GET(x) (((uint32_t)(x) & USB_ENDPTCOMPLETE_ETCE_MASK) >> USB_ENDPTCOMPLETE_ETCE_SHIFT)
1827 
1828 /*
1829  * ERCE (RWC)
1830  *
1831  * ERCE
1832  * Endpoint Receive Complete Event - RW/C. Each bit indicates a received event (OUT/SETUP) occurred
1833  * and software should read the corresponding endpoint queue to determine the transfer status. If the
1834  * corresponding IOC bit is set in the Transfer Descriptor, then this bit is set simultaneously with the
1835  * USBINT . Writing one clears the corresponding bit in this register.
1836  * ERCE[N] - Endpoint #N, N is in 0..7
1837  */
1838 #define USB_ENDPTCOMPLETE_ERCE_MASK (0xFFFFU)
1839 #define USB_ENDPTCOMPLETE_ERCE_SHIFT (0U)
1840 #define USB_ENDPTCOMPLETE_ERCE_SET(x) (((uint32_t)(x) << USB_ENDPTCOMPLETE_ERCE_SHIFT) & USB_ENDPTCOMPLETE_ERCE_MASK)
1841 #define USB_ENDPTCOMPLETE_ERCE_GET(x) (((uint32_t)(x) & USB_ENDPTCOMPLETE_ERCE_MASK) >> USB_ENDPTCOMPLETE_ERCE_SHIFT)
1842 
1843 /* Bitfield definition for register array: ENDPTCTRL */
1844 /*
1845  * TXE (RW)
1846  *
1847  * TXE
1848  * TX Endpoint Enable
1849  * 0 Disabled [Default]
1850  * 1 Enabled
1851  * An Endpoint should be enabled only after it has been configured.
1852  */
1853 #define USB_ENDPTCTRL_TXE_MASK (0x800000UL)
1854 #define USB_ENDPTCTRL_TXE_SHIFT (23U)
1855 #define USB_ENDPTCTRL_TXE_SET(x) (((uint32_t)(x) << USB_ENDPTCTRL_TXE_SHIFT) & USB_ENDPTCTRL_TXE_MASK)
1856 #define USB_ENDPTCTRL_TXE_GET(x) (((uint32_t)(x) & USB_ENDPTCTRL_TXE_MASK) >> USB_ENDPTCTRL_TXE_SHIFT)
1857 
1858 /*
1859  * TXR (WS)
1860  *
1861  * TXR
1862  * TX Data Toggle Reset (WS)
1863  * Write 1 - Reset PID Sequence
1864  * Whenever a configuration event is received for this Endpoint, software must write a one to this bit in order
1865  * to synchronize the data PID's between the Host and device.
1866  */
1867 #define USB_ENDPTCTRL_TXR_MASK (0x400000UL)
1868 #define USB_ENDPTCTRL_TXR_SHIFT (22U)
1869 #define USB_ENDPTCTRL_TXR_SET(x) (((uint32_t)(x) << USB_ENDPTCTRL_TXR_SHIFT) & USB_ENDPTCTRL_TXR_MASK)
1870 #define USB_ENDPTCTRL_TXR_GET(x) (((uint32_t)(x) & USB_ENDPTCTRL_TXR_MASK) >> USB_ENDPTCTRL_TXR_SHIFT)
1871 
1872 /*
1873  * TXT (RW)
1874  *
1875  * TXT
1876  * TX Endpoint Type - Read/Write
1877  * 00 Control
1878  * 01 Isochronous
1879  * 10 Bulk
1880  * 11 Interrupt
1881  */
1882 #define USB_ENDPTCTRL_TXT_MASK (0xC0000UL)
1883 #define USB_ENDPTCTRL_TXT_SHIFT (18U)
1884 #define USB_ENDPTCTRL_TXT_SET(x) (((uint32_t)(x) << USB_ENDPTCTRL_TXT_SHIFT) & USB_ENDPTCTRL_TXT_MASK)
1885 #define USB_ENDPTCTRL_TXT_GET(x) (((uint32_t)(x) & USB_ENDPTCTRL_TXT_MASK) >> USB_ENDPTCTRL_TXT_SHIFT)
1886 
1887 /*
1888  * TXS (RW)
1889  *
1890  * TXS
1891  * TX Endpoint Stall - Read/Write
1892  * 0 End Point OK
1893  * 1 End Point Stalled
1894  * This bit will be cleared automatically upon receipt of a SETUP request if this Endpoint is configured
1895  * as a Control Endpoint and this bit will continue to be cleared by hardware until the associated ENDPTSETUPSTAT bit is cleared.
1896  * Software can write a one to this bit to force the endpoint to return a STALL handshake to the Host.
1897  * This control will continue to STALL until this bit is either cleared by software or automatically cleared as above for control endpoints.
1898  * NOTE: [CONTROL ENDPOINT TYPES ONLY]: there is a slight delay (50 clocks max) between the ENDPTSETUPSTAT begin cleared and hardware continuing to clear this bit.
1899  * In most systems, it is unlikely the DCD software will observe this delay. However, should the DCD observe that the stall bit is not set after writing a one to it then follow this procedure:
1900  * continually write this stall bit until it is set or until a new setup has been received by checking the associated endptsetupstat Bit.
1901  */
1902 #define USB_ENDPTCTRL_TXS_MASK (0x10000UL)
1903 #define USB_ENDPTCTRL_TXS_SHIFT (16U)
1904 #define USB_ENDPTCTRL_TXS_SET(x) (((uint32_t)(x) << USB_ENDPTCTRL_TXS_SHIFT) & USB_ENDPTCTRL_TXS_MASK)
1905 #define USB_ENDPTCTRL_TXS_GET(x) (((uint32_t)(x) & USB_ENDPTCTRL_TXS_MASK) >> USB_ENDPTCTRL_TXS_SHIFT)
1906 
1907 /*
1908  * RXE (RW)
1909  *
1910  * RXE
1911  * RX Endpoint Enable
1912  * 0 Disabled [Default]
1913  * 1 Enabled
1914  * An Endpoint should be enabled only after it has been configured.
1915  */
1916 #define USB_ENDPTCTRL_RXE_MASK (0x80U)
1917 #define USB_ENDPTCTRL_RXE_SHIFT (7U)
1918 #define USB_ENDPTCTRL_RXE_SET(x) (((uint32_t)(x) << USB_ENDPTCTRL_RXE_SHIFT) & USB_ENDPTCTRL_RXE_MASK)
1919 #define USB_ENDPTCTRL_RXE_GET(x) (((uint32_t)(x) & USB_ENDPTCTRL_RXE_MASK) >> USB_ENDPTCTRL_RXE_SHIFT)
1920 
1921 /*
1922  * RXR (WS)
1923  *
1924  * RXR
1925  * RX Data Toggle Reset (WS)
1926  * Write 1 - Reset PID Sequence
1927  * Whenever a configuration event is received for this Endpoint, software must write a one to this bit in order
1928  * to synchronize the data PID's between the host and device.
1929  */
1930 #define USB_ENDPTCTRL_RXR_MASK (0x40U)
1931 #define USB_ENDPTCTRL_RXR_SHIFT (6U)
1932 #define USB_ENDPTCTRL_RXR_SET(x) (((uint32_t)(x) << USB_ENDPTCTRL_RXR_SHIFT) & USB_ENDPTCTRL_RXR_MASK)
1933 #define USB_ENDPTCTRL_RXR_GET(x) (((uint32_t)(x) & USB_ENDPTCTRL_RXR_MASK) >> USB_ENDPTCTRL_RXR_SHIFT)
1934 
1935 /*
1936  * RXT (RW)
1937  *
1938  * RXT
1939  * RX Endpoint Type - Read/Write
1940  * 00 Control
1941  * 01 Isochronous
1942  * 10 Bulk
1943  * 11 Interrupt
1944  */
1945 #define USB_ENDPTCTRL_RXT_MASK (0xCU)
1946 #define USB_ENDPTCTRL_RXT_SHIFT (2U)
1947 #define USB_ENDPTCTRL_RXT_SET(x) (((uint32_t)(x) << USB_ENDPTCTRL_RXT_SHIFT) & USB_ENDPTCTRL_RXT_MASK)
1948 #define USB_ENDPTCTRL_RXT_GET(x) (((uint32_t)(x) & USB_ENDPTCTRL_RXT_MASK) >> USB_ENDPTCTRL_RXT_SHIFT)
1949 
1950 /*
1951  * RXS (RW)
1952  *
1953  * RXS
1954  * RX Endpoint Stall - Read/Write
1955  * 0 End Point OK. [Default]
1956  * 1 End Point Stalled
1957  * This bit is set automatically upon receipt of a SETUP request if this Endpoint is configured as a Control
1958  * Endpointand this bit will continue to be cleared by hardware until the associated ENDPTSETUPSTAT bit
1959  * is cleared.
1960  * Software can write a one to this bit to force the endpoint to return a STALL handshake to the Host. This
1961  * control will continue to STALL until this bit is either cleared by software or automatically cleared as above
1962  * for control endpoints.
1963  * NOTE: [CONTROL ENDPOINT TYPES ONLY]: there is a slight delay (50 clocks max) between the
1964  * ENDPTSETUPSTAT begin cleared and hardware continuing to clear this bit. In most systems, it
1965  * is unlikely the DCD software will observe this delay. However, should the DCD observe that the
1966  * stall bit is not set after writing a one to it then follow this procedure: continually write this stall bit
1967  * until it is set or until a new setup has been received by checking the associated endptsetupstat
1968  * Bit.
1969  */
1970 #define USB_ENDPTCTRL_RXS_MASK (0x1U)
1971 #define USB_ENDPTCTRL_RXS_SHIFT (0U)
1972 #define USB_ENDPTCTRL_RXS_SET(x) (((uint32_t)(x) << USB_ENDPTCTRL_RXS_SHIFT) & USB_ENDPTCTRL_RXS_MASK)
1973 #define USB_ENDPTCTRL_RXS_GET(x) (((uint32_t)(x) & USB_ENDPTCTRL_RXS_MASK) >> USB_ENDPTCTRL_RXS_SHIFT)
1974 
1975 /* Bitfield definition for register: OTG_CTRL0 */
1976 /*
1977  * OTG_WKDPDMCHG_EN (RW)
1978  *
1979  */
1980 #define USB_OTG_CTRL0_OTG_WKDPDMCHG_EN_MASK (0x2000000UL)
1981 #define USB_OTG_CTRL0_OTG_WKDPDMCHG_EN_SHIFT (25U)
1982 #define USB_OTG_CTRL0_OTG_WKDPDMCHG_EN_SET(x) (((uint32_t)(x) << USB_OTG_CTRL0_OTG_WKDPDMCHG_EN_SHIFT) & USB_OTG_CTRL0_OTG_WKDPDMCHG_EN_MASK)
1983 #define USB_OTG_CTRL0_OTG_WKDPDMCHG_EN_GET(x) (((uint32_t)(x) & USB_OTG_CTRL0_OTG_WKDPDMCHG_EN_MASK) >> USB_OTG_CTRL0_OTG_WKDPDMCHG_EN_SHIFT)
1984 
1985 /*
1986  * AUTORESUME_EN (RW)
1987  *
1988  */
1989 #define USB_OTG_CTRL0_AUTORESUME_EN_MASK (0x80000UL)
1990 #define USB_OTG_CTRL0_AUTORESUME_EN_SHIFT (19U)
1991 #define USB_OTG_CTRL0_AUTORESUME_EN_SET(x) (((uint32_t)(x) << USB_OTG_CTRL0_AUTORESUME_EN_SHIFT) & USB_OTG_CTRL0_AUTORESUME_EN_MASK)
1992 #define USB_OTG_CTRL0_AUTORESUME_EN_GET(x) (((uint32_t)(x) & USB_OTG_CTRL0_AUTORESUME_EN_MASK) >> USB_OTG_CTRL0_AUTORESUME_EN_SHIFT)
1993 
1994 /*
1995  * OTG_VBUS_WAKEUP_EN (RW)
1996  *
1997  */
1998 #define USB_OTG_CTRL0_OTG_VBUS_WAKEUP_EN_MASK (0x20000UL)
1999 #define USB_OTG_CTRL0_OTG_VBUS_WAKEUP_EN_SHIFT (17U)
2000 #define USB_OTG_CTRL0_OTG_VBUS_WAKEUP_EN_SET(x) (((uint32_t)(x) << USB_OTG_CTRL0_OTG_VBUS_WAKEUP_EN_SHIFT) & USB_OTG_CTRL0_OTG_VBUS_WAKEUP_EN_MASK)
2001 #define USB_OTG_CTRL0_OTG_VBUS_WAKEUP_EN_GET(x) (((uint32_t)(x) & USB_OTG_CTRL0_OTG_VBUS_WAKEUP_EN_MASK) >> USB_OTG_CTRL0_OTG_VBUS_WAKEUP_EN_SHIFT)
2002 
2003 /*
2004  * OTG_ID_WAKEUP_EN (RW)
2005  *
2006  */
2007 #define USB_OTG_CTRL0_OTG_ID_WAKEUP_EN_MASK (0x10000UL)
2008 #define USB_OTG_CTRL0_OTG_ID_WAKEUP_EN_SHIFT (16U)
2009 #define USB_OTG_CTRL0_OTG_ID_WAKEUP_EN_SET(x) (((uint32_t)(x) << USB_OTG_CTRL0_OTG_ID_WAKEUP_EN_SHIFT) & USB_OTG_CTRL0_OTG_ID_WAKEUP_EN_MASK)
2010 #define USB_OTG_CTRL0_OTG_ID_WAKEUP_EN_GET(x) (((uint32_t)(x) & USB_OTG_CTRL0_OTG_ID_WAKEUP_EN_MASK) >> USB_OTG_CTRL0_OTG_ID_WAKEUP_EN_SHIFT)
2011 
2012 /*
2013  * OTG_VBUS_SOURCE_SEL (RW)
2014  *
2015  */
2016 #define USB_OTG_CTRL0_OTG_VBUS_SOURCE_SEL_MASK (0x2000U)
2017 #define USB_OTG_CTRL0_OTG_VBUS_SOURCE_SEL_SHIFT (13U)
2018 #define USB_OTG_CTRL0_OTG_VBUS_SOURCE_SEL_SET(x) (((uint32_t)(x) << USB_OTG_CTRL0_OTG_VBUS_SOURCE_SEL_SHIFT) & USB_OTG_CTRL0_OTG_VBUS_SOURCE_SEL_MASK)
2019 #define USB_OTG_CTRL0_OTG_VBUS_SOURCE_SEL_GET(x) (((uint32_t)(x) & USB_OTG_CTRL0_OTG_VBUS_SOURCE_SEL_MASK) >> USB_OTG_CTRL0_OTG_VBUS_SOURCE_SEL_SHIFT)
2020 
2021 /*
2022  * OTG_UTMI_SUSPENDM_SW (RW)
2023  *
2024  * default 0 for naneng usbphy
2025  */
2026 #define USB_OTG_CTRL0_OTG_UTMI_SUSPENDM_SW_MASK (0x1000U)
2027 #define USB_OTG_CTRL0_OTG_UTMI_SUSPENDM_SW_SHIFT (12U)
2028 #define USB_OTG_CTRL0_OTG_UTMI_SUSPENDM_SW_SET(x) (((uint32_t)(x) << USB_OTG_CTRL0_OTG_UTMI_SUSPENDM_SW_SHIFT) & USB_OTG_CTRL0_OTG_UTMI_SUSPENDM_SW_MASK)
2029 #define USB_OTG_CTRL0_OTG_UTMI_SUSPENDM_SW_GET(x) (((uint32_t)(x) & USB_OTG_CTRL0_OTG_UTMI_SUSPENDM_SW_MASK) >> USB_OTG_CTRL0_OTG_UTMI_SUSPENDM_SW_SHIFT)
2030 
2031 /*
2032  * OTG_UTMI_RESET_SW (RW)
2033  *
2034  * default 1 for naneng usbphy
2035  */
2036 #define USB_OTG_CTRL0_OTG_UTMI_RESET_SW_MASK (0x800U)
2037 #define USB_OTG_CTRL0_OTG_UTMI_RESET_SW_SHIFT (11U)
2038 #define USB_OTG_CTRL0_OTG_UTMI_RESET_SW_SET(x) (((uint32_t)(x) << USB_OTG_CTRL0_OTG_UTMI_RESET_SW_SHIFT) & USB_OTG_CTRL0_OTG_UTMI_RESET_SW_MASK)
2039 #define USB_OTG_CTRL0_OTG_UTMI_RESET_SW_GET(x) (((uint32_t)(x) & USB_OTG_CTRL0_OTG_UTMI_RESET_SW_MASK) >> USB_OTG_CTRL0_OTG_UTMI_RESET_SW_SHIFT)
2040 
2041 /*
2042  * OTG_WAKEUP_INT_ENABLE (RW)
2043  *
2044  */
2045 #define USB_OTG_CTRL0_OTG_WAKEUP_INT_ENABLE_MASK (0x400U)
2046 #define USB_OTG_CTRL0_OTG_WAKEUP_INT_ENABLE_SHIFT (10U)
2047 #define USB_OTG_CTRL0_OTG_WAKEUP_INT_ENABLE_SET(x) (((uint32_t)(x) << USB_OTG_CTRL0_OTG_WAKEUP_INT_ENABLE_SHIFT) & USB_OTG_CTRL0_OTG_WAKEUP_INT_ENABLE_MASK)
2048 #define USB_OTG_CTRL0_OTG_WAKEUP_INT_ENABLE_GET(x) (((uint32_t)(x) & USB_OTG_CTRL0_OTG_WAKEUP_INT_ENABLE_MASK) >> USB_OTG_CTRL0_OTG_WAKEUP_INT_ENABLE_SHIFT)
2049 
2050 /*
2051  * OTG_POWER_MASK (RW)
2052  *
2053  */
2054 #define USB_OTG_CTRL0_OTG_POWER_MASK_MASK (0x200U)
2055 #define USB_OTG_CTRL0_OTG_POWER_MASK_SHIFT (9U)
2056 #define USB_OTG_CTRL0_OTG_POWER_MASK_SET(x) (((uint32_t)(x) << USB_OTG_CTRL0_OTG_POWER_MASK_SHIFT) & USB_OTG_CTRL0_OTG_POWER_MASK_MASK)
2057 #define USB_OTG_CTRL0_OTG_POWER_MASK_GET(x) (((uint32_t)(x) & USB_OTG_CTRL0_OTG_POWER_MASK_MASK) >> USB_OTG_CTRL0_OTG_POWER_MASK_SHIFT)
2058 
2059 /*
2060  * OTG_OVER_CUR_POL (RW)
2061  *
2062  */
2063 #define USB_OTG_CTRL0_OTG_OVER_CUR_POL_MASK (0x100U)
2064 #define USB_OTG_CTRL0_OTG_OVER_CUR_POL_SHIFT (8U)
2065 #define USB_OTG_CTRL0_OTG_OVER_CUR_POL_SET(x) (((uint32_t)(x) << USB_OTG_CTRL0_OTG_OVER_CUR_POL_SHIFT) & USB_OTG_CTRL0_OTG_OVER_CUR_POL_MASK)
2066 #define USB_OTG_CTRL0_OTG_OVER_CUR_POL_GET(x) (((uint32_t)(x) & USB_OTG_CTRL0_OTG_OVER_CUR_POL_MASK) >> USB_OTG_CTRL0_OTG_OVER_CUR_POL_SHIFT)
2067 
2068 /*
2069  * OTG_OVER_CUR_DIS (RW)
2070  *
2071  */
2072 #define USB_OTG_CTRL0_OTG_OVER_CUR_DIS_MASK (0x80U)
2073 #define USB_OTG_CTRL0_OTG_OVER_CUR_DIS_SHIFT (7U)
2074 #define USB_OTG_CTRL0_OTG_OVER_CUR_DIS_SET(x) (((uint32_t)(x) << USB_OTG_CTRL0_OTG_OVER_CUR_DIS_SHIFT) & USB_OTG_CTRL0_OTG_OVER_CUR_DIS_MASK)
2075 #define USB_OTG_CTRL0_OTG_OVER_CUR_DIS_GET(x) (((uint32_t)(x) & USB_OTG_CTRL0_OTG_OVER_CUR_DIS_MASK) >> USB_OTG_CTRL0_OTG_OVER_CUR_DIS_SHIFT)
2076 
2077 /*
2078  * SER_MODE_SUSPEND_EN (RW)
2079  *
2080  * for naneng usbphy, only switch to serial mode when suspend
2081  */
2082 #define USB_OTG_CTRL0_SER_MODE_SUSPEND_EN_MASK (0x10U)
2083 #define USB_OTG_CTRL0_SER_MODE_SUSPEND_EN_SHIFT (4U)
2084 #define USB_OTG_CTRL0_SER_MODE_SUSPEND_EN_SET(x) (((uint32_t)(x) << USB_OTG_CTRL0_SER_MODE_SUSPEND_EN_SHIFT) & USB_OTG_CTRL0_SER_MODE_SUSPEND_EN_MASK)
2085 #define USB_OTG_CTRL0_SER_MODE_SUSPEND_EN_GET(x) (((uint32_t)(x) & USB_OTG_CTRL0_SER_MODE_SUSPEND_EN_MASK) >> USB_OTG_CTRL0_SER_MODE_SUSPEND_EN_SHIFT)
2086 
2087 /* Bitfield definition for register: PHY_CTRL0 */
2088 /*
2089  * GPIO_ID_SEL_N (RW)
2090  *
2091  */
2092 #define USB_PHY_CTRL0_GPIO_ID_SEL_N_MASK (0x2000000UL)
2093 #define USB_PHY_CTRL0_GPIO_ID_SEL_N_SHIFT (25U)
2094 #define USB_PHY_CTRL0_GPIO_ID_SEL_N_SET(x) (((uint32_t)(x) << USB_PHY_CTRL0_GPIO_ID_SEL_N_SHIFT) & USB_PHY_CTRL0_GPIO_ID_SEL_N_MASK)
2095 #define USB_PHY_CTRL0_GPIO_ID_SEL_N_GET(x) (((uint32_t)(x) & USB_PHY_CTRL0_GPIO_ID_SEL_N_MASK) >> USB_PHY_CTRL0_GPIO_ID_SEL_N_SHIFT)
2096 
2097 /*
2098  * ID_DIG_OVERRIDE (RW)
2099  *
2100  */
2101 #define USB_PHY_CTRL0_ID_DIG_OVERRIDE_MASK (0x4000U)
2102 #define USB_PHY_CTRL0_ID_DIG_OVERRIDE_SHIFT (14U)
2103 #define USB_PHY_CTRL0_ID_DIG_OVERRIDE_SET(x) (((uint32_t)(x) << USB_PHY_CTRL0_ID_DIG_OVERRIDE_SHIFT) & USB_PHY_CTRL0_ID_DIG_OVERRIDE_MASK)
2104 #define USB_PHY_CTRL0_ID_DIG_OVERRIDE_GET(x) (((uint32_t)(x) & USB_PHY_CTRL0_ID_DIG_OVERRIDE_MASK) >> USB_PHY_CTRL0_ID_DIG_OVERRIDE_SHIFT)
2105 
2106 /*
2107  * SESS_VALID_OVERRIDE (RW)
2108  *
2109  */
2110 #define USB_PHY_CTRL0_SESS_VALID_OVERRIDE_MASK (0x2000U)
2111 #define USB_PHY_CTRL0_SESS_VALID_OVERRIDE_SHIFT (13U)
2112 #define USB_PHY_CTRL0_SESS_VALID_OVERRIDE_SET(x) (((uint32_t)(x) << USB_PHY_CTRL0_SESS_VALID_OVERRIDE_SHIFT) & USB_PHY_CTRL0_SESS_VALID_OVERRIDE_MASK)
2113 #define USB_PHY_CTRL0_SESS_VALID_OVERRIDE_GET(x) (((uint32_t)(x) & USB_PHY_CTRL0_SESS_VALID_OVERRIDE_MASK) >> USB_PHY_CTRL0_SESS_VALID_OVERRIDE_SHIFT)
2114 
2115 /*
2116  * VBUS_VALID_OVERRIDE (RW)
2117  *
2118  */
2119 #define USB_PHY_CTRL0_VBUS_VALID_OVERRIDE_MASK (0x1000U)
2120 #define USB_PHY_CTRL0_VBUS_VALID_OVERRIDE_SHIFT (12U)
2121 #define USB_PHY_CTRL0_VBUS_VALID_OVERRIDE_SET(x) (((uint32_t)(x) << USB_PHY_CTRL0_VBUS_VALID_OVERRIDE_SHIFT) & USB_PHY_CTRL0_VBUS_VALID_OVERRIDE_MASK)
2122 #define USB_PHY_CTRL0_VBUS_VALID_OVERRIDE_GET(x) (((uint32_t)(x) & USB_PHY_CTRL0_VBUS_VALID_OVERRIDE_MASK) >> USB_PHY_CTRL0_VBUS_VALID_OVERRIDE_SHIFT)
2123 
2124 /*
2125  * ID_DIG_OVERRIDE_EN (RW)
2126  *
2127  */
2128 #define USB_PHY_CTRL0_ID_DIG_OVERRIDE_EN_MASK (0x4U)
2129 #define USB_PHY_CTRL0_ID_DIG_OVERRIDE_EN_SHIFT (2U)
2130 #define USB_PHY_CTRL0_ID_DIG_OVERRIDE_EN_SET(x) (((uint32_t)(x) << USB_PHY_CTRL0_ID_DIG_OVERRIDE_EN_SHIFT) & USB_PHY_CTRL0_ID_DIG_OVERRIDE_EN_MASK)
2131 #define USB_PHY_CTRL0_ID_DIG_OVERRIDE_EN_GET(x) (((uint32_t)(x) & USB_PHY_CTRL0_ID_DIG_OVERRIDE_EN_MASK) >> USB_PHY_CTRL0_ID_DIG_OVERRIDE_EN_SHIFT)
2132 
2133 /*
2134  * SESS_VALID_OVERRIDE_EN (RW)
2135  *
2136  */
2137 #define USB_PHY_CTRL0_SESS_VALID_OVERRIDE_EN_MASK (0x2U)
2138 #define USB_PHY_CTRL0_SESS_VALID_OVERRIDE_EN_SHIFT (1U)
2139 #define USB_PHY_CTRL0_SESS_VALID_OVERRIDE_EN_SET(x) (((uint32_t)(x) << USB_PHY_CTRL0_SESS_VALID_OVERRIDE_EN_SHIFT) & USB_PHY_CTRL0_SESS_VALID_OVERRIDE_EN_MASK)
2140 #define USB_PHY_CTRL0_SESS_VALID_OVERRIDE_EN_GET(x) (((uint32_t)(x) & USB_PHY_CTRL0_SESS_VALID_OVERRIDE_EN_MASK) >> USB_PHY_CTRL0_SESS_VALID_OVERRIDE_EN_SHIFT)
2141 
2142 /*
2143  * VBUS_VALID_OVERRIDE_EN (RW)
2144  *
2145  */
2146 #define USB_PHY_CTRL0_VBUS_VALID_OVERRIDE_EN_MASK (0x1U)
2147 #define USB_PHY_CTRL0_VBUS_VALID_OVERRIDE_EN_SHIFT (0U)
2148 #define USB_PHY_CTRL0_VBUS_VALID_OVERRIDE_EN_SET(x) (((uint32_t)(x) << USB_PHY_CTRL0_VBUS_VALID_OVERRIDE_EN_SHIFT) & USB_PHY_CTRL0_VBUS_VALID_OVERRIDE_EN_MASK)
2149 #define USB_PHY_CTRL0_VBUS_VALID_OVERRIDE_EN_GET(x) (((uint32_t)(x) & USB_PHY_CTRL0_VBUS_VALID_OVERRIDE_EN_MASK) >> USB_PHY_CTRL0_VBUS_VALID_OVERRIDE_EN_SHIFT)
2150 
2151 /* Bitfield definition for register: PHY_CTRL1 */
2152 /*
2153  * UTMI_CFG_RST_N (RW)
2154  *
2155  */
2156 #define USB_PHY_CTRL1_UTMI_CFG_RST_N_MASK (0x100000UL)
2157 #define USB_PHY_CTRL1_UTMI_CFG_RST_N_SHIFT (20U)
2158 #define USB_PHY_CTRL1_UTMI_CFG_RST_N_SET(x) (((uint32_t)(x) << USB_PHY_CTRL1_UTMI_CFG_RST_N_SHIFT) & USB_PHY_CTRL1_UTMI_CFG_RST_N_MASK)
2159 #define USB_PHY_CTRL1_UTMI_CFG_RST_N_GET(x) (((uint32_t)(x) & USB_PHY_CTRL1_UTMI_CFG_RST_N_MASK) >> USB_PHY_CTRL1_UTMI_CFG_RST_N_SHIFT)
2160 
2161 /*
2162  * UTMI_OTG_SUSPENDM (RW)
2163  *
2164  * OTG suspend, not utmi_suspendm
2165  */
2166 #define USB_PHY_CTRL1_UTMI_OTG_SUSPENDM_MASK (0x2U)
2167 #define USB_PHY_CTRL1_UTMI_OTG_SUSPENDM_SHIFT (1U)
2168 #define USB_PHY_CTRL1_UTMI_OTG_SUSPENDM_SET(x) (((uint32_t)(x) << USB_PHY_CTRL1_UTMI_OTG_SUSPENDM_SHIFT) & USB_PHY_CTRL1_UTMI_OTG_SUSPENDM_MASK)
2169 #define USB_PHY_CTRL1_UTMI_OTG_SUSPENDM_GET(x) (((uint32_t)(x) & USB_PHY_CTRL1_UTMI_OTG_SUSPENDM_MASK) >> USB_PHY_CTRL1_UTMI_OTG_SUSPENDM_SHIFT)
2170 
2171 /* Bitfield definition for register: TOP_STATUS */
2172 /*
2173  * WAKEUP_INT_STATUS (RW)
2174  *
2175  */
2176 #define USB_TOP_STATUS_WAKEUP_INT_STATUS_MASK (0x80000000UL)
2177 #define USB_TOP_STATUS_WAKEUP_INT_STATUS_SHIFT (31U)
2178 #define USB_TOP_STATUS_WAKEUP_INT_STATUS_SET(x) (((uint32_t)(x) << USB_TOP_STATUS_WAKEUP_INT_STATUS_SHIFT) & USB_TOP_STATUS_WAKEUP_INT_STATUS_MASK)
2179 #define USB_TOP_STATUS_WAKEUP_INT_STATUS_GET(x) (((uint32_t)(x) & USB_TOP_STATUS_WAKEUP_INT_STATUS_MASK) >> USB_TOP_STATUS_WAKEUP_INT_STATUS_SHIFT)
2180 
2181 /* Bitfield definition for register: PHY_STATUS */
2182 /*
2183  * UTMI_CLK_VALID (RW)
2184  *
2185  */
2186 #define USB_PHY_STATUS_UTMI_CLK_VALID_MASK (0x80000000UL)
2187 #define USB_PHY_STATUS_UTMI_CLK_VALID_SHIFT (31U)
2188 #define USB_PHY_STATUS_UTMI_CLK_VALID_SET(x) (((uint32_t)(x) << USB_PHY_STATUS_UTMI_CLK_VALID_SHIFT) & USB_PHY_STATUS_UTMI_CLK_VALID_MASK)
2189 #define USB_PHY_STATUS_UTMI_CLK_VALID_GET(x) (((uint32_t)(x) & USB_PHY_STATUS_UTMI_CLK_VALID_MASK) >> USB_PHY_STATUS_UTMI_CLK_VALID_SHIFT)
2190 
2191 /*
2192  * LINE_STATE (RW)
2193  *
2194  */
2195 #define USB_PHY_STATUS_LINE_STATE_MASK (0xC0U)
2196 #define USB_PHY_STATUS_LINE_STATE_SHIFT (6U)
2197 #define USB_PHY_STATUS_LINE_STATE_SET(x) (((uint32_t)(x) << USB_PHY_STATUS_LINE_STATE_SHIFT) & USB_PHY_STATUS_LINE_STATE_MASK)
2198 #define USB_PHY_STATUS_LINE_STATE_GET(x) (((uint32_t)(x) & USB_PHY_STATUS_LINE_STATE_MASK) >> USB_PHY_STATUS_LINE_STATE_SHIFT)
2199 
2200 /*
2201  * HOST_DISCONNECT (RW)
2202  *
2203  */
2204 #define USB_PHY_STATUS_HOST_DISCONNECT_MASK (0x20U)
2205 #define USB_PHY_STATUS_HOST_DISCONNECT_SHIFT (5U)
2206 #define USB_PHY_STATUS_HOST_DISCONNECT_SET(x) (((uint32_t)(x) << USB_PHY_STATUS_HOST_DISCONNECT_SHIFT) & USB_PHY_STATUS_HOST_DISCONNECT_MASK)
2207 #define USB_PHY_STATUS_HOST_DISCONNECT_GET(x) (((uint32_t)(x) & USB_PHY_STATUS_HOST_DISCONNECT_MASK) >> USB_PHY_STATUS_HOST_DISCONNECT_SHIFT)
2208 
2209 /*
2210  * ID_DIG (RW)
2211  *
2212  */
2213 #define USB_PHY_STATUS_ID_DIG_MASK (0x10U)
2214 #define USB_PHY_STATUS_ID_DIG_SHIFT (4U)
2215 #define USB_PHY_STATUS_ID_DIG_SET(x) (((uint32_t)(x) << USB_PHY_STATUS_ID_DIG_SHIFT) & USB_PHY_STATUS_ID_DIG_MASK)
2216 #define USB_PHY_STATUS_ID_DIG_GET(x) (((uint32_t)(x) & USB_PHY_STATUS_ID_DIG_MASK) >> USB_PHY_STATUS_ID_DIG_SHIFT)
2217 
2218 /*
2219  * UTMI_SESS_VALID (RW)
2220  *
2221  */
2222 #define USB_PHY_STATUS_UTMI_SESS_VALID_MASK (0x4U)
2223 #define USB_PHY_STATUS_UTMI_SESS_VALID_SHIFT (2U)
2224 #define USB_PHY_STATUS_UTMI_SESS_VALID_SET(x) (((uint32_t)(x) << USB_PHY_STATUS_UTMI_SESS_VALID_SHIFT) & USB_PHY_STATUS_UTMI_SESS_VALID_MASK)
2225 #define USB_PHY_STATUS_UTMI_SESS_VALID_GET(x) (((uint32_t)(x) & USB_PHY_STATUS_UTMI_SESS_VALID_MASK) >> USB_PHY_STATUS_UTMI_SESS_VALID_SHIFT)
2226 
2227 /*
2228  * VBUS_VALID (RW)
2229  *
2230  */
2231 #define USB_PHY_STATUS_VBUS_VALID_MASK (0x1U)
2232 #define USB_PHY_STATUS_VBUS_VALID_SHIFT (0U)
2233 #define USB_PHY_STATUS_VBUS_VALID_SET(x) (((uint32_t)(x) << USB_PHY_STATUS_VBUS_VALID_SHIFT) & USB_PHY_STATUS_VBUS_VALID_MASK)
2234 #define USB_PHY_STATUS_VBUS_VALID_GET(x) (((uint32_t)(x) & USB_PHY_STATUS_VBUS_VALID_MASK) >> USB_PHY_STATUS_VBUS_VALID_SHIFT)
2235 
2236 
2237 
2238 /* ENDPTCTRL register group index macro definition */
2239 #define USB_ENDPTCTRL_ENDPTCTRL0 (0UL)
2240 #define USB_ENDPTCTRL_ENDPTCTRL1 (1UL)
2241 #define USB_ENDPTCTRL_ENDPTCTRL2 (2UL)
2242 #define USB_ENDPTCTRL_ENDPTCTRL3 (3UL)
2243 #define USB_ENDPTCTRL_ENDPTCTRL4 (4UL)
2244 #define USB_ENDPTCTRL_ENDPTCTRL5 (5UL)
2245 #define USB_ENDPTCTRL_ENDPTCTRL6 (6UL)
2246 #define USB_ENDPTCTRL_ENDPTCTRL7 (7UL)
2247 
2248 
2249 #endif /* HPM_USB_H */
2250