18 #ifndef MBED_FLASHIAP_BLOCK_DEVICE_H 19 #define MBED_FLASHIAP_BLOCK_DEVICE_H 24 #include "blockdevice/BlockDevice.h" 25 #include "platform/mbed_toolchain.h" 39 uint32_t
size = MBED_CONF_FLASHIAP_BLOCK_DEVICE_SIZE);
62 virtual int read(
void *buffer, mbed::bd_addr_t addr, mbed::bd_size_t
size);
73 virtual int program(
const void *buffer, mbed::bd_addr_t addr, mbed::bd_size_t size);
83 virtual int erase(mbed::bd_addr_t addr, mbed::bd_size_t size);
111 virtual mbed::bd_size_t
get_erase_size(mbed::bd_addr_t addr)
const;
123 virtual mbed::bd_size_t
size()
const;
129 virtual const char *
get_type()
const;
137 virtual bool is_valid_erase(mbed::bd_addr_t addr, mbed::bd_size_t size)
const;
143 mbed::bd_addr_t _base;
144 mbed::bd_size_t _size;
145 bool _is_initialized;
146 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 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.
virtual bool is_valid_erase(mbed::bd_addr_t addr, mbed::bd_size_t size) const
Convenience function for checking block erase validity.