Hardware Abstraction Layer (HAL) API Reference

Modules

Common Microcontroller Functions
 
Token Access
 
Sample APIs for Peripheral Access
 
USB Device Stack Library
 
System Timer Control
Functions that provide access to the system clock.
 
Symbol Timer Control
 
HAL Configuration
 
HAL Utilities
 
Bootloader Interfaces
 
Custom Bootloader HAL

Macros

#define TOKEN_NEXT_ADDRESS(region, address)
 By default, tokens are automatically located after the previous token.
 
#define CURRENT_STACK_TOKEN_VERSION   0x03FC
 The current version number of the stack tokens. MSB is the version, LSB is a complement.

Convenience Macros

The following convenience macros are used to simplify the definition process for commonly specified parameters to the basic TOKEN_DEF macro. Please see hal/micro/token.h for a more complete explanation.

#define DEFINE_BASIC_TOKEN(name, type, ...)   TOKEN_DEF(name, CREATOR_##name, 0, 0, type, 1, __VA_ARGS__)
 
#define DEFINE_COUNTER_TOKEN(name, type, ...)   TOKEN_DEF(name, CREATOR_##name, 1, 0, type, 1, __VA_ARGS__)
 
#define DEFINE_INDEXED_TOKEN(name, type, arraysize, ...)   TOKEN_DEF(name, CREATOR_##name, 0, 1, type, (arraysize), __VA_ARGS__)
 
#define DEFINE_FIXED_BASIC_TOKEN(name, type, address, ...)
 
#define DEFINE_FIXED_COUNTER_TOKEN(name, type, address, ...)
 
#define DEFINE_FIXED_INDEXED_TOKEN(name, type, arraysize, address, ...)
 
#define DEFINE_MFG_TOKEN(name, type, address, ...)

Creator Codes

The CREATOR is used as a distinct identifier tag for the token.

The CREATOR is necessary because the token name is defined differently depending on the hardware platform, therefore the CREATOR makes sure that token definitions and data stay tagged and known. The only requirement is that each creator definition must be unique. Please see hal/micro/token.h for a more complete explanation.

#define CREATOR_STACK_NVDATA_VERSION   0xFF01
 
#define CREATOR_STACK_BOOT_COUNTER   0xE263
 
#define CREATOR_STACK_NONCE_COUNTER   0xE563
 
#define CREATOR_STACK_ANALYSIS_REBOOT   0xE162
 
#define CREATOR_STACK_KEYS   0xEB79
 
#define CREATOR_STACK_NODE_DATA   0xEE64
 
#define CREATOR_STACK_CLASSIC_DATA   0xE364
 
#define CREATOR_STACK_ALTERNATE_KEY   0xE475
 
#define CREATOR_STACK_APS_FRAME_COUNTER   0xE123
 
#define CREATOR_STACK_TRUST_CENTER   0xE124
 
#define CREATOR_STACK_NETWORK_MANAGEMENT   0xE125
 
#define CREATOR_STACK_BINDING_TABLE   0xE274
 
#define CREATOR_STACK_CHILD_TABLE   0xFF0D
 
#define CREATOR_STACK_KEY_TABLE   0xE456
 
#define CREATOR_STACK_CERTIFICATE_TABLE   0xE500
 
#define CREATOR_STACK_PSL_DATA   0xE501
 
#define CREATOR_STACK_HOST_REGISTRY   0xE502

Detailed Description

The tokens listed here are divided into three sections (the three main types of tokens mentioned in token.h):

  • Manufacturing
  • Stack
  • Application

For a full explanation of the tokens, see hal/micro/token.h. See token-stack.h for source code.

A set of tokens is predefined in the APPLICATION DATA section at the end of token-stack.h because these tokens are required by the stack, but they are classified as application tokens since they are sized by the application via its CONFIGURATION_HEADER.

The user application can include its own tokens in a header file similar to this one. The macro ::APPLICATION_TOKEN_HEADER should be defined to equal the name of the header file in which application tokens are defined. See the APPLICATION DATA section at the end of token-stack.h for examples of token definitions.

Since token-stack.h contains both the typedefs and the token defs, there are two #defines used to select which one is needed when this file is included. #define DEFINETYPES is used to select the type definitions and #define DEFINETOKENS is used to select the token definitions. Refer to token.h and token.c to see how these are used.

EM35x Microprocessors

HAL function names have the following prefix conventions:

halCommon: API that is used by the EmberZNet stack and can also be called from an application. This API must be implemented. Custom applications can change the implementation of the API but its functionality must remain the same.

hal: API that is used by sample applications. Custom applications can remove this API or change its implementation as they see fit.

halStack: API used only by the EmberZNet stack. This API must be implemented and should not be directly called from any application. Custom applications can change the implementation of the API, but its functionality must remain the same.

