From 00ad5090614568f75b588d5fe3480f4d20d370b2 Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Mon, 31 Oct 2011 03:31:00 +0000 Subject: Add support for the Atmel XMEGA A3BU Xplained board. More XMEGA USB core fixes. --- LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.c | 12 ++++++++++-- LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.h | 6 +++--- 2 files changed, 13 insertions(+), 5 deletions(-) (limited to 'LUFA/Drivers/USB/Core/XMEGA') diff --git a/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.c b/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.c index 604427fca..ead993ebb 100644 --- a/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.c +++ b/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.c @@ -107,8 +107,16 @@ uint8_t Endpoint_WaitUntilReady(void) for (;;) { - if (Endpoint_IsOUTReceived()) - return ENDPOINT_READYWAIT_NoError; + if (Endpoint_GetEndpointDirection() == ENDPOINT_DIR_IN) + { + if (Endpoint_IsINReady()) + return ENDPOINT_READYWAIT_NoError; + } + else + { + if (Endpoint_IsOUTReceived()) + return ENDPOINT_READYWAIT_NoError; + } uint8_t USB_DeviceState_LCL = USB_DeviceState; diff --git a/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.h b/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.h index 2ba135619..62398762c 100644 --- a/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.h +++ b/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.h @@ -305,7 +305,7 @@ } if (Type == EP_TYPE_CONTROL) - Endpoint_ConfigureEndpoint_PRV(Number, Direction ^ ENDPOINT_DIR_IN, EPConfigMask, Size); + Endpoint_ConfigureEndpoint_PRV(Number, (Direction ^ ENDPOINT_DIR_IN), EPConfigMask, Size); return Endpoint_ConfigureEndpoint_PRV(Number, Direction, EPConfigMask, Size); } @@ -367,7 +367,7 @@ */ static inline void Endpoint_AbortPendingIN(void) { - // TODO + USB_Endpoint_SelectedHandle->STATUS |= USB_EP_BUSNACK0_bm; } /** Determines if the currently selected endpoint may be read from (if data is waiting in the endpoint @@ -581,7 +581,7 @@ static inline uint8_t Endpoint_GetEndpointDirection(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; static inline uint8_t Endpoint_GetEndpointDirection(void) { - return ((USB_Endpoint_SelectedEndpoint & ENDPOINT_DIR_IN) ? true : false); + return (USB_Endpoint_SelectedEndpoint & ENDPOINT_DIR_IN); } /** Sets the direction of the currently selected endpoint. -- cgit v1.2.3