3 Copyright (C) Dean Camera, 2011.
5 dean [at] fourwalledcubicle [dot] com
10 Copyright 2011 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 AVR32 UC3B 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_UC3B_H__
42 #define __USBINTERRUPT_UC3B_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__)
78 /* Inline Functions: */
79 static inline void USB_INT_Enable(const uint8_t Interrupt
) ATTR_ALWAYS_INLINE
;
80 static inline void USB_INT_Enable(const uint8_t Interrupt
)
85 AVR32_USBB
.USBCON
.vbuste
= true;
88 AVR32_USBB
.USBCON
.idte
= true;
91 AVR32_USBB
.UDINTESET
.wakeupes
= true;
94 AVR32_USBB
.UDINTESET
.suspes
= true;
97 AVR32_USBB
.UDINTESET
.eorstes
= true;
100 AVR32_USBB
.UDINTESET
.sofes
= true;
103 AVR32_USBB
.UHINTESET
.hsofies
= true;
106 AVR32_USBB
.UHINTESET
.dconnies
= true;
109 AVR32_USBB
.UHINTESET
.ddiscies
= true;
112 AVR32_USBB
.UHINTESET
.rsties
= true;
115 AVR32_USBB
.USBCON
.bcerre
= true;
118 AVR32_USBB
.USBCON
.vberre
= true;
127 static inline void USB_INT_Disable(const uint8_t Interrupt
) ATTR_ALWAYS_INLINE
;
128 static inline void USB_INT_Disable(const uint8_t Interrupt
)
133 AVR32_USBB
.USBCON
.vbuste
= false;
136 AVR32_USBB
.USBCON
.idte
= false;
138 case USB_INT_WAKEUPI
:
139 AVR32_USBB
.UDINTECLR
.wakeupec
= true;
142 AVR32_USBB
.UDINTECLR
.suspec
= true;
145 AVR32_USBB
.UDINTECLR
.eorstec
= true;
148 AVR32_USBB
.UDINTECLR
.sofec
= true;
151 AVR32_USBB
.UHINTECLR
.hsofiec
= true;
154 AVR32_USBB
.UHINTECLR
.dconniec
= true;
157 AVR32_USBB
.UHINTECLR
.ddisciec
= true;
160 AVR32_USBB
.UHINTECLR
.rstiec
= true;
163 AVR32_USBB
.USBCON
.bcerre
= false;
166 AVR32_USBB
.USBCON
.vberre
= false;
175 static inline void USB_INT_Clear(const uint8_t Interrupt
) ATTR_ALWAYS_INLINE
;
176 static inline void USB_INT_Clear(const uint8_t Interrupt
)
181 AVR32_USBB
.USBSTACLR
.vbustic
= true;
184 AVR32_USBB
.USBSTACLR
.idtic
= true;
186 case USB_INT_WAKEUPI
:
187 AVR32_USBB
.UDINTCLR
.wakeupc
= true;
190 AVR32_USBB
.UDINTCLR
.suspc
= true;
193 AVR32_USBB
.UDINTCLR
.eorstc
= true;
196 AVR32_USBB
.UDINTCLR
.sofc
= true;
199 AVR32_USBB
.UHINTCLR
.hsofic
= true;
202 AVR32_USBB
.UHINTCLR
.dconnic
= true;
205 AVR32_USBB
.UHINTCLR
.ddiscic
= true;
208 AVR32_USBB
.UHINTCLR
.rstic
= true;
211 AVR32_USBB
.USBSTACLR
.bcerric
= true;
214 AVR32_USBB
.USBSTACLR
.vberric
= true;
223 static inline bool USB_INT_IsEnabled(const uint8_t Interrupt
) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT
;
224 static inline bool USB_INT_IsEnabled(const uint8_t Interrupt
)
229 return AVR32_USBB
.USBCON
.vbuste
;
231 return AVR32_USBB
.USBCON
.idte
;
232 case USB_INT_WAKEUPI
:
233 return AVR32_USBB
.UDINTE
.wakeupe
;
235 return AVR32_USBB
.UDINTE
.suspe
;
237 return AVR32_USBB
.UDINTE
.eorste
;
239 return AVR32_USBB
.UDINTE
.sofe
;
241 return AVR32_USBB
.UHINTE
.hsofie
;
243 return AVR32_USBB
.UHINTE
.dconnie
;
245 return AVR32_USBB
.UHINTE
.ddiscie
;
247 return AVR32_USBB
.UHINTE
.rstie
;
249 return AVR32_USBB
.USBCON
.bcerre
;
251 return AVR32_USBB
.USBCON
.vberre
;
261 static inline bool USB_INT_HasOccurred(const uint8_t Interrupt
) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT
;
262 static inline bool USB_INT_HasOccurred(const uint8_t Interrupt
)
267 return AVR32_USBB
.USBSTA
.vbusti
;
269 return AVR32_USBB
.USBSTA
.idti
;
270 case USB_INT_WAKEUPI
:
271 return AVR32_USBB
.UDINT
.wakeup
;
273 return AVR32_USBB
.UDINT
.susp
;
275 return AVR32_USBB
.UDINT
.eorst
;
277 return AVR32_USBB
.UDINT
.sof
;
279 return AVR32_USBB
.UHINT
.hsofi
;
281 return AVR32_USBB
.UHINT
.dconni
;
283 return AVR32_USBB
.UHINT
.ddisci
;
285 return AVR32_USBB
.UHINT
.rsti
;
287 return AVR32_USBB
.USBSTA
.bcerri
;
289 return AVR32_USBB
.USBSTA
.vberri
;
300 #include "../USBMode.h"
301 #include "../Events.h"
302 #include "../USBController.h"
304 /* Function Prototypes: */
305 void USB_INT_ClearAllInterrupts(void);
306 void USB_INT_DisableAllInterrupts(void);
309 /* Disable C linkage for C++ Compilers: */
310 #if defined(__cplusplus)