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 18 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 5 of file flash.cpp.
9{
10}
size_t min_write_size_
Minimum writable block size in bytes. 最小可写块大小(字节)。
size_t min_erase_size_
Minimum erasable block size in bytes. 最小可擦除块大小(字节)。
◆ Erase()
virtual ErrorCode LibXR::Flash::Erase |
( |
size_t | offset, |
|
|
size_t | size ) |
|
pure virtual |
Erases a section of the flash memory. 擦除闪存的指定区域。
- Parameters
-
offset | The starting offset of the section to erase. 要擦除的起始偏移地址。 |
size | The size of the section to erase. 要擦除的区域大小。 |
- Returns
- ErrorCode indicating success or failure. 返回操作结果的错误码。
Implemented in LibXR::LinuxBinaryFileFlash< FLASH_SIZE >, and LibXR::STM32Flash.
◆ 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 64 of file flash.hpp.
◆ 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 73 of file flash.hpp.
◆ Read()
ErrorCode Flash::Read |
( |
size_t | offset, |
|
|
RawData | data ) |
|
virtual |
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 12 of file flash.cpp.
13{
17
18 return ErrorCode::OK;
19}
size_t size_
数据大小(字节)。 The size of the data (in bytes).
void * addr_
数据存储地址。 The storage address of the data.
◆ 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 82 of file flash.hpp.
◆ Write()
virtual ErrorCode LibXR::Flash::Write |
( |
size_t | offset, |
|
|
ConstRawData | data ) |
|
pure virtual |
◆ flash_area_
Memory area allocated for flash operations. 用于闪存操作的存储区域。
Definition at line 89 of file flash.hpp.
◆ min_erase_size_
size_t LibXR::Flash::min_erase_size_ |
|
private |
Initial value:
Minimum erasable block size in bytes. 最小可擦除块大小(字节)。
Definition at line 85 of file flash.hpp.
◆ min_write_size_
size_t LibXR::Flash::min_write_size_ |
|
private |
Initial value:
Minimum writable block size in bytes. 最小可写块大小(字节)。
Definition at line 87 of file flash.hpp.
The documentation for this class was generated from the following files: