Logo
DSR GreenBOSS  1.1.0
Data Structures | Macros | Enumerations
Basic Typedefs

Data Structures

union  zb_addr_u
 Union to address either long or short address. More...
 

Macros

#define ZB_CPP_STR(x)   ZB_CPP_STR2(x)
 Creates a string at compile time, like 0 - "0". More...
 
#define ZB_FALSE   0U
 False value literal. More...
 
#define ZB_TRUE   1U
 True value literal. More...
 

Enumerations

enum  zb_param_e
 General purpose parameter type. More...
 

Error codes

enum  zb_ret_e
 Error codes for non-void stack functions. More...
 
typedef zb_int_t zb_ret_t
 Type for ZB functions returning non-void values. More...
 

Endian change API

Macros to change words endian and access words at potentially non-aligned pointers.

Zigbee uses little endian, see ZB spec, subclause 1.2.1.3.

void zb_htole16 (zb_uint8_t ZB_XDATA *ptr, zb_uint8_t ZB_XDATA *val)
 
void zb_htole32 (zb_uint8_t ZB_XDATA *ptr, zb_uint8_t ZB_XDATA *val)
 
void * zb_put_next_htole16 (zb_uint8_t *dst, zb_uint16_t val)
 Puts next 2-bite value into buffer, moves pointer. More...
 
void * zb_put_next_htole32 (zb_uint8_t *dst, zb_uint32_t val1)
 
void zb_get_next_letoh16 (zb_uint16_t *dst, zb_uint8_t **src)
 
void * zb_put_next_2_htole16 (zb_uint8_t *dst, zb_uint16_t val1, zb_uint16_t val2)
 
void * zb_put_next_2_htole32 (zb_uint8_t *dst, zb_uint32_t val1, zb_uint32_t val2)
 
void zb_memcpy8 (void *vptr, void *vsrc)
 
#define ZB_8BIT_SIZE   1U
 
#define ZB_16BIT_SIZE   2U
 
#define ZB_24BIT_SIZE   3U
 
#define ZB_32BIT_SIZE   4U
 
#define ZB_48BIT_SIZE   6U
 
#define ZB_64BIT_SIZE   8U
 
#define ZB_HTOLE16(ptr, val)   zb_htole16((zb_uint8_t*)(ptr), (zb_uint8_t*)(val))
 
#define ZB_HTOLE16_ONPLACE(val)
 
#define ZB_HTOLE32_ONPLACE(val)   { zb_uint32_t _v = (val); ZB_HTOLE32(&(val), &_v); }
 
#define ZB_HTOLE32(ptr, val)   zb_htole32((zb_uint8_t*)(ptr), (zb_uint8_t*)(val))
 
#define ZB_HTOBE32(ptr, val)   ZB_MEMCPY(ptr, val, 4U)
 
#define ZB_HTOBE16(ptr, val)   (*(zb_uint16_t *)(ptr)) = *((zb_uint16_t *)(val))
 
#define ZB_HTOBE16_VAL(ptr, val)   ((zb_uint16_t *)(ptr))[0] = (val)
 
#define ZB_HTOLE64(ptr, val)   zb_memcpy8(ptr, val)
 
#define ZB_HTOLE32_VAL(ptr, val)
 
#define ZB_HTOLE16_VAL(ptr, val)
 
#define ZB_PUT_NEXT_HTOLE16(ptr, val)
 
#define ZB_PUT_NEXT_HTOLE32(ptr, val)   (ptr) = zb_put_next_htole32((ptr), (val))
 
#define ZB_LETOH64(dst, src)   zb_memcpy8((zb_uint8_t*)dst, (zb_uint8_t*)src)
 
#define ZB_LETOH16   ZB_HTOLE16
 Converts 16-bits integer from the little endian to the host endian. More...
 
#define ZB_LETOH24   ZB_HTOLE24
 
#define ZB_LETOH48   ZB_HTOLE48
 
#define ZB_LETOH32   ZB_HTOLE32
 
