aboutsummaryrefslogtreecommitdiff
path: root/LUFA/Drivers
diff options
context:
space:
mode:
authorDean <Dean@d5102386-fcda-11dd-9fdb-3debd5008f28>2011-10-07 05:52:35 +0000
committerDean <Dean@d5102386-fcda-11dd-9fdb-3debd5008f28>2011-10-07 05:52:35 +0000
commit80220d70c50c5cf1146ba3d27860e6a7c96237b2 (patch)
treec3d5ac1b8195b6fb3c4c4a9939d7edfbadc56905 /LUFA/Drivers
parent670e65a7933ff4031ef6fdd66184de725f0d6f08 (diff)
USB XMEGA support improvements; add DFLL clock platform support, ensure the endpoint table is correctly aligned and configured in the USB controller.
git-svn-id: http://lufa-lib.googlecode.com/svn/trunk@1938 d5102386-fcda-11dd-9fdb-3debd5008f28
Diffstat (limited to 'LUFA/Drivers')
-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 9f44dc46..df45f744 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();