Settings specific macros. More...

Macros

#define GOS_NVM_TYPE_MAX_VALUE 31
#define GOS_NVM_SUBTYPE_MAX_VALUE 127
#define GOS_NVM_ENTRY_MAX_LENGTH 640
#define GOS_NVM_MEMORY_SECTION_SIZE PLATFORM_NVM_USER_SETTINGS_SECTION_SIZE
#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
type name of NVM entry type
subtype name of NVM entry subtype
array_type The data type of each array element
array_length Number of element in array
default_value The 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
type name of NVM entry type
subtype name of NVM entry subtype
data_type The data type of the NVM entry
default_value The default value of the NVM entry
Examples:
cloud/coap_demo/nvm_defaults.c , cloud/dps_demo/nvm_defaults.c , cloud/mqtt_demo/nvm_defaults.c , demo/uart_blaster/nvm/nvm_defaults.c , hurricane/arducam/settings.c , hurricane/gps/nvm_defaults.c , hurricane/security_camera/settings.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
type name of NVM entry type
subtype name of NVM entry subtype
subtype_value numeric value of NVM entry subtype (0-127)
length Maximum length of the entry's data
Examples:
cloud/coap_demo/nvm_settings.h , cloud/dps_demo/nvm_settings.h , cloud/mqtt_demo/nvm_settings.h , demo/uart_blaster/nvm/nvm_settings.h , hurricane/arducam/settings.c , hurricane/gps/nvm_settings.h , hurricane/security_camera/settings.c , 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
type name of type this subtype belongs
subtype name of the subtype
value Numeric 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_ENTRY_MAX_LENGTH

#define GOS_NVM_ENTRY_MAX_LENGTH   640

The maximum size in bytes of an NVM entry

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
type name of NVM entry type
subtype name of NVM entry subtype
value_ptr Pointer 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/dps_demo/main.c , cloud/mqtt_demo/main.c , demo/uart_blaster/main.c , hurricane/arducam/settings.c , hurricane/gps/main.c , hurricane/security_camera/settings.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
type The NVM entry 'type'
subtype The NVM entry 'subtype'

GOS_NVM_MEMORY_SECTION_SIZE

#define GOS_NVM_MEMORY_SECTION_SIZE   PLATFORM_NVM_USER_SETTINGS_SECTION_SIZE

The maximum size of the NVM memory section This is platform dependent but is typically 4K

GOS_NVM_SUBTYPE_MAX_VALUE

#define GOS_NVM_SUBTYPE_MAX_VALUE   127

The maximum value of an NVM entry 'subtype'

GOS_NVM_TYPE_MAX_VALUE

#define GOS_NVM_TYPE_MAX_VALUE   31

The maximum value of an NVM entry 'type'

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
type name of NVM entry type
subtype name of NVM entry subtype
value Pointer 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
type name of NVM entry type
subtype name of NVM entry subtype
value Pointer to buffer containing new NVM entry value
Returns
gos_result_t , the result of updating