Token system for storing non-volatile information. See Tokens for documentation.
License#
Copyright 2018 Silicon Laboratories Inc. www.silabs.com
The licensor of this software is Silicon Laboratories Inc. Your use of this software is governed by the terms of Silicon Labs Master Software License Agreement (MSLA) available at www.silabs.com/about-us/legal/master-software-license-agreement. This software is distributed to you in Source Code format and is governed by the sections of the MSLA applicable to Source Code.
/***************************************************************************/
#ifndef __TOKEN_H__
#define __TOKEN_H__
#if defined(CORTEXM3)
#ifdef MINIMAL_HAL
#include "cortexm3/nvm-token.h"
#include "cortexm3/mfg-token.h"
#else //MINIMAL_HAL
#include "cortexm3/token.h"
#endif //MINIMAL_HAL
#elif (defined(SL_ZIGBEE_TEST) && !defined(ZIGBEE_STACK_ON_HOST))
#include "generic/token-ram.h"
#elif (defined(EZSP_HOST) || defined(UNIX_HOST)) && defined(SL_ZIGBEE_AF_API_TOKEN)
#include "unix/host/token.h"
#else
#error invalid platform
#endif
#include "sl_status.h"
sl_status_t halStackInitTokens(void);
// NOTE:
// The following API as written below is purely for doxygen
// documentation purposes. The live API used in code is actually macros
// defined in the platform specific token headers and provide abstraction
// that can allow easy and efficient access to tokens in different
// implementations.
#ifdef DOXYGEN_SHOULD_SKIP_THIS
#define halCommonGetToken(data, token)
#define halCommonGetMfgToken(data, token)
#define halCommonGetIndexedToken(data, token, index)
#define halCommonSetToken(token, data)
#define halCommonSetIndexedToken(token, index, data)
#define halCommonIncrementCounterToken(token)
#endif //DOXYGEN_SHOULD_SKIP_THIS
#ifndef DOXYGEN_SHOULD_SKIP_THIS
// These interfaces serve only as a glue layer
// to link creator codes to tokens (primarily for *test code)
#define INVALID_EE_ADDRESS 0xFFFF
uint16_t getTokenAddress(uint16_t creator);
uint8_t getTokenSize(uint16_t creator);
uint8_t getTokenArraySize(uint16_t creator);
#endif //DOXYGEN_SHOULD_SKIP_THIS
#endif // __TOKEN_H__
Macros#
Macro that copies the token value from non-volatile storage into a RAM location. This macro can only be used with tokens that are defined using DEFINE_BASIC_TOKEN.
Macro that copies the token value from non-volatile storage into a RAM location. This macro can only be used with tokens that are defined using DEFINE_MFG_TOKEN.
Macro that copies the token value from non-volatile storage into a RAM location. This macro can only be used with tokens that are defined using DEFINE_INDEXED_TOKEN.
Macro that sets the value of a token in non-volatile storage. This macro can only be used with tokens that are defined using DEFINE_BASIC_TOKEN.
Macro that sets the value of a token in non-volatile storage. This macro can only be used with tokens that are defined using DEFINE_INDEXED_TOKEN.
Macro that increments the value of a token that is a counter. This macro can only be used with tokens that are defined using either DEFINE_COUNTER_TOKEN.
Functions#
Initializes and enables the token system. Checks if the manufacturing and stack non-volatile data versions are correct.
Macro Definition Documentation#
halCommonGetToken#
#define halCommonGetToken
Macro that copies the token value from non-volatile storage into a RAM location. This macro can only be used with tokens that are defined using DEFINE_BASIC_TOKEN.
Note
To better understand the parameters of this macro, refer to the example of token usage above.
316
of file /mnt/raid/workspaces/ws.r4wf6JzLX/overlay/gsdk/platform/base/hal/micro/token.h
halCommonGetMfgToken#
#define halCommonGetMfgToken
Macro that copies the token value from non-volatile storage into a RAM location. This macro can only be used with tokens that are defined using DEFINE_MFG_TOKEN.
Note
To better understand the parameters of this macro, refer to the example of token usage above.
331
of file /mnt/raid/workspaces/ws.r4wf6JzLX/overlay/gsdk/platform/base/hal/micro/token.h
halCommonGetIndexedToken#
#define halCommonGetIndexedToken
Macro that copies the token value from non-volatile storage into a RAM location. This macro can only be used with tokens that are defined using DEFINE_INDEXED_TOKEN.
Note
To better understand the parameters of this macro, refer to the example of token usage above.
347
of file /mnt/raid/workspaces/ws.r4wf6JzLX/overlay/gsdk/platform/base/hal/micro/token.h
halCommonSetToken#
#define halCommonSetToken
Macro that sets the value of a token in non-volatile storage. This macro can only be used with tokens that are defined using DEFINE_BASIC_TOKEN.
Note
To better understand the parameters of this macro, refer to the example of token usage above. For EFR32 devices this function must not be called in IRQ context as it can cause data corruption.
363
of file /mnt/raid/workspaces/ws.r4wf6JzLX/overlay/gsdk/platform/base/hal/micro/token.h
halCommonSetIndexedToken#
#define halCommonSetIndexedToken
Macro that sets the value of a token in non-volatile storage. This macro can only be used with tokens that are defined using DEFINE_INDEXED_TOKEN.
Note
To better understand the parameters of this macro, refer to the example of token usage above.
380
of file /mnt/raid/workspaces/ws.r4wf6JzLX/overlay/gsdk/platform/base/hal/micro/token.h
halCommonIncrementCounterToken#
#define halCommonIncrementCounterToken
Macro that increments the value of a token that is a counter. This macro can only be used with tokens that are defined using either DEFINE_COUNTER_TOKEN.
Note
To better understand the parameters of this macro, refer to the example of token usage above.
393
of file /mnt/raid/workspaces/ws.r4wf6JzLX/overlay/gsdk/platform/base/hal/micro/token.h
Function Documentation#
halStackInitTokens#
sl_status_t halStackInitTokens (void )
Initializes and enables the token system. Checks if the manufacturing and stack non-volatile data versions are correct.
N/A |
Returns
An sl_status_t value indicating the success or failure of the command.
292
of file /mnt/raid/workspaces/ws.r4wf6JzLX/overlay/gsdk/platform/base/hal/micro/token.h