fx3: Check return value of CyU3PDmaChannelSetXfer()

We won't clear the EP halt (and possibly ACK) if this fails.

This addresses CID 1097393 ("Unchecked return value")
This commit is contained in:
Jon Szymaniak 2013-11-29 17:11:55 -05:00 • committed by Brian Padalino
commit 8cd076af1e

View file

@ -235,15 +235,22 @@ CyBool_t GetStatus(uint16_t endpoint) {
return isHandled;
}
void ClearDMAChannel(uint8_t ep, CyU3PDmaChannel * handle, uint32_t count, CyBool_t stall_only) {
void ClearDMAChannel(uint8_t ep, CyU3PDmaChannel * handle, uint32_t count,
CyBool_t stall_only) {
CyU3PReturnStatus_t status;
CyU3PDmaChannelReset (handle);
CyU3PUsbFlushEp(ep);
CyU3PUsbResetEp(ep);
CyU3PDmaChannelSetXfer (handle, count);
CyU3PUsbStall (ep, CyFalse, CyTrue);
status = CyU3PDmaChannelSetXfer (handle, count);
if(!stall_only) {
CyU3PUsbAckSetup ();
if (status == CY_U3P_SUCCESS) {
CyU3PUsbStall (ep, CyFalse, CyTrue);
if(!stall_only) {
CyU3PUsbAckSetup ();
}
}
}