NetBurner 3.5.7
PDF Version
Usb_host_msc_drv

Classes

struct  _usb_host_cbw
 MSC Bulk-Only command block wrapper (CBW) More...
 
struct  _usb_host_csw
 MSC Bulk-Only command status wrapper (CSW) More...
 
struct  _usb_host_msd_command
 MSC UFI command information structure. More...
 
struct  _usb_host_msd_instance
 MSD instance structure, MSD usb_host_class_handle pointer to this structure. More...
 
struct  _usb_host_ufi_sense_data
 UFI standard sense data structure. More...
 
struct  _usb_host_ufi_inquiry_data
 UFI standard inquiry data structure. More...
 
struct  _usb_host_ufi_read_capacity
 UFI read capacity data structure. More...
 

Macros

#define USB_HOST_MSD_RETRY_MAX_TIME   (1U)
 retry time when transfer fail, when all the retries fail the transfer callback with error status
 
#define USB_HOST_MSD_BLOCK_SIZE   (512U)
 mass storage block size
 
#define USB_HOST_MSD_CLASS_CODE   (8U)
 MSD class code.
 
#define USB_HOST_MSD_SUBCLASS_CODE_UFI   (4U)
 MSD sub-class code.
 
#define USB_HOST_MSD_SUBCLASS_CODE_SCSI   (6U)
 MSD sub-class code.
 
#define USB_HOST_MSD_PROTOCOL_BULK   (0x50U)
 MSD protocol code.
 
#define USB_HOST_HID_MASS_STORAGE_RESET   (0xFFU)
 MSD class-specific request (mass storage reset)
 
#define USB_HOST_HID_GET_MAX_LUN   (0xFEU)
 MSD class-specific request (get maximum logical unit number)
 

Typedefs

typedef enum _usb_host_msd_command_status usb_host_msd_command_status_t
 UFI command process status.
 
typedef struct _usb_host_cbw usb_host_cbw_t
 MSC Bulk-Only command block wrapper (CBW)
 
typedef struct _usb_host_csw usb_host_csw_t
 MSC Bulk-Only command status wrapper (CSW)
 
typedef struct _usb_host_msd_command usb_host_msd_command_t
 MSC UFI command information structure.
 
typedef struct _usb_host_msd_instance usb_host_msd_instance_t
 MSD instance structure, MSD usb_host_class_handle pointer to this structure.
 
typedef struct _usb_host_ufi_sense_data usb_host_ufi_sense_data_t
 UFI standard sense data structure.
 
typedef struct _usb_host_ufi_inquiry_data usb_host_ufi_inquiry_data_t
 UFI standard inquiry data structure.
 
typedef struct _usb_host_ufi_read_capacity usb_host_ufi_read_capacity_t
 UFI read capacity data structure.
 

Enumerations

enum  _usb_host_msd_command_status
 UFI command process status.
 

USB host MSD class APIs

usb_status_t USB_HostMsdInit (usb_device_handle deviceHandle, usb_host_class_handle *classHandle)
 Initializes the MSD instance.
 
usb_status_t USB_HostMsdSetInterface (usb_host_class_handle classHandle, usb_host_interface_handle interfaceHandle, uint8_t alternateSetting, transfer_callback_t callbackFn, void *callbackParam)
 Sets the interface.
 
usb_status_t USB_HostMsdDeinit (usb_device_handle deviceHandle, usb_host_class_handle classHandle)
 Deinitializes the MSD instance.
 
usb_status_t USB_HostMsdMassStorageReset (usb_host_class_handle classHandle, transfer_callback_t callbackFn, void *callbackParam)
 Mass storage reset.
 
usb_status_t USB_HostMsdGetMaxLun (usb_host_class_handle classHandle, uint8_t *logicalUnitNumber, transfer_callback_t callbackFn, void *callbackParam)
 Gets the maximum logical unit number.
 
usb_status_t USB_HostMsdRead10 (usb_host_class_handle classHandle, uint8_t logicalUnit, uint32_t blockAddress, uint8_t *buffer, uint32_t bufferLength, uint32_t blockNumber, transfer_callback_t callbackFn, void *callbackParam)
 Mass storage read (10).
 
usb_status_t USB_HostMsdRead12 (usb_host_class_handle classHandle, uint8_t logicalUnit, uint32_t blockAddress, uint8_t *buffer, uint32_t bufferLength, uint32_t blockNumber, transfer_callback_t callbackFn, void *callbackParam)
 Mass storage read (12).
 
usb_status_t USB_HostMsdWrite10 (usb_host_class_handle classHandle, uint8_t logicalUnit, uint32_t blockAddress, uint8_t *buffer, uint32_t bufferLength, uint32_t blockNumber, transfer_callback_t callbackFn, void *callbackParam)
 Mass storage write (10).
 
