aboutsummaryrefslogtreecommitdiffstats
path: root/LUFA/Drivers/USB/LowLevel/Endpoint.c
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2010-12-24 17:05:41 +0000
committerDean Camera <dean@fourwalledcubicle.com>2010-12-24 17:05:41 +0000
commitec537fd84d6ad3fd0dfa1b55efa2c2d554c1db48 (patch)
tree96ae5d0bfaaf096456f83504322dd0ac782793b9 /LUFA/Drivers/USB/LowLevel/Endpoint.c
parenta57287a59f51c53e888068be954f4d8a3f04f52a (diff)
downloadlufa-ec537fd84d6ad3fd0dfa1b55efa2c2d554c1db48.tar.gz
lufa-ec537fd84d6ad3fd0dfa1b55efa2c2d554c1db48.tar.bz2
lufa-ec537fd84d6ad3fd0dfa1b55efa2c2d554c1db48.zip
Re-add in old Endpoint/Pipe workaround for unordered pipes - add new ORDERED_EP_CONFIG compile time option to override the workaround and use the previous behaviour that imposes correct Endpoint/Pipe ordering but produces smaller compiled code.
Diffstat (limited to 'LUFA/Drivers/USB/LowLevel/Endpoint.c')
-rw-r--r--LUFA/Drivers/USB/LowLevel/Endpoint.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/LUFA/Drivers/USB/LowLevel/Endpoint.c b/LUFA/Drivers/USB/LowLevel/Endpoint.c
index a7b1e4b58..56c73fc48 100644
--- a/LUFA/Drivers/USB/LowLevel/Endpoint.c
+++ b/LUFA/Drivers/USB/LowLevel/Endpoint.c
@@ -43,6 +43,7 @@ bool Endpoint_ConfigureEndpoint_Prv(const uint8_t Number,
const uint8_t UECFG0XData,
const uint8_t UECFG1XData)
{
+#if defined(CONTROL_ONLY_DEVICE) || defined(ORDERED_EP_CONFIG)
Endpoint_SelectEndpoint(Number);
Endpoint_EnableEndpoint();
@@ -51,6 +52,51 @@ bool Endpoint_ConfigureEndpoint_Prv(const uint8_t Number,
UECFG1X = UECFG1XData;
return Endpoint_IsConfigured();
+#else
+ uint8_t UECFG0XTemp[ENDPOINT_TOTAL_ENDPOINTS];
+ uint8_t UECFG1XTemp[ENDPOINT_TOTAL_ENDPOINTS];
+ uint8_t UEIENXTemp[ENDPOINT_TOTAL_ENDPOINTS];
+
+ for (uint8_t EPNum = 0; EPNum < ENDPOINT_TOTAL_ENDPOINTS; EPNum++)
+ {
+ Endpoint_SelectEndpoint(EPNum);
+ UECFG0XTemp[EPNum] = UECFG0X;
+ UECFG1XTemp[EPNum] = UECFG1X;
+ UEIENXTemp[EPNum] = UEIENX;
+ }
+
+ UECFG0XTemp[Number] = UECFG0XData;
+ UECFG1XTemp[Number] = UECFG1XData;
+ UEIENXTemp[Number] = 0;
+
+ for (uint8_t EPNum = 1; EPNum < ENDPOINT_TOTAL_ENDPOINTS; EPNum++)
+ {
+ Endpoint_SelectEndpoint(EPNum);
+ UEIENX = 0;
+ UEINTX = 0;
+ UECFG1X = 0;
+ Endpoint_DisableEndpoint();
+ }
+
+ for (uint8_t EPNum = 0; EPNum < ENDPOINT_TOTAL_ENDPOINTS; EPNum++)
+ {
+ if (!(UECFG1XTemp[EPNum] & (1 << ALLOC)))
+ continue;
+
+ Endpoint_SelectEndpoint(EPNum);
+ Endpoint_EnableEndpoint();
+
+ UECFG0X = UECFG0XTemp[EPNum];
+ UECFG1X = UECFG1XTemp[EPNum];
+ UEIENX = UEIENXTemp[EPNum];
+
+ if (!(Endpoint_IsConfigured()))
+ return false;
+ }
+
+ Endpoint_SelectEndpoint(Number);
+ return true;
+#endif
}
void Endpoint_ClearEndpoints(void)