21 #ifndef MBED_SLICING_BLOCK_DEVICE_H 22 #define MBED_SLICING_BLOCK_DEVICE_H 24 #include "BlockDevice.h" 25 #include "platform/mbed_assert.h" 74 virtual int read(
void *buffer, bd_addr_t addr, bd_size_t
size);
85 virtual int program(
const void *buffer, bd_addr_t addr, bd_size_t size);
96 virtual int erase(bd_addr_t addr, bd_size_t size);
141 virtual bd_size_t
size()
const;
147 virtual const char *
get_type()
const;
163 virtual bool is_valid_read(bd_addr_t addr, bd_size_t size)
const;
171 virtual bool is_valid_erase(bd_addr_t addr, bd_size_t size)
const;
176 bool _start_from_end;
185 #ifndef MBED_NO_GLOBAL_USING_DIRECTIVE virtual ~SlicingBlockDevice()
Lifetime of a block device.
virtual bd_size_t get_program_size() const
Get the size of a programmable block.
virtual bool is_valid_read(bd_addr_t addr, bd_size_t size) const
Convenience function for checking block read validity.
A hardware device capable of writing and reading blocks.
virtual bool is_valid_erase(bd_addr_t addr, bd_size_t size) const
Convenience function for checking block erase validity.
virtual bool is_valid_program(bd_addr_t addr, bd_size_t size) const
Convenience function for checking block program validity.
virtual const char * get_type() const
Get the BlockDevice class type.
virtual bd_size_t get_erase_size() const
Get the size of an erasable block.
virtual int sync()
Ensure data on storage is in sync with the driver.
virtual int deinit()
Deinitialize a block device.
virtual bd_size_t size() const
Get the total size of the underlying device.
SlicingBlockDevice(BlockDevice *bd, bd_addr_t start, bd_addr_t end=0)
Lifetime of the memory block device.
virtual int read(void *buffer, bd_addr_t addr, bd_size_t size)
Read blocks from a block device.
virtual int program(const void *buffer, bd_addr_t addr, bd_size_t size)
Program blocks to a block device.
virtual int erase(bd_addr_t addr, bd_size_t size)
Erase blocks on a block device.
virtual int get_erase_value() const
Get the value of storage when erased.
virtual int init()
Initialize a block device.
Block device for mapping to a slice of another block device.
virtual bd_size_t get_read_size() const
Get the size of a readable block.