Complete USB XMEGA interrupt control subsystem code in the core USB driver.
[pub/USBasp.git] / LUFA / Drivers / USB / Core / XMEGA / Device_XMEGA.h
index f0a472e..4b43891 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
                        /** Length of the device's unique internal serial number, in bits, if present on the selected microcontroller\r
                         *  model.\r
                         */\r
-                       #define INTERNAL_SERIAL_LENGTH_BITS    112\r
+                       #define INTERNAL_SERIAL_LENGTH_BITS    (8 * (1 + (offsetof(NVM_PROD_SIGNATURES_t, COORDY1) - offsetof(NVM_PROD_SIGNATURES_t, LOTNUM0))))\r
                        \r
                        /** Start address of the internal serial number, in the appropriate address space, if present on the selected microcontroller\r
                         *  model.\r
                         */\r
-                       #define INTERNAL_SERIAL_START_ADDRESS  0x08\r
+                       #define INTERNAL_SERIAL_START_ADDRESS  offsetof(NVM_PROD_SIGNATURES_t, LOTNUM0)\r
                        \r
                /* Function Prototypes: */\r
                        /** Sends a Remote Wakeup request to the host. This signals to the host that the device should\r
                        static inline uint16_t USB_Device_GetFrameNumber(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT;\r
                        static inline uint16_t USB_Device_GetFrameNumber(void)\r
                        {\r
-                               return 0; // TODO\r
+                               return (((uint16_t)USB_EndpointTable.FRAMENUMH << 8) | USB_EndpointTable.FRAMENUML);\r
                        }\r
 \r
                        #if !defined(NO_SOF_EVENTS)\r
                        static inline void USB_Device_EnableSOFEvents(void) ATTR_ALWAYS_INLINE;\r
                        static inline void USB_Device_EnableSOFEvents(void)\r
                        {\r
-                               // TODO\r
+                               USB.INTCTRLA |=  USB_SOFIE_bm;\r
                        }\r
 \r
                        /** Disables the device mode Start Of Frame events. When disabled, this stops the firing of the\r
                        static inline void USB_Device_DisableSOFEvents(void) ATTR_ALWAYS_INLINE;\r
                        static inline void USB_Device_DisableSOFEvents(void)\r
                        {\r
-                               // TODO\r
+                               USB.INTCTRLA &= ~USB_SOFIE_bm;\r
                        }\r
                        #endif\r
 \r
                                }\r
                                \r
                                SetGlobalInterruptMask(CurrentGlobalInt);\r
-\r
-\r
                        }\r
 \r
        #endif\r