aboutsummaryrefslogtreecommitdiffstats
path: root/LUFA/Drivers/USB/Core/XMEGA
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2011-10-07 05:52:35 +0000
committerDean Camera <dean@fourwalledcubicle.com>2011-10-07 05:52:35 +0000
commita4d67bb6ffea688e8a25d5fd4692e569ca98f2f4 (patch)
treec3d5ac1b8195b6fb3c4c4a9939d7edfbadc56905 /LUFA/Drivers/USB/Core/XMEGA
parentdb73b11244c2c5dc444f3c459d6823be8d1fe655 (diff)
downloadlufa-a4d67bb6ffea688e8a25d5fd4692e569ca98f2f4.tar.gz
lufa-a4d67bb6ffea688e8a25d5fd4692e569ca98f2f4.tar.bz2
lufa-a4d67bb6ffea688e8a25d5fd4692e569ca98f2f4.zip
USB XMEGA support improvements; add DFLL clock platform support, ensure the endpoint table is correctly aligned and configured in the USB controller.
Diffstat (limited to 'LUFA/Drivers/USB/Core/XMEGA')
-rw-r--r--LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c b/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c
index 9f44dc46a..df45f7444 100644
--- a/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c
+++ b/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c
@@ -40,7 +40,7 @@ volatile uint8_t USB_CurrentMode = USB_MODE_None;
volatile uint8_t USB_Options;
#endif
-USB_EP_TABLE_t USB_EndpointTable ATTR_ALIGNED(2);
+USB_EP_TABLE_t USB_EndpointTable ATTR_ALIGNED(4);
void USB_Init(
#if defined(USB_CAN_BE_BOTH)
@@ -72,6 +72,8 @@ void USB_Init(
NVM.CMD = NVM_CMD_READ_CALIB_ROW_gc;
USB.CAL1 = pgm_read_byte(offsetof(NVM_PROD_SIGNATURES_t, USBCAL1));
+ USB.EPPTR = (intptr_t)&USB_EndpointTable;
+
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)
@@ -81,7 +83,7 @@ void USB_Init(
SetGlobalInterruptMask(CurrentGlobalInt);
- USB_ResetInterface();
+ USB_ResetInterface();
}
void USB_Disable(void)
@@ -102,6 +104,8 @@ void USB_ResetInterface(void)
else
CLK.USBCTRL = ((((F_USB / 48000000) - 1) << CLK_USBPSDIV_gp) | CLK_USBSRC_PLL_gc | CLK_USBSEN_bm);
+ USB_Device_SetDeviceAddress(0);
+
USB_INT_DisableAllInterrupts();
USB_INT_ClearAllInterrupts();