usb_status_t USB_HostMsdWrite12 (usb_host_class_handle classHandle, uint8_t logicalUnit, uint32_t blockAddress, uint8_t *buffer, uint32_t bufferLength, uint32_t blockNumber, transfer_callback_t callbackFn, void *callbackParam)
 Mass storage write (12).
 
usb_status_t USB_HostMsdReadCapacity (usb_host_class_handle classHandle, uint8_t logicalUnit, uint8_t *buffer, uint32_t bufferLength, transfer_callback_t callbackFn, void *callbackParam)
 Mass storage read capacity.
 
usb_status_t USB_HostMsdTestUnitReady (usb_host_class_handle classHandle, uint8_t logicalUnit, transfer_callback_t callbackFn, void *callbackParam)
 Mass storage test unit ready.
 
usb_status_t USB_HostMsdRequestSense (usb_host_class_handle classHandle, uint8_t logicalUnit, uint8_t *buffer, uint32_t bufferLength, transfer_callback_t callbackFn, void *callbackParam)
 mass storage request sense.
 
usb_status_t USB_HostMsdModeSelect (usb_host_class_handle classHandle, uint8_t logicalUnit, uint8_t *buffer, uint32_t bufferLength, transfer_callback_t callbackFn, void *callbackParam)
 Mass storage mode select.
 
usb_status_t USB_HostMsdModeSense (usb_host_class_handle classHandle, uint8_t logicalUnit, uint8_t pageControl, uint8_t pageCode, uint8_t *buffer, uint32_t bufferLength, transfer_callback_t callbackFn, void *callbackParam)
 Mass storage mode sense.
 
usb_status_t USB_HostMsdInquiry (usb_host_class_handle classHandle, uint8_t logicalUnit, uint8_t *buffer, uint32_t bufferLength, transfer_callback_t callbackFn, void *callbackParam)
 Mass storage inquiry.
 
usb_status_t USB_HostMsdReadFormatCapacities (usb_host_class_handle classHandle, uint8_t logicalUnit, uint8_t *buffer, uint32_t bufferLength, transfer_callback_t callbackFn, void *callbackParam)
 Mass storage read format capacities.
 
usb_status_t USB_HostMsdFormatUnit (usb_host_class_handle classHandle, uint8_t logicalUnit, uint8_t trackNumber, uint16_t interLeave, uint8_t *buffer, uint32_t bufferLength, transfer_callback_t callbackFn, void *callbackParam)
 Mass storage format unit.
 
usb_status_t USB_HostMsdPreventAllowRemoval (usb_host_class_handle classHandle, uint8_t logicalUnit, uint8_t prevent, transfer_callback_t callbackFn, void *callbackParam)
 Mass storage prevents/allows a medium removal.
 
usb_status_t USB_HostMsdWriteAndVerify (usb_host_class_handle classHandle, uint8_t logicalUnit, uint32_t blockAddress, uint8_t *buffer, uint32_t bufferLength, uint32_t blockNumber, transfer_callback_t callbackFn, void *callbackParam)
 Mass storage write and verify.
 
usb_status_t USB_HostMsdStartStopUnit (usb_host_class_handle classHandle, uint8_t logicalUnit, uint8_t loadEject, uint8_t start, transfer_callback_t callbackFn, void *callbackParam)
 Mass storage start stop unit.
 
usb_status_t USB_HostMsdVerify (usb_host_class_handle classHandle, uint8_t logicalUnit, uint32_t blockAddress, uint16_t verificationLength, transfer_callback_t callbackFn, void *callbackParam)
 Mass storage verify.
 
usb_status_t USB_HostMsdRezeroUnit (usb_host_class_handle classHandle, uint8_t logicalUnit, transfer_callback_t callbackFn, void *callbackParam)
 Mass storage rezero.
 
usb_status_t USB_HostMsdSeek10 (usb_host_class_handle classHandle, uint8_t logicalUnit, uint32_t blockAddress, transfer_callback_t callbackFn, void *callbackParam)
 Mass storage seek(10).
 
usb_status_t USB_HostMsdSendDiagnostic (usb_host_class_handle classHandle, uint8_t logicalUnit, uint8_t selfTest, transfer_callback_t callbackFn, void *callbackParam)
 Mass storage send diagnostic.
 
usb_status_t USB_HostMsdCommand (usb_host_class_handle classHandle, uint8_t *buffer, uint32_t bufferLength, transfer_callback_t callbackFn, void *callbackParam, uint8_t direction, uint8_t byteValues[10])
 all ufi function calls this api.
 

Detailed Description

Function Documentation

◆ USB_HostMsdCommand()

usb_status_t USB_HostMsdCommand ( usb_host_class_handle classHandle,
uint8_t * buffer,
uint32_t bufferLength,
transfer_callback_t callbackFn,
void * callbackParam,
uint8_t direction,
uint8_t byteValues[10] )

#include <usb_host_msd.h>

all ufi function calls this api.

This function implements the common ufi commands.

Parameters
classHandlethe class msd handle.
bufferbuffer pointer.
bufferLengthbuffer length.
callbackFncallback function.
callbackParamcallback parameter.
directioncommand direction.
byteValuesufi command fields value.
Returns
An error code or kStatus_USB_Success.

◆ USB_HostMsdDeinit()

usb_status_t USB_HostMsdDeinit ( usb_device_handle deviceHandle,
usb_host_class_handle classHandle )
extern

#include <usb_host_msd.h>

Deinitializes the MSD instance.

This function frees the resource for the MSD instance.

Parameters
[in]deviceHandleThe device handle.
[in]classHandleThe class handle.
Return values
kStatus_USB_SuccessThe device is de-initialized successfully.

◆ USB_HostMsdFormatUnit()

usb_status_t USB_HostMsdFormatUnit ( usb_host_class_handle classHandle,
uint8_t logicalUnit,
uint8_t trackNumber,
uint16_t interLeave,
uint8_t * buffer,
uint32_t bufferLength,
transfer_callback_t callbackFn,
void * callbackParam )
extern

#include <usb_host_msd.h>

Mass storage format unit.

This function implements the UFI FORMAT UNIT command and the host sends this command to physically format one track of a diskette according to the selected options.

Parameters
[in]classHandleThe class MSD handle.
[in]logicalUnitLogical unit number.
[in]trackNumberThis specifies which track is to be formatted.
[in]interLeaveThis specifies the interleave that shall be used for formatting.
[in]bufferBuffer pointer.
[in]bufferLengthThe buffer length.
[in]callbackFnThis callback is called after this command completes.
[in]callbackParamThe first parameter in the callback function.
Return values
kStatus_USB_SuccessThe device is initialized successfully.
kStatus_USB_InvalidHandleThe classHandle is NULL pointer.
kStatus_USB_BusyThe previous command is executing or there is no idle transfer.
kStatus_USB_ErrorSend transfer fail. See the USB_HostSend/USB_HostRecv.
kStatus_USB_SuccessCallback return status, the command succeed.
kStatus_USB_MSDStatusFailCallback return status, the CSW status indicate this command fail.
kStatus_USB_ErrorCallback return status, the command fail.

◆ USB_HostMsdGetMaxLun()

usb_status_t USB_HostMsdGetMaxLun ( usb_host_class_handle classHandle,
uint8_t * logicalUnitNumber,
transfer_callback_t callbackFn,
void * callbackParam )
extern

#include <usb_host_msd.h>

Gets the maximum logical unit number.

This function implements the get maximum LUN request.

Parameters
[in]classHandleThe class handle.
[out]logicalUnitNumberReturn logical unit number value.
[in]callbackFnThis callback is called after this function completes.
[in]callbackParamThe first parameter in the callback function.
Return values
kStatus_USB_SuccessThe device is initialized successfully.
kStatus_USB_InvalidHandleThe classHandle is NULL pointer.
kStatus_USB_BusyThere is no idle transfer.
kStatus_USB_ErrorSend transfer fail. See the USB_HostSendSetup.
kStatus_USB_SuccessCallback return status, the command succeed.
kStatus_USB_MSDStatusFailCallback return status, the CSW status indicate this command fail.
kStatus_USB_ErrorCallback return status, the command fail.

◆ USB_HostMsdInit()

usb_status_t USB_HostMsdInit ( usb_device_handle deviceHandle,
usb_host_class_handle * classHandle )
extern

#include <usb_host_msd.h>

Initializes the MSD instance.

This function allocates the resources for the MSD instance.

Parameters
[in]deviceHandleThe device handle.
[out]classHandleReturn class handle.
Return values
kStatus_USB_SuccessThe device is initialized successfully.
kStatus_USB_AllocFailAllocate memory fail.

◆ USB_HostMsdInquiry()

usb_status_t USB_HostMsdInquiry ( usb_host_class_handle classHandle,
uint8_t logicalUnit,
uint8_t * buffer,
uint32_t bufferLength,
transfer_callback_t callbackFn,
void * callbackParam )
extern

#include <usb_host_msd.h>

Mass storage inquiry.

This function implements the UFI INQUIRY command and requests that information regarding parameters of the UFI device itself be sent to the host.

Parameters
[in]classHandleThe class MSD handle.
[in]logicalUnitLogical unit number.
[out]bufferBuffer pointer.
[in]bufferLengthThe buffer length.
[in]callbackFnThis callback is called after this command completes.
[in]callbackParamThe first parameter in the callback function.
Return values
kStatus_USB_SuccessThe device is initialized successfully.
kStatus_USB_InvalidHandleThe classHandle is NULL pointer.
kStatus_USB_BusyThe previous command is executing or there is no idle transfer.
kStatus_USB_ErrorSend transfer fail. See the USB_HostSend/USB_HostRecv.
kStatus_USB_SuccessCallback return status, the command succeed.
kStatus_USB_MSDStatusFailCallback return status, the CSW status indicate this command fail.
kStatus_USB_ErrorCallback return status, the command fail.

