Morse Micro IoT SDK  2.10.4
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
48{
53
56
62};
63
65#define MMHAL_FLASH_PARTITION_CONFIG_DEFAULT { 0, 0, false }
66
79
89int mmhal_flash_erase(uint32_t block_address);
90
98uint32_t mmhal_flash_getblocksize(uint32_t block_address);
99
108int mmhal_flash_read(uint32_t read_address, uint8_t *buf, size_t size);
109
123int mmhal_flash_write(uint32_t write_address, const uint8_t *data, size_t size);
124
140const struct lfs_config *mmhal_get_littlefs_config(void);
141
142#ifdef __cplusplus
143}
144#endif
145
int mmhal_flash_erase(uint32_t block_address)
Erases a block of Flash pointed to by the block_address.
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.
char buf[1408]
Statically allocated buffer for HTTP GET request, just under 1 packet size.
Definition: sslclient.c:176
Flash partition configuration structure.
Definition: mmhal_flash.h:48
uint32_t partition_size
The size of the partition.
Definition: mmhal_flash.h:55
bool not_memory_mapped
If true, then the partition is not memory mapped and cannot be directly accessed at the physical part...
Definition: mmhal_flash.h:61
uint32_t partition_start
The start address of the partition, this may be a physical address or a relative address depending on...
Definition: mmhal_flash.h:52