3      Copyright (C) Dean Camera, 2012. 
   5   dean [at] fourwalledcubicle [dot] com 
  10   Copyright 2012  Dean Camera (dean [at] fourwalledcubicle [dot] com) 
  12   Permission to use, copy, modify, distribute, and sell this 
  13   software and its documentation for any purpose is hereby granted 
  14   without fee, provided that the above copyright notice appear in 
  15   all copies and that both that the copyright notice and this 
  16   permission notice and warranty disclaimer appear in supporting 
  17   documentation, and that the name of the author not be used in 
  18   advertising or publicity pertaining to distribution of the 
  19   software without specific, written prior permission. 
  21   The author disclaim all warranties with regard to this 
  22   software, including all implied warranties of merchantability 
  23   and fitness.  In no event shall the author be liable for any 
  24   special, indirect or consequential damages or any damages 
  25   whatsoever resulting from loss of use, data or profits, whether 
  26   in an action of contract, negligence or other tortious action, 
  27   arising out of or in connection with the use or performance of 
  32  *  \brief USB Controller Interrupt definitions for the AVR XMEGA microcontrollers. 
  34  *  This file contains definitions required for the correct handling of low level USB service routine interrupts 
  35  *  from the USB controller. 
  37  *  \note This file should not be included directly. It is automatically included as needed by the USB driver 
  38  *        dispatch header located in LUFA/Drivers/USB/USB.h. 
  41 #ifndef __USBINTERRUPT_XMEGA_H__ 
  42 #define __USBINTERRUPT_XMEGA_H__ 
  45                 #include "../../../../Common/Common.h" 
  47         /* Enable C linkage for C++ Compilers: */ 
  48                 #if defined(__cplusplus) 
  52         /* Preprocessor Checks: */ 
  53                 #if !defined(__INCLUDE_FROM_USB_DRIVER) 
  54                         #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. 
  57         /* Private Interface - For use in library only: */ 
  58         #if !defined(__DOXYGEN__) 
  62                                 USB_INT_BUSEVENTI         
= 1, 
  63                                 USB_INT_BUSEVENTI_Suspend 
= 2, 
  64                                 USB_INT_BUSEVENTI_Resume  
= 3, 
  65                                 USB_INT_BUSEVENTI_Reset   
= 4, 
  69                 /* Inline Functions: */ 
  70                         static inline void USB_INT_Enable(const uint8_t Interrupt
) ATTR_ALWAYS_INLINE
; 
  71                         static inline void USB_INT_Enable(const uint8_t Interrupt
) 
  75                                         case USB_INT_BUSEVENTI
: 
  76                                                 USB
.INTCTRLA 
|= USB_BUSEVIE_bm
; 
  79                                                 USB
.INTCTRLA 
|= USB_SOFIE_bm
; 
  84                         static inline void USB_INT_Disable(const uint8_t Interrupt
) ATTR_ALWAYS_INLINE
; 
  85                         static inline void USB_INT_Disable(const uint8_t Interrupt
) 
  89                                         case USB_INT_BUSEVENTI
: 
  90                                                 USB
.INTCTRLA 
&= ~USB_BUSEVIE_bm
; 
  93                                                 USB
.INTCTRLA 
&= ~USB_SOFIE_bm
; 
  98                         static inline void USB_INT_Clear(const uint8_t Interrupt
) ATTR_ALWAYS_INLINE
; 
  99                         static inline void USB_INT_Clear(const uint8_t Interrupt
) 
 103                                         case USB_INT_BUSEVENTI_Suspend
: 
 104                                                 USB
.INTFLAGSACLR 
= USB_SUSPENDIF_bm
; 
 106                                         case USB_INT_BUSEVENTI_Resume
: 
 107                                                 USB
.INTFLAGSACLR 
= USB_RESUMEIF_bm
; 
 109                                         case USB_INT_BUSEVENTI_Reset
: 
 110                                                 USB
.INTFLAGSACLR 
= USB_RSTIF_bm
; 
 113                                                 USB
.INTFLAGSACLR 
= USB_SOFIF_bm
; 
 118                         static inline bool USB_INT_IsEnabled(const uint8_t Interrupt
) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT
; 
 119                         static inline bool USB_INT_IsEnabled(const uint8_t Interrupt
) 
 123                                         case USB_INT_BUSEVENTI
: 
 124                                                 return ((USB
.INTCTRLA 
& USB_BUSEVIE_bm
) ? 
true : false); 
 126                                                 return ((USB
.INTCTRLA 
& USB_SOFIE_bm
) ? 
true : false); 
 132                         static inline bool USB_INT_HasOccurred(const uint8_t Interrupt
) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT
; 
 133                         static inline bool USB_INT_HasOccurred(const uint8_t Interrupt
) 
 137                                         case USB_INT_BUSEVENTI_Suspend
: 
 138                                                 return ((USB
.INTFLAGSACLR 
& USB_SUSPENDIF_bm
) ? 
true : false); 
 139                                         case USB_INT_BUSEVENTI_Resume
: 
 140                                                 return ((USB
.INTFLAGSACLR 
& USB_RESUMEIF_bm
) ? 
true : false); 
 141                                         case USB_INT_BUSEVENTI_Reset
: 
 142                                                 return ((USB
.INTFLAGSACLR 
& USB_RSTIF_bm
) ? 
true : false); 
 144                                                 return ((USB
.INTFLAGSACLR 
& USB_SOFIF_bm
) ? 
true : false); 
 151                         #include "../USBMode.h" 
 152                         #include "../Events.h" 
 153                         #include "../USBController.h" 
 155                 /* Function Prototypes: */ 
 156                         void USB_INT_ClearAllInterrupts(void); 
 157                         void USB_INT_DisableAllInterrupts(void); 
 160         /* Disable C linkage for C++ Compilers: */ 
 161                 #if defined(__cplusplus)