X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/7f9f97c792dee6875fbca9806422bdd7d6c5a657..fc31973daffea3506051ce51a5f79383ce0867d6:/LUFA/Drivers/USB/LowLevel/LowLevel.c diff --git a/LUFA/Drivers/USB/LowLevel/LowLevel.c b/LUFA/Drivers/USB/LowLevel/LowLevel.c index b49c5b8ce..a088654f7 100644 --- a/LUFA/Drivers/USB/LowLevel/LowLevel.c +++ b/LUFA/Drivers/USB/LowLevel/LowLevel.c @@ -28,6 +28,7 @@ this software. */ +#define __INCLUDE_FROM_USB_DRIVER #include "LowLevel.h" #if (!defined(USB_HOST_ONLY) && !defined(USB_DEVICE_ONLY)) @@ -102,8 +103,6 @@ void USB_Init( #endif USB_IsInitialized = true; - - sei(); } void USB_ShutDown(void) @@ -112,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 @@ -144,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 @@ -216,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();