X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/3702ba1fb31f265360a0e4cf1736465e44389103..fc31973daffea3506051ce51a5f79383ce0867d6:/LUFA/Drivers/USB/LowLevel/LowLevel.c diff --git a/LUFA/Drivers/USB/LowLevel/LowLevel.c b/LUFA/Drivers/USB/LowLevel/LowLevel.c index 0d220cedc..a088654f7 100644 --- a/LUFA/Drivers/USB/LowLevel/LowLevel.c +++ b/LUFA/Drivers/USB/LowLevel/LowLevel.c @@ -39,10 +39,6 @@ volatile uint8_t USB_CurrentMode = USB_MODE_NONE; volatile uint8_t USB_Options; #endif -#if defined(__AVR32__) && !defined(CONTROL_ONLY_DEVICE) -uint8_t USB_SelectedEPNumber; -#endif - void USB_Init( #if defined(USB_CAN_BE_BOTH) const uint8_t Mode @@ -59,10 +55,6 @@ void USB_Init( #endif ) { - #if defined(__AVR32__) - USB_SelectedEPNumber = 0; - #endif - #if defined(USB_CAN_BE_BOTH) USB_CurrentMode = Mode; #endif @@ -111,8 +103,6 @@ void USB_Init( #endif USB_IsInitialized = true; - - sei(); } void USB_ShutDown(void) @@ -121,9 +111,18 @@ void USB_ShutDown(void) USB_Detach(); USB_Controller_Disable(); + USB_INT_DisableAllInterrupts(); + USB_INT_ClearAllInterrupts(); + + #if defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR) + UHWCON &= ~(1 << UIMOD); + #endif + if (!(USB_Options & USB_OPT_MANUAL_PLL)) USB_PLL_Off(); + USB_REG_Off(); + #if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR) USB_OTGPAD_Off(); #endif @@ -153,11 +152,11 @@ void USB_ResetInterface(void) USB_ConfigurationNumber = 0; #if !defined(NO_DEVICE_REMOTE_WAKEUP) - USB_RemoteWakeupEnabled = false; + USB_RemoteWakeupEnabled = false; #endif #if !defined(NO_DEVICE_SELF_POWER) - USB_CurrentlySelfPowered = false; + USB_CurrentlySelfPowered = false; #endif #endif @@ -225,9 +224,9 @@ void USB_ResetInterface(void) USB_INT_Clear(USB_INT_EORSTI); USB_INT_Enable(USB_INT_EORSTI); - #if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR) - USB_INT_Enable(USB_INT_VBUS); - #endif + #if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR) + USB_INT_Enable(USB_INT_VBUS); + #endif #elif defined(USB_HOST_ONLY) USB_Host_HostMode_On();