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:
parent
b62f1f6039
commit
8cd076af1e
1 changed files with 12 additions and 5 deletions
|
|
@ -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 ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue