meh

Fork of mbed by mbed official

Committer:
bogdanm
Date:
Mon Apr 07 18:28:36 2014 +0100
Revision:
82:6473597d706e
Release 82 of the mbed library

Main changes:

- support for K64F
- Revisited Nordic code structure
- Test infrastructure improvements
- various bug fixes

Who changed what in which revision?

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