aboutsummaryrefslogtreecommitdiffstats
path: root/LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.h
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2011-07-15 08:10:51 +0000
committerDean Camera <dean@fourwalledcubicle.com>2011-07-15 08:10:51 +0000
commitf07e766755b2489c76f0f353b7fe2d4a11300e61 (patch)
tree95f6050361cbfa3ecdca0d5926f7c8201b98ca64 /LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.h
parentffa8b430c1886b696e1e94039e6a9343b5b81dbd (diff)
downloadlufa-f07e766755b2489c76f0f353b7fe2d4a11300e61.tar.gz
lufa-f07e766755b2489c76f0f353b7fe2d4a11300e61.tar.bz2
lufa-f07e766755b2489c76f0f353b7fe2d4a11300e61.zip
Complete USB XMEGA interrupt control subsystem code in the core USB driver.
Automatically load in the USB calibration bytes from the User Signature Row on start-up. Create internal SRAM variable for the endpoint control and status register table, used by the XMEGA USB controller hardware.
Diffstat (limited to 'LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.h')
-rw-r--r--LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.h66
1 files changed, 60 insertions, 6 deletions
diff --git a/LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.h b/LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.h
index 6dcb0e67c..b6acec4ea 100644
--- a/LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.h
+++ b/LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.h
@@ -59,38 +59,92 @@
/* Enums: */
enum USB_Interrupts_t
{
- USB_INT_NONE = 0, // TODO
+ USB_INT_BUSEVENTI = 1,
+ USB_INT_BUSEVENTI_Suspend = 2,
+ USB_INT_BUSEVENTI_Resume = 3,
+ USB_INT_BUSEVENTI_Reset = 4,
+ USB_INT_SOFI = 5,
};
/* Inline Functions: */
static inline void USB_INT_Enable(const uint8_t Interrupt) ATTR_ALWAYS_INLINE;
static inline void USB_INT_Enable(const uint8_t Interrupt)
{
- // TODO
+ switch (Interrupt)
+ {
+ case USB_INT_BUSEVENTI:
+ USB.INTCTRLA |= USB_BUSEVIE_bm;
+ return;
+ case USB_INT_SOFI:
+ USB.INTCTRLA |= USB_SOFIE_bm;
+ return;
+ }
}
static inline void USB_INT_Disable(const uint8_t Interrupt) ATTR_ALWAYS_INLINE;
static inline void USB_INT_Disable(const uint8_t Interrupt)
{
- // TODO
+ switch (Interrupt)
+ {
+ case USB_INT_BUSEVENTI:
+ USB.INTCTRLA &= ~USB_BUSEVIE_bm;
+ return;
+ case USB_INT_SOFI:
+ USB.INTCTRLA &= ~USB_SOFIE_bm;
+ return;
+ }
}
static inline void USB_INT_Clear(const uint8_t Interrupt) ATTR_ALWAYS_INLINE;
static inline void USB_INT_Clear(const uint8_t Interrupt)
{
- // TODO
+ switch (Interrupt)
+ {
+ case USB_INT_BUSEVENTI_Suspend:
+ USB.INTFLAGSACLR = USB_SUSPENDIF_bm;
+ return;
+ case USB_INT_BUSEVENTI_Resume:
+ USB.INTFLAGSACLR = USB_RESUMEIF_bm;
+ return;
+ case USB_INT_BUSEVENTI_Reset:
+ USB.INTFLAGSACLR = USB_RSTIF_bm;
+ return;
+ case USB_INT_SOFI:
+ USB.INTFLAGSACLR = USB_SOFIF_bm;
+ return;
+ }
}
static inline bool USB_INT_IsEnabled(const uint8_t Interrupt) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT;
static inline bool USB_INT_IsEnabled(const uint8_t Interrupt)
{
- return false; // TODO
+ switch (Interrupt)
+ {
+ case USB_INT_BUSEVENTI:
+ return (USB.INTCTRLA & USB_BUSEVIE_bm);
+ case USB_INT_SOFI:
+ return (USB.INTCTRLA & USB_SOFIE_bm);
+ }
+
+ return false;
}
static inline bool USB_INT_HasOccurred(const uint8_t Interrupt) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT;
static inline bool USB_INT_HasOccurred(const uint8_t Interrupt)
{
- return false; // TODO
+ switch (Interrupt)
+ {
+ case USB_INT_BUSEVENTI_Suspend:
+ return (USB.INTFLAGSACLR & USB_SUSPENDIF_bm);
+ case USB_INT_BUSEVENTI_Resume:
+ return (USB.INTFLAGSACLR & USB_RESUMEIF_bm);
+ case USB_INT_BUSEVENTI_Reset:
+ return (USB.INTFLAGSACLR & USB_RSTIF_bm);
+ case USB_INT_SOFI:
+ return (USB.INTFLAGSACLR & USB_SOFIF_bm);
+ }
+
+ return false;
}
/* Includes: */