6#include "libxr_def.hpp"
8#include "libxr_type.hpp"
43 Flash(
size_t min_erase_size,
size_t min_write_size,
RawData flash_area);
93 size_t min_erase_size_ =
95 size_t min_write_size_ =
只读原始数据视图 / Immutable raw data view
抽象基类,表示闪存接口。 Abstract base class representing a flash memory interface.
Flash(size_t min_erase_size, size_t min_write_size, RawData flash_area)
构造函数,初始化闪存属性。 Constructs a Flash object with specified properties.
size_t Size() const
获取闪存存储区域的大小 / Returns the size of the flash memory area.
size_t MinWriteSize() const
获取最小可写块大小(字节) / Returns the minimum writable block size in bytes.
virtual ErrorCode Erase(size_t offset, size_t size)=0
擦除闪存的指定区域 / Erases a section of the flash memory.
virtual ErrorCode Write(size_t offset, ConstRawData data)=0
向闪存写入数据 / Writes data to the flash memory.
virtual ErrorCode Read(size_t offset, RawData data)
从闪存中读取数据 / Reads data from the flash memory.
size_t MinEraseSize() const
获取最小可擦除块大小(字节)。 Returns the minimum erasable block size in bytes.
可写原始数据视图 / Mutable raw data view
size_t size_
数据字节数 / Data size in bytes
LibXR 命名空间 / LibXR namespace.
ErrorCode
定义错误码枚举 / Defines an enumeration for error codes
一段连续、大小相同的扇区 / A run of contiguous sectors of equal size
uint32_t sector_count
扇区个数 / Number of sectors
uint32_t address
第一个扇区的地址 / Address of the first sector
uint32_t sector_size
每个扇区的字节数 / Bytes per sector