2.4.5.3 USB_DEVICE_AUDIO_V2_TransferCancel Function

C

USB_DEVICE_AUDIO_V2_RESULT USB_DEVICE_AUDIO_V2_TransferCancel(
    USB_DEVICE_AUDIO_V2_INDEX instanceIndex, 
    USB_DEVICE_AUDIO_V2_TRANSFER_HANDLE transferHandle
);

Summary

This function cancels a scheduled Audio v2.0 Device data transfer. The transfer could have been scheduled using the USB_DEVICE_AUDIO_V2_Read, USB_DEVICE_AUDIO_V2_Write, or the USB_DEVICE_AUDIO_V2_SerialStateNotificationSend function. 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 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
instanceIndex AUDIO v2.0 Function Driver instance index.
transferHandle Transfer handle of the transfer to be canceled.

Returns

  • USB_DEVICE_AUDIO_V2_RESULT_OK - The transfer will be canceled completely or partially.
  • USB_DEVICE_AUDIO_V2_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 an Audio transfer.

USB_DEVICE_AUDIO_V2_TRANSFER_HANDLE transferHandle;
USB_DEVICE_AUDIO_V2_RESULT result;

result = USB_DEVICE_AUDIO_V2_TransferCancel(instanceIndex, transferHandle);

if(USB_DEVICE_AUDIO_V2_RESULT_OK == result)
{
    // The transfer cancellation was either completely or
    // partially successful.
}

Remarks

None.