diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2011-07-15 08:29:25 +0000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2011-07-15 08:29:25 +0000 |
commit | a36012fc4b057dc1fe96f75a005cd8ba017a6a71 (patch) | |
tree | 52df29ae331e8dcd04b863163408b7b1b3503543 /LUFA/Drivers/USB/Core | |
parent | f07e766755b2489c76f0f353b7fe2d4a11300e61 (diff) | |
download | lufa-a36012fc4b057dc1fe96f75a005cd8ba017a6a71.tar.gz lufa-a36012fc4b057dc1fe96f75a005cd8ba017a6a71.tar.bz2 lufa-a36012fc4b057dc1fe96f75a005cd8ba017a6a71.zip |
Add option to the USB XMEGAs to set the USB bus interrupt priority level.
Diffstat (limited to 'LUFA/Drivers/USB/Core')
-rw-r--r-- | LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c | 11 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.h | 20 |
2 files changed, 26 insertions, 5 deletions
diff --git a/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c b/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c index c67575b6f..dcb506b2b 100644 --- a/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c +++ b/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c @@ -72,6 +72,13 @@ void USB_Init( NVM.CMD = NVM_CMD_READ_CALIB_ROW_gc;
USB.CAL1 = pgm_read_byte(offsetof(NVM_PROD_SIGNATURES_t, USBCAL1));
+ if ((USB_Options & USB_OPT_BUSEVENT_PRIHIGH) == USB_OPT_BUSEVENT_PRIHIGH)
+ USB.INTCTRLA = (3 << USB_INTLVL_gp);
+ else if ((USB_Options & USB_OPT_BUSEVENT_PRIMED) == USB_OPT_BUSEVENT_PRIMED)
+ USB.INTCTRLA = (2 << USB_INTLVL_gp);
+ else
+ USB.INTCTRLA = (1 << USB_INTLVL_gp);
+
SetGlobalInterruptMask(CurrentGlobalInt);
USB_ResetInterface();
@@ -98,10 +105,6 @@ void USB_ResetInterface(void) USB_INT_DisableAllInterrupts();
USB_INT_ClearAllInterrupts();
- // TODO: Config define for priority
- USB.INTCTRLA = (2 << USB_INTLVL_gp);
- PMIC.CTRL |= (1 << PMIC_MEDLVLEX_bp);
-
USB_Controller_Reset();
USB_Init_Device();
}
diff --git a/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.h b/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.h index 45cfe5977..f6c4a7aa8 100644 --- a/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.h +++ b/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.h @@ -84,7 +84,25 @@ #endif
/* Public Interface - May be used in end-application: */
- /* Macros: */
+ /* Macros: */
+ /** \name USB Controller Option Masks */
+ //@{
+ /** Sets the USB bus interrupt priority level to be low priority. The USB bus interrupt is used for Start of Frame events, bus suspend
+ * and resume events, bus reset events and other events related to the management of the USB bus.
+ */
+ #define USB_OPT_BUSEVENT_PRILOW ((0 << 1) | (0 << 1))
+
+ /** Sets the USB bus interrupt priority level to be medium priority. The USB bus interrupt is used for Start of Frame events, bus suspend
+ * and resume events, bus reset events and other events related to the management of the USB bus.
+ */
+ #define USB_OPT_BUSEVENT_PRIMED ((0 << 1) | (1 << 1))
+
+ /** Sets the USB bus interrupt priority level to be high priority. The USB bus interrupt is used for Start of Frame events, bus suspend
+ * and resume events, bus reset events and other events related to the management of the USB bus.
+ */
+ #define USB_OPT_BUSEVENT_PRIHIGH ((1 << 1) | (0 << 1))
+ //@}
+
/** \name Endpoint/Pipe Type Masks */
//@{
/** Mask for a CONTROL type endpoint or pipe.
|