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