抽象基类,表示闪存接口。 Abstract base class representing a flash memory interface.
More...
#include <flash.hpp>
|
| | Flash (size_t min_erase_size, size_t min_write_size, RawData flash_area) |
| | 构造函数,初始化闪存属性。 Constructs a Flash object with specified properties.
|
| |
| 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.
|
| |
| size_t | MinWriteSize () const |
| | 获取最小可写块大小(字节) / Returns the minimum writable block size in bytes.
|
| |
| size_t | Size () const |
| | 获取闪存存储区域的大小 / Returns the size of the flash memory area.
|
| |
抽象基类,表示闪存接口。 Abstract base class representing a flash memory interface.
Definition at line 31 of file flash.hpp.
◆ Flash()
| Flash::Flash |
( |
size_t | min_erase_size, |
|
|
size_t | min_write_size, |
|
|
RawData | flash_area ) |
构造函数,初始化闪存属性。 Constructs a Flash object with specified properties.
- Parameters
-
| min_erase_size | 最小可擦除块大小(字节)。 Minimum erasable block size in bytes. |
| min_write_size | 最小可写块大小(字节) / Minimum writable block size in bytes. |
| flash_area | 用于闪存操作的存储区域。 Memory area allocated for flash operations. |
Definition at line 7 of file flash.cpp.
8 : min_erase_size_(min_erase_size),
9 min_write_size_(min_write_size),
10 flash_area_(flash_area)
11{
12}
◆ Erase()
| virtual ErrorCode LibXR::Flash::Erase |
( |
size_t | offset, |
|
|
size_t | size ) |
|
pure virtual |
◆ MinEraseSize()
| size_t LibXR::Flash::MinEraseSize |
( |
| ) |
const |
|
inline |
获取最小可擦除块大小(字节)。 Returns the minimum erasable block size in bytes.
- Returns
- 最小可擦除块大小(字节) / size_t Minimum erasable block size in bytes.
Definition at line 76 of file flash.hpp.
76{ return min_erase_size_; }
◆ MinWriteSize()
| size_t LibXR::Flash::MinWriteSize |
( |
| ) |
const |
|
inline |
获取最小可写块大小(字节) / Returns the minimum writable block size in bytes.
- Returns
- 最小可写块大小(字节) / size_t Minimum writable block size in bytes.
Definition at line 83 of file flash.hpp.
83{ return min_write_size_; }
◆ Read()
从闪存中读取数据 / Reads data from the flash memory.
- Parameters
-
| offset | 数据读取的起始偏移地址 / The starting offset to read data. |
| data | 存储读取数据的缓冲区 / Data buffer to store the read data. |
- Returns
- 返回操作结果的错误码 / ErrorCode indicating success or failure.
Definition at line 14 of file flash.cpp.
15{
16 ASSERT(offset + data.
size_ <= flash_area_.
size_);
18 reinterpret_cast<const uint8_t*
>(flash_area_.
addr_) + offset,
20
22}
static void FastCopy(void *dst, const void *src, size_t size)
快速内存拷贝 / Fast memory copy
size_t size_
数据字节数 / Data size in bytes
void * addr_
数据起始地址 / Data start address
@ OK
操作成功 / Operation successful
◆ Size()
| size_t LibXR::Flash::Size |
( |
| ) |
const |
|
inline |
获取闪存存储区域的大小 / Returns the size of the flash memory area.
- Returns
- 闪存存储区域的大小 / size_t Size of the flash memory area.
Definition at line 90 of file flash.hpp.
90{
return flash_area_.
size_; }
◆ Write()
The documentation for this class was generated from the following files: