Add in USB_INT_RegisterHandlers() internal function to register the interrupt handler...
[pub/lufa.git] / LUFA / Drivers / USB / Core / UC3B / USBInterrupt_UC3B.h
index 4100a01..ca60e7f 100644 (file)
                                USB_INT_SUSPI   = 3,\r
                                USB_INT_EORSTI  = 4,\r
                                USB_INT_SOFI    = 5,\r
-                               USB_INT_RXSTPI  = 6,\r
                                #endif\r
                                #if (defined(USB_CAN_BE_HOST) || defined(__DOXYGEN__))                  \r
-                               USB_INT_HSOFI   = 7,\r
-                               USB_INT_DCONNI  = 8,\r
-                               USB_INT_DDISCI  = 9,\r
-                               USB_INT_RSTI    = 10,\r
-                               USB_INT_BCERRI  = 11,\r
-                               USB_INT_VBERRI  = 12,\r
+                               USB_INT_HSOFI   = 6,\r
+                               USB_INT_DCONNI  = 7,\r
+                               USB_INT_DDISCI  = 8,\r
+                               USB_INT_RSTI    = 9,\r
+                               USB_INT_BCERRI  = 10,\r
+                               USB_INT_VBERRI  = 11,\r
                                #endif\r
                        };\r
-                       \r
+               \r
+               /* ISR Prototypes: */\r
+                       ISR(USB_GEN_vect);\r
+               \r
                /* Inline Functions: */\r
+                       static inline void USB_INT_RegisterHandlers(void)\r
+                       {\r
+                               AVR32_INTC.IPR[AVR32_USBB_IRQ % 32].autovector = (uintptr_t)&USB_GEN_vect;                      \r
+                       }\r
+               \r
                        static inline void USB_INT_Enable(const uint8_t Interrupt) ATTR_ALWAYS_INLINE;\r
                        static inline void USB_INT_Enable(const uint8_t Interrupt)\r
-                       {\r
+                       {                       \r
                                switch (Interrupt)\r
                                {\r
                                        case USB_INT_VBUSTI:\r
                                        case USB_INT_SOFI:\r
                                                AVR32_USBB.UDINTESET.sofes    = true;\r
                                                break;\r
-                                       case USB_INT_RXSTPI:\r
-                                               // TODO\r
-                                               return;\r
                                        #endif\r
                                        #if defined(USB_CAN_BE_HOST)\r
                                        case USB_INT_HSOFI:\r
                                        case USB_INT_SOFI:\r
                                                AVR32_USBB.UDINTECLR.sofec    = true;\r
                                                break;\r
-                                       case USB_INT_RXSTPI:\r
-                                               // TODO\r
-                                               return;\r
                                        #endif\r
                                        #if defined(USB_CAN_BE_HOST)\r
                                        case USB_INT_HSOFI:\r
                                {\r
                                        case USB_INT_VBUSTI:\r
                                                AVR32_USBB.USBSTACLR.vbustic = true;\r
+                                               (void)AVR32_USBB.USBSTACLR;\r
                                                break;\r
                                        #if defined(USB_CAN_BE_BOTH)\r
                                        case USB_INT_IDTI:\r
                                                AVR32_USBB.USBSTACLR.idtic   = true;\r
+                                               (void)AVR32_USBB.USBSTACLR;\r
                                                break;\r
                                        #endif\r
                                        #if defined(USB_CAN_BE_DEVICE)\r
                                        case USB_INT_WAKEUPI:\r
                                                AVR32_USBB.UDINTCLR.wakeupc  = true;\r
+                                               (void)AVR32_USBB.UDINTCLR;\r
                                                break;\r
                                        case USB_INT_SUSPI:\r
                                                AVR32_USBB.UDINTCLR.suspc    = true;\r
+                                               (void)AVR32_USBB.UDINTCLR;\r
                                                break;\r
                                        case USB_INT_EORSTI:\r
                                                AVR32_USBB.UDINTCLR.eorstc   = true;\r
+                                               (void)AVR32_USBB.UDINTCLR;\r
                                                break;\r
                                        case USB_INT_SOFI:\r
                                                AVR32_USBB.UDINTCLR.sofc     = true;\r
+                                               (void)AVR32_USBB.UDINTCLR;\r
                                                break;\r
-                                       case USB_INT_RXSTPI:\r
-                                               // TODO\r
-                                               return;\r
                                        #endif\r
                                        #if defined(USB_CAN_BE_HOST)\r
                                        case USB_INT_HSOFI:\r
                                                AVR32_USBB.UHINTCLR.hsofic   = true;\r
+                                               (void)AVR32_USBB.UHINTCLR;\r
                                                break;\r
                                        case USB_INT_DCONNI:\r
                                                AVR32_USBB.UHINTCLR.dconnic  = true;\r
+                                               (void)AVR32_USBB.UHINTCLR;\r
                                                break;\r
                                        case USB_INT_DDISCI:\r
                                                AVR32_USBB.UHINTCLR.ddiscic  = true;\r
+                                               (void)AVR32_USBB.UHINTCLR;\r
                                                break;\r
                                        case USB_INT_RSTI:\r
                                                AVR32_USBB.UHINTCLR.rstic    = true;\r
+                                               (void)AVR32_USBB.UHINTCLR;\r
                                                break;\r
                                        case USB_INT_BCERRI:\r
                                                AVR32_USBB.USBSTACLR.bcerric = true;\r
+                                               (void)AVR32_USBB.USBSTACLR;\r
                                                break;\r
                                        case USB_INT_VBERRI:\r
                                                AVR32_USBB.USBSTACLR.vberric = true;\r
+                                               (void)AVR32_USBB.USBSTACLR;\r
                                                break;\r
                                        #endif\r
                                }\r
                                                return AVR32_USBB.UDINTE.eorste;\r
                                        case USB_INT_SOFI:\r
                                                return AVR32_USBB.UDINTE.sofe;\r
-                                       case USB_INT_RXSTPI:\r
-                                               // TODO\r
-                                               return false;\r
                                        #endif\r
                                        #if defined(USB_CAN_BE_HOST)                                    \r
                                        case USB_INT_HSOFI:\r
                                                return AVR32_USBB.UDINT.eorst;\r
                                        case USB_INT_SOFI:\r
                                                return AVR32_USBB.UDINT.sof;\r
-                                       case USB_INT_RXSTPI:\r
-                                               // TODO\r
-                                               return false;\r
                                        #endif\r
                                        #if defined(USB_CAN_BE_HOST)\r
                                        case USB_INT_HSOFI:\r