Settings specific macros. More...

Macros

#define GOS_NVM_KEY(type, subtype)   _GOS_NVM_ENTRY_KEY(type, subtype)
 
#define GOS_NVM_DEFINE_TYPE(type, value)   _GOS_NVM_DEFINE_ENTRY_TYPE(type, value)
 
#define GOS_NVM_DEFINE_SUBTYPE(type, subtype, value)   _GOS_NVM_DEFINE_ENTRY_SUBTYPE(type, subtype, value)
 
#define GOS_NVM_DEFINE_ENTRY(type, subtype, subtype_value, length)
 
#define GOS_NVM_CREATE_DEFAULT_ENTRY(type, subtype, data_type, default_value)
 
#define GOS_NVM_CREATE_DEFAULT_ARRAY(type, subtype, array_type, array_length, default_value)
 
#define GOS_NVM_GET(type, subtype, value_ptr)   _GOS_NVM_GET_ENTRY(type, subtype, value_ptr)
 
#define GOS_NVM_UPDATE(type, subtype, value)   _GOS_NVM_UPDATE(type, subtype, value)
 
#define GOS_NVM_UPDATE_FORCED(type, subtype, value)   _GOS_NVM_UPDATE_FORCED(type, subtype, value)
 

Detailed Description

Settings specific macros.

Macro Definition Documentation

◆ GOS_NVM_CREATE_DEFAULT_ARRAY

#define GOS_NVM_CREATE_DEFAULT_ARRAY (   type,
  subtype,
  array_type,
  array_length,
  default_value 
)
Value:
const struct {\
gos_nvm_entry_header_t header;\
array_type data[array_length];\
} APP_ ## type ## _ ## subtype ## _default_value SECTION( ".gos.nvm_defaults.APP." STRINGIFY(type) "." STRINGIFY(subtype)) ALIGNED(4) USED = {\
.header = (uint32_t)_GOS_NVM_ENTRY_KEY(type, subtype),\
.data = default_value\
}

Create a default value array for a given NVM entry

Parameters
typename of NVM entry type
subtypename of NVM entry subtype
array_typeThe data type of each array element
array_lengthNumber of element in array
default_valueThe default value of the array
Examples:
system/application_nvm/nvm_defaults.c, and system/custom_commands/nvm_defaults.c.

◆ GOS_NVM_CREATE_DEFAULT_ENTRY

#define GOS_NVM_CREATE_DEFAULT_ENTRY (   type,
  subtype,
  data_type,
  default_value 
)
Value:
const struct {\
gos_nvm_entry_header_t header;\
data_type data;\
} APP_ ## type ## _ ## subtype ## _default_value SECTION( ".gos.nvm_defaults.APP." STRINGIFY(type) "." STRINGIFY(subtype)) ALIGNED(4) USED = {\
.header = (uint32_t)_GOS_NVM_ENTRY_KEY(type, subtype),\
.data = default_value\
}

Create a default value for a given NVM entry

Parameters
typename of NVM entry type
subtypename of NVM entry subtype
data_typeThe data type of the NVM entry
default_valueThe default value of the NVM entry
Examples:
cloud/coap_demo/nvm_defaults.c, cloud/mqtt_demo/nvm_defaults.c, demo/uart_blaster/nvm/nvm_defaults.c, network/uart_tcp_client/nvm_defaults.c, system/application_nvm/nvm_defaults.c, system/custom_commands/nvm_defaults.c, and system/settings_file/nvm_defaults.c.

◆ GOS_NVM_DEFINE_ENTRY

#define GOS_NVM_DEFINE_ENTRY (   type,
  subtype,
  subtype_value,
  length 
)
Value:
_GOS_NVM_DEFINE_ENTRY_SUBTYPE(type, subtype, subtype_value), \
_GOS_NVM_DEFINE_ENTRY(type, subtype, length)

Define a NVM entry

Parameters
typename of NVM entry type
subtypename of NVM entry subtype
subtype_valuenumeric value of NVM entry subtype (0-127)
lengthMaximum length of the entry's data
Examples:
cloud/coap_demo/nvm_settings.h, cloud/mqtt_demo/nvm_settings.h, demo/uart_blaster/nvm/nvm_settings.h, network/uart_tcp_client/nvm_settings.h, system/application_nvm/nvm_settings.h, system/custom_commands/nvm_settings.h, and system/settings_file/nvm_settings.h.

◆ GOS_NVM_DEFINE_SUBTYPE

#define GOS_NVM_DEFINE_SUBTYPE (   type,
  subtype,
  value 
)    _GOS_NVM_DEFINE_ENTRY_SUBTYPE(type, subtype, value)

Define a NVM entry 'subtype' for a given 'type'

Parameters
typename of type this subtype belongs
subtypename of the subtype
valueNumeric value of NVM subtype (0-127)

◆ GOS_NVM_DEFINE_TYPE

#define GOS_NVM_DEFINE_TYPE (   type,
  value 
)    _GOS_NVM_DEFINE_ENTRY_TYPE(type, value)

◆ GOS_NVM_GET

#define GOS_NVM_GET (   type,
  subtype,
  value_ptr 
)    _GOS_NVM_GET_ENTRY(type, subtype, value_ptr)

Retrieve a pointer to a NVM cached entry

This is helper macro for gos_nvm_retrieve() See gos_nvm_retrieve() for more information.

Parameters
typename of NVM entry type
subtypename of NVM entry subtype
value_ptrPointer to hold reference to NVM cache entry
Returns
gos_result_t, the result of retrieving a refernce to the NVM cache entry
Examples:
cloud/coap_demo/commands.c, cloud/coap_demo/main.c, cloud/mqtt_demo/main.c, demo/uart_blaster/main.c, network/uart_tcp_client/main.c, system/application_nvm/main.c, system/custom_commands/main.c, and system/settings_file/main.c.

◆ GOS_NVM_KEY

#define GOS_NVM_KEY (   type,
  subtype 
)    _GOS_NVM_ENTRY_KEY(type, subtype)

A key to lookup a value in the NVM

Parameters
typeThe NVM entry 'type'
subtypeThe NVM entry 'subtype'

◆ GOS_NVM_UPDATE

#define GOS_NVM_UPDATE (   type,
  subtype,
  value 
)    _GOS_NVM_UPDATE(type, subtype, value)

Attempt to update an existing NVM entry in cache

This is a helper macro for gos_nvm_update() See gos_nvm_update() for more information

Parameters
typename of NVM entry type
subtypename of NVM entry subtype
valuePointer to buffer containing new NVM entry value
Returns
gos_result_t, the result of updating

◆ GOS_NVM_UPDATE_FORCED

#define GOS_NVM_UPDATE_FORCED (   type,
  subtype,
  value 
)    _GOS_NVM_UPDATE_FORCED(type, subtype, value)

Attempt to update an existing NVM entry in cache, if the entry does not exist, create a new entry with the given value.

This is a helper macro for gos_nvm_update() See gos_nvm_update() for more information

Parameters
typename of NVM entry type
subtypename of NVM entry subtype
valuePointer to buffer containing new NVM entry value
Returns
gos_result_t, the result of updating