Prevent the CDC Device Class driver from sending empty IN packets on every service task call - only send termination packets when data is in the endpoint.

pull/1469/head
Dean Camera 15 years ago
parent b221e7d175
commit e918d977b1

@ -1481,4 +1481,4 @@ DOT_CLEANUP = YES
# The SEARCHENGINE tag specifies whether or not a search engine should be
# used. If set to NO the values of all tags below this one will be ignored.
SEARCHENGINE = NO
SEARCHENGINE = YES

@ -143,11 +143,11 @@ uint8_t CDC_Device_SendByte(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo,
Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataINEndpointNumber);
if (!(Endpoint_IsReadWriteAllowed()))
{
uint8_t ErrorCode;
{
Endpoint_ClearIN();
uint8_t ErrorCode;
if ((ErrorCode = Endpoint_WaitUntilReady()) != ENDPOINT_READYWAIT_NoError)
return ErrorCode;
}
@ -161,20 +161,26 @@ uint8_t CDC_Device_Flush(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo)
if ((USB_DeviceState != DEVICE_STATE_Configured) || !(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS))
return ENDPOINT_READYWAIT_NoError;
uint8_t ErrorCode;
Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataINEndpointNumber);
if (!(Endpoint_BytesInEndpoint()))
return ENDPOINT_READYWAIT_NoError;
bool BankFull = !(Endpoint_IsReadWriteAllowed());
if (Endpoint_BytesInEndpoint())
Endpoint_ClearIN();
if (BankFull)
{
uint8_t ErrorCode;
Endpoint_ClearIN();
if ((ErrorCode = Endpoint_WaitUntilReady()) != ENDPOINT_READYWAIT_NoError)
return ErrorCode;
Endpoint_ClearIN();
}
Endpoint_ClearIN();
return Endpoint_WaitUntilReady();
return ENDPOINT_READYWAIT_NoError;
}
uint16_t CDC_Device_BytesReceived(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo)

@ -192,10 +192,8 @@
/** Flushes any data waiting to be sent, ensuring that the send buffer is cleared.
*
* \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state.
*
* \return A value from the \ref Endpoint_WaitUntilReady_ErrorCodes_t enum
*/
uint8_t CDC_Device_Flush(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
void CDC_Device_Flush(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
/** Sends a Serial Control Line State Change notification to the host. This should be called when the virtual serial
* control lines (DCD, DSR, etc.) have changed states, or to give BREAK notfications to the host. Line states persist

@ -181,7 +181,7 @@
/** Receives an asynchronous event block from the device via the asynchronous events pipe.
*
* \param[in,out] SIInterfaceInfo Pointer to a structure containing a Still Image Class host configuration and state
* \param[out] SI_PIMA_Container_t Pointer to a PIMA container structure where the event should be stored
* \param[out] PIMAHeader Pointer to a PIMA container structure where the event should be stored
*
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum, or \ref SI_ERROR_LOGICAL_CMD_FAILED if the device
* returned a logical command failure

Loading…
Cancel
Save