halInternal: API that is internal to the HAL. The EmberZNet stack and applications must never call this API directly. Custom applications can change this API as they see fit. However, be careful not to impact the functionalty of any halStack or halCommon APIs.

See also hal.h.

Macro Definition Documentation

#define CREATOR_STACK_ALTERNATE_KEY   0xE475
#define CREATOR_STACK_ANALYSIS_REBOOT   0xE162
#define CREATOR_STACK_APS_FRAME_COUNTER   0xE123
#define CREATOR_STACK_BINDING_TABLE   0xE274
#define CREATOR_STACK_BOOT_COUNTER   0xE263
#define CREATOR_STACK_CERTIFICATE_TABLE   0xE500
#define CREATOR_STACK_CHILD_TABLE   0xFF0D
#define CREATOR_STACK_CLASSIC_DATA   0xE364
#define CREATOR_STACK_HOST_REGISTRY   0xE502
#define CREATOR_STACK_KEY_TABLE   0xE456
#define CREATOR_STACK_KEYS   0xEB79
#define CREATOR_STACK_NETWORK_MANAGEMENT   0xE125
#define CREATOR_STACK_NODE_DATA   0xEE64
#define CREATOR_STACK_NONCE_COUNTER   0xE563
#define CREATOR_STACK_NVDATA_VERSION   0xFF01
#define CREATOR_STACK_PSL_DATA   0xE501
#define CREATOR_STACK_TRUST_CENTER   0xE124
#define CURRENT_STACK_TOKEN_VERSION   0x03FC

Please see hal/micro/token.h for a more complete explanation.

#define DEFINE_BASIC_TOKEN (   name,
  type,
  ... 
)    TOKEN_DEF(name, CREATOR_##name, 0, 0, type, 1, __VA_ARGS__)
#define DEFINE_COUNTER_TOKEN (   name,
  type,
  ... 
)    TOKEN_DEF(name, CREATOR_##name, 1, 0, type, 1, __VA_ARGS__)
#define DEFINE_FIXED_BASIC_TOKEN (   name,
  type,
  address,
  ... 
)
Value:
TOKEN_NEXT_ADDRESS(name, (address)) \
TOKEN_DEF(name, CREATOR_##name, 0, 0, type, 1, __VA_ARGS__)
#define TOKEN_NEXT_ADDRESS(region, address)
By default, tokens are automatically located after the previous token.
Definition: token-stack.h:60
TOKEN_DEF
#define TOKEN_DEF(name, creator, iscnt, isidx, type, arraysize,...)
Definition: cortexm3/token.h:181
#define DEFINE_FIXED_COUNTER_TOKEN (   name,
  type,
  address,
  ... 
)
Value:
TOKEN_NEXT_ADDRESS(name, (address)) \
TOKEN_DEF(name, CREATOR_##name, 1, 0, type, 1, __VA_ARGS__)
#define TOKEN_NEXT_ADDRESS(region, address)
By default, tokens are automatically located after the previous token.
Definition: token-stack.h:60
TOKEN_DEF
#define TOKEN_DEF(name, creator, iscnt, isidx, type, arraysize,...)
Definition: cortexm3/token.h:181
#define DEFINE_FIXED_INDEXED_TOKEN (   name,
  type,
  arraysize,
  address,
  ... 
)
Value:
TOKEN_NEXT_ADDRESS(name, (address)) \
TOKEN_DEF(name, CREATOR_##name, 0, 1, type, (arraysize), __VA_ARGS__)
#define TOKEN_NEXT_ADDRESS(region, address)
By default, tokens are automatically located after the previous token.
Definition: token-stack.h:60
TOKEN_DEF
#define TOKEN_DEF(name, creator, iscnt, isidx, type, arraysize,...)
Definition: cortexm3/token.h:181
#define DEFINE_INDEXED_TOKEN (   name,
  type,
  arraysize,
  ... 
)    TOKEN_DEF(name, CREATOR_##name, 0, 1, type, (arraysize), __VA_ARGS__)
#define DEFINE_MFG_TOKEN (   name,
  type,
  address,
  ... 
)
Value:
TOKEN_NEXT_ADDRESS(name, (address)) \
TOKEN_MFG(name, CREATOR_##name, 0, 0, type, 1, __VA_ARGS__)
#define TOKEN_NEXT_ADDRESS(region, address)
By default, tokens are automatically located after the previous token.
Definition: token-stack.h:60
#define TOKEN_NEXT_ADDRESS (   region,
  address 
)

If a token needs to be placed at a specific location, one of the DEFINE_FIXED_* definitions should be used. This macro is inherently used in the DEFINE_FIXED_* definition to locate a token, and under special circumstances (such as manufacturing tokens) it may be explicitely used.

Parameters
regionA name for the next region being located.
addressThe address of the beginning of the next region.