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