X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/d49cc0f7830319e701294e19937fae4de26ae8e2..fc31973daffea3506051ce51a5f79383ce0867d6:/LUFA/Drivers/USB/LowLevel/LowLevel.c?ds=sidebyside diff --git a/LUFA/Drivers/USB/LowLevel/LowLevel.c b/LUFA/Drivers/USB/LowLevel/LowLevel.c index f4f277ccb..a088654f7 100644 --- a/LUFA/Drivers/USB/LowLevel/LowLevel.c +++ b/LUFA/Drivers/USB/LowLevel/LowLevel.c @@ -103,8 +103,6 @@ void USB_Init( #endif USB_IsInitialized = true; - - sei(); } void USB_ShutDown(void) @@ -113,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 @@ -145,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 @@ -217,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();