+++ /dev/null
-/*\r
- LUFA Library\r
- Copyright (C) Dean Camera, 2011.\r
-\r
- dean [at] fourwalledcubicle [dot] com\r
- www.lufa-lib.org\r
-*/\r
-\r
-/*\r
- Copyright 2011 Dean Camera (dean [at] fourwalledcubicle [dot] com)\r
-\r
- Permission to use, copy, modify, distribute, and sell this\r
- software and its documentation for any purpose is hereby granted\r
- without fee, provided that the above copyright notice appear in\r
- all copies and that both that the copyright notice and this\r
- permission notice and warranty disclaimer appear in supporting\r
- documentation, and that the name of the author not be used in\r
- advertising or publicity pertaining to distribution of the\r
- software without specific, written prior permission.\r
-\r
- The author disclaim all warranties with regard to this\r
- software, including all implied warranties of merchantability\r
- and fitness. In no event shall the author be liable for any\r
- special, indirect or consequential damages or any damages\r
- whatsoever resulting from loss of use, data or profits, whether\r
- in an action of contract, negligence or other tortious action,\r
- arising out of or in connection with the use or performance of\r
- this software.\r
-*/\r
-\r
-/** \file\r
- * \brief USB Controller Interrupt definitions for the AVR32 UC3B microcontrollers.\r
- *\r
- * This file contains definitions required for the correct handling of low level USB service routine interrupts\r
- * from the USB controller.\r
- *\r
- * \note This file should not be included directly. It is automatically included as needed by the USB driver\r
- * dispatch header located in LUFA/Drivers/USB/USB.h.\r
- */\r
-\r
-#ifndef __USBINTERRUPT_UC3B_H__\r
-#define __USBINTERRUPT_UC3B_H__\r
-\r
- /* Includes: */\r
- #include "../../../../Common/Common.h"\r
-\r
- /* Enable C linkage for C++ Compilers: */\r
- #if defined(__cplusplus)\r
- extern "C" {\r
- #endif\r
-\r
- /* Preprocessor Checks: */\r
- #if !defined(__INCLUDE_FROM_USB_DRIVER)\r
- #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.\r
- #endif\r
-\r
- /* Private Interface - For use in library only: */\r
- #if !defined(__DOXYGEN__)\r
- /* Macros: */\r
- enum USB_Interrupts_t\r
- {\r
- USB_INT_VBUSTI = 0,\r
- #if (defined(USB_CAN_BE_BOTH) || defined(__DOXYGEN__))\r
- USB_INT_IDTI = 1,\r
- #endif\r
- #if (defined(USB_CAN_BE_DEVICE) || defined(__DOXYGEN__))\r
- USB_INT_WAKEUPI = 2,\r
- USB_INT_SUSPI = 3,\r
- USB_INT_EORSTI = 4,\r
- USB_INT_SOFI = 5,\r
- #endif\r
- #if (defined(USB_CAN_BE_HOST) || defined(__DOXYGEN__)) \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
- /* ISR Prototypes: */\r
- ISR(USB_GEN_vect);\r
- \r
- /* Inline Functions: */\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
- switch (Interrupt)\r
- {\r
- case USB_INT_VBUSTI:\r
- AVR32_USBB.USBCON.vbuste = true;\r
- break;\r
- #if defined(USB_CAN_BE_BOTH)\r
- case USB_INT_IDTI:\r
- AVR32_USBB.USBCON.idte = true;\r
- break;\r
- #endif\r
- #if defined(USB_CAN_BE_DEVICE)\r
- case USB_INT_WAKEUPI:\r
- AVR32_USBB.UDINTESET.wakeupes = true;\r
- break;\r
- case USB_INT_SUSPI:\r
- AVR32_USBB.UDINTESET.suspes = true;\r
- break;\r
- case USB_INT_EORSTI:\r
- AVR32_USBB.UDINTESET.eorstes = true;\r
- break;\r
- case USB_INT_SOFI:\r
- AVR32_USBB.UDINTESET.sofes = true;\r
- break;\r
- #endif\r
- #if defined(USB_CAN_BE_HOST)\r
- case USB_INT_HSOFI:\r
- AVR32_USBB.UHINTESET.hsofies = true;\r
- break;\r
- case USB_INT_DCONNI:\r
- AVR32_USBB.UHINTESET.dconnies = true;\r
- break;\r
- case USB_INT_DDISCI:\r
- AVR32_USBB.UHINTESET.ddiscies = true;\r
- break;\r
- case USB_INT_RSTI:\r
- AVR32_USBB.UHINTESET.rsties = true;\r
- break;\r
- case USB_INT_BCERRI:\r
- AVR32_USBB.USBCON.bcerre = true;\r
- break;\r
- case USB_INT_VBERRI:\r
- AVR32_USBB.USBCON.vberre = true;\r
- break;\r
- #endif\r
- }\r
- }\r
-\r
- static inline void USB_INT_Disable(const uint8_t Interrupt) ATTR_ALWAYS_INLINE;\r
- static inline void USB_INT_Disable(const uint8_t Interrupt)\r
- {\r
- switch (Interrupt)\r
- {\r
- case USB_INT_VBUSTI:\r
- AVR32_USBB.USBCON.vbuste = false;\r
- break;\r
- #if defined(USB_CAN_BE_BOTH)\r
- case USB_INT_IDTI:\r
- AVR32_USBB.USBCON.idte = false;\r
- break;\r
- #endif\r
- #if defined(USB_CAN_BE_DEVICE)\r
- case USB_INT_WAKEUPI:\r
- AVR32_USBB.UDINTECLR.wakeupec = true;\r
- break;\r
- case USB_INT_SUSPI:\r
- AVR32_USBB.UDINTECLR.suspec = true;\r
- break;\r
- case USB_INT_EORSTI:\r
- AVR32_USBB.UDINTECLR.eorstec = true;\r
- break;\r
- case USB_INT_SOFI:\r
- AVR32_USBB.UDINTECLR.sofec = true;\r
- break;\r
- #endif\r
- #if defined(USB_CAN_BE_HOST)\r
- case USB_INT_HSOFI:\r
- AVR32_USBB.UHINTECLR.hsofiec = true;\r
- break;\r
- case USB_INT_DCONNI:\r
- AVR32_USBB.UHINTECLR.dconniec = true;\r
- break;\r
- case USB_INT_DDISCI:\r
- AVR32_USBB.UHINTECLR.ddisciec = true;\r
- break;\r
- case USB_INT_RSTI:\r
- AVR32_USBB.UHINTECLR.rstiec = true;\r
- break;\r
- case USB_INT_BCERRI:\r
- AVR32_USBB.USBCON.bcerre = false;\r
- break;\r
- case USB_INT_VBERRI:\r
- AVR32_USBB.USBCON.vberre = false;\r
- break;\r
- #endif\r
- }\r
- }\r
- \r
- static inline void USB_INT_Clear(const uint8_t Interrupt) ATTR_ALWAYS_INLINE;\r
- static inline void USB_INT_Clear(const uint8_t Interrupt)\r
- {\r
- switch (Interrupt)\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
- #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
- }\r
- \r
- static inline bool USB_INT_IsEnabled(const uint8_t Interrupt) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT;\r
- static inline bool USB_INT_IsEnabled(const uint8_t Interrupt)\r
- {\r
- switch (Interrupt)\r
- {\r
- case USB_INT_VBUSTI:\r
- return AVR32_USBB.USBCON.vbuste;\r
- #if defined(USB_CAN_BE_BOTH)\r
- case USB_INT_IDTI:\r
- return AVR32_USBB.USBCON.idte;\r
- #endif\r
- #if defined(USB_CAN_BE_DEVICE)\r
- case USB_INT_WAKEUPI:\r
- return AVR32_USBB.UDINTE.wakeupe;\r
- case USB_INT_SUSPI:\r
- return AVR32_USBB.UDINTE.suspe;\r
- case USB_INT_EORSTI:\r
- return AVR32_USBB.UDINTE.eorste;\r
- case USB_INT_SOFI:\r
- return AVR32_USBB.UDINTE.sofe;\r
- #endif\r
- #if defined(USB_CAN_BE_HOST) \r
- case USB_INT_HSOFI:\r
- return AVR32_USBB.UHINTE.hsofie;\r
- case USB_INT_DCONNI:\r
- return AVR32_USBB.UHINTE.dconnie;\r
- case USB_INT_DDISCI:\r
- return AVR32_USBB.UHINTE.ddiscie;\r
- case USB_INT_RSTI:\r
- return AVR32_USBB.UHINTE.rstie;\r
- case USB_INT_BCERRI:\r
- return AVR32_USBB.USBCON.bcerre;\r
- case USB_INT_VBERRI:\r
- return AVR32_USBB.USBCON.vberre;\r
- #endif\r
- }\r
- \r
- return false;\r
- }\r
- \r
- static inline bool USB_INT_HasOccurred(const uint8_t Interrupt) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT;\r
- static inline bool USB_INT_HasOccurred(const uint8_t Interrupt)\r
- {\r
- switch (Interrupt)\r
- {\r
- case USB_INT_VBUSTI:\r
- return AVR32_USBB.USBSTA.vbusti;\r
- #if defined(USB_CAN_BE_BOTH)\r
- case USB_INT_IDTI:\r
- return AVR32_USBB.USBSTA.idti;\r
- #endif\r
- #if defined(USB_CAN_BE_DEVICE)\r
- case USB_INT_WAKEUPI:\r
- return AVR32_USBB.UDINT.wakeup;\r
- case USB_INT_SUSPI:\r
- return AVR32_USBB.UDINT.susp;\r
- case USB_INT_EORSTI:\r
- return AVR32_USBB.UDINT.eorst;\r
- case USB_INT_SOFI:\r
- return AVR32_USBB.UDINT.sof;\r
- #endif\r
- #if defined(USB_CAN_BE_HOST)\r
- case USB_INT_HSOFI:\r
- return AVR32_USBB.UHINT.hsofi;\r
- case USB_INT_DCONNI:\r
- return AVR32_USBB.UHINT.dconni;\r
- case USB_INT_DDISCI:\r
- return AVR32_USBB.UHINT.ddisci;\r
- case USB_INT_RSTI:\r
- return AVR32_USBB.UHINT.rsti;\r
- case USB_INT_BCERRI:\r
- return AVR32_USBB.USBSTA.bcerri;\r
- case USB_INT_VBERRI:\r
- return AVR32_USBB.USBSTA.vberri;\r
- #endif\r
- }\r
-\r
- return false;\r
- }\r
-\r
- /* Includes: */\r
- #include "../USBMode.h"\r
- #include "../Events.h"\r
- #include "../USBController.h"\r
-\r
- /* Function Prototypes: */\r
- void USB_INT_ClearAllInterrupts(void);\r
- void USB_INT_DisableAllInterrupts(void);\r
- #endif\r
-\r
- /* Disable C linkage for C++ Compilers: */\r
- #if defined(__cplusplus)\r
- }\r
- #endif\r
-\r
-#endif\r
-\r