projects
/
pub
/
lufa.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fixed GenericHIDHost demo report write routine incorrect for control type requests...
[pub/lufa.git]
/
LUFA
/
Drivers
/
USB
/
LowLevel
/
Endpoint.c
diff --git
a/LUFA/Drivers/USB/LowLevel/Endpoint.c
b/LUFA/Drivers/USB/LowLevel/Endpoint.c
index
aa18358
..
b885471
100644
(file)
--- a/
LUFA/Drivers/USB/LowLevel/Endpoint.c
+++ b/
LUFA/Drivers/USB/LowLevel/Endpoint.c
@@
-88,8
+88,19
@@
uint8_t Endpoint_WaitUntilReady(void)
\r
USB_INT_Clear(USB_INT_SOFI);
\r
\r
\r
USB_INT_Clear(USB_INT_SOFI);
\r
\r
-
while (!(Endpoint_ReadWriteAllowed())
)
\r
+
for (;;
)
\r
{
\r
{
\r
+ if (Endpoint_GetEndpointDirection() == ENDPOINT_DIR_IN)
\r
+ {
\r
+ if (Endpoint_IsINReady())
\r
+ return ENDPOINT_READYWAIT_NoError;
\r
+ }
\r
+ else
\r
+ {
\r
+ if (Endpoint_IsOUTReceived())
\r
+ return ENDPOINT_READYWAIT_NoError;
\r
+ }
\r
+
\r
if (!(USB_IsConnected))
\r
return ENDPOINT_READYWAIT_DeviceDisconnected;
\r
else if (Endpoint_IsStalled())
\r
if (!(USB_IsConnected))
\r
return ENDPOINT_READYWAIT_DeviceDisconnected;
\r
else if (Endpoint_IsStalled())
\r
@@
-103,8
+114,6
@@
uint8_t Endpoint_WaitUntilReady(void)
return ENDPOINT_READYWAIT_Timeout;
\r
}
\r
}
\r
return ENDPOINT_READYWAIT_Timeout;
\r
}
\r
}
\r
-
\r
- return ENDPOINT_READYWAIT_NoError;
\r
}
\r
\r
uint8_t Endpoint_Discard_Stream(uint16_t Length
\r
}
\r
\r
uint8_t Endpoint_Discard_Stream(uint16_t Length
\r
@@
-120,9
+129,9
@@
uint8_t Endpoint_Discard_Stream(uint16_t Length
\r
while (Length--)
\r
{
\r
\r
while (Length--)
\r
{
\r
- if (!(Endpoint_ReadWriteAllowed()))
\r
+ if (!(Endpoint_
Is
ReadWriteAllowed()))
\r
{
\r
{
\r
- Endpoint_Clear
CurrentBank
();
\r
+ Endpoint_Clear
OUT
();
\r
\r
#if !defined(NO_STREAM_CALLBACKS)
\r
if ((Callback != NULL) && (Callback() == STREAMCALLBACK_Abort))
\r
\r
#if !defined(NO_STREAM_CALLBACKS)
\r
if ((Callback != NULL) && (Callback() == STREAMCALLBACK_Abort))
\r
@@
-132,8
+141,10
@@
uint8_t Endpoint_Discard_Stream(uint16_t Length
if ((ErrorCode = Endpoint_WaitUntilReady()))
\r
return ErrorCode;
\r
}
\r
if ((ErrorCode = Endpoint_WaitUntilReady()))
\r
return ErrorCode;
\r
}
\r
-
\r
- Endpoint_Discard_Byte();
\r
+ else
\r
+ {
\r
+ Endpoint_Discard_Byte();
\r
+ }
\r
}
\r
\r
return ENDPOINT_RWSTREAM_ERROR_NoError;
\r
}
\r
\r
return ENDPOINT_RWSTREAM_ERROR_NoError;
\r
@@
-153,9
+164,9
@@
uint8_t Endpoint_Write_Stream_LE(const void* Buffer, uint16_t Length
\r
while (Length--)
\r
{
\r
\r
while (Length--)
\r
{
\r
- if (!(Endpoint_ReadWriteAllowed()))
\r
+ if (!(Endpoint_
Is
ReadWriteAllowed()))
\r
{
\r
{
\r
- Endpoint_Clear
CurrentBank
();
\r
+ Endpoint_Clear
IN
();
\r
\r
#if !defined(NO_STREAM_CALLBACKS)
\r
if ((Callback != NULL) && (Callback() == STREAMCALLBACK_Abort))
\r
\r
#if !defined(NO_STREAM_CALLBACKS)
\r
if ((Callback != NULL) && (Callback() == STREAMCALLBACK_Abort))
\r
@@
-165,8
+176,10
@@
uint8_t Endpoint_Write_Stream_LE(const void* Buffer, uint16_t Length
if ((ErrorCode = Endpoint_WaitUntilReady()))
\r
return ErrorCode;
\r
}
\r
if ((ErrorCode = Endpoint_WaitUntilReady()))
\r
return ErrorCode;
\r
}
\r
-
\r
- Endpoint_Write_Byte(*(DataStream++));
\r
+ else
\r
+ {
\r
+ Endpoint_Write_Byte(*(DataStream++));
\r
+ }
\r
}
\r
\r
return ENDPOINT_RWSTREAM_ERROR_NoError;
\r
}
\r
\r
return ENDPOINT_RWSTREAM_ERROR_NoError;
\r
@@
-186,9
+199,9
@@
uint8_t Endpoint_Write_Stream_BE(const void* Buffer, uint16_t Length
\r
while (Length--)
\r
{
\r
\r
while (Length--)
\r
{
\r
- if (!(Endpoint_ReadWriteAllowed()))
\r
+ if (!(Endpoint_
Is
ReadWriteAllowed()))
\r
{
\r
{
\r
- Endpoint_Clear
CurrentBank
();
\r
+ Endpoint_Clear
IN
();
\r
\r
#if !defined(NO_STREAM_CALLBACKS)
\r
if ((Callback != NULL) && (Callback() == STREAMCALLBACK_Abort))
\r
\r
#if !defined(NO_STREAM_CALLBACKS)
\r
if ((Callback != NULL) && (Callback() == STREAMCALLBACK_Abort))
\r
@@
-198,8
+211,10
@@
uint8_t Endpoint_Write_Stream_BE(const void* Buffer, uint16_t Length
if ((ErrorCode = Endpoint_WaitUntilReady()))
\r
return ErrorCode;
\r
}
\r
if ((ErrorCode = Endpoint_WaitUntilReady()))
\r
return ErrorCode;
\r
}
\r
-
\r
- Endpoint_Write_Byte(*(DataStream--));
\r
+ else
\r
+ {
\r
+ Endpoint_Write_Byte(*(DataStream--));
\r
+ }
\r
}
\r
\r
return ENDPOINT_RWSTREAM_ERROR_NoError;
\r
}
\r
\r
return ENDPOINT_RWSTREAM_ERROR_NoError;
\r
@@
-219,9
+234,9
@@
uint8_t Endpoint_Read_Stream_LE(void* Buffer, uint16_t Length
\r
while (Length--)
\r
{
\r
\r
while (Length--)
\r
{
\r
- if (!(Endpoint_ReadWriteAllowed()))
\r
+ if (!(Endpoint_
Is
ReadWriteAllowed()))
\r
{
\r
{
\r
- Endpoint_Clear
CurrentBank
();
\r
+ Endpoint_Clear
OUT
();
\r
\r
#if !defined(NO_STREAM_CALLBACKS)
\r
if ((Callback != NULL) && (Callback() == STREAMCALLBACK_Abort))
\r
\r
#if !defined(NO_STREAM_CALLBACKS)
\r
if ((Callback != NULL) && (Callback() == STREAMCALLBACK_Abort))
\r
@@
-231,8
+246,10
@@
uint8_t Endpoint_Read_Stream_LE(void* Buffer, uint16_t Length
if ((ErrorCode = Endpoint_WaitUntilReady()))
\r
return ErrorCode;
\r
}
\r
if ((ErrorCode = Endpoint_WaitUntilReady()))
\r
return ErrorCode;
\r
}
\r
-
\r
- *(DataStream++) = Endpoint_Read_Byte();
\r
+ else
\r
+ {
\r
+ *(DataStream++) = Endpoint_Read_Byte();
\r
+ }
\r
}
\r
\r
return ENDPOINT_RWSTREAM_ERROR_NoError;
\r
}
\r
\r
return ENDPOINT_RWSTREAM_ERROR_NoError;
\r
@@
-252,9
+269,9
@@
uint8_t Endpoint_Read_Stream_BE(void* Buffer, uint16_t Length
\r
while (Length--)
\r
{
\r
\r
while (Length--)
\r
{
\r
- if (!(Endpoint_ReadWriteAllowed()))
\r
+ if (!(Endpoint_
Is
ReadWriteAllowed()))
\r
{
\r
{
\r
- Endpoint_Clear
CurrentBank
();
\r
+ Endpoint_Clear
OUT
();
\r
\r
#if !defined(NO_STREAM_CALLBACKS)
\r
if ((Callback != NULL) && (Callback() == STREAMCALLBACK_Abort))
\r
\r
#if !defined(NO_STREAM_CALLBACKS)
\r
if ((Callback != NULL) && (Callback() == STREAMCALLBACK_Abort))
\r
@@
-264,8
+281,10
@@
uint8_t Endpoint_Read_Stream_BE(void* Buffer, uint16_t Length
if ((ErrorCode = Endpoint_WaitUntilReady()))
\r
return ErrorCode;
\r
}
\r
if ((ErrorCode = Endpoint_WaitUntilReady()))
\r
return ErrorCode;
\r
}
\r
-
\r
- *(DataStream--) = Endpoint_Read_Byte();
\r
+ else
\r
+ {
\r
+ *(DataStream--) = Endpoint_Read_Byte();
\r
+ }
\r
}
\r
\r
return ENDPOINT_RWSTREAM_ERROR_NoError;
\r
}
\r
\r
return ENDPOINT_RWSTREAM_ERROR_NoError;
\r
@@
-276,9
+295,9
@@
uint8_t Endpoint_Write_Control_Stream_LE(const void* Buffer, uint16_t Length)
uint8_t* DataStream = (uint8_t*)Buffer;
\r
bool SendZLP = true;
\r
\r
uint8_t* DataStream = (uint8_t*)Buffer;
\r
bool SendZLP = true;
\r
\r
- while (Length && !(Endpoint_Is
Setup
OUTReceived()))
\r
+ while (Length && !(Endpoint_IsOUTReceived()))
\r
{
\r
{
\r
- while (!(Endpoint_Is
Setup
INReady()));
\r
+ while (!(Endpoint_IsINReady()));
\r
\r
while (Length && (Endpoint_BytesInEndpoint() < USB_ControlEndpointSize))
\r
{
\r
\r
while (Length && (Endpoint_BytesInEndpoint() < USB_ControlEndpointSize))
\r
{
\r
@@
-288,19
+307,19
@@
uint8_t Endpoint_Write_Control_Stream_LE(const void* Buffer, uint16_t Length)
}
\r
\r
SendZLP = (Endpoint_BytesInEndpoint() == USB_ControlEndpointSize);
\r
}
\r
\r
SendZLP = (Endpoint_BytesInEndpoint() == USB_ControlEndpointSize);
\r
- Endpoint_Clear
Setup
IN();
\r
+ Endpoint_Clear
Control
IN();
\r
}
\r
\r
}
\r
\r
- if (Endpoint_Is
Setup
OUTReceived())
\r
+ if (Endpoint_IsOUTReceived())
\r
return ENDPOINT_RWCSTREAM_ERROR_HostAborted;
\r
\r
if (SendZLP)
\r
{
\r
return ENDPOINT_RWCSTREAM_ERROR_HostAborted;
\r
\r
if (SendZLP)
\r
{
\r
- while (!(Endpoint_Is
Setup
INReady()));
\r
- Endpoint_Clear
Setup
IN();
\r
+ while (!(Endpoint_IsINReady()));
\r
+ Endpoint_Clear
Control
IN();
\r
}
\r
\r
}
\r
\r
- while (!(Endpoint_Is
Setup
OUTReceived()));
\r
+ while (!(Endpoint_IsOUTReceived()));
\r
\r
return ENDPOINT_RWCSTREAM_ERROR_NoError;
\r
}
\r
\r
return ENDPOINT_RWCSTREAM_ERROR_NoError;
\r
}
\r
@@
-310,9
+329,9
@@
uint8_t Endpoint_Write_Control_Stream_BE(const void* Buffer, uint16_t Length)
uint8_t* DataStream = (uint8_t*)(Buffer + Length - 1);
\r
bool SendZLP = true;
\r
\r
uint8_t* DataStream = (uint8_t*)(Buffer + Length - 1);
\r
bool SendZLP = true;
\r
\r
- while (Length && !(Endpoint_Is
Setup
OUTReceived()))
\r
+ while (Length && !(Endpoint_IsOUTReceived()))
\r
{
\r
{
\r
- while (!(Endpoint_Is
Setup
INReady()));
\r
+ while (!(Endpoint_IsINReady()));
\r
\r
while (Length && (Endpoint_BytesInEndpoint() < USB_ControlEndpointSize))
\r
{
\r
\r
while (Length && (Endpoint_BytesInEndpoint() < USB_ControlEndpointSize))
\r
{
\r
@@
-322,19
+341,19
@@
uint8_t Endpoint_Write_Control_Stream_BE(const void* Buffer, uint16_t Length)
}
\r
\r
SendZLP = (Endpoint_BytesInEndpoint() == USB_ControlEndpointSize);
\r
}
\r
\r
SendZLP = (Endpoint_BytesInEndpoint() == USB_ControlEndpointSize);
\r
- Endpoint_Clear
Setup
IN();
\r
+ Endpoint_Clear
Control
IN();
\r
}
\r
\r
}
\r
\r
- if (Endpoint_Is
Setup
OUTReceived())
\r
+ if (Endpoint_IsOUTReceived())
\r
return ENDPOINT_RWCSTREAM_ERROR_HostAborted;
\r
\r
if (SendZLP)
\r
{
\r
return ENDPOINT_RWCSTREAM_ERROR_HostAborted;
\r
\r
if (SendZLP)
\r
{
\r
- while (!(Endpoint_Is
Setup
INReady()));
\r
- Endpoint_Clear
Setup
IN();
\r
+ while (!(Endpoint_IsINReady()));
\r
+ Endpoint_Clear
Control
IN();
\r
}
\r
\r
}
\r
\r
- while (!(Endpoint_Is
Setup
OUTReceived()));
\r
+ while (!(Endpoint_IsOUTReceived()));
\r
\r
return ENDPOINT_RWCSTREAM_ERROR_NoError;
\r
}
\r
\r
return ENDPOINT_RWCSTREAM_ERROR_NoError;
\r
}
\r
@@
-345,7
+364,7
@@
uint8_t Endpoint_Read_Control_Stream_LE(void* Buffer, uint16_t Length)
\r
while (Length)
\r
{
\r
\r
while (Length)
\r
{
\r
- while (!(Endpoint_Is
Setup
OUTReceived()));
\r
+ while (!(Endpoint_IsOUTReceived()));
\r
\r
while (Length && Endpoint_BytesInEndpoint())
\r
{
\r
\r
while (Length && Endpoint_BytesInEndpoint())
\r
{
\r
@@
-354,10
+373,10
@@
uint8_t Endpoint_Read_Control_Stream_LE(void* Buffer, uint16_t Length)
Length--;
\r
}
\r
\r
Length--;
\r
}
\r
\r
- Endpoint_Clear
Setup
OUT();
\r
+ Endpoint_Clear
Control
OUT();
\r
}
\r
\r
}
\r
\r
- while (!(Endpoint_Is
Setup
INReady()));
\r
+ while (!(Endpoint_IsINReady()));
\r
\r
return ENDPOINT_RWCSTREAM_ERROR_NoError;
\r
}
\r
\r
return ENDPOINT_RWCSTREAM_ERROR_NoError;
\r
}
\r
@@
-368,7
+387,7
@@
uint8_t Endpoint_Read_Control_Stream_BE(void* Buffer, uint16_t Length)
\r
while (Length)
\r
{
\r
\r
while (Length)
\r
{
\r
- while (!(Endpoint_Is
Setup
OUTReceived()));
\r
+ while (!(Endpoint_IsOUTReceived()));
\r
\r
while (Length && Endpoint_BytesInEndpoint())
\r
{
\r
\r
while (Length && Endpoint_BytesInEndpoint())
\r
{
\r
@@
-377,10
+396,10
@@
uint8_t Endpoint_Read_Control_Stream_BE(void* Buffer, uint16_t Length)
Length--;
\r
}
\r
\r
Length--;
\r
}
\r
\r
- Endpoint_Clear
Setup
OUT();
\r
+ Endpoint_Clear
Control
OUT();
\r
}
\r
\r
}
\r
\r
- while (!(Endpoint_Is
Setup
INReady()));
\r
+ while (!(Endpoint_IsINReady()));
\r
\r
return ENDPOINT_RWCSTREAM_ERROR_NoError;
\r
}
\r
\r
return ENDPOINT_RWCSTREAM_ERROR_NoError;
\r
}
\r