libxr 1.0
Want to be the best embedded framework
Loading...
Searching...
No Matches
LibXR::Flash Class Referenceabstract

Abstract base class representing a flash memory interface. 抽象基类,表示闪存接口。 More...

#include <flash.hpp>

Inheritance diagram for LibXR::Flash:
Collaboration diagram for LibXR::Flash:

Public Member Functions

 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. 向闪存写入数据。
 

Data Fields

size_t min_erase_size_
 Minimum erasable block size in bytes. 最小可擦除块大小(字节)。
 
size_t min_write_size_
 Minimum writable block size in bytes. 最小可写块大小(字节)。
 
RawData flash_area_
 

Detailed Description

Abstract base class representing a flash memory interface. 抽象基类,表示闪存接口。

Definition at line 15 of file flash.hpp.

Constructor & Destructor Documentation

◆ Flash()

LibXR::Flash::Flash ( size_t  min_erase_size,
size_t  min_write_size,
RawData  flash_area 
)
inline

Constructs a Flash object with specified properties. 构造函数,初始化闪存属性。

Parameters
min_erase_sizeMinimum erasable block size in bytes. 最小可擦除块大小(字节)。
min_write_sizeMinimum writable block size in bytes. 最小可写块大小(字节)。
flash_areaMemory area allocated for flash operations. 用于闪存操作的存储区域。

Definition at line 27 of file flash.hpp.

31 {
32 }
size_t min_write_size_
Minimum writable block size in bytes. 最小可写块大小(字节)。
Definition flash.hpp:36
size_t min_erase_size_
Minimum erasable block size in bytes. 最小可擦除块大小(字节)。
Definition flash.hpp:34
RawData flash_area_
Definition flash.hpp:38
constexpr auto min(T1 a, T2 b) -> typename std::common_type< T1, T2 >::type
计算两个数的最小值

Member Function Documentation

◆ Erase()

virtual ErrorCode LibXR::Flash::Erase ( size_t  offset,
size_t  size 
)
pure virtual

Erases a section of the flash memory. 擦除闪存的指定区域。

Parameters
offsetThe starting offset of the section to erase. 要擦除的起始偏移地址。
sizeThe size of the section to erase. 要擦除的区域大小。
Returns
ErrorCode indicating success or failure. 返回操作结果的错误码。

Implemented in LibXR::LinuxBinaryFileFlash< FLASH_SIZE >, and LibXR::STM32Flash< SECTOR_COUNT, START_SECTOR >.

◆ Write()

virtual ErrorCode LibXR::Flash::Write ( size_t  offset,
ConstRawData  data 
)
pure virtual

Writes data to the flash memory. 向闪存写入数据。

Parameters
offsetThe starting offset to write data. 数据写入的起始偏移地址。
dataThe data to be written. 需要写入的数据。
Returns
ErrorCode indicating success or failure. 返回操作结果的错误码。

Implemented in LibXR::LinuxBinaryFileFlash< FLASH_SIZE >, and LibXR::STM32Flash< SECTOR_COUNT, START_SECTOR >.

Field Documentation

◆ flash_area_

RawData LibXR::Flash::flash_area_

Memory area allocated for flash operations. 用于闪存操作的存储区域。

Definition at line 38 of file flash.hpp.

◆ min_erase_size_

size_t LibXR::Flash::min_erase_size_
Initial value:
=
0

Minimum erasable block size in bytes. 最小可擦除块大小(字节)。

Definition at line 34 of file flash.hpp.

◆ min_write_size_

size_t LibXR::Flash::min_write_size_
Initial value:
=
0

Minimum writable block size in bytes. 最小可写块大小(字节)。

Definition at line 36 of file flash.hpp.


The documentation for this class was generated from the following file: