USB Libraries Help > USB Host Libraries > USB MSD Host Client Driver Library > Library Interface > a) Data Transfer Functions > USB_HOST_MSD_Transfer Function
MPLAB Harmony USB Stack
USB_HOST_MSD_Transfer Function

This function schedules a MSD BOT transfer. The command to be executed is specified in the cdb. This should be pointer to a 16 byte command descriptor block. The actual length of the command is specified by cdbLength. If there is data to be transferred, the pointer to the buffer is specified by data. The size of the buffer is specified in size. When the transfer completes, the callback function will be called. The context will be returned in the callback function.

C
USB_HOST_MSD_RESULT USB_HOST_MSD_Transfer(
    USB_HOST_MSD_LUN_HANDLE lunHandle, 
    uint8_t * cdb, 
    uint8_t cdbLength, 
    void * data, 
    size_t size, 
    USB_HOST_MSD_TRANSFER_DIRECTION transferDirection, 
    USB_HOST_MSD_TRANSFER_CALLBACK callback, 
    uintptr_t context
);
Preconditions

None.

Parameters
Parameters 
Description 
cdb 
pointer to the command to be executted. Should be a pointer to a 16 byte array. Unused bytes should be zero-padded.
 
cdbLength 
Actual size of the command.
 
data 
pointer to the data buffer if a data stage is involved.
 
size 
size of the data buffer.
 
callback 
callback function to called when the transfer has completed.
 
transferDirection 
specifies the direction of the MSD transfer.
 
context 
caller defined context that is returned in the callback function. 
Returns

USB_HOST_MSD_RESULT_FAILURE - An unknown failure occurred. USB_HOST_MSD_RESULT_BUSY - The transfer cannot be scheduled right now. The caller should retry. USB_HOST_MSD_RESULT_LUN_HANDLE_INVALID - This LUN does not exist in the system. USB_HOST_MSD_RESULT_SUCCESS - The transfer request was scheduled.

Remarks

This is a local function and should not be called directly by the application.