A physical device instance managed by an MSC interface. More...

#include <Device.h>

Inheritance diagram for USB::MSC::LogicalUnit:
Collaboration diagram for USB::MSC::LogicalUnit:

Public Member Functions

 operator bool () const
 
void getCapacity (uint32_t *block_count, uint16_t *block_size)
 
int read (uint32_t lba, uint32_t offset, void *buffer, uint32_t bufsize)
 
int write (uint32_t lba, uint32_t offset, uint8_t *buffer, uint32_t bufsize)
 
 LogicalUnit (HostDevice &device, uint8_t lun)
 
Type getType () const override
 Obtain device type. More...
 
String getName () const override
 Obtain unique device name. More...
 
uint32_t getId () const override
 Obtain device ID. More...
 
- Public Member Functions inherited from Storage::Disk::BlockDevice
bool read (storage_size_t address, void *dst, size_t size) override
 Read data from the storage device. More...
 
bool write (storage_size_t address, const void *src, size_t size) override
 Write data to the storage device. More...
 
bool erase_range (storage_size_t address, storage_size_t size) override
 Erase a region of storage in preparation for writing. More...
 
size_t getBlockSize () const override
 Obtain smallest allocation unit for erase operations. More...
 
storage_size_t getSize () const override
 Obtain addressable size of this device. More...
 
storage_size_t getSectorCount () const override
 Obtain total number of sectors on this device. More...
 
bool sync () override
 Flush any pending writes to the physical media. More...
 
bool allocateBuffers (unsigned numBuffers)
 Set number of sector buffers to use. More...
 
- Public Member Functions inherited from Storage::Device
 Device ()
 
 ~Device ()
 
bool operator== (const String &name) const
 
const PartitionTablepartitions () const
 Provide read-only access to partition table. More...
 
PartitionTableeditablePartitions ()
 Provide full access to partition table. More...
 
bool loadPartitions (uint32_t tableOffset)
 Load partition table entries @tableOffset Location of partition table to read. More...
 
bool loadPartitions (Device &source, uint32_t tableOffset)
 Load partition table entries from another table. More...
 
virtual uint16_t getSectorSize () const
 Get sector size, the unit of allocation for block-access devices. More...
 
size_t printTo (Print &p) const
 
- Public Member Functions inherited from LinkedObjectTemplate< Device >
Device * getNext () const
 
bool insertAfter (Device *object)
 
Iterator begin () const
 
Iterator end () const
 
Iterator cbegin () const
 
Iterator cend () const
 
- Public Member Functions inherited from LinkedObject
virtual ~LinkedObject ()
 
virtual LinkedObjectnext () const
 
bool insertAfter (LinkedObject *object)
 
bool operator== (const LinkedObject &other) const
 
bool operator!= (const LinkedObject &other) const
 

Public Attributes

Storage::Devicedevice
 
bool readOnly
 
- Public Attributes inherited from Storage::Disk::BlockDevice
Stat stat
 

Protected Member Functions

bool raw_sector_read (storage_size_t address, void *dst, size_t size) override
 
bool raw_sector_write (storage_size_t address, const void *src, size_t size) override
 
bool raw_sector_erase_range (storage_size_t address, size_t size) override
 
bool raw_sync () override
 
- Protected Member Functions inherited from Storage::Disk::BlockDevice
bool flushBuffer (Buffer &buf)
 
bool flushBuffers ()
 

Additional Inherited Members

- Public Types inherited from Storage::Device
enum class  Type : uint8_t { partitionType = uint8_t(Partition::Type::storage) , XX }
 Storage type. More...
 
using List = LinkedObjectListTemplate< Device >
 
using OwnedList = OwnedLinkedObjectListTemplate< Device >
 
- Public Types inherited from LinkedObjectTemplate< Device >
using Iterator = IteratorTemplate< Device, Device *, Device & >
 
using ConstIterator = IteratorTemplate< const Device, const Device *, const Device & >
 
- Static Public Attributes inherited from Storage::Device
static constexpr uint16_t defaultSectorSize {512}
 
- Protected Attributes inherited from Storage::Disk::BlockDevice
std::unique_ptr< BufferListbuffers
 
uint64_t sectorCount {0}
 
uint16_t sectorSize {defaultSectorSize}
 
uint8_t sectorSizeShift {getSizeBits(defaultSectorSize)}
 
- Protected Attributes inherited from Storage::Device
PartitionTable mPartitions
 

Detailed Description

A physical device instance managed by an MSC interface.

Constructor & Destructor Documentation

◆ LogicalUnit()

USB::MSC::LogicalUnit::LogicalUnit ( HostDevice device,
uint8_t  lun 
)

Member Function Documentation

◆ getCapacity()

void USB::MSC::LogicalUnit::getCapacity ( uint32_t *  block_count,
uint16_t *  block_size 
)
inline

◆ getId()

uint32_t USB::MSC::LogicalUnit::getId ( ) const
overridevirtual

Obtain device ID.

Return values
uint32_ttypically flash chip ID

Reimplemented from Storage::Device.

◆ getName()

String USB::MSC::LogicalUnit::getName ( ) const
overridevirtual

Obtain unique device name.

Implements Storage::Device.

◆ getType()

Type USB::MSC::LogicalUnit::getType ( ) const
inlineoverridevirtual

Obtain device type.

Implements Storage::Device.

◆ operator bool()

USB::MSC::LogicalUnit::operator bool ( ) const
inline

◆ raw_sector_erase_range()

bool USB::MSC::LogicalUnit::raw_sector_erase_range ( storage_size_t  address,
size_t  size 
)
overrideprotectedvirtual

◆ raw_sector_read()

bool USB::MSC::LogicalUnit::raw_sector_read ( storage_size_t  address,
void *  dst,
size_t  size 
)
overrideprotectedvirtual

◆ raw_sector_write()

bool USB::MSC::LogicalUnit::raw_sector_write ( storage_size_t  address,
const void *  src,
size_t  size 
)
overrideprotectedvirtual

◆ raw_sync()

bool USB::MSC::LogicalUnit::raw_sync ( )
overrideprotectedvirtual

◆ read()

int USB::MSC::LogicalUnit::read ( uint32_t  lba,
uint32_t  offset,
void *  buffer,
uint32_t  bufsize 
)
inline

◆ write()

int USB::MSC::LogicalUnit::write ( uint32_t  lba,
uint32_t  offset,
uint8_t *  buffer,
uint32_t  bufsize 
)
inline

Member Data Documentation

◆ device

Storage::Device* USB::MSC::LogicalUnit::device

◆ readOnly

bool USB::MSC::LogicalUnit::readOnly

The documentation for this class was generated from the following files: