21 #ifndef MBED_CHAINING_BLOCK_DEVICE_H 22 #define MBED_CHAINING_BLOCK_DEVICE_H 24 #include "BlockDevice.h" 25 #include "platform/mbed_assert.h" 64 template <
size_t Size>
66 : _bds(bds), _bd_count(sizeof(bds) / sizeof(bds[0]))
67 , _read_size(0), _program_size(0), _erase_size(0), _size(0), _init_ref_count(0)
101 virtual int read(
void *buffer, bd_addr_t addr, bd_size_t
size);
112 virtual int program(
const void *buffer, bd_addr_t addr, bd_size_t size);
123 virtual int erase(bd_addr_t addr, bd_size_t size);
168 virtual bd_size_t
size()
const;
174 virtual const char *
get_type()
const;
179 bd_size_t _read_size;
180 bd_size_t _program_size;
181 bd_size_t _erase_size;
184 uint32_t _init_ref_count;
185 bool _is_initialized;
191 #ifndef MBED_NO_GLOBAL_USING_DIRECTIVE virtual int read(void *buffer, bd_addr_t addr, bd_size_t size)
Read blocks from a block device.
virtual bd_size_t get_program_size() const
Get the size of a programmable block.
ChainingBlockDevice(BlockDevice *(&bds)[Size])
Lifetime of the memory block device.
virtual ~ChainingBlockDevice()
Lifetime of the memory block device.
A hardware device capable of writing and reading blocks.
virtual const char * get_type() const
Get the BlockDevice class type.
virtual int get_erase_value() const
Get the value of storage when erased.
virtual int program(const void *buffer, bd_addr_t addr, bd_size_t size)
Program blocks to a block device.
virtual bd_size_t size() const
Get the total size of the underlying device.
virtual int init()
Initialize a block device.
virtual bd_size_t get_read_size() const
Get the size of a readable block.
virtual int erase(bd_addr_t addr, bd_size_t size)
Erase blocks on a block device.
virtual int deinit()
Deinitialize a block device.
Block device for chaining multiple block devices with the similar block sizes at sequential addresses...
virtual int sync()
Ensure data on storage is in sync with the driver.
ChainingBlockDevice(BlockDevice **bds, size_t bd_count)
Lifetime of the memory block device.
virtual bd_size_t get_erase_size() const
Get the size of an eraseable block.