User API reference of the Mass Storage Class. More...
Functions | |
void | USBH_MSC_Initialize (uint8_t instance) |
Callback function called when Mass Storage Device was enumerated and is ready. | |
void | USBH_MSC_Uninitialize (uint8_t instance) |
Callback function called when Mass Storage Device was disconnected. | |
uint8_t | USBH_MSC_GetDevice (uint8_t instance) |
Get Device instance of Mass Storage Device. | |
usbStatus | USBH_MSC_GetStatus (uint8_t instance) |
Get status of Mass Storage Device. | |
usbStatus | USBH_MSC_Read (uint8_t instance, uint32_t lba, uint32_t cnt, uint8_t *buf) |
Read requested number of blocks from Mass Storage Device. | |
usbStatus | USBH_MSC_Write (uint8_t instance, uint32_t lba, uint32_t cnt, const uint8_t *buf) |
Write requested number of blocks to Mass Storage Device. | |
usbStatus | USBH_MSC_ReadCapacity (uint8_t instance, uint32_t *block_count, uint32_t *block_size) |
Read capacity of Mass Storage Device. | |
User API reference of the Mass Storage Class.
uint8_t USBH_MSC_GetDevice | ( | uint8_t | instance | ) |
Get Device instance of Mass Storage Device.
[in] | instance | instance of MSC Device. |
The function USBH_MSC_GetDevice is used to retrieve device instance that is used to handle mass storage device instance.
The argument instance specifies the MSC device instance.
usbStatus USBH_MSC_GetStatus | ( | uint8_t | instance | ) |
Get status of Mass Storage Device.
[in] | instance | instance of MSC Device. |
The function USBH_MSC_GetStatus checks if a mass storage device is connected and initialized.
The argument instance specifies the MSC device instance.
Code Example
void USBH_MSC_Initialize | ( | uint8_t | instance | ) |
Callback function called when Mass Storage Device was enumerated and is ready.
[in] | instance | instance of MSC Device. |
The function USBH_MSC_Initialize is called when a mass storage device was connected and successfully enumerated and is ready for communication.
The argument instance specifies the MSC device instance.
usbStatus USBH_MSC_Read | ( | uint8_t | instance, |
uint32_t | lba, | ||
uint32_t | cnt, | ||
uint8_t * | buf | ||
) |
Read requested number of blocks from Mass Storage Device.
[in] | instance | instance of MSC Device. |
[in] | lba | logical block address of first block to read. |
[in] | cnt | number of contiguous blocks to read. |
[out] | buf | data buffer in which to read data. |
The function USBH_MSC_Read reads data from physical memory blocks of a mass storage device.
The argument instance specifies the MSC device instance.
The argument lba is the physical address of the first block to be read.
The argument cnt is the number of blocks to be read.
The argument buf is a pointer to the location where the data will be stored. It is recommended that buffer is 4-byte aligned as some drivers might not support 1-byte alignment if DMA is used.
Code Example
usbStatus USBH_MSC_ReadCapacity | ( | uint8_t | instance, |
uint32_t * | block_count, | ||
uint32_t * | block_size | ||
) |
Read capacity of Mass Storage Device.
[in] | instance | instance of MSC Device. |
[out] | block_count | pointer to where total number of blocks available will be read. |
[out] | block_size | pointer to where block size will be read. |
The function USBH_MSC_ReadCapacity gets information about the capacity of a mass storage device.
The argument instance specifies the MSC device instance.
The argument block_count is a pointer to a variable that stores the total number of available blocks.
The argument block_size is a pointer to a variable that stores the block size (in bytes).
Code Example
void USBH_MSC_Uninitialize | ( | uint8_t | instance | ) |
Callback function called when Mass Storage Device was disconnected.
[in] | instance | instance of MSC Device. |
The function USBH_MSC_Unitialize is called when a mass storage device was disconnected form the USB Bus.
The argument instance specifies the MSC device instance.
usbStatus USBH_MSC_Write | ( | uint8_t | instance, |
uint32_t | lba, | ||
uint32_t | cnt, | ||
const uint8_t * | buf | ||
) |
Write requested number of blocks to Mass Storage Device.
[in] | instance | instance of MSC Device. |
[in] | lba | logical address of first block to write. |
[in] | cnt | number of contiguous blocks to write. |
[in] | buf | data buffer containing data to write. |
The function USBH_MSC_Write writes data to physical memory blocks of the mass storage device.
The argument instance specifies the MSC device instance.
The argument lba is the physical address of the first block to be written.
The argument cnt is the number of blocks to be written.
The argument buf is a pointer to the location that contains the data to be written. It is recommended that buffer is 4-byte aligned as some drivers might not support 1-byte alignment if DMA is used.
Code Example