17 #ifndef MBED_FLASHIAP_BLOCK_DEVICE_H 18 #define MBED_FLASHIAP_BLOCK_DEVICE_H 23 #include "features/storage/blockdevice/BlockDevice.h" 24 #include "platform/mbed_toolchain.h" 38 uint32_t
size = MBED_CONF_FLASHIAP_BLOCK_DEVICE_SIZE);
61 virtual int read(
void *buffer, mbed::bd_addr_t addr, mbed::bd_size_t
size);
72 virtual int program(
const void *buffer, mbed::bd_addr_t addr, mbed::bd_size_t size);
82 virtual int erase(mbed::bd_addr_t addr, mbed::bd_size_t size);
110 virtual mbed::bd_size_t
get_erase_size(mbed::bd_addr_t addr)
const;
122 virtual mbed::bd_size_t
size()
const;
128 virtual const char *
get_type()
const;
136 virtual bool is_valid_erase(bd_addr_t addr, bd_size_t size)
const;
142 mbed::bd_addr_t _base;
143 mbed::bd_size_t _size;
144 bool _is_initialized;
145 uint32_t _init_ref_count;
virtual mbed::bd_size_t get_erase_size() const
Get the size of a eraseable block.
virtual int program(const void *buffer, mbed::bd_addr_t addr, mbed::bd_size_t size)
Program blocks to a block device.
A hardware device capable of writing and reading blocks.
virtual int init()
Initialize a block device.
virtual int read(void *buffer, mbed::bd_addr_t addr, mbed::bd_size_t size)
Read blocks from a block device.
BlockDevice using the FlashIAP API.
virtual mbed::bd_size_t size() const
Get the total size of the underlying device.
FlashIAPBlockDevice(uint32_t address=MBED_CONF_FLASHIAP_BLOCK_DEVICE_BASE_ADDRESS, uint32_t size=MBED_CONF_FLASHIAP_BLOCK_DEVICE_SIZE)
Creates a FlashIAPBlockDevice.
virtual int erase(mbed::bd_addr_t addr, mbed::bd_size_t size)
Erase blocks on a block device.
virtual mbed::bd_size_t get_read_size() const
Get the size of a readable block.
virtual bool is_valid_erase(bd_addr_t addr, bd_size_t size) const
Convenience function for checking block erase validity.
virtual int deinit()
Deinitialize a block device.
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 mbed::bd_size_t get_program_size() const
Get the size of a programable block.