|
libxr
Embedded C++ framework for bare-metal, RTOS and Linux
|
STM32 闪存驱动实现 / STM32 flash driver implementation. More...
#include <stm32_flash.hpp>
Public Member Functions | |
| STM32Flash (const FlashRegion *regions, size_t region_count, uint32_t start_address) | |
| 构造闪存对象 / Construct flash object | |
| STM32Flash (const FlashRegion *regions, size_t region_count) | |
| 用末尾两个扇区构造,供 DatabaseRaw 的主块和备份块使用 / Construct with the last two sectors, for the main and backup blocks of DatabaseRaw | |
| ErrorCode | Erase (size_t offset, size_t size) override |
| 擦除闪存的指定区域 / Erases a section of the flash memory. | |
| ErrorCode | Write (size_t offset, ConstRawData data) override |
| 向闪存写入数据 / Writes data to the flash memory. | |
Public Member Functions inherited from LibXR::Flash | |
| Flash (size_t min_erase_size, size_t min_write_size, RawData flash_area) | |
| 构造函数,初始化闪存属性。 Constructs a Flash object with specified properties. | |
| 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. | |
Static Public Attributes | |
| static constexpr size_t | MIN_WRITE_SIZE = STM32FlashMinWriteSize() |
最小写入单位(字节),由 HAL 的 FLASH_TYPEPROGRAM_* 宏确定;可直接作为 DatabaseRaw 的模板参数 / Minimum write unit in bytes, determined from the HAL FLASH_TYPEPROGRAM_* macros; usable directly as the DatabaseRaw template argument | |
STM32 闪存驱动实现 / STM32 flash driver implementation.
Definition at line 137 of file stm32_flash.hpp.
| STM32Flash::STM32Flash | ( | const FlashRegion * | regions, |
| size_t | region_count, | ||
| uint32_t | start_address ) |
构造闪存对象 / Construct flash object
| regions | 扇区表 / Sector table |
| region_count | 扇区表的段数 / Number of runs in the sector table |
| start_address | 存储区的起始地址,须正好是某个扇区的起点;存储区一直到 Flash 末尾 / Start address of the storage area; must be exactly the start of a sector; the area extends to the end of the Flash |
Definition at line 123 of file stm32_flash.cpp.
| STM32Flash::STM32Flash | ( | const FlashRegion * | regions, |
| size_t | region_count ) |
用末尾两个扇区构造,供 DatabaseRaw 的主块和备份块使用 / Construct with the last two sectors, for the main and backup blocks of DatabaseRaw
| regions | 扇区表 / Sector table |
| region_count | 扇区表的段数 / Number of runs in the sector table |
Definition at line 135 of file stm32_flash.cpp.
|
overridevirtual |
擦除闪存的指定区域 / Erases a section of the flash memory.
| offset | 要擦除的起始偏移地址 / The starting offset of the section to erase. |
| size | 要擦除的区域大小 / The size of the section to erase. |
Implements LibXR::Flash.
Definition at line 140 of file stm32_flash.cpp.
|
overridevirtual |
向闪存写入数据 / Writes data to the flash memory.
| offset | 数据写入的起始偏移地址 / The starting offset to write data. |
| data | 需要写入的数据 / The data to be written. |
Implements LibXR::Flash.
Definition at line 227 of file stm32_flash.cpp.
|
staticconstexpr |
最小写入单位(字节),由 HAL 的 FLASH_TYPEPROGRAM_* 宏确定;可直接作为 DatabaseRaw 的模板参数 / Minimum write unit in bytes, determined from the HAL FLASH_TYPEPROGRAM_* macros; usable directly as the DatabaseRaw template argument
Definition at line 146 of file stm32_flash.hpp.