X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/6a8e27f7ee43169b9f6eb928b12e00d6306618ff..2793c88fc601dcc7ec4961326dd9748a20f3ec83:/LUFA/Drivers/USB/LowLevel/Endpoint.c diff --git a/LUFA/Drivers/USB/LowLevel/Endpoint.c b/LUFA/Drivers/USB/LowLevel/Endpoint.c index f4f2bdc0b..d02071bbd 100644 --- a/LUFA/Drivers/USB/LowLevel/Endpoint.c +++ b/LUFA/Drivers/USB/LowLevel/Endpoint.c @@ -74,9 +74,11 @@ void Endpoint_ClearEndpoints(void) #if !defined(CONTROL_ONLY_DEVICE) uint8_t Endpoint_WaitUntilReady(void) { + #if (USB_STREAM_TIMEOUT_MS < 0xFF) + uint8_t TimeoutMSRem = USB_STREAM_TIMEOUT_MS; + #else uint16_t TimeoutMSRem = USB_STREAM_TIMEOUT_MS; - - USB_INT_Clear(USB_INT_SOFI); + #endif for (;;) { @@ -96,9 +98,9 @@ uint8_t Endpoint_WaitUntilReady(void) else if (Endpoint_IsStalled()) return ENDPOINT_READYWAIT_EndpointStalled; - if (USB_INT_HasOccurred(USB_INT_SOFI)) + if (FrameElapsed) { - USB_INT_Clear(USB_INT_SOFI); + FrameElapsed = false; if (!(TimeoutMSRem--)) return ENDPOINT_READYWAIT_Timeout; @@ -108,7 +110,7 @@ uint8_t Endpoint_WaitUntilReady(void) uint8_t Endpoint_Discard_Stream(uint16_t Length #if !defined(NO_STREAM_CALLBACKS) - , uint8_t (* const Callback)(void) + , StreamCallbackPtr_t Callback #endif ) { @@ -125,7 +127,7 @@ uint8_t Endpoint_Discard_Stream(uint16_t Length #if !defined(NO_STREAM_CALLBACKS) if ((Callback != NULL) && (Callback() == STREAMCALLBACK_Abort)) - return ENDPOINT_RWSTREAM_ERROR_CallbackAborted; + return ENDPOINT_RWSTREAM_CallbackAborted; #endif if ((ErrorCode = Endpoint_WaitUntilReady())) @@ -138,12 +140,12 @@ uint8_t Endpoint_Discard_Stream(uint16_t Length } } - return ENDPOINT_RWSTREAM_ERROR_NoError; + return ENDPOINT_RWSTREAM_NoError; } uint8_t Endpoint_Write_Stream_LE(const void* Buffer, uint16_t Length #if !defined(NO_STREAM_CALLBACKS) - , uint8_t (* const Callback)(void) + , StreamCallbackPtr_t Callback #endif ) { @@ -161,7 +163,7 @@ uint8_t Endpoint_Write_Stream_LE(const void* Buffer, uint16_t Length #if !defined(NO_STREAM_CALLBACKS) if ((Callback != NULL) && (Callback() == STREAMCALLBACK_Abort)) - return ENDPOINT_RWSTREAM_ERROR_CallbackAborted; + return ENDPOINT_RWSTREAM_CallbackAborted; #endif if ((ErrorCode = Endpoint_WaitUntilReady())) @@ -174,12 +176,12 @@ uint8_t Endpoint_Write_Stream_LE(const void* Buffer, uint16_t Length } } - return ENDPOINT_RWSTREAM_ERROR_NoError; + return ENDPOINT_RWSTREAM_NoError; } uint8_t Endpoint_Write_Stream_BE(const void* Buffer, uint16_t Length #if !defined(NO_STREAM_CALLBACKS) - , uint8_t (* const Callback)(void) + , StreamCallbackPtr_t Callback #endif ) { @@ -197,7 +199,7 @@ uint8_t Endpoint_Write_Stream_BE(const void* Buffer, uint16_t Length #if !defined(NO_STREAM_CALLBACKS) if ((Callback != NULL) && (Callback() == STREAMCALLBACK_Abort)) - return ENDPOINT_RWSTREAM_ERROR_CallbackAborted; + return ENDPOINT_RWSTREAM_CallbackAborted; #endif if ((ErrorCode = Endpoint_WaitUntilReady())) @@ -210,12 +212,12 @@ uint8_t Endpoint_Write_Stream_BE(const void* Buffer, uint16_t Length } } - return ENDPOINT_RWSTREAM_ERROR_NoError; + return ENDPOINT_RWSTREAM_NoError; } uint8_t Endpoint_Read_Stream_LE(void* Buffer, uint16_t Length #if !defined(NO_STREAM_CALLBACKS) - , uint8_t (* const Callback)(void) + , StreamCallbackPtr_t Callback #endif ) { @@ -233,7 +235,7 @@ uint8_t Endpoint_Read_Stream_LE(void* Buffer, uint16_t Length #if !defined(NO_STREAM_CALLBACKS) if ((Callback != NULL) && (Callback() == STREAMCALLBACK_Abort)) - return ENDPOINT_RWSTREAM_ERROR_CallbackAborted; + return ENDPOINT_RWSTREAM_CallbackAborted; #endif if ((ErrorCode = Endpoint_WaitUntilReady())) @@ -246,12 +248,12 @@ uint8_t Endpoint_Read_Stream_LE(void* Buffer, uint16_t Length } } - return ENDPOINT_RWSTREAM_ERROR_NoError; + return ENDPOINT_RWSTREAM_NoError; } uint8_t Endpoint_Read_Stream_BE(void* Buffer, uint16_t Length #if !defined(NO_STREAM_CALLBACKS) - , uint8_t (* const Callback)(void) + , StreamCallbackPtr_t Callback #endif ) { @@ -269,7 +271,7 @@ uint8_t Endpoint_Read_Stream_BE(void* Buffer, uint16_t Length #if !defined(NO_STREAM_CALLBACKS) if ((Callback != NULL) && (Callback() == STREAMCALLBACK_Abort)) - return ENDPOINT_RWSTREAM_ERROR_CallbackAborted; + return ENDPOINT_RWSTREAM_CallbackAborted; #endif if ((ErrorCode = Endpoint_WaitUntilReady())) @@ -282,7 +284,7 @@ uint8_t Endpoint_Read_Stream_BE(void* Buffer, uint16_t Length } } - return ENDPOINT_RWSTREAM_ERROR_NoError; + return ENDPOINT_RWSTREAM_NoError; } #endif @@ -309,7 +311,7 @@ uint8_t Endpoint_Write_Control_Stream_LE(const void* Buffer, uint16_t Length) } if (Endpoint_IsOUTReceived()) - return ENDPOINT_RWCSTREAM_ERROR_HostAborted; + return ENDPOINT_RWCSTREAM_HostAborted; if (LastPacketFull) { @@ -319,7 +321,7 @@ uint8_t Endpoint_Write_Control_Stream_LE(const void* Buffer, uint16_t Length) while (!(Endpoint_IsOUTReceived())); - return ENDPOINT_RWCSTREAM_ERROR_NoError; + return ENDPOINT_RWCSTREAM_NoError; } uint8_t Endpoint_Write_Control_Stream_BE(const void* Buffer, uint16_t Length) @@ -346,7 +348,7 @@ uint8_t Endpoint_Write_Control_Stream_BE(const void* Buffer, uint16_t Length) } if (Endpoint_IsOUTReceived()) - return ENDPOINT_RWCSTREAM_ERROR_HostAborted; + return ENDPOINT_RWCSTREAM_HostAborted; if (LastPacketFull) { @@ -356,7 +358,7 @@ uint8_t Endpoint_Write_Control_Stream_BE(const void* Buffer, uint16_t Length) while (!(Endpoint_IsOUTReceived())); - return ENDPOINT_RWCSTREAM_ERROR_NoError; + return ENDPOINT_RWCSTREAM_NoError; } uint8_t Endpoint_Read_Control_Stream_LE(void* Buffer, uint16_t Length) @@ -379,7 +381,7 @@ uint8_t Endpoint_Read_Control_Stream_LE(void* Buffer, uint16_t Length) while (!(Endpoint_IsINReady())); - return ENDPOINT_RWCSTREAM_ERROR_NoError; + return ENDPOINT_RWCSTREAM_NoError; } uint8_t Endpoint_Read_Control_Stream_BE(void* Buffer, uint16_t Length) @@ -402,7 +404,7 @@ uint8_t Endpoint_Read_Control_Stream_BE(void* Buffer, uint16_t Length) while (!(Endpoint_IsINReady())); - return ENDPOINT_RWCSTREAM_ERROR_NoError; + return ENDPOINT_RWCSTREAM_NoError; } #endif