A USB mass storage device supports one or more logical units, each of which is a physical storage device.
More...
#include <HostDevice.h>
|
| static constexpr size_t | MAX_LUN {CFG_TUH_MSC_MAXLUN} |
| |
A USB mass storage device supports one or more logical units, each of which is a physical storage device.
◆ EnumCallback
Callback passed to enumerate() method.
- Parameters
-
| unit | The logical unit attached to a device |
| inquiry | Detailed information |
- Return values
-
| bool | true to continue enumeration, false to stop |
◆ begin()
| bool USB::MSC::HostDevice::begin |
( |
const Instance & |
inst | ) |
|
◆ end()
| void USB::MSC::HostDevice::end |
( |
| ) |
|
|
virtual |
Called when device is disconnected. Override as required.
Reimplemented from USB::HostInterface.
◆ enumerate()
| bool USB::MSC::HostDevice::enumerate |
( |
EnumCallback |
callback | ) |
|
Enumerate all logical units managed by this device.
- Parameters
-
| callback | Invoked for each discovered Logical Unit |
◆ getSectorCount()
| storage_size_t USB::MSC::HostDevice::getSectorCount |
( |
uint8_t |
lun | ) |
const |
|
inline |
Get the number of blocks/sectors for a unit.
- Parameters
-
| lun | The logical Unit Number |
- Return values
-
| size_t | Number of blocks, 0 if invalid |
◆ getSectorSize()
| size_t USB::MSC::HostDevice::getSectorSize |
( |
uint8_t |
lun | ) |
const |
|
inline |
Get the declared block/sector size for a unit.
- Parameters
-
| lun | The logical Unit Number |
- Return values
-
| size_t | Block size in bytes, or 0 if invalid |
◆ operator[]()
Access a specific logical unit by number.
- Parameters
-
| lun | The logical Unit Number |
- Return values
-
| LogicalUnit* | The corresponding LU, or nullptr if invalid |
◆ read_sectors()
| bool USB::MSC::HostDevice::read_sectors |
( |
uint8_t |
lun, |
|
|
uint32_t |
lba, |
|
|
void * |
dst, |
|
|
size_t |
size |
|
) |
| |
Read data from a unit.
- Parameters
-
| lun | The logical Unit Number |
| lba | Starting Logical Block Address |
| dst | Buffer to store data |
| size | Number of sectors to read |
- Return values
-
◆ wait()
| bool USB::MSC::HostDevice::wait |
( |
| ) |
|
Wait for all outstanding operations to complete.
- Parameters
-
| lun | The logical Unit Number |
- Return values
-
| bool | false on error (e.g. device forceably disconnected) |
Write operations are asynchronous so calling this method ensures that the operation has completed.
◆ write_sectors()
| bool USB::MSC::HostDevice::write_sectors |
( |
uint8_t |
lun, |
|
|
uint32_t |
lba, |
|
|
const void * |
src, |
|
|
size_t |
size |
|
) |
| |
Write data to a unit.
- Parameters
-
| lun | The logical Unit Number |
| lba | Starting Logical Block Address |
| src | Data to write |
| size | Number of sectors to write |
- Return values
-
◆ MAX_LUN
| constexpr size_t USB::MSC::HostDevice::MAX_LUN {CFG_TUH_MSC_MAXLUN} |
|
staticconstexpr |
◆ units
The documentation for this class was generated from the following file: