aboutsummaryrefslogtreecommitdiffstats
path: root/LUFA
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2010-09-19 05:46:17 +0000
committerDean Camera <dean@fourwalledcubicle.com>2010-09-19 05:46:17 +0000
commit01fecac0a70b02ccb197091935052fcfc9955b26 (patch)
tree70077edc3850e20b9e680ba533155bada92cf079 /LUFA
parentcce8760b9169dffe1a126e221f4b4c48c83192b9 (diff)
downloadlufa-01fecac0a70b02ccb197091935052fcfc9955b26.tar.gz
lufa-01fecac0a70b02ccb197091935052fcfc9955b26.tar.bz2
lufa-01fecac0a70b02ccb197091935052fcfc9955b26.zip
Ensure device address latch bit is not set at the same time as the new address, as per datasheet.
Minor documentation fixes. Fix broken USB host mode due to the USB frame counter not being updated during the early enumeration steps, causing USB_Host_DelayMS() to spinloop forever.
Diffstat (limited to 'LUFA')
-rw-r--r--LUFA/Drivers/USB/HighLevel/StdDescriptors.h4
-rw-r--r--LUFA/Drivers/USB/LowLevel/Device.h3
-rw-r--r--LUFA/Drivers/USB/LowLevel/Host.c19
-rw-r--r--LUFA/Drivers/USB/LowLevel/USBInterrupt.c12
-rw-r--r--LUFA/ManPages/FutureChanges.txt2
5 files changed, 26 insertions, 14 deletions
diff --git a/LUFA/Drivers/USB/HighLevel/StdDescriptors.h b/LUFA/Drivers/USB/HighLevel/StdDescriptors.h
index 89c2c97cb..433947997 100644
--- a/LUFA/Drivers/USB/HighLevel/StdDescriptors.h
+++ b/LUFA/Drivers/USB/HighLevel/StdDescriptors.h
@@ -459,7 +459,7 @@
* to make each element's purpose clearer.
*
* This descriptor has been added as a supplement to the USB2.0 standard, in the ECN located at
- * <a>http://www.usb.org/developers/docs/InterfaceAssociationDescriptor_ecn.pdf</a>. It allows compound
+ * <a>http://www.usb.org/developers/docs/InterfaceAssociationDescriptor_ecn.pdf</a>. It allows composite
* devices with multiple interfaces related to the same function to have the multiple interfaces bound
* together at the point of enumeration, loading one generic driver for all the interfaces in the single
* function. Read the ECN for more information.
@@ -488,7 +488,7 @@
* element names to ensure compatibility with the standard.
*
* This descriptor has been added as a supplement to the USB2.0 standard, in the ECN located at
- * <a>http://www.usb.org/developers/docs/InterfaceAssociationDescriptor_ecn.pdf</a>. It allows compound
+ * <a>http://www.usb.org/developers/docs/InterfaceAssociationDescriptor_ecn.pdf</a>. It allows composite
* devices with multiple interfaces related to the same function to have the multiple interfaces bound
* together at the point of enumeration, loading one generic driver for all the interfaces in the single
* function. Read the ECN for more information.
diff --git a/LUFA/Drivers/USB/LowLevel/Device.h b/LUFA/Drivers/USB/LowLevel/Device.h
index 300793612..a37e6d939 100644
--- a/LUFA/Drivers/USB/LowLevel/Device.h
+++ b/LUFA/Drivers/USB/LowLevel/Device.h
@@ -221,7 +221,8 @@
static inline void USB_Device_SetDeviceAddress(const uint8_t Address) ATTR_ALWAYS_INLINE;
static inline void USB_Device_SetDeviceAddress(const uint8_t Address)
{
- UDADDR = ((1 << ADDEN) | (Address & 0x7F));
+ UDADDR = ((UDADDR & (1 << ADDEN)) | (Address & 0x7F));
+ UDADDR |= (1 << ADDEN);
}
#endif
diff --git a/LUFA/Drivers/USB/LowLevel/Host.c b/LUFA/Drivers/USB/LowLevel/Host.c
index 2b66e28b4..6c66083a8 100644
--- a/LUFA/Drivers/USB/LowLevel/Host.c
+++ b/LUFA/Drivers/USB/LowLevel/Host.c
@@ -194,19 +194,21 @@ void USB_Host_ProcessNextHostState(void)
uint8_t USB_Host_WaitMS(uint8_t MS)
{
- bool BusSuspended = USB_Host_IsBusSuspended();
- uint8_t ErrorCode = HOST_WAITERROR_Successful;
- uint16_t PreviousFrameNumber = USB_Host_GetFrameNumber();
+ bool BusSuspended = USB_Host_IsBusSuspended();
+ uint8_t ErrorCode = HOST_WAITERROR_Successful;
USB_Host_ResumeBus();
+ bool HSOFIEnabled = USB_INT_IsEnabled(USB_INT_HSOFI);
+
+ USB_INT_Disable(USB_INT_HSOFI);
+ USB_INT_Clear(USB_INT_HSOFI);
+
while (MS)
{
- uint16_t CurrentFrameNumber = USB_Host_GetFrameNumber();
-
- if (CurrentFrameNumber != PreviousFrameNumber)
+ if (USB_INT_HasOccurred(USB_INT_HSOFI))
{
- PreviousFrameNumber = CurrentFrameNumber;
+ USB_INT_Clear(USB_INT_HSOFI);
MS--;
}
@@ -234,6 +236,9 @@ uint8_t USB_Host_WaitMS(uint8_t MS)
}
}
+ if (HSOFIEnabled)
+ USB_INT_Enable(USB_INT_HSOFI);
+
if (BusSuspended)
USB_Host_SuspendBus();
diff --git a/LUFA/Drivers/USB/LowLevel/USBInterrupt.c b/LUFA/Drivers/USB/LowLevel/USBInterrupt.c
index a49b8da7b..52951fc39 100644
--- a/LUFA/Drivers/USB/LowLevel/USBInterrupt.c
+++ b/LUFA/Drivers/USB/LowLevel/USBInterrupt.c
@@ -34,14 +34,17 @@
void USB_INT_DisableAllInterrupts(void)
{
#if defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)
- USBCON &= ~((1 << VBUSTE) | (1 << IDTE));
+ USBCON &= ~((1 << OTGPADE) | (1 << VBUSTE) | (1 << IDTE));
#elif defined(USB_SERIES_4_AVR)
USBCON &= ~(1 << VBUSTE);
#endif
+ #if defined(USB_CAN_BE_BOTH)
+ OTGIEN = 0;
+ #endif
+
#if defined(USB_CAN_BE_HOST)
UHIEN = 0;
- OTGIEN = 0;
#endif
#if defined(USB_CAN_BE_DEVICE)
@@ -55,9 +58,12 @@ void USB_INT_ClearAllInterrupts(void)
USBINT = 0;
#endif
+ #if defined(USB_CAN_BE_BOTH)
+ OTGINT = 0;
+ #endif
+
#if defined(USB_CAN_BE_HOST)
UHINT = 0;
- OTGINT = 0;
#endif
#if defined(USB_CAN_BE_DEVICE)
diff --git a/LUFA/ManPages/FutureChanges.txt b/LUFA/ManPages/FutureChanges.txt
index 555971f8e..6e77effbf 100644
--- a/LUFA/ManPages/FutureChanges.txt
+++ b/LUFA/ManPages/FutureChanges.txt
@@ -14,7 +14,7 @@
* <b>Targeted for Future Releases:</b>
* - Code Features
* -# Add hub support when in Host mode for multiple devices
- * -# Investigate virtual hubs when in device mode instead of compound devices
+ * -# Investigate virtual hubs when in device mode instead of composite devices
* -# Add ability to get number of bytes not written with pipe/endpoint write routines after an error
* -# Change makefiles to allow for absolute LUFA location to be used
* -# Re-add interrupt Pipe/Endpoint support