◆ USB_HostMsdMassStorageReset()

usb_status_t USB_HostMsdMassStorageReset ( usb_host_class_handle classHandle,
transfer_callback_t callbackFn,
void * callbackParam )
extern

#include <usb_host_msd.h>

Mass storage reset.

This function implements the mass storage reset request.

Parameters
[in]classHandleThe class handle.
[in]callbackFnThis callback is called after this function completes.
[in]callbackParamThe first parameter in the callback function.
Return values
kStatus_USB_SuccessThe device is initialized successfully.
kStatus_USB_InvalidHandleThe classHandle is NULL pointer.
kStatus_USB_BusyThere is no idle transfer.
kStatus_USB_ErrorSend transfer fail. See the USB_HostSendSetup.

◆ USB_HostMsdModeSelect()

usb_status_t USB_HostMsdModeSelect ( usb_host_class_handle classHandle,
uint8_t logicalUnit,
uint8_t * buffer,
uint32_t bufferLength,
transfer_callback_t callbackFn,
void * callbackParam )
extern

#include <usb_host_msd.h>

Mass storage mode select.

This function implements the UFI MODE SELECT command and allows the host to specify medium or device parameters to the UFI device.

Parameters
[in]classHandleThe class MSD handle.
[in]logicalUnitLogical unit number.
[in]bufferBuffer pointer.
[in]bufferLengthThe buffer length.
[in]callbackFnThis callback is called after this command completes.
[in]callbackParamThe first parameter in the callback function.
Return values
kStatus_USB_SuccessThe device is initialized successfully.
kStatus_USB_InvalidHandleThe classHandle is NULL pointer.
kStatus_USB_BusyThe previous command is executing or there is no idle transfer.
kStatus_USB_ErrorSend transfer fail. See the USB_HostSend/USB_HostRecv.
kStatus_USB_SuccessCallback return status, the command succeed.
kStatus_USB_MSDStatusFailCallback return status, the CSW status indicate this command fail.
kStatus_USB_ErrorCallback return status, the command fail.

◆ USB_HostMsdModeSense()

usb_status_t USB_HostMsdModeSense ( usb_host_class_handle classHandle,
uint8_t logicalUnit,
uint8_t pageControl,
uint8_t pageCode,
uint8_t * buffer,
uint32_t bufferLength,
transfer_callback_t callbackFn,
void * callbackParam )
extern

#include <usb_host_msd.h>

Mass storage mode sense.

This function implements the UFI MODE SENSE command and allows the UFI device to report medium or device parameters to the host.

Parameters
[in]classHandleThe class MSD handle.
[in]logicalUnitLogical unit number.
[in]pageControlThe page control field specifies the type of mode parameters to return.
[in]pageCodeBuffer pointer.
[out]bufferBuffer pointer.
[in]bufferLengthThe buffer length.
[in]callbackFnThis callback is called after this command completes.
[in]callbackParamThe first parameter in the callback function.
Return values
kStatus_USB_SuccessThe device is initialized successfully.
kStatus_USB_InvalidHandleThe classHandle is NULL pointer.
kStatus_USB_BusyThe previous command is executing or there is no idle transfer.
kStatus_USB_ErrorSend transfer fail. See the USB_HostSend/USB_HostRecv.
kStatus_USB_SuccessCallback return status, the command succeed.
kStatus_USB_MSDStatusFailCallback return status, the CSW status indicate this command fail.
kStatus_USB_ErrorCallback return status, the command fail.

◆ USB_HostMsdPreventAllowRemoval()

usb_status_t USB_HostMsdPreventAllowRemoval ( usb_host_class_handle classHandle,
uint8_t logicalUnit,
uint8_t prevent,
transfer_callback_t callbackFn,
void * callbackParam )
extern

#include <usb_host_msd.h>

Mass storage prevents/allows a medium removal.

This function implements the UFI PREVENT-ALLOW MEDIUM REMOVAL command and notifies the FUI device to enable or disable the removal of the medium in the logical unit.

Parameters
[in]classHandleThe class MSD handle.
[in]logicalUnitLogical unit number.
[in]preventPrevent or allow
  • 0: enable (allow) the removal of the medium
  • 1: disable (prevent) removal of the medium
[in]callbackFnThis callback is called after this command completes.
[in]callbackParamThe first parameter in the callback function.
Return values
kStatus_USB_SuccessThe device is initialized successfully.
kStatus_USB_InvalidHandleThe classHandle is NULL pointer.
kStatus_USB_BusyThe previous command is executing or there is no idle transfer.
kStatus_USB_ErrorSend transfer fail. See the USB_HostSend/USB_HostRecv.
kStatus_USB_SuccessCallback return status, the command succeed.
kStatus_USB_MSDStatusFailCallback return status, the CSW status indicate this command fail.
kStatus_USB_ErrorCallback return status, the command fail.

◆ USB_HostMsdRead10()

