21 #ifndef MBED_MBR_BLOCK_DEVICE_H 22 #define MBED_MBR_BLOCK_DEVICE_H 24 #include "BlockDevice.h" 31 BD_ERROR_INVALID_MBR = -3101,
32 BD_ERROR_INVALID_PARTITION = -3102,
116 virtual int read(
void *buffer, bd_addr_t addr, bd_size_t
size);
127 virtual int program(
const void *buffer, bd_addr_t addr, bd_size_t size);
138 virtual int erase(bd_addr_t addr, bd_size_t size);
183 virtual bd_size_t
size()
const;
209 virtual const char *
get_type()
const;
217 uint32_t _init_ref_count;
218 bool _is_initialized;
224 #ifndef MBED_NO_GLOBAL_USING_DIRECTIVE virtual int program(const void *buffer, bd_addr_t addr, bd_size_t size)
Program blocks to a block device.
Block device for managing a Master Boot Record https://en.wikipedia.org/wiki/Master_boot_record.
virtual bd_size_t size() const
Get the total size of the underlying device.
virtual int init()
Initialize a block device.
virtual uint8_t get_partition_type() const
Get 8-bit type of the partition.
A hardware device capable of writing and reading blocks.
virtual int get_erase_value() const
Get the value of storage when erased.
virtual bd_addr_t get_partition_start() const
Get the offset of the partition on the underlying block device.
virtual int deinit()
Deinitialize a block device.
virtual int get_partition_number() const
Get the partition number.
virtual int sync()
Ensure data on storage is in sync with the driver.
virtual bd_size_t get_program_size() const
Get the size of a programmable block.
virtual bd_size_t get_erase_size() const
Get the size of an erasable block.
virtual bd_addr_t get_partition_stop() const
Get size of partition on underlying block device.
virtual ~MBRBlockDevice()
Lifetime of the block device.
virtual int erase(bd_addr_t addr, bd_size_t size)
Erase blocks on a block device.
virtual bd_size_t get_read_size() const
Get the size of a readable block.
MBRBlockDevice(BlockDevice *bd, int part)
Lifetime of the block device.
virtual int read(void *buffer, bd_addr_t addr, bd_size_t size)
Read blocks from a block device.
static int partition(BlockDevice *bd, int part, uint8_t type, bd_addr_t start)
Format the MBR to contain the following partition.
virtual const char * get_type() const
Get the BlockDevice class type.