![]() |
RA Flexible Software Package Documentation
Release v5.8.0
|
|
Middleware to implement the block media interface on USB mass storage devices. This module implements the Block Media Interface.
The USB implementation of the block media interface has the following key features:
Configuration | Options | Default | Description |
---|---|---|---|
Parameter Checking |
| Default (BSP) | If selected code for parameter checking is included in the build. |
Configuration | Options | Default | Description |
---|---|---|---|
Name | Name must be a valid C symbol | g_rm_block_media0 | Module name. |
Callback | Name must be a valid C symbol | NULL | A user callback function can be provided. If this callback function is provided, it will be called when a device is attached or removed. |
Pointer to user context | Name must be a valid C symbol | NULL | A user context can be provided. If this context is provided, it will be passed to callback function when a device is attached or removed. |
This module has no required clock configurations.
This module does not use I/O pins.
This is a basic example of minimal use of the USB mass storage block media implementation in an application.
This is an example of using a callback to determine when a mass storage device is plugged in and enumerated.
fsp_err_t RM_BLOCK_MEDIA_USB_Open | ( | rm_block_media_ctrl_t *const | p_ctrl, |
rm_block_media_cfg_t const *const | p_cfg | ||
) |
Opens the module.
Implements rm_block_media_api_t::open().
FSP_SUCCESS | Module is available and is now open. |
FSP_ERR_ASSERTION | An input parameter is invalid. |
FSP_ERR_ALREADY_OPEN | Module has already been opened with this instance of the control structure. |
fsp_err_t RM_BLOCK_MEDIA_USB_MediaInit | ( | rm_block_media_ctrl_t *const | p_ctrl | ) |
Initializes the USB device.
Implements rm_block_media_api_t::mediaInit().
FSP_SUCCESS | Module is initialized and ready to access the memory device. |
FSP_ERR_ASSERTION | An input parameter is invalid. |
FSP_ERR_NOT_OPEN | Module is not open. |
fsp_err_t RM_BLOCK_MEDIA_USB_Read | ( | rm_block_media_ctrl_t *const | p_ctrl, |
uint8_t *const | p_dest_address, | ||
uint32_t const | block_address, | ||
uint32_t const | num_blocks | ||
) |
Reads data from an USB device. Implements rm_block_media_api_t::read().
This function blocks until the data is read into the destination buffer.
FSP_SUCCESS | Data read successfully. |
FSP_ERR_ASSERTION | An input parameter is invalid. |
FSP_ERR_NOT_OPEN | Module is not open. |
FSP_ERR_NOT_INITIALIZED | Module has not been initialized. |
FSP_ERR_USB_FAILED | The message could not received completed successfully. |
fsp_err_t RM_BLOCK_MEDIA_USB_Write | ( | rm_block_media_ctrl_t *const | p_ctrl, |
uint8_t const *const | p_src_address, | ||
uint32_t const | block_address, | ||
uint32_t const | num_blocks | ||
) |
Writes data to an USB device. Implements rm_block_media_api_t::write().
This function blocks until the write operation completes.
FSP_SUCCESS | Write finished successfully. |
FSP_ERR_ASSERTION | An input parameter is invalid. |
FSP_ERR_NOT_OPEN | Module is not open. |
FSP_ERR_NOT_INITIALIZED | Module has not been initialized. |
FSP_ERR_USB_FAILED | The message could not received completed successfully. |
fsp_err_t RM_BLOCK_MEDIA_USB_Erase | ( | rm_block_media_ctrl_t *const | p_ctrl, |
uint32_t const | block_address, | ||
uint32_t const | num_blocks | ||
) |
Erases sectors of an USB device. Implements rm_block_media_api_t::erase().
This function blocks until erase is complete.
FSP_SUCCESS | Erase operation requested. |
FSP_ERR_ASSERTION | An input parameter is invalid. |
FSP_ERR_NOT_OPEN | Module is not open. |
FSP_ERR_NOT_INITIALIZED | Module has not been initialized. |
fsp_err_t RM_BLOCK_MEDIA_USB_CallbackSet | ( | rm_block_media_ctrl_t *const | p_api_ctrl, |
void(*)(rm_block_media_callback_args_t *) | p_callback, | ||
void const *const | p_context, | ||
rm_block_media_callback_args_t *const | p_callback_memory | ||
) |
Updates the user callback with the option to provide memory for the callback argument structure. Implements rm_block_media_api_t::callbackSet.
FSP_ERR_UNSUPPORTED | CallbackSet is not currently supported for Block Media over USB. |
fsp_err_t RM_BLOCK_MEDIA_USB_StatusGet | ( | rm_block_media_ctrl_t *const | p_api_ctrl, |
rm_block_media_status_t *const | p_status | ||
) |
Provides driver status. Implements rm_block_media_api_t::statusGet().
FSP_SUCCESS | Status stored in p_status. |
FSP_ERR_ASSERTION | NULL pointer. |
FSP_ERR_NOT_OPEN | Module is not open. |
FSP_ERR_NOT_INITIALIZED | Module has not been initialized. |
fsp_err_t RM_BLOCK_MEDIA_USB_InfoGet | ( | rm_block_media_ctrl_t *const | p_ctrl, |
rm_block_media_info_t *const | p_info | ||
) |
Retrieves module information. Implements rm_block_media_api_t::infoGet().
FSP_SUCCESS | Erase operation requested. |
FSP_ERR_ASSERTION | An input parameter is invalid. |
FSP_ERR_NOT_OPEN | Module is not open. |
FSP_ERR_NOT_INITIALIZED | Module has not been initialized. |
fsp_err_t RM_BLOCK_MEDIA_USB_Close | ( | rm_block_media_ctrl_t *const | p_ctrl | ) |
Closes an open USB device. Implements rm_block_media_api_t::close().
FSP_SUCCESS | Successful close. |
FSP_ERR_ASSERTION | An input parameter is invalid. |
FSP_ERR_NOT_OPEN | Module is not open. |