SmartSnippets DA1459x SDK
Files | Typedefs | Functions

NV parameters adapter. More...

Files

file  ad_nvparam.h
 NV Parameters adapter API.
 

Typedefs

typedef void * nvparam_t
 NV-Parameters area handle. More...
 

Functions

nvparam_t ad_nvparam_open (const char *area_name)
 Open NV-Parameters area. More...
 
void ad_nvparam_close (nvparam_t nvparam)
 Close NV-Parameters area. More...
 
void ad_nvparam_erase_all (nvparam_t nvparam)
 Erase NV-Parameters area. More...
 
void ad_nvparam_erase (nvparam_t nvparam, uint8_t tag)
 Erase single NV-Parameter. More...
 
uint16_t ad_nvparam_read_offset (nvparam_t nvparam, uint8_t tag, uint16_t offset, uint16_t length, void *data)
 Read parameter value with offset. More...
 
__STATIC_INLINE uint16_t ad_nvparam_read (nvparam_t nvparam, uint8_t tag, uint16_t length, void *data)
 Read parameter value. More...
 
uint16_t ad_nvparam_write (nvparam_t nvparam, uint8_t tag, uint16_t length, const void *data)
 Write parameter value. More...
 
uint16_t ad_nvparam_get_length (nvparam_t nvparam, uint8_t tag, uint16_t *max_length)
 Get current parameter length. More...
 

Detailed Description

NV parameters adapter.

Typedef Documentation

◆ nvparam_t

typedef void* nvparam_t

NV-Parameters area handle.

This is opaque pointer returned when opening NV-Parameters area and it should not be accessed directly.

Function Documentation

◆ ad_nvparam_close()

void ad_nvparam_close ( nvparam_t  nvparam)

Close NV-Parameters area.

Parameters
[in]nvparamarea handle

◆ ad_nvparam_erase()

void ad_nvparam_erase ( nvparam_t  nvparam,
uint8_t  tag 
)

Erase single NV-Parameter.

This will erase single NV-Parameter to default value

Parameters
[in]nvparamarea handle
[in]tagparameter tag

◆ ad_nvparam_erase_all()

void ad_nvparam_erase_all ( nvparam_t  nvparam)

Erase NV-Parameters area.

This will erase whole parameters area. It's a shortcut to call ad_nvparam_erase() on each parameter.

Parameters
[in]nvparamarea handle

◆ ad_nvparam_get_length()

uint16_t ad_nvparam_get_length ( nvparam_t  nvparam,
uint8_t  tag,
uint16_t *  max_length 
)

Get current parameter length.

For variable length parameters this will return current parameter value length as stored in area. Returned length may be less than parameter length defined. If max_length is not NULL, maximum parameter length will be returned there.

For constant length parameters

If nvparam is NULL or tag points to invalid parameter, 0 will be returned.

Parameters
[in]nvparamarea handle
[in]tagparameter tag
[out]max_lengthmaximum parameter length (optional)
Returns
current parameter length

◆ ad_nvparam_open()

nvparam_t ad_nvparam_open ( const char *  area_name)

Open NV-Parameters area.

Note
In Debug configuration this call will check consistency of area configuration (i.e. whether parameters do not overlap each other) and will assert on error.
Parameters
[in]area_namearea configuration name
Returns
area handle or NULL if failed

◆ ad_nvparam_read()

__STATIC_INLINE uint16_t ad_nvparam_read ( nvparam_t  nvparam,
uint8_t  tag,
uint16_t  length,
void *  data 
)

Read parameter value.

This call has the same effect as calling ad_nvparam_read_offset() with offset set to 0.

Parameters
[in]nvparamarea handle
[in]tagparameter tag
[in]lengthrequested length
[out]dataoutput buffer
Returns
number of bytes read

◆ ad_nvparam_read_offset()

uint16_t ad_nvparam_read_offset ( nvparam_t  nvparam,
uint8_t  tag,
uint16_t  offset,
uint16_t  length,
void *  data 
)

Read parameter value with offset.

This will read parameter value starting from offset and up to length bytes. Number of bytes read may be different than requested if length of parameter is less than requested (including offset).

If tag points to invalid parameter, 0 will be returned.

Parameters
[in]nvparamarea handle
[in]tagparameter tag
[in]offsetrequested value offset
[in]lengthrequested length
[out]dataoutput buffer
Returns
number of bytes read

◆ ad_nvparam_write()

uint16_t ad_nvparam_write ( nvparam_t  nvparam,
uint8_t  tag,
uint16_t  length,
const void *  data 
)

Write parameter value.

This will write parameter value of length bytes. If parameter length is less than requested length, value will be truncated to fit in parameter area.

If nvparam is NULL or tag points to invalid parameter, 0 will be returned.

Parameters
[in]nvparamarea handle
[in]tagparameter tag
[in]lengthrequested length
[in]datainput buffer
Returns
number of bytes written