26 #ifndef MBED_BUFFERED_BLOCK_DEVICE_H 27 #define MBED_BUFFERED_BLOCK_DEVICE_H 29 #include "BlockDevice.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);
109 virtual int trim(bd_addr_t addr, bd_size_t size);
154 virtual bd_size_t
size()
const;
160 virtual const char *
get_type()
const;
164 bd_size_t _bd_program_size;
165 bd_size_t _bd_read_size;
167 bd_size_t _write_cache_addr;
168 bool _write_cache_valid;
169 uint8_t *_write_cache;
171 uint32_t _init_ref_count;
172 bool _is_initialized;
185 void invalidate_write_cache();
186 #endif //#if !(DOXYGEN_ONLY) 191 #ifndef MBED_NO_GLOBAL_USING_DIRECTIVE virtual bd_size_t get_program_size() const
Get the size of a programmable block.
virtual int trim(bd_addr_t addr, bd_size_t size)
Mark blocks as no longer in use.
virtual int erase(bd_addr_t addr, bd_size_t size)
Erase blocks from the memory-buffered block device.
virtual bd_size_t get_erase_size() const
Get the size of an erasable block.
BufferedBlockDevice(BlockDevice *bd)
Lifetime of a memory-buffered block device wrapping an underlying block device.
A hardware device capable of writing and reading blocks.
virtual int sync()
Ensure that data on the underlying storage block device is in sync with the memory-buffered block dev...
virtual int get_erase_value() const
Get the value of storage data after being erased.
virtual int deinit()
Deinitialize the buffered-memory block device and its underlying block device.
virtual int init()
Initialize a buffered-memory block device and its underlying block device.
Block device for allowing minimal read and program sizes (of 1) for the underlying BD...
virtual int program(const void *buffer, bd_addr_t addr, bd_size_t size)
Program data to the memory-buffered block device.
virtual bd_size_t get_read_size() const
Get the size of a readable block.
virtual bd_size_t size() const
Get the total size of the underlying device.
virtual int read(void *buffer, bd_addr_t addr, bd_size_t size)
Read blocks from the memory-buffered block device.
virtual const char * get_type() const
Get the underlying BlockDevice class type.
virtual ~BufferedBlockDevice()
Lifetime of the memory-buffered block device.