Token Manager#

Routines for working with tokens.


Introduction#

The token system stores such non-volatile information as the manufacturing ID, channel number, transmit power, and various pieces of information that the application needs to be persistent between device power cycles. The token system is design to abstract implementation details and simplify interacting with differing non-volatile systems. The majority of tokens are stored in NVM3 where they can be rewritten. Manufacturing tokens are stored in dedicated regions of flash and are not designed to be rewritten.

By default the Token Manager pulls in the NVM3 component for storage. The "Token Manager using NVM3" still requires the "Token Manager" component.

Functions#

sl_status_t

Initialize the Token Manager.

sl_status_t
sl_token_get_data(uint32_t token, uint32_t index, void *data, uint32_t length)

Read the data stored in the specified data or manufacturing token.

sl_status_t
sl_token_set_data(uint32_t token, uint32_t index, void *data, uint32_t length)

Writes the data to the specified token.

sl_status_t

Increments the value of a counter token.

sl_status_t
sl_token_delete_token(uint32_t token)

This call support deleting manufacturing tokens from NVM3 region only when NVM3 override is enabled.

sl_status_t
sl_token_get_manufacturing_data(uint32_t token, uint32_t index, void *data, uint32_t length)

Read the data associated with the specified manufacturing token.

sl_status_t
sl_token_set_manufacturing_data(uint32_t token, void *data, uint32_t length)

Writes data to a manufacturing token.

Macros#

#define
NVM3KEY_MFG_TOKEN_RANGE (NVM3KEY_MFG_TOKEN_RANGE_ID << NVM3KEY_MFG_TOKEN_RANGE_ID_SHIFT)

Function Documentation#

sl_token_init#

sl_status_t sl_token_init (void )

Initialize the Token Manager.

Parameters
N/A

Note

  • This function must be called before any other sl_token functions. If it does not return success, the other sl_token functions will not work.

Returns

  • SL_STATUS_OK if successful, an error code otherwise.


Definition at line 55 of file platform/service/token_manager/inc/sl_token_manager.h

sl_token_get_data#

sl_status_t sl_token_get_data (uint32_t token, uint32_t index, void * data, uint32_t length)

Read the data stored in the specified data or manufacturing token.

Parameters
N/Atoken

The NVM3KEY for the token.

N/Aindex

The index to access in the indexed token.

N/Adata

A pointer to where the token data should be placed.

N/Alength

The size of the token data in number of bytes.

Returns

  • SL_STATUS_OK if successful, an error code otherwise.


Definition at line 67 of file platform/service/token_manager/inc/sl_token_manager.h

sl_token_set_data#

sl_status_t sl_token_set_data (uint32_t token, uint32_t index, void * data, uint32_t length)

Writes the data to the specified token.

Parameters
N/Atoken

The NVM3KEY for the token.

N/Aindex

The index to access in the indexed token.

N/Adata

A pointer to the data being written.

N/Alength

The size of the token data in number of bytes.

Returns

  • SL_STATUS_OK if successful, an error code otherwise.


Definition at line 82 of file platform/service/token_manager/inc/sl_token_manager.h

sl_token_increment_counter#

sl_status_t sl_token_increment_counter (uint32_t token)

Increments the value of a counter token.

Parameters
N/Atoken

The NVM3KEY for the token.

This call does not support manufacturing tokens.

Returns

  • SL_STATUS_OK if successful, an error code otherwise.


Definition at line 95 of file platform/service/token_manager/inc/sl_token_manager.h

sl_token_delete_token#

sl_status_t sl_token_delete_token (uint32_t token)

This call support deleting manufacturing tokens from NVM3 region only when NVM3 override is enabled.

Parameters
N/Atoken

- The NVM3 key for the mfg token.

Note

  • This call support deleting manufacturing tokens from NVM3 region.

Returns

  • SL_STATUS_OK if successful, an error code otherwise.


Definition at line 107 of file platform/service/token_manager/inc/sl_token_manager.h

sl_token_get_manufacturing_data#

sl_status_t sl_token_get_manufacturing_data (uint32_t token, uint32_t index, void * data, uint32_t length)

Read the data associated with the specified manufacturing token.

Parameters
N/Atoken

The NVM3KEY for the token.

N/Aindex

The index to access in the indexed token.

N/Adata

A pointer to where the token data should be placed.

N/Alength

The size of the token data in number of bytes.

Returns

  • SL_STATUS_OK if successful, an error code otherwise.


Definition at line 119 of file platform/service/token_manager/inc/sl_token_manager.h

sl_token_set_manufacturing_data#

sl_status_t sl_token_set_manufacturing_data (uint32_t token, void * data, uint32_t length)

Writes data to a manufacturing token.

Parameters
N/Atoken

The NVM3KEY for the token.

N/Adata

A pointer to the data being written.

N/Alength

The size of the token data in number of bytes.

Note

  • Only manufacturing token values that have not been written since the last erase can be written. For areas of flash that cannot be erased by user code, those manufacturing tokens are effectively write-once.

Returns

  • SL_STATUS_OK if successful, an error code otherwise.


Definition at line 137 of file platform/service/token_manager/inc/sl_token_manager.h

Macro Definition Documentation#

NVM3KEY_MFG_TOKEN_RANGE_ID_SHIFT#

#define NVM3KEY_MFG_TOKEN_RANGE_ID_SHIFT
Value:
16u

Definition at line 42 of file platform/service/token_manager/inc/sl_token_manager.h

NVM3KEY_MFG_TOKEN_RANGE_ID#

#define NVM3KEY_MFG_TOKEN_RANGE_ID
Value:
0xF

Definition at line 43 of file platform/service/token_manager/inc/sl_token_manager.h

NVM3KEY_MFG_TOKEN_RANGE#

#define NVM3KEY_MFG_TOKEN_RANGE
Value:
(NVM3KEY_MFG_TOKEN_RANGE_ID << NVM3KEY_MFG_TOKEN_RANGE_ID_SHIFT)

Definition at line 44 of file platform/service/token_manager/inc/sl_token_manager.h