gr55xx_nvds.h
Go to the documentation of this file.
1
48 #ifndef __GR55XX_NVDS_H__
49 #define __GR55XX_NVDS_H__
50
51 #include <stdint.h>
52 #include <stdbool.h>
53
56 #define NV_TAGCAT_APP 0x4000
62 #define NV_TAG_APP(idx) (NV_TAGCAT_APP | ((idx) & 0x3FFF))
63
68 enum NVDS_STATUS
69 {
70 NVDS_SUCCESS,
71 NVDS_FAIL,
72 NVDS_TAG_NOT_EXISTED,
73 NVDS_SPACE_NOT_ENOUGH,
74 NVDS_LENGTH_OUT_OF_RANGE,
75 NVDS_INVALID_PARA,
76 NVDS_INVALID_START_ADDR,
77 NVDS_INVALID_SECTORS,
78 NVDS_COMPACT_FAILED,
79 NVDS_STORAGE_ACCESS_FAILED ,
80 NVDS_GC_COMPLETE,
81 NVDS_NOT_INIT,
82 NVDS_POINTER_NULL
83 };
89 typedef uint16_t NvdsTag_t;
110 uint8_t nvds_init(uint32_t start_addr, uint8_t sectors);
111
124 uint8_t nvds_get(NvdsTag_t tag, uint16_t *p_len, uint8_t *p_buf);
125
138 uint8_t nvds_put(NvdsTag_t tag, uint16_t len, const uint8_t *p_buf);
139
150 uint8_t nvds_del(NvdsTag_t tag);
151
162 uint16_t nvds_tag_length(NvdsTag_t tag);
163
164
176 bool local_hal_flash_erase_chip(void);
177
195 bool local_hal_flash_erase(const uint32_t addr, const uint32_t size);
196
208 uint32_t local_hal_flash_write(const uint32_t addr, const uint8_t *buf, const uint32_t size);
209
221 uint32_t local_hal_flash_read(const uint32_t addr, uint8_t *buf, const uint32_t size);
222
232 void local_hal_flash_get_info(uint32_t *id, uint32_t *size);
233
242 bool local_hal_flash_get_security(void);
243
252 void local_hal_flash_set_security(bool enable);
253
268 uint32_t local_hal_flash_write_r(const uint32_t addr, const uint8_t *buf, const uint32_t size);
269
274 #endif
275
nvds_del
uint8_t nvds_del(NvdsTag_t tag)
Delete a tag in NVDS.
NVDS_SPACE_NOT_ENOUGH
@ NVDS_SPACE_NOT_ENOUGH
Definition: gr55xx_nvds.h:73
local_hal_flash_write
uint32_t local_hal_flash_write(const uint32_t addr, const uint8_t *buf, const uint32_t size)
Write flash Memory.
local_hal_flash_read
uint32_t local_hal_flash_read(const uint32_t addr, uint8_t *buf, const uint32_t size)
Read flash Memory.
NVDS_POINTER_NULL
@ NVDS_POINTER_NULL
Definition: gr55xx_nvds.h:82
NVDS_COMPACT_FAILED
@ NVDS_COMPACT_FAILED
Definition: gr55xx_nvds.h:78
NVDS_NOT_INIT
@ NVDS_NOT_INIT
Definition: gr55xx_nvds.h:81
local_hal_flash_set_security
void local_hal_flash_set_security(bool enable)
Enable encrypted and decrypted in write-read operations.
local_hal_flash_get_security
bool local_hal_flash_get_security(void)
Get encrypted and decrypted status in write-read operations.
NVDS_LENGTH_OUT_OF_RANGE
@ NVDS_LENGTH_OUT_OF_RANGE
Definition: gr55xx_nvds.h:74
NVDS_GC_COMPLETE
@ NVDS_GC_COMPLETE
Definition: gr55xx_nvds.h:80
NVDS_INVALID_PARA
@ NVDS_INVALID_PARA
Definition: gr55xx_nvds.h:75
NVDS_STORAGE_ACCESS_FAILED
@ NVDS_STORAGE_ACCESS_FAILED
Definition: gr55xx_nvds.h:79
local_hal_flash_erase
bool local_hal_flash_erase(const uint32_t addr, const uint32_t size)
Erase flash region.
local_hal_flash_get_info
void local_hal_flash_get_info(uint32_t *id, uint32_t *size)
Get Flash information.
NVDS_INVALID_SECTORS
@ NVDS_INVALID_SECTORS
Definition: gr55xx_nvds.h:77
NVDS_FAIL
@ NVDS_FAIL
Definition: gr55xx_nvds.h:71
nvds_put
uint8_t nvds_put(NvdsTag_t tag, uint16_t len, const uint8_t *p_buf)
Write data to NVDS. If the tag does not exist, create one.
nvds_tag_length
uint16_t nvds_tag_length(NvdsTag_t tag)
Get the length of a tag in NVDS.
local_hal_flash_erase_chip
bool local_hal_flash_erase_chip(void)
Flash operation API based on hal flash.
NVDS_STATUS
NVDS_STATUS
NVDS Returned Status.
Definition: gr55xx_nvds.h:69
NVDS_SUCCESS
@ NVDS_SUCCESS
Definition: gr55xx_nvds.h:70
local_hal_flash_write_r
uint32_t local_hal_flash_write_r(const uint32_t addr, const uint8_t *buf, const uint32_t size)
Write flash Memory reliably.
NVDS_TAG_NOT_EXISTED
@ NVDS_TAG_NOT_EXISTED
Definition: gr55xx_nvds.h:72
nvds_init
uint8_t nvds_init(uint32_t start_addr, uint8_t sectors)
Initialize the sectors for NVDS.
nvds_get
uint8_t nvds_get(NvdsTag_t tag, uint16_t *p_len, uint8_t *p_buf)
Read data from NVDS.
NVDS_INVALID_START_ADDR
@ NVDS_INVALID_START_ADDR
Definition: gr55xx_nvds.h:76
NvdsTag_t
uint16_t NvdsTag_t
NVDS Item tag.
Definition: gr55xx_nvds.h:89