![]() |
USB Component
Version 6.0
MDK-Professional Middleware for USB Device and Host
|
Enable the USB Host to support USB Mass Storage Devices. More...
Functions | |
usbStatus | USBH_MSC_GetDeviceStatus (int8_t instance) |
Get status of Mass Storage Device. | |
usbStatus | USBH_MSC_Read (int8_t instance, uint32_t lba, uint16_t cnt, uint8_t *buf) |
Read requested number of blocks from Mass Storage Device. | |
usbStatus | USBH_MSC_Write (int8_t instance, uint32_t lba, uint16_t cnt, const uint8_t *buf) |
Write requested number of blocks to Mass Storage Device. | |
usbStatus | USBH_MSC_ReadCapacity (int8_t instance, uint32_t *block_count, uint32_t *block_size) |
Read capacity of Mass Storage Device. | |
Enable the USB Host to support USB Mass Storage Devices.
The MSC class in the USB Component is used for data storage.
Refer to:
To create an USB Host with support for the MSC class:
Configuration File USBH_Config_MSC.h
The USB Host Component has one configuration file for the MSC Device class: USBH_Config_MSC.h. This configuration file defines the maximum number of concurrent MSC Devices that may be attached to the system.
Code Example
usbStatus USBH_MSC_GetDeviceStatus | ( | int8_t | instance | ) |
Get status of Mass Storage Device.
[in] | instance | instance of MSC Device. |
The function USBH_MSC_GetDeviceStatus checks if a mass storage device instance is connected and initialized.
The argument instance is specifying the instance of the MSC device.
Code Example
usbStatus USBH_MSC_Read | ( | int8_t | instance, |
uint32_t | lba, | ||
uint16_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 a mass storage device and stores them in a buffer.
The argument instance is specifying the device instance.
The argument lba is the address of the starting block to be read.
The argument cnt is a value indicating the number of blocks to be read.
The argument buf is pointing to the location where the data will be read.
Code Example
usbStatus USBH_MSC_ReadCapacity | ( | int8_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 reads the capacity of a mass storage device.
The argument instance is specifying the device instance.
The argument block_count is a pointer to where the total number of available blocks will be written.
The argument block_size is a pointer to where the block size will be written.
Code Example
usbStatus USBH_MSC_Write | ( | int8_t | instance, |
uint32_t | lba, | ||
uint16_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 a mass storage device.
The argument instance is specifying the device instance.
The argument lba is the address of the starting block to be written.
The argument cnt is a value indicating the number of blocks to be written.
The argument buf is pointing to the location where the data will be written.
Code Example