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