usb_status_t USB_HostMsdRead10 ( usb_host_class_handle classHandle,
uint8_t logicalUnit,
uint32_t blockAddress,
uint8_t * buffer,
uint32_t bufferLength,
uint32_t blockNumber,
transfer_callback_t callbackFn,
void * callbackParam )
extern

#include <usb_host_msd.h>

Mass storage read (10).

This function implements the UFI READ(10) command. This command requests that the UFI device transfer data to the host.

Parameters
[in]classHandleThe class MSD handle.
[in]logicalUnitLogical unit number.
[in]blockAddressThe start block address.
[out]bufferBuffer pointer.
[in]bufferLengthThe buffer length.
[in]blockNumberRead block number.
[in]callbackFnThis callback is called after this command completes.
[in]callbackParamThe first parameter in the callback function.
Return values
kStatus_USB_SuccessThe device is initialized successfully.
kStatus_USB_InvalidHandleThe classHandle is NULL pointer.
kStatus_USB_BusyThe previous command is executing or there is no idle transfer.
kStatus_USB_ErrorSend transfer fail. See the USB_HostSend/USB_HostRecv.
kStatus_USB_SuccessCallback return status, the command succeed.
kStatus_USB_MSDStatusFailCallback return status, the CSW status indicate this command fail.
kStatus_USB_ErrorCallback return status, the command fail.

◆ USB_HostMsdRead12()

usb_status_t USB_HostMsdRead12 ( usb_host_class_handle classHandle,
uint8_t logicalUnit,
uint32_t blockAddress,
uint8_t * buffer,
uint32_t bufferLength,
uint32_t blockNumber,
transfer_callback_t callbackFn,
void * callbackParam )
extern

#include <usb_host_msd.h>

Mass storage read (12).

This function implements the UFI READ(12) command and requests that the UFI device transfer data to the host.

Parameters
[in]classHandleThe class MSD handle.
[in]logicalUnitLogical unit number.
[in]blockAddressThe start block address.
[out]bufferBuffer pointer.
[in]bufferLengthThe buffer length.
[in]blockNumberRead block number.
[in]callbackFnThis callback is called after this command completes.
[in]callbackParamThe first parameter in the callback function.
Return values
kStatus_USB_SuccessThe device is initialized successfully.
kStatus_USB_InvalidHandleThe classHandle is NULL pointer.
kStatus_USB_BusyThe previous command is executing or there is no idle transfer.
kStatus_USB_ErrorSend transfer fail. See the USB_HostSend/USB_HostRecv.
kStatus_USB_SuccessCallback return status, the command succeed.
kStatus_USB_MSDStatusFailCallback return status, the CSW status indicate this command fail.
kStatus_USB_ErrorCallback return status, the command fail.

◆ USB_HostMsdReadCapacity()

usb_status_t USB_HostMsdReadCapacity ( usb_host_class_handle classHandle,
uint8_t logicalUnit,
uint8_t * buffer,
uint32_t bufferLength,
transfer_callback_t callbackFn,
void * callbackParam )
extern

#include <usb_host_msd.h>

Mass storage read capacity.

This function implements the UFI READ CAPACITY command and allows the host to request capacities of the currently installed medium.

Parameters
[in]classHandleThe class MSD handle.
[in]logicalUnitLogical unit number.
[out]bufferBuffer pointer.
[in]bufferLengthThe buffer length.
[in]callbackFnThis callback is called after this command completes.
[in]callbackParamThe first parameter in the callback function.
Return values
kStatus_USB_SuccessThe device is initialized successfully.
kStatus_USB_InvalidHandleThe classHandle is NULL pointer.
kStatus_USB_BusyThe previous command is executing or there is no idle transfer.
kStatus_USB_ErrorSend transfer fail. See the USB_HostSend/USB_HostRecv.
kStatus_USB_SuccessCallback return status, the command succeed.
kStatus_USB_MSDStatusFailCallback return status, the CSW status indicate this command fail.
kStatus_USB_ErrorCallback return status, the command fail.

◆ USB_HostMsdReadFormatCapacities()

usb_status_t USB_HostMsdReadFormatCapacities ( usb_host_class_handle classHandle,
uint8_t logicalUnit,
uint8_t * buffer,
uint32_t bufferLength,
transfer_callback_t callbackFn,
void * callbackParam )
extern

#include <usb_host_msd.h>

Mass storage read format capacities.

This function implements the UFI READ FORMAT CAPACITIES command and allows the host to request a list of the possible capacities that can be formatted on the currently installed medium.

