CI13LC SDK API手册  2.1.1
本手册用于描述CI13LC SDK各个组件和驱动API
枚举 | 函数
nv_data

用于保存用户数据到flash,包含对用户数据的初始化,写入、读取、删除等功能。 更多...

枚举

enum  cinv_item_ret_t {
  CINV_ITEM_UNINIT,
  CINV_OPER_FAILED,
  CINV_OPER_SUCCESS,
  CINV_ITEM_LEN_ERR
}
 nvdata function return value 更多...
 

函数

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_addrnvdata region start address from flash
sizenvdata region size

◆ cinv_item_delete()

cinv_item_ret_t cinv_item_delete ( uint32_t  id)

Delete data item from nvdata.

参数
idNvdata item id
返回值
CINV_ITEM_UNINITId did not exist and was created successfully.
CINV_OPER_SUCCESSDelete ok.
CINV_OPER_FAILEDFailure to delete.
CINV_ITEM_LEN_ERRItem length error

◆ cinv_item_init()

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().

参数
idNvdata item id
lenNvdata item length
bufNvdata item data pointer
返回值
CINV_ITEM_UNINITId did not exist and was created successfully.
CINV_OPER_SUCCESSId already existed, no action taken.
CINV_OPER_FAILEDFailure to find or create id.
CINV_ITEM_LEN_ERRItem 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.

参数
idNvdata item id
lenRead length of this nvdata item
bufNvdata item data pointer
real_lenNvdata item real length to read.
返回值
CINV_ITEM_UNINITId did not exist.
CINV_OPER_SUCCESSRead ok.
CINV_OPER_FAILEDFailure to read.

◆ cinv_item_write()

cinv_item_ret_t cinv_item_write ( uint32_t  id,
uint16_t  len,
void *  buf 
)

Write a data item to nvdata.

参数
idNvdata item id
lenNvdata item length
bufNvdata item data pointer
返回值
CINV_ITEM_UNINITId did not exist.
CINV_OPER_SUCCESSWrite ok.
CINV_OPER_FAILEDFailure to wirte.
CINV_ITEM_LEN_ERRItem length error

◆ cinv_register_hotid()

cinv_item_ret_t cinv_register_hotid ( uint32_t  hot_id)

register hotid.

参数
idNvdata item id
返回值
CINV_OPER_SUCCESSId already existed, no action taken.
CINV_OPER_FAILEDFailure to find or create id.