#define ZB_BETOH16   ZB_HTOBE16
 
#define ZB_BETOH32   ZB_HTOBE32
 
#define ZB_LETOH16_ONPLACE   ZB_HTOLE16_ONPLACE
 
#define ZB_LETOH32_ONPLACE   ZB_HTOLE32_ONPLACE
 

Base types

typedef char zb_char_t
 Project-local char type. More...
 
typedef unsigned char zb_uchar_t
 Project-local unsigned char type. More...
 
typedef unsigned char zb_uint8_t
 Project-local 1-byte unsigned int type. More...
 
typedef signed char zb_int8_t
 Project-local 1-byte signed int type. More...
 
typedef unsigned short zb_uint16_t
 Project-local 2-byte unsigned int type. More...
 
typedef signed short zb_int16_t
 Project-local 2-byte signed int type. More...
 
typedef unsigned int zb_uint32_t
 Project-local 4-byte unsigned int type. More...
 
typedef signed int zb_int32_t
 Project-local 4-byte signed int type. More...
 
typedef zb_uint32_t zb_bitfield_t
 Type to be used for unsigned bit fields inside structure. More...
 
typedef zb_int32_t zb_sbitfield_t
 Type to be used for signed bit fields inside structure. More...
 
typedef zb_uint32_t zb_size_t
 Project-local size_t type. More...
 
typedef int zb_short_t
 Short int (can fit into single CPU register). More...
 
typedef unsigned int zb_ushort_t
 Short unsigned int (can fit into single CPU register). More...
 
typedef int zb_int_t
 Int (at least 2 bytes). More...
 
typedef unsigned int zb_uint_t
 Unsigned int (at least 2 bytes). More...
 
typedef zb_int_t zb_long_t
 Long int (at least 4 bytes). More...
 
typedef zb_uint_t zb_ulong_t
 Unsigned long int (at least 4 bytes). More...
 
typedef zb_uint8_t zb_bool_t
 General purpose boolean type. More...
 
typedef zb_bitfield_t zb_bitbool_t
 Type to be used for boolean bit fields inside structure. More...
 

Address types and API

typedef zb_uint8_t zb_64bit_addr_t[8]
 8-bytes address (xpanid or long device address) base type. More...
 
typedef zb_64bit_addr_t zb_ieee_addr_t
 Long (64-bit) device address. More...
 
typedef zb_64bit_addr_t zb_ext_pan_id_t
 Long (64-bit) extended Pan ID. More...
 
#define ZB_IS_64BIT_ADDR_ZERO(addr)   (ZB_MEMCMP((addr), (void const*)g_zero_addr, 8) == 0)
 Checks that long address is a zero one. More...
 
#define ZB_64BIT_ADDR_ZERO(addr)   ZB_MEMSET((addr), 0, 8)
 Clears long address. More...
 
#define ZB_64BIT_ADDR_COPY(dst, src)   ZB_MEMCPY(dst, src, sizeof(zb_64bit_addr_t))
 Copies long address. More...
 
#define ZB_64BIT_ADDR_CMP(one, two)   (ZB_MEMCMP((one), (two), 8) == 0)
 Checks if two long addresses are equal. More...
 

Detailed Description

Macro Definition Documentation

§ ZB_CPP_STR

#define ZB_CPP_STR (   x)    ZB_CPP_STR2(x)

Creates a string at compile time, like 0 - "0".

§ ZB_FALSE

#define ZB_FALSE   0U

False value literal.

Referenced by zb_mac_set_ieee_addr(), and zb_nwk_frame_prepare().

§ ZB_TRUE

#define ZB_TRUE   1U

True value literal.

Referenced by zb_mac_set_ieee_addr(), and zb_nwk_frame_prepare().

§ ZB_IS_64BIT_ADDR_ZERO

#define ZB_IS_64BIT_ADDR_ZERO (   addr)    (ZB_MEMCMP((addr), (void const*)g_zero_addr, 8) == 0)

Checks that long address is a zero one.