Parameters
[in]classHandleThe class MSD handle.
[in]logicalUnitLogical unit number.
[out]bufferBuffer pointer.
[in]bufferLengthThe buffer length.
[in]callbackFnThis callback is called after this command completes.
[in]callbackParamThe first parameter in the callback function.
Return values
kStatus_USB_SuccessThe device is initialized successfully.
kStatus_USB_InvalidHandleThe classHandle is NULL pointer.
kStatus_USB_BusyThe previous command is executing or there is no idle transfer.
kStatus_USB_ErrorSend transfer fail. See the USB_HostSend/USB_HostRecv.
kStatus_USB_SuccessCallback return status, the command succeed.
kStatus_USB_MSDStatusFailCallback return status, the CSW status indicate this command fail.
kStatus_USB_ErrorCallback return status, the command fail.

◆ USB_HostMsdRequestSense()

usb_status_t USB_HostMsdRequestSense ( usb_host_class_handle classHandle,
uint8_t logicalUnit,
uint8_t * buffer,
uint32_t bufferLength,
transfer_callback_t callbackFn,
void * callbackParam )
extern

#include <usb_host_msd.h>

mass storage request sense.

This function implements the UFI REQUEST SENSE command, this command instructs the UFI device to transfer sense data to the host for the specified logical unit.

Parameters
[in]classHandleThe class MSD handle.
[in]logicalUnitLogical unit number.
[out]bufferBuffer pointer.
[in]bufferLengthThe buffer length.
[in]callbackFnThis callback is called after this command completes.
[in]callbackParamThe first parameter in the callback function.
Return values
kStatus_USB_SuccessThe device is initialized successfully.
kStatus_USB_InvalidHandleThe classHandle is NULL pointer.
kStatus_USB_BusyThe previous command is executing or there is no idle transfer.
kStatus_USB_ErrorSend transfer fail. See the USB_HostSend/USB_HostRecv.
kStatus_USB_SuccessCallback return status, the command succeed.
kStatus_USB_MSDStatusFailCallback return status, the CSW status indicate this command fail.
kStatus_USB_ErrorCallback return status, the command fail.

◆ USB_HostMsdRezeroUnit()

usb_status_t USB_HostMsdRezeroUnit ( usb_host_class_handle classHandle,
uint8_t logicalUnit,
transfer_callback_t callbackFn,
void * callbackParam )
extern

#include <usb_host_msd.h>

Mass storage rezero.

This function implements the UFI REZERO UNIT command. This command positions the head of the drive to the cylinder 0.

Parameters
[in]classHandleThe class MSD handle.
[in]logicalUnitLogical unit number.
[in]callbackFnThis callback is called after this command completes.
[in]callbackParamThe first parameter in the callback function.
Return values
kStatus_USB_SuccessThe device is initialized successfully.
kStatus_USB_InvalidHandleThe classHandle is NULL pointer.
kStatus_USB_BusyThe previous command is executing or there is no idle transfer.
kStatus_USB_ErrorSend transfer fail. See the USB_HostSend/USB_HostRecv.
kStatus_USB_SuccessCallback return status, the command succeed.
kStatus_USB_MSDStatusFailCallback return status, the CSW status indicate this command fail.
kStatus_USB_ErrorCallback return status, the command fail.

◆ USB_HostMsdSeek10()

usb_status_t USB_HostMsdSeek10 ( usb_host_class_handle classHandle,
uint8_t logicalUnit,
uint32_t blockAddress,
transfer_callback_t callbackFn,
void * callbackParam )
extern

#include <usb_host_msd.h>

Mass storage seek(10).

This function implements the UFI SEEK(10) command and requests that the UFI device seek to the specified Logical Block Address.

Parameters
[in]classHandleThe class MSD handle.
[in]logicalUnitLogical unit number.
[in]blockAddressThe start block address.
[in]callbackFnThis callback is called after this command completes.
[in]callbackParamThe first parameter in the callback function.
Return values
kStatus_USB_SuccessThe device is initialized successfully.
kStatus_USB_InvalidHandleThe classHandle is NULL pointer.
kStatus_USB_BusyThe previous command is executing or there is no idle transfer.
kStatus_USB_ErrorSend transfer fail. See the USB_HostSend/USB_HostRecv.
kStatus_USB_SuccessCallback return status, the command succeed.
kStatus_USB_MSDStatusFailCallback return status, the CSW status indicate this command fail.
kStatus_USB_ErrorCallback return status, the command fail.

◆ USB_HostMsdSendDiagnostic()

usb_status_t USB_HostMsdSendDiagnostic ( usb_host_class_handle classHandle,
uint8_t logicalUnit,
uint8_t selfTest,
transfer_callback_t callbackFn,
void * callbackParam )
extern

#include <usb_host_msd.h>

Mass storage send diagnostic.

This function implements the UFI SEND DIAGNOSTIC command. This command requests the UFI device to do a reset or perform a self-test.

