Fix broken XMEGA USB support.
authorDean Camera <dean@fourwalledcubicle.com>
Sun, 27 Jan 2013 19:35:40 +0000 (19:35 +0000)
committerDean Camera <dean@fourwalledcubicle.com>
Sun, 27 Jan 2013 19:35:40 +0000 (19:35 +0000)
LUFA/Drivers/USB/Core/AVR8/Device_AVR8.h
LUFA/Drivers/USB/Core/DeviceStandardReq.c
LUFA/Drivers/USB/Core/UC3/Device_UC3.h
LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.h
LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.h

index 7874690..a2a2ddf 100644 (file)
                                UDADDR = (UDADDR & (1 << ADDEN)) | (Address & 0x7F);
                        }
 
                                UDADDR = (UDADDR & (1 << ADDEN)) | (Address & 0x7F);
                        }
 
-                       static inline void USB_Device_EnableDeviceAddress(void) ATTR_ALWAYS_INLINE;
-                       static inline void USB_Device_EnableDeviceAddress(void)
+                       static inline void USB_Device_EnableDeviceAddress(const uint8_t Address) ATTR_ALWAYS_INLINE;
+                       static inline void USB_Device_EnableDeviceAddress(const uint8_t Address)
                        {
                                  UDADDR |= (1 << ADDEN);
                        }
                        {
                                  UDADDR |= (1 << ADDEN);
                        }
index 6284dd3..3176e15 100644 (file)
@@ -134,7 +134,7 @@ static void USB_Device_SetAddress(void)
 
        while (!(Endpoint_IsINReady()));
 
 
        while (!(Endpoint_IsINReady()));
 
-       USB_Device_EnableDeviceAddress();
+       USB_Device_EnableDeviceAddress(DeviceAddress);
 
        USB_DeviceState = (DeviceAddress) ? DEVICE_STATE_Addressed : DEVICE_STATE_Default;
 }
 
        USB_DeviceState = (DeviceAddress) ? DEVICE_STATE_Addressed : DEVICE_STATE_Default;
 }
index 86583d8..60a1e27 100644 (file)
                                AVR32_USBB.UDCON.uadd  = Address;
                        }
 
                                AVR32_USBB.UDCON.uadd  = Address;
                        }
 
-                       static inline void USB_Device_EnableDeviceAddress(void) ATTR_ALWAYS_INLINE;
-                       static inline void USB_Device_EnableDeviceAddress(void)
+                       static inline void USB_Device_EnableDeviceAddress(const uint8_t Address) ATTR_ALWAYS_INLINE;
+                       static inline void USB_Device_EnableDeviceAddress(const uint8_t Address)
                        {
                                AVR32_USBB.UDCON.adden = true;
                        }
                        {
                                AVR32_USBB.UDCON.adden = true;
                        }
index d2d506c..6e2380a 100644 (file)
                        static inline void USB_Device_SetDeviceAddress(const uint8_t Address) ATTR_ALWAYS_INLINE;
                        static inline void USB_Device_SetDeviceAddress(const uint8_t Address)
                        {
                        static inline void USB_Device_SetDeviceAddress(const uint8_t Address) ATTR_ALWAYS_INLINE;
                        static inline void USB_Device_SetDeviceAddress(const uint8_t Address)
                        {
-                               USB.ADDR = Address;
+                               /* No implementation for XMEGA architecture */
                        }
 
                        }
 
-                       static inline void USB_Device_EnableDeviceAddress(void) ATTR_ALWAYS_INLINE;
-                       static inline void USB_Device_EnableDeviceAddress(void)
+                       static inline void USB_Device_EnableDeviceAddress(const uint8_t Address) ATTR_ALWAYS_INLINE;
+                       static inline void USB_Device_EnableDeviceAddress(const uint8_t Address)
                        {
                        {
-                               /* No implementation for XMEGA architecture */
+                               USB.ADDR = Address;
                        }
 
                        static inline bool USB_Device_IsAddressSet(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT;
                        }
 
                        static inline bool USB_Device_IsAddressSet(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT;
index 84966ad..2198b53 100644 (file)
 
        /* Private Interface - For use in library only: */
        #if !defined(__DOXYGEN__)
 
        /* Private Interface - For use in library only: */
        #if !defined(__DOXYGEN__)
+               /* Macros: */
+                       #if defined(MAX_ENDPOINT_INDEX)
+                               #define ENDPOINT_TABLE_COUNT  (MAX_ENDPOINT_INDEX + 1)
+                       #else
+                               #define ENDPOINT_TABLE_COUNT  16
+                       #endif
+
                /* Type Defines: */
                        typedef struct
                        {
                /* Type Defines: */
                        typedef struct
                        {
@@ -64,7 +71,7 @@
                                {
                                        USB_EP_t OUT;
                                        USB_EP_t IN;
                                {
                                        USB_EP_t OUT;
                                        USB_EP_t IN;
-                               } Endpoints[16];
+                               } Endpoints[ENDPOINT_TABLE_COUNT];
                                uint16_t FrameNum;
                        } ATTR_PACKED USB_EndpointTable_t;
 
                                uint16_t FrameNum;
                        } ATTR_PACKED USB_EndpointTable_t;