![]() |
RZ Flexible Software Package Documentation
Release v4.3.0
|
|
Functions | |
| fsp_err_t | R_USB_HMSC_StorageCommand (usb_ctrl_t *const p_ctrl, uint8_t *buf, uint8_t command, uint8_t destination) |
| Processing for MassStorage(ATAPI) command. More... | |
| fsp_err_t | R_USB_HMSC_DriveNumberGet (usb_ctrl_t *const p_ctrl, uint8_t *p_drive, uint8_t destination) |
| Get number of Storage drive. More... | |
| fsp_err_t | R_USB_HMSC_StorageReadSector (uint16_t drive_number, uint8_t *const buff, uint32_t sector_number, uint16_t sector_count) |
| Read sector information. More... | |
| fsp_err_t | R_USB_HMSC_StorageWriteSector (uint16_t drive_number, uint8_t const *const buff, uint32_t sector_number, uint16_t sector_count) |
| Write sector information. More... | |
| fsp_err_t | R_USB_HMSC_SemaphoreGet (void) |
| Get a semaphore. (RTOS only) More... | |
| fsp_err_t | R_USB_HMSC_SemaphoreRelease (void) |
| Release a semaphore. (RTOS only) More... | |
This module provides a USB Host Mass Storage Class (HMSC) driver. It implements the USB HMSC Interface.
The r_usb_hmsc module, when used in combination with the r_usb_basic module, operates as a USB Host Mass Storage Class (HMSC) driver. It is built on the USB Mass Storage Class Bulk-Only Transport (BOT) protocol. It is possible to communicate with BOT-compatible USB storage devices by combining this module with a file system and storage device driver.
The r_usb_hmsc module has the following key features:
The class requests supported by this driver are shown below.
| Request | Description |
|---|---|
| GetMaxLun | Gets the maximum number of units that are supported. |
| MassStorageReset | Cancels a protocol error. |
This driver supports the following storage commands:
Refer to the USB (r_usb_basic) module.
Refer to the USB (r_usb_basic) module.
Refer to the USB (r_usb_basic) module.
To use FreeRTOS+FAT without FreeRTOS, copy FreeRTOSConfig.h to the include path of your project.
When using ff_fread() / ff_fwrite(), please append USB_BUFFER_PLACE_IN_SECTION to the declaration of the memory area specified as the first argument (pvBuffer), as shown below:
Example: uint8_t g_buffer[x] USB_BUFFER_PLACE_IN_SECTION;
Example Operating Environment
The following shows an example operating environment for the HMSC.
Refer to the associated instruction manuals for details on setting up the evaluation board and using the emulator, etc.
The main functions of the application are as follows:
This application has two tasks. An overview of the processing in these two tasks is provided below.
usb_apl_task
file_read_task
Of the application tasks usb_apl_task and file_read_task, file_read_task is processed while usb_apl_task is in the wait state. This task performs file read processing on the file that was written to the MSC device.
| fsp_err_t R_USB_HMSC_StorageCommand | ( | usb_ctrl_t *const | p_ctrl, |
| uint8_t * | buf, | ||
| uint8_t | command, | ||
| uint8_t | destination | ||
| ) |
Processing for MassStorage(ATAPI) command.
| FSP_SUCCESS | Success. |
| FSP_ERR_USB_FAILED | The function could not be completed successfully. |
| FSP_ERR_ASSERTION | Parameter Null pointer error. |
| FSP_ERR_USB_PARAMETER | Parameter error. |
| fsp_err_t R_USB_HMSC_DriveNumberGet | ( | usb_ctrl_t *const | p_ctrl, |
| uint8_t * | p_drive, | ||
| uint8_t | destination | ||
| ) |
Get number of Storage drive.
| FSP_SUCCESS | Success. |
| FSP_ERR_USB_FAILED | The function could not be completed successfully. |
| FSP_ERR_ASSERTION | Parameter Null pointer error. |
| FSP_ERR_USB_PARAMETER | Parameter error. |
| fsp_err_t R_USB_HMSC_StorageReadSector | ( | uint16_t | drive_number, |
| uint8_t *const | buff, | ||
| uint32_t | sector_number, | ||
| uint16_t | sector_count | ||
| ) |
Read sector information.
| FSP_SUCCESS | Success. |
| FSP_ERR_USB_FAILED | The function could not be completed successfully. |
| FSP_ERR_ASSERTION | Parameter Null pointer error. |
| FSP_ERR_USB_PARAMETER | Parameter error. |
| fsp_err_t R_USB_HMSC_StorageWriteSector | ( | uint16_t | drive_number, |
| uint8_t const *const | buff, | ||
| uint32_t | sector_number, | ||
| uint16_t | sector_count | ||
| ) |
Write sector information.
| FSP_SUCCESS | Success. |
| FSP_ERR_USB_FAILED | The function could not be completed successfully. |
| FSP_ERR_ASSERTION | Parameter Null pointer error. |
| FSP_ERR_USB_PARAMETER | Parameter error. |
| fsp_err_t R_USB_HMSC_SemaphoreGet | ( | void | ) |
Get a semaphore. (RTOS only)
If this function is called in the OS less execution environment, a failure is returned.
| FSP_SUCCESS | Success. |
| FSP_ERR_USB_FAILED | The function could not be completed successfully. |
| fsp_err_t R_USB_HMSC_SemaphoreRelease | ( | void | ) |
Release a semaphore. (RTOS only)
If this function is called in the OS less execution environment, a failure is returned.
| FSP_SUCCESS | Success. |
| FSP_ERR_USB_FAILED | The function could not be completed successfully. |