Parameters
[in]classHandleThe class MSD handle.
[in]logicalUnitLogical unit number.
[in]selfTest0 = perform special diagnostic test; 1 = perform default self-test.
[in]callbackFnThis callback is called after this command completes.
[in]callbackParamThe first parameter in the callback function.
Return values
kStatus_USB_SuccessThe device is initialized successfully.
kStatus_USB_InvalidHandleThe classHandle is NULL pointer.
kStatus_USB_BusyThe previous command is executing or there is no idle transfer.
kStatus_USB_ErrorSend transfer fail. See the USB_HostSend/USB_HostRecv.
kStatus_USB_SuccessCallback return status, the command succeed.
kStatus_USB_MSDStatusFailCallback return status, the CSW status indicate this command fail.
kStatus_USB_ErrorCallback return status, the command fail.

◆ USB_HostMsdSetInterface()

usb_status_t USB_HostMsdSetInterface ( usb_host_class_handle classHandle,
usb_host_interface_handle interfaceHandle,
uint8_t alternateSetting,
transfer_callback_t callbackFn,
void * callbackParam )
extern

#include <usb_host_msd.h>

Sets the interface.

This function binds the interface with the MSD instance.

Parameters
[in]classHandleThe class handle.
[in]interfaceHandleThe interface handle.
[in]alternateSettingThe alternate setting value.
[in]callbackFnThis callback is called after this function completes.
[in]callbackParamThe first parameter in the callback function.
Return values
kStatus_USB_SuccessThe device is initialized successfully.
kStatus_USB_InvalidHandleThe classHandle is NULL pointer.
kStatus_USB_BusyThere is no idle transfer.
kStatus_USB_ErrorSend transfer fail. See the USB_HostSendSetup.
kStatus_USB_SuccessCallback return status, the command succeeded.
kStatus_USB_BusyCallback return status, there is no idle pipe.
kStatus_USB_TransferStallCallback return status, the transfer is stalled by the device.
kStatus_USB_ErrorCallback return status, open pipe fail. See the USB_HostOpenPipe.

◆ USB_HostMsdStartStopUnit()

usb_status_t USB_HostMsdStartStopUnit ( usb_host_class_handle classHandle,
uint8_t logicalUnit,
uint8_t loadEject,
uint8_t start,
transfer_callback_t callbackFn,
void * callbackParam )
extern

#include <usb_host_msd.h>

Mass storage start stop unit.

This function implements the UFI START-STOP UNIT command and instructs the UFI device to enable or disable media access operations .

Parameters
[in]classHandleThe class MSD handle.
[in]logicalUnitLogical unit number.
[in]loadEjectA Load Eject (LoEj) bit of zero requests that no eject action be performed. A LoEj bit of one, with the Start bit cleared to zero, which instructs the UFI device to eject the media.
[in]startA Start bit of one instructs the UFI device to enable media access operations. A Start bit of zero instructs the UFI device to disable media access operations.
[in]callbackFnThis callback is called after this command completes.
[in]callbackParamThe first parameter in the callback function.
Return values
kStatus_USB_SuccessThe device is initialized successfully.
kStatus_USB_InvalidHandleThe classHandle is NULL pointer.
kStatus_USB_BusyThe previous command is executing or there is no idle transfer.
kStatus_USB_ErrorSend transfer fail. See the USB_HostSend/USB_HostRecv.
kStatus_USB_SuccessCallback return status, the command succeed.
kStatus_USB_MSDStatusFailCallback return status, the CSW status indicate this command fail.
kStatus_USB_ErrorCallback return status, the command fail.

◆ USB_HostMsdTestUnitReady()

usb_status_t USB_HostMsdTestUnitReady ( usb_host_class_handle classHandle,
uint8_t logicalUnit,
transfer_callback_t callbackFn,
void * callbackParam )
extern

#include <usb_host_msd.h>

Mass storage test unit ready.

This function implements the UFI TEST UNIT READY command and checks if the UFI device is ready.

Parameters
[in]classHandleThe class MSD handle.
[in]logicalUnitLogical unit number.
[in]callbackFnThis callback is called after this command completes.
[in]callbackParamThe first parameter in the callback function.
Return values
kStatus_USB_SuccessThe device is initialized successfully.
kStatus_USB_InvalidHandleThe classHandle is NULL pointer.
kStatus_USB_BusyThe previous command is executing or there is no idle transfer.
kStatus_USB_ErrorSend transfer fail. See the USB_HostSend/USB_HostRecv.
kStatus_USB_SuccessCallback return status, the command succeed.
kStatus_USB_MSDStatusFailCallback return status, the CSW status indicate this command fail.
kStatus_USB_ErrorCallback return status, the command fail.

◆ USB_HostMsdVerify()

usb_status_t USB_HostMsdVerify ( usb_host_class_handle classHandle,
uint8_t logicalUnit,
uint32_t blockAddress,
uint16_t verificationLength,
transfer_callback_t callbackFn,
void * callbackParam )
extern

#include <usb_host_msd.h>

Mass storage verify.

This function implements the UFI VERIFY command and requests that the UFI device verify the data on the medium.

