]> git.donarmstrong.com Git - qmk_firmware.git/blob - tool/mbed/mbed-sdk/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_MCU_K64F/device/device/MK64F12/MK64F12_usb.h
Squashed 'tmk_core/' changes from 7967731..b9e0ea0
[qmk_firmware.git] / tool / mbed / mbed-sdk / libraries / mbed / targets / hal / TARGET_Freescale / TARGET_KPSDK_MCUS / TARGET_MCU_K64F / device / device / MK64F12 / MK64F12_usb.h
1 /*
2 ** ###################################################################
3 **     Compilers:           Keil ARM C/C++ Compiler
4 **                          Freescale C/C++ for Embedded ARM
5 **                          GNU C Compiler
6 **                          IAR ANSI C/C++ Compiler for ARM
7 **
8 **     Reference manual:    K64P144M120SF5RM, Rev.2, January 2014
9 **     Version:             rev. 2.5, 2014-02-10
10 **     Build:               b140604
11 **
12 **     Abstract:
13 **         Extension to the CMSIS register access layer header.
14 **
15 **     Copyright (c) 2014 Freescale Semiconductor, Inc.
16 **     All rights reserved.
17 **
18 **     Redistribution and use in source and binary forms, with or without modification,
19 **     are permitted provided that the following conditions are met:
20 **
21 **     o Redistributions of source code must retain the above copyright notice, this list
22 **       of conditions and the following disclaimer.
23 **
24 **     o Redistributions in binary form must reproduce the above copyright notice, this
25 **       list of conditions and the following disclaimer in the documentation and/or
26 **       other materials provided with the distribution.
27 **
28 **     o Neither the name of Freescale Semiconductor, Inc. nor the names of its
29 **       contributors may be used to endorse or promote products derived from this
30 **       software without specific prior written permission.
31 **
32 **     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
33 **     ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
34 **     WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
35 **     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
36 **     ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
37 **     (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
38 **     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
39 **     ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
40 **     (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
41 **     SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42 **
43 **     http:                 www.freescale.com
44 **     mail:                 support@freescale.com
45 **
46 **     Revisions:
47 **     - rev. 1.0 (2013-08-12)
48 **         Initial version.
49 **     - rev. 2.0 (2013-10-29)
50 **         Register accessor macros added to the memory map.
51 **         Symbols for Processor Expert memory map compatibility added to the memory map.
52 **         Startup file for gcc has been updated according to CMSIS 3.2.
53 **         System initialization updated.
54 **         MCG - registers updated.
55 **         PORTA, PORTB, PORTC, PORTE - registers for digital filter removed.
56 **     - rev. 2.1 (2013-10-30)
57 **         Definition of BITBAND macros updated to support peripherals with 32-bit acces disabled.
58 **     - rev. 2.2 (2013-12-09)
59 **         DMA - EARS register removed.
60 **         AIPS0, AIPS1 - MPRA register updated.
61 **     - rev. 2.3 (2014-01-24)
62 **         Update according to reference manual rev. 2
63 **         ENET, MCG, MCM, SIM, USB - registers updated
64 **     - rev. 2.4 (2014-02-10)
65 **         The declaration of clock configurations has been moved to separate header file system_MK64F12.h
66 **         Update of SystemInit() and SystemCoreClockUpdate() functions.
67 **     - rev. 2.5 (2014-02-10)
68 **         The declaration of clock configurations has been moved to separate header file system_MK64F12.h
69 **         Update of SystemInit() and SystemCoreClockUpdate() functions.
70 **         Module access macro module_BASES replaced by module_BASE_PTRS.
71 **
72 ** ###################################################################
73 */
74
75 /*
76  * WARNING! DO NOT EDIT THIS FILE DIRECTLY!
77  *
78  * This file was generated automatically and any changes may be lost.
79  */
80 #ifndef __HW_USB_REGISTERS_H__
81 #define __HW_USB_REGISTERS_H__
82
83 #include "MK64F12.h"
84 #include "fsl_bitaccess.h"
85
86 /*
87  * MK64F12 USB
88  *
89  * Universal Serial Bus, OTG Capable Controller
90  *
91  * Registers defined in this header file:
92  * - HW_USB_PERID - Peripheral ID register
93  * - HW_USB_IDCOMP - Peripheral ID Complement register
94  * - HW_USB_REV - Peripheral Revision register
95  * - HW_USB_ADDINFO - Peripheral Additional Info register
96  * - HW_USB_OTGISTAT - OTG Interrupt Status register
97  * - HW_USB_OTGICR - OTG Interrupt Control register
98  * - HW_USB_OTGSTAT - OTG Status register
99  * - HW_USB_OTGCTL - OTG Control register
100  * - HW_USB_ISTAT - Interrupt Status register
101  * - HW_USB_INTEN - Interrupt Enable register
102  * - HW_USB_ERRSTAT - Error Interrupt Status register
103  * - HW_USB_ERREN - Error Interrupt Enable register
104  * - HW_USB_STAT - Status register
105  * - HW_USB_CTL - Control register
106  * - HW_USB_ADDR - Address register
107  * - HW_USB_BDTPAGE1 - BDT Page register 1
108  * - HW_USB_FRMNUML - Frame Number register Low
109  * - HW_USB_FRMNUMH - Frame Number register High
110  * - HW_USB_TOKEN - Token register
111  * - HW_USB_SOFTHLD - SOF Threshold register
112  * - HW_USB_BDTPAGE2 - BDT Page Register 2
113  * - HW_USB_BDTPAGE3 - BDT Page Register 3
114  * - HW_USB_ENDPTn - Endpoint Control register
115  * - HW_USB_USBCTRL - USB Control register
116  * - HW_USB_OBSERVE - USB OTG Observe register
117  * - HW_USB_CONTROL - USB OTG Control register
118  * - HW_USB_USBTRC0 - USB Transceiver Control register 0
119  * - HW_USB_USBFRMADJUST - Frame Adjust Register
120  * - HW_USB_CLK_RECOVER_CTRL - USB Clock recovery control
121  * - HW_USB_CLK_RECOVER_IRC_EN - IRC48M oscillator enable register
122  * - HW_USB_CLK_RECOVER_INT_STATUS - Clock recovery separated interrupt status
123  *
124  * - hw_usb_t - Struct containing all module registers.
125  */
126
127 #define HW_USB_INSTANCE_COUNT (1U) /*!< Number of instances of the USB module. */
128
129 /*******************************************************************************
130  * HW_USB_PERID - Peripheral ID register
131  ******************************************************************************/
132
133 /*!
134  * @brief HW_USB_PERID - Peripheral ID register (RO)
135  *
136  * Reset value: 0x04U
137  *
138  * Reads back the value of 0x04. This value is defined for the USB peripheral.
139  */
140 typedef union _hw_usb_perid
141 {
142     uint8_t U;
143     struct _hw_usb_perid_bitfields
144     {
145         uint8_t ID : 6;                /*!< [5:0] Peripheral Identification */
146         uint8_t RESERVED0 : 2;         /*!< [7:6]  */
147     } B;
148 } hw_usb_perid_t;
149
150 /*!
151  * @name Constants and macros for entire USB_PERID register
152  */
153 /*@{*/
154 #define HW_USB_PERID_ADDR(x)     ((x) + 0x0U)
155
156 #define HW_USB_PERID(x)          (*(__I hw_usb_perid_t *) HW_USB_PERID_ADDR(x))
157 #define HW_USB_PERID_RD(x)       (HW_USB_PERID(x).U)
158 /*@}*/
159
160 /*
161  * Constants & macros for individual USB_PERID bitfields
162  */
163
164 /*!
165  * @name Register USB_PERID, field ID[5:0] (RO)
166  *
167  * This field always reads 0x4h.
168  */
169 /*@{*/
170 #define BP_USB_PERID_ID      (0U)          /*!< Bit position for USB_PERID_ID. */
171 #define BM_USB_PERID_ID      (0x3FU)       /*!< Bit mask for USB_PERID_ID. */
172 #define BS_USB_PERID_ID      (6U)          /*!< Bit field size in bits for USB_PERID_ID. */
173
174 /*! @brief Read current value of the USB_PERID_ID field. */
175 #define BR_USB_PERID_ID(x)   (HW_USB_PERID(x).B.ID)
176 /*@}*/
177
178 /*******************************************************************************
179  * HW_USB_IDCOMP - Peripheral ID Complement register
180  ******************************************************************************/
181
182 /*!
183  * @brief HW_USB_IDCOMP - Peripheral ID Complement register (RO)
184  *
185  * Reset value: 0xFBU
186  *
187  * Reads back the complement of the Peripheral ID register. For the USB
188  * peripheral, the value is 0xFB.
189  */
190 typedef union _hw_usb_idcomp
191 {
192     uint8_t U;
193     struct _hw_usb_idcomp_bitfields
194     {
195         uint8_t NID : 6;               /*!< [5:0]  */
196         uint8_t RESERVED0 : 2;         /*!< [7:6]  */
197     } B;
198 } hw_usb_idcomp_t;
199
200 /*!
201  * @name Constants and macros for entire USB_IDCOMP register
202  */
203 /*@{*/
204 #define HW_USB_IDCOMP_ADDR(x)    ((x) + 0x4U)
205
206 #define HW_USB_IDCOMP(x)         (*(__I hw_usb_idcomp_t *) HW_USB_IDCOMP_ADDR(x))
207 #define HW_USB_IDCOMP_RD(x)      (HW_USB_IDCOMP(x).U)
208 /*@}*/
209
210 /*
211  * Constants & macros for individual USB_IDCOMP bitfields
212  */
213
214 /*!
215  * @name Register USB_IDCOMP, field NID[5:0] (RO)
216  *
217  * Ones' complement of PERID[ID]. bits.
218  */
219 /*@{*/
220 #define BP_USB_IDCOMP_NID    (0U)          /*!< Bit position for USB_IDCOMP_NID. */
221 #define BM_USB_IDCOMP_NID    (0x3FU)       /*!< Bit mask for USB_IDCOMP_NID. */
222 #define BS_USB_IDCOMP_NID    (6U)          /*!< Bit field size in bits for USB_IDCOMP_NID. */
223
224 /*! @brief Read current value of the USB_IDCOMP_NID field. */
225 #define BR_USB_IDCOMP_NID(x) (HW_USB_IDCOMP(x).B.NID)
226 /*@}*/
227
228 /*******************************************************************************
229  * HW_USB_REV - Peripheral Revision register
230  ******************************************************************************/
231
232 /*!
233  * @brief HW_USB_REV - Peripheral Revision register (RO)
234  *
235  * Reset value: 0x33U
236  *
237  * Contains the revision number of the USB module.
238  */
239 typedef union _hw_usb_rev
240 {
241     uint8_t U;
242     struct _hw_usb_rev_bitfields
243     {
244         uint8_t REV : 8;               /*!< [7:0] Revision */
245     } B;
246 } hw_usb_rev_t;
247
248 /*!
249  * @name Constants and macros for entire USB_REV register
250  */
251 /*@{*/
252 #define HW_USB_REV_ADDR(x)       ((x) + 0x8U)
253
254 #define HW_USB_REV(x)            (*(__I hw_usb_rev_t *) HW_USB_REV_ADDR(x))
255 #define HW_USB_REV_RD(x)         (HW_USB_REV(x).U)
256 /*@}*/
257
258 /*
259  * Constants & macros for individual USB_REV bitfields
260  */
261
262 /*!
263  * @name Register USB_REV, field REV[7:0] (RO)
264  *
265  * Indicates the revision number of the USB Core.
266  */
267 /*@{*/
268 #define BP_USB_REV_REV       (0U)          /*!< Bit position for USB_REV_REV. */
269 #define BM_USB_REV_REV       (0xFFU)       /*!< Bit mask for USB_REV_REV. */
270 #define BS_USB_REV_REV       (8U)          /*!< Bit field size in bits for USB_REV_REV. */
271
272 /*! @brief Read current value of the USB_REV_REV field. */
273 #define BR_USB_REV_REV(x)    (HW_USB_REV(x).U)
274 /*@}*/
275
276 /*******************************************************************************
277  * HW_USB_ADDINFO - Peripheral Additional Info register
278  ******************************************************************************/
279
280 /*!
281  * @brief HW_USB_ADDINFO - Peripheral Additional Info register (RO)
282  *
283  * Reset value: 0x01U
284  *
285  * Reads back the value of the fixed Interrupt Request Level (IRQNUM) along with
286  * the Host Enable bit.
287  */
288 typedef union _hw_usb_addinfo
289 {
290     uint8_t U;
291     struct _hw_usb_addinfo_bitfields
292     {
293         uint8_t IEHOST : 1;            /*!< [0]  */
294         uint8_t RESERVED0 : 2;         /*!< [2:1]  */
295         uint8_t IRQNUM : 5;            /*!< [7:3] Assigned Interrupt Request Number */
296     } B;
297 } hw_usb_addinfo_t;
298
299 /*!
300  * @name Constants and macros for entire USB_ADDINFO register
301  */
302 /*@{*/
303 #define HW_USB_ADDINFO_ADDR(x)   ((x) + 0xCU)
304
305 #define HW_USB_ADDINFO(x)        (*(__I hw_usb_addinfo_t *) HW_USB_ADDINFO_ADDR(x))
306 #define HW_USB_ADDINFO_RD(x)     (HW_USB_ADDINFO(x).U)
307 /*@}*/
308
309 /*
310  * Constants & macros for individual USB_ADDINFO bitfields
311  */
312
313 /*!
314  * @name Register USB_ADDINFO, field IEHOST[0] (RO)
315  *
316  * This bit is set if host mode is enabled.
317  */
318 /*@{*/
319 #define BP_USB_ADDINFO_IEHOST (0U)         /*!< Bit position for USB_ADDINFO_IEHOST. */
320 #define BM_USB_ADDINFO_IEHOST (0x01U)      /*!< Bit mask for USB_ADDINFO_IEHOST. */
321 #define BS_USB_ADDINFO_IEHOST (1U)         /*!< Bit field size in bits for USB_ADDINFO_IEHOST. */
322
323 /*! @brief Read current value of the USB_ADDINFO_IEHOST field. */
324 #define BR_USB_ADDINFO_IEHOST(x) (BITBAND_ACCESS8(HW_USB_ADDINFO_ADDR(x), BP_USB_ADDINFO_IEHOST))
325 /*@}*/
326
327 /*!
328  * @name Register USB_ADDINFO, field IRQNUM[7:3] (RO)
329  */
330 /*@{*/
331 #define BP_USB_ADDINFO_IRQNUM (3U)         /*!< Bit position for USB_ADDINFO_IRQNUM. */
332 #define BM_USB_ADDINFO_IRQNUM (0xF8U)      /*!< Bit mask for USB_ADDINFO_IRQNUM. */
333 #define BS_USB_ADDINFO_IRQNUM (5U)         /*!< Bit field size in bits for USB_ADDINFO_IRQNUM. */
334
335 /*! @brief Read current value of the USB_ADDINFO_IRQNUM field. */
336 #define BR_USB_ADDINFO_IRQNUM(x) (HW_USB_ADDINFO(x).B.IRQNUM)
337 /*@}*/
338
339 /*******************************************************************************
340  * HW_USB_OTGISTAT - OTG Interrupt Status register
341  ******************************************************************************/
342
343 /*!
344  * @brief HW_USB_OTGISTAT - OTG Interrupt Status register (RW)
345  *
346  * Reset value: 0x00U
347  *
348  * Records changes of the ID sense and VBUS signals. Software can read this
349  * register to determine the event that triggers an interrupt. Only bits that have
350  * changed since the last software read are set. Writing a one to a bit clears the
351  * associated interrupt.
352  */
353 typedef union _hw_usb_otgistat
354 {
355     uint8_t U;
356     struct _hw_usb_otgistat_bitfields
357     {
358         uint8_t AVBUSCHG : 1;          /*!< [0]  */
359         uint8_t RESERVED0 : 1;         /*!< [1]  */
360         uint8_t B_SESS_CHG : 1;        /*!< [2]  */
361         uint8_t SESSVLDCHG : 1;        /*!< [3]  */
362         uint8_t RESERVED1 : 1;         /*!< [4]  */
363         uint8_t LINE_STATE_CHG : 1;    /*!< [5]  */
364         uint8_t ONEMSEC : 1;           /*!< [6]  */
365         uint8_t IDCHG : 1;             /*!< [7]  */
366     } B;
367 } hw_usb_otgistat_t;
368
369 /*!
370  * @name Constants and macros for entire USB_OTGISTAT register
371  */
372 /*@{*/
373 #define HW_USB_OTGISTAT_ADDR(x)  ((x) + 0x10U)
374
375 #define HW_USB_OTGISTAT(x)       (*(__IO hw_usb_otgistat_t *) HW_USB_OTGISTAT_ADDR(x))
376 #define HW_USB_OTGISTAT_RD(x)    (HW_USB_OTGISTAT(x).U)
377 #define HW_USB_OTGISTAT_WR(x, v) (HW_USB_OTGISTAT(x).U = (v))
378 #define HW_USB_OTGISTAT_SET(x, v) (HW_USB_OTGISTAT_WR(x, HW_USB_OTGISTAT_RD(x) |  (v)))
379 #define HW_USB_OTGISTAT_CLR(x, v) (HW_USB_OTGISTAT_WR(x, HW_USB_OTGISTAT_RD(x) & ~(v)))
380 #define HW_USB_OTGISTAT_TOG(x, v) (HW_USB_OTGISTAT_WR(x, HW_USB_OTGISTAT_RD(x) ^  (v)))
381 /*@}*/
382
383 /*
384  * Constants & macros for individual USB_OTGISTAT bitfields
385  */
386
387 /*!
388  * @name Register USB_OTGISTAT, field AVBUSCHG[0] (RW)
389  *
390  * This bit is set when a change in VBUS is detected on an A device.
391  */
392 /*@{*/
393 #define BP_USB_OTGISTAT_AVBUSCHG (0U)      /*!< Bit position for USB_OTGISTAT_AVBUSCHG. */
394 #define BM_USB_OTGISTAT_AVBUSCHG (0x01U)   /*!< Bit mask for USB_OTGISTAT_AVBUSCHG. */
395 #define BS_USB_OTGISTAT_AVBUSCHG (1U)      /*!< Bit field size in bits for USB_OTGISTAT_AVBUSCHG. */
396
397 /*! @brief Read current value of the USB_OTGISTAT_AVBUSCHG field. */
398 #define BR_USB_OTGISTAT_AVBUSCHG(x) (BITBAND_ACCESS8(HW_USB_OTGISTAT_ADDR(x), BP_USB_OTGISTAT_AVBUSCHG))
399
400 /*! @brief Format value for bitfield USB_OTGISTAT_AVBUSCHG. */
401 #define BF_USB_OTGISTAT_AVBUSCHG(v) ((uint8_t)((uint8_t)(v) << BP_USB_OTGISTAT_AVBUSCHG) & BM_USB_OTGISTAT_AVBUSCHG)
402
403 /*! @brief Set the AVBUSCHG field to a new value. */
404 #define BW_USB_OTGISTAT_AVBUSCHG(x, v) (BITBAND_ACCESS8(HW_USB_OTGISTAT_ADDR(x), BP_USB_OTGISTAT_AVBUSCHG) = (v))
405 /*@}*/
406
407 /*!
408  * @name Register USB_OTGISTAT, field B_SESS_CHG[2] (RW)
409  *
410  * This bit is set when a change in VBUS is detected on a B device.
411  */
412 /*@{*/
413 #define BP_USB_OTGISTAT_B_SESS_CHG (2U)    /*!< Bit position for USB_OTGISTAT_B_SESS_CHG. */
414 #define BM_USB_OTGISTAT_B_SESS_CHG (0x04U) /*!< Bit mask for USB_OTGISTAT_B_SESS_CHG. */
415 #define BS_USB_OTGISTAT_B_SESS_CHG (1U)    /*!< Bit field size in bits for USB_OTGISTAT_B_SESS_CHG. */
416
417 /*! @brief Read current value of the USB_OTGISTAT_B_SESS_CHG field. */
418 #define BR_USB_OTGISTAT_B_SESS_CHG(x) (BITBAND_ACCESS8(HW_USB_OTGISTAT_ADDR(x), BP_USB_OTGISTAT_B_SESS_CHG))
419
420 /*! @brief Format value for bitfield USB_OTGISTAT_B_SESS_CHG. */
421 #define BF_USB_OTGISTAT_B_SESS_CHG(v) ((uint8_t)((uint8_t)(v) << BP_USB_OTGISTAT_B_SESS_CHG) & BM_USB_OTGISTAT_B_SESS_CHG)
422
423 /*! @brief Set the B_SESS_CHG field to a new value. */
424 #define BW_USB_OTGISTAT_B_SESS_CHG(x, v) (BITBAND_ACCESS8(HW_USB_OTGISTAT_ADDR(x), BP_USB_OTGISTAT_B_SESS_CHG) = (v))
425 /*@}*/
426
427 /*!
428  * @name Register USB_OTGISTAT, field SESSVLDCHG[3] (RW)
429  *
430  * This bit is set when a change in VBUS is detected indicating a session valid
431  * or a session no longer valid.
432  */
433 /*@{*/
434 #define BP_USB_OTGISTAT_SESSVLDCHG (3U)    /*!< Bit position for USB_OTGISTAT_SESSVLDCHG. */
435 #define BM_USB_OTGISTAT_SESSVLDCHG (0x08U) /*!< Bit mask for USB_OTGISTAT_SESSVLDCHG. */
436 #define BS_USB_OTGISTAT_SESSVLDCHG (1U)    /*!< Bit field size in bits for USB_OTGISTAT_SESSVLDCHG. */
437
438 /*! @brief Read current value of the USB_OTGISTAT_SESSVLDCHG field. */
439 #define BR_USB_OTGISTAT_SESSVLDCHG(x) (BITBAND_ACCESS8(HW_USB_OTGISTAT_ADDR(x), BP_USB_OTGISTAT_SESSVLDCHG))
440
441 /*! @brief Format value for bitfield USB_OTGISTAT_SESSVLDCHG. */
442 #define BF_USB_OTGISTAT_SESSVLDCHG(v) ((uint8_t)((uint8_t)(v) << BP_USB_OTGISTAT_SESSVLDCHG) & BM_USB_OTGISTAT_SESSVLDCHG)
443
444 /*! @brief Set the SESSVLDCHG field to a new value. */
445 #define BW_USB_OTGISTAT_SESSVLDCHG(x, v) (BITBAND_ACCESS8(HW_USB_OTGISTAT_ADDR(x), BP_USB_OTGISTAT_SESSVLDCHG) = (v))
446 /*@}*/
447
448 /*!
449  * @name Register USB_OTGISTAT, field LINE_STATE_CHG[5] (RW)
450  *
451  * This interrupt is set when the USB line state (CTL[SE0] and CTL[JSTATE] bits)
452  * are stable without change for 1 millisecond, and the value of the line state
453  * is different from the last time when the line state was stable. It is set on
454  * transitions between SE0 and J-state, SE0 and K-state, and J-state and K-state.
455  * Changes in J-state while SE0 is true do not cause an interrupt. This interrupt
456  * can be used in detecting Reset, Resume, Connect, and Data Line Pulse
457  * signaling.
458  */
459 /*@{*/
460 #define BP_USB_OTGISTAT_LINE_STATE_CHG (5U) /*!< Bit position for USB_OTGISTAT_LINE_STATE_CHG. */
461 #define BM_USB_OTGISTAT_LINE_STATE_CHG (0x20U) /*!< Bit mask for USB_OTGISTAT_LINE_STATE_CHG. */
462 #define BS_USB_OTGISTAT_LINE_STATE_CHG (1U) /*!< Bit field size in bits for USB_OTGISTAT_LINE_STATE_CHG. */
463
464 /*! @brief Read current value of the USB_OTGISTAT_LINE_STATE_CHG field. */
465 #define BR_USB_OTGISTAT_LINE_STATE_CHG(x) (BITBAND_ACCESS8(HW_USB_OTGISTAT_ADDR(x), BP_USB_OTGISTAT_LINE_STATE_CHG))
466
467 /*! @brief Format value for bitfield USB_OTGISTAT_LINE_STATE_CHG. */
468 #define BF_USB_OTGISTAT_LINE_STATE_CHG(v) ((uint8_t)((uint8_t)(v) << BP_USB_OTGISTAT_LINE_STATE_CHG) & BM_USB_OTGISTAT_LINE_STATE_CHG)
469
470 /*! @brief Set the LINE_STATE_CHG field to a new value. */
471 #define BW_USB_OTGISTAT_LINE_STATE_CHG(x, v) (BITBAND_ACCESS8(HW_USB_OTGISTAT_ADDR(x), BP_USB_OTGISTAT_LINE_STATE_CHG) = (v))
472 /*@}*/
473
474 /*!
475  * @name Register USB_OTGISTAT, field ONEMSEC[6] (RW)
476  *
477  * This bit is set when the 1 millisecond timer expires. This bit stays asserted
478  * until cleared by software. The interrupt must be serviced every millisecond
479  * to avoid losing 1msec counts.
480  */
481 /*@{*/
482 #define BP_USB_OTGISTAT_ONEMSEC (6U)       /*!< Bit position for USB_OTGISTAT_ONEMSEC. */
483 #define BM_USB_OTGISTAT_ONEMSEC (0x40U)    /*!< Bit mask for USB_OTGISTAT_ONEMSEC. */
484 #define BS_USB_OTGISTAT_ONEMSEC (1U)       /*!< Bit field size in bits for USB_OTGISTAT_ONEMSEC. */
485
486 /*! @brief Read current value of the USB_OTGISTAT_ONEMSEC field. */
487 #define BR_USB_OTGISTAT_ONEMSEC(x) (BITBAND_ACCESS8(HW_USB_OTGISTAT_ADDR(x), BP_USB_OTGISTAT_ONEMSEC))
488
489 /*! @brief Format value for bitfield USB_OTGISTAT_ONEMSEC. */
490 #define BF_USB_OTGISTAT_ONEMSEC(v) ((uint8_t)((uint8_t)(v) << BP_USB_OTGISTAT_ONEMSEC) & BM_USB_OTGISTAT_ONEMSEC)
491
492 /*! @brief Set the ONEMSEC field to a new value. */
493 #define BW_USB_OTGISTAT_ONEMSEC(x, v) (BITBAND_ACCESS8(HW_USB_OTGISTAT_ADDR(x), BP_USB_OTGISTAT_ONEMSEC) = (v))
494 /*@}*/
495
496 /*!
497  * @name Register USB_OTGISTAT, field IDCHG[7] (RW)
498  *
499  * This bit is set when a change in the ID Signal from the USB connector is
500  * sensed.
501  */
502 /*@{*/
503 #define BP_USB_OTGISTAT_IDCHG (7U)         /*!< Bit position for USB_OTGISTAT_IDCHG. */
504 #define BM_USB_OTGISTAT_IDCHG (0x80U)      /*!< Bit mask for USB_OTGISTAT_IDCHG. */
505 #define BS_USB_OTGISTAT_IDCHG (1U)         /*!< Bit field size in bits for USB_OTGISTAT_IDCHG. */
506
507 /*! @brief Read current value of the USB_OTGISTAT_IDCHG field. */
508 #define BR_USB_OTGISTAT_IDCHG(x) (BITBAND_ACCESS8(HW_USB_OTGISTAT_ADDR(x), BP_USB_OTGISTAT_IDCHG))
509
510 /*! @brief Format value for bitfield USB_OTGISTAT_IDCHG. */
511 #define BF_USB_OTGISTAT_IDCHG(v) ((uint8_t)((uint8_t)(v) << BP_USB_OTGISTAT_IDCHG) & BM_USB_OTGISTAT_IDCHG)
512
513 /*! @brief Set the IDCHG field to a new value. */
514 #define BW_USB_OTGISTAT_IDCHG(x, v) (BITBAND_ACCESS8(HW_USB_OTGISTAT_ADDR(x), BP_USB_OTGISTAT_IDCHG) = (v))
515 /*@}*/
516
517 /*******************************************************************************
518  * HW_USB_OTGICR - OTG Interrupt Control register
519  ******************************************************************************/
520
521 /*!
522  * @brief HW_USB_OTGICR - OTG Interrupt Control register (RW)
523  *
524  * Reset value: 0x00U
525  *
526  * Enables the corresponding interrupt status bits defined in the OTG Interrupt
527  * Status Register.
528  */
529 typedef union _hw_usb_otgicr
530 {
531     uint8_t U;
532     struct _hw_usb_otgicr_bitfields
533     {
534         uint8_t AVBUSEN : 1;           /*!< [0] A VBUS Valid Interrupt Enable */
535         uint8_t RESERVED0 : 1;         /*!< [1]  */
536         uint8_t BSESSEN : 1;           /*!< [2] B Session END Interrupt Enable */
537         uint8_t SESSVLDEN : 1;         /*!< [3] Session Valid Interrupt Enable */
538         uint8_t RESERVED1 : 1;         /*!< [4]  */
539         uint8_t LINESTATEEN : 1;       /*!< [5] Line State Change Interrupt Enable
540                                         * */
541         uint8_t ONEMSECEN : 1;         /*!< [6] One Millisecond Interrupt Enable */
542         uint8_t IDEN : 1;              /*!< [7] ID Interrupt Enable */
543     } B;
544 } hw_usb_otgicr_t;
545
546 /*!
547  * @name Constants and macros for entire USB_OTGICR register
548  */
549 /*@{*/
550 #define HW_USB_OTGICR_ADDR(x)    ((x) + 0x14U)
551
552 #define HW_USB_OTGICR(x)         (*(__IO hw_usb_otgicr_t *) HW_USB_OTGICR_ADDR(x))
553 #define HW_USB_OTGICR_RD(x)      (HW_USB_OTGICR(x).U)
554 #define HW_USB_OTGICR_WR(x, v)   (HW_USB_OTGICR(x).U = (v))
555 #define HW_USB_OTGICR_SET(x, v)  (HW_USB_OTGICR_WR(x, HW_USB_OTGICR_RD(x) |  (v)))
556 #define HW_USB_OTGICR_CLR(x, v)  (HW_USB_OTGICR_WR(x, HW_USB_OTGICR_RD(x) & ~(v)))
557 #define HW_USB_OTGICR_TOG(x, v)  (HW_USB_OTGICR_WR(x, HW_USB_OTGICR_RD(x) ^  (v)))
558 /*@}*/
559
560 /*
561  * Constants & macros for individual USB_OTGICR bitfields
562  */
563
564 /*!
565  * @name Register USB_OTGICR, field AVBUSEN[0] (RW)
566  *
567  * Values:
568  * - 0 - Disables the AVBUSCHG interrupt.
569  * - 1 - Enables the AVBUSCHG interrupt.
570  */
571 /*@{*/
572 #define BP_USB_OTGICR_AVBUSEN (0U)         /*!< Bit position for USB_OTGICR_AVBUSEN. */
573 #define BM_USB_OTGICR_AVBUSEN (0x01U)      /*!< Bit mask for USB_OTGICR_AVBUSEN. */
574 #define BS_USB_OTGICR_AVBUSEN (1U)         /*!< Bit field size in bits for USB_OTGICR_AVBUSEN. */
575
576 /*! @brief Read current value of the USB_OTGICR_AVBUSEN field. */
577 #define BR_USB_OTGICR_AVBUSEN(x) (BITBAND_ACCESS8(HW_USB_OTGICR_ADDR(x), BP_USB_OTGICR_AVBUSEN))
578
579 /*! @brief Format value for bitfield USB_OTGICR_AVBUSEN. */
580 #define BF_USB_OTGICR_AVBUSEN(v) ((uint8_t)((uint8_t)(v) << BP_USB_OTGICR_AVBUSEN) & BM_USB_OTGICR_AVBUSEN)
581
582 /*! @brief Set the AVBUSEN field to a new value. */
583 #define BW_USB_OTGICR_AVBUSEN(x, v) (BITBAND_ACCESS8(HW_USB_OTGICR_ADDR(x), BP_USB_OTGICR_AVBUSEN) = (v))
584 /*@}*/
585
586 /*!
587  * @name Register USB_OTGICR, field BSESSEN[2] (RW)
588  *
589  * Values:
590  * - 0 - Disables the B_SESS_CHG interrupt.
591  * - 1 - Enables the B_SESS_CHG interrupt.
592  */
593 /*@{*/
594 #define BP_USB_OTGICR_BSESSEN (2U)         /*!< Bit position for USB_OTGICR_BSESSEN. */
595 #define BM_USB_OTGICR_BSESSEN (0x04U)      /*!< Bit mask for USB_OTGICR_BSESSEN. */
596 #define BS_USB_OTGICR_BSESSEN (1U)         /*!< Bit field size in bits for USB_OTGICR_BSESSEN. */
597
598 /*! @brief Read current value of the USB_OTGICR_BSESSEN field. */
599 #define BR_USB_OTGICR_BSESSEN(x) (BITBAND_ACCESS8(HW_USB_OTGICR_ADDR(x), BP_USB_OTGICR_BSESSEN))
600
601 /*! @brief Format value for bitfield USB_OTGICR_BSESSEN. */
602 #define BF_USB_OTGICR_BSESSEN(v) ((uint8_t)((uint8_t)(v) << BP_USB_OTGICR_BSESSEN) & BM_USB_OTGICR_BSESSEN)
603
604 /*! @brief Set the BSESSEN field to a new value. */
605 #define BW_USB_OTGICR_BSESSEN(x, v) (BITBAND_ACCESS8(HW_USB_OTGICR_ADDR(x), BP_USB_OTGICR_BSESSEN) = (v))
606 /*@}*/
607
608 /*!
609  * @name Register USB_OTGICR, field SESSVLDEN[3] (RW)
610  *
611  * Values:
612  * - 0 - Disables the SESSVLDCHG interrupt.
613  * - 1 - Enables the SESSVLDCHG interrupt.
614  */
615 /*@{*/
616 #define BP_USB_OTGICR_SESSVLDEN (3U)       /*!< Bit position for USB_OTGICR_SESSVLDEN. */
617 #define BM_USB_OTGICR_SESSVLDEN (0x08U)    /*!< Bit mask for USB_OTGICR_SESSVLDEN. */
618 #define BS_USB_OTGICR_SESSVLDEN (1U)       /*!< Bit field size in bits for USB_OTGICR_SESSVLDEN. */
619
620 /*! @brief Read current value of the USB_OTGICR_SESSVLDEN field. */
621 #define BR_USB_OTGICR_SESSVLDEN(x) (BITBAND_ACCESS8(HW_USB_OTGICR_ADDR(x), BP_USB_OTGICR_SESSVLDEN))
622
623 /*! @brief Format value for bitfield USB_OTGICR_SESSVLDEN. */
624 #define BF_USB_OTGICR_SESSVLDEN(v) ((uint8_t)((uint8_t)(v) << BP_USB_OTGICR_SESSVLDEN) & BM_USB_OTGICR_SESSVLDEN)
625
626 /*! @brief Set the SESSVLDEN field to a new value. */
627 #define BW_USB_OTGICR_SESSVLDEN(x, v) (BITBAND_ACCESS8(HW_USB_OTGICR_ADDR(x), BP_USB_OTGICR_SESSVLDEN) = (v))
628 /*@}*/
629
630 /*!
631  * @name Register USB_OTGICR, field LINESTATEEN[5] (RW)
632  *
633  * Values:
634  * - 0 - Disables the LINE_STAT_CHG interrupt.
635  * - 1 - Enables the LINE_STAT_CHG interrupt.
636  */
637 /*@{*/
638 #define BP_USB_OTGICR_LINESTATEEN (5U)     /*!< Bit position for USB_OTGICR_LINESTATEEN. */
639 #define BM_USB_OTGICR_LINESTATEEN (0x20U)  /*!< Bit mask for USB_OTGICR_LINESTATEEN. */
640 #define BS_USB_OTGICR_LINESTATEEN (1U)     /*!< Bit field size in bits for USB_OTGICR_LINESTATEEN. */
641
642 /*! @brief Read current value of the USB_OTGICR_LINESTATEEN field. */
643 #define BR_USB_OTGICR_LINESTATEEN(x) (BITBAND_ACCESS8(HW_USB_OTGICR_ADDR(x), BP_USB_OTGICR_LINESTATEEN))
644
645 /*! @brief Format value for bitfield USB_OTGICR_LINESTATEEN. */
646 #define BF_USB_OTGICR_LINESTATEEN(v) ((uint8_t)((uint8_t)(v) << BP_USB_OTGICR_LINESTATEEN) & BM_USB_OTGICR_LINESTATEEN)
647
648 /*! @brief Set the LINESTATEEN field to a new value. */
649 #define BW_USB_OTGICR_LINESTATEEN(x, v) (BITBAND_ACCESS8(HW_USB_OTGICR_ADDR(x), BP_USB_OTGICR_LINESTATEEN) = (v))
650 /*@}*/
651
652 /*!
653  * @name Register USB_OTGICR, field ONEMSECEN[6] (RW)
654  *
655  * Values:
656  * - 0 - Diables the 1ms timer interrupt.
657  * - 1 - Enables the 1ms timer interrupt.
658  */
659 /*@{*/
660 #define BP_USB_OTGICR_ONEMSECEN (6U)       /*!< Bit position for USB_OTGICR_ONEMSECEN. */
661 #define BM_USB_OTGICR_ONEMSECEN (0x40U)    /*!< Bit mask for USB_OTGICR_ONEMSECEN. */
662 #define BS_USB_OTGICR_ONEMSECEN (1U)       /*!< Bit field size in bits for USB_OTGICR_ONEMSECEN. */
663
664 /*! @brief Read current value of the USB_OTGICR_ONEMSECEN field. */
665 #define BR_USB_OTGICR_ONEMSECEN(x) (BITBAND_ACCESS8(HW_USB_OTGICR_ADDR(x), BP_USB_OTGICR_ONEMSECEN))
666
667 /*! @brief Format value for bitfield USB_OTGICR_ONEMSECEN. */
668 #define BF_USB_OTGICR_ONEMSECEN(v) ((uint8_t)((uint8_t)(v) << BP_USB_OTGICR_ONEMSECEN) & BM_USB_OTGICR_ONEMSECEN)
669
670 /*! @brief Set the ONEMSECEN field to a new value. */
671 #define BW_USB_OTGICR_ONEMSECEN(x, v) (BITBAND_ACCESS8(HW_USB_OTGICR_ADDR(x), BP_USB_OTGICR_ONEMSECEN) = (v))
672 /*@}*/
673
674 /*!
675  * @name Register USB_OTGICR, field IDEN[7] (RW)
676  *
677  * Values:
678  * - 0 - The ID interrupt is disabled
679  * - 1 - The ID interrupt is enabled
680  */
681 /*@{*/
682 #define BP_USB_OTGICR_IDEN   (7U)          /*!< Bit position for USB_OTGICR_IDEN. */
683 #define BM_USB_OTGICR_IDEN   (0x80U)       /*!< Bit mask for USB_OTGICR_IDEN. */
684 #define BS_USB_OTGICR_IDEN   (1U)          /*!< Bit field size in bits for USB_OTGICR_IDEN. */
685
686 /*! @brief Read current value of the USB_OTGICR_IDEN field. */
687 #define BR_USB_OTGICR_IDEN(x) (BITBAND_ACCESS8(HW_USB_OTGICR_ADDR(x), BP_USB_OTGICR_IDEN))
688
689 /*! @brief Format value for bitfield USB_OTGICR_IDEN. */
690 #define BF_USB_OTGICR_IDEN(v) ((uint8_t)((uint8_t)(v) << BP_USB_OTGICR_IDEN) & BM_USB_OTGICR_IDEN)
691
692 /*! @brief Set the IDEN field to a new value. */
693 #define BW_USB_OTGICR_IDEN(x, v) (BITBAND_ACCESS8(HW_USB_OTGICR_ADDR(x), BP_USB_OTGICR_IDEN) = (v))
694 /*@}*/
695
696 /*******************************************************************************
697  * HW_USB_OTGSTAT - OTG Status register
698  ******************************************************************************/
699
700 /*!
701  * @brief HW_USB_OTGSTAT - OTG Status register (RW)
702  *
703  * Reset value: 0x00U
704  *
705  * Displays the actual value from the external comparator outputs of the ID pin
706  * and VBUS.
707  */
708 typedef union _hw_usb_otgstat
709 {
710     uint8_t U;
711     struct _hw_usb_otgstat_bitfields
712     {
713         uint8_t AVBUSVLD : 1;          /*!< [0] A VBUS Valid */
714         uint8_t RESERVED0 : 1;         /*!< [1]  */
715         uint8_t BSESSEND : 1;          /*!< [2] B Session End */
716         uint8_t SESS_VLD : 1;          /*!< [3] Session Valid */
717         uint8_t RESERVED1 : 1;         /*!< [4]  */
718         uint8_t LINESTATESTABLE : 1;   /*!< [5]  */
719         uint8_t ONEMSECEN : 1;         /*!< [6]  */
720         uint8_t ID : 1;                /*!< [7]  */
721     } B;
722 } hw_usb_otgstat_t;
723
724 /*!
725  * @name Constants and macros for entire USB_OTGSTAT register
726  */
727 /*@{*/
728 #define HW_USB_OTGSTAT_ADDR(x)   ((x) + 0x18U)
729
730 #define HW_USB_OTGSTAT(x)        (*(__IO hw_usb_otgstat_t *) HW_USB_OTGSTAT_ADDR(x))
731 #define HW_USB_OTGSTAT_RD(x)     (HW_USB_OTGSTAT(x).U)
732 #define HW_USB_OTGSTAT_WR(x, v)  (HW_USB_OTGSTAT(x).U = (v))
733 #define HW_USB_OTGSTAT_SET(x, v) (HW_USB_OTGSTAT_WR(x, HW_USB_OTGSTAT_RD(x) |  (v)))
734 #define HW_USB_OTGSTAT_CLR(x, v) (HW_USB_OTGSTAT_WR(x, HW_USB_OTGSTAT_RD(x) & ~(v)))
735 #define HW_USB_OTGSTAT_TOG(x, v) (HW_USB_OTGSTAT_WR(x, HW_USB_OTGSTAT_RD(x) ^  (v)))
736 /*@}*/
737
738 /*
739  * Constants & macros for individual USB_OTGSTAT bitfields
740  */
741
742 /*!
743  * @name Register USB_OTGSTAT, field AVBUSVLD[0] (RW)
744  *
745  * Values:
746  * - 0 - The VBUS voltage is below the A VBUS Valid threshold.
747  * - 1 - The VBUS voltage is above the A VBUS Valid threshold.
748  */
749 /*@{*/
750 #define BP_USB_OTGSTAT_AVBUSVLD (0U)       /*!< Bit position for USB_OTGSTAT_AVBUSVLD. */
751 #define BM_USB_OTGSTAT_AVBUSVLD (0x01U)    /*!< Bit mask for USB_OTGSTAT_AVBUSVLD. */
752 #define BS_USB_OTGSTAT_AVBUSVLD (1U)       /*!< Bit field size in bits for USB_OTGSTAT_AVBUSVLD. */
753
754 /*! @brief Read current value of the USB_OTGSTAT_AVBUSVLD field. */
755 #define BR_USB_OTGSTAT_AVBUSVLD(x) (BITBAND_ACCESS8(HW_USB_OTGSTAT_ADDR(x), BP_USB_OTGSTAT_AVBUSVLD))
756
757 /*! @brief Format value for bitfield USB_OTGSTAT_AVBUSVLD. */
758 #define BF_USB_OTGSTAT_AVBUSVLD(v) ((uint8_t)((uint8_t)(v) << BP_USB_OTGSTAT_AVBUSVLD) & BM_USB_OTGSTAT_AVBUSVLD)
759
760 /*! @brief Set the AVBUSVLD field to a new value. */
761 #define BW_USB_OTGSTAT_AVBUSVLD(x, v) (BITBAND_ACCESS8(HW_USB_OTGSTAT_ADDR(x), BP_USB_OTGSTAT_AVBUSVLD) = (v))
762 /*@}*/
763
764 /*!
765  * @name Register USB_OTGSTAT, field BSESSEND[2] (RW)
766  *
767  * Values:
768  * - 0 - The VBUS voltage is above the B session end threshold.
769  * - 1 - The VBUS voltage is below the B session end threshold.
770  */
771 /*@{*/
772 #define BP_USB_OTGSTAT_BSESSEND (2U)       /*!< Bit position for USB_OTGSTAT_BSESSEND. */
773 #define BM_USB_OTGSTAT_BSESSEND (0x04U)    /*!< Bit mask for USB_OTGSTAT_BSESSEND. */
774 #define BS_USB_OTGSTAT_BSESSEND (1U)       /*!< Bit field size in bits for USB_OTGSTAT_BSESSEND. */
775
776 /*! @brief Read current value of the USB_OTGSTAT_BSESSEND field. */
777 #define BR_USB_OTGSTAT_BSESSEND(x) (BITBAND_ACCESS8(HW_USB_OTGSTAT_ADDR(x), BP_USB_OTGSTAT_BSESSEND))
778
779 /*! @brief Format value for bitfield USB_OTGSTAT_BSESSEND. */
780 #define BF_USB_OTGSTAT_BSESSEND(v) ((uint8_t)((uint8_t)(v) << BP_USB_OTGSTAT_BSESSEND) & BM_USB_OTGSTAT_BSESSEND)
781
782 /*! @brief Set the BSESSEND field to a new value. */
783 #define BW_USB_OTGSTAT_BSESSEND(x, v) (BITBAND_ACCESS8(HW_USB_OTGSTAT_ADDR(x), BP_USB_OTGSTAT_BSESSEND) = (v))
784 /*@}*/
785
786 /*!
787  * @name Register USB_OTGSTAT, field SESS_VLD[3] (RW)
788  *
789  * Values:
790  * - 0 - The VBUS voltage is below the B session valid threshold
791  * - 1 - The VBUS voltage is above the B session valid threshold.
792  */
793 /*@{*/
794 #define BP_USB_OTGSTAT_SESS_VLD (3U)       /*!< Bit position for USB_OTGSTAT_SESS_VLD. */
795 #define BM_USB_OTGSTAT_SESS_VLD (0x08U)    /*!< Bit mask for USB_OTGSTAT_SESS_VLD. */
796 #define BS_USB_OTGSTAT_SESS_VLD (1U)       /*!< Bit field size in bits for USB_OTGSTAT_SESS_VLD. */
797
798 /*! @brief Read current value of the USB_OTGSTAT_SESS_VLD field. */
799 #define BR_USB_OTGSTAT_SESS_VLD(x) (BITBAND_ACCESS8(HW_USB_OTGSTAT_ADDR(x), BP_USB_OTGSTAT_SESS_VLD))
800
801 /*! @brief Format value for bitfield USB_OTGSTAT_SESS_VLD. */
802 #define BF_USB_OTGSTAT_SESS_VLD(v) ((uint8_t)((uint8_t)(v) << BP_USB_OTGSTAT_SESS_VLD) & BM_USB_OTGSTAT_SESS_VLD)
803
804 /*! @brief Set the SESS_VLD field to a new value. */
805 #define BW_USB_OTGSTAT_SESS_VLD(x, v) (BITBAND_ACCESS8(HW_USB_OTGSTAT_ADDR(x), BP_USB_OTGSTAT_SESS_VLD) = (v))
806 /*@}*/
807
808 /*!
809  * @name Register USB_OTGSTAT, field LINESTATESTABLE[5] (RW)
810  *
811  * Indicates that the internal signals that control the LINE_STATE_CHG field of
812  * OTGISTAT are stable for at least 1 millisecond. First read LINE_STATE_CHG
813  * field and then read this field. If this field reads as 1, then the value of
814  * LINE_STATE_CHG can be considered stable.
815  *
816  * Values:
817  * - 0 - The LINE_STAT_CHG bit is not yet stable.
818  * - 1 - The LINE_STAT_CHG bit has been debounced and is stable.
819  */
820 /*@{*/
821 #define BP_USB_OTGSTAT_LINESTATESTABLE (5U) /*!< Bit position for USB_OTGSTAT_LINESTATESTABLE. */
822 #define BM_USB_OTGSTAT_LINESTATESTABLE (0x20U) /*!< Bit mask for USB_OTGSTAT_LINESTATESTABLE. */
823 #define BS_USB_OTGSTAT_LINESTATESTABLE (1U) /*!< Bit field size in bits for USB_OTGSTAT_LINESTATESTABLE. */
824
825 /*! @brief Read current value of the USB_OTGSTAT_LINESTATESTABLE field. */
826 #define BR_USB_OTGSTAT_LINESTATESTABLE(x) (BITBAND_ACCESS8(HW_USB_OTGSTAT_ADDR(x), BP_USB_OTGSTAT_LINESTATESTABLE))
827
828 /*! @brief Format value for bitfield USB_OTGSTAT_LINESTATESTABLE. */
829 #define BF_USB_OTGSTAT_LINESTATESTABLE(v) ((uint8_t)((uint8_t)(v) << BP_USB_OTGSTAT_LINESTATESTABLE) & BM_USB_OTGSTAT_LINESTATESTABLE)
830
831 /*! @brief Set the LINESTATESTABLE field to a new value. */
832 #define BW_USB_OTGSTAT_LINESTATESTABLE(x, v) (BITBAND_ACCESS8(HW_USB_OTGSTAT_ADDR(x), BP_USB_OTGSTAT_LINESTATESTABLE) = (v))
833 /*@}*/
834
835 /*!
836  * @name Register USB_OTGSTAT, field ONEMSECEN[6] (RW)
837  *
838  * This bit is reserved for the 1ms count, but it is not useful to software.
839  */
840 /*@{*/
841 #define BP_USB_OTGSTAT_ONEMSECEN (6U)      /*!< Bit position for USB_OTGSTAT_ONEMSECEN. */
842 #define BM_USB_OTGSTAT_ONEMSECEN (0x40U)   /*!< Bit mask for USB_OTGSTAT_ONEMSECEN. */
843 #define BS_USB_OTGSTAT_ONEMSECEN (1U)      /*!< Bit field size in bits for USB_OTGSTAT_ONEMSECEN. */
844
845 /*! @brief Read current value of the USB_OTGSTAT_ONEMSECEN field. */
846 #define BR_USB_OTGSTAT_ONEMSECEN(x) (BITBAND_ACCESS8(HW_USB_OTGSTAT_ADDR(x), BP_USB_OTGSTAT_ONEMSECEN))
847
848 /*! @brief Format value for bitfield USB_OTGSTAT_ONEMSECEN. */
849 #define BF_USB_OTGSTAT_ONEMSECEN(v) ((uint8_t)((uint8_t)(v) << BP_USB_OTGSTAT_ONEMSECEN) & BM_USB_OTGSTAT_ONEMSECEN)
850
851 /*! @brief Set the ONEMSECEN field to a new value. */
852 #define BW_USB_OTGSTAT_ONEMSECEN(x, v) (BITBAND_ACCESS8(HW_USB_OTGSTAT_ADDR(x), BP_USB_OTGSTAT_ONEMSECEN) = (v))
853 /*@}*/
854
855 /*!
856  * @name Register USB_OTGSTAT, field ID[7] (RW)
857  *
858  * Indicates the current state of the ID pin on the USB connector
859  *
860  * Values:
861  * - 0 - Indicates a Type A cable is plugged into the USB connector.
862  * - 1 - Indicates no cable is attached or a Type B cable is plugged into the
863  *     USB connector.
864  */
865 /*@{*/
866 #define BP_USB_OTGSTAT_ID    (7U)          /*!< Bit position for USB_OTGSTAT_ID. */
867 #define BM_USB_OTGSTAT_ID    (0x80U)       /*!< Bit mask for USB_OTGSTAT_ID. */
868 #define BS_USB_OTGSTAT_ID    (1U)          /*!< Bit field size in bits for USB_OTGSTAT_ID. */
869
870 /*! @brief Read current value of the USB_OTGSTAT_ID field. */
871 #define BR_USB_OTGSTAT_ID(x) (BITBAND_ACCESS8(HW_USB_OTGSTAT_ADDR(x), BP_USB_OTGSTAT_ID))
872
873 /*! @brief Format value for bitfield USB_OTGSTAT_ID. */
874 #define BF_USB_OTGSTAT_ID(v) ((uint8_t)((uint8_t)(v) << BP_USB_OTGSTAT_ID) & BM_USB_OTGSTAT_ID)
875
876 /*! @brief Set the ID field to a new value. */
877 #define BW_USB_OTGSTAT_ID(x, v) (BITBAND_ACCESS8(HW_USB_OTGSTAT_ADDR(x), BP_USB_OTGSTAT_ID) = (v))
878 /*@}*/
879
880 /*******************************************************************************
881  * HW_USB_OTGCTL - OTG Control register
882  ******************************************************************************/
883
884 /*!
885  * @brief HW_USB_OTGCTL - OTG Control register (RW)
886  *
887  * Reset value: 0x00U
888  *
889  * Controls the operation of VBUS and Data Line termination resistors.
890  */
891 typedef union _hw_usb_otgctl
892 {
893     uint8_t U;
894     struct _hw_usb_otgctl_bitfields
895     {
896         uint8_t RESERVED0 : 2;         /*!< [1:0]  */
897         uint8_t OTGEN : 1;             /*!< [2] On-The-Go pullup/pulldown resistor enable
898                                         * */
899         uint8_t RESERVED1 : 1;         /*!< [3]  */
900         uint8_t DMLOW : 1;             /*!< [4] D- Data Line pull-down resistor enable */
901         uint8_t DPLOW : 1;             /*!< [5] D+ Data Line pull-down resistor enable */
902         uint8_t RESERVED2 : 1;         /*!< [6]  */
903         uint8_t DPHIGH : 1;            /*!< [7] D+ Data Line pullup resistor enable */
904     } B;
905 } hw_usb_otgctl_t;
906
907 /*!
908  * @name Constants and macros for entire USB_OTGCTL register
909  */
910 /*@{*/
911 #define HW_USB_OTGCTL_ADDR(x)    ((x) + 0x1CU)
912
913 #define HW_USB_OTGCTL(x)         (*(__IO hw_usb_otgctl_t *) HW_USB_OTGCTL_ADDR(x))
914 #define HW_USB_OTGCTL_RD(x)      (HW_USB_OTGCTL(x).U)
915 #define HW_USB_OTGCTL_WR(x, v)   (HW_USB_OTGCTL(x).U = (v))
916 #define HW_USB_OTGCTL_SET(x, v)  (HW_USB_OTGCTL_WR(x, HW_USB_OTGCTL_RD(x) |  (v)))
917 #define HW_USB_OTGCTL_CLR(x, v)  (HW_USB_OTGCTL_WR(x, HW_USB_OTGCTL_RD(x) & ~(v)))
918 #define HW_USB_OTGCTL_TOG(x, v)  (HW_USB_OTGCTL_WR(x, HW_USB_OTGCTL_RD(x) ^  (v)))
919 /*@}*/
920
921 /*
922  * Constants & macros for individual USB_OTGCTL bitfields
923  */
924
925 /*!
926  * @name Register USB_OTGCTL, field OTGEN[2] (RW)
927  *
928  * Values:
929  * - 0 - If USB_EN is 1 and HOST_MODE is 0 in the Control Register (CTL), then
930  *     the D+ Data Line pull-up resistors are enabled. If HOST_MODE is 1 the D+
931  *     and D- Data Line pull-down resistors are engaged.
932  * - 1 - The pull-up and pull-down controls in this register are used.
933  */
934 /*@{*/
935 #define BP_USB_OTGCTL_OTGEN  (2U)          /*!< Bit position for USB_OTGCTL_OTGEN. */
936 #define BM_USB_OTGCTL_OTGEN  (0x04U)       /*!< Bit mask for USB_OTGCTL_OTGEN. */
937 #define BS_USB_OTGCTL_OTGEN  (1U)          /*!< Bit field size in bits for USB_OTGCTL_OTGEN. */
938
939 /*! @brief Read current value of the USB_OTGCTL_OTGEN field. */
940 #define BR_USB_OTGCTL_OTGEN(x) (BITBAND_ACCESS8(HW_USB_OTGCTL_ADDR(x), BP_USB_OTGCTL_OTGEN))
941
942 /*! @brief Format value for bitfield USB_OTGCTL_OTGEN. */
943 #define BF_USB_OTGCTL_OTGEN(v) ((uint8_t)((uint8_t)(v) << BP_USB_OTGCTL_OTGEN) & BM_USB_OTGCTL_OTGEN)
944
945 /*! @brief Set the OTGEN field to a new value. */
946 #define BW_USB_OTGCTL_OTGEN(x, v) (BITBAND_ACCESS8(HW_USB_OTGCTL_ADDR(x), BP_USB_OTGCTL_OTGEN) = (v))
947 /*@}*/
948
949 /*!
950  * @name Register USB_OTGCTL, field DMLOW[4] (RW)
951  *
952  * Values:
953  * - 0 - D- pulldown resistor is not enabled.
954  * - 1 - D- pulldown resistor is enabled.
955  */
956 /*@{*/
957 #define BP_USB_OTGCTL_DMLOW  (4U)          /*!< Bit position for USB_OTGCTL_DMLOW. */
958 #define BM_USB_OTGCTL_DMLOW  (0x10U)       /*!< Bit mask for USB_OTGCTL_DMLOW. */
959 #define BS_USB_OTGCTL_DMLOW  (1U)          /*!< Bit field size in bits for USB_OTGCTL_DMLOW. */
960
961 /*! @brief Read current value of the USB_OTGCTL_DMLOW field. */
962 #define BR_USB_OTGCTL_DMLOW(x) (BITBAND_ACCESS8(HW_USB_OTGCTL_ADDR(x), BP_USB_OTGCTL_DMLOW))
963
964 /*! @brief Format value for bitfield USB_OTGCTL_DMLOW. */
965 #define BF_USB_OTGCTL_DMLOW(v) ((uint8_t)((uint8_t)(v) << BP_USB_OTGCTL_DMLOW) & BM_USB_OTGCTL_DMLOW)
966
967 /*! @brief Set the DMLOW field to a new value. */
968 #define BW_USB_OTGCTL_DMLOW(x, v) (BITBAND_ACCESS8(HW_USB_OTGCTL_ADDR(x), BP_USB_OTGCTL_DMLOW) = (v))
969 /*@}*/
970
971 /*!
972  * @name Register USB_OTGCTL, field DPLOW[5] (RW)
973  *
974  * This bit should always be enabled together with bit 4 (DMLOW)
975  *
976  * Values:
977  * - 0 - D+ pulldown resistor is not enabled.
978  * - 1 - D+ pulldown resistor is enabled.
979  */
980 /*@{*/
981 #define BP_USB_OTGCTL_DPLOW  (5U)          /*!< Bit position for USB_OTGCTL_DPLOW. */
982 #define BM_USB_OTGCTL_DPLOW  (0x20U)       /*!< Bit mask for USB_OTGCTL_DPLOW. */
983 #define BS_USB_OTGCTL_DPLOW  (1U)          /*!< Bit field size in bits for USB_OTGCTL_DPLOW. */
984
985 /*! @brief Read current value of the USB_OTGCTL_DPLOW field. */
986 #define BR_USB_OTGCTL_DPLOW(x) (BITBAND_ACCESS8(HW_USB_OTGCTL_ADDR(x), BP_USB_OTGCTL_DPLOW))
987
988 /*! @brief Format value for bitfield USB_OTGCTL_DPLOW. */
989 #define BF_USB_OTGCTL_DPLOW(v) ((uint8_t)((uint8_t)(v) << BP_USB_OTGCTL_DPLOW) & BM_USB_OTGCTL_DPLOW)
990
991 /*! @brief Set the DPLOW field to a new value. */
992 #define BW_USB_OTGCTL_DPLOW(x, v) (BITBAND_ACCESS8(HW_USB_OTGCTL_ADDR(x), BP_USB_OTGCTL_DPLOW) = (v))
993 /*@}*/
994
995 /*!
996  * @name Register USB_OTGCTL, field DPHIGH[7] (RW)
997  *
998  * Values:
999  * - 0 - D+ pullup resistor is not enabled
1000  * - 1 - D+ pullup resistor is enabled
1001  */
1002 /*@{*/
1003 #define BP_USB_OTGCTL_DPHIGH (7U)          /*!< Bit position for USB_OTGCTL_DPHIGH. */
1004 #define BM_USB_OTGCTL_DPHIGH (0x80U)       /*!< Bit mask for USB_OTGCTL_DPHIGH. */
1005 #define BS_USB_OTGCTL_DPHIGH (1U)          /*!< Bit field size in bits for USB_OTGCTL_DPHIGH. */
1006
1007 /*! @brief Read current value of the USB_OTGCTL_DPHIGH field. */
1008 #define BR_USB_OTGCTL_DPHIGH(x) (BITBAND_ACCESS8(HW_USB_OTGCTL_ADDR(x), BP_USB_OTGCTL_DPHIGH))
1009
1010 /*! @brief Format value for bitfield USB_OTGCTL_DPHIGH. */
1011 #define BF_USB_OTGCTL_DPHIGH(v) ((uint8_t)((uint8_t)(v) << BP_USB_OTGCTL_DPHIGH) & BM_USB_OTGCTL_DPHIGH)
1012
1013 /*! @brief Set the DPHIGH field to a new value. */
1014 #define BW_USB_OTGCTL_DPHIGH(x, v) (BITBAND_ACCESS8(HW_USB_OTGCTL_ADDR(x), BP_USB_OTGCTL_DPHIGH) = (v))
1015 /*@}*/
1016
1017 /*******************************************************************************
1018  * HW_USB_ISTAT - Interrupt Status register
1019  ******************************************************************************/
1020
1021 /*!
1022  * @brief HW_USB_ISTAT - Interrupt Status register (W1C)
1023  *
1024  * Reset value: 0x00U
1025  *
1026  * Contains fields for each of the interrupt sources within the USB Module. Each
1027  * of these fields are qualified with their respective interrupt enable bits.
1028  * All fields of this register are logically OR'd together along with the OTG
1029  * Interrupt Status Register (OTGSTAT) to form a single interrupt source for the
1030  * processor's interrupt controller. After an interrupt bit has been set it may only
1031  * be cleared by writing a one to the respective interrupt bit. This register
1032  * contains the value of 0x00 after a reset.
1033  */
1034 typedef union _hw_usb_istat
1035 {
1036     uint8_t U;
1037     struct _hw_usb_istat_bitfields
1038     {
1039         uint8_t USBRST : 1;            /*!< [0]  */
1040         uint8_t ERROR : 1;             /*!< [1]  */
1041         uint8_t SOFTOK : 1;            /*!< [2]  */
1042         uint8_t TOKDNE : 1;            /*!< [3]  */
1043         uint8_t SLEEP : 1;             /*!< [4]  */
1044         uint8_t RESUME : 1;            /*!< [5]  */
1045         uint8_t ATTACH : 1;            /*!< [6] Attach Interrupt */
1046         uint8_t STALL : 1;             /*!< [7] Stall Interrupt */
1047     } B;
1048 } hw_usb_istat_t;
1049
1050 /*!
1051  * @name Constants and macros for entire USB_ISTAT register
1052  */
1053 /*@{*/
1054 #define HW_USB_ISTAT_ADDR(x)     ((x) + 0x80U)
1055
1056 #define HW_USB_ISTAT(x)          (*(__IO hw_usb_istat_t *) HW_USB_ISTAT_ADDR(x))
1057 #define HW_USB_ISTAT_RD(x)       (HW_USB_ISTAT(x).U)
1058 #define HW_USB_ISTAT_WR(x, v)    (HW_USB_ISTAT(x).U = (v))
1059 #define HW_USB_ISTAT_SET(x, v)   (HW_USB_ISTAT_WR(x, HW_USB_ISTAT_RD(x) |  (v)))
1060 #define HW_USB_ISTAT_CLR(x, v)   (HW_USB_ISTAT_WR(x, HW_USB_ISTAT_RD(x) & ~(v)))
1061 #define HW_USB_ISTAT_TOG(x, v)   (HW_USB_ISTAT_WR(x, HW_USB_ISTAT_RD(x) ^  (v)))
1062 /*@}*/
1063
1064 /*
1065  * Constants & macros for individual USB_ISTAT bitfields
1066  */
1067
1068 /*!
1069  * @name Register USB_ISTAT, field USBRST[0] (W1C)
1070  *
1071  * This bit is set when the USB Module has decoded a valid USB reset. This
1072  * informs the processor that it should write 0x00 into the address register and
1073  * enable endpoint 0. USBRST is set after a USB reset has been detected for 2.5
1074  * microseconds. It is not asserted again until the USB reset condition has been
1075  * removed and then reasserted.
1076  */
1077 /*@{*/
1078 #define BP_USB_ISTAT_USBRST  (0U)          /*!< Bit position for USB_ISTAT_USBRST. */
1079 #define BM_USB_ISTAT_USBRST  (0x01U)       /*!< Bit mask for USB_ISTAT_USBRST. */
1080 #define BS_USB_ISTAT_USBRST  (1U)          /*!< Bit field size in bits for USB_ISTAT_USBRST. */
1081
1082 /*! @brief Read current value of the USB_ISTAT_USBRST field. */
1083 #define BR_USB_ISTAT_USBRST(x) (BITBAND_ACCESS8(HW_USB_ISTAT_ADDR(x), BP_USB_ISTAT_USBRST))
1084
1085 /*! @brief Format value for bitfield USB_ISTAT_USBRST. */
1086 #define BF_USB_ISTAT_USBRST(v) ((uint8_t)((uint8_t)(v) << BP_USB_ISTAT_USBRST) & BM_USB_ISTAT_USBRST)
1087
1088 /*! @brief Set the USBRST field to a new value. */
1089 #define BW_USB_ISTAT_USBRST(x, v) (BITBAND_ACCESS8(HW_USB_ISTAT_ADDR(x), BP_USB_ISTAT_USBRST) = (v))
1090 /*@}*/
1091
1092 /*!
1093  * @name Register USB_ISTAT, field ERROR[1] (W1C)
1094  *
1095  * This bit is set when any of the error conditions within Error Interrupt
1096  * Status (ERRSTAT) register occur. The processor must then read the ERRSTAT register
1097  * to determine the source of the error.
1098  */
1099 /*@{*/
1100 #define BP_USB_ISTAT_ERROR   (1U)          /*!< Bit position for USB_ISTAT_ERROR. */
1101 #define BM_USB_ISTAT_ERROR   (0x02U)       /*!< Bit mask for USB_ISTAT_ERROR. */
1102 #define BS_USB_ISTAT_ERROR   (1U)          /*!< Bit field size in bits for USB_ISTAT_ERROR. */
1103
1104 /*! @brief Read current value of the USB_ISTAT_ERROR field. */
1105 #define BR_USB_ISTAT_ERROR(x) (BITBAND_ACCESS8(HW_USB_ISTAT_ADDR(x), BP_USB_ISTAT_ERROR))
1106
1107 /*! @brief Format value for bitfield USB_ISTAT_ERROR. */
1108 #define BF_USB_ISTAT_ERROR(v) ((uint8_t)((uint8_t)(v) << BP_USB_ISTAT_ERROR) & BM_USB_ISTAT_ERROR)
1109
1110 /*! @brief Set the ERROR field to a new value. */
1111 #define BW_USB_ISTAT_ERROR(x, v) (BITBAND_ACCESS8(HW_USB_ISTAT_ADDR(x), BP_USB_ISTAT_ERROR) = (v))
1112 /*@}*/
1113
1114 /*!
1115  * @name Register USB_ISTAT, field SOFTOK[2] (W1C)
1116  *
1117  * This bit is set when the USB Module receives a Start Of Frame (SOF) token. In
1118  * Host mode this field is set when the SOF threshold is reached, so that
1119  * software can prepare for the next SOF.
1120  */
1121 /*@{*/
1122 #define BP_USB_ISTAT_SOFTOK  (2U)          /*!< Bit position for USB_ISTAT_SOFTOK. */
1123 #define BM_USB_ISTAT_SOFTOK  (0x04U)       /*!< Bit mask for USB_ISTAT_SOFTOK. */
1124 #define BS_USB_ISTAT_SOFTOK  (1U)          /*!< Bit field size in bits for USB_ISTAT_SOFTOK. */
1125
1126 /*! @brief Read current value of the USB_ISTAT_SOFTOK field. */
1127 #define BR_USB_ISTAT_SOFTOK(x) (BITBAND_ACCESS8(HW_USB_ISTAT_ADDR(x), BP_USB_ISTAT_SOFTOK))
1128
1129 /*! @brief Format value for bitfield USB_ISTAT_SOFTOK. */
1130 #define BF_USB_ISTAT_SOFTOK(v) ((uint8_t)((uint8_t)(v) << BP_USB_ISTAT_SOFTOK) & BM_USB_ISTAT_SOFTOK)
1131
1132 /*! @brief Set the SOFTOK field to a new value. */
1133 #define BW_USB_ISTAT_SOFTOK(x, v) (BITBAND_ACCESS8(HW_USB_ISTAT_ADDR(x), BP_USB_ISTAT_SOFTOK) = (v))
1134 /*@}*/
1135
1136 /*!
1137  * @name Register USB_ISTAT, field TOKDNE[3] (W1C)
1138  *
1139  * This bit is set when the current token being processed has completed. The
1140  * processor must immediately read the STATUS (STAT) register to determine the
1141  * EndPoint and BD used for this token. Clearing this bit (by writing a one) causes
1142  * STAT to be cleared or the STAT holding register to be loaded into the STAT
1143  * register.
1144  */
1145 /*@{*/
1146 #define BP_USB_ISTAT_TOKDNE  (3U)          /*!< Bit position for USB_ISTAT_TOKDNE. */
1147 #define BM_USB_ISTAT_TOKDNE  (0x08U)       /*!< Bit mask for USB_ISTAT_TOKDNE. */
1148 #define BS_USB_ISTAT_TOKDNE  (1U)          /*!< Bit field size in bits for USB_ISTAT_TOKDNE. */
1149
1150 /*! @brief Read current value of the USB_ISTAT_TOKDNE field. */
1151 #define BR_USB_ISTAT_TOKDNE(x) (BITBAND_ACCESS8(HW_USB_ISTAT_ADDR(x), BP_USB_ISTAT_TOKDNE))
1152
1153 /*! @brief Format value for bitfield USB_ISTAT_TOKDNE. */
1154 #define BF_USB_ISTAT_TOKDNE(v) ((uint8_t)((uint8_t)(v) << BP_USB_ISTAT_TOKDNE) & BM_USB_ISTAT_TOKDNE)
1155
1156 /*! @brief Set the TOKDNE field to a new value. */
1157 #define BW_USB_ISTAT_TOKDNE(x, v) (BITBAND_ACCESS8(HW_USB_ISTAT_ADDR(x), BP_USB_ISTAT_TOKDNE) = (v))
1158 /*@}*/
1159
1160 /*!
1161  * @name Register USB_ISTAT, field SLEEP[4] (W1C)
1162  *
1163  * This bit is set when the USB Module detects a constant idle on the USB bus
1164  * for 3 ms. The sleep timer is reset by activity on the USB bus.
1165  */
1166 /*@{*/
1167 #define BP_USB_ISTAT_SLEEP   (4U)          /*!< Bit position for USB_ISTAT_SLEEP. */
1168 #define BM_USB_ISTAT_SLEEP   (0x10U)       /*!< Bit mask for USB_ISTAT_SLEEP. */
1169 #define BS_USB_ISTAT_SLEEP   (1U)          /*!< Bit field size in bits for USB_ISTAT_SLEEP. */
1170
1171 /*! @brief Read current value of the USB_ISTAT_SLEEP field. */
1172 #define BR_USB_ISTAT_SLEEP(x) (BITBAND_ACCESS8(HW_USB_ISTAT_ADDR(x), BP_USB_ISTAT_SLEEP))
1173
1174 /*! @brief Format value for bitfield USB_ISTAT_SLEEP. */
1175 #define BF_USB_ISTAT_SLEEP(v) ((uint8_t)((uint8_t)(v) << BP_USB_ISTAT_SLEEP) & BM_USB_ISTAT_SLEEP)
1176
1177 /*! @brief Set the SLEEP field to a new value. */
1178 #define BW_USB_ISTAT_SLEEP(x, v) (BITBAND_ACCESS8(HW_USB_ISTAT_ADDR(x), BP_USB_ISTAT_SLEEP) = (v))
1179 /*@}*/
1180
1181 /*!
1182  * @name Register USB_ISTAT, field RESUME[5] (W1C)
1183  *
1184  * This bit is set when a K-state is observed on the DP/DM signals for 2.5 us.
1185  * When not in suspend mode this interrupt must be disabled.
1186  */
1187 /*@{*/
1188 #define BP_USB_ISTAT_RESUME  (5U)          /*!< Bit position for USB_ISTAT_RESUME. */
1189 #define BM_USB_ISTAT_RESUME  (0x20U)       /*!< Bit mask for USB_ISTAT_RESUME. */
1190 #define BS_USB_ISTAT_RESUME  (1U)          /*!< Bit field size in bits for USB_ISTAT_RESUME. */
1191
1192 /*! @brief Read current value of the USB_ISTAT_RESUME field. */
1193 #define BR_USB_ISTAT_RESUME(x) (BITBAND_ACCESS8(HW_USB_ISTAT_ADDR(x), BP_USB_ISTAT_RESUME))
1194
1195 /*! @brief Format value for bitfield USB_ISTAT_RESUME. */
1196 #define BF_USB_ISTAT_RESUME(v) ((uint8_t)((uint8_t)(v) << BP_USB_ISTAT_RESUME) & BM_USB_ISTAT_RESUME)
1197
1198 /*! @brief Set the RESUME field to a new value. */
1199 #define BW_USB_ISTAT_RESUME(x, v) (BITBAND_ACCESS8(HW_USB_ISTAT_ADDR(x), BP_USB_ISTAT_RESUME) = (v))
1200 /*@}*/
1201
1202 /*!
1203  * @name Register USB_ISTAT, field ATTACH[6] (W1C)
1204  *
1205  * This bit is set when the USB Module detects an attach of a USB device. This
1206  * signal is only valid if HOSTMODEEN is true. This interrupt signifies that a
1207  * peripheral is now present and must be configured; it is asserted if there have
1208  * been no transitions on the USB for 2.5 us and the current bus state is not SE0."
1209  */
1210 /*@{*/
1211 #define BP_USB_ISTAT_ATTACH  (6U)          /*!< Bit position for USB_ISTAT_ATTACH. */
1212 #define BM_USB_ISTAT_ATTACH  (0x40U)       /*!< Bit mask for USB_ISTAT_ATTACH. */
1213 #define BS_USB_ISTAT_ATTACH  (1U)          /*!< Bit field size in bits for USB_ISTAT_ATTACH. */
1214
1215 /*! @brief Read current value of the USB_ISTAT_ATTACH field. */
1216 #define BR_USB_ISTAT_ATTACH(x) (BITBAND_ACCESS8(HW_USB_ISTAT_ADDR(x), BP_USB_ISTAT_ATTACH))
1217
1218 /*! @brief Format value for bitfield USB_ISTAT_ATTACH. */
1219 #define BF_USB_ISTAT_ATTACH(v) ((uint8_t)((uint8_t)(v) << BP_USB_ISTAT_ATTACH) & BM_USB_ISTAT_ATTACH)
1220
1221 /*! @brief Set the ATTACH field to a new value. */
1222 #define BW_USB_ISTAT_ATTACH(x, v) (BITBAND_ACCESS8(HW_USB_ISTAT_ADDR(x), BP_USB_ISTAT_ATTACH) = (v))
1223 /*@}*/
1224
1225 /*!
1226  * @name Register USB_ISTAT, field STALL[7] (W1C)
1227  *
1228  * In Target mode this bit is asserted when a STALL handshake is sent by the
1229  * SIE. In Host mode this bit is set when the USB Module detects a STALL acknowledge
1230  * during the handshake phase of a USB transaction.This interrupt can be used to
1231  * determine whether the last USB transaction was completed successfully or
1232  * stalled.
1233  */
1234 /*@{*/
1235 #define BP_USB_ISTAT_STALL   (7U)          /*!< Bit position for USB_ISTAT_STALL. */
1236 #define BM_USB_ISTAT_STALL   (0x80U)       /*!< Bit mask for USB_ISTAT_STALL. */
1237 #define BS_USB_ISTAT_STALL   (1U)          /*!< Bit field size in bits for USB_ISTAT_STALL. */
1238
1239 /*! @brief Read current value of the USB_ISTAT_STALL field. */
1240 #define BR_USB_ISTAT_STALL(x) (BITBAND_ACCESS8(HW_USB_ISTAT_ADDR(x), BP_USB_ISTAT_STALL))
1241
1242 /*! @brief Format value for bitfield USB_ISTAT_STALL. */
1243 #define BF_USB_ISTAT_STALL(v) ((uint8_t)((uint8_t)(v) << BP_USB_ISTAT_STALL) & BM_USB_ISTAT_STALL)
1244
1245 /*! @brief Set the STALL field to a new value. */
1246 #define BW_USB_ISTAT_STALL(x, v) (BITBAND_ACCESS8(HW_USB_ISTAT_ADDR(x), BP_USB_ISTAT_STALL) = (v))
1247 /*@}*/
1248
1249 /*******************************************************************************
1250  * HW_USB_INTEN - Interrupt Enable register
1251  ******************************************************************************/
1252
1253 /*!
1254  * @brief HW_USB_INTEN - Interrupt Enable register (RW)
1255  *
1256  * Reset value: 0x00U
1257  *
1258  * Contains enable fields for each of the interrupt sources within the USB
1259  * Module. Setting any of these bits enables the respective interrupt source in the
1260  * ISTAT register. This register contains the value of 0x00 after a reset.
1261  */
1262 typedef union _hw_usb_inten
1263 {
1264     uint8_t U;
1265     struct _hw_usb_inten_bitfields
1266     {
1267         uint8_t USBRSTEN : 1;          /*!< [0] USBRST Interrupt Enable */
1268         uint8_t ERROREN : 1;           /*!< [1] ERROR Interrupt Enable */
1269         uint8_t SOFTOKEN : 1;          /*!< [2] SOFTOK Interrupt Enable */
1270         uint8_t TOKDNEEN : 1;          /*!< [3] TOKDNE Interrupt Enable */
1271         uint8_t SLEEPEN : 1;           /*!< [4] SLEEP Interrupt Enable */
1272         uint8_t RESUMEEN : 1;          /*!< [5] RESUME Interrupt Enable */
1273         uint8_t ATTACHEN : 1;          /*!< [6] ATTACH Interrupt Enable */
1274         uint8_t STALLEN : 1;           /*!< [7] STALL Interrupt Enable */
1275     } B;
1276 } hw_usb_inten_t;
1277
1278 /*!
1279  * @name Constants and macros for entire USB_INTEN register
1280  */
1281 /*@{*/
1282 #define HW_USB_INTEN_ADDR(x)     ((x) + 0x84U)
1283
1284 #define HW_USB_INTEN(x)          (*(__IO hw_usb_inten_t *) HW_USB_INTEN_ADDR(x))
1285 #define HW_USB_INTEN_RD(x)       (HW_USB_INTEN(x).U)
1286 #define HW_USB_INTEN_WR(x, v)    (HW_USB_INTEN(x).U = (v))
1287 #define HW_USB_INTEN_SET(x, v)   (HW_USB_INTEN_WR(x, HW_USB_INTEN_RD(x) |  (v)))
1288 #define HW_USB_INTEN_CLR(x, v)   (HW_USB_INTEN_WR(x, HW_USB_INTEN_RD(x) & ~(v)))
1289 #define HW_USB_INTEN_TOG(x, v)   (HW_USB_INTEN_WR(x, HW_USB_INTEN_RD(x) ^  (v)))
1290 /*@}*/
1291
1292 /*
1293  * Constants & macros for individual USB_INTEN bitfields
1294  */
1295
1296 /*!
1297  * @name Register USB_INTEN, field USBRSTEN[0] (RW)
1298  *
1299  * Values:
1300  * - 0 - Disables the USBRST interrupt.
1301  * - 1 - Enables the USBRST interrupt.
1302  */
1303 /*@{*/
1304 #define BP_USB_INTEN_USBRSTEN (0U)         /*!< Bit position for USB_INTEN_USBRSTEN. */
1305 #define BM_USB_INTEN_USBRSTEN (0x01U)      /*!< Bit mask for USB_INTEN_USBRSTEN. */
1306 #define BS_USB_INTEN_USBRSTEN (1U)         /*!< Bit field size in bits for USB_INTEN_USBRSTEN. */
1307
1308 /*! @brief Read current value of the USB_INTEN_USBRSTEN field. */
1309 #define BR_USB_INTEN_USBRSTEN(x) (BITBAND_ACCESS8(HW_USB_INTEN_ADDR(x), BP_USB_INTEN_USBRSTEN))
1310
1311 /*! @brief Format value for bitfield USB_INTEN_USBRSTEN. */
1312 #define BF_USB_INTEN_USBRSTEN(v) ((uint8_t)((uint8_t)(v) << BP_USB_INTEN_USBRSTEN) & BM_USB_INTEN_USBRSTEN)
1313
1314 /*! @brief Set the USBRSTEN field to a new value. */
1315 #define BW_USB_INTEN_USBRSTEN(x, v) (BITBAND_ACCESS8(HW_USB_INTEN_ADDR(x), BP_USB_INTEN_USBRSTEN) = (v))
1316 /*@}*/
1317
1318 /*!
1319  * @name Register USB_INTEN, field ERROREN[1] (RW)
1320  *
1321  * Values:
1322  * - 0 - Disables the ERROR interrupt.
1323  * - 1 - Enables the ERROR interrupt.
1324  */
1325 /*@{*/
1326 #define BP_USB_INTEN_ERROREN (1U)          /*!< Bit position for USB_INTEN_ERROREN. */
1327 #define BM_USB_INTEN_ERROREN (0x02U)       /*!< Bit mask for USB_INTEN_ERROREN. */
1328 #define BS_USB_INTEN_ERROREN (1U)          /*!< Bit field size in bits for USB_INTEN_ERROREN. */
1329
1330 /*! @brief Read current value of the USB_INTEN_ERROREN field. */
1331 #define BR_USB_INTEN_ERROREN(x) (BITBAND_ACCESS8(HW_USB_INTEN_ADDR(x), BP_USB_INTEN_ERROREN))
1332
1333 /*! @brief Format value for bitfield USB_INTEN_ERROREN. */
1334 #define BF_USB_INTEN_ERROREN(v) ((uint8_t)((uint8_t)(v) << BP_USB_INTEN_ERROREN) & BM_USB_INTEN_ERROREN)
1335
1336 /*! @brief Set the ERROREN field to a new value. */
1337 #define BW_USB_INTEN_ERROREN(x, v) (BITBAND_ACCESS8(HW_USB_INTEN_ADDR(x), BP_USB_INTEN_ERROREN) = (v))
1338 /*@}*/
1339
1340 /*!
1341  * @name Register USB_INTEN, field SOFTOKEN[2] (RW)
1342  *
1343  * Values:
1344  * - 0 - Disbles the SOFTOK interrupt.
1345  * - 1 - Enables the SOFTOK interrupt.
1346  */
1347 /*@{*/
1348 #define BP_USB_INTEN_SOFTOKEN (2U)         /*!< Bit position for USB_INTEN_SOFTOKEN. */
1349 #define BM_USB_INTEN_SOFTOKEN (0x04U)      /*!< Bit mask for USB_INTEN_SOFTOKEN. */
1350 #define BS_USB_INTEN_SOFTOKEN (1U)         /*!< Bit field size in bits for USB_INTEN_SOFTOKEN. */
1351
1352 /*! @brief Read current value of the USB_INTEN_SOFTOKEN field. */
1353 #define BR_USB_INTEN_SOFTOKEN(x) (BITBAND_ACCESS8(HW_USB_INTEN_ADDR(x), BP_USB_INTEN_SOFTOKEN))
1354
1355 /*! @brief Format value for bitfield USB_INTEN_SOFTOKEN. */
1356 #define BF_USB_INTEN_SOFTOKEN(v) ((uint8_t)((uint8_t)(v) << BP_USB_INTEN_SOFTOKEN) & BM_USB_INTEN_SOFTOKEN)
1357
1358 /*! @brief Set the SOFTOKEN field to a new value. */
1359 #define BW_USB_INTEN_SOFTOKEN(x, v) (BITBAND_ACCESS8(HW_USB_INTEN_ADDR(x), BP_USB_INTEN_SOFTOKEN) = (v))
1360 /*@}*/
1361
1362 /*!
1363  * @name Register USB_INTEN, field TOKDNEEN[3] (RW)
1364  *
1365  * Values:
1366  * - 0 - Disables the TOKDNE interrupt.
1367  * - 1 - Enables the TOKDNE interrupt.
1368  */
1369 /*@{*/
1370 #define BP_USB_INTEN_TOKDNEEN (3U)         /*!< Bit position for USB_INTEN_TOKDNEEN. */
1371 #define BM_USB_INTEN_TOKDNEEN (0x08U)      /*!< Bit mask for USB_INTEN_TOKDNEEN. */
1372 #define BS_USB_INTEN_TOKDNEEN (1U)         /*!< Bit field size in bits for USB_INTEN_TOKDNEEN. */
1373
1374 /*! @brief Read current value of the USB_INTEN_TOKDNEEN field. */
1375 #define BR_USB_INTEN_TOKDNEEN(x) (BITBAND_ACCESS8(HW_USB_INTEN_ADDR(x), BP_USB_INTEN_TOKDNEEN))
1376
1377 /*! @brief Format value for bitfield USB_INTEN_TOKDNEEN. */
1378 #define BF_USB_INTEN_TOKDNEEN(v) ((uint8_t)((uint8_t)(v) << BP_USB_INTEN_TOKDNEEN) & BM_USB_INTEN_TOKDNEEN)
1379
1380 /*! @brief Set the TOKDNEEN field to a new value. */
1381 #define BW_USB_INTEN_TOKDNEEN(x, v) (BITBAND_ACCESS8(HW_USB_INTEN_ADDR(x), BP_USB_INTEN_TOKDNEEN) = (v))
1382 /*@}*/
1383
1384 /*!
1385  * @name Register USB_INTEN, field SLEEPEN[4] (RW)
1386  *
1387  * Values:
1388  * - 0 - Disables the SLEEP interrupt.
1389  * - 1 - Enables the SLEEP interrupt.
1390  */
1391 /*@{*/
1392 #define BP_USB_INTEN_SLEEPEN (4U)          /*!< Bit position for USB_INTEN_SLEEPEN. */
1393 #define BM_USB_INTEN_SLEEPEN (0x10U)       /*!< Bit mask for USB_INTEN_SLEEPEN. */
1394 #define BS_USB_INTEN_SLEEPEN (1U)          /*!< Bit field size in bits for USB_INTEN_SLEEPEN. */
1395
1396 /*! @brief Read current value of the USB_INTEN_SLEEPEN field. */
1397 #define BR_USB_INTEN_SLEEPEN(x) (BITBAND_ACCESS8(HW_USB_INTEN_ADDR(x), BP_USB_INTEN_SLEEPEN))
1398
1399 /*! @brief Format value for bitfield USB_INTEN_SLEEPEN. */
1400 #define BF_USB_INTEN_SLEEPEN(v) ((uint8_t)((uint8_t)(v) << BP_USB_INTEN_SLEEPEN) & BM_USB_INTEN_SLEEPEN)
1401
1402 /*! @brief Set the SLEEPEN field to a new value. */
1403 #define BW_USB_INTEN_SLEEPEN(x, v) (BITBAND_ACCESS8(HW_USB_INTEN_ADDR(x), BP_USB_INTEN_SLEEPEN) = (v))
1404 /*@}*/
1405
1406 /*!
1407  * @name Register USB_INTEN, field RESUMEEN[5] (RW)
1408  *
1409  * Values:
1410  * - 0 - Disables the RESUME interrupt.
1411  * - 1 - Enables the RESUME interrupt.
1412  */
1413 /*@{*/
1414 #define BP_USB_INTEN_RESUMEEN (5U)         /*!< Bit position for USB_INTEN_RESUMEEN. */
1415 #define BM_USB_INTEN_RESUMEEN (0x20U)      /*!< Bit mask for USB_INTEN_RESUMEEN. */
1416 #define BS_USB_INTEN_RESUMEEN (1U)         /*!< Bit field size in bits for USB_INTEN_RESUMEEN. */
1417
1418 /*! @brief Read current value of the USB_INTEN_RESUMEEN field. */
1419 #define BR_USB_INTEN_RESUMEEN(x) (BITBAND_ACCESS8(HW_USB_INTEN_ADDR(x), BP_USB_INTEN_RESUMEEN))
1420
1421 /*! @brief Format value for bitfield USB_INTEN_RESUMEEN. */
1422 #define BF_USB_INTEN_RESUMEEN(v) ((uint8_t)((uint8_t)(v) << BP_USB_INTEN_RESUMEEN) & BM_USB_INTEN_RESUMEEN)
1423
1424 /*! @brief Set the RESUMEEN field to a new value. */
1425 #define BW_USB_INTEN_RESUMEEN(x, v) (BITBAND_ACCESS8(HW_USB_INTEN_ADDR(x), BP_USB_INTEN_RESUMEEN) = (v))
1426 /*@}*/
1427
1428 /*!
1429  * @name Register USB_INTEN, field ATTACHEN[6] (RW)
1430  *
1431  * Values:
1432  * - 0 - Disables the ATTACH interrupt.
1433  * - 1 - Enables the ATTACH interrupt.
1434  */
1435 /*@{*/
1436 #define BP_USB_INTEN_ATTACHEN (6U)         /*!< Bit position for USB_INTEN_ATTACHEN. */
1437 #define BM_USB_INTEN_ATTACHEN (0x40U)      /*!< Bit mask for USB_INTEN_ATTACHEN. */
1438 #define BS_USB_INTEN_ATTACHEN (1U)         /*!< Bit field size in bits for USB_INTEN_ATTACHEN. */
1439
1440 /*! @brief Read current value of the USB_INTEN_ATTACHEN field. */
1441 #define BR_USB_INTEN_ATTACHEN(x) (BITBAND_ACCESS8(HW_USB_INTEN_ADDR(x), BP_USB_INTEN_ATTACHEN))
1442
1443 /*! @brief Format value for bitfield USB_INTEN_ATTACHEN. */
1444 #define BF_USB_INTEN_ATTACHEN(v) ((uint8_t)((uint8_t)(v) << BP_USB_INTEN_ATTACHEN) & BM_USB_INTEN_ATTACHEN)
1445
1446 /*! @brief Set the ATTACHEN field to a new value. */
1447 #define BW_USB_INTEN_ATTACHEN(x, v) (BITBAND_ACCESS8(HW_USB_INTEN_ADDR(x), BP_USB_INTEN_ATTACHEN) = (v))
1448 /*@}*/
1449
1450 /*!
1451  * @name Register USB_INTEN, field STALLEN[7] (RW)
1452  *
1453  * Values:
1454  * - 0 - Diasbles the STALL interrupt.
1455  * - 1 - Enables the STALL interrupt.
1456  */
1457 /*@{*/
1458 #define BP_USB_INTEN_STALLEN (7U)          /*!< Bit position for USB_INTEN_STALLEN. */
1459 #define BM_USB_INTEN_STALLEN (0x80U)       /*!< Bit mask for USB_INTEN_STALLEN. */
1460 #define BS_USB_INTEN_STALLEN (1U)          /*!< Bit field size in bits for USB_INTEN_STALLEN. */
1461
1462 /*! @brief Read current value of the USB_INTEN_STALLEN field. */
1463 #define BR_USB_INTEN_STALLEN(x) (BITBAND_ACCESS8(HW_USB_INTEN_ADDR(x), BP_USB_INTEN_STALLEN))
1464
1465 /*! @brief Format value for bitfield USB_INTEN_STALLEN. */
1466 #define BF_USB_INTEN_STALLEN(v) ((uint8_t)((uint8_t)(v) << BP_USB_INTEN_STALLEN) & BM_USB_INTEN_STALLEN)
1467
1468 /*! @brief Set the STALLEN field to a new value. */
1469 #define BW_USB_INTEN_STALLEN(x, v) (BITBAND_ACCESS8(HW_USB_INTEN_ADDR(x), BP_USB_INTEN_STALLEN) = (v))
1470 /*@}*/
1471
1472 /*******************************************************************************
1473  * HW_USB_ERRSTAT - Error Interrupt Status register
1474  ******************************************************************************/
1475
1476 /*!
1477  * @brief HW_USB_ERRSTAT - Error Interrupt Status register (RW)
1478  *
1479  * Reset value: 0x00U
1480  *
1481  * Contains enable bits for each of the error sources within the USB Module.
1482  * Each of these bits are qualified with their respective error enable bits. All
1483  * bits of this register are logically OR'd together and the result placed in the
1484  * ERROR bit of the ISTAT register. After an interrupt bit has been set it may only
1485  * be cleared by writing a one to the respective interrupt bit. Each bit is set
1486  * as soon as the error condition is detected. Therefore, the interrupt does not
1487  * typically correspond with the end of a token being processed. This register
1488  * contains the value of 0x00 after a reset.
1489  */
1490 typedef union _hw_usb_errstat
1491 {
1492     uint8_t U;
1493     struct _hw_usb_errstat_bitfields
1494     {
1495         uint8_t PIDERR : 1;            /*!< [0]  */
1496         uint8_t CRC5EOF : 1;           /*!< [1]  */
1497         uint8_t CRC16 : 1;             /*!< [2]  */
1498         uint8_t DFN8 : 1;              /*!< [3]  */
1499         uint8_t BTOERR : 1;            /*!< [4]  */
1500         uint8_t DMAERR : 1;            /*!< [5]  */
1501         uint8_t RESERVED0 : 1;         /*!< [6]  */
1502         uint8_t BTSERR : 1;            /*!< [7]  */
1503     } B;
1504 } hw_usb_errstat_t;
1505
1506 /*!
1507  * @name Constants and macros for entire USB_ERRSTAT register
1508  */
1509 /*@{*/
1510 #define HW_USB_ERRSTAT_ADDR(x)   ((x) + 0x88U)
1511
1512 #define HW_USB_ERRSTAT(x)        (*(__IO hw_usb_errstat_t *) HW_USB_ERRSTAT_ADDR(x))
1513 #define HW_USB_ERRSTAT_RD(x)     (HW_USB_ERRSTAT(x).U)
1514 #define HW_USB_ERRSTAT_WR(x, v)  (HW_USB_ERRSTAT(x).U = (v))
1515 #define HW_USB_ERRSTAT_SET(x, v) (HW_USB_ERRSTAT_WR(x, HW_USB_ERRSTAT_RD(x) |  (v)))
1516 #define HW_USB_ERRSTAT_CLR(x, v) (HW_USB_ERRSTAT_WR(x, HW_USB_ERRSTAT_RD(x) & ~(v)))
1517 #define HW_USB_ERRSTAT_TOG(x, v) (HW_USB_ERRSTAT_WR(x, HW_USB_ERRSTAT_RD(x) ^  (v)))
1518 /*@}*/
1519
1520 /*
1521  * Constants & macros for individual USB_ERRSTAT bitfields
1522  */
1523
1524 /*!
1525  * @name Register USB_ERRSTAT, field PIDERR[0] (W1C)
1526  *
1527  * This bit is set when the PID check field fails.
1528  */
1529 /*@{*/
1530 #define BP_USB_ERRSTAT_PIDERR (0U)         /*!< Bit position for USB_ERRSTAT_PIDERR. */
1531 #define BM_USB_ERRSTAT_PIDERR (0x01U)      /*!< Bit mask for USB_ERRSTAT_PIDERR. */
1532 #define BS_USB_ERRSTAT_PIDERR (1U)         /*!< Bit field size in bits for USB_ERRSTAT_PIDERR. */
1533
1534 /*! @brief Read current value of the USB_ERRSTAT_PIDERR field. */
1535 #define BR_USB_ERRSTAT_PIDERR(x) (BITBAND_ACCESS8(HW_USB_ERRSTAT_ADDR(x), BP_USB_ERRSTAT_PIDERR))
1536
1537 /*! @brief Format value for bitfield USB_ERRSTAT_PIDERR. */
1538 #define BF_USB_ERRSTAT_PIDERR(v) ((uint8_t)((uint8_t)(v) << BP_USB_ERRSTAT_PIDERR) & BM_USB_ERRSTAT_PIDERR)
1539
1540 /*! @brief Set the PIDERR field to a new value. */
1541 #define BW_USB_ERRSTAT_PIDERR(x, v) (BITBAND_ACCESS8(HW_USB_ERRSTAT_ADDR(x), BP_USB_ERRSTAT_PIDERR) = (v))
1542 /*@}*/
1543
1544 /*!
1545  * @name Register USB_ERRSTAT, field CRC5EOF[1] (W1C)
1546  *
1547  * This error interrupt has two functions. When the USB Module is operating in
1548  * peripheral mode (HOSTMODEEN=0), this interrupt detects CRC5 errors in the token
1549  * packets generated by the host. If set the token packet was rejected due to a
1550  * CRC5 error. When the USB Module is operating in host mode (HOSTMODEEN=1), this
1551  * interrupt detects End Of Frame (EOF) error conditions. This occurs when the
1552  * USB Module is transmitting or receiving data and the SOF counter reaches zero.
1553  * This interrupt is useful when developing USB packet scheduling software to
1554  * ensure that no USB transactions cross the start of the next frame.
1555  */
1556 /*@{*/
1557 #define BP_USB_ERRSTAT_CRC5EOF (1U)        /*!< Bit position for USB_ERRSTAT_CRC5EOF. */
1558 #define BM_USB_ERRSTAT_CRC5EOF (0x02U)     /*!< Bit mask for USB_ERRSTAT_CRC5EOF. */
1559 #define BS_USB_ERRSTAT_CRC5EOF (1U)        /*!< Bit field size in bits for USB_ERRSTAT_CRC5EOF. */
1560
1561 /*! @brief Read current value of the USB_ERRSTAT_CRC5EOF field. */
1562 #define BR_USB_ERRSTAT_CRC5EOF(x) (BITBAND_ACCESS8(HW_USB_ERRSTAT_ADDR(x), BP_USB_ERRSTAT_CRC5EOF))
1563
1564 /*! @brief Format value for bitfield USB_ERRSTAT_CRC5EOF. */
1565 #define BF_USB_ERRSTAT_CRC5EOF(v) ((uint8_t)((uint8_t)(v) << BP_USB_ERRSTAT_CRC5EOF) & BM_USB_ERRSTAT_CRC5EOF)
1566
1567 /*! @brief Set the CRC5EOF field to a new value. */
1568 #define BW_USB_ERRSTAT_CRC5EOF(x, v) (BITBAND_ACCESS8(HW_USB_ERRSTAT_ADDR(x), BP_USB_ERRSTAT_CRC5EOF) = (v))
1569 /*@}*/
1570
1571 /*!
1572  * @name Register USB_ERRSTAT, field CRC16[2] (W1C)
1573  *
1574  * This bit is set when a data packet is rejected due to a CRC16 error.
1575  */
1576 /*@{*/
1577 #define BP_USB_ERRSTAT_CRC16 (2U)          /*!< Bit position for USB_ERRSTAT_CRC16. */
1578 #define BM_USB_ERRSTAT_CRC16 (0x04U)       /*!< Bit mask for USB_ERRSTAT_CRC16. */
1579 #define BS_USB_ERRSTAT_CRC16 (1U)          /*!< Bit field size in bits for USB_ERRSTAT_CRC16. */
1580
1581 /*! @brief Read current value of the USB_ERRSTAT_CRC16 field. */
1582 #define BR_USB_ERRSTAT_CRC16(x) (BITBAND_ACCESS8(HW_USB_ERRSTAT_ADDR(x), BP_USB_ERRSTAT_CRC16))
1583
1584 /*! @brief Format value for bitfield USB_ERRSTAT_CRC16. */
1585 #define BF_USB_ERRSTAT_CRC16(v) ((uint8_t)((uint8_t)(v) << BP_USB_ERRSTAT_CRC16) & BM_USB_ERRSTAT_CRC16)
1586
1587 /*! @brief Set the CRC16 field to a new value. */
1588 #define BW_USB_ERRSTAT_CRC16(x, v) (BITBAND_ACCESS8(HW_USB_ERRSTAT_ADDR(x), BP_USB_ERRSTAT_CRC16) = (v))
1589 /*@}*/
1590
1591 /*!
1592  * @name Register USB_ERRSTAT, field DFN8[3] (W1C)
1593  *
1594  * This bit is set if the data field received was not 8 bits in length. USB
1595  * Specification 1.0 requires that data fields be an integral number of bytes. If the
1596  * data field was not an integral number of bytes, this bit is set.
1597  */
1598 /*@{*/
1599 #define BP_USB_ERRSTAT_DFN8  (3U)          /*!< Bit position for USB_ERRSTAT_DFN8. */
1600 #define BM_USB_ERRSTAT_DFN8  (0x08U)       /*!< Bit mask for USB_ERRSTAT_DFN8. */
1601 #define BS_USB_ERRSTAT_DFN8  (1U)          /*!< Bit field size in bits for USB_ERRSTAT_DFN8. */
1602
1603 /*! @brief Read current value of the USB_ERRSTAT_DFN8 field. */
1604 #define BR_USB_ERRSTAT_DFN8(x) (BITBAND_ACCESS8(HW_USB_ERRSTAT_ADDR(x), BP_USB_ERRSTAT_DFN8))
1605
1606 /*! @brief Format value for bitfield USB_ERRSTAT_DFN8. */
1607 #define BF_USB_ERRSTAT_DFN8(v) ((uint8_t)((uint8_t)(v) << BP_USB_ERRSTAT_DFN8) & BM_USB_ERRSTAT_DFN8)
1608
1609 /*! @brief Set the DFN8 field to a new value. */
1610 #define BW_USB_ERRSTAT_DFN8(x, v) (BITBAND_ACCESS8(HW_USB_ERRSTAT_ADDR(x), BP_USB_ERRSTAT_DFN8) = (v))
1611 /*@}*/
1612
1613 /*!
1614  * @name Register USB_ERRSTAT, field BTOERR[4] (W1C)
1615  *
1616  * This bit is set when a bus turnaround timeout error occurs. The USB module
1617  * contains a bus turnaround timer that keeps track of the amount of time elapsed
1618  * between the token and data phases of a SETUP or OUT TOKEN or the data and
1619  * handshake phases of a IN TOKEN. If more than 16 bit times are counted from the
1620  * previous EOP before a transition from IDLE, a bus turnaround timeout error occurs.
1621  */
1622 /*@{*/
1623 #define BP_USB_ERRSTAT_BTOERR (4U)         /*!< Bit position for USB_ERRSTAT_BTOERR. */
1624 #define BM_USB_ERRSTAT_BTOERR (0x10U)      /*!< Bit mask for USB_ERRSTAT_BTOERR. */
1625 #define BS_USB_ERRSTAT_BTOERR (1U)         /*!< Bit field size in bits for USB_ERRSTAT_BTOERR. */
1626
1627 /*! @brief Read current value of the USB_ERRSTAT_BTOERR field. */
1628 #define BR_USB_ERRSTAT_BTOERR(x) (BITBAND_ACCESS8(HW_USB_ERRSTAT_ADDR(x), BP_USB_ERRSTAT_BTOERR))
1629
1630 /*! @brief Format value for bitfield USB_ERRSTAT_BTOERR. */
1631 #define BF_USB_ERRSTAT_BTOERR(v) ((uint8_t)((uint8_t)(v) << BP_USB_ERRSTAT_BTOERR) & BM_USB_ERRSTAT_BTOERR)
1632
1633 /*! @brief Set the BTOERR field to a new value. */
1634 #define BW_USB_ERRSTAT_BTOERR(x, v) (BITBAND_ACCESS8(HW_USB_ERRSTAT_ADDR(x), BP_USB_ERRSTAT_BTOERR) = (v))
1635 /*@}*/
1636
1637 /*!
1638  * @name Register USB_ERRSTAT, field DMAERR[5] (W1C)
1639  *
1640  * This bit is set if the USB Module has requested a DMA access to read a new
1641  * BDT but has not been given the bus before it needs to receive or transmit data.
1642  * If processing a TX transfer this would cause a transmit data underflow
1643  * condition. If processing a RX transfer this would cause a receive data overflow
1644  * condition. This interrupt is useful when developing device arbitration hardware for
1645  * the microprocessor and the USB module to minimize bus request and bus grant
1646  * latency. This bit is also set if a data packet to or from the host is larger
1647  * than the buffer size allocated in the BDT. In this case the data packet is
1648  * truncated as it is put in buffer memory.
1649  */
1650 /*@{*/
1651 #define BP_USB_ERRSTAT_DMAERR (5U)         /*!< Bit position for USB_ERRSTAT_DMAERR. */
1652 #define BM_USB_ERRSTAT_DMAERR (0x20U)      /*!< Bit mask for USB_ERRSTAT_DMAERR. */
1653 #define BS_USB_ERRSTAT_DMAERR (1U)         /*!< Bit field size in bits for USB_ERRSTAT_DMAERR. */
1654
1655 /*! @brief Read current value of the USB_ERRSTAT_DMAERR field. */
1656 #define BR_USB_ERRSTAT_DMAERR(x) (BITBAND_ACCESS8(HW_USB_ERRSTAT_ADDR(x), BP_USB_ERRSTAT_DMAERR))
1657
1658 /*! @brief Format value for bitfield USB_ERRSTAT_DMAERR. */
1659 #define BF_USB_ERRSTAT_DMAERR(v) ((uint8_t)((uint8_t)(v) << BP_USB_ERRSTAT_DMAERR) & BM_USB_ERRSTAT_DMAERR)
1660
1661 /*! @brief Set the DMAERR field to a new value. */
1662 #define BW_USB_ERRSTAT_DMAERR(x, v) (BITBAND_ACCESS8(HW_USB_ERRSTAT_ADDR(x), BP_USB_ERRSTAT_DMAERR) = (v))
1663 /*@}*/
1664
1665 /*!
1666  * @name Register USB_ERRSTAT, field BTSERR[7] (W1C)
1667  *
1668  * This bit is set when a bit stuff error is detected. If set, the corresponding
1669  * packet is rejected due to the error.
1670  */
1671 /*@{*/
1672 #define BP_USB_ERRSTAT_BTSERR (7U)         /*!< Bit position for USB_ERRSTAT_BTSERR. */
1673 #define BM_USB_ERRSTAT_BTSERR (0x80U)      /*!< Bit mask for USB_ERRSTAT_BTSERR. */
1674 #define BS_USB_ERRSTAT_BTSERR (1U)         /*!< Bit field size in bits for USB_ERRSTAT_BTSERR. */
1675
1676 /*! @brief Read current value of the USB_ERRSTAT_BTSERR field. */
1677 #define BR_USB_ERRSTAT_BTSERR(x) (BITBAND_ACCESS8(HW_USB_ERRSTAT_ADDR(x), BP_USB_ERRSTAT_BTSERR))
1678
1679 /*! @brief Format value for bitfield USB_ERRSTAT_BTSERR. */
1680 #define BF_USB_ERRSTAT_BTSERR(v) ((uint8_t)((uint8_t)(v) << BP_USB_ERRSTAT_BTSERR) & BM_USB_ERRSTAT_BTSERR)
1681
1682 /*! @brief Set the BTSERR field to a new value. */
1683 #define BW_USB_ERRSTAT_BTSERR(x, v) (BITBAND_ACCESS8(HW_USB_ERRSTAT_ADDR(x), BP_USB_ERRSTAT_BTSERR) = (v))
1684 /*@}*/
1685
1686 /*******************************************************************************
1687  * HW_USB_ERREN - Error Interrupt Enable register
1688  ******************************************************************************/
1689
1690 /*!
1691  * @brief HW_USB_ERREN - Error Interrupt Enable register (RW)
1692  *
1693  * Reset value: 0x00U
1694  *
1695  * Contains enable bits for each of the error interrupt sources within the USB
1696  * module. Setting any of these bits enables the respective interrupt source in
1697  * ERRSTAT. Each bit is set as soon as the error condition is detected. Therefore,
1698  * the interrupt does not typically correspond with the end of a token being
1699  * processed. This register contains the value of 0x00 after a reset.
1700  */
1701 typedef union _hw_usb_erren
1702 {
1703     uint8_t U;
1704     struct _hw_usb_erren_bitfields
1705     {
1706         uint8_t PIDERREN : 1;          /*!< [0] PIDERR Interrupt Enable */
1707         uint8_t CRC5EOFEN : 1;         /*!< [1] CRC5/EOF Interrupt Enable */
1708         uint8_t CRC16EN : 1;           /*!< [2] CRC16 Interrupt Enable */
1709         uint8_t DFN8EN : 1;            /*!< [3] DFN8 Interrupt Enable */
1710         uint8_t BTOERREN : 1;          /*!< [4] BTOERR Interrupt Enable */
1711         uint8_t DMAERREN : 1;          /*!< [5] DMAERR Interrupt Enable */
1712         uint8_t RESERVED0 : 1;         /*!< [6]  */
1713         uint8_t BTSERREN : 1;          /*!< [7] BTSERR Interrupt Enable */
1714     } B;
1715 } hw_usb_erren_t;
1716
1717 /*!
1718  * @name Constants and macros for entire USB_ERREN register
1719  */
1720 /*@{*/
1721 #define HW_USB_ERREN_ADDR(x)     ((x) + 0x8CU)
1722
1723 #define HW_USB_ERREN(x)          (*(__IO hw_usb_erren_t *) HW_USB_ERREN_ADDR(x))
1724 #define HW_USB_ERREN_RD(x)       (HW_USB_ERREN(x).U)
1725 #define HW_USB_ERREN_WR(x, v)    (HW_USB_ERREN(x).U = (v))
1726 #define HW_USB_ERREN_SET(x, v)   (HW_USB_ERREN_WR(x, HW_USB_ERREN_RD(x) |  (v)))
1727 #define HW_USB_ERREN_CLR(x, v)   (HW_USB_ERREN_WR(x, HW_USB_ERREN_RD(x) & ~(v)))
1728 #define HW_USB_ERREN_TOG(x, v)   (HW_USB_ERREN_WR(x, HW_USB_ERREN_RD(x) ^  (v)))
1729 /*@}*/
1730
1731 /*
1732  * Constants & macros for individual USB_ERREN bitfields
1733  */
1734
1735 /*!
1736  * @name Register USB_ERREN, field PIDERREN[0] (RW)
1737  *
1738  * Values:
1739  * - 0 - Disables the PIDERR interrupt.
1740  * - 1 - Enters the PIDERR interrupt.
1741  */
1742 /*@{*/
1743 #define BP_USB_ERREN_PIDERREN (0U)         /*!< Bit position for USB_ERREN_PIDERREN. */
1744 #define BM_USB_ERREN_PIDERREN (0x01U)      /*!< Bit mask for USB_ERREN_PIDERREN. */
1745 #define BS_USB_ERREN_PIDERREN (1U)         /*!< Bit field size in bits for USB_ERREN_PIDERREN. */
1746
1747 /*! @brief Read current value of the USB_ERREN_PIDERREN field. */
1748 #define BR_USB_ERREN_PIDERREN(x) (BITBAND_ACCESS8(HW_USB_ERREN_ADDR(x), BP_USB_ERREN_PIDERREN))
1749
1750 /*! @brief Format value for bitfield USB_ERREN_PIDERREN. */
1751 #define BF_USB_ERREN_PIDERREN(v) ((uint8_t)((uint8_t)(v) << BP_USB_ERREN_PIDERREN) & BM_USB_ERREN_PIDERREN)
1752
1753 /*! @brief Set the PIDERREN field to a new value. */
1754 #define BW_USB_ERREN_PIDERREN(x, v) (BITBAND_ACCESS8(HW_USB_ERREN_ADDR(x), BP_USB_ERREN_PIDERREN) = (v))
1755 /*@}*/
1756
1757 /*!
1758  * @name Register USB_ERREN, field CRC5EOFEN[1] (RW)
1759  *
1760  * Values:
1761  * - 0 - Disables the CRC5/EOF interrupt.
1762  * - 1 - Enables the CRC5/EOF interrupt.
1763  */
1764 /*@{*/
1765 #define BP_USB_ERREN_CRC5EOFEN (1U)        /*!< Bit position for USB_ERREN_CRC5EOFEN. */
1766 #define BM_USB_ERREN_CRC5EOFEN (0x02U)     /*!< Bit mask for USB_ERREN_CRC5EOFEN. */
1767 #define BS_USB_ERREN_CRC5EOFEN (1U)        /*!< Bit field size in bits for USB_ERREN_CRC5EOFEN. */
1768
1769 /*! @brief Read current value of the USB_ERREN_CRC5EOFEN field. */
1770 #define BR_USB_ERREN_CRC5EOFEN(x) (BITBAND_ACCESS8(HW_USB_ERREN_ADDR(x), BP_USB_ERREN_CRC5EOFEN))
1771
1772 /*! @brief Format value for bitfield USB_ERREN_CRC5EOFEN. */
1773 #define BF_USB_ERREN_CRC5EOFEN(v) ((uint8_t)((uint8_t)(v) << BP_USB_ERREN_CRC5EOFEN) & BM_USB_ERREN_CRC5EOFEN)
1774
1775 /*! @brief Set the CRC5EOFEN field to a new value. */
1776 #define BW_USB_ERREN_CRC5EOFEN(x, v) (BITBAND_ACCESS8(HW_USB_ERREN_ADDR(x), BP_USB_ERREN_CRC5EOFEN) = (v))
1777 /*@}*/
1778
1779 /*!
1780  * @name Register USB_ERREN, field CRC16EN[2] (RW)
1781  *
1782  * Values:
1783  * - 0 - Disables the CRC16 interrupt.
1784  * - 1 - Enables the CRC16 interrupt.
1785  */
1786 /*@{*/
1787 #define BP_USB_ERREN_CRC16EN (2U)          /*!< Bit position for USB_ERREN_CRC16EN. */
1788 #define BM_USB_ERREN_CRC16EN (0x04U)       /*!< Bit mask for USB_ERREN_CRC16EN. */
1789 #define BS_USB_ERREN_CRC16EN (1U)          /*!< Bit field size in bits for USB_ERREN_CRC16EN. */
1790
1791 /*! @brief Read current value of the USB_ERREN_CRC16EN field. */
1792 #define BR_USB_ERREN_CRC16EN(x) (BITBAND_ACCESS8(HW_USB_ERREN_ADDR(x), BP_USB_ERREN_CRC16EN))
1793
1794 /*! @brief Format value for bitfield USB_ERREN_CRC16EN. */
1795 #define BF_USB_ERREN_CRC16EN(v) ((uint8_t)((uint8_t)(v) << BP_USB_ERREN_CRC16EN) & BM_USB_ERREN_CRC16EN)
1796
1797 /*! @brief Set the CRC16EN field to a new value. */
1798 #define BW_USB_ERREN_CRC16EN(x, v) (BITBAND_ACCESS8(HW_USB_ERREN_ADDR(x), BP_USB_ERREN_CRC16EN) = (v))
1799 /*@}*/
1800
1801 /*!
1802  * @name Register USB_ERREN, field DFN8EN[3] (RW)
1803  *
1804  * Values:
1805  * - 0 - Disables the DFN8 interrupt.
1806  * - 1 - Enables the DFN8 interrupt.
1807  */
1808 /*@{*/
1809 #define BP_USB_ERREN_DFN8EN  (3U)          /*!< Bit position for USB_ERREN_DFN8EN. */
1810 #define BM_USB_ERREN_DFN8EN  (0x08U)       /*!< Bit mask for USB_ERREN_DFN8EN. */
1811 #define BS_USB_ERREN_DFN8EN  (1U)          /*!< Bit field size in bits for USB_ERREN_DFN8EN. */
1812
1813 /*! @brief Read current value of the USB_ERREN_DFN8EN field. */
1814 #define BR_USB_ERREN_DFN8EN(x) (BITBAND_ACCESS8(HW_USB_ERREN_ADDR(x), BP_USB_ERREN_DFN8EN))
1815
1816 /*! @brief Format value for bitfield USB_ERREN_DFN8EN. */
1817 #define BF_USB_ERREN_DFN8EN(v) ((uint8_t)((uint8_t)(v) << BP_USB_ERREN_DFN8EN) & BM_USB_ERREN_DFN8EN)
1818
1819 /*! @brief Set the DFN8EN field to a new value. */
1820 #define BW_USB_ERREN_DFN8EN(x, v) (BITBAND_ACCESS8(HW_USB_ERREN_ADDR(x), BP_USB_ERREN_DFN8EN) = (v))
1821 /*@}*/
1822
1823 /*!
1824  * @name Register USB_ERREN, field BTOERREN[4] (RW)
1825  *
1826  * Values:
1827  * - 0 - Disables the BTOERR interrupt.
1828  * - 1 - Enables the BTOERR interrupt.
1829  */
1830 /*@{*/
1831 #define BP_USB_ERREN_BTOERREN (4U)         /*!< Bit position for USB_ERREN_BTOERREN. */
1832 #define BM_USB_ERREN_BTOERREN (0x10U)      /*!< Bit mask for USB_ERREN_BTOERREN. */
1833 #define BS_USB_ERREN_BTOERREN (1U)         /*!< Bit field size in bits for USB_ERREN_BTOERREN. */
1834
1835 /*! @brief Read current value of the USB_ERREN_BTOERREN field. */
1836 #define BR_USB_ERREN_BTOERREN(x) (BITBAND_ACCESS8(HW_USB_ERREN_ADDR(x), BP_USB_ERREN_BTOERREN))
1837
1838 /*! @brief Format value for bitfield USB_ERREN_BTOERREN. */
1839 #define BF_USB_ERREN_BTOERREN(v) ((uint8_t)((uint8_t)(v) << BP_USB_ERREN_BTOERREN) & BM_USB_ERREN_BTOERREN)
1840
1841 /*! @brief Set the BTOERREN field to a new value. */
1842 #define BW_USB_ERREN_BTOERREN(x, v) (BITBAND_ACCESS8(HW_USB_ERREN_ADDR(x), BP_USB_ERREN_BTOERREN) = (v))
1843 /*@}*/
1844
1845 /*!
1846  * @name Register USB_ERREN, field DMAERREN[5] (RW)
1847  *
1848  * Values:
1849  * - 0 - Disables the DMAERR interrupt.
1850  * - 1 - Enables the DMAERR interrupt.
1851  */
1852 /*@{*/
1853 #define BP_USB_ERREN_DMAERREN (5U)         /*!< Bit position for USB_ERREN_DMAERREN. */
1854 #define BM_USB_ERREN_DMAERREN (0x20U)      /*!< Bit mask for USB_ERREN_DMAERREN. */
1855 #define BS_USB_ERREN_DMAERREN (1U)         /*!< Bit field size in bits for USB_ERREN_DMAERREN. */
1856
1857 /*! @brief Read current value of the USB_ERREN_DMAERREN field. */
1858 #define BR_USB_ERREN_DMAERREN(x) (BITBAND_ACCESS8(HW_USB_ERREN_ADDR(x), BP_USB_ERREN_DMAERREN))
1859
1860 /*! @brief Format value for bitfield USB_ERREN_DMAERREN. */
1861 #define BF_USB_ERREN_DMAERREN(v) ((uint8_t)((uint8_t)(v) << BP_USB_ERREN_DMAERREN) & BM_USB_ERREN_DMAERREN)
1862
1863 /*! @brief Set the DMAERREN field to a new value. */
1864 #define BW_USB_ERREN_DMAERREN(x, v) (BITBAND_ACCESS8(HW_USB_ERREN_ADDR(x), BP_USB_ERREN_DMAERREN) = (v))
1865 /*@}*/
1866
1867 /*!
1868  * @name Register USB_ERREN, field BTSERREN[7] (RW)
1869  *
1870  * Values:
1871  * - 0 - Disables the BTSERR interrupt.
1872  * - 1 - Enables the BTSERR interrupt.
1873  */
1874 /*@{*/
1875 #define BP_USB_ERREN_BTSERREN (7U)         /*!< Bit position for USB_ERREN_BTSERREN. */
1876 #define BM_USB_ERREN_BTSERREN (0x80U)      /*!< Bit mask for USB_ERREN_BTSERREN. */
1877 #define BS_USB_ERREN_BTSERREN (1U)         /*!< Bit field size in bits for USB_ERREN_BTSERREN. */
1878
1879 /*! @brief Read current value of the USB_ERREN_BTSERREN field. */
1880 #define BR_USB_ERREN_BTSERREN(x) (BITBAND_ACCESS8(HW_USB_ERREN_ADDR(x), BP_USB_ERREN_BTSERREN))
1881
1882 /*! @brief Format value for bitfield USB_ERREN_BTSERREN. */
1883 #define BF_USB_ERREN_BTSERREN(v) ((uint8_t)((uint8_t)(v) << BP_USB_ERREN_BTSERREN) & BM_USB_ERREN_BTSERREN)
1884
1885 /*! @brief Set the BTSERREN field to a new value. */
1886 #define BW_USB_ERREN_BTSERREN(x, v) (BITBAND_ACCESS8(HW_USB_ERREN_ADDR(x), BP_USB_ERREN_BTSERREN) = (v))
1887 /*@}*/
1888
1889 /*******************************************************************************
1890  * HW_USB_STAT - Status register
1891  ******************************************************************************/
1892
1893 /*!
1894  * @brief HW_USB_STAT - Status register (RO)
1895  *
1896  * Reset value: 0x00U
1897  *
1898  * Reports the transaction status within the USB module. When the processor's
1899  * interrupt controller has received a TOKDNE, interrupt the Status Register must
1900  * be read to determine the status of the previous endpoint communication. The
1901  * data in the status register is valid when TOKDNE interrupt is asserted. The
1902  * Status register is actually a read window into a status FIFO maintained by the USB
1903  * module. When the USB module uses a BD, it updates the Status register. If
1904  * another USB transaction is performed before the TOKDNE interrupt is serviced, the
1905  * USB module stores the status of the next transaction in the STAT FIFO. Thus
1906  * STAT is actually a four byte FIFO that allows the processor core to process one
1907  * transaction while the SIE is processing the next transaction. Clearing the
1908  * TOKDNE bit in the ISTAT register causes the SIE to update STAT with the contents
1909  * of the next STAT value. If the data in the STAT holding register is valid, the
1910  * SIE immediately reasserts to TOKDNE interrupt.
1911  */
1912 typedef union _hw_usb_stat
1913 {
1914     uint8_t U;
1915     struct _hw_usb_stat_bitfields
1916     {
1917         uint8_t RESERVED0 : 2;         /*!< [1:0]  */
1918         uint8_t ODD : 1;               /*!< [2]  */
1919         uint8_t TX : 1;                /*!< [3] Transmit Indicator */
1920         uint8_t ENDP : 4;              /*!< [7:4]  */
1921     } B;
1922 } hw_usb_stat_t;
1923
1924 /*!
1925  * @name Constants and macros for entire USB_STAT register
1926  */
1927 /*@{*/
1928 #define HW_USB_STAT_ADDR(x)      ((x) + 0x90U)
1929
1930 #define HW_USB_STAT(x)           (*(__I hw_usb_stat_t *) HW_USB_STAT_ADDR(x))
1931 #define HW_USB_STAT_RD(x)        (HW_USB_STAT(x).U)
1932 /*@}*/
1933
1934 /*
1935  * Constants & macros for individual USB_STAT bitfields
1936  */
1937
1938 /*!
1939  * @name Register USB_STAT, field ODD[2] (RO)
1940  *
1941  * This bit is set if the last buffer descriptor updated was in the odd bank of
1942  * the BDT.
1943  */
1944 /*@{*/
1945 #define BP_USB_STAT_ODD      (2U)          /*!< Bit position for USB_STAT_ODD. */
1946 #define BM_USB_STAT_ODD      (0x04U)       /*!< Bit mask for USB_STAT_ODD. */
1947 #define BS_USB_STAT_ODD      (1U)          /*!< Bit field size in bits for USB_STAT_ODD. */
1948
1949 /*! @brief Read current value of the USB_STAT_ODD field. */
1950 #define BR_USB_STAT_ODD(x)   (BITBAND_ACCESS8(HW_USB_STAT_ADDR(x), BP_USB_STAT_ODD))
1951 /*@}*/
1952
1953 /*!
1954  * @name Register USB_STAT, field TX[3] (RO)
1955  *
1956  * Values:
1957  * - 0 - The most recent transaction was a receive operation.
1958  * - 1 - The most recent transaction was a transmit operation.
1959  */
1960 /*@{*/
1961 #define BP_USB_STAT_TX       (3U)          /*!< Bit position for USB_STAT_TX. */
1962 #define BM_USB_STAT_TX       (0x08U)       /*!< Bit mask for USB_STAT_TX. */
1963 #define BS_USB_STAT_TX       (1U)          /*!< Bit field size in bits for USB_STAT_TX. */
1964
1965 /*! @brief Read current value of the USB_STAT_TX field. */
1966 #define BR_USB_STAT_TX(x)    (BITBAND_ACCESS8(HW_USB_STAT_ADDR(x), BP_USB_STAT_TX))
1967 /*@}*/
1968
1969 /*!
1970  * @name Register USB_STAT, field ENDP[7:4] (RO)
1971  *
1972  * This four-bit field encodes the endpoint address that received or transmitted
1973  * the previous token. This allows the processor core to determine the BDT entry
1974  * that was updated by the last USB transaction.
1975  */
1976 /*@{*/
1977 #define BP_USB_STAT_ENDP     (4U)          /*!< Bit position for USB_STAT_ENDP. */
1978 #define BM_USB_STAT_ENDP     (0xF0U)       /*!< Bit mask for USB_STAT_ENDP. */
1979 #define BS_USB_STAT_ENDP     (4U)          /*!< Bit field size in bits for USB_STAT_ENDP. */
1980
1981 /*! @brief Read current value of the USB_STAT_ENDP field. */
1982 #define BR_USB_STAT_ENDP(x)  (HW_USB_STAT(x).B.ENDP)
1983 /*@}*/
1984
1985 /*******************************************************************************
1986  * HW_USB_CTL - Control register
1987  ******************************************************************************/
1988
1989 /*!
1990  * @brief HW_USB_CTL - Control register (RW)
1991  *
1992  * Reset value: 0x00U
1993  *
1994  * Provides various control and configuration information for the USB module.
1995  */
1996 typedef union _hw_usb_ctl
1997 {
1998     uint8_t U;
1999     struct _hw_usb_ctl_bitfields
2000     {
2001         uint8_t USBENSOFEN : 1;        /*!< [0] USB Enable */
2002         uint8_t ODDRST : 1;            /*!< [1]  */
2003         uint8_t RESUME : 1;            /*!< [2]  */
2004         uint8_t HOSTMODEEN : 1;        /*!< [3]  */
2005         uint8_t RESET : 1;             /*!< [4]  */
2006         uint8_t TXSUSPENDTOKENBUSY : 1; /*!< [5]  */
2007         uint8_t SE0 : 1;               /*!< [6] Live USB Single Ended Zero signal */
2008         uint8_t JSTATE : 1;            /*!< [7] Live USB differential receiver JSTATE
2009                                         * signal */
2010     } B;
2011 } hw_usb_ctl_t;
2012
2013 /*!
2014  * @name Constants and macros for entire USB_CTL register
2015  */
2016 /*@{*/
2017 #define HW_USB_CTL_ADDR(x)       ((x) + 0x94U)
2018
2019 #define HW_USB_CTL(x)            (*(__IO hw_usb_ctl_t *) HW_USB_CTL_ADDR(x))
2020 #define HW_USB_CTL_RD(x)         (HW_USB_CTL(x).U)
2021 #define HW_USB_CTL_WR(x, v)      (HW_USB_CTL(x).U = (v))
2022 #define HW_USB_CTL_SET(x, v)     (HW_USB_CTL_WR(x, HW_USB_CTL_RD(x) |  (v)))
2023 #define HW_USB_CTL_CLR(x, v)     (HW_USB_CTL_WR(x, HW_USB_CTL_RD(x) & ~(v)))
2024 #define HW_USB_CTL_TOG(x, v)     (HW_USB_CTL_WR(x, HW_USB_CTL_RD(x) ^  (v)))
2025 /*@}*/
2026
2027 /*
2028  * Constants & macros for individual USB_CTL bitfields
2029  */
2030
2031 /*!
2032  * @name Register USB_CTL, field USBENSOFEN[0] (RW)
2033  *
2034  * Setting this bit enables the USB-FS to operate; clearing it disables the
2035  * USB-FS. Setting the bit causes the SIE to reset all of its ODD bits to the BDTs.
2036  * Therefore, setting this bit resets much of the logic in the SIE. When host mode
2037  * is enabled, clearing this bit causes the SIE to stop sending SOF tokens.
2038  *
2039  * Values:
2040  * - 0 - Disables the USB Module.
2041  * - 1 - Enables the USB Module.
2042  */
2043 /*@{*/
2044 #define BP_USB_CTL_USBENSOFEN (0U)         /*!< Bit position for USB_CTL_USBENSOFEN. */
2045 #define BM_USB_CTL_USBENSOFEN (0x01U)      /*!< Bit mask for USB_CTL_USBENSOFEN. */
2046 #define BS_USB_CTL_USBENSOFEN (1U)         /*!< Bit field size in bits for USB_CTL_USBENSOFEN. */
2047
2048 /*! @brief Read current value of the USB_CTL_USBENSOFEN field. */
2049 #define BR_USB_CTL_USBENSOFEN(x) (BITBAND_ACCESS8(HW_USB_CTL_ADDR(x), BP_USB_CTL_USBENSOFEN))
2050
2051 /*! @brief Format value for bitfield USB_CTL_USBENSOFEN. */
2052 #define BF_USB_CTL_USBENSOFEN(v) ((uint8_t)((uint8_t)(v) << BP_USB_CTL_USBENSOFEN) & BM_USB_CTL_USBENSOFEN)
2053
2054 /*! @brief Set the USBENSOFEN field to a new value. */
2055 #define BW_USB_CTL_USBENSOFEN(x, v) (BITBAND_ACCESS8(HW_USB_CTL_ADDR(x), BP_USB_CTL_USBENSOFEN) = (v))
2056 /*@}*/
2057
2058 /*!
2059  * @name Register USB_CTL, field ODDRST[1] (RW)
2060  *
2061  * Setting this bit to 1 resets all the BDT ODD ping/pong fields to 0, which
2062  * then specifies the EVEN BDT bank.
2063  */
2064 /*@{*/
2065 #define BP_USB_CTL_ODDRST    (1U)          /*!< Bit position for USB_CTL_ODDRST. */
2066 #define BM_USB_CTL_ODDRST    (0x02U)       /*!< Bit mask for USB_CTL_ODDRST. */
2067 #define BS_USB_CTL_ODDRST    (1U)          /*!< Bit field size in bits for USB_CTL_ODDRST. */
2068
2069 /*! @brief Read current value of the USB_CTL_ODDRST field. */
2070 #define BR_USB_CTL_ODDRST(x) (BITBAND_ACCESS8(HW_USB_CTL_ADDR(x), BP_USB_CTL_ODDRST))
2071
2072 /*! @brief Format value for bitfield USB_CTL_ODDRST. */
2073 #define BF_USB_CTL_ODDRST(v) ((uint8_t)((uint8_t)(v) << BP_USB_CTL_ODDRST) & BM_USB_CTL_ODDRST)
2074
2075 /*! @brief Set the ODDRST field to a new value. */
2076 #define BW_USB_CTL_ODDRST(x, v) (BITBAND_ACCESS8(HW_USB_CTL_ADDR(x), BP_USB_CTL_ODDRST) = (v))
2077 /*@}*/
2078
2079 /*!
2080  * @name Register USB_CTL, field RESUME[2] (RW)
2081  *
2082  * When set to 1 this bit enables the USB Module to execute resume signaling.
2083  * This allows the USB Module to perform remote wake-up. Software must set RESUME
2084  * to 1 for the required amount of time and then clear it to 0. If the HOSTMODEEN
2085  * bit is set, the USB module appends a Low Speed End of Packet to the Resume
2086  * signaling when the RESUME bit is cleared. For more information on RESUME
2087  * signaling see Section 7.1.4.5 of the USB specification version 1.0.
2088  */
2089 /*@{*/
2090 #define BP_USB_CTL_RESUME    (2U)          /*!< Bit position for USB_CTL_RESUME. */
2091 #define BM_USB_CTL_RESUME    (0x04U)       /*!< Bit mask for USB_CTL_RESUME. */
2092 #define BS_USB_CTL_RESUME    (1U)          /*!< Bit field size in bits for USB_CTL_RESUME. */
2093
2094 /*! @brief Read current value of the USB_CTL_RESUME field. */
2095 #define BR_USB_CTL_RESUME(x) (BITBAND_ACCESS8(HW_USB_CTL_ADDR(x), BP_USB_CTL_RESUME))
2096
2097 /*! @brief Format value for bitfield USB_CTL_RESUME. */
2098 #define BF_USB_CTL_RESUME(v) ((uint8_t)((uint8_t)(v) << BP_USB_CTL_RESUME) & BM_USB_CTL_RESUME)
2099
2100 /*! @brief Set the RESUME field to a new value. */
2101 #define BW_USB_CTL_RESUME(x, v) (BITBAND_ACCESS8(HW_USB_CTL_ADDR(x), BP_USB_CTL_RESUME) = (v))
2102 /*@}*/
2103
2104 /*!
2105  * @name Register USB_CTL, field HOSTMODEEN[3] (RW)
2106  *
2107  * When set to 1, this bit enables the USB Module to operate in Host mode. In
2108  * host mode, the USB module performs USB transactions under the programmed control
2109  * of the host processor.
2110  */
2111 /*@{*/
2112 #define BP_USB_CTL_HOSTMODEEN (3U)         /*!< Bit position for USB_CTL_HOSTMODEEN. */
2113 #define BM_USB_CTL_HOSTMODEEN (0x08U)      /*!< Bit mask for USB_CTL_HOSTMODEEN. */
2114 #define BS_USB_CTL_HOSTMODEEN (1U)         /*!< Bit field size in bits for USB_CTL_HOSTMODEEN. */
2115
2116 /*! @brief Read current value of the USB_CTL_HOSTMODEEN field. */
2117 #define BR_USB_CTL_HOSTMODEEN(x) (BITBAND_ACCESS8(HW_USB_CTL_ADDR(x), BP_USB_CTL_HOSTMODEEN))
2118
2119 /*! @brief Format value for bitfield USB_CTL_HOSTMODEEN. */
2120 #define BF_USB_CTL_HOSTMODEEN(v) ((uint8_t)((uint8_t)(v) << BP_USB_CTL_HOSTMODEEN) & BM_USB_CTL_HOSTMODEEN)
2121
2122 /*! @brief Set the HOSTMODEEN field to a new value. */
2123 #define BW_USB_CTL_HOSTMODEEN(x, v) (BITBAND_ACCESS8(HW_USB_CTL_ADDR(x), BP_USB_CTL_HOSTMODEEN) = (v))
2124 /*@}*/
2125
2126 /*!
2127  * @name Register USB_CTL, field RESET[4] (RW)
2128  *
2129  * Setting this bit enables the USB Module to generate USB reset signaling. This
2130  * allows the USB Module to reset USB peripherals. This control signal is only
2131  * valid in Host mode (HOSTMODEEN=1). Software must set RESET to 1 for the
2132  * required amount of time and then clear it to 0 to end reset signaling. For more
2133  * information on reset signaling see Section 7.1.4.3 of the USB specification version
2134  * 1.0.
2135  */
2136 /*@{*/
2137 #define BP_USB_CTL_RESET     (4U)          /*!< Bit position for USB_CTL_RESET. */
2138 #define BM_USB_CTL_RESET     (0x10U)       /*!< Bit mask for USB_CTL_RESET. */
2139 #define BS_USB_CTL_RESET     (1U)          /*!< Bit field size in bits for USB_CTL_RESET. */
2140
2141 /*! @brief Read current value of the USB_CTL_RESET field. */
2142 #define BR_USB_CTL_RESET(x)  (BITBAND_ACCESS8(HW_USB_CTL_ADDR(x), BP_USB_CTL_RESET))
2143
2144 /*! @brief Format value for bitfield USB_CTL_RESET. */
2145 #define BF_USB_CTL_RESET(v)  ((uint8_t)((uint8_t)(v) << BP_USB_CTL_RESET) & BM_USB_CTL_RESET)
2146
2147 /*! @brief Set the RESET field to a new value. */
2148 #define BW_USB_CTL_RESET(x, v) (BITBAND_ACCESS8(HW_USB_CTL_ADDR(x), BP_USB_CTL_RESET) = (v))
2149 /*@}*/
2150
2151 /*!
2152  * @name Register USB_CTL, field TXSUSPENDTOKENBUSY[5] (RW)
2153  *
2154  * In Host mode, TOKEN_BUSY is set when the USB module is busy executing a USB
2155  * token. Software must not write more token commands to the Token Register when
2156  * TOKEN_BUSY is set. Software should check this field before writing any tokens
2157  * to the Token Register to ensure that token commands are not lost. In Target
2158  * mode, TXD_SUSPEND is set when the SIE has disabled packet transmission and
2159  * reception. Clearing this bit allows the SIE to continue token processing. This bit
2160  * is set by the SIE when a SETUP Token is received allowing software to dequeue
2161  * any pending packet transactions in the BDT before resuming token processing.
2162  */
2163 /*@{*/
2164 #define BP_USB_CTL_TXSUSPENDTOKENBUSY (5U) /*!< Bit position for USB_CTL_TXSUSPENDTOKENBUSY. */
2165 #define BM_USB_CTL_TXSUSPENDTOKENBUSY (0x20U) /*!< Bit mask for USB_CTL_TXSUSPENDTOKENBUSY. */
2166 #define BS_USB_CTL_TXSUSPENDTOKENBUSY (1U) /*!< Bit field size in bits for USB_CTL_TXSUSPENDTOKENBUSY. */
2167
2168 /*! @brief Read current value of the USB_CTL_TXSUSPENDTOKENBUSY field. */
2169 #define BR_USB_CTL_TXSUSPENDTOKENBUSY(x) (BITBAND_ACCESS8(HW_USB_CTL_ADDR(x), BP_USB_CTL_TXSUSPENDTOKENBUSY))
2170
2171 /*! @brief Format value for bitfield USB_CTL_TXSUSPENDTOKENBUSY. */
2172 #define BF_USB_CTL_TXSUSPENDTOKENBUSY(v) ((uint8_t)((uint8_t)(v) << BP_USB_CTL_TXSUSPENDTOKENBUSY) & BM_USB_CTL_TXSUSPENDTOKENBUSY)
2173
2174 /*! @brief Set the TXSUSPENDTOKENBUSY field to a new value. */
2175 #define BW_USB_CTL_TXSUSPENDTOKENBUSY(x, v) (BITBAND_ACCESS8(HW_USB_CTL_ADDR(x), BP_USB_CTL_TXSUSPENDTOKENBUSY) = (v))
2176 /*@}*/
2177
2178 /*!
2179  * @name Register USB_CTL, field SE0[6] (RW)
2180  */
2181 /*@{*/
2182 #define BP_USB_CTL_SE0       (6U)          /*!< Bit position for USB_CTL_SE0. */
2183 #define BM_USB_CTL_SE0       (0x40U)       /*!< Bit mask for USB_CTL_SE0. */
2184 #define BS_USB_CTL_SE0       (1U)          /*!< Bit field size in bits for USB_CTL_SE0. */
2185
2186 /*! @brief Read current value of the USB_CTL_SE0 field. */
2187 #define BR_USB_CTL_SE0(x)    (BITBAND_ACCESS8(HW_USB_CTL_ADDR(x), BP_USB_CTL_SE0))
2188
2189 /*! @brief Format value for bitfield USB_CTL_SE0. */
2190 #define BF_USB_CTL_SE0(v)    ((uint8_t)((uint8_t)(v) << BP_USB_CTL_SE0) & BM_USB_CTL_SE0)
2191
2192 /*! @brief Set the SE0 field to a new value. */
2193 #define BW_USB_CTL_SE0(x, v) (BITBAND_ACCESS8(HW_USB_CTL_ADDR(x), BP_USB_CTL_SE0) = (v))
2194 /*@}*/
2195
2196 /*!
2197  * @name Register USB_CTL, field JSTATE[7] (RW)
2198  *
2199  * The polarity of this signal is affected by the current state of LSEN .
2200  */
2201 /*@{*/
2202 #define BP_USB_CTL_JSTATE    (7U)          /*!< Bit position for USB_CTL_JSTATE. */
2203 #define BM_USB_CTL_JSTATE    (0x80U)       /*!< Bit mask for USB_CTL_JSTATE. */
2204 #define BS_USB_CTL_JSTATE    (1U)          /*!< Bit field size in bits for USB_CTL_JSTATE. */
2205
2206 /*! @brief Read current value of the USB_CTL_JSTATE field. */
2207 #define BR_USB_CTL_JSTATE(x) (BITBAND_ACCESS8(HW_USB_CTL_ADDR(x), BP_USB_CTL_JSTATE))
2208
2209 /*! @brief Format value for bitfield USB_CTL_JSTATE. */
2210 #define BF_USB_CTL_JSTATE(v) ((uint8_t)((uint8_t)(v) << BP_USB_CTL_JSTATE) & BM_USB_CTL_JSTATE)
2211
2212 /*! @brief Set the JSTATE field to a new value. */
2213 #define BW_USB_CTL_JSTATE(x, v) (BITBAND_ACCESS8(HW_USB_CTL_ADDR(x), BP_USB_CTL_JSTATE) = (v))
2214 /*@}*/
2215
2216 /*******************************************************************************
2217  * HW_USB_ADDR - Address register
2218  ******************************************************************************/
2219
2220 /*!
2221  * @brief HW_USB_ADDR - Address register (RW)
2222  *
2223  * Reset value: 0x00U
2224  *
2225  * Holds the unique USB address that the USB module decodes when in Peripheral
2226  * mode (HOSTMODEEN=0). When operating in Host mode (HOSTMODEEN=1) the USB module
2227  * transmits this address with a TOKEN packet. This enables the USB module to
2228  * uniquely address any USB peripheral. In either mode, CTL[USBENSOFEN] must be 1.
2229  * The Address register is reset to 0x00 after the reset input becomes active or
2230  * the USB module decodes a USB reset signal. This action initializes the Address
2231  * register to decode address 0x00 as required by the USB specification.
2232  */
2233 typedef union _hw_usb_addr
2234 {
2235     uint8_t U;
2236     struct _hw_usb_addr_bitfields
2237     {
2238         uint8_t ADDR : 7;              /*!< [6:0] USB Address */
2239         uint8_t LSEN : 1;              /*!< [7] Low Speed Enable bit */
2240     } B;
2241 } hw_usb_addr_t;
2242
2243 /*!
2244  * @name Constants and macros for entire USB_ADDR register
2245  */
2246 /*@{*/
2247 #define HW_USB_ADDR_ADDR(x)      ((x) + 0x98U)
2248
2249 #define HW_USB_ADDR(x)           (*(__IO hw_usb_addr_t *) HW_USB_ADDR_ADDR(x))
2250 #define HW_USB_ADDR_RD(x)        (HW_USB_ADDR(x).U)
2251 #define HW_USB_ADDR_WR(x, v)     (HW_USB_ADDR(x).U = (v))
2252 #define HW_USB_ADDR_SET(x, v)    (HW_USB_ADDR_WR(x, HW_USB_ADDR_RD(x) |  (v)))
2253 #define HW_USB_ADDR_CLR(x, v)    (HW_USB_ADDR_WR(x, HW_USB_ADDR_RD(x) & ~(v)))
2254 #define HW_USB_ADDR_TOG(x, v)    (HW_USB_ADDR_WR(x, HW_USB_ADDR_RD(x) ^  (v)))
2255 /*@}*/
2256
2257 /*
2258  * Constants & macros for individual USB_ADDR bitfields
2259  */
2260
2261 /*!
2262  * @name Register USB_ADDR, field ADDR[6:0] (RW)
2263  *
2264  * Defines the USB address that the USB module decodes in peripheral mode, or
2265  * transmits when in host mode.
2266  */
2267 /*@{*/
2268 #define BP_USB_ADDR_ADDR     (0U)          /*!< Bit position for USB_ADDR_ADDR. */
2269 #define BM_USB_ADDR_ADDR     (0x7FU)       /*!< Bit mask for USB_ADDR_ADDR. */
2270 #define BS_USB_ADDR_ADDR     (7U)          /*!< Bit field size in bits for USB_ADDR_ADDR. */
2271
2272 /*! @brief Read current value of the USB_ADDR_ADDR field. */
2273 #define BR_USB_ADDR_ADDR(x)  (HW_USB_ADDR(x).B.ADDR)
2274
2275 /*! @brief Format value for bitfield USB_ADDR_ADDR. */
2276 #define BF_USB_ADDR_ADDR(v)  ((uint8_t)((uint8_t)(v) << BP_USB_ADDR_ADDR) & BM_USB_ADDR_ADDR)
2277
2278 /*! @brief Set the ADDR field to a new value. */
2279 #define BW_USB_ADDR_ADDR(x, v) (HW_USB_ADDR_WR(x, (HW_USB_ADDR_RD(x) & ~BM_USB_ADDR_ADDR) | BF_USB_ADDR_ADDR(v)))
2280 /*@}*/
2281
2282 /*!
2283  * @name Register USB_ADDR, field LSEN[7] (RW)
2284  *
2285  * Informs the USB module that the next token command written to the token
2286  * register must be performed at low speed. This enables the USB module to perform the
2287  * necessary preamble required for low-speed data transmissions.
2288  */
2289 /*@{*/
2290 #define BP_USB_ADDR_LSEN     (7U)          /*!< Bit position for USB_ADDR_LSEN. */
2291 #define BM_USB_ADDR_LSEN     (0x80U)       /*!< Bit mask for USB_ADDR_LSEN. */
2292 #define BS_USB_ADDR_LSEN     (1U)          /*!< Bit field size in bits for USB_ADDR_LSEN. */
2293
2294 /*! @brief Read current value of the USB_ADDR_LSEN field. */
2295 #define BR_USB_ADDR_LSEN(x)  (BITBAND_ACCESS8(HW_USB_ADDR_ADDR(x), BP_USB_ADDR_LSEN))
2296
2297 /*! @brief Format value for bitfield USB_ADDR_LSEN. */
2298 #define BF_USB_ADDR_LSEN(v)  ((uint8_t)((uint8_t)(v) << BP_USB_ADDR_LSEN) & BM_USB_ADDR_LSEN)
2299
2300 /*! @brief Set the LSEN field to a new value. */
2301 #define BW_USB_ADDR_LSEN(x, v) (BITBAND_ACCESS8(HW_USB_ADDR_ADDR(x), BP_USB_ADDR_LSEN) = (v))
2302 /*@}*/
2303
2304 /*******************************************************************************
2305  * HW_USB_BDTPAGE1 - BDT Page register 1
2306  ******************************************************************************/
2307
2308 /*!
2309  * @brief HW_USB_BDTPAGE1 - BDT Page register 1 (RW)
2310  *
2311  * Reset value: 0x00U
2312  *
2313  * Provides address bits 15 through 9 of the base address where the current
2314  * Buffer Descriptor Table (BDT) resides in system memory. See Buffer Descriptor
2315  * Table. The 32-bit BDT Base Address is always aligned on 512-byte boundaries, so
2316  * bits 8 through 0 of the base address are always zero.
2317  */
2318 typedef union _hw_usb_bdtpage1
2319 {
2320     uint8_t U;
2321     struct _hw_usb_bdtpage1_bitfields
2322     {
2323         uint8_t RESERVED0 : 1;         /*!< [0]  */
2324         uint8_t BDTBA : 7;             /*!< [7:1]  */
2325     } B;
2326 } hw_usb_bdtpage1_t;
2327
2328 /*!
2329  * @name Constants and macros for entire USB_BDTPAGE1 register
2330  */
2331 /*@{*/
2332 #define HW_USB_BDTPAGE1_ADDR(x)  ((x) + 0x9CU)
2333
2334 #define HW_USB_BDTPAGE1(x)       (*(__IO hw_usb_bdtpage1_t *) HW_USB_BDTPAGE1_ADDR(x))
2335 #define HW_USB_BDTPAGE1_RD(x)    (HW_USB_BDTPAGE1(x).U)
2336 #define HW_USB_BDTPAGE1_WR(x, v) (HW_USB_BDTPAGE1(x).U = (v))
2337 #define HW_USB_BDTPAGE1_SET(x, v) (HW_USB_BDTPAGE1_WR(x, HW_USB_BDTPAGE1_RD(x) |  (v)))
2338 #define HW_USB_BDTPAGE1_CLR(x, v) (HW_USB_BDTPAGE1_WR(x, HW_USB_BDTPAGE1_RD(x) & ~(v)))
2339 #define HW_USB_BDTPAGE1_TOG(x, v) (HW_USB_BDTPAGE1_WR(x, HW_USB_BDTPAGE1_RD(x) ^  (v)))
2340 /*@}*/
2341
2342 /*
2343  * Constants & macros for individual USB_BDTPAGE1 bitfields
2344  */
2345
2346 /*!
2347  * @name Register USB_BDTPAGE1, field BDTBA[7:1] (RW)
2348  *
2349  * Provides address bits 15 through 9 of the BDT base address.
2350  */
2351 /*@{*/
2352 #define BP_USB_BDTPAGE1_BDTBA (1U)         /*!< Bit position for USB_BDTPAGE1_BDTBA. */
2353 #define BM_USB_BDTPAGE1_BDTBA (0xFEU)      /*!< Bit mask for USB_BDTPAGE1_BDTBA. */
2354 #define BS_USB_BDTPAGE1_BDTBA (7U)         /*!< Bit field size in bits for USB_BDTPAGE1_BDTBA. */
2355
2356 /*! @brief Read current value of the USB_BDTPAGE1_BDTBA field. */
2357 #define BR_USB_BDTPAGE1_BDTBA(x) (HW_USB_BDTPAGE1(x).B.BDTBA)
2358
2359 /*! @brief Format value for bitfield USB_BDTPAGE1_BDTBA. */
2360 #define BF_USB_BDTPAGE1_BDTBA(v) ((uint8_t)((uint8_t)(v) << BP_USB_BDTPAGE1_BDTBA) & BM_USB_BDTPAGE1_BDTBA)
2361
2362 /*! @brief Set the BDTBA field to a new value. */
2363 #define BW_USB_BDTPAGE1_BDTBA(x, v) (HW_USB_BDTPAGE1_WR(x, (HW_USB_BDTPAGE1_RD(x) & ~BM_USB_BDTPAGE1_BDTBA) | BF_USB_BDTPAGE1_BDTBA(v)))
2364 /*@}*/
2365
2366 /*******************************************************************************
2367  * HW_USB_FRMNUML - Frame Number register Low
2368  ******************************************************************************/
2369
2370 /*!
2371  * @brief HW_USB_FRMNUML - Frame Number register Low (RW)
2372  *
2373  * Reset value: 0x00U
2374  *
2375  * The Frame Number registers (low and high) contain the 11-bit frame number.
2376  * These registers are updated with the current frame number whenever a SOF TOKEN
2377  * is received.
2378  */
2379 typedef union _hw_usb_frmnuml
2380 {
2381     uint8_t U;
2382     struct _hw_usb_frmnuml_bitfields
2383     {
2384         uint8_t FRM : 8;               /*!< [7:0]  */
2385     } B;
2386 } hw_usb_frmnuml_t;
2387
2388 /*!
2389  * @name Constants and macros for entire USB_FRMNUML register
2390  */
2391 /*@{*/
2392 #define HW_USB_FRMNUML_ADDR(x)   ((x) + 0xA0U)
2393
2394 #define HW_USB_FRMNUML(x)        (*(__IO hw_usb_frmnuml_t *) HW_USB_FRMNUML_ADDR(x))
2395 #define HW_USB_FRMNUML_RD(x)     (HW_USB_FRMNUML(x).U)
2396 #define HW_USB_FRMNUML_WR(x, v)  (HW_USB_FRMNUML(x).U = (v))
2397 #define HW_USB_FRMNUML_SET(x, v) (HW_USB_FRMNUML_WR(x, HW_USB_FRMNUML_RD(x) |  (v)))
2398 #define HW_USB_FRMNUML_CLR(x, v) (HW_USB_FRMNUML_WR(x, HW_USB_FRMNUML_RD(x) & ~(v)))
2399 #define HW_USB_FRMNUML_TOG(x, v) (HW_USB_FRMNUML_WR(x, HW_USB_FRMNUML_RD(x) ^  (v)))
2400 /*@}*/
2401
2402 /*
2403  * Constants & macros for individual USB_FRMNUML bitfields
2404  */
2405
2406 /*!
2407  * @name Register USB_FRMNUML, field FRM[7:0] (RW)
2408  *
2409  * This 8-bit field and the 3-bit field in the Frame Number Register High are
2410  * used to compute the address where the current Buffer Descriptor Table (BDT)
2411  * resides in system memory.
2412  */
2413 /*@{*/
2414 #define BP_USB_FRMNUML_FRM   (0U)          /*!< Bit position for USB_FRMNUML_FRM. */
2415 #define BM_USB_FRMNUML_FRM   (0xFFU)       /*!< Bit mask for USB_FRMNUML_FRM. */
2416 #define BS_USB_FRMNUML_FRM   (8U)          /*!< Bit field size in bits for USB_FRMNUML_FRM. */
2417
2418 /*! @brief Read current value of the USB_FRMNUML_FRM field. */
2419 #define BR_USB_FRMNUML_FRM(x) (HW_USB_FRMNUML(x).U)
2420
2421 /*! @brief Format value for bitfield USB_FRMNUML_FRM. */
2422 #define BF_USB_FRMNUML_FRM(v) ((uint8_t)((uint8_t)(v) << BP_USB_FRMNUML_FRM) & BM_USB_FRMNUML_FRM)
2423
2424 /*! @brief Set the FRM field to a new value. */
2425 #define BW_USB_FRMNUML_FRM(x, v) (HW_USB_FRMNUML_WR(x, v))
2426 /*@}*/
2427
2428 /*******************************************************************************
2429  * HW_USB_FRMNUMH - Frame Number register High
2430  ******************************************************************************/
2431
2432 /*!
2433  * @brief HW_USB_FRMNUMH - Frame Number register High (RW)
2434  *
2435  * Reset value: 0x00U
2436  *
2437  * The Frame Number registers (low and high) contain the 11-bit frame number.
2438  * These registers are updated with the current frame number whenever a SOF TOKEN
2439  * is received.
2440  */
2441 typedef union _hw_usb_frmnumh
2442 {
2443     uint8_t U;
2444     struct _hw_usb_frmnumh_bitfields
2445     {
2446         uint8_t FRM : 3;               /*!< [2:0]  */
2447         uint8_t RESERVED0 : 5;         /*!< [7:3]  */
2448     } B;
2449 } hw_usb_frmnumh_t;
2450
2451 /*!
2452  * @name Constants and macros for entire USB_FRMNUMH register
2453  */
2454 /*@{*/
2455 #define HW_USB_FRMNUMH_ADDR(x)   ((x) + 0xA4U)
2456
2457 #define HW_USB_FRMNUMH(x)        (*(__IO hw_usb_frmnumh_t *) HW_USB_FRMNUMH_ADDR(x))
2458 #define HW_USB_FRMNUMH_RD(x)     (HW_USB_FRMNUMH(x).U)
2459 #define HW_USB_FRMNUMH_WR(x, v)  (HW_USB_FRMNUMH(x).U = (v))
2460 #define HW_USB_FRMNUMH_SET(x, v) (HW_USB_FRMNUMH_WR(x, HW_USB_FRMNUMH_RD(x) |  (v)))
2461 #define HW_USB_FRMNUMH_CLR(x, v) (HW_USB_FRMNUMH_WR(x, HW_USB_FRMNUMH_RD(x) & ~(v)))
2462 #define HW_USB_FRMNUMH_TOG(x, v) (HW_USB_FRMNUMH_WR(x, HW_USB_FRMNUMH_RD(x) ^  (v)))
2463 /*@}*/
2464
2465 /*
2466  * Constants & macros for individual USB_FRMNUMH bitfields
2467  */
2468
2469 /*!
2470  * @name Register USB_FRMNUMH, field FRM[2:0] (RW)
2471  *
2472  * This 3-bit field and the 8-bit field in the Frame Number Register Low are
2473  * used to compute the address where the current Buffer Descriptor Table (BDT)
2474  * resides in system memory.
2475  */
2476 /*@{*/
2477 #define BP_USB_FRMNUMH_FRM   (0U)          /*!< Bit position for USB_FRMNUMH_FRM. */
2478 #define BM_USB_FRMNUMH_FRM   (0x07U)       /*!< Bit mask for USB_FRMNUMH_FRM. */
2479 #define BS_USB_FRMNUMH_FRM   (3U)          /*!< Bit field size in bits for USB_FRMNUMH_FRM. */
2480
2481 /*! @brief Read current value of the USB_FRMNUMH_FRM field. */
2482 #define BR_USB_FRMNUMH_FRM(x) (HW_USB_FRMNUMH(x).B.FRM)
2483
2484 /*! @brief Format value for bitfield USB_FRMNUMH_FRM. */
2485 #define BF_USB_FRMNUMH_FRM(v) ((uint8_t)((uint8_t)(v) << BP_USB_FRMNUMH_FRM) & BM_USB_FRMNUMH_FRM)
2486
2487 /*! @brief Set the FRM field to a new value. */
2488 #define BW_USB_FRMNUMH_FRM(x, v) (HW_USB_FRMNUMH_WR(x, (HW_USB_FRMNUMH_RD(x) & ~BM_USB_FRMNUMH_FRM) | BF_USB_FRMNUMH_FRM(v)))
2489 /*@}*/
2490
2491 /*******************************************************************************
2492  * HW_USB_TOKEN - Token register
2493  ******************************************************************************/
2494
2495 /*!
2496  * @brief HW_USB_TOKEN - Token register (RW)
2497  *
2498  * Reset value: 0x00U
2499  *
2500  * Used to initiate USB transactions when in host mode (HOSTMODEEN=1). When the
2501  * software needs to execute a USB transaction to a peripheral, it writes the
2502  * TOKEN type and endpoint to this register. After this register has been written,
2503  * the USB module begins the specified USB transaction to the address contained in
2504  * the address register. The processor core must always check that the
2505  * TOKEN_BUSY bit in the control register is not 1 before writing to the Token Register.
2506  * This ensures that the token commands are not overwritten before they can be
2507  * executed. The address register and endpoint control register 0 are also used when
2508  * performing a token command and therefore must also be written before the
2509  * Token Register. The address register is used to select the USB peripheral address
2510  * transmitted by the token command. The endpoint control register determines the
2511  * handshake and retry policies used during the transfer.
2512  */
2513 typedef union _hw_usb_token
2514 {
2515     uint8_t U;
2516     struct _hw_usb_token_bitfields
2517     {
2518         uint8_t TOKENENDPT : 4;        /*!< [3:0]  */
2519         uint8_t TOKENPID : 4;          /*!< [7:4]  */
2520     } B;
2521 } hw_usb_token_t;
2522
2523 /*!
2524  * @name Constants and macros for entire USB_TOKEN register
2525  */
2526 /*@{*/
2527 #define HW_USB_TOKEN_ADDR(x)     ((x) + 0xA8U)
2528
2529 #define HW_USB_TOKEN(x)          (*(__IO hw_usb_token_t *) HW_USB_TOKEN_ADDR(x))
2530 #define HW_USB_TOKEN_RD(x)       (HW_USB_TOKEN(x).U)
2531 #define HW_USB_TOKEN_WR(x, v)    (HW_USB_TOKEN(x).U = (v))
2532 #define HW_USB_TOKEN_SET(x, v)   (HW_USB_TOKEN_WR(x, HW_USB_TOKEN_RD(x) |  (v)))
2533 #define HW_USB_TOKEN_CLR(x, v)   (HW_USB_TOKEN_WR(x, HW_USB_TOKEN_RD(x) & ~(v)))
2534 #define HW_USB_TOKEN_TOG(x, v)   (HW_USB_TOKEN_WR(x, HW_USB_TOKEN_RD(x) ^  (v)))
2535 /*@}*/
2536
2537 /*
2538  * Constants & macros for individual USB_TOKEN bitfields
2539  */
2540
2541 /*!
2542  * @name Register USB_TOKEN, field TOKENENDPT[3:0] (RW)
2543  *
2544  * Holds the Endpoint address for the token command. The four bit value written
2545  * must be a valid endpoint.
2546  */
2547 /*@{*/
2548 #define BP_USB_TOKEN_TOKENENDPT (0U)       /*!< Bit position for USB_TOKEN_TOKENENDPT. */
2549 #define BM_USB_TOKEN_TOKENENDPT (0x0FU)    /*!< Bit mask for USB_TOKEN_TOKENENDPT. */
2550 #define BS_USB_TOKEN_TOKENENDPT (4U)       /*!< Bit field size in bits for USB_TOKEN_TOKENENDPT. */
2551
2552 /*! @brief Read current value of the USB_TOKEN_TOKENENDPT field. */
2553 #define BR_USB_TOKEN_TOKENENDPT(x) (HW_USB_TOKEN(x).B.TOKENENDPT)
2554
2555 /*! @brief Format value for bitfield USB_TOKEN_TOKENENDPT. */
2556 #define BF_USB_TOKEN_TOKENENDPT(v) ((uint8_t)((uint8_t)(v) << BP_USB_TOKEN_TOKENENDPT) & BM_USB_TOKEN_TOKENENDPT)
2557
2558 /*! @brief Set the TOKENENDPT field to a new value. */
2559 #define BW_USB_TOKEN_TOKENENDPT(x, v) (HW_USB_TOKEN_WR(x, (HW_USB_TOKEN_RD(x) & ~BM_USB_TOKEN_TOKENENDPT) | BF_USB_TOKEN_TOKENENDPT(v)))
2560 /*@}*/
2561
2562 /*!
2563  * @name Register USB_TOKEN, field TOKENPID[7:4] (RW)
2564  *
2565  * Contains the token type executed by the USB module.
2566  *
2567  * Values:
2568  * - 0001 - OUT Token. USB Module performs an OUT (TX) transaction.
2569  * - 1001 - IN Token. USB Module performs an In (RX) transaction.
2570  * - 1101 - SETUP Token. USB Module performs a SETUP (TX) transaction
2571  */
2572 /*@{*/
2573 #define BP_USB_TOKEN_TOKENPID (4U)         /*!< Bit position for USB_TOKEN_TOKENPID. */
2574 #define BM_USB_TOKEN_TOKENPID (0xF0U)      /*!< Bit mask for USB_TOKEN_TOKENPID. */
2575 #define BS_USB_TOKEN_TOKENPID (4U)         /*!< Bit field size in bits for USB_TOKEN_TOKENPID. */
2576
2577 /*! @brief Read current value of the USB_TOKEN_TOKENPID field. */
2578 #define BR_USB_TOKEN_TOKENPID(x) (HW_USB_TOKEN(x).B.TOKENPID)
2579
2580 /*! @brief Format value for bitfield USB_TOKEN_TOKENPID. */
2581 #define BF_USB_TOKEN_TOKENPID(v) ((uint8_t)((uint8_t)(v) << BP_USB_TOKEN_TOKENPID) & BM_USB_TOKEN_TOKENPID)
2582
2583 /*! @brief Set the TOKENPID field to a new value. */
2584 #define BW_USB_TOKEN_TOKENPID(x, v) (HW_USB_TOKEN_WR(x, (HW_USB_TOKEN_RD(x) & ~BM_USB_TOKEN_TOKENPID) | BF_USB_TOKEN_TOKENPID(v)))
2585 /*@}*/
2586
2587 /*******************************************************************************
2588  * HW_USB_SOFTHLD - SOF Threshold register
2589  ******************************************************************************/
2590
2591 /*!
2592  * @brief HW_USB_SOFTHLD - SOF Threshold register (RW)
2593  *
2594  * Reset value: 0x00U
2595  *
2596  * The SOF Threshold Register is used only in Host mode (HOSTMODEEN=1). When in
2597  * Host mode, the 14-bit SOF counter counts the interval between SOF frames. The
2598  * SOF must be transmitted every 1ms so therefore the SOF counter is loaded with
2599  * a value of 12000. When the SOF counter reaches zero, a Start Of Frame (SOF)
2600  * token is transmitted. The SOF threshold register is used to program the number
2601  * of USB byte times before the SOF to stop initiating token packet transactions.
2602  * This register must be set to a value that ensures that other packets are not
2603  * actively being transmitted when the SOF time counts to zero. When the SOF
2604  * counter reaches the threshold value, no more tokens are transmitted until after the
2605  * SOF has been transmitted. The value programmed into the threshold register
2606  * must reserve enough time to ensure the worst case transaction completes. In
2607  * general the worst case transaction is an IN token followed by a data packet from
2608  * the target followed by the response from the host. The actual time required is
2609  * a function of the maximum packet size on the bus. Typical values for the SOF
2610  * threshold are: 64-byte packets=74; 32-byte packets=42; 16-byte packets=26;
2611  * 8-byte packets=18.
2612  */
2613 typedef union _hw_usb_softhld
2614 {
2615     uint8_t U;
2616     struct _hw_usb_softhld_bitfields
2617     {
2618         uint8_t CNT : 8;               /*!< [7:0]  */
2619     } B;
2620 } hw_usb_softhld_t;
2621
2622 /*!
2623  * @name Constants and macros for entire USB_SOFTHLD register
2624  */
2625 /*@{*/
2626 #define HW_USB_SOFTHLD_ADDR(x)   ((x) + 0xACU)
2627
2628 #define HW_USB_SOFTHLD(x)        (*(__IO hw_usb_softhld_t *) HW_USB_SOFTHLD_ADDR(x))
2629 #define HW_USB_SOFTHLD_RD(x)     (HW_USB_SOFTHLD(x).U)
2630 #define HW_USB_SOFTHLD_WR(x, v)  (HW_USB_SOFTHLD(x).U = (v))
2631 #define HW_USB_SOFTHLD_SET(x, v) (HW_USB_SOFTHLD_WR(x, HW_USB_SOFTHLD_RD(x) |  (v)))
2632 #define HW_USB_SOFTHLD_CLR(x, v) (HW_USB_SOFTHLD_WR(x, HW_USB_SOFTHLD_RD(x) & ~(v)))
2633 #define HW_USB_SOFTHLD_TOG(x, v) (HW_USB_SOFTHLD_WR(x, HW_USB_SOFTHLD_RD(x) ^  (v)))
2634 /*@}*/
2635
2636 /*
2637  * Constants & macros for individual USB_SOFTHLD bitfields
2638  */
2639
2640 /*!
2641  * @name Register USB_SOFTHLD, field CNT[7:0] (RW)
2642  *
2643  * Represents the SOF count threshold in byte times.
2644  */
2645 /*@{*/
2646 #define BP_USB_SOFTHLD_CNT   (0U)          /*!< Bit position for USB_SOFTHLD_CNT. */
2647 #define BM_USB_SOFTHLD_CNT   (0xFFU)       /*!< Bit mask for USB_SOFTHLD_CNT. */
2648 #define BS_USB_SOFTHLD_CNT   (8U)          /*!< Bit field size in bits for USB_SOFTHLD_CNT. */
2649
2650 /*! @brief Read current value of the USB_SOFTHLD_CNT field. */
2651 #define BR_USB_SOFTHLD_CNT(x) (HW_USB_SOFTHLD(x).U)
2652
2653 /*! @brief Format value for bitfield USB_SOFTHLD_CNT. */
2654 #define BF_USB_SOFTHLD_CNT(v) ((uint8_t)((uint8_t)(v) << BP_USB_SOFTHLD_CNT) & BM_USB_SOFTHLD_CNT)
2655
2656 /*! @brief Set the CNT field to a new value. */
2657 #define BW_USB_SOFTHLD_CNT(x, v) (HW_USB_SOFTHLD_WR(x, v))
2658 /*@}*/
2659
2660 /*******************************************************************************
2661  * HW_USB_BDTPAGE2 - BDT Page Register 2
2662  ******************************************************************************/
2663
2664 /*!
2665  * @brief HW_USB_BDTPAGE2 - BDT Page Register 2 (RW)
2666  *
2667  * Reset value: 0x00U
2668  *
2669  * Contains an 8-bit value used to compute the address where the current Buffer
2670  * Descriptor Table (BDT) resides in system memory. See Buffer Descriptor Table.
2671  */
2672 typedef union _hw_usb_bdtpage2
2673 {
2674     uint8_t U;
2675     struct _hw_usb_bdtpage2_bitfields
2676     {
2677         uint8_t BDTBA : 8;             /*!< [7:0]  */
2678     } B;
2679 } hw_usb_bdtpage2_t;
2680
2681 /*!
2682  * @name Constants and macros for entire USB_BDTPAGE2 register
2683  */
2684 /*@{*/
2685 #define HW_USB_BDTPAGE2_ADDR(x)  ((x) + 0xB0U)
2686
2687 #define HW_USB_BDTPAGE2(x)       (*(__IO hw_usb_bdtpage2_t *) HW_USB_BDTPAGE2_ADDR(x))
2688 #define HW_USB_BDTPAGE2_RD(x)    (HW_USB_BDTPAGE2(x).U)
2689 #define HW_USB_BDTPAGE2_WR(x, v) (HW_USB_BDTPAGE2(x).U = (v))
2690 #define HW_USB_BDTPAGE2_SET(x, v) (HW_USB_BDTPAGE2_WR(x, HW_USB_BDTPAGE2_RD(x) |  (v)))
2691 #define HW_USB_BDTPAGE2_CLR(x, v) (HW_USB_BDTPAGE2_WR(x, HW_USB_BDTPAGE2_RD(x) & ~(v)))
2692 #define HW_USB_BDTPAGE2_TOG(x, v) (HW_USB_BDTPAGE2_WR(x, HW_USB_BDTPAGE2_RD(x) ^  (v)))
2693 /*@}*/
2694
2695 /*
2696  * Constants & macros for individual USB_BDTPAGE2 bitfields
2697  */
2698
2699 /*!
2700  * @name Register USB_BDTPAGE2, field BDTBA[7:0] (RW)
2701  *
2702  * Provides address bits 23 through 16 of the BDT base address that defines the
2703  * location of Buffer Descriptor Table resides in system memory.
2704  */
2705 /*@{*/
2706 #define BP_USB_BDTPAGE2_BDTBA (0U)         /*!< Bit position for USB_BDTPAGE2_BDTBA. */
2707 #define BM_USB_BDTPAGE2_BDTBA (0xFFU)      /*!< Bit mask for USB_BDTPAGE2_BDTBA. */
2708 #define BS_USB_BDTPAGE2_BDTBA (8U)         /*!< Bit field size in bits for USB_BDTPAGE2_BDTBA. */
2709
2710 /*! @brief Read current value of the USB_BDTPAGE2_BDTBA field. */
2711 #define BR_USB_BDTPAGE2_BDTBA(x) (HW_USB_BDTPAGE2(x).U)
2712
2713 /*! @brief Format value for bitfield USB_BDTPAGE2_BDTBA. */
2714 #define BF_USB_BDTPAGE2_BDTBA(v) ((uint8_t)((uint8_t)(v) << BP_USB_BDTPAGE2_BDTBA) & BM_USB_BDTPAGE2_BDTBA)
2715
2716 /*! @brief Set the BDTBA field to a new value. */
2717 #define BW_USB_BDTPAGE2_BDTBA(x, v) (HW_USB_BDTPAGE2_WR(x, v))
2718 /*@}*/
2719
2720 /*******************************************************************************
2721  * HW_USB_BDTPAGE3 - BDT Page Register 3
2722  ******************************************************************************/
2723
2724 /*!
2725  * @brief HW_USB_BDTPAGE3 - BDT Page Register 3 (RW)
2726  *
2727  * Reset value: 0x00U
2728  *
2729  * Contains an 8-bit value used to compute the address where the current Buffer
2730  * Descriptor Table (BDT) resides in system memory. See Buffer Descriptor Table.
2731  */
2732 typedef union _hw_usb_bdtpage3
2733 {
2734     uint8_t U;
2735     struct _hw_usb_bdtpage3_bitfields
2736     {
2737         uint8_t BDTBA : 8;             /*!< [7:0]  */
2738     } B;
2739 } hw_usb_bdtpage3_t;
2740
2741 /*!
2742  * @name Constants and macros for entire USB_BDTPAGE3 register
2743  */
2744 /*@{*/
2745 #define HW_USB_BDTPAGE3_ADDR(x)  ((x) + 0xB4U)
2746
2747 #define HW_USB_BDTPAGE3(x)       (*(__IO hw_usb_bdtpage3_t *) HW_USB_BDTPAGE3_ADDR(x))
2748 #define HW_USB_BDTPAGE3_RD(x)    (HW_USB_BDTPAGE3(x).U)
2749 #define HW_USB_BDTPAGE3_WR(x, v) (HW_USB_BDTPAGE3(x).U = (v))
2750 #define HW_USB_BDTPAGE3_SET(x, v) (HW_USB_BDTPAGE3_WR(x, HW_USB_BDTPAGE3_RD(x) |  (v)))
2751 #define HW_USB_BDTPAGE3_CLR(x, v) (HW_USB_BDTPAGE3_WR(x, HW_USB_BDTPAGE3_RD(x) & ~(v)))
2752 #define HW_USB_BDTPAGE3_TOG(x, v) (HW_USB_BDTPAGE3_WR(x, HW_USB_BDTPAGE3_RD(x) ^  (v)))
2753 /*@}*/
2754
2755 /*
2756  * Constants & macros for individual USB_BDTPAGE3 bitfields
2757  */
2758
2759 /*!
2760  * @name Register USB_BDTPAGE3, field BDTBA[7:0] (RW)
2761  *
2762  * Provides address bits 31 through 24 of the BDT base address that defines the
2763  * location of Buffer Descriptor Table resides in system memory.
2764  */
2765 /*@{*/
2766 #define BP_USB_BDTPAGE3_BDTBA (0U)         /*!< Bit position for USB_BDTPAGE3_BDTBA. */
2767 #define BM_USB_BDTPAGE3_BDTBA (0xFFU)      /*!< Bit mask for USB_BDTPAGE3_BDTBA. */
2768 #define BS_USB_BDTPAGE3_BDTBA (8U)         /*!< Bit field size in bits for USB_BDTPAGE3_BDTBA. */
2769
2770 /*! @brief Read current value of the USB_BDTPAGE3_BDTBA field. */
2771 #define BR_USB_BDTPAGE3_BDTBA(x) (HW_USB_BDTPAGE3(x).U)
2772
2773 /*! @brief Format value for bitfield USB_BDTPAGE3_BDTBA. */
2774 #define BF_USB_BDTPAGE3_BDTBA(v) ((uint8_t)((uint8_t)(v) << BP_USB_BDTPAGE3_BDTBA) & BM_USB_BDTPAGE3_BDTBA)
2775
2776 /*! @brief Set the BDTBA field to a new value. */
2777 #define BW_USB_BDTPAGE3_BDTBA(x, v) (HW_USB_BDTPAGE3_WR(x, v))
2778 /*@}*/
2779
2780 /*******************************************************************************
2781  * HW_USB_ENDPTn - Endpoint Control register
2782  ******************************************************************************/
2783
2784 /*!
2785  * @brief HW_USB_ENDPTn - Endpoint Control register (RW)
2786  *
2787  * Reset value: 0x00U
2788  *
2789  * Contains the endpoint control bits for each of the 16 endpoints available
2790  * within the USB module for a decoded address. The format for these registers is
2791  * shown in the following figure. Endpoint 0 (ENDPT0) is associated with control
2792  * pipe 0, which is required for all USB functions. Therefore, after a USBRST
2793  * interrupt occurs the processor core should set ENDPT0 to contain 0x0D. In Host mode
2794  * ENDPT0 is used to determine the handshake, retry and low speed
2795  * characteristics of the host transfer. For Control, Bulk and Interrupt transfers, the EPHSHK
2796  * bit should be 1. For Isochronous transfers it should be 0. Common values to
2797  * use for ENDPT0 in host mode are 0x4D for Control, Bulk, and Interrupt transfers,
2798  * and 0x4C for Isochronous transfers. The three bits EPCTLDIS, EPRXEN, and
2799  * EPTXEN define if an endpoint is enabled and define the direction of the endpoint.
2800  * The endpoint enable/direction control is defined in the following table.
2801  * Endpoint enable and direction control EPCTLDIS EPRXEN EPTXEN Endpoint
2802  * enable/direction control X 0 0 Disable endpoint X 0 1 Enable endpoint for Tx transfers only
2803  * X 1 0 Enable endpoint for Rx transfers only 1 1 1 Enable endpoint for Rx and
2804  * Tx transfers 0 1 1 Enable Endpoint for RX and TX as well as control (SETUP)
2805  * transfers.
2806  */
2807 typedef union _hw_usb_endptn
2808 {
2809     uint8_t U;
2810     struct _hw_usb_endptn_bitfields
2811     {
2812         uint8_t EPHSHK : 1;            /*!< [0]  */
2813         uint8_t EPSTALL : 1;           /*!< [1]  */
2814         uint8_t EPTXEN : 1;            /*!< [2]  */
2815         uint8_t EPRXEN : 1;            /*!< [3]  */
2816         uint8_t EPCTLDIS : 1;          /*!< [4]  */
2817         uint8_t RESERVED0 : 1;         /*!< [5]  */
2818         uint8_t RETRYDIS : 1;          /*!< [6]  */
2819         uint8_t HOSTWOHUB : 1;         /*!< [7]  */
2820     } B;
2821 } hw_usb_endptn_t;
2822
2823 /*!
2824  * @name Constants and macros for entire USB_ENDPTn register
2825  */
2826 /*@{*/
2827 #define HW_USB_ENDPTn_COUNT (16U)
2828
2829 #define HW_USB_ENDPTn_ADDR(x, n) ((x) + 0xC0U + (0x4U * (n)))
2830
2831 #define HW_USB_ENDPTn(x, n)      (*(__IO hw_usb_endptn_t *) HW_USB_ENDPTn_ADDR(x, n))
2832 #define HW_USB_ENDPTn_RD(x, n)   (HW_USB_ENDPTn(x, n).U)
2833 #define HW_USB_ENDPTn_WR(x, n, v) (HW_USB_ENDPTn(x, n).U = (v))
2834 #define HW_USB_ENDPTn_SET(x, n, v) (HW_USB_ENDPTn_WR(x, n, HW_USB_ENDPTn_RD(x, n) |  (v)))
2835 #define HW_USB_ENDPTn_CLR(x, n, v) (HW_USB_ENDPTn_WR(x, n, HW_USB_ENDPTn_RD(x, n) & ~(v)))
2836 #define HW_USB_ENDPTn_TOG(x, n, v) (HW_USB_ENDPTn_WR(x, n, HW_USB_ENDPTn_RD(x, n) ^  (v)))
2837 /*@}*/
2838
2839 /*
2840  * Constants & macros for individual USB_ENDPTn bitfields
2841  */
2842
2843 /*!
2844  * @name Register USB_ENDPTn, field EPHSHK[0] (RW)
2845  *
2846  * When set this bit enables an endpoint to perform handshaking during a
2847  * transaction to this endpoint. This bit is generally 1 unless the endpoint is
2848  * Isochronous.
2849  */
2850 /*@{*/
2851 #define BP_USB_ENDPTn_EPHSHK (0U)          /*!< Bit position for USB_ENDPTn_EPHSHK. */
2852 #define BM_USB_ENDPTn_EPHSHK (0x01U)       /*!< Bit mask for USB_ENDPTn_EPHSHK. */
2853 #define BS_USB_ENDPTn_EPHSHK (1U)          /*!< Bit field size in bits for USB_ENDPTn_EPHSHK. */
2854
2855 /*! @brief Read current value of the USB_ENDPTn_EPHSHK field. */
2856 #define BR_USB_ENDPTn_EPHSHK(x, n) (BITBAND_ACCESS8(HW_USB_ENDPTn_ADDR(x, n), BP_USB_ENDPTn_EPHSHK))
2857
2858 /*! @brief Format value for bitfield USB_ENDPTn_EPHSHK. */
2859 #define BF_USB_ENDPTn_EPHSHK(v) ((uint8_t)((uint8_t)(v) << BP_USB_ENDPTn_EPHSHK) & BM_USB_ENDPTn_EPHSHK)
2860
2861 /*! @brief Set the EPHSHK field to a new value. */
2862 #define BW_USB_ENDPTn_EPHSHK(x, n, v) (BITBAND_ACCESS8(HW_USB_ENDPTn_ADDR(x, n), BP_USB_ENDPTn_EPHSHK) = (v))
2863 /*@}*/
2864
2865 /*!
2866  * @name Register USB_ENDPTn, field EPSTALL[1] (RW)
2867  *
2868  * When set this bit indicates that the endpoint is called. This bit has
2869  * priority over all other control bits in the EndPoint Enable Register, but it is only
2870  * valid if EPTXEN=1 or EPRXEN=1. Any access to this endpoint causes the USB
2871  * Module to return a STALL handshake. After an endpoint is stalled it requires
2872  * intervention from the Host Controller.
2873  */
2874 /*@{*/
2875 #define BP_USB_ENDPTn_EPSTALL (1U)         /*!< Bit position for USB_ENDPTn_EPSTALL. */
2876 #define BM_USB_ENDPTn_EPSTALL (0x02U)      /*!< Bit mask for USB_ENDPTn_EPSTALL. */
2877 #define BS_USB_ENDPTn_EPSTALL (1U)         /*!< Bit field size in bits for USB_ENDPTn_EPSTALL. */
2878
2879 /*! @brief Read current value of the USB_ENDPTn_EPSTALL field. */
2880 #define BR_USB_ENDPTn_EPSTALL(x, n) (BITBAND_ACCESS8(HW_USB_ENDPTn_ADDR(x, n), BP_USB_ENDPTn_EPSTALL))
2881
2882 /*! @brief Format value for bitfield USB_ENDPTn_EPSTALL. */
2883 #define BF_USB_ENDPTn_EPSTALL(v) ((uint8_t)((uint8_t)(v) << BP_USB_ENDPTn_EPSTALL) & BM_USB_ENDPTn_EPSTALL)
2884
2885 /*! @brief Set the EPSTALL field to a new value. */
2886 #define BW_USB_ENDPTn_EPSTALL(x, n, v) (BITBAND_ACCESS8(HW_USB_ENDPTn_ADDR(x, n), BP_USB_ENDPTn_EPSTALL) = (v))
2887 /*@}*/
2888
2889 /*!
2890  * @name Register USB_ENDPTn, field EPTXEN[2] (RW)
2891  *
2892  * This bit, when set, enables the endpoint for TX transfers.
2893  */
2894 /*@{*/
2895 #define BP_USB_ENDPTn_EPTXEN (2U)          /*!< Bit position for USB_ENDPTn_EPTXEN. */
2896 #define BM_USB_ENDPTn_EPTXEN (0x04U)       /*!< Bit mask for USB_ENDPTn_EPTXEN. */
2897 #define BS_USB_ENDPTn_EPTXEN (1U)          /*!< Bit field size in bits for USB_ENDPTn_EPTXEN. */
2898
2899 /*! @brief Read current value of the USB_ENDPTn_EPTXEN field. */
2900 #define BR_USB_ENDPTn_EPTXEN(x, n) (BITBAND_ACCESS8(HW_USB_ENDPTn_ADDR(x, n), BP_USB_ENDPTn_EPTXEN))
2901
2902 /*! @brief Format value for bitfield USB_ENDPTn_EPTXEN. */
2903 #define BF_USB_ENDPTn_EPTXEN(v) ((uint8_t)((uint8_t)(v) << BP_USB_ENDPTn_EPTXEN) & BM_USB_ENDPTn_EPTXEN)
2904
2905 /*! @brief Set the EPTXEN field to a new value. */
2906 #define BW_USB_ENDPTn_EPTXEN(x, n, v) (BITBAND_ACCESS8(HW_USB_ENDPTn_ADDR(x, n), BP_USB_ENDPTn_EPTXEN) = (v))
2907 /*@}*/
2908
2909 /*!
2910  * @name Register USB_ENDPTn, field EPRXEN[3] (RW)
2911  *
2912  * This bit, when set, enables the endpoint for RX transfers.
2913  */
2914 /*@{*/
2915 #define BP_USB_ENDPTn_EPRXEN (3U)          /*!< Bit position for USB_ENDPTn_EPRXEN. */
2916 #define BM_USB_ENDPTn_EPRXEN (0x08U)       /*!< Bit mask for USB_ENDPTn_EPRXEN. */
2917 #define BS_USB_ENDPTn_EPRXEN (1U)          /*!< Bit field size in bits for USB_ENDPTn_EPRXEN. */
2918
2919 /*! @brief Read current value of the USB_ENDPTn_EPRXEN field. */
2920 #define BR_USB_ENDPTn_EPRXEN(x, n) (BITBAND_ACCESS8(HW_USB_ENDPTn_ADDR(x, n), BP_USB_ENDPTn_EPRXEN))
2921
2922 /*! @brief Format value for bitfield USB_ENDPTn_EPRXEN. */
2923 #define BF_USB_ENDPTn_EPRXEN(v) ((uint8_t)((uint8_t)(v) << BP_USB_ENDPTn_EPRXEN) & BM_USB_ENDPTn_EPRXEN)
2924
2925 /*! @brief Set the EPRXEN field to a new value. */
2926 #define BW_USB_ENDPTn_EPRXEN(x, n, v) (BITBAND_ACCESS8(HW_USB_ENDPTn_ADDR(x, n), BP_USB_ENDPTn_EPRXEN) = (v))
2927 /*@}*/
2928
2929 /*!
2930  * @name Register USB_ENDPTn, field EPCTLDIS[4] (RW)
2931  *
2932  * This bit, when set, disables control (SETUP) transfers. When cleared, control
2933  * transfers are enabled. This applies if and only if the EPRXEN and EPTXEN bits
2934  * are also set.
2935  */
2936 /*@{*/
2937 #define BP_USB_ENDPTn_EPCTLDIS (4U)        /*!< Bit position for USB_ENDPTn_EPCTLDIS. */
2938 #define BM_USB_ENDPTn_EPCTLDIS (0x10U)     /*!< Bit mask for USB_ENDPTn_EPCTLDIS. */
2939 #define BS_USB_ENDPTn_EPCTLDIS (1U)        /*!< Bit field size in bits for USB_ENDPTn_EPCTLDIS. */
2940
2941 /*! @brief Read current value of the USB_ENDPTn_EPCTLDIS field. */
2942 #define BR_USB_ENDPTn_EPCTLDIS(x, n) (BITBAND_ACCESS8(HW_USB_ENDPTn_ADDR(x, n), BP_USB_ENDPTn_EPCTLDIS))
2943
2944 /*! @brief Format value for bitfield USB_ENDPTn_EPCTLDIS. */
2945 #define BF_USB_ENDPTn_EPCTLDIS(v) ((uint8_t)((uint8_t)(v) << BP_USB_ENDPTn_EPCTLDIS) & BM_USB_ENDPTn_EPCTLDIS)
2946
2947 /*! @brief Set the EPCTLDIS field to a new value. */
2948 #define BW_USB_ENDPTn_EPCTLDIS(x, n, v) (BITBAND_ACCESS8(HW_USB_ENDPTn_ADDR(x, n), BP_USB_ENDPTn_EPCTLDIS) = (v))
2949 /*@}*/
2950
2951 /*!
2952  * @name Register USB_ENDPTn, field RETRYDIS[6] (RW)
2953  *
2954  * This is a Host mode only bit and is present in the control register for
2955  * endpoint 0 (ENDPT0) only. When set this bit causes the host to not retry NAK'ed
2956  * (Negative Acknowledgement) transactions. When a transaction is NAKed, the BDT PID
2957  * field is updated with the NAK PID, and the TOKEN_DNE interrupt is set. When
2958  * this bit is cleared, NAKed transactions are retried in hardware. This bit must
2959  * be set when the host is attempting to poll an interrupt endpoint.
2960  */
2961 /*@{*/
2962 #define BP_USB_ENDPTn_RETRYDIS (6U)        /*!< Bit position for USB_ENDPTn_RETRYDIS. */
2963 #define BM_USB_ENDPTn_RETRYDIS (0x40U)     /*!< Bit mask for USB_ENDPTn_RETRYDIS. */
2964 #define BS_USB_ENDPTn_RETRYDIS (1U)        /*!< Bit field size in bits for USB_ENDPTn_RETRYDIS. */
2965
2966 /*! @brief Read current value of the USB_ENDPTn_RETRYDIS field. */
2967 #define BR_USB_ENDPTn_RETRYDIS(x, n) (BITBAND_ACCESS8(HW_USB_ENDPTn_ADDR(x, n), BP_USB_ENDPTn_RETRYDIS))
2968
2969 /*! @brief Format value for bitfield USB_ENDPTn_RETRYDIS. */
2970 #define BF_USB_ENDPTn_RETRYDIS(v) ((uint8_t)((uint8_t)(v) << BP_USB_ENDPTn_RETRYDIS) & BM_USB_ENDPTn_RETRYDIS)
2971
2972 /*! @brief Set the RETRYDIS field to a new value. */
2973 #define BW_USB_ENDPTn_RETRYDIS(x, n, v) (BITBAND_ACCESS8(HW_USB_ENDPTn_ADDR(x, n), BP_USB_ENDPTn_RETRYDIS) = (v))
2974 /*@}*/
2975
2976 /*!
2977  * @name Register USB_ENDPTn, field HOSTWOHUB[7] (RW)
2978  *
2979  * This is a Host mode only field and is present in the control register for
2980  * endpoint 0 (ENDPT0) only. When set this bit allows the host to communicate to a
2981  * directly connected low speed device. When cleared, the host produces the
2982  * PRE_PID. It then switches to low-speed signaling when sending a token to a low speed
2983  * device as required to communicate with a low speed device through a hub.
2984  */
2985 /*@{*/
2986 #define BP_USB_ENDPTn_HOSTWOHUB (7U)       /*!< Bit position for USB_ENDPTn_HOSTWOHUB. */
2987 #define BM_USB_ENDPTn_HOSTWOHUB (0x80U)    /*!< Bit mask for USB_ENDPTn_HOSTWOHUB. */
2988 #define BS_USB_ENDPTn_HOSTWOHUB (1U)       /*!< Bit field size in bits for USB_ENDPTn_HOSTWOHUB. */
2989
2990 /*! @brief Read current value of the USB_ENDPTn_HOSTWOHUB field. */
2991 #define BR_USB_ENDPTn_HOSTWOHUB(x, n) (BITBAND_ACCESS8(HW_USB_ENDPTn_ADDR(x, n), BP_USB_ENDPTn_HOSTWOHUB))
2992
2993 /*! @brief Format value for bitfield USB_ENDPTn_HOSTWOHUB. */
2994 #define BF_USB_ENDPTn_HOSTWOHUB(v) ((uint8_t)((uint8_t)(v) << BP_USB_ENDPTn_HOSTWOHUB) & BM_USB_ENDPTn_HOSTWOHUB)
2995
2996 /*! @brief Set the HOSTWOHUB field to a new value. */
2997 #define BW_USB_ENDPTn_HOSTWOHUB(x, n, v) (BITBAND_ACCESS8(HW_USB_ENDPTn_ADDR(x, n), BP_USB_ENDPTn_HOSTWOHUB) = (v))
2998 /*@}*/
2999
3000 /*******************************************************************************
3001  * HW_USB_USBCTRL - USB Control register
3002  ******************************************************************************/
3003
3004 /*!
3005  * @brief HW_USB_USBCTRL - USB Control register (RW)
3006  *
3007  * Reset value: 0xC0U
3008  */
3009 typedef union _hw_usb_usbctrl
3010 {
3011     uint8_t U;
3012     struct _hw_usb_usbctrl_bitfields
3013     {
3014         uint8_t RESERVED0 : 6;         /*!< [5:0]  */
3015         uint8_t PDE : 1;               /*!< [6]  */
3016         uint8_t SUSP : 1;              /*!< [7]  */
3017     } B;
3018 } hw_usb_usbctrl_t;
3019
3020 /*!
3021  * @name Constants and macros for entire USB_USBCTRL register
3022  */
3023 /*@{*/
3024 #define HW_USB_USBCTRL_ADDR(x)   ((x) + 0x100U)
3025
3026 #define HW_USB_USBCTRL(x)        (*(__IO hw_usb_usbctrl_t *) HW_USB_USBCTRL_ADDR(x))
3027 #define HW_USB_USBCTRL_RD(x)     (HW_USB_USBCTRL(x).U)
3028 #define HW_USB_USBCTRL_WR(x, v)  (HW_USB_USBCTRL(x).U = (v))
3029 #define HW_USB_USBCTRL_SET(x, v) (HW_USB_USBCTRL_WR(x, HW_USB_USBCTRL_RD(x) |  (v)))
3030 #define HW_USB_USBCTRL_CLR(x, v) (HW_USB_USBCTRL_WR(x, HW_USB_USBCTRL_RD(x) & ~(v)))
3031 #define HW_USB_USBCTRL_TOG(x, v) (HW_USB_USBCTRL_WR(x, HW_USB_USBCTRL_RD(x) ^  (v)))
3032 /*@}*/
3033
3034 /*
3035  * Constants & macros for individual USB_USBCTRL bitfields
3036  */
3037
3038 /*!
3039  * @name Register USB_USBCTRL, field PDE[6] (RW)
3040  *
3041  * Enables the weak pulldowns on the USB transceiver.
3042  *
3043  * Values:
3044  * - 0 - Weak pulldowns are disabled on D+ and D-.
3045  * - 1 - Weak pulldowns are enabled on D+ and D-.
3046  */
3047 /*@{*/
3048 #define BP_USB_USBCTRL_PDE   (6U)          /*!< Bit position for USB_USBCTRL_PDE. */
3049 #define BM_USB_USBCTRL_PDE   (0x40U)       /*!< Bit mask for USB_USBCTRL_PDE. */
3050 #define BS_USB_USBCTRL_PDE   (1U)          /*!< Bit field size in bits for USB_USBCTRL_PDE. */
3051
3052 /*! @brief Read current value of the USB_USBCTRL_PDE field. */
3053 #define BR_USB_USBCTRL_PDE(x) (BITBAND_ACCESS8(HW_USB_USBCTRL_ADDR(x), BP_USB_USBCTRL_PDE))
3054
3055 /*! @brief Format value for bitfield USB_USBCTRL_PDE. */
3056 #define BF_USB_USBCTRL_PDE(v) ((uint8_t)((uint8_t)(v) << BP_USB_USBCTRL_PDE) & BM_USB_USBCTRL_PDE)
3057
3058 /*! @brief Set the PDE field to a new value. */
3059 #define BW_USB_USBCTRL_PDE(x, v) (BITBAND_ACCESS8(HW_USB_USBCTRL_ADDR(x), BP_USB_USBCTRL_PDE) = (v))
3060 /*@}*/
3061
3062 /*!
3063  * @name Register USB_USBCTRL, field SUSP[7] (RW)
3064  *
3065  * Places the USB transceiver into the suspend state.
3066  *
3067  * Values:
3068  * - 0 - USB transceiver is not in suspend state.
3069  * - 1 - USB transceiver is in suspend state.
3070  */
3071 /*@{*/
3072 #define BP_USB_USBCTRL_SUSP  (7U)          /*!< Bit position for USB_USBCTRL_SUSP. */
3073 #define BM_USB_USBCTRL_SUSP  (0x80U)       /*!< Bit mask for USB_USBCTRL_SUSP. */
3074 #define BS_USB_USBCTRL_SUSP  (1U)          /*!< Bit field size in bits for USB_USBCTRL_SUSP. */
3075
3076 /*! @brief Read current value of the USB_USBCTRL_SUSP field. */
3077 #define BR_USB_USBCTRL_SUSP(x) (BITBAND_ACCESS8(HW_USB_USBCTRL_ADDR(x), BP_USB_USBCTRL_SUSP))
3078
3079 /*! @brief Format value for bitfield USB_USBCTRL_SUSP. */
3080 #define BF_USB_USBCTRL_SUSP(v) ((uint8_t)((uint8_t)(v) << BP_USB_USBCTRL_SUSP) & BM_USB_USBCTRL_SUSP)
3081
3082 /*! @brief Set the SUSP field to a new value. */
3083 #define BW_USB_USBCTRL_SUSP(x, v) (BITBAND_ACCESS8(HW_USB_USBCTRL_ADDR(x), BP_USB_USBCTRL_SUSP) = (v))
3084 /*@}*/
3085
3086 /*******************************************************************************
3087  * HW_USB_OBSERVE - USB OTG Observe register
3088  ******************************************************************************/
3089
3090 /*!
3091  * @brief HW_USB_OBSERVE - USB OTG Observe register (RO)
3092  *
3093  * Reset value: 0x50U
3094  *
3095  * Provides visibility on the state of the pull-ups and pull-downs at the
3096  * transceiver. Useful when interfacing to an external OTG control module via a serial
3097  * interface.
3098  */
3099 typedef union _hw_usb_observe
3100 {
3101     uint8_t U;
3102     struct _hw_usb_observe_bitfields
3103     {
3104         uint8_t RESERVED0 : 4;         /*!< [3:0]  */
3105         uint8_t DMPD : 1;              /*!< [4]  */
3106         uint8_t RESERVED1 : 1;         /*!< [5]  */
3107         uint8_t DPPD : 1;              /*!< [6]  */
3108         uint8_t DPPU : 1;              /*!< [7]  */
3109     } B;
3110 } hw_usb_observe_t;
3111
3112 /*!
3113  * @name Constants and macros for entire USB_OBSERVE register
3114  */
3115 /*@{*/
3116 #define HW_USB_OBSERVE_ADDR(x)   ((x) + 0x104U)
3117
3118 #define HW_USB_OBSERVE(x)        (*(__I hw_usb_observe_t *) HW_USB_OBSERVE_ADDR(x))
3119 #define HW_USB_OBSERVE_RD(x)     (HW_USB_OBSERVE(x).U)
3120 /*@}*/
3121
3122 /*
3123  * Constants & macros for individual USB_OBSERVE bitfields
3124  */
3125
3126 /*!
3127  * @name Register USB_OBSERVE, field DMPD[4] (RO)
3128  *
3129  * Provides observability of the D- Pulldown enable at the USB transceiver.
3130  *
3131  * Values:
3132  * - 0 - D- pulldown disabled.
3133  * - 1 - D- pulldown enabled.
3134  */
3135 /*@{*/
3136 #define BP_USB_OBSERVE_DMPD  (4U)          /*!< Bit position for USB_OBSERVE_DMPD. */
3137 #define BM_USB_OBSERVE_DMPD  (0x10U)       /*!< Bit mask for USB_OBSERVE_DMPD. */
3138 #define BS_USB_OBSERVE_DMPD  (1U)          /*!< Bit field size in bits for USB_OBSERVE_DMPD. */
3139
3140 /*! @brief Read current value of the USB_OBSERVE_DMPD field. */
3141 #define BR_USB_OBSERVE_DMPD(x) (BITBAND_ACCESS8(HW_USB_OBSERVE_ADDR(x), BP_USB_OBSERVE_DMPD))
3142 /*@}*/
3143
3144 /*!
3145  * @name Register USB_OBSERVE, field DPPD[6] (RO)
3146  *
3147  * Provides observability of the D+ Pulldown enable at the USB transceiver.
3148  *
3149  * Values:
3150  * - 0 - D+ pulldown disabled.
3151  * - 1 - D+ pulldown enabled.
3152  */
3153 /*@{*/
3154 #define BP_USB_OBSERVE_DPPD  (6U)          /*!< Bit position for USB_OBSERVE_DPPD. */
3155 #define BM_USB_OBSERVE_DPPD  (0x40U)       /*!< Bit mask for USB_OBSERVE_DPPD. */
3156 #define BS_USB_OBSERVE_DPPD  (1U)          /*!< Bit field size in bits for USB_OBSERVE_DPPD. */
3157
3158 /*! @brief Read current value of the USB_OBSERVE_DPPD field. */
3159 #define BR_USB_OBSERVE_DPPD(x) (BITBAND_ACCESS8(HW_USB_OBSERVE_ADDR(x), BP_USB_OBSERVE_DPPD))
3160 /*@}*/
3161
3162 /*!
3163  * @name Register USB_OBSERVE, field DPPU[7] (RO)
3164  *
3165  * Provides observability of the D+ Pullup enable at the USB transceiver.
3166  *
3167  * Values:
3168  * - 0 - D+ pullup disabled.
3169  * - 1 - D+ pullup enabled.
3170  */
3171 /*@{*/
3172 #define BP_USB_OBSERVE_DPPU  (7U)          /*!< Bit position for USB_OBSERVE_DPPU. */
3173 #define BM_USB_OBSERVE_DPPU  (0x80U)       /*!< Bit mask for USB_OBSERVE_DPPU. */
3174 #define BS_USB_OBSERVE_DPPU  (1U)          /*!< Bit field size in bits for USB_OBSERVE_DPPU. */
3175
3176 /*! @brief Read current value of the USB_OBSERVE_DPPU field. */
3177 #define BR_USB_OBSERVE_DPPU(x) (BITBAND_ACCESS8(HW_USB_OBSERVE_ADDR(x), BP_USB_OBSERVE_DPPU))
3178 /*@}*/
3179
3180 /*******************************************************************************
3181  * HW_USB_CONTROL - USB OTG Control register
3182  ******************************************************************************/
3183
3184 /*!
3185  * @brief HW_USB_CONTROL - USB OTG Control register (RW)
3186  *
3187  * Reset value: 0x00U
3188  */
3189 typedef union _hw_usb_control
3190 {
3191     uint8_t U;
3192     struct _hw_usb_control_bitfields
3193     {
3194         uint8_t RESERVED0 : 4;         /*!< [3:0]  */
3195         uint8_t DPPULLUPNONOTG : 1;    /*!< [4]  */
3196         uint8_t RESERVED1 : 3;         /*!< [7:5]  */
3197     } B;
3198 } hw_usb_control_t;
3199
3200 /*!
3201  * @name Constants and macros for entire USB_CONTROL register
3202  */
3203 /*@{*/
3204 #define HW_USB_CONTROL_ADDR(x)   ((x) + 0x108U)
3205
3206 #define HW_USB_CONTROL(x)        (*(__IO hw_usb_control_t *) HW_USB_CONTROL_ADDR(x))
3207 #define HW_USB_CONTROL_RD(x)     (HW_USB_CONTROL(x).U)
3208 #define HW_USB_CONTROL_WR(x, v)  (HW_USB_CONTROL(x).U = (v))
3209 #define HW_USB_CONTROL_SET(x, v) (HW_USB_CONTROL_WR(x, HW_USB_CONTROL_RD(x) |  (v)))
3210 #define HW_USB_CONTROL_CLR(x, v) (HW_USB_CONTROL_WR(x, HW_USB_CONTROL_RD(x) & ~(v)))
3211 #define HW_USB_CONTROL_TOG(x, v) (HW_USB_CONTROL_WR(x, HW_USB_CONTROL_RD(x) ^  (v)))
3212 /*@}*/
3213
3214 /*
3215  * Constants & macros for individual USB_CONTROL bitfields
3216  */
3217
3218 /*!
3219  * @name Register USB_CONTROL, field DPPULLUPNONOTG[4] (RW)
3220  *
3221  * Provides control of the DP Pullup in USBOTG, if USB is configured in non-OTG
3222  * device mode.
3223  *
3224  * Values:
3225  * - 0 - DP Pullup in non-OTG device mode is not enabled.
3226  * - 1 - DP Pullup in non-OTG device mode is enabled.
3227  */
3228 /*@{*/
3229 #define BP_USB_CONTROL_DPPULLUPNONOTG (4U) /*!< Bit position for USB_CONTROL_DPPULLUPNONOTG. */
3230 #define BM_USB_CONTROL_DPPULLUPNONOTG (0x10U) /*!< Bit mask for USB_CONTROL_DPPULLUPNONOTG. */
3231 #define BS_USB_CONTROL_DPPULLUPNONOTG (1U) /*!< Bit field size in bits for USB_CONTROL_DPPULLUPNONOTG. */
3232
3233 /*! @brief Read current value of the USB_CONTROL_DPPULLUPNONOTG field. */
3234 #define BR_USB_CONTROL_DPPULLUPNONOTG(x) (BITBAND_ACCESS8(HW_USB_CONTROL_ADDR(x), BP_USB_CONTROL_DPPULLUPNONOTG))
3235
3236 /*! @brief Format value for bitfield USB_CONTROL_DPPULLUPNONOTG. */
3237 #define BF_USB_CONTROL_DPPULLUPNONOTG(v) ((uint8_t)((uint8_t)(v) << BP_USB_CONTROL_DPPULLUPNONOTG) & BM_USB_CONTROL_DPPULLUPNONOTG)
3238
3239 /*! @brief Set the DPPULLUPNONOTG field to a new value. */
3240 #define BW_USB_CONTROL_DPPULLUPNONOTG(x, v) (BITBAND_ACCESS8(HW_USB_CONTROL_ADDR(x), BP_USB_CONTROL_DPPULLUPNONOTG) = (v))
3241 /*@}*/
3242
3243 /*******************************************************************************
3244  * HW_USB_USBTRC0 - USB Transceiver Control register 0
3245  ******************************************************************************/
3246
3247 /*!
3248  * @brief HW_USB_USBTRC0 - USB Transceiver Control register 0 (RW)
3249  *
3250  * Reset value: 0x00U
3251  *
3252  * Includes signals for basic operation of the on-chip USB Full Speed
3253  * transceiver and configuration of the USB data connection that are not otherwise included
3254  * in the USB Full Speed controller registers.
3255  */
3256 typedef union _hw_usb_usbtrc0
3257 {
3258     uint8_t U;
3259     struct _hw_usb_usbtrc0_bitfields
3260     {
3261         uint8_t USB_RESUME_INT : 1;    /*!< [0] USB Asynchronous Interrupt */
3262         uint8_t SYNC_DET : 1;          /*!< [1] Synchronous USB Interrupt Detect */
3263         uint8_t USB_CLK_RECOVERY_INT : 1; /*!< [2] Combined USB Clock
3264                                         * Recovery interrupt status */
3265         uint8_t RESERVED0 : 2;         /*!< [4:3]  */
3266         uint8_t USBRESMEN : 1;         /*!< [5] Asynchronous Resume Interrupt Enable
3267                                         * */
3268         uint8_t RESERVED1 : 1;         /*!< [6]  */
3269         uint8_t USBRESET : 1;          /*!< [7] USB Reset */
3270     } B;
3271 } hw_usb_usbtrc0_t;
3272
3273 /*!
3274  * @name Constants and macros for entire USB_USBTRC0 register
3275  */
3276 /*@{*/
3277 #define HW_USB_USBTRC0_ADDR(x)   ((x) + 0x10CU)
3278
3279 #define HW_USB_USBTRC0(x)        (*(__IO hw_usb_usbtrc0_t *) HW_USB_USBTRC0_ADDR(x))
3280 #define HW_USB_USBTRC0_RD(x)     (HW_USB_USBTRC0(x).U)
3281 #define HW_USB_USBTRC0_WR(x, v)  (HW_USB_USBTRC0(x).U = (v))
3282 #define HW_USB_USBTRC0_SET(x, v) (HW_USB_USBTRC0_WR(x, HW_USB_USBTRC0_RD(x) |  (v)))
3283 #define HW_USB_USBTRC0_CLR(x, v) (HW_USB_USBTRC0_WR(x, HW_USB_USBTRC0_RD(x) & ~(v)))
3284 #define HW_USB_USBTRC0_TOG(x, v) (HW_USB_USBTRC0_WR(x, HW_USB_USBTRC0_RD(x) ^  (v)))
3285 /*@}*/
3286
3287 /*
3288  * Constants & macros for individual USB_USBTRC0 bitfields
3289  */
3290
3291 /*!
3292  * @name Register USB_USBTRC0, field USB_RESUME_INT[0] (RO)
3293  *
3294  * Values:
3295  * - 0 - No interrupt was generated.
3296  * - 1 - Interrupt was generated because of the USB asynchronous interrupt.
3297  */
3298 /*@{*/
3299 #define BP_USB_USBTRC0_USB_RESUME_INT (0U) /*!< Bit position for USB_USBTRC0_USB_RESUME_INT. */
3300 #define BM_USB_USBTRC0_USB_RESUME_INT (0x01U) /*!< Bit mask for USB_USBTRC0_USB_RESUME_INT. */
3301 #define BS_USB_USBTRC0_USB_RESUME_INT (1U) /*!< Bit field size in bits for USB_USBTRC0_USB_RESUME_INT. */
3302
3303 /*! @brief Read current value of the USB_USBTRC0_USB_RESUME_INT field. */
3304 #define BR_USB_USBTRC0_USB_RESUME_INT(x) (BITBAND_ACCESS8(HW_USB_USBTRC0_ADDR(x), BP_USB_USBTRC0_USB_RESUME_INT))
3305 /*@}*/
3306
3307 /*!
3308  * @name Register USB_USBTRC0, field SYNC_DET[1] (RO)
3309  *
3310  * Values:
3311  * - 0 - Synchronous interrupt has not been detected.
3312  * - 1 - Synchronous interrupt has been detected.
3313  */
3314 /*@{*/
3315 #define BP_USB_USBTRC0_SYNC_DET (1U)       /*!< Bit position for USB_USBTRC0_SYNC_DET. */
3316 #define BM_USB_USBTRC0_SYNC_DET (0x02U)    /*!< Bit mask for USB_USBTRC0_SYNC_DET. */
3317 #define BS_USB_USBTRC0_SYNC_DET (1U)       /*!< Bit field size in bits for USB_USBTRC0_SYNC_DET. */
3318
3319 /*! @brief Read current value of the USB_USBTRC0_SYNC_DET field. */
3320 #define BR_USB_USBTRC0_SYNC_DET(x) (BITBAND_ACCESS8(HW_USB_USBTRC0_ADDR(x), BP_USB_USBTRC0_SYNC_DET))
3321 /*@}*/
3322
3323 /*!
3324  * @name Register USB_USBTRC0, field USB_CLK_RECOVERY_INT[2] (RO)
3325  *
3326  * This read-only field will be set to value high at 1'b1 when any of USB clock
3327  * recovery interrupt conditions are detected and those interrupts are unmasked.
3328  * For customer use the only unmasked USB clock recovery interrupt condition
3329  * results from an overflow of the frequency trim setting values indicating that the
3330  * frequency trim calculated is out of the adjustment range of the IRC48M output
3331  * clock. To clear this bit after it has been set, Write 0xFF to register
3332  * USB_CLK_RECOVER_INT_STATUS.
3333  */
3334 /*@{*/
3335 #define BP_USB_USBTRC0_USB_CLK_RECOVERY_INT (2U) /*!< Bit position for USB_USBTRC0_USB_CLK_RECOVERY_INT. */
3336 #define BM_USB_USBTRC0_USB_CLK_RECOVERY_INT (0x04U) /*!< Bit mask for USB_USBTRC0_USB_CLK_RECOVERY_INT. */
3337 #define BS_USB_USBTRC0_USB_CLK_RECOVERY_INT (1U) /*!< Bit field size in bits for USB_USBTRC0_USB_CLK_RECOVERY_INT. */
3338
3339 /*! @brief Read current value of the USB_USBTRC0_USB_CLK_RECOVERY_INT field. */
3340 #define BR_USB_USBTRC0_USB_CLK_RECOVERY_INT(x) (BITBAND_ACCESS8(HW_USB_USBTRC0_ADDR(x), BP_USB_USBTRC0_USB_CLK_RECOVERY_INT))
3341 /*@}*/
3342
3343 /*!
3344  * @name Register USB_USBTRC0, field USBRESMEN[5] (RW)
3345  *
3346  * This bit, when set, allows the USB module to send an asynchronous wakeup
3347  * event to the MCU upon detection of resume signaling on the USB bus. The MCU then
3348  * re-enables clocks to the USB module. It is used for low-power suspend mode when
3349  * USB module clocks are stopped or the USB transceiver is in Suspend mode.
3350  * Async wakeup only works in device mode.
3351  *
3352  * Values:
3353  * - 0 - USB asynchronous wakeup from suspend mode disabled.
3354  * - 1 - USB asynchronous wakeup from suspend mode enabled. The asynchronous
3355  *     resume interrupt differs from the synchronous resume interrupt in that it
3356  *     asynchronously detects K-state using the unfiltered state of the D+ and D-
3357  *     pins. This interrupt should only be enabled when the Transceiver is
3358  *     suspended.
3359  */
3360 /*@{*/
3361 #define BP_USB_USBTRC0_USBRESMEN (5U)      /*!< Bit position for USB_USBTRC0_USBRESMEN. */
3362 #define BM_USB_USBTRC0_USBRESMEN (0x20U)   /*!< Bit mask for USB_USBTRC0_USBRESMEN. */
3363 #define BS_USB_USBTRC0_USBRESMEN (1U)      /*!< Bit field size in bits for USB_USBTRC0_USBRESMEN. */
3364
3365 /*! @brief Read current value of the USB_USBTRC0_USBRESMEN field. */
3366 #define BR_USB_USBTRC0_USBRESMEN(x) (BITBAND_ACCESS8(HW_USB_USBTRC0_ADDR(x), BP_USB_USBTRC0_USBRESMEN))
3367
3368 /*! @brief Format value for bitfield USB_USBTRC0_USBRESMEN. */
3369 #define BF_USB_USBTRC0_USBRESMEN(v) ((uint8_t)((uint8_t)(v) << BP_USB_USBTRC0_USBRESMEN) & BM_USB_USBTRC0_USBRESMEN)
3370
3371 /*! @brief Set the USBRESMEN field to a new value. */
3372 #define BW_USB_USBTRC0_USBRESMEN(x, v) (BITBAND_ACCESS8(HW_USB_USBTRC0_ADDR(x), BP_USB_USBTRC0_USBRESMEN) = (v))
3373 /*@}*/
3374
3375 /*!
3376  * @name Register USB_USBTRC0, field USBRESET[7] (WO)
3377  *
3378  * Generates a hard reset to USBOTG. After this bit is set and the reset occurs,
3379  * this bit is automatically cleared. This bit is always read as zero. Wait two
3380  * USB clock cycles after setting this bit.
3381  *
3382  * Values:
3383  * - 0 - Normal USB module operation.
3384  * - 1 - Returns the USB module to its reset state.
3385  */
3386 /*@{*/
3387 #define BP_USB_USBTRC0_USBRESET (7U)       /*!< Bit position for USB_USBTRC0_USBRESET. */
3388 #define BM_USB_USBTRC0_USBRESET (0x80U)    /*!< Bit mask for USB_USBTRC0_USBRESET. */
3389 #define BS_USB_USBTRC0_USBRESET (1U)       /*!< Bit field size in bits for USB_USBTRC0_USBRESET. */
3390
3391 /*! @brief Format value for bitfield USB_USBTRC0_USBRESET. */
3392 #define BF_USB_USBTRC0_USBRESET(v) ((uint8_t)((uint8_t)(v) << BP_USB_USBTRC0_USBRESET) & BM_USB_USBTRC0_USBRESET)
3393 /*@}*/
3394
3395 /*******************************************************************************
3396  * HW_USB_USBFRMADJUST - Frame Adjust Register
3397  ******************************************************************************/
3398
3399 /*!
3400  * @brief HW_USB_USBFRMADJUST - Frame Adjust Register (RW)
3401  *
3402  * Reset value: 0x00U
3403  */
3404 typedef union _hw_usb_usbfrmadjust
3405 {
3406     uint8_t U;
3407     struct _hw_usb_usbfrmadjust_bitfields
3408     {
3409         uint8_t ADJ : 8;               /*!< [7:0] Frame Adjustment */
3410     } B;
3411 } hw_usb_usbfrmadjust_t;
3412
3413 /*!
3414  * @name Constants and macros for entire USB_USBFRMADJUST register
3415  */
3416 /*@{*/
3417 #define HW_USB_USBFRMADJUST_ADDR(x) ((x) + 0x114U)
3418
3419 #define HW_USB_USBFRMADJUST(x)   (*(__IO hw_usb_usbfrmadjust_t *) HW_USB_USBFRMADJUST_ADDR(x))
3420 #define HW_USB_USBFRMADJUST_RD(x) (HW_USB_USBFRMADJUST(x).U)
3421 #define HW_USB_USBFRMADJUST_WR(x, v) (HW_USB_USBFRMADJUST(x).U = (v))
3422 #define HW_USB_USBFRMADJUST_SET(x, v) (HW_USB_USBFRMADJUST_WR(x, HW_USB_USBFRMADJUST_RD(x) |  (v)))
3423 #define HW_USB_USBFRMADJUST_CLR(x, v) (HW_USB_USBFRMADJUST_WR(x, HW_USB_USBFRMADJUST_RD(x) & ~(v)))
3424 #define HW_USB_USBFRMADJUST_TOG(x, v) (HW_USB_USBFRMADJUST_WR(x, HW_USB_USBFRMADJUST_RD(x) ^  (v)))
3425 /*@}*/
3426
3427 /*
3428  * Constants & macros for individual USB_USBFRMADJUST bitfields
3429  */
3430
3431 /*!
3432  * @name Register USB_USBFRMADJUST, field ADJ[7:0] (RW)
3433  *
3434  * In Host mode, the frame adjustment is a twos complement number that adjusts
3435  * the period of each USB frame in 12-MHz clock periods. A SOF is normally
3436  * generated every 12,000 12-MHz clock cycles. The Frame Adjust Register can adjust this
3437  * by -128 to +127 to compensate for inaccuracies in the USB 48-MHz clock.
3438  * Changes to the ADJ bit take effect at the next start of the next frame.
3439  */
3440 /*@{*/
3441 #define BP_USB_USBFRMADJUST_ADJ (0U)       /*!< Bit position for USB_USBFRMADJUST_ADJ. */
3442 #define BM_USB_USBFRMADJUST_ADJ (0xFFU)    /*!< Bit mask for USB_USBFRMADJUST_ADJ. */
3443 #define BS_USB_USBFRMADJUST_ADJ (8U)       /*!< Bit field size in bits for USB_USBFRMADJUST_ADJ. */
3444
3445 /*! @brief Read current value of the USB_USBFRMADJUST_ADJ field. */
3446 #define BR_USB_USBFRMADJUST_ADJ(x) (HW_USB_USBFRMADJUST(x).U)
3447
3448 /*! @brief Format value for bitfield USB_USBFRMADJUST_ADJ. */
3449 #define BF_USB_USBFRMADJUST_ADJ(v) ((uint8_t)((uint8_t)(v) << BP_USB_USBFRMADJUST_ADJ) & BM_USB_USBFRMADJUST_ADJ)
3450
3451 /*! @brief Set the ADJ field to a new value. */
3452 #define BW_USB_USBFRMADJUST_ADJ(x, v) (HW_USB_USBFRMADJUST_WR(x, v))
3453 /*@}*/
3454
3455 /*******************************************************************************
3456  * HW_USB_CLK_RECOVER_CTRL - USB Clock recovery control
3457  ******************************************************************************/
3458
3459 /*!
3460  * @brief HW_USB_CLK_RECOVER_CTRL - USB Clock recovery control (RW)
3461  *
3462  * Reset value: 0x00U
3463  *
3464  * Signals in this register control the crystal-less USB clock mode in which the
3465  * internal IRC48M oscillator is tuned to match the clock extracted from the
3466  * incoming USB data stream. The IRC48M internal oscillator module must be enabled
3467  * in register USB_CLK_RECOVER_IRC_EN for this mode.
3468  */
3469 typedef union _hw_usb_clk_recover_ctrl
3470 {
3471     uint8_t U;
3472     struct _hw_usb_clk_recover_ctrl_bitfields
3473     {
3474         uint8_t RESERVED0 : 5;         /*!< [4:0]  */
3475         uint8_t RESTART_IFRTRIM_EN : 1; /*!< [5] Restart from IFR trim value
3476                                         * */
3477         uint8_t RESET_RESUME_ROUGH_EN : 1; /*!< [6] Reset/resume to rough
3478                                         * phase enable */
3479         uint8_t CLOCK_RECOVER_EN : 1;  /*!< [7] Crystal-less USB enable */
3480     } B;
3481 } hw_usb_clk_recover_ctrl_t;
3482
3483 /*!
3484  * @name Constants and macros for entire USB_CLK_RECOVER_CTRL register
3485  */
3486 /*@{*/
3487 #define HW_USB_CLK_RECOVER_CTRL_ADDR(x) ((x) + 0x140U)
3488
3489 #define HW_USB_CLK_RECOVER_CTRL(x) (*(__IO hw_usb_clk_recover_ctrl_t *) HW_USB_CLK_RECOVER_CTRL_ADDR(x))
3490 #define HW_USB_CLK_RECOVER_CTRL_RD(x) (HW_USB_CLK_RECOVER_CTRL(x).U)
3491 #define HW_USB_CLK_RECOVER_CTRL_WR(x, v) (HW_USB_CLK_RECOVER_CTRL(x).U = (v))
3492 #define HW_USB_CLK_RECOVER_CTRL_SET(x, v) (HW_USB_CLK_RECOVER_CTRL_WR(x, HW_USB_CLK_RECOVER_CTRL_RD(x) |  (v)))
3493 #define HW_USB_CLK_RECOVER_CTRL_CLR(x, v) (HW_USB_CLK_RECOVER_CTRL_WR(x, HW_USB_CLK_RECOVER_CTRL_RD(x) & ~(v)))
3494 #define HW_USB_CLK_RECOVER_CTRL_TOG(x, v) (HW_USB_CLK_RECOVER_CTRL_WR(x, HW_USB_CLK_RECOVER_CTRL_RD(x) ^  (v)))
3495 /*@}*/
3496
3497 /*
3498  * Constants & macros for individual USB_CLK_RECOVER_CTRL bitfields
3499  */
3500
3501 /*!
3502  * @name Register USB_CLK_RECOVER_CTRL, field RESTART_IFRTRIM_EN[5] (RW)
3503  *
3504  * IRC48 has a default trim fine value whose default value is factory trimmed
3505  * (the IFR trim value). Clock recover block tracks the accuracy of the clock 48Mhz
3506  * and keeps updating the trim fine value accordingly
3507  *
3508  * Values:
3509  * - 0 - Trim fine adjustment always works based on the previous updated trim
3510  *     fine value (default)
3511  * - 1 - Trim fine restarts from the IFR trim value whenever
3512  *     bus_reset/bus_resume is detected or module enable is desasserted
3513  */
3514 /*@{*/
3515 #define BP_USB_CLK_RECOVER_CTRL_RESTART_IFRTRIM_EN (5U) /*!< Bit position for USB_CLK_RECOVER_CTRL_RESTART_IFRTRIM_EN. */
3516 #define BM_USB_CLK_RECOVER_CTRL_RESTART_IFRTRIM_EN (0x20U) /*!< Bit mask for USB_CLK_RECOVER_CTRL_RESTART_IFRTRIM_EN. */
3517 #define BS_USB_CLK_RECOVER_CTRL_RESTART_IFRTRIM_EN (1U) /*!< Bit field size in bits for USB_CLK_RECOVER_CTRL_RESTART_IFRTRIM_EN. */
3518
3519 /*! @brief Read current value of the USB_CLK_RECOVER_CTRL_RESTART_IFRTRIM_EN field. */
3520 #define BR_USB_CLK_RECOVER_CTRL_RESTART_IFRTRIM_EN(x) (BITBAND_ACCESS8(HW_USB_CLK_RECOVER_CTRL_ADDR(x), BP_USB_CLK_RECOVER_CTRL_RESTART_IFRTRIM_EN))
3521
3522 /*! @brief Format value for bitfield USB_CLK_RECOVER_CTRL_RESTART_IFRTRIM_EN. */
3523 #define BF_USB_CLK_RECOVER_CTRL_RESTART_IFRTRIM_EN(v) ((uint8_t)((uint8_t)(v) << BP_USB_CLK_RECOVER_CTRL_RESTART_IFRTRIM_EN) & BM_USB_CLK_RECOVER_CTRL_RESTART_IFRTRIM_EN)
3524
3525 /*! @brief Set the RESTART_IFRTRIM_EN field to a new value. */
3526 #define BW_USB_CLK_RECOVER_CTRL_RESTART_IFRTRIM_EN(x, v) (BITBAND_ACCESS8(HW_USB_CLK_RECOVER_CTRL_ADDR(x), BP_USB_CLK_RECOVER_CTRL_RESTART_IFRTRIM_EN) = (v))
3527 /*@}*/
3528
3529 /*!
3530  * @name Register USB_CLK_RECOVER_CTRL, field RESET_RESUME_ROUGH_EN[6] (RW)
3531  *
3532  * The clock recovery block tracks the IRC48Mhz to get an accurate 48Mhz clock.
3533  * It has two phases after user enables clock_recover_en bit, rough phase and
3534  * tracking phase. The step to fine tune the IRC 48Mhz by adjusting the trim fine
3535  * value is different during these two phases. The step in rough phase is larger
3536  * than that in tracking phase. Switch back to rough stage whenever USB bus reset
3537  * or bus resume occurs.
3538  *
3539  * Values:
3540  * - 0 - Always works in tracking phase after the 1st time rough to track
3541  *     transition (default)
3542  * - 1 - Go back to rough stage whenever bus reset or bus resume occurs
3543  */
3544 /*@{*/
3545 #define BP_USB_CLK_RECOVER_CTRL_RESET_RESUME_ROUGH_EN (6U) /*!< Bit position for USB_CLK_RECOVER_CTRL_RESET_RESUME_ROUGH_EN. */
3546 #define BM_USB_CLK_RECOVER_CTRL_RESET_RESUME_ROUGH_EN (0x40U) /*!< Bit mask for USB_CLK_RECOVER_CTRL_RESET_RESUME_ROUGH_EN. */
3547 #define BS_USB_CLK_RECOVER_CTRL_RESET_RESUME_ROUGH_EN (1U) /*!< Bit field size in bits for USB_CLK_RECOVER_CTRL_RESET_RESUME_ROUGH_EN. */
3548
3549 /*! @brief Read current value of the USB_CLK_RECOVER_CTRL_RESET_RESUME_ROUGH_EN field. */
3550 #define BR_USB_CLK_RECOVER_CTRL_RESET_RESUME_ROUGH_EN(x) (BITBAND_ACCESS8(HW_USB_CLK_RECOVER_CTRL_ADDR(x), BP_USB_CLK_RECOVER_CTRL_RESET_RESUME_ROUGH_EN))
3551
3552 /*! @brief Format value for bitfield USB_CLK_RECOVER_CTRL_RESET_RESUME_ROUGH_EN. */
3553 #define BF_USB_CLK_RECOVER_CTRL_RESET_RESUME_ROUGH_EN(v) ((uint8_t)((uint8_t)(v) << BP_USB_CLK_RECOVER_CTRL_RESET_RESUME_ROUGH_EN) & BM_USB_CLK_RECOVER_CTRL_RESET_RESUME_ROUGH_EN)
3554
3555 /*! @brief Set the RESET_RESUME_ROUGH_EN field to a new value. */
3556 #define BW_USB_CLK_RECOVER_CTRL_RESET_RESUME_ROUGH_EN(x, v) (BITBAND_ACCESS8(HW_USB_CLK_RECOVER_CTRL_ADDR(x), BP_USB_CLK_RECOVER_CTRL_RESET_RESUME_ROUGH_EN) = (v))
3557 /*@}*/
3558
3559 /*!
3560  * @name Register USB_CLK_RECOVER_CTRL, field CLOCK_RECOVER_EN[7] (RW)
3561  *
3562  * This bit must be enabled if user wants to use the crystal-less USB mode for
3563  * the Full Speed USB controller and transceiver. This bit should not be set for
3564  * USB host mode or OTG.
3565  *
3566  * Values:
3567  * - 0 - Disable clock recovery block (default)
3568  * - 1 - Enable clock recovery block
3569  */
3570 /*@{*/
3571 #define BP_USB_CLK_RECOVER_CTRL_CLOCK_RECOVER_EN (7U) /*!< Bit position for USB_CLK_RECOVER_CTRL_CLOCK_RECOVER_EN. */
3572 #define BM_USB_CLK_RECOVER_CTRL_CLOCK_RECOVER_EN (0x80U) /*!< Bit mask for USB_CLK_RECOVER_CTRL_CLOCK_RECOVER_EN. */
3573 #define BS_USB_CLK_RECOVER_CTRL_CLOCK_RECOVER_EN (1U) /*!< Bit field size in bits for USB_CLK_RECOVER_CTRL_CLOCK_RECOVER_EN. */
3574
3575 /*! @brief Read current value of the USB_CLK_RECOVER_CTRL_CLOCK_RECOVER_EN field. */
3576 #define BR_USB_CLK_RECOVER_CTRL_CLOCK_RECOVER_EN(x) (BITBAND_ACCESS8(HW_USB_CLK_RECOVER_CTRL_ADDR(x), BP_USB_CLK_RECOVER_CTRL_CLOCK_RECOVER_EN))
3577
3578 /*! @brief Format value for bitfield USB_CLK_RECOVER_CTRL_CLOCK_RECOVER_EN. */
3579 #define BF_USB_CLK_RECOVER_CTRL_CLOCK_RECOVER_EN(v) ((uint8_t)((uint8_t)(v) << BP_USB_CLK_RECOVER_CTRL_CLOCK_RECOVER_EN) & BM_USB_CLK_RECOVER_CTRL_CLOCK_RECOVER_EN)
3580
3581 /*! @brief Set the CLOCK_RECOVER_EN field to a new value. */
3582 #define BW_USB_CLK_RECOVER_CTRL_CLOCK_RECOVER_EN(x, v) (BITBAND_ACCESS8(HW_USB_CLK_RECOVER_CTRL_ADDR(x), BP_USB_CLK_RECOVER_CTRL_CLOCK_RECOVER_EN) = (v))
3583 /*@}*/
3584
3585 /*******************************************************************************
3586  * HW_USB_CLK_RECOVER_IRC_EN - IRC48M oscillator enable register
3587  ******************************************************************************/
3588
3589 /*!
3590  * @brief HW_USB_CLK_RECOVER_IRC_EN - IRC48M oscillator enable register (RW)
3591  *
3592  * Reset value: 0x01U
3593  *
3594  * Controls basic operation of the on-chip IRC48M module used to produce nominal
3595  * 48MHz clocks for USB crystal-less operation and other functions. See
3596  * additional information about the IRC48M operation in the Clock Distribution chapter.
3597  */
3598 typedef union _hw_usb_clk_recover_irc_en
3599 {
3600     uint8_t U;
3601     struct _hw_usb_clk_recover_irc_en_bitfields
3602     {
3603         uint8_t REG_EN : 1;            /*!< [0] IRC48M regulator enable */
3604         uint8_t IRC_EN : 1;            /*!< [1] IRC48M enable */
3605         uint8_t RESERVED0 : 6;         /*!< [7:2]  */
3606     } B;
3607 } hw_usb_clk_recover_irc_en_t;
3608
3609 /*!
3610  * @name Constants and macros for entire USB_CLK_RECOVER_IRC_EN register
3611  */
3612 /*@{*/
3613 #define HW_USB_CLK_RECOVER_IRC_EN_ADDR(x) ((x) + 0x144U)
3614
3615 #define HW_USB_CLK_RECOVER_IRC_EN(x) (*(__IO hw_usb_clk_recover_irc_en_t *) HW_USB_CLK_RECOVER_IRC_EN_ADDR(x))
3616 #define HW_USB_CLK_RECOVER_IRC_EN_RD(x) (HW_USB_CLK_RECOVER_IRC_EN(x).U)
3617 #define HW_USB_CLK_RECOVER_IRC_EN_WR(x, v) (HW_USB_CLK_RECOVER_IRC_EN(x).U = (v))
3618 #define HW_USB_CLK_RECOVER_IRC_EN_SET(x, v) (HW_USB_CLK_RECOVER_IRC_EN_WR(x, HW_USB_CLK_RECOVER_IRC_EN_RD(x) |  (v)))
3619 #define HW_USB_CLK_RECOVER_IRC_EN_CLR(x, v) (HW_USB_CLK_RECOVER_IRC_EN_WR(x, HW_USB_CLK_RECOVER_IRC_EN_RD(x) & ~(v)))
3620 #define HW_USB_CLK_RECOVER_IRC_EN_TOG(x, v) (HW_USB_CLK_RECOVER_IRC_EN_WR(x, HW_USB_CLK_RECOVER_IRC_EN_RD(x) ^  (v)))
3621 /*@}*/
3622
3623 /*
3624  * Constants & macros for individual USB_CLK_RECOVER_IRC_EN bitfields
3625  */
3626
3627 /*!
3628  * @name Register USB_CLK_RECOVER_IRC_EN, field REG_EN[0] (RW)
3629  *
3630  * This bit is used to enable the local analog regulator for IRC48Mhz module.
3631  * This bit must be set if user wants to use the crystal-less USB clock
3632  * configuration.
3633  *
3634  * Values:
3635  * - 0 - IRC48M local regulator is disabled
3636  * - 1 - IRC48M local regulator is enabled (default)
3637  */
3638 /*@{*/
3639 #define BP_USB_CLK_RECOVER_IRC_EN_REG_EN (0U) /*!< Bit position for USB_CLK_RECOVER_IRC_EN_REG_EN. */
3640 #define BM_USB_CLK_RECOVER_IRC_EN_REG_EN (0x01U) /*!< Bit mask for USB_CLK_RECOVER_IRC_EN_REG_EN. */
3641 #define BS_USB_CLK_RECOVER_IRC_EN_REG_EN (1U) /*!< Bit field size in bits for USB_CLK_RECOVER_IRC_EN_REG_EN. */
3642
3643 /*! @brief Read current value of the USB_CLK_RECOVER_IRC_EN_REG_EN field. */
3644 #define BR_USB_CLK_RECOVER_IRC_EN_REG_EN(x) (BITBAND_ACCESS8(HW_USB_CLK_RECOVER_IRC_EN_ADDR(x), BP_USB_CLK_RECOVER_IRC_EN_REG_EN))
3645
3646 /*! @brief Format value for bitfield USB_CLK_RECOVER_IRC_EN_REG_EN. */
3647 #define BF_USB_CLK_RECOVER_IRC_EN_REG_EN(v) ((uint8_t)((uint8_t)(v) << BP_USB_CLK_RECOVER_IRC_EN_REG_EN) & BM_USB_CLK_RECOVER_IRC_EN_REG_EN)
3648
3649 /*! @brief Set the REG_EN field to a new value. */
3650 #define BW_USB_CLK_RECOVER_IRC_EN_REG_EN(x, v) (BITBAND_ACCESS8(HW_USB_CLK_RECOVER_IRC_EN_ADDR(x), BP_USB_CLK_RECOVER_IRC_EN_REG_EN) = (v))
3651 /*@}*/
3652
3653 /*!
3654  * @name Register USB_CLK_RECOVER_IRC_EN, field IRC_EN[1] (RW)
3655  *
3656  * This bit is used to enable the on-chip IRC48Mhz module to generate clocks for
3657  * crystal-less USB. It can only be used for FS USB device mode operation. This
3658  * bit must be set before using the crystal-less USB clock configuration.
3659  *
3660  * Values:
3661  * - 0 - Disable the IRC48M module (default)
3662  * - 1 - Enable the IRC48M module
3663  */
3664 /*@{*/
3665 #define BP_USB_CLK_RECOVER_IRC_EN_IRC_EN (1U) /*!< Bit position for USB_CLK_RECOVER_IRC_EN_IRC_EN. */
3666 #define BM_USB_CLK_RECOVER_IRC_EN_IRC_EN (0x02U) /*!< Bit mask for USB_CLK_RECOVER_IRC_EN_IRC_EN. */
3667 #define BS_USB_CLK_RECOVER_IRC_EN_IRC_EN (1U) /*!< Bit field size in bits for USB_CLK_RECOVER_IRC_EN_IRC_EN. */
3668
3669 /*! @brief Read current value of the USB_CLK_RECOVER_IRC_EN_IRC_EN field. */
3670 #define BR_USB_CLK_RECOVER_IRC_EN_IRC_EN(x) (BITBAND_ACCESS8(HW_USB_CLK_RECOVER_IRC_EN_ADDR(x), BP_USB_CLK_RECOVER_IRC_EN_IRC_EN))
3671
3672 /*! @brief Format value for bitfield USB_CLK_RECOVER_IRC_EN_IRC_EN. */
3673 #define BF_USB_CLK_RECOVER_IRC_EN_IRC_EN(v) ((uint8_t)((uint8_t)(v) << BP_USB_CLK_RECOVER_IRC_EN_IRC_EN) & BM_USB_CLK_RECOVER_IRC_EN_IRC_EN)
3674
3675 /*! @brief Set the IRC_EN field to a new value. */
3676 #define BW_USB_CLK_RECOVER_IRC_EN_IRC_EN(x, v) (BITBAND_ACCESS8(HW_USB_CLK_RECOVER_IRC_EN_ADDR(x), BP_USB_CLK_RECOVER_IRC_EN_IRC_EN) = (v))
3677 /*@}*/
3678
3679 /*******************************************************************************
3680  * HW_USB_CLK_RECOVER_INT_STATUS - Clock recovery separated interrupt status
3681  ******************************************************************************/
3682
3683 /*!
3684  * @brief HW_USB_CLK_RECOVER_INT_STATUS - Clock recovery separated interrupt status (W1C)
3685  *
3686  * Reset value: 0x00U
3687  *
3688  * A Write operation with value high at 1'b1 on any combination of individual
3689  * bits will clear those bits.
3690  */
3691 typedef union _hw_usb_clk_recover_int_status
3692 {
3693     uint8_t U;
3694     struct _hw_usb_clk_recover_int_status_bitfields
3695     {
3696         uint8_t RESERVED0 : 4;         /*!< [3:0]  */
3697         uint8_t OVF_ERROR : 1;         /*!< [4]  */
3698         uint8_t RESERVED1 : 3;         /*!< [7:5]  */
3699     } B;
3700 } hw_usb_clk_recover_int_status_t;
3701
3702 /*!
3703  * @name Constants and macros for entire USB_CLK_RECOVER_INT_STATUS register
3704  */
3705 /*@{*/
3706 #define HW_USB_CLK_RECOVER_INT_STATUS_ADDR(x) ((x) + 0x15CU)
3707
3708 #define HW_USB_CLK_RECOVER_INT_STATUS(x) (*(__IO hw_usb_clk_recover_int_status_t *) HW_USB_CLK_RECOVER_INT_STATUS_ADDR(x))
3709 #define HW_USB_CLK_RECOVER_INT_STATUS_RD(x) (HW_USB_CLK_RECOVER_INT_STATUS(x).U)
3710 #define HW_USB_CLK_RECOVER_INT_STATUS_WR(x, v) (HW_USB_CLK_RECOVER_INT_STATUS(x).U = (v))
3711 #define HW_USB_CLK_RECOVER_INT_STATUS_SET(x, v) (HW_USB_CLK_RECOVER_INT_STATUS_WR(x, HW_USB_CLK_RECOVER_INT_STATUS_RD(x) |  (v)))
3712 #define HW_USB_CLK_RECOVER_INT_STATUS_CLR(x, v) (HW_USB_CLK_RECOVER_INT_STATUS_WR(x, HW_USB_CLK_RECOVER_INT_STATUS_RD(x) & ~(v)))
3713 #define HW_USB_CLK_RECOVER_INT_STATUS_TOG(x, v) (HW_USB_CLK_RECOVER_INT_STATUS_WR(x, HW_USB_CLK_RECOVER_INT_STATUS_RD(x) ^  (v)))
3714 /*@}*/
3715
3716 /*
3717  * Constants & macros for individual USB_CLK_RECOVER_INT_STATUS bitfields
3718  */
3719
3720 /*!
3721  * @name Register USB_CLK_RECOVER_INT_STATUS, field OVF_ERROR[4] (W1C)
3722  *
3723  * Indicates that the USB clock recovery algorithm has detected that the
3724  * frequency trim adjustment needed for the IRC48M output clock is outside the available
3725  * TRIM_FINE adjustment range for the IRC48M module.
3726  *
3727  * Values:
3728  * - 0 - No interrupt is reported
3729  * - 1 - Unmasked interrupt has been generated
3730  */
3731 /*@{*/
3732 #define BP_USB_CLK_RECOVER_INT_STATUS_OVF_ERROR (4U) /*!< Bit position for USB_CLK_RECOVER_INT_STATUS_OVF_ERROR. */
3733 #define BM_USB_CLK_RECOVER_INT_STATUS_OVF_ERROR (0x10U) /*!< Bit mask for USB_CLK_RECOVER_INT_STATUS_OVF_ERROR. */
3734 #define BS_USB_CLK_RECOVER_INT_STATUS_OVF_ERROR (1U) /*!< Bit field size in bits for USB_CLK_RECOVER_INT_STATUS_OVF_ERROR. */
3735
3736 /*! @brief Read current value of the USB_CLK_RECOVER_INT_STATUS_OVF_ERROR field. */
3737 #define BR_USB_CLK_RECOVER_INT_STATUS_OVF_ERROR(x) (BITBAND_ACCESS8(HW_USB_CLK_RECOVER_INT_STATUS_ADDR(x), BP_USB_CLK_RECOVER_INT_STATUS_OVF_ERROR))
3738
3739 /*! @brief Format value for bitfield USB_CLK_RECOVER_INT_STATUS_OVF_ERROR. */
3740 #define BF_USB_CLK_RECOVER_INT_STATUS_OVF_ERROR(v) ((uint8_t)((uint8_t)(v) << BP_USB_CLK_RECOVER_INT_STATUS_OVF_ERROR) & BM_USB_CLK_RECOVER_INT_STATUS_OVF_ERROR)
3741
3742 /*! @brief Set the OVF_ERROR field to a new value. */
3743 #define BW_USB_CLK_RECOVER_INT_STATUS_OVF_ERROR(x, v) (BITBAND_ACCESS8(HW_USB_CLK_RECOVER_INT_STATUS_ADDR(x), BP_USB_CLK_RECOVER_INT_STATUS_OVF_ERROR) = (v))
3744 /*@}*/
3745
3746 /*******************************************************************************
3747  * hw_usb_t - module struct
3748  ******************************************************************************/
3749 /*!
3750  * @brief All USB module registers.
3751  */
3752 #pragma pack(1)
3753 typedef struct _hw_usb
3754 {
3755     __I hw_usb_perid_t PERID;              /*!< [0x0] Peripheral ID register */
3756     uint8_t _reserved0[3];
3757     __I hw_usb_idcomp_t IDCOMP;            /*!< [0x4] Peripheral ID Complement register */
3758     uint8_t _reserved1[3];
3759     __I hw_usb_rev_t REV;                  /*!< [0x8] Peripheral Revision register */
3760     uint8_t _reserved2[3];
3761     __I hw_usb_addinfo_t ADDINFO;          /*!< [0xC] Peripheral Additional Info register */
3762     uint8_t _reserved3[3];
3763     __IO hw_usb_otgistat_t OTGISTAT;       /*!< [0x10] OTG Interrupt Status register */
3764     uint8_t _reserved4[3];
3765     __IO hw_usb_otgicr_t OTGICR;           /*!< [0x14] OTG Interrupt Control register */
3766     uint8_t _reserved5[3];
3767     __IO hw_usb_otgstat_t OTGSTAT;         /*!< [0x18] OTG Status register */
3768     uint8_t _reserved6[3];
3769     __IO hw_usb_otgctl_t OTGCTL;           /*!< [0x1C] OTG Control register */
3770     uint8_t _reserved7[99];
3771     __IO hw_usb_istat_t ISTAT;             /*!< [0x80] Interrupt Status register */
3772     uint8_t _reserved8[3];
3773     __IO hw_usb_inten_t INTEN;             /*!< [0x84] Interrupt Enable register */
3774     uint8_t _reserved9[3];
3775     __IO hw_usb_errstat_t ERRSTAT;         /*!< [0x88] Error Interrupt Status register */
3776     uint8_t _reserved10[3];
3777     __IO hw_usb_erren_t ERREN;             /*!< [0x8C] Error Interrupt Enable register */
3778     uint8_t _reserved11[3];
3779     __I hw_usb_stat_t STAT;                /*!< [0x90] Status register */
3780     uint8_t _reserved12[3];
3781     __IO hw_usb_ctl_t CTL;                 /*!< [0x94] Control register */
3782     uint8_t _reserved13[3];
3783     __IO hw_usb_addr_t ADDR;               /*!< [0x98] Address register */
3784     uint8_t _reserved14[3];
3785     __IO hw_usb_bdtpage1_t BDTPAGE1;       /*!< [0x9C] BDT Page register 1 */
3786     uint8_t _reserved15[3];
3787     __IO hw_usb_frmnuml_t FRMNUML;         /*!< [0xA0] Frame Number register Low */
3788     uint8_t _reserved16[3];
3789     __IO hw_usb_frmnumh_t FRMNUMH;         /*!< [0xA4] Frame Number register High */
3790     uint8_t _reserved17[3];
3791     __IO hw_usb_token_t TOKEN;             /*!< [0xA8] Token register */
3792     uint8_t _reserved18[3];
3793     __IO hw_usb_softhld_t SOFTHLD;         /*!< [0xAC] SOF Threshold register */
3794     uint8_t _reserved19[3];
3795     __IO hw_usb_bdtpage2_t BDTPAGE2;       /*!< [0xB0] BDT Page Register 2 */
3796     uint8_t _reserved20[3];
3797     __IO hw_usb_bdtpage3_t BDTPAGE3;       /*!< [0xB4] BDT Page Register 3 */
3798     uint8_t _reserved21[11];
3799     struct {
3800         __IO hw_usb_endptn_t ENDPTn;       /*!< [0xC0] Endpoint Control register */
3801         uint8_t _reserved0[3];
3802     } ENDPOINT[16];
3803     __IO hw_usb_usbctrl_t USBCTRL;         /*!< [0x100] USB Control register */
3804     uint8_t _reserved22[3];
3805     __I hw_usb_observe_t OBSERVE;          /*!< [0x104] USB OTG Observe register */
3806     uint8_t _reserved23[3];
3807     __IO hw_usb_control_t CONTROL;         /*!< [0x108] USB OTG Control register */
3808     uint8_t _reserved24[3];
3809     __IO hw_usb_usbtrc0_t USBTRC0;         /*!< [0x10C] USB Transceiver Control register 0 */
3810     uint8_t _reserved25[7];
3811     __IO hw_usb_usbfrmadjust_t USBFRMADJUST; /*!< [0x114] Frame Adjust Register */
3812     uint8_t _reserved26[43];
3813     __IO hw_usb_clk_recover_ctrl_t CLK_RECOVER_CTRL; /*!< [0x140] USB Clock recovery control */
3814     uint8_t _reserved27[3];
3815     __IO hw_usb_clk_recover_irc_en_t CLK_RECOVER_IRC_EN; /*!< [0x144] IRC48M oscillator enable register */
3816     uint8_t _reserved28[23];
3817     __IO hw_usb_clk_recover_int_status_t CLK_RECOVER_INT_STATUS; /*!< [0x15C] Clock recovery separated interrupt status */
3818 } hw_usb_t;
3819 #pragma pack()
3820
3821 /*! @brief Macro to access all USB registers. */
3822 /*! @param x USB module instance base address. */
3823 /*! @return Reference (not a pointer) to the registers struct. To get a pointer to the struct,
3824  *     use the '&' operator, like <code>&HW_USB(USB0_BASE)</code>. */
3825 #define HW_USB(x)      (*(hw_usb_t *)(x))
3826
3827 #endif /* __HW_USB_REGISTERS_H__ */
3828 /* EOF */