3.7.4.1 USB_HOST_MSD_Transfer 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
);

Summary

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.

Precondition

None.

Parameters

Parameters Description
cdb pointer to the command to be executed. 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.