Morse Micro IoT SDK  2.11.2
mmhal_flash.h
1/*
2 * Copyright 2021-2023 Morse Micro
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
17#pragma once
18
19#include <stdbool.h>
20#include <stddef.h>
21#include <stdint.h>
22
23#ifdef __cplusplus
24extern "C"
25{
26#endif
27
32#define MMHAL_FLASH_ERASE_VALUE 0xFF
33
35struct lfs_config;
36
47{
58
61
69};
70
72#define MMHAL_FLASH_PARTITION_CONFIG_DEFAULT { 0, 0, false }
73
86
98int mmhal_flash_erase(uint32_t block_address);
99
109uint32_t mmhal_flash_getblocksize(uint32_t block_address);
110
121int mmhal_flash_read(uint32_t read_address, uint8_t *buf, size_t size);
122
138int mmhal_flash_write(uint32_t write_address, const uint8_t *data, size_t size);
139
155const struct lfs_config *mmhal_get_littlefs_config(void);
156
157#ifdef __cplusplus
158}
159#endif
160
int mmhal_flash_erase(uint32_t block_address)
Erases a specified block of flash.
uint32_t mmhal_flash_getblocksize(uint32_t block_address)
Returns the size of the flash block at the specified address.
const struct lfs_config * mmhal_get_littlefs_config(void)
Get LittleFS configuration.
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.
const struct mmhal_flash_partition_config * mmhal_get_mmconfig_partition(void)
Get MMCONFIG flash partition configuration.
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.
static unsigned char buf[1024]
Statically allocated buffer for MQTT.
Definition: mqttdemo.c:153
Flash partition configuration structure.
Definition: mmhal_flash.h:47
uint32_t partition_size
The size of the partition (in bytes).
Definition: mmhal_flash.h:60
bool not_memory_mapped
If false, then the partition address range (partition_start to partition_start + partition_size) must...
Definition: mmhal_flash.h:68
uint32_t partition_start
The start address of the partition.
Definition: mmhal_flash.h:57