Add high speed USB support for the UC3 devices containing a high speed USB controller.
[pub/USBasp.git] / LUFA / Drivers / USB / Core / UC3 / Device_UC3.h
index 55e4b0c..9b324ab 100644 (file)
@@ -50,6 +50,7 @@
 \r
        /* Includes: */\r
                #include "../../../../Common/Common.h"\r
+               #include "../USBController.h"\r
                #include "../StdDescriptors.h"\r
                #include "../USBInterrupt.h"\r
                #include "../Endpoint.h"\r
                         *  USB interface should be initialized in full speed (12Mb/s) mode.\r
                         */\r
                        #define USB_DEVICE_OPT_FULLSPEED               (0 << 0)\r
+                       \r
+                       #if defined(USB_SERIES_UC3A3_AVR32) || defined(USB_SERIES_UC3A4_AVR32) || defined(__DOXYGEN__)\r
+                               /** Mask for the Options parameter of the \ref USB_Init() function. This indicates that the\r
+                                *  USB interface should be initialized in high speed (480Mb/s) mode.\r
+                                */\r
+                               #define USB_DEVICE_OPT_HIGHSPEED           (1 << 1)                     \r
+                       #endif\r
                        //@}\r
                        \r
                        #if (!defined(NO_INTERNAL_SERIAL) && \\r
                        }\r
 \r
                        #if !defined(NO_SOF_EVENTS)\r
-                       /** Enables the device mode Start Of Frame events. When enabled, this causes the\r
-                        *  \ref EVENT_USB_Device_StartOfFrame() event to fire once per millisecond, synchronized to the USB bus,\r
-                        *  at the start of each USB frame when enumerated in device mode.\r
-                        *\r
-                        *  \note Not available when the \c NO_SOF_EVENTS compile time token is defined.\r
-                        */\r
-                       static inline void USB_Device_EnableSOFEvents(void) ATTR_ALWAYS_INLINE;\r
-                       static inline void USB_Device_EnableSOFEvents(void)\r
-                       {\r
-                               USB_INT_Enable(USB_INT_SOFI);\r
-                       }\r
+                               /** Enables the device mode Start Of Frame events. When enabled, this causes the\r
+                                *  \ref EVENT_USB_Device_StartOfFrame() event to fire once per millisecond, synchronized to the USB bus,\r
+                                *  at the start of each USB frame when enumerated in device mode.\r
+                                *\r
+                                *  \note Not available when the \c NO_SOF_EVENTS compile time token is defined.\r
+                                */\r
+                               static inline void USB_Device_EnableSOFEvents(void) ATTR_ALWAYS_INLINE;\r
+                               static inline void USB_Device_EnableSOFEvents(void)\r
+                               {\r
+                                       USB_INT_Enable(USB_INT_SOFI);\r
+                               }\r
 \r
-                       /** Disables the device mode Start Of Frame events. When disabled, this stops the firing of the\r
-                        *  \ref EVENT_USB_Device_StartOfFrame() event when enumerated in device mode.\r
-                        *\r
-                        *  \note Not available when the \c NO_SOF_EVENTS compile time token is defined.\r
-                        */\r
-                       static inline void USB_Device_DisableSOFEvents(void) ATTR_ALWAYS_INLINE;\r
-                       static inline void USB_Device_DisableSOFEvents(void)\r
-                       {\r
-                               USB_INT_Disable(USB_INT_SOFI);\r
-                       }\r
+                               /** Disables the device mode Start Of Frame events. When disabled, this stops the firing of the\r
+                                *  \ref EVENT_USB_Device_StartOfFrame() event when enumerated in device mode.\r
+                                *\r
+                                *  \note Not available when the \c NO_SOF_EVENTS compile time token is defined.\r
+                                */\r
+                               static inline void USB_Device_DisableSOFEvents(void) ATTR_ALWAYS_INLINE;\r
+                               static inline void USB_Device_DisableSOFEvents(void)\r
+                               {\r
+                                       USB_INT_Disable(USB_INT_SOFI);\r
+                               }\r
                        #endif\r
 \r
        /* Private Interface - For use in library only: */\r
                        static inline void USB_Device_SetLowSpeed(void) ATTR_ALWAYS_INLINE;\r
                        static inline void USB_Device_SetLowSpeed(void)\r
                        {\r
-                               AVR32_USBB.UDCON.ls = true;\r
+                               AVR32_USBB.UDCON.ls      = true;\r
                        }\r
 \r
                        static inline void USB_Device_SetFullSpeed(void) ATTR_ALWAYS_INLINE;\r
                        static inline void USB_Device_SetFullSpeed(void)\r
                        {\r
-                               AVR32_USBB.UDCON.ls = false;\r
+                               AVR32_USBB.UDCON.ls      = false;\r
+                               #if defined(USB_DEVICE_OPT_HIGHSPEED)\r
+                               AVR32_USBB.UDCON.spdconf = 3;\r
+                               #endif\r
                        }\r
 \r
+                       #if defined(USB_DEVICE_OPT_HIGHSPEED)\r
+                       static inline void USB_Device_SetHighSpeed(void) ATTR_ALWAYS_INLINE;\r
+                       static inline void USB_Device_SetHighSpeed(void)\r
+                       {\r
+                               AVR32_USBB.UDCON.ls      = false;\r
+                               AVR32_USBB.UDCON.spdconf = 0;\r
+                       }\r
+                       #endif\r
+\r
                        static inline void USB_Device_SetDeviceAddress(const uint8_t Address) ATTR_ALWAYS_INLINE;\r
                        static inline void USB_Device_SetDeviceAddress(const uint8_t Address)\r
                        {\r