*/\r
static inline uint16_t USB_Host_GetFrameNumber(void)\r
{\r
- return UHFNUM;\r
+ return AVR32_USBB_UHFNUM;\r
}\r
\r
#if !defined(NO_SOF_EVENTS)\r
static inline void USB_Host_ResetBus(void) ATTR_ALWAYS_INLINE;\r
static inline void USB_Host_ResetBus(void)\r
{\r
- UHCON |= (1 << RESET);\r
+ AVR32_USBB_UHCON.reset = true;\r
}\r
\r
/** Determines if a previously issued bus reset (via the \ref USB_Host_ResetBus() macro) has\r
static inline bool USB_Host_IsBusResetComplete(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;\r
static inline bool USB_Host_IsBusResetComplete(void)\r
{\r
- return ((UHCON & (1 << RESET)) ? false : true);\r
+ return AVR32_USBB_UHCON.reset;\r
}\r
\r
/** Resumes USB communications with an attached and enumerated device, by resuming the transmission\r
static inline void USB_Host_ResumeBus(void) ATTR_ALWAYS_INLINE;\r
static inline void USB_Host_ResumeBus(void)\r
{\r
- UHCON |= (1 << SOFEN);\r
+ AVR32_USBB_UHCON.sofe = true;\r
}\r
\r
/** Suspends the USB bus, preventing any communications from occurring between the host and attached\r
static inline void USB_Host_SuspendBus(void) ATTR_ALWAYS_INLINE;\r
static inline void USB_Host_SuspendBus(void)\r
{\r
- UHCON &= ~(1 << SOFEN);\r
+ AVR32_USBB_UHCON.sofe = false;\r
}\r
\r
/** Determines if the USB bus has been suspended via the use of the \ref USB_Host_SuspendBus() macro,\r
static inline bool USB_Host_IsBusSuspended(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;\r
static inline bool USB_Host_IsBusSuspended(void)\r
{\r
- return ((UHCON & (1 << SOFEN)) ? false : true);\r
+ return AVR32_USBB_UHCON.sofe;\r
}\r
\r
/** Determines if the attached device is currently enumerated in Full Speed mode (12Mb/s), or\r
static inline bool USB_Host_IsDeviceFullSpeed(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;\r
static inline bool USB_Host_IsDeviceFullSpeed(void)\r
{\r
- return ((USBSTA & (1 << SPEED)) ? true : false);\r
+ return (AVR32_USBB_USBSTA.speed == AVR32_USBB_SPEED_FULL);\r
}\r
\r
/** Determines if the attached device is currently issuing a Remote Wakeup request, requesting\r
static inline bool USB_Host_IsRemoteWakeupSent(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;\r
static inline bool USB_Host_IsRemoteWakeupSent(void)\r
{\r
- return ((UHINT & (1 << RXRSMI)) ? true : false);\r
+ return AVR32_USBB_UHINT.rxrsmi;\r
}\r
\r
/** Clears the flag indicating that a Remote Wakeup request has been issued by an attached device. */\r
static inline void USB_Host_ClearRemoteWakeupSent(void) ATTR_ALWAYS_INLINE;\r
static inline void USB_Host_ClearRemoteWakeupSent(void)\r
{\r
- UHINT &= ~(1 << RXRSMI);\r
+ AVR32_USBB_UHINTCLR.rxrsmic = true;\r
}\r
\r
/** Accepts a Remote Wakeup request from an attached device. This must be issued in response to\r
static inline void USB_Host_ResumeFromWakeupRequest(void) ATTR_ALWAYS_INLINE;\r
static inline void USB_Host_ResumeFromWakeupRequest(void)\r
{\r
- UHCON |= (1 << RESUME);\r
+ AVR32_USBB_UHCON.resume = true;\r
}\r
\r
/** Determines if a resume from Remote Wakeup request is currently being sent to an attached\r
static inline bool USB_Host_IsResumeFromWakeupRequestSent(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;\r
static inline bool USB_Host_IsResumeFromWakeupRequestSent(void)\r
{\r
- return ((UHCON & (1 << RESUME)) ? false : true);\r
+ return AVR32_USBB_UHCON.resume;\r
}\r
\r
/* Function Prototypes: */\r
static inline void USB_Host_HostMode_On(void) ATTR_ALWAYS_INLINE;\r
static inline void USB_Host_HostMode_On(void)\r
{\r
- USBCON |= (1 << HOST);\r
+ // Not required for UC3B\r
}\r
\r
static inline void USB_Host_HostMode_Off(void) ATTR_ALWAYS_INLINE;\r
static inline void USB_Host_HostMode_Off(void)\r
{\r
- USBCON &= ~(1 << HOST);\r
+ // Not required for UC3B\r
}\r
\r
static inline void USB_Host_VBUS_Auto_Enable(void) ATTR_ALWAYS_INLINE;\r
static inline void USB_Host_VBUS_Auto_Enable(void)\r
{\r
- OTGCON &= ~(1 << VBUSHWC);\r
- UHWCON |= (1 << UVCONE);\r
+ AVR32_USBB_USBCON.vbushwc = false;\r
}\r
\r
static inline void USB_Host_VBUS_Manual_Enable(void) ATTR_ALWAYS_INLINE;\r
static inline void USB_Host_VBUS_Manual_Enable(void)\r
{\r
- OTGCON |= (1 << VBUSHWC);\r
- UHWCON &= ~(1 << UVCONE);\r
-\r
- DDRE |= (1 << 7);\r
+ AVR32_USBB_USBCON.vbushwc = true;\r
+ \r
+ // TODO: Manual VBUS pin output setup\r
}\r
\r
static inline void USB_Host_VBUS_Auto_On(void) ATTR_ALWAYS_INLINE;\r
static inline void USB_Host_VBUS_Auto_On(void)\r
{\r
- OTGCON |= (1 << VBUSREQ);\r
+ AVR32_USBB_USBSTASET.vbusreqs = true;\r
}\r
\r
static inline void USB_Host_VBUS_Manual_On(void) ATTR_ALWAYS_INLINE;\r
static inline void USB_Host_VBUS_Manual_On(void)\r
{\r
- PORTE |= (1 << 7);\r
+ // TODO: Manual VBUS pin output on\r
}\r
\r
static inline void USB_Host_VBUS_Auto_Off(void) ATTR_ALWAYS_INLINE;\r
static inline void USB_Host_VBUS_Auto_Off(void)\r
{\r
- OTGCON |= (1 << VBUSRQC);\r
+ AVR32_USBB_USBSTACLR.vbusreqc = true;\r
}\r
\r
static inline void USB_Host_VBUS_Manual_Off(void) ATTR_ALWAYS_INLINE;\r
static inline void USB_Host_VBUS_Manual_Off(void)\r
{\r
- PORTE &= ~(1 << 7);\r
+ // TODO: Manual VBUS pin output off\r
}\r
\r
static inline void USB_Host_SetDeviceAddress(const uint8_t Address) ATTR_ALWAYS_INLINE;\r
static inline void USB_Host_SetDeviceAddress(const uint8_t Address)\r
{\r
- UHADDR = (Address & 0x7F);\r
+ AVR32_USBB_UHADDR1.uhaddrp0 = Address;\r
+ AVR32_USBB_UHADDR1.uhaddrp1 = Address;\r
+ AVR32_USBB_UHADDR1.uhaddrp2 = Address;\r
+ AVR32_USBB_UHADDR1.uhaddrp3 = Address;\r
+ AVR32_USBB_UHADDR2.uhaddrp4 = Address;\r
+ AVR32_USBB_UHADDR2.uhaddrp5 = Address;\r
+ AVR32_USBB_UHADDR2.uhaddrp6 = Address;\r
}\r
\r
/* Enums: */\r