RA Flexible Software Package Documentation
Release v5.7.0
|
|
This module provides a USB Peripheral Mass Storage Class (PMSC) driver. It implements the USB PMSC Interface.
Refer to USB (r_usb_basic) for the common API (r_usb_basic) to be called from the application.
The r_usb_pmsc module combines with the r_usb_basic module to provide USB Peripheral It operates as a Mass Storage class driver (hereinafter referred to as PMSC).
The USB peripheral mass storage class driver (PMSC) comprises a USB mass storage class bulk-only transport (BOT) protocol.
When combined with a USB peripheral control driver and media driver, it enables communication with a USB host as a BOT-compatible storage device.
The r_usb_pmsc module has the following key features:
Configuration | Options | Default | Description |
---|---|---|---|
Bulk Input Transfer Pipe |
| USB PIPE4 | Select the USB pipe to use for bulk input transfers. |
Bulk Output Transfer Pipe |
| USB PIPE5 | Select the USB pipe to use for bulk output transfers. |
Vendor Information | Vendor Information must be 8 bytes long; pad with spaces if shorter. | Vendor | Specify the vendor information field (part of the Inquiry command response). |
Product Information | Product Information must be 16 bytes long; pad with spaces if shorter. | Mass Storage | Specify the product information field (part of the Inquiry command response). |
Product Revision Level | Product Revision Level must be 4 bytes long; pad with spaces if shorter. | 1.00 | Specify the product revision level field (part of the Inquiry command response). |
Sector size |
| 512 | Specifies the sector size. |
Number of Transfer Sectors | Please enter a number between 1 and 255. | 8 | Specify the maximum sector size to request with one data transfer. |
Configuration | Options | Default | Description |
---|---|---|---|
Name | Name must be a valid C symbol | g_pmsc0 | Module name. |
Refer to the USB (r_usb_basic) module for hardware configuration options.
Refer to the USB (r_usb_basic) module.
Refer to the USB (r_usb_basic) module.
The class requests supported by this driver are shown below.
Request | Code | Description |
---|---|---|
Bulk-Only Mass Storage Reset | 0xFF | Resets the connection interface to the mass storage device. |
Get Max Logical Unit Number | 0xFE | Reports the logical numbers supported by the device. |
This driver supports the following storage commands.
Command | Code | Description |
---|---|---|
TEST_UNIT_READY | 0x00 | Checks the state of the peripheral device. |
REQUEST_SENSE | 0x03 | Gets the error information of the previous storage command execution result. |
INQUIRY | 0x12 | Gets the parameter information of the logical unit. |
READ_FORMAT_CAPACITY | 0x23 | Gets the formattable capacity. |
READ_CAPACITY | 0x25 | Gets the capacity information of the logical unit. |
READ10 | 0x28 | Reads data. |
WRITE10 | 0x1A | Writes data. |
MODE_SENSE10 | 0x5A | Gets the parameters of the logical unit. |
BOT (USB MSC Bulk-Only Transport) is a transfer protocol that encapsulates command, data, and status (results of commands) using only two endpoints (one bulk in and one bulk out). The ATAPI storage commands and the response status are embedded in a Command Block Wrapper (CBW) and a Command Status Wrapper (CSW). The below image shows an overview of how the BOT protocol progresses with command and status data flowing between USB host and peripheral.
PMSC implements a block media interface to enable access to higher-level modules. If the block media interface supports multiple media, users can select any media to access.
In this example, when the evaluation board is connected to the host PC it is recognized as a removable disk and reading/writing files is possible. The FAT type is either FAT12, FAT16, or FAT32 depending on the size of the media used.
A template for PMSC descriptors can be found in ra/fsp/src/r_usb_pmsc/r_usb_pmsc_descriptor.c.template. Also, please be sure to use your vendor ID.