Parameters
[in]classHandleThe class MSD handle.
[in]logicalUnitLogical unit number.
[in]blockAddressThe start block address.
[in]verificationLengthThe data length that need to be verified.
[in]callbackFnThis callback is called after this command completes.
[in]callbackParamThe first parameter in the callback function.
Return values
kStatus_USB_SuccessThe device is initialized successfully.
kStatus_USB_InvalidHandleThe classHandle is NULL pointer.
kStatus_USB_BusyThe previous command is executing or there is no idle transfer.
kStatus_USB_ErrorSend transfer fail. See the USB_HostSend/USB_HostRecv.
kStatus_USB_SuccessCallback return status, the command succeed.
kStatus_USB_MSDStatusFailCallback return status, the CSW status indicate this command fail.
kStatus_USB_ErrorCallback return status, the command fail.

◆ USB_HostMsdWrite10()

usb_status_t USB_HostMsdWrite10 ( usb_host_class_handle classHandle,
uint8_t logicalUnit,
uint32_t blockAddress,
uint8_t * buffer,
uint32_t bufferLength,
uint32_t blockNumber,
transfer_callback_t callbackFn,
void * callbackParam )
extern

#include <usb_host_msd.h>

Mass storage write (10).

This function implements the UFI WRITE(10) command and requests that the UFI device write the data transferred by the host to the medium.

Parameters
[in]classHandleThe class MSD handle.
[in]logicalUnitLogical unit number.
[in]blockAddressThe start block address.
[in]bufferBuffer pointer.
[in]bufferLengthThe buffer length.
[in]blockNumberWrite block number.
[in]callbackFnThis callback is called after this command completes.
[in]callbackParamThe first parameter in the callback function.
Return values
kStatus_USB_SuccessThe device is initialized successfully.
kStatus_USB_InvalidHandleThe classHandle is NULL pointer.
kStatus_USB_BusyThe previous command is executing or there is no idle transfer.
kStatus_USB_ErrorSend transfer fail. See the USB_HostSend/USB_HostRecv.
kStatus_USB_SuccessCallback return status, the command succeed.
kStatus_USB_MSDStatusFailCallback return status, the CSW status indicate this command fail.
kStatus_USB_ErrorCallback return status, the command fail.

◆ USB_HostMsdWrite12()

usb_status_t USB_HostMsdWrite12 ( usb_host_class_handle classHandle,
uint8_t logicalUnit,
uint32_t blockAddress,
uint8_t * buffer,
uint32_t bufferLength,
uint32_t blockNumber,
transfer_callback_t callbackFn,
void * callbackParam )
extern

#include <usb_host_msd.h>

Mass storage write (12).

This function implements the UFI WRITE(12) command and requests that the UFI device write the data transferred by the host to the medium.

Parameters
[in]classHandleThe class MSD handle.
[in]logicalUnitLogical unit number.
[in]blockAddressThe start block address.
[in]bufferBuffer pointer.
[in]bufferLengthThe buffer length.
[in]blockNumberWrite block number.
[in]callbackFnThis callback is called after this command completes.
[in]callbackParamThe first parameter in the callback function.
Return values
kStatus_USB_SuccessThe device is initialized successfully.
kStatus_USB_InvalidHandleThe classHandle is NULL pointer.
kStatus_USB_BusyThe previous command is executing or there is no idle transfer.
kStatus_USB_ErrorSend transfer fail. See the USB_HostSend/USB_HostRecv.
kStatus_USB_SuccessCallback return status, the command succeed.
kStatus_USB_MSDStatusFailCallback return status, the CSW status indicate this command fail.
kStatus_USB_ErrorCallback return status, the command fail.

◆ USB_HostMsdWriteAndVerify()

usb_status_t USB_HostMsdWriteAndVerify ( usb_host_class_handle classHandle,
uint8_t logicalUnit,
uint32_t blockAddress,
uint8_t * buffer,
uint32_t bufferLength,
uint32_t blockNumber,
transfer_callback_t callbackFn,
void * callbackParam )
extern

#include <usb_host_msd.h>

Mass storage write and verify.

This function implements the UFI WRITE AND VERIFY command and requests that the UFI device writes the data transferred by the host to the medium, then verifies the data on the medium.

Parameters
[in]classHandleThe class MSD handle.
[in]logicalUnitLogical unit number.
[in]blockAddressThe start block address.
[in]bufferBuffer pointer.
[in]bufferLengthThe buffer length.
[in]blockNumberWrite and verify block number.
[in]callbackFnThis callback is called after this command completes.
[in]callbackParamThe first parameter in the callback function.
Return values
kStatus_USB_SuccessThe device is initialized successfully.
kStatus_USB_InvalidHandleThe classHandle is NULL pointer.
kStatus_USB_BusyThe previous command is executing or there is no idle transfer.
kStatus_USB_ErrorSend transfer fail. See the USB_HostSend/USB_HostRecv.
kStatus_USB_SuccessCallback return status, the command succeed.
kStatus_USB_MSDStatusFailCallback return status, the CSW status indicate this command fail.
kStatus_USB_ErrorCallback return status, the command fail.