aboutsummaryrefslogtreecommitdiffstats
path: root/LUFA/Drivers/USB/Core/XMEGA
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2012-06-10 19:53:20 +0000
committerDean Camera <dean@fourwalledcubicle.com>2012-06-10 19:53:20 +0000
commitc41bbf9fccd99de70c962ec6f7cac15efe06d3df (patch)
tree05918c6da856132fe8a38324fc7a3cd88db14b63 /LUFA/Drivers/USB/Core/XMEGA
parent9ab445518a01e9b10b5d3e1c99f45d81d874278b (diff)
downloadlufa-c41bbf9fccd99de70c962ec6f7cac15efe06d3df.tar.gz
lufa-c41bbf9fccd99de70c962ec6f7cac15efe06d3df.tar.bz2
lufa-c41bbf9fccd99de70c962ec6f7cac15efe06d3df.zip
Add checks to the endpoint and pipe configure functions and fail if the requested endpoint or pipe number is above the maximum for that device.
Diffstat (limited to 'LUFA/Drivers/USB/Core/XMEGA')
-rw-r--r--LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.h6
-rw-r--r--LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c2
2 files changed, 6 insertions, 2 deletions
diff --git a/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.h b/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.h
index 8be20d2de..3d2926c30 100644
--- a/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.h
+++ b/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.h
@@ -246,8 +246,12 @@
{
uint8_t EPConfigMask = (USB_EP_INTDSBL_bm | ((Banks > 1) ? USB_EP_PINGPONG_bm : 0) | Endpoint_BytesToEPSizeMask(Size));
+ if ((Address & ENDPOINT_EPNUM_MASK) >= ENDPOINT_TOTAL_ENDPOINTS)
+ return false;
+
// TODO - Fix once limitations are lifted
- if ((Banks > 1) || (Size > 64))
+ EPConfigMask &= ~USB_EP_PINGPONG_bm;
+ if (Size > 64)
return false;
switch (Type)
diff --git a/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c b/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c
index 844ef650f..09d4ab620 100644
--- a/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c
+++ b/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c
@@ -76,7 +76,7 @@ void USB_Init(
USB.CAL1 = pgm_read_byte(offsetof(NVM_PROD_SIGNATURES_t, USBCAL1));
NVM.CMD = 0;
- /* Ugly workaround to ensure an aligned table, since __BIGGEST_ALIGNMENT__ == 1 for 8-bit AVR-GCC */
+ /* Ugly workaround to ensure an aligned table, since __BIGGEST_ALIGNMENT__ == 1 for the 8-bit AVR-GCC toochain */
USB.EPPTR = ((intptr_t)&USB_EndpointTable[1] & ~(1 << 0));
USB.CTRLA = (USB_STFRNUM_bm | ((ENDPOINT_TOTAL_ENDPOINTS - 1) << USB_MAXEP_gp));