Add in a new common Delay_MS() function, which provides a blocking delay for all...
[pub/lufa.git] / LUFA / Drivers / USB / Core / UC3 / USBInterrupt_UC3.h
index 1192433..95a85cf 100644 (file)
@@ -57,6 +57,9 @@
        /* Private Interface - For use in library only: */\r
        #if !defined(__DOXYGEN__)\r
                /* Macros: */\r
+                       #define LUFA_ISR(Name)                void Name (void) __attribute__((__interrupt__)); void Name (void)\r
+                       \r
+               /* Enums: */\r
                        enum USB_Interrupts_t\r
                        {\r
                                USB_INT_VBUSTI  = 0,\r
                                #endif\r
                        };\r
                \r
-               /* ISR Prototypes: */\r
-                       ISR(USB_GEN_vect);\r
-               \r
                /* Inline Functions: */\r
+                       static inline uint_reg_t USB_INT_GetGlobalEnableState(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT;\r
+                       static inline uint_reg_t USB_INT_GetGlobalEnableState(void)\r
+                       {\r
+                               GCC_MEMORY_BARRIER();\r
+                               return (__builtin_mfsr(AVR32_SR) & AVR32_SR_GM);\r
+                       }\r
+\r
+                       static inline void USB_INT_SetGlobalEnableState(uint_reg_t GlobalIntState) ATTR_ALWAYS_INLINE;\r
+                       static inline void USB_INT_SetGlobalEnableState(uint_reg_t GlobalIntState)\r
+                       {\r
+                               GCC_MEMORY_BARRIER();\r
+                               __builtin_ssrf(AVR32_SR_GM_OFFSET, GlobalIntState);\r
+                               GCC_MEMORY_BARRIER();\r
+                       }\r
+               \r
+                       static inline void USB_INT_GlobalEnable(void) ATTR_ALWAYS_INLINE;\r
+                       static inline void USB_INT_GlobalEnable(void)\r
+                       {\r
+                               GCC_MEMORY_BARRIER();\r
+                               __builtin_csrf(AVR32_SR_GM_OFFSET);\r
+                               GCC_MEMORY_BARRIER();\r
+                       }               \r
+\r
+                       static inline void USB_INT_GlobalDisable(void) ATTR_ALWAYS_INLINE;\r
+                       static inline void USB_INT_GlobalDisable(void)\r
+                       {\r
+                               GCC_MEMORY_BARRIER();\r
+                               __builtin_ssrf(AVR32_SR_GM_OFFSET);\r
+                               GCC_MEMORY_BARRIER();\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
                        void USB_INT_DisableAllInterrupts(void);\r
        #endif\r
 \r
+       /* Public Interface - May be used in end-application: */\r
+               /* ISR Prototypes: */\r
+                       #if defined(__DOXYGEN__)\r
+                               /** Interrupt service routine handler for the USB controller ISR group. This interrupt routine <b>must</b> be\r
+                                *  linked to the entire USB controller ISR vector group inside the AVR32's interrupt controller peripheral,\r
+                                *  using the user application's preferred USB controller driver.\r
+                                */\r
+                               void USB_GEN_vect(void);\r
+                       #else\r
+                               LUFA_ISR(USB_GEN_vect);\r
+                       #endif\r
+                       \r
        /* Disable C linkage for C++ Compilers: */\r
                #if defined(__cplusplus)\r
                        }\r