diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2012-02-05 15:19:01 +0000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2012-02-05 15:19:01 +0000 |
commit | a6772540268fb53aa2509b07f17167ca92642c5a (patch) | |
tree | f79812afc0ea67a508d7e56e01bed5771aaf8835 /LUFA/Drivers/USB | |
parent | 252bd7bb2c3a018c54f460311d8c7776cc5747dc (diff) | |
download | lufa-a6772540268fb53aa2509b07f17167ca92642c5a.tar.gz lufa-a6772540268fb53aa2509b07f17167ca92642c5a.tar.bz2 lufa-a6772540268fb53aa2509b07f17167ca92642c5a.zip |
Added INVERTED_VBUS_ENABLE_LINE and NO_AUTO_VBUS_MANAGEMENT compile time options (thanks to Opendous Inc.).
Diffstat (limited to 'LUFA/Drivers/USB')
-rw-r--r-- | LUFA/Drivers/USB/Core/AVR8/Host_AVR8.c | 5 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Core/AVR8/Host_AVR8.h | 12 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Core/UC3/Host_UC3.c | 5 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Core/UC3/USBController_UC3.c | 4 |
4 files changed, 26 insertions, 0 deletions
diff --git a/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.c b/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.c index d40a7f2f5..6d7e9688e 100644 --- a/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.c +++ b/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.c @@ -79,6 +79,11 @@ void USB_Host_ProcessNextHostState(void) USB_OTGPAD_On(); USB_Host_VBUS_Auto_Enable(); USB_Host_VBUS_Auto_On(); + + #if defined(NO_AUTO_VBUS_MANAGEMENT) + USB_Host_VBUS_Manual_Enable(); + USB_Host_VBUS_Manual_On(); + #endif USB_HostState = HOST_STATE_Powered_WaitForConnect; } diff --git a/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.h b/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.h index 4baaf3a73..09c58bcd6 100644 --- a/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.h +++ b/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.h @@ -64,6 +64,10 @@ #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. #endif + #if defined(INVERTED_VBUS_ENABLE_LINE) && !defined(NO_AUTO_VBUS_MANAGEMENT) + #error The INVERTED_VBUS_ENABLE_LINE compile option requires NO_AUTO_VBUS_MANAGEMENT for the AVR8 architecture. + #endif + /* Public Interface - May be used in end-application: */ /* Macros: */ /** Indicates the fixed USB device address which any attached device is enumerated to when in @@ -310,7 +314,11 @@ static inline void USB_Host_VBUS_Manual_On(void) ATTR_ALWAYS_INLINE; static inline void USB_Host_VBUS_Manual_On(void) { + #if defined(INVERTED_VBUS_ENABLE_LINE) + PORTE &= ~(1 << 7); + #else PORTE |= (1 << 7); + #endif } static inline void USB_Host_VBUS_Auto_Off(void) ATTR_ALWAYS_INLINE; @@ -322,7 +330,11 @@ static inline void USB_Host_VBUS_Manual_Off(void) ATTR_ALWAYS_INLINE; static inline void USB_Host_VBUS_Manual_Off(void) { + #if defined(INVERTED_VBUS_ENABLE_LINE) + PORTE |= (1 << 7); + #else PORTE &= ~(1 << 7); + #endif } static inline void USB_Host_SetDeviceAddress(const uint8_t Address) ATTR_ALWAYS_INLINE; diff --git a/LUFA/Drivers/USB/Core/UC3/Host_UC3.c b/LUFA/Drivers/USB/Core/UC3/Host_UC3.c index d40a7f2f5..9d3026614 100644 --- a/LUFA/Drivers/USB/Core/UC3/Host_UC3.c +++ b/LUFA/Drivers/USB/Core/UC3/Host_UC3.c @@ -80,6 +80,11 @@ void USB_Host_ProcessNextHostState(void) USB_Host_VBUS_Auto_Enable(); USB_Host_VBUS_Auto_On(); + #if defined(NO_AUTO_VBUS_MANAGEMENT) + USB_Host_VBUS_Manual_Enable(); + USB_Host_VBUS_Manual_On(); + #endif + USB_HostState = HOST_STATE_Powered_WaitForConnect; } diff --git a/LUFA/Drivers/USB/Core/UC3/USBController_UC3.c b/LUFA/Drivers/USB/Core/UC3/USBController_UC3.c index 2b2a23f73..a9a6d35d9 100644 --- a/LUFA/Drivers/USB/Core/UC3/USBController_UC3.c +++ b/LUFA/Drivers/USB/Core/UC3/USBController_UC3.c @@ -134,6 +134,10 @@ void USB_ResetInterface(void) } else if (USB_CurrentMode == USB_MODE_Host) { + #if defined(INVERTED_VBUS_ENABLE_LINE) + AVR32_USBB.USBCON.vbuspol = true; + #endif + #if defined(USB_CAN_BE_HOST) AVR32_USBB.USBCON.uimod = false; |