Logo
DSR GreenBOSS  1.1.0
Data Structures | Macros | Typedefs | Functions

Data Structures

union  zb_gpdf_mac_addr_flds_u
 MAC addressing fields of GPDF as they are transmitted over the air. More...
 
struct  zb_mac_mhr_s
 Parser MAC header. More...
 

Macros

#define ZB_ADDR_NO_ADDR   0x00U
 802.15: 0x00 = no address (addressing fields omitted, see 7.2.1.1.8). More...
 
#define ZB_ADDR_16BIT_MULTICAST   0x01U
 802.15: 0x01 = reserved. More...
 
#define ZB_ADDR_16BIT_GROUP   ZB_ADDR_16BIT_MULTICAST
 APS: 0x01 = 16-bit group address for DstAddress. More...
 
#define ZB_ADDR_16BIT_DEV_OR_BROADCAST   0x02U
 802.15: 0x02 = 16-bit short address. More...
 
#define ZB_ADDR_64BIT_DEV   0x03U
 802.15: 0x03 = 64-bit extended address. More...
 
#define ZB_BROADCAST_PAN_ID   0xFFFFU
 Broadcast Pan ID value. More...
 
#define ZB_FCF_GET_DST_ADDRESSING_MODE(p_fcf)   (((( ( ( const zb_uint8_t* ) ( p_fcf ) )[ZB_PKT_16B_FIRST_BYTE] ) & 0x0CU) ) >> 2U )
 Gets source addressing mode subfield in frame control field (FCF). More...
 
#define ZB_FCF_GET_SRC_ADDRESSING_MODE(p_fcf)   ( (( ( ( ( const zb_uint8_t* ) ( p_fcf ) )[ZB_PKT_16B_FIRST_BYTE] ) & 0xC0U )) >> 6U )
 Gets source addressing mode subfield in frame control field (FCF). More...
 
#define ZB_FCF_GET_PANID_COMPRESSION_BIT(p_fcf)   (( ( ( ( const zb_uint8_t* ) ( p_fcf ) )[ZB_PKT_16B_ZERO_BYTE] ) & 0x40U ))
 Gets Pan ID compression bit subfield in frame control field (FCF). More...
 

Typedefs

typedef struct zb_mac_mhr_s zb_mac_mhr_t
 Parser MAC header. More...
 

Functions

void zb_mac_init ()
 Inits ZGPD MAC HW. More...
 
void zb_mac_set_ieee_addr (const zb_ieee_addr_t ieee_addr)
 Inits ZGPD MAC IEEE address. More...
 
zb_uint8_t zb_mac_frame_prepare (zb_uint8_t *buffer, const gboss_device_config_t *device_config, zb_uint8_t sequence_number, zb_uint16_t dst_pan_id)
 Prepares a packet to be sent. More...
 
void zb_mac_send (zb_uint8_t *buf, zb_uint8_t repetitions)
 Sends ZGPD frame through one channel. More...
 
void zb_mac_sync_wait_tx_complete (void)
 Blocks waiting for TX complete. More...
 
void zb_mac_set_tx_power (zb_int8_t power)
 Sets the TX power on the transmitter (in dBm). More...
 
void zb_mac_set_tx_channel (zb_int8_t channel)
 Sets RF channel to be used. More...
 
zb_uint8_t zb_parse_mhr (zb_mac_mhr_t *mhr, zb_uint8_t *buf)
 Parses packed mhr header, fills mhr structure. More...
 

Detailed Description

Macro Definition Documentation

§ ZB_ADDR_NO_ADDR

#define ZB_ADDR_NO_ADDR   0x00U

802.15: 0x00 = no address (addressing fields omitted, see 7.2.1.1.8).

§ ZB_ADDR_16BIT_MULTICAST

#define ZB_ADDR_16BIT_MULTICAST   0x01U

802.15: 0x01 = reserved.

NWK: 0x01 = 16-bit multicast group address.

§ ZB_ADDR_16BIT_GROUP

#define ZB_ADDR_16BIT_GROUP   ZB_ADDR_16BIT_MULTICAST

APS: 0x01 = 16-bit group address for DstAddress.

§ ZB_ADDR_16BIT_DEV_OR_BROADCAST

#define ZB_ADDR_16BIT_DEV_OR_BROADCAST   0x02U

802.15: 0x02 = 16-bit short address.

NWK: 0x02 = 16-bit network address of a device or a 16-bit broadcast address.

Referenced by zb_parse_mhr().

§ ZB_ADDR_64BIT_DEV

#define ZB_ADDR_64BIT_DEV   0x03U

802.15: 0x03 = 64-bit extended address.

§ ZB_BROADCAST_PAN_ID

#define ZB_BROADCAST_PAN_ID   0xFFFFU

Broadcast Pan ID value.

§ ZB_FCF_GET_DST_ADDRESSING_MODE

#define ZB_FCF_GET_DST_ADDRESSING_MODE (   p_fcf)    (((( ( ( const zb_uint8_t* ) ( p_fcf ) )[ZB_PKT_16B_FIRST_BYTE] ) & 0x0CU) ) >> 2U )

Gets source addressing mode subfield in frame control field (FCF).

Retrieves value from address_modes.

Parameters
p_fcfPointer to 16bit FCF field

Referenced by zb_parse_mhr().

§ ZB_FCF_GET_SRC_ADDRESSING_MODE

#define ZB_FCF_GET_SRC_ADDRESSING_MODE (   p_fcf)    ( (( ( ( ( const zb_uint8_t* ) ( p_fcf ) )[ZB_PKT_16B_FIRST_BYTE] ) & 0xC0U )) >> 6U )

Gets source addressing mode subfield in frame control field (FCF).

Retrieves value from address_modes.

Parameters
p_fcfPointer to 16bit FCF field.

§ ZB_FCF_GET_PANID_COMPRESSION_BIT

#define ZB_FCF_GET_PANID_COMPRESSION_BIT (   p_fcf)    (( ( ( ( const zb_uint8_t* ) ( p_fcf ) )[ZB_PKT_16B_ZERO_BYTE] ) & 0x40U ))

Gets Pan ID compression bit subfield in frame control field (FCF).

Retrieved value can be 0 or 1.

Parameters
p_fcfPointer to 16bit FCF field.

Typedef Documentation

§ zb_mac_mhr_t

typedef struct zb_mac_mhr_s zb_mac_mhr_t

Parser MAC header.

Mac spec 7.2.1 General MAC frame format.

Note
Actually MHR is of variable length and this structure can't be used for physical data i/o, it is used only for function calls.

Function Documentation

§ zb_mac_init()

void zb_mac_init ( )

Inits ZGPD MAC HW.

Note
Typically the function shouldn't be called by user application because it is called internally by gboss_app_init().

References TRACE_MSG.

Referenced by gboss_app_init().

§ zb_mac_set_ieee_addr()

void zb_mac_set_ieee_addr ( const zb_ieee_addr_t  ieee_addr)

Inits ZGPD MAC IEEE address.

Note
Typically the function shouldn't be called by user application because it is called internally by gboss_app_init().
Parameters
ieee_addrIEEE address of GP device

References ZB_FALSE, and ZB_TRUE.

§ zb_mac_frame_prepare()

zb_uint8_t zb_mac_frame_prepare ( zb_uint8_t buffer,
const gboss_device_config_t device_config,
zb_uint8_t  sequence_number,
zb_uint16_t  dst_pan_id 
)

Prepares a packet to be sent.

The function sets some fields in the MAC header of the packet. Should be called before zb_mac_send() calling.

Note
This function simplifies the selection of MAC header fields for GPD, aiming to save resources.
Parameters
bufferPointer to the start of MAC header area
device_configGPD configuration block
sequence_numberPacket sequential number
dst_pan_idDestination PAN ID
Returns
Size of MAC header

Referenced by zgpd_pkt_send_bidir(), and zgpd_pkt_send_unidir().

§ zb_mac_send()

void zb_mac_send ( zb_uint8_t buf,
zb_uint8_t  repetitions 
)

Sends ZGPD frame through one channel.

Note
The channel to be used for sending should be previously set by the zb_mac_set_tx_channel.
First byte of the buffer is a length of the data. It is not sent actually.

Sends one frame. It is supposed that MAC sequence number was added earlier.

Parameters
bufBuffer to be sent. The first byte in the buffer is a packet length
repetitionsNumber of packets in GPDFS

References TRACE_MSG.

Referenced by zgpd_pkt_send_bidir().

§ zb_mac_sync_wait_tx_complete()

void zb_mac_sync_wait_tx_complete ( void  )

Blocks waiting for TX complete.

References TRACE_MSG.

§ zb_mac_set_tx_power()

void zb_mac_set_tx_power ( zb_int8_t  power)

Sets the TX power on the transmitter (in dBm).

Parameters
powerExpected power in dBm

Referenced by gboss_app_init().

§ zb_mac_set_tx_channel()

void zb_mac_set_tx_channel ( zb_int8_t  channel)

Sets RF channel to be used.

Parameters
channelChannel number in range 11..26 according to 802.15.4 specification

References TRACE_MSG.

Referenced by zgpd_pkt_send_bidir().

§ zb_parse_mhr()

zb_uint8_t zb_parse_mhr ( zb_mac_mhr_t mhr,
zb_uint8_t buf 
)

Parses packed mhr header, fills mhr structure.

Parameters
mhrOut pointer to mhr structure
ptrPointer to packed mhr header buffer
Returns
Packed mhr buffer length

References ZB_ADDR_16BIT_DEV_OR_BROADCAST, ZB_FCF_GET_DST_ADDRESSING_MODE, and ZB_LETOH16.