用于保存用户数据到flash,包含对用户数据的初始化,写入、读取、删除等功能。
更多...
|
| void | cinv_init (uint32_t flash_addr, uint32_t size) |
| | initialize the nvdata management information and nvdata region 更多...
|
| |
| cinv_item_ret_t | cinv_item_init (uint32_t id, uint16_t len, void *buf) |
| | If the nvdata item does not already exist, it is created and initialized with the data passed to the function, if any. This function must be called before calling cinv_item_read() or cinv_item_write(). 更多...
|
| |
| cinv_item_ret_t | cinv_item_read (uint32_t id, uint16_t len, void *buf, uint16_t *real_len) |
| | Read data from nvdata. This function can be used to read an entire item or short. Read data is copied into *buf. If input length longer than item real length, read item real length data to *buf. 更多...
|
| |
| cinv_item_ret_t | cinv_item_write (uint32_t id, uint16_t len, void *buf) |
| | Write a data item to nvdata. 更多...
|
| |
| cinv_item_ret_t | cinv_item_delete (uint32_t id) |
| | Delete data item from nvdata. 更多...
|
| |
| cinv_item_ret_t | cinv_register_hotid (uint32_t hot_id) |
| | register hotid. 更多...
|
| |
用于保存用户数据到flash,包含对用户数据的初始化,写入、读取、删除等功能。
◆ cinv_item_ret_t
nvdata function return value
| 枚举值 |
|---|
| CINV_ITEM_UNINIT | Id did not exist and was created successfully
|
| CINV_OPER_FAILED | Id already existed, no action taken
|
| CINV_OPER_SUCCESS | Failure to find or create id
|
| CINV_ITEM_LEN_ERR | Item length error
|
◆ cinv_init()
| void cinv_init |
( |
uint32_t |
flash_addr, |
|
|
uint32_t |
size |
|
) |
| |
initialize the nvdata management information and nvdata region
- 参数
-
| flash_addr | nvdata region start address from flash |
| size | nvdata region size |
◆ cinv_item_delete()
Delete data item from nvdata.
- 参数
-
- 返回值
-
| CINV_ITEM_UNINIT | Id did not exist and was created successfully.
|
| CINV_OPER_SUCCESS | Delete ok. |
| CINV_OPER_FAILED | Failure to delete. |
| CINV_ITEM_LEN_ERR | Item length error |
◆ cinv_item_init()
If the nvdata item does not already exist, it is created and initialized with the data passed to the function, if any. This function must be called before calling cinv_item_read() or cinv_item_write().
- 参数
-
| id | Nvdata item id |
| len | Nvdata item length |
| buf | Nvdata item data pointer |
- 返回值
-
| CINV_ITEM_UNINIT | Id did not exist and was created successfully.
|
| CINV_OPER_SUCCESS | Id already existed, no action taken. |
| CINV_OPER_FAILED | Failure to find or create id. |
| CINV_ITEM_LEN_ERR | Item length error |
◆ cinv_item_read()
| cinv_item_ret_t cinv_item_read |
( |
uint32_t |
id, |
|
|
uint16_t |
len, |
|
|
void * |
buf, |
|
|
uint16_t * |
real_len |
|
) |
| |
Read data from nvdata. This function can be used to read an entire item or short. Read data is copied into *buf. If input length longer than item real length, read item real length data to *buf.
- 参数
-
| id | Nvdata item id |
| len | Read length of this nvdata item |
| buf | Nvdata item data pointer |
| real_len | Nvdata item real length to read. |
- 返回值
-
| CINV_ITEM_UNINIT | Id did not exist.
|
| CINV_OPER_SUCCESS | Read ok. |
| CINV_OPER_FAILED | Failure to read. |
◆ cinv_item_write()
Write a data item to nvdata.
- 参数
-
| id | Nvdata item id |
| len | Nvdata item length |
| buf | Nvdata item data pointer |
- 返回值
-
| CINV_ITEM_UNINIT | Id did not exist.
|
| CINV_OPER_SUCCESS | Write ok. |
| CINV_OPER_FAILED | Failure to wirte. |
| CINV_ITEM_LEN_ERR | Item length error |
◆ cinv_register_hotid()
register hotid.
- 参数
-
- 返回值
-
| CINV_OPER_SUCCESS | Id already existed, no action taken. |
| CINV_OPER_FAILED | Failure to find or create id. |