diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2012-08-28 20:09:14 +0000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2012-08-28 20:09:14 +0000 |
commit | 44aea22949c40e76b8be6cb56acbd2b155043e6b (patch) | |
tree | ce9537d7baf57caeb8c871b7d91abd0fa7693f6b /LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c | |
parent | e225de8a8372fa2cc5dc1d2d782cf7af0f3c0f08 (diff) | |
download | lufa-44aea22949c40e76b8be6cb56acbd2b155043e6b.tar.gz lufa-44aea22949c40e76b8be6cb56acbd2b155043e6b.tar.bz2 lufa-44aea22949c40e76b8be6cb56acbd2b155043e6b.zip |
Fixed logic hole breaking USB operations on a USB controller with only one supported USB mode and no USB_DEVICE_ONLY or USB_HOST_ONLY configuration token set.
Diffstat (limited to 'LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c')
-rw-r--r-- | LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c b/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c index 86df5c825..dde984b8b 100644 --- a/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c +++ b/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c @@ -35,7 +35,7 @@ #define __INCLUDE_FROM_USB_CONTROLLER_C #include "../USBController.h" -#if (!defined(USB_HOST_ONLY) && !defined(USB_DEVICE_ONLY)) +#if defined(USB_CAN_BE_BOTH) volatile uint8_t USB_CurrentMode = USB_MODE_None; #endif @@ -43,7 +43,7 @@ volatile uint8_t USB_CurrentMode = USB_MODE_None; volatile uint8_t USB_Options; #endif -/* Ugly workaround to ensure an aligned table, since __BIGGEST_ALIGNMENT__ == 1 for 8-bit AVR-GCC */ +/* Ugly workaround to ensure an aligned table, since __BIGGEST_ALIGNMENT__ == 1 for the 8-bit AVR-GCC toolchain */ uint8_t USB_EndpointTable[sizeof(USB_EndpointTable_t) + 1]; void USB_Init( @@ -66,8 +66,6 @@ void USB_Init( USB_Options = Options; #endif - USB_IsInitialized = true; - uint_reg_t CurrentGlobalInt = GetGlobalInterruptMask(); GlobalInterruptDisable(); @@ -89,6 +87,12 @@ void USB_Init( SetGlobalInterruptMask(CurrentGlobalInt); + #if defined(USB_CAN_BE_BOTH) + USB_CurrentMode = Mode; + #endif + + USB_IsInitialized = true; + USB_ResetInterface(); } |