diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2009-07-21 13:51:34 +0000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2009-07-21 13:51:34 +0000 |
commit | 7a5d045987f1d42b73a4291a9cd7ac25dc3b8c1a (patch) | |
tree | acd259c5053f591f075ae55eb2bbb3967243d8c3 /LUFA | |
parent | e071f3897a0946c6be1e1b5e1f78eda8dcbf6fc7 (diff) | |
download | lufa-7a5d045987f1d42b73a4291a9cd7ac25dc3b8c1a.tar.gz lufa-7a5d045987f1d42b73a4291a9cd7ac25dc3b8c1a.tar.bz2 lufa-7a5d045987f1d42b73a4291a9cd7ac25dc3b8c1a.zip |
Slight changes to TeensyHID bootloader to ensure it builds under the 2KB boundary.
Changed USB_Init() and USB_Shutdown() so that they are no longer dependant on oneanother for possible code savings when the interface is never explicitly shut down.
Diffstat (limited to 'LUFA')
-rw-r--r-- | LUFA/Drivers/USB/LowLevel/LowLevel.c | 34 | ||||
-rw-r--r-- | LUFA/Drivers/USB/LowLevel/LowLevel.h | 6 |
2 files changed, 12 insertions, 28 deletions
diff --git a/LUFA/Drivers/USB/LowLevel/LowLevel.c b/LUFA/Drivers/USB/LowLevel/LowLevel.c index cd7fa891d..41d9e10cc 100644 --- a/LUFA/Drivers/USB/LowLevel/LowLevel.c +++ b/LUFA/Drivers/USB/LowLevel/LowLevel.c @@ -54,8 +54,6 @@ void USB_Init( #endif
)
{
- USB_ShutDown();
-
#if defined(USB_CAN_BE_BOTH)
USB_CurrentMode = Mode;
#endif
@@ -120,29 +118,9 @@ void USB_ShutDown(void) EVENT_USB_Disconnect();
#endif
+ USB_ResetInterface();
USB_Detach();
-
- USB_INT_DisableAllInterrupts();
- USB_INT_ClearAllInterrupts();
-
- USB_IsInitialized = false;
-
- #if defined(USB_CAN_BE_HOST)
- USB_HostState = HOST_STATE_Unattached;
- #endif
-
- #if defined(USB_CAN_BE_DEVICE)
- USB_DeviceState = DEVICE_STATE_Unattached;
- USB_ConfigurationNumber = 0;
- USB_RemoteWakeupEnabled = false;
- USB_CurrentlySelfPowered = false;
- #endif
-
- #if defined(CAN_BE_BOTH)
- USB_CurrentMode = USB_MODE_NONE;
- #endif
-
- USB_Interface_Disable();
+ USB_Controller_Disable();
USB_PLL_Off();
#if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)
@@ -152,6 +130,12 @@ void USB_ShutDown(void) #if defined(USB_CAN_BE_BOTH)
UHWCON &= ~(1 << UIDE);
#endif
+
+ USB_IsInitialized = false;
+
+ #if defined(CAN_BE_BOTH)
+ USB_CurrentMode = USB_MODE_NONE;
+ #endif
}
void USB_ResetInterface(void)
@@ -180,7 +164,7 @@ void USB_ResetInterface(void) while (!(USB_PLL_IsReady()));
}
- USB_Interface_Reset();
+ USB_Controller_Reset();
#if defined(USB_CAN_BE_BOTH)
if (UHWCON & (1 << UIDE))
diff --git a/LUFA/Drivers/USB/LowLevel/LowLevel.h b/LUFA/Drivers/USB/LowLevel/LowLevel.h index df1fa0bcc..ca2fc7b15 100644 --- a/LUFA/Drivers/USB/LowLevel/LowLevel.h +++ b/LUFA/Drivers/USB/LowLevel/LowLevel.h @@ -334,9 +334,9 @@ #define USB_CLK_Freeze() MACROS{ USBCON |= (1 << FRZCLK); }MACROE
#define USB_CLK_Unfreeze() MACROS{ USBCON &= ~(1 << FRZCLK); }MACROE
- #define USB_Interface_Enable() MACROS{ USBCON |= (1 << USBE); }MACROE
- #define USB_Interface_Disable() MACROS{ USBCON &= ~(1 << USBE); }MACROE
- #define USB_Interface_Reset() MACROS{ uint8_t Temp = USBCON; USBCON = (Temp & ~(1 << USBE)); \
+ #define USB_Controller_Enable() MACROS{ USBCON |= (1 << USBE); }MACROE
+ #define USB_Controller_Disable() MACROS{ USBCON &= ~(1 << USBE); }MACROE
+ #define USB_Controller_Reset() MACROS{ uint8_t Temp = USBCON; USBCON = (Temp & ~(1 << USBE)); \
USBCON = (Temp | (1 << USBE)); }MACROE
/* Inline Functions: */
|