aboutsummaryrefslogtreecommitdiffstats
path: root/LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.c
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2011-07-19 02:42:27 +0000
committerDean Camera <dean@fourwalledcubicle.com>2011-07-19 02:42:27 +0000
commit2c404e5af53409af5ce279321377a1303c776617 (patch)
tree090bca3a20578720326ef0102cf1b22f582adf52 /LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.c
parent69243c5071c4b059c1405f9dd4753f306f8dc04e (diff)
downloadlufa-2c404e5af53409af5ce279321377a1303c776617.tar.gz
lufa-2c404e5af53409af5ce279321377a1303c776617.tar.bz2
lufa-2c404e5af53409af5ce279321377a1303c776617.zip
Add support for the ORDERED_EP_CONFIG compile time token on the UC3 architecture.
Diffstat (limited to 'LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.c')
-rw-r--r--LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.c b/LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.c
index 8e784e96c..19a57a1f3 100644
--- a/LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.c
+++ b/LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.c
@@ -45,6 +45,7 @@ volatile uint8_t* USB_EndpointFIFOPos[ENDPOINT_TOTAL_ENDPOINTS];
bool Endpoint_ConfigureEndpoint_Prv(const uint8_t Number,
const uint32_t UECFG0Data)
{
+#if defined(CONTROL_ONLY_DEVICE) || defined(ORDERED_EP_CONFIG)
Endpoint_SelectEndpoint(Number);
Endpoint_EnableEndpoint();
@@ -53,6 +54,38 @@ bool Endpoint_ConfigureEndpoint_Prv(const uint8_t Number,
USB_EndpointFIFOPos[Number] = &AVR32_USBB_SLAVE[Number * 0x10000];
return Endpoint_IsConfigured();
+#else
+ for (uint8_t EPNum = Number; EPNum < ENDPOINT_TOTAL_ENDPOINTS; EPNum++)
+ {
+ uint8_t UECFG0Temp;
+
+ Endpoint_SelectEndpoint(EPNum);
+
+ if (EPNum == Number)
+ {
+ UECFG0Temp = UECFG0Data;
+ }
+ else
+ {
+ UECFG0Temp = (&AVR32_USBB.uecfg0)[EPNum];
+ }
+
+ if (!(UECFG0Temp & AVR32_USBB_ALLOC_MASK))
+ continue;
+
+ Endpoint_DisableEndpoint();
+ (&AVR32_USBB.uecfg0)[EPNum] &= ~AVR32_USBB_ALLOC_MASK;
+
+ Endpoint_EnableEndpoint();
+ (&AVR32_USBB.uecfg0)[EPNum] = UECFG0Temp;
+
+ if (!(Endpoint_IsConfigured()))
+ return false;
+ }
+
+ Endpoint_SelectEndpoint(Number);
+ return true;
+#endif
}
void Endpoint_ClearEndpoints(void)