Loading...
Searching...
No Matches
furi_hal_flash.h
1#pragma once
2
3#include <stdbool.h>
4#include <stdint.h>
5#include <stddef.h>
6
7#ifdef __cplusplus
8extern "C" {
9#endif
10
11#define FURI_HAL_FLASH_OB_RAW_SIZE_BYTES 0x80
12#define FURI_HAL_FLASH_OB_SIZE_WORDS (FURI_HAL_FLASH_OB_RAW_SIZE_BYTES / sizeof(uint32_t))
13#define FURI_HAL_FLASH_OB_TOTAL_VALUES (FURI_HAL_FLASH_OB_SIZE_WORDS / 2)
14
15typedef union {
16 uint8_t bytes[FURI_HAL_FLASH_OB_RAW_SIZE_BYTES];
17 union {
18 struct {
19 uint32_t base;
20 uint32_t complementary_value;
21 } values;
22 uint64_t dword;
23 } obs[FURI_HAL_FLASH_OB_TOTAL_VALUES];
25
26_Static_assert(
27 sizeof(FuriHalFlashRawOptionByteData) == FURI_HAL_FLASH_OB_RAW_SIZE_BYTES,
28 "UpdateManifestOptionByteData size error");
29
32void furi_hal_flash_init(void);
33
38size_t furi_hal_flash_get_base(void);
39
44size_t furi_hal_flash_get_read_block_size(void);
45
50size_t furi_hal_flash_get_write_block_size(void);
51
56size_t furi_hal_flash_get_page_size(void);
57
62size_t furi_hal_flash_get_cycles_count(void);
63
68const void* furi_hal_flash_get_free_start_address(void);
69
74const void* furi_hal_flash_get_free_end_address(void);
75
80size_t furi_hal_flash_get_free_page_start_address(void);
81
86size_t furi_hal_flash_get_free_page_count(void);
87
94void furi_hal_flash_erase(uint8_t page);
95
103void furi_hal_flash_write_dword(size_t address, uint64_t data);
104
113void furi_hal_flash_program_page(const uint8_t page, const uint8_t* data, uint16_t length);
114
119int16_t furi_hal_flash_get_page_number(size_t address);
120
129bool furi_hal_flash_ob_set_word(size_t word_idx, const uint32_t value);
130
136void furi_hal_flash_ob_apply(void);
137
142const FuriHalFlashRawOptionByteData* furi_hal_flash_ob_get_raw_ptr(void);
143
144#ifdef __cplusplus
145}
146#endif
Definition furi_hal_flash.h:15