2.2.4.27 USB_DEVICE_EndpointTransferCancel Function
C
USB_DEVICE_RESULT USB_DEVICE_EndpointTransferCancel(
USB_DEVICE_HANDLE usbDeviceHandle,
USB_ENDPOINT_ADDRESS endpoint,
USB_DEVICE_TRANSFER_HANDLE transferHandle
);
Summary
This function cancels a transfer scheduled on an endpoint using the USB_DEVICE_EndpointRead and USB_DEVICE_EndpointWrite functions. If a transfer is still in the queue and its processing has not started, the transfer is canceled completely. A transfer that is in progress may or may not get canceled depending on the transaction that is presently in progress. If the last transaction of the transfer is in progress, the transfer will not be canceled. If it is not the last transaction in progress, the in progress transfer will be allowed to complete. Pending transactions will be canceled. The first transaction of an in progress transfer cannot be canceled.
Precondition
The USB Device should be in a configured state.
Parameters
Parameters | Description |
usbDeviceHandle | USB Device Layer Handle. |
endpoint | Endpoint of which the transfer needs to be canceled. |
transferHandle | Transfer handle of the transfer to be canceled. |
Returns
USB_DEVICE_RESULT_OK - The transfer will be canceled completely or partially.
USB_DEVICE_RESULT_ERROR - The transfer could not be canceled because it has either completed, the transfer handle is invalid or the last transaction is in progress.
Example
// The following code example cancels a transfer on endpoint 1, IN direction.
USB_DEVICE_TRANSFER_HANDLE transferHandle;
USB_DEVICE_RESULT result;
result = USB_DEVICE_EndpointTransferCancel(usbDeviceHandle,
(0x1|USB_EP_DIRECTION_IN), transferHandle);
if(USB_DEVICE_RESULT_OK == result)
{
// The transfer cancellation was either completely or
// partially successful.
}
Remarks
None.