USB Libraries Help > USB Host Libraries > USB Audio v1.0 Host Client Driver Library > Library Interface > a) Audio Device Access Functions > USB_HOST_AUDIO_V1_0_ControlRequest Function
MPLAB Harmony USB Stack
USB_HOST_AUDIO_V1_0_ControlRequest Function

This function schedules an Audio v1.0 control transfer. The audioObj parameter is an object of the Audio v1.0 Class Driver to which the audio control transfer is to be scheduled. The setupPacket parameter points to the SETUP command to be sent in the setup state of the control transfer. The size and the direction of the data stage is indicated by the SETUP packet. For control transfers where there is no data stage, data is ignored and can be NULL. In all other instances, data should point to the data to data be transferred in the data stage of the control transfer. 

If the transfer was scheduled successfully, requestHandle will contain a transfer handle that uniquely identifies this transfer. If the transfer could not be scheduled successfully, requestHandle will contain USB_HOST_AUDIO_V1_0_REQUEST_HANDLE_INVALID

When the control transfer completes, the Audio v1.0 Client Driver will call the specified callback function. The context parameter specified here will be returned in the callback.

C
USB_HOST_AUDIO_V1_0_RESULT USB_HOST_AUDIO_V1_0_ControlRequest(
    USB_HOST_AUDIO_V1_0_OBJ OBJ, 
    USB_HOST_AUDIO_V1_0_REQUEST_HANDLE * transferHandle, 
    USB_SETUP_PACKET * setupPacket, 
    void * data, 
    USB_HOST_AUDIO_V1_0_CONTROL_CALLBACK callback, 
    uintptr_t context
);
Preconditions

The Audio v1.0 Device should be attached.

Parameters
Parameters 
Description 
audioObj 
Audio v1.0 client driver object 
requestHandle 
Output parameter that will contain the handle to this transfer 
setupPacket 
Pointer to the SETUP packet to sent to the device in the SETUP stage of the control transfer 
data 
For control transfer with a data stage, this should point to data to be sent to the device (for a control write transfer) or point to the buffer that will receive data from the device (for a control read transfer). For control transfers that do not require a data stage, this parameter is ignored and can be NULL. 
callback 
Pointer to the callback function that will be called when the control transfer completes. If the callback function is NULL, there will be no notification of when the control transfer will complete. 
context 
User-defined context that is returned with the callback function 
Returns
  • USB_HOST_AUDIO_V1_0_RESULT_SUCCESS - The transfer was scheduled successfully. requestHandle will contain a valid transfer handle.
  • USB_HOST_AUDIO_V1_0_RESULT_FAILURE - An unknown failure occurred. requestHandle will contain USB_HOST_AUDIO_V1_0_REQUEST_HANDLE_INVALID.
  • USB_HOST_AUDIO_V1_0_RESULT_PARAMETER_INVALID - The data pointer or requestHandle pointer is NULL
Remarks

None.