3      Copyright (C) Dean Camera, 2013. 
   5   dean [at] fourwalledcubicle [dot] com 
  10   Copyright 2013  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 disclaims 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
; 
  86                         static inline void USB_INT_Disable(const uint8_t Interrupt
) ATTR_ALWAYS_INLINE
; 
  87                         static inline void USB_INT_Disable(const uint8_t Interrupt
) 
  91                                         case USB_INT_BUSEVENTI
: 
  92                                                 USB
.INTCTRLA 
&= ~USB_BUSEVIE_bm
; 
  95                                                 USB
.INTCTRLA 
&= ~USB_SOFIE_bm
; 
 102                         static inline void USB_INT_Clear(const uint8_t Interrupt
) ATTR_ALWAYS_INLINE
; 
 103                         static inline void USB_INT_Clear(const uint8_t Interrupt
) 
 107                                         case USB_INT_BUSEVENTI_Suspend
: 
 108                                                 USB
.INTFLAGSACLR 
= USB_SUSPENDIF_bm
; 
 110                                         case USB_INT_BUSEVENTI_Resume
: 
 111                                                 USB
.INTFLAGSACLR 
= USB_RESUMEIF_bm
; 
 113                                         case USB_INT_BUSEVENTI_Reset
: 
 114                                                 USB
.INTFLAGSACLR 
= USB_RSTIF_bm
; 
 117                                                 USB
.INTFLAGSACLR 
= USB_SOFIF_bm
; 
 124                         static inline bool USB_INT_IsEnabled(const uint8_t Interrupt
) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT
; 
 125                         static inline bool USB_INT_IsEnabled(const uint8_t Interrupt
) 
 129                                         case USB_INT_BUSEVENTI
: 
 130                                                 return ((USB
.INTCTRLA 
& USB_BUSEVIE_bm
) ? 
true : false); 
 132                                                 return ((USB
.INTCTRLA 
& USB_SOFIE_bm
) ? 
true : false); 
 138                         static inline bool USB_INT_HasOccurred(const uint8_t Interrupt
) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT
; 
 139                         static inline bool USB_INT_HasOccurred(const uint8_t Interrupt
) 
 143                                         case USB_INT_BUSEVENTI_Suspend
: 
 144                                                 return ((USB
.INTFLAGSACLR 
& USB_SUSPENDIF_bm
) ? 
true : false); 
 145                                         case USB_INT_BUSEVENTI_Resume
: 
 146                                                 return ((USB
.INTFLAGSACLR 
& USB_RESUMEIF_bm
) ? 
true : false); 
 147                                         case USB_INT_BUSEVENTI_Reset
: 
 148                                                 return ((USB
.INTFLAGSACLR 
& USB_RSTIF_bm
) ? 
true : false); 
 150                                                 return ((USB
.INTFLAGSACLR 
& USB_SOFIF_bm
) ? 
true : false); 
 157                         #include "../USBMode.h" 
 158                         #include "../Events.h" 
 159                         #include "../USBController.h" 
 161                 /* Function Prototypes: */ 
 162                         void USB_INT_ClearAllInterrupts(void); 
 163                         void USB_INT_DisableAllInterrupts(void); 
 166         /* Disable C linkage for C++ Compilers: */ 
 167                 #if defined(__cplusplus)