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