Be doubly-certain that the incomming CDC class driver's endpoint/pipe is flushed only once when the bank is empty.

pull/1469/head
Dean Camera 15 years ago
parent cec699ac59
commit d26a9ed5fd

@ -190,10 +190,17 @@ uint16_t CDC_Device_BytesReceived(USB_ClassInfo_CDC_Device_t* const CDCInterface
Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataOUTEndpointNumber); Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataOUTEndpointNumber);
if (Endpoint_IsOUTReceived() && !(Endpoint_BytesInEndpoint())) if (Endpoint_IsOUTReceived())
Endpoint_ClearOUT(); {
if (!(Endpoint_BytesInEndpoint()))
Endpoint_ClearOUT();
return Endpoint_BytesInEndpoint(); return Endpoint_BytesInEndpoint();
}
else
{
return 0;
}
} }
uint8_t CDC_Device_ReceiveByte(USB_ClassInfo_CDC_Device_t* CDCInterfaceInfo) uint8_t CDC_Device_ReceiveByte(USB_ClassInfo_CDC_Device_t* CDCInterfaceInfo)

@ -309,13 +309,22 @@ uint16_t CDC_Host_BytesReceived(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo
Pipe_SetPipeToken(PIPE_TOKEN_IN); Pipe_SetPipeToken(PIPE_TOKEN_IN);
Pipe_Unfreeze(); Pipe_Unfreeze();
if (Pipe_IsINReceived() && !(Pipe_BytesInPipe())) if (Pipe_IsINReceived())
Pipe_ClearIN(); {
if (!(Pipe_BytesInPipe()))
BytesInPipe = Pipe_BytesInPipe(); Pipe_ClearIN();
Pipe_Freeze();
BytesInPipe = Pipe_BytesInPipe();
return BytesInPipe; Pipe_Freeze();
return BytesInPipe;
}
else
{
Pipe_Freeze();
return 0;
}
} }
uint8_t CDC_Host_ReceiveByte(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo) uint8_t CDC_Host_ReceiveByte(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo)

Loading…
Cancel
Save