Parameters
addrAddress to check
Returns
ZB_TRUE if address is zero, ZB_FALSE otherwise

§ ZB_64BIT_ADDR_ZERO

#define ZB_64BIT_ADDR_ZERO (   addr)    ZB_MEMSET((addr), 0, 8)

Clears long address.

Parameters
addrAddress to clear

§ ZB_64BIT_ADDR_COPY

#define ZB_64BIT_ADDR_COPY (   dst,
  src 
)    ZB_MEMCPY(dst, src, sizeof(zb_64bit_addr_t))

Copies long address.

Parameters
dstDestination address
srcSource address

§ ZB_64BIT_ADDR_CMP

#define ZB_64BIT_ADDR_CMP (   one,
  two 
)    (ZB_MEMCMP((one), (two), 8) == 0)

Checks if two long addresses are equal.

Parameters
oneAddress to be compared
twoAddress to compare to
Returns
ZB_TRUE if addresses are equal, ZB_FALSE otherwise

§ ZB_LETOH16

#define ZB_LETOH16   ZB_HTOLE16

Converts 16-bits integer from the little endian to the host endian.

Parameters
ptrDestination pointer. It is ok if it not aligned to 2.
valSource pointer. It is ok if it not aligned to 2.

Referenced by zb_parse_mhr().

Typedef Documentation

§ zb_ret_t

typedef zb_int_t zb_ret_t

Type for ZB functions returning non-void values.

§ zb_char_t

Project-local char type.

§ zb_uchar_t

Project-local unsigned char type.

§ zb_uint8_t

Project-local 1-byte unsigned int type.

§ zb_int8_t

Project-local 1-byte signed int type.

§ zb_uint16_t

Project-local 2-byte unsigned int type.

§ zb_int16_t

Project-local 2-byte signed int type.

§ zb_uint32_t

Project-local 4-byte unsigned int type.

§ zb_int32_t

Project-local 4-byte signed int type.

§ zb_bitfield_t

Type to be used for unsigned bit fields inside structure.

§ zb_sbitfield_t

Type to be used for signed bit fields inside structure.

§ zb_size_t

Project-local size_t type.

§ zb_short_t

Short int (can fit into single CPU register).

§ zb_ushort_t

Short unsigned int (can fit into single CPU register).

§ zb_int_t

Int (at least 2 bytes).

§ zb_uint_t

Unsigned int (at least 2 bytes).

§ zb_long_t

Long int (at least 4 bytes).

§ zb_ulong_t

Unsigned long int (at least 4 bytes).

§ zb_bool_t

General purpose boolean type.

Boolean type can be ZB_TRUE or ZB_FALSE.

For C90, 'zb_bool_t' is an alias of 'zb_uint8_t'. For C99, the availability of the 'stdbool.h' standard header is expected and 'zb_bool_t' is an alias of 'bool'. ZB_FALSE and ZB_TRUE are defined as macros for both standards.

To ensure that zb_bool_t always has the same size of one byte, static compile time assertions were added. See 'zb_common.h'.

§ zb_bitbool_t

Type to be used for boolean bit fields inside structure.

§ zb_64bit_addr_t

zb_64bit_addr_t

8-bytes address (xpanid or long device address) base type.

§ zb_ieee_addr_t

Long (64-bit) device address.

§ zb_ext_pan_id_t

Long (64-bit) extended Pan ID.

Enumeration Type Documentation

§ zb_ret_e

enum zb_ret_e

Error codes for non-void stack functions.

Typically, functions can return OK, BLOCKED or some error. Errors are represented as negative numbers.

Error can be either "generic" or an additional error code.

§ zb_param_e

enum zb_param_e

General purpose parameter type.

Function Documentation

§ zb_put_next_htole16()

void* zb_put_next_htole16 ( zb_uint8_t dst,
zb_uint16_t  val 
)

Puts next 2-bite value into buffer, moves pointer.

To be used for headers composing.

Parameters
dst(in/out) address of the buffer pointer. As a side effect it will be incremented by 2.
valValue