Functions
Functions
SYSTEM » Non-Volatile Data Storage

## Functions
uint8_t | nvds_init (uint32_t start_addr, uint8_t sectors)
| Initialize the sectors for NVDS. More...
uint8_t | nvds_get (NvdsTag_t tag, uint16_t *p_len, uint8_t *p_buf)
| Read data from NVDS. More...
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. More...
uint8_t | nvds_del (NvdsTag_t tag)
| Delete a tag in NVDS. More...
uint16_t | nvds_tag_length (NvdsTag_t tag)
| Get the length of a tag in NVDS. More...
uint8_t | nvds_drv_func_replace (nvds_drv_func_t *p_nvds_drv_func)
| Replace the drive function. More...
uint8_t | nvds_func_replace (nvds_func_t *p_nvds_func)
| Replace the function in NVDS. More...
void | nvds_retention_size (uint8_t bond_dev_num, mesh_config_dev_num_t mesh_config_dev_num)
| Calculate the space reserved for system. More...

## Detailed Description

## Function Documentation

## ◆ nvds_del()

uint8_t nvds_del | ( | NvdsTag_t | tag | ) |

Delete a tag in NVDS.

Parameters

  [in] | tag | The tag to be deleted.

Returns
  Result of nvds delete.

## ◆ nvds_drv_func_replace()

uint8_t nvds_drv_func_replace | ( | nvds_drv_func_t * | p_nvds_drv_func | ) |

Replace the drive function.

Parameters

  [in] | p_nvds_drv_func | Pointer to drive functions.

Returns
  Result of drive function replace.

## ◆ nvds_func_replace()

uint8_t nvds_func_replace | ( | nvds_func_t * | p_nvds_func | ) |

Replace the function in NVDS.

Parameters

  [in] | p_nvds_func | Pointer to nvds functions.

Returns
  Result nvds function replace.

## ◆ nvds_get()

uint8_t nvds_get | ( | NvdsTag_t | tag,
|  | uint16_t * | p_len,
|  | uint8_t * | p_buf
| ) |  |

Read data from NVDS.

Parameters

  [in] | tag | Valid NVDS item tag.
  [in,out] | p_len | Pointer to the length of data.
  [out] | p_buf | Data is read into the buffer.

Returns
  Result of nvds get.

## ◆ nvds_init()

uint8_t nvds_init | ( | uint32_t | start_addr,
|  | uint8_t | sectors
| ) |  |

Initialize the sectors for NVDS.

Note
  NVDS module will use one more sector flash for garbage collection.

Parameters

  [in] | start_addr | Start address of NVDS area. If the value does not equal zero, it must be sector-aligned. If the value equals zero, NVDS area will locate in the last two sector(s) in flash memory.
  [in] | sectors | The number of sectors.

Returns
  Result of nvds init.

## ◆ 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.

Parameters

  [in] | tag | Valid NVDS item tag.
  [in] | len | Length of data to be written.
  [in] | p_buf | Data to be written.

Returns
  Result of nvds put.

## ◆ nvds_retention_size()

void nvds_retention_size | ( | uint8_t | bond_dev_num,
|  | mesh_config_dev_num_t | mesh_config_dev_num
| ) |  |

Calculate the space reserved for system.

Parameters

  [in] | bond_dev_num | The number of bond device.
  [in] | mesh_config_dev_num | The number of mesh config device.

Returns
  System retention size.

## ◆ nvds_tag_length()

uint16_t nvds_tag_length | ( | NvdsTag_t | tag | ) |

Get the length of a tag in NVDS.

Parameters

  [in] | tag | The tag to get the length.

Returns
  Length of tag data.