![]() |
Morse Micro IoT SDK
2.10.4
|
This API provides abstraction from the underlying flash hardware.
Data Structures | |
| struct | mmhal_flash_partition_config |
| Flash partition configuration structure. More... | |
Macros | |
| #define | MMHAL_FLASH_ERASE_VALUE 0xFF |
| This is the value erased flash bytes are set to. More... | |
| #define | MMHAL_FLASH_PARTITION_CONFIG_DEFAULT { 0, 0, false } |
| Initial values for mmhal_flash_partition_config. More... | |
Functions | |
| const struct mmhal_flash_partition_config * | mmhal_get_mmconfig_partition (void) |
| Get MMCONFIG flash partition configuration. More... | |
| int | mmhal_flash_erase (uint32_t block_address) |
| Erases a block of Flash pointed to by the block_address. More... | |
| uint32_t | mmhal_flash_getblocksize (uint32_t block_address) |
| Returns the size of the Flash block at the specified address. More... | |
| int | mmhal_flash_read (uint32_t read_address, uint8_t *buf, size_t size) |
| Read a block of data from the specified Flash address into the buffer. More... | |
| int | mmhal_flash_write (uint32_t write_address, const uint8_t *data, size_t size) |
| Write a block of data to the specified Flash address. More... | |
| const struct lfs_config * | mmhal_get_littlefs_config (void) |
| Get LittleFS configuration. More... | |
| #define MMHAL_FLASH_ERASE_VALUE 0xFF |
This is the value erased flash bytes are set to.
This shall be 0xFF as this is the value that hardware flash erases to.
Definition at line 32 of file mmhal_flash.h.
| #define MMHAL_FLASH_PARTITION_CONFIG_DEFAULT { 0, 0, false } |
Initial values for mmhal_flash_partition_config.
Definition at line 65 of file mmhal_flash.h.
| int mmhal_flash_erase | ( | uint32_t | block_address | ) |
Erases a block of Flash pointed to by the block_address.
The block address may be anywhere within the block to erase. The entire block gets erased. Once erased all bytes in the block shall be MMHAL_FLASH_ERASE_VALUE (0xFF).
| block_address | The address of the block of Flash to erase. |
| uint32_t mmhal_flash_getblocksize | ( | uint32_t | block_address | ) |
Returns the size of the Flash block at the specified address.
| block_address | The address of the Flash block. |
| int mmhal_flash_read | ( | uint32_t | read_address, |
| uint8_t * | buf, | ||
| size_t | size | ||
| ) |
Read a block of data from the specified Flash address into the buffer.
| read_address | The address in Flash to read from. |
| buf | The buffer to read into. |
| size | The number of bytes to read. |
| int mmhal_flash_write | ( | uint32_t | write_address, |
| const uint8_t * | data, | ||
| size_t | size | ||
| ) |
Write a block of data to the specified Flash address.
There is no alignment or minimum size requirement. This function will take care of aligning the data and merging with existing Flash contents. The Flash block is not erased, it is up to the application to determine if the block needs to be erased before programming.
| write_address | The address in Flash to write to. |
| data | A pointer to the block of data to write. |
| size | The number of bytes to write. |
| const struct lfs_config * mmhal_get_littlefs_config | ( | void | ) |
Get LittleFS configuration.
LittleFS initialization is done by littlefs_init() in mmosal_shim_fileio.c. which in turn calls this function to fetch the hardware configuration for LittleFS from the HAL layer. The LittleFS configuration will vary from platform to platform. If LittleFS is not supported by the platform then we just return NULL. This function returns a static pointer to struct lfs_config which is defined in lfs.h.
See mmhal_littlefs.c for the full HAL layer implementation for your platform. See mmosal_shim_fileio.c for the libc shims for LittleFS. See README.md in the src/littlefs folder for detailed information on LittleFS.
| const struct mmhal_flash_partition_config * mmhal_get_mmconfig_partition | ( | void | ) |
Get MMCONFIG flash partition configuration.
MMCONFIG initialization is done by mmconfig_init() in mmconfig.c. which in turn calls this function to fetch the partition configuration for config store from the HAL layer. If config store is not supported by the platform then we just return NULL. This function returns a static pointer to struct mmhal_flash_partition_config.