Fixed hardware race condition that could cause failed device enumerations for AVR8 and UC3 architectures (thanks to Mike Beyhs).

Fixed incorrect Minimus board LED definitions (thanks to Joonas Lahtinen).

Fixed incorrect LED masks for received data display in the Device GenericHID demos (thanks to Denys Berkovskyy).
This commit is contained in:
Dean Camera 2013-01-03 10:53:47 +00:00
parent 7d037c7db8
commit 2608fd1dd4
9 changed files with 40 additions and 28 deletions

View file

@ -210,10 +210,13 @@
static inline void USB_Device_SetDeviceAddress(const uint8_t Address) ATTR_ALWAYS_INLINE;
static inline void USB_Device_SetDeviceAddress(const uint8_t Address)
{
uint8_t Temp = (UDADDR & (1 << ADDEN)) | (Address & 0x7F);
UDADDR = (UDADDR & (1 << ADDEN)) | (Address & 0x7F);
}
UDADDR = Temp;
UDADDR = Temp | (1 << ADDEN);
static inline void USB_Device_EnableDeviceAddress(void) ATTR_ALWAYS_INLINE;
static inline void USB_Device_EnableDeviceAddress(void)
{
UDADDR |= (1 << ADDEN);
}
static inline bool USB_Device_IsAddressSet(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT;

View file

@ -124,9 +124,9 @@ void USB_Device_ProcessControlRequest(void)
static void USB_Device_SetAddress(void)
{
uint8_t DeviceAddress = (USB_ControlRequest.wValue & 0x7F);
uint_reg_t CurrentGlobalInt = GetGlobalInterruptMask();
GlobalInterruptDisable();
uint8_t DeviceAddress = (USB_ControlRequest.wValue & 0x7F);
USB_Device_SetDeviceAddress(DeviceAddress);
Endpoint_ClearSETUP();
@ -134,10 +134,9 @@ static void USB_Device_SetAddress(void)
while (!(Endpoint_IsINReady()));
USB_Device_SetDeviceAddress(DeviceAddress);
USB_DeviceState = (DeviceAddress) ? DEVICE_STATE_Addressed : DEVICE_STATE_Default;
USB_Device_EnableDeviceAddress();
SetGlobalInterruptMask(CurrentGlobalInt);
USB_DeviceState = (DeviceAddress) ? DEVICE_STATE_Addressed : DEVICE_STATE_Default;
}
static void USB_Device_SetConfiguration(void)

View file

@ -209,7 +209,12 @@
static inline void USB_Device_SetDeviceAddress(const uint8_t Address)
{
AVR32_USBB.UDCON.uadd = Address;
AVR32_USBB.UDCON.adden = (Address ? true : false);
}
static inline void USB_Device_EnableDeviceAddress(void) ATTR_ALWAYS_INLINE;
static inline void USB_Device_EnableDeviceAddress(void)
{
AVR32_USBB.UDCON.adden = true;
}
static inline bool USB_Device_IsAddressSet(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT;

View file

@ -208,6 +208,12 @@
USB.ADDR = Address;
}
static inline void USB_Device_EnableDeviceAddress(void) ATTR_ALWAYS_INLINE;
static inline void USB_Device_EnableDeviceAddress(void)
{
/* No implementation for XMEGA architecture */
}
static inline bool USB_Device_IsAddressSet(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT;
static inline bool USB_Device_IsAddressSet(void)
{