Loading...
Searching...
No Matches
IEEE 802.15.4 frame headers and definitions

IEEE 802.15.4 header definitions and utility functions. More...

Detailed Description

IEEE 802.15.4 header definitions and utility functions.

Modules

 IEEE802.15.4 compile configurations
 

Files

file  ieee802154.h
 IEEE 802.15.4 header definitions.
 

Macros

#define IEEE802154_SFD   (0xa7)
 Default start frame delimiter.
 
#define IEEE802154_FRAME_LEN_MAX   (127U)
 maximum 802.15.4 frame length
 
#define IEEE802154G_FRAME_LEN_MAX   (2047U)
 maximum 802.15.4g-2012 frame length
 
#define IEEE802154_ACK_FRAME_LEN   (5U)
 ACK frame length.
 
#define IEEE802154_LIFS_SYMS   (40U)
 Number of symbols to wait during Long Inter Frame Spacing.
 
#define IEEE802154_SIFS_SYMS   (12U)
 Number of symbols to wait during Short Inter Frame Spacing.
 
#define IEEE802154_SIFS_MAX_FRAME_SIZE   (18U)
 Maximum frame size to consider a frame as short.
 
#define IEEE802154_ACK_TIMEOUT_SYMS   (54)
 ACK Timeout period in symbols.
 
#define IEEE802154_RADIO_RSSI_OFFSET   (-174)
 value of measured power when RSSI is zero.
 
#define IEEE802154_PHY_MR_FSK_PHR_LEN   (2)
 MR-FSK PHY header length.
 
#define IEEE802154_PHY_MR_FSK_2FSK_SFD_LEN   (2)
 MR-FSK SFD length on Filtered 2-FSK.
 
#define IEEE802154G_ATURNAROUNDTIME_US   (1 * US_PER_MS)
 For the SUN PHYs, the value is 1 ms expressed in symbol periods, rounded up to the next integer number of symbol periods using the ceiling() function.
 
#define IEEE802154_ATURNAROUNDTIME_IN_SYMBOLS   (12)
 IEEE Std 802.15.4-2020 Table 11-1—PHY constants: The value is 12 for all other PHYs.
 
#define IEEE802154_CCA_DURATION_IN_SYMBOLS   (8)
 IEEE Std 802.15.4-2020 Table 11-1—PHY constants: For all other PHYs¹, the duration of 8 symbol periods.
 
#define CONFIG_IEEE802154_DEFAULT_CSMA_CA_MIN_BE   (3U)
 IEEE802.15.4 default value for minimum backoff exponent.
 
#define CONFIG_IEEE802154_DEFAULT_CSMA_CA_RETRIES   (4U)
 IEEE802.15.4 default value for maximum number of CSMA-CA retries.
 
#define CONFIG_IEEE802154_DEFAULT_CSMA_CA_MAX_BE   (5U)
 IEEE802.15.4 default value for maximum backoff exponent.
 
#define CONFIG_IEEE802154_CCA_THRESH_DEFAULT   (-70)
 IEEE802.15.4 default value for CCA threshold (in dBm)
 
#define CONFIG_IEEE802154_DEFAULT_MAX_FRAME_RETRANS   (4U)
 IEEE802.15.4 default value for maximum frame retries.
 
#define CONFIG_IEEE802154_AUTO_ACK_DISABLE   0
 Disable Auto ACK support.
 
#define CONFIG_IEEE802154_DEFAULT_ACK_REQ   1
 Request ACKs by default.
 
#define CONFIG_IEEE802154_DSME_CAP_REDUCTION   0
 Enable DSME CAP reduction.
 
#define CONFIG_IEEE802154_DSME_MAC_RESPONSE_WAIT_TIME   (244U)
 Set the maximum DSME MAC response wait time.
 
#define CONFIG_IEEE802154_DSME_SCAN_DURATION   (4U)
 Set the scan duration.
 
#define CONFIG_IEEE802154_DSME_SUPERFRAME_ORDER   (3U)
 Set IEEE 802.15.4 DSME Superframe Order (SO) The SO sets the slot duration to 60 * symbol_time_us * 2^SO usecs.
 
#define CONFIG_IEEE802154_DSME_MULTISUPERFRAME_ORDER   (3U)
 Set IEEE 802.15.4 DSME Multisuperframe Order (MO)
 
#define CONFIG_IEEE802154_DSME_BEACON_ORDER   (3U)
 Set IEEE 802.15.4 DSME Beacon Order (BO)
 
#define CONFIG_IEEE802154_DSME_STATIC_GTS   0
 Use static GTS allocation.
 
#define CONFIG_IEEE802154_DSME_GTS_EXPIRATION   (16U)
 Set expiration time of DSME GTS slot.
 
#define CONFIG_IEEE802154_DSME_MIN_COORD_LQI   (100U)
 Set the minimum LQI to consider a beacon from a coordinator valid.
 

Enumerations

enum  ieee802154_phy_mode_t {
  IEEE802154_PHY_DISABLED , IEEE802154_PHY_BPSK , IEEE802154_PHY_ASK , IEEE802154_PHY_OQPSK ,
  IEEE802154_PHY_MR_OQPSK , IEEE802154_PHY_MR_OFDM , IEEE802154_PHY_MR_FSK
}
 802.15.4 PHY modes More...
 
enum  { IEEE802154_FEC_NONE , IEEE802154_FEC_NRNSC , IEEE802154_FEC_RSC }
 802.15.4 forward error correction schemes More...
 

Functions

size_t ieee802154_set_frame_hdr (uint8_t *buf, const uint8_t *src, size_t src_len, const uint8_t *dst, size_t dst_len, le_uint16_t src_pan, le_uint16_t dst_pan, uint8_t flags, uint8_t seq)
 Initializes an IEEE 802.15.4 MAC frame header in buf.
 
size_t ieee802154_get_frame_hdr_len (const uint8_t *mhr)
 Get length of MAC header.
 
int ieee802154_get_src (const uint8_t *mhr, uint8_t *src, le_uint16_t *src_pan)
 Gets source address from MAC header.
 
int ieee802154_get_dst (const uint8_t *mhr, uint8_t *dst, le_uint16_t *dst_pan)
 Gets destination address from MAC header.
 
int ieee802154_dst_filter (const uint8_t *mhr, uint16_t pan, network_uint16_t short_addr, const eui64_t *ext_addr)
 Check whether a frame pass the IEEE 802.15.4 frame filter.
 
static uint8_t ieee802154_get_seq (const uint8_t *mhr)
 Gets sequence number from MAC header.
 
static eui64_tieee802154_get_iid (eui64_t *eui64, const uint8_t *addr, size_t addr_len)
 Generates an IPv6 interface identifier from an IEEE 802.15.4 address.
 
static int16_t ieee802154_rssi_to_dbm (uint8_t rssi)
 Convert from RSSI scale to dBm.
 
static uint8_t ieee802154_dbm_to_rssi (int16_t dbm)
 Convert from dBm scale to RSSI.
 
const uint8_t ieee802154_addr_bcast [IEEE802154_ADDR_BCAST_LEN]
 Broadcast address.
 
#define IEEE802154_ADDR_BCAST   { 0xff, 0xff }
 Special address definitions.
 
#define IEEE802154_ADDR_BCAST_LEN   (IEEE802154_SHORT_ADDRESS_LEN)
 Length in byte of IEEE802154_ADDR_BCAST.
 
#define IEEE802154_SHORT_ADDRESS_LEN   (2U)
 IEEE 802.15.4 address lengths.
 
#define IEEE802154_LONG_ADDRESS_LEN   (8U)
 long address (EUI-64)
 
#define IEEE802154_MAX_HDR_LEN   (23U)
 IEEE802.15.4 FCF field definitions.
 
#define IEEE802154_MIN_FRAME_LEN   (IEEE802154_FCF_LEN + sizeof(uint8_t))
 
#define IEEE802154_FCF_LEN   (2U)
 
#define IEEE802154_FCS_LEN   (2U)
 
#define IEEE802154_FCF_TYPE_MASK   (0x07)
 
#define IEEE802154_FCF_TYPE_BEACON   (0x00)
 
#define IEEE802154_FCF_TYPE_DATA   (0x01)
 
#define IEEE802154_FCF_TYPE_ACK   (0x02)
 
#define IEEE802154_FCF_TYPE_MACCMD   (0x03)
 
#define IEEE802154_FCF_SECURITY_EN   (0x08)
 enable security
 
#define IEEE802154_FCF_FRAME_PEND   (0x10)
 follow-up frame is pending
 
#define IEEE802154_FCF_ACK_REQ   (0x20)
 acknowledgement requested from receiver
 
#define IEEE802154_FCF_PAN_COMP   (0x40)
 compress source PAN ID
 
#define IEEE802154_FCF_DST_ADDR_MASK   (0x0c)
 
#define IEEE802154_FCF_DST_ADDR_VOID   (0x00)
 no destination address
 
#define IEEE802154_FCF_DST_ADDR_RESV   (0x04)
 reserved address mode
 
#define IEEE802154_FCF_DST_ADDR_SHORT   (0x08)
 destination address length is 2
 
#define IEEE802154_FCF_DST_ADDR_LONG   (0x0c)
 destination address length is 8
 
#define IEEE802154_FCF_VERS_MASK   (0x30)
 
#define IEEE802154_FCF_VERS_V0   (0x00)
 
#define IEEE802154_FCF_VERS_V1   (0x10)
 
#define IEEE802154_FCF_SRC_ADDR_MASK   (0xc0)
 
#define IEEE802154_FCF_SRC_ADDR_VOID   (0x00)
 no source address
 
#define IEEE802154_FCF_SRC_ADDR_RESV   (0x40)
 reserved address mode
 
#define IEEE802154_FCF_SRC_ADDR_SHORT   (0x80)
 source address length is 2
 
#define IEEE802154_FCF_SRC_ADDR_LONG   (0xc0)
 source address length is 8
 
#define IEEE802154_CHANNEL_MIN_SUBGHZ   (0U)
 Channel ranges.
 
#define IEEE802154_CHANNEL_MAX_SUBGHZ   (10U)
 Maximum channel for sub-GHz band.
 
#define IEEE802154_CHANNEL_MIN   (11U)
 Minimum channel for 2.4 GHz band.
 
#define IEEE802154_CHANNEL_MAX   (26U)
 Maximum channel for 2.4 GHz band.
 
#define IEEE802154_PHY_MR_FSK_2FSK_CODED_SFD_0   (0x6F4E)
 For the MR-FSK PHY, the SFD value when PHR + PSDU are coded/uncoded and with phyMRFSKSFD = 0 or 1 respectively.
 
#define IEEE802154_PHY_MR_FSK_2FSK_CODED_SFD_1   (0x632D)
 
#define IEEE802154_PHY_MR_FSK_2FSK_UNCODED_SFD_0   (0x90E4)
 
#define IEEE802154_PHY_MR_FSK_2FSK_UNCODED_SFD_1   (0x7A0E)
 

Macro Definition Documentation

◆ CONFIG_IEEE802154_AUTO_ACK_DISABLE

#define CONFIG_IEEE802154_AUTO_ACK_DISABLE   0

Disable Auto ACK support.

Definition at line 320 of file ieee802154.h.

◆ CONFIG_IEEE802154_CCA_THRESH_DEFAULT

#define CONFIG_IEEE802154_CCA_THRESH_DEFAULT   (-70)

IEEE802.15.4 default value for CCA threshold (in dBm)

Definition at line 306 of file ieee802154.h.

◆ CONFIG_IEEE802154_DEFAULT_ACK_REQ

#define CONFIG_IEEE802154_DEFAULT_ACK_REQ   1

Request ACKs by default.

Definition at line 327 of file ieee802154.h.

◆ CONFIG_IEEE802154_DEFAULT_CSMA_CA_MAX_BE

#define CONFIG_IEEE802154_DEFAULT_CSMA_CA_MAX_BE   (5U)

IEEE802.15.4 default value for maximum backoff exponent.

Definition at line 299 of file ieee802154.h.

◆ CONFIG_IEEE802154_DEFAULT_CSMA_CA_MIN_BE

#define CONFIG_IEEE802154_DEFAULT_CSMA_CA_MIN_BE   (3U)

IEEE802.15.4 default value for minimum backoff exponent.

Definition at line 285 of file ieee802154.h.

◆ CONFIG_IEEE802154_DEFAULT_CSMA_CA_RETRIES

#define CONFIG_IEEE802154_DEFAULT_CSMA_CA_RETRIES   (4U)

IEEE802.15.4 default value for maximum number of CSMA-CA retries.

Definition at line 292 of file ieee802154.h.

◆ CONFIG_IEEE802154_DEFAULT_MAX_FRAME_RETRANS

#define CONFIG_IEEE802154_DEFAULT_MAX_FRAME_RETRANS   (4U)

IEEE802.15.4 default value for maximum frame retries.

Definition at line 313 of file ieee802154.h.

◆ CONFIG_IEEE802154_DSME_BEACON_ORDER

#define CONFIG_IEEE802154_DSME_BEACON_ORDER   (3U)

Set IEEE 802.15.4 DSME Beacon Order (BO)

The BO sets the beacon interval to 2^(BO-SO) superframes.

See also
CONFIG_IEEE802154_DSME_SUPERFRAME_ORDER
Note
For the moment, this is only valid for openDSME - IEEE 802.15.4 DSME

Definition at line 402 of file ieee802154.h.

◆ CONFIG_IEEE802154_DSME_CAP_REDUCTION

#define CONFIG_IEEE802154_DSME_CAP_REDUCTION   0

Enable DSME CAP reduction.

Note
For the moment, this is only valid for openDSME - IEEE 802.15.4 DSME

Definition at line 336 of file ieee802154.h.

◆ CONFIG_IEEE802154_DSME_GTS_EXPIRATION

#define CONFIG_IEEE802154_DSME_GTS_EXPIRATION   (16U)

Set expiration time of DSME GTS slot.

Sets the expiration time of DSME GTS slot (in number of idle slots). If DSME detects no activity, it will deallocate the GTS slot.

Note
For the moment, this is only valid for openDSME - IEEE 802.15.4 DSME

Definition at line 428 of file ieee802154.h.

◆ CONFIG_IEEE802154_DSME_MAC_RESPONSE_WAIT_TIME

#define CONFIG_IEEE802154_DSME_MAC_RESPONSE_WAIT_TIME   (244U)

Set the maximum DSME MAC response wait time.

This configuration sets the maximum wait times for MAC commands (association, DSME GTS allocation, etc). The unit is "base superframe duration" (60 * symbol_time_us).

Note
For the moment, this is only valid for openDSME - IEEE 802.15.4 DSME

Definition at line 349 of file ieee802154.h.

◆ CONFIG_IEEE802154_DSME_MIN_COORD_LQI

#define CONFIG_IEEE802154_DSME_MIN_COORD_LQI   (100U)

Set the minimum LQI to consider a beacon from a coordinator valid.

Note
For the moment, this is only valid for openDSME - IEEE 802.15.4 DSME

Definition at line 437 of file ieee802154.h.

◆ CONFIG_IEEE802154_DSME_MULTISUPERFRAME_ORDER

#define CONFIG_IEEE802154_DSME_MULTISUPERFRAME_ORDER   (3U)

Set IEEE 802.15.4 DSME Multisuperframe Order (MO)

The MO sets the number of superframes per multisuperframe to 2^(MO-SO).

See also
CONFIG_IEEE802154_DSME_SUPERFRAME_ORDER
Note
For the moment, this is only valid for openDSME - IEEE 802.15.4 DSME

Definition at line 389 of file ieee802154.h.

◆ CONFIG_IEEE802154_DSME_SCAN_DURATION

#define CONFIG_IEEE802154_DSME_SCAN_DURATION   (4U)

Set the scan duration.

Set the scan duration for each channel to 60 * symbol_time_us * (2^scanDuration + 1)

Note
For the moment, this is only valid for openDSME - IEEE 802.15.4 DSME

Definition at line 361 of file ieee802154.h.

◆ CONFIG_IEEE802154_DSME_STATIC_GTS

#define CONFIG_IEEE802154_DSME_STATIC_GTS   0

Use static GTS allocation.

When set, the MAC implementation will not use scheduling functions. This requires that the upper layer allocates slots manually using NETOPT_GTS_ALLOC.

See also
CONFIG_IEEE802154_DSME_STATIC_GTS
Note
For the moment, this is only valid for openDSME - IEEE 802.15.4 DSME

Definition at line 416 of file ieee802154.h.

◆ CONFIG_IEEE802154_DSME_SUPERFRAME_ORDER

#define CONFIG_IEEE802154_DSME_SUPERFRAME_ORDER   (3U)

Set IEEE 802.15.4 DSME Superframe Order (SO) The SO sets the slot duration to 60 * symbol_time_us * 2^SO usecs.

E.g for O-QPSK an SO=3 renders a slot duration of 60 * 16 * 8 = 7.6 ms and a superframe duration of 122.88 ms.

Settings this value to 3 allows to transmit full IEEE 802.15.4 O-QPSK frames (127 bytes).

Note
For the moment, this is only valid for openDSME - IEEE 802.15.4 DSME

Definition at line 376 of file ieee802154.h.

◆ IEEE802154_ACK_FRAME_LEN

#define IEEE802154_ACK_FRAME_LEN   (5U)

ACK frame length.

Definition at line 100 of file ieee802154.h.

◆ IEEE802154_ACK_TIMEOUT_SYMS

#define IEEE802154_ACK_TIMEOUT_SYMS   (54)

ACK Timeout period in symbols.

Definition at line 120 of file ieee802154.h.

◆ IEEE802154_ADDR_BCAST

#define IEEE802154_ADDR_BCAST   { 0xff, 0xff }

Special address definitions.

Static initializer for broadcast address

Definition at line 198 of file ieee802154.h.

◆ IEEE802154_ADDR_BCAST_LEN

#define IEEE802154_ADDR_BCAST_LEN   (IEEE802154_SHORT_ADDRESS_LEN)

Length in byte of IEEE802154_ADDR_BCAST.

Definition at line 203 of file ieee802154.h.

◆ IEEE802154_ATURNAROUNDTIME_IN_SYMBOLS

#define IEEE802154_ATURNAROUNDTIME_IN_SYMBOLS   (12)

IEEE Std 802.15.4-2020 Table 11-1—PHY constants: The value is 12 for all other PHYs.

Definition at line 158 of file ieee802154.h.

◆ IEEE802154_CCA_DURATION_IN_SYMBOLS

#define IEEE802154_CCA_DURATION_IN_SYMBOLS   (8)

IEEE Std 802.15.4-2020 Table 11-1—PHY constants: For all other PHYs¹, the duration of 8 symbol periods.

[1] all but MR-O-QPSK

Definition at line 167 of file ieee802154.h.

◆ IEEE802154_CHANNEL_MAX

#define IEEE802154_CHANNEL_MAX   (26U)

Maximum channel for 2.4 GHz band.

Definition at line 95 of file ieee802154.h.

◆ IEEE802154_CHANNEL_MAX_SUBGHZ

#define IEEE802154_CHANNEL_MAX_SUBGHZ   (10U)

Maximum channel for sub-GHz band.

Definition at line 93 of file ieee802154.h.

◆ IEEE802154_CHANNEL_MIN

#define IEEE802154_CHANNEL_MIN   (11U)

Minimum channel for 2.4 GHz band.

Definition at line 94 of file ieee802154.h.

◆ IEEE802154_CHANNEL_MIN_SUBGHZ

#define IEEE802154_CHANNEL_MIN_SUBGHZ   (0U)

Channel ranges.

Minimum channel for sub-GHz band

Definition at line 92 of file ieee802154.h.

◆ IEEE802154_FCF_ACK_REQ

#define IEEE802154_FCF_ACK_REQ   (0x20)

acknowledgement requested from receiver

Definition at line 68 of file ieee802154.h.

◆ IEEE802154_FCF_DST_ADDR_LONG

#define IEEE802154_FCF_DST_ADDR_LONG   (0x0c)

destination address length is 8

Definition at line 75 of file ieee802154.h.

◆ IEEE802154_FCF_DST_ADDR_MASK

#define IEEE802154_FCF_DST_ADDR_MASK   (0x0c)

Definition at line 71 of file ieee802154.h.

◆ IEEE802154_FCF_DST_ADDR_RESV

#define IEEE802154_FCF_DST_ADDR_RESV   (0x04)

reserved address mode

Definition at line 73 of file ieee802154.h.

◆ IEEE802154_FCF_DST_ADDR_SHORT

#define IEEE802154_FCF_DST_ADDR_SHORT   (0x08)

destination address length is 2

Definition at line 74 of file ieee802154.h.

◆ IEEE802154_FCF_DST_ADDR_VOID

#define IEEE802154_FCF_DST_ADDR_VOID   (0x00)

no destination address

Definition at line 72 of file ieee802154.h.

◆ IEEE802154_FCF_FRAME_PEND

#define IEEE802154_FCF_FRAME_PEND   (0x10)

follow-up frame is pending

Definition at line 67 of file ieee802154.h.

◆ IEEE802154_FCF_LEN

#define IEEE802154_FCF_LEN   (2U)

Definition at line 57 of file ieee802154.h.

◆ IEEE802154_FCF_PAN_COMP

#define IEEE802154_FCF_PAN_COMP   (0x40)

compress source PAN ID

Definition at line 69 of file ieee802154.h.

◆ IEEE802154_FCF_SECURITY_EN

#define IEEE802154_FCF_SECURITY_EN   (0x08)

enable security

Definition at line 66 of file ieee802154.h.

◆ IEEE802154_FCF_SRC_ADDR_LONG

#define IEEE802154_FCF_SRC_ADDR_LONG   (0xc0)

source address length is 8

Definition at line 85 of file ieee802154.h.

◆ IEEE802154_FCF_SRC_ADDR_MASK

#define IEEE802154_FCF_SRC_ADDR_MASK   (0xc0)

Definition at line 81 of file ieee802154.h.

◆ IEEE802154_FCF_SRC_ADDR_RESV

#define IEEE802154_FCF_SRC_ADDR_RESV   (0x40)

reserved address mode

Definition at line 83 of file ieee802154.h.

◆ IEEE802154_FCF_SRC_ADDR_SHORT

#define IEEE802154_FCF_SRC_ADDR_SHORT   (0x80)

source address length is 2

Definition at line 84 of file ieee802154.h.

◆ IEEE802154_FCF_SRC_ADDR_VOID

#define IEEE802154_FCF_SRC_ADDR_VOID   (0x00)

no source address

Definition at line 82 of file ieee802154.h.

◆ IEEE802154_FCF_TYPE_ACK

#define IEEE802154_FCF_TYPE_ACK   (0x02)

Definition at line 63 of file ieee802154.h.

◆ IEEE802154_FCF_TYPE_BEACON

#define IEEE802154_FCF_TYPE_BEACON   (0x00)

Definition at line 61 of file ieee802154.h.

◆ IEEE802154_FCF_TYPE_DATA

#define IEEE802154_FCF_TYPE_DATA   (0x01)

Definition at line 62 of file ieee802154.h.

◆ IEEE802154_FCF_TYPE_MACCMD

#define IEEE802154_FCF_TYPE_MACCMD   (0x03)

Definition at line 64 of file ieee802154.h.

◆ IEEE802154_FCF_TYPE_MASK

#define IEEE802154_FCF_TYPE_MASK   (0x07)

Definition at line 60 of file ieee802154.h.

◆ IEEE802154_FCF_VERS_MASK

#define IEEE802154_FCF_VERS_MASK   (0x30)

Definition at line 77 of file ieee802154.h.

◆ IEEE802154_FCF_VERS_V0

#define IEEE802154_FCF_VERS_V0   (0x00)

Definition at line 78 of file ieee802154.h.

◆ IEEE802154_FCF_VERS_V1

#define IEEE802154_FCF_VERS_V1   (0x10)

Definition at line 79 of file ieee802154.h.

◆ IEEE802154_FCS_LEN

#define IEEE802154_FCS_LEN   (2U)

Definition at line 58 of file ieee802154.h.

◆ IEEE802154_FRAME_LEN_MAX

#define IEEE802154_FRAME_LEN_MAX   (127U)

maximum 802.15.4 frame length

Definition at line 98 of file ieee802154.h.

◆ IEEE802154_LIFS_SYMS

#define IEEE802154_LIFS_SYMS   (40U)

Number of symbols to wait during Long Inter Frame Spacing.

Definition at line 105 of file ieee802154.h.

◆ IEEE802154_LONG_ADDRESS_LEN

#define IEEE802154_LONG_ADDRESS_LEN   (8U)

long address (EUI-64)

Definition at line 45 of file ieee802154.h.

◆ IEEE802154_MAX_HDR_LEN

#define IEEE802154_MAX_HDR_LEN   (23U)

IEEE802.15.4 FCF field definitions.

Definition at line 54 of file ieee802154.h.

◆ IEEE802154_MIN_FRAME_LEN

#define IEEE802154_MIN_FRAME_LEN   (IEEE802154_FCF_LEN + sizeof(uint8_t))

Definition at line 55 of file ieee802154.h.

◆ IEEE802154_PHY_MR_FSK_2FSK_CODED_SFD_0

#define IEEE802154_PHY_MR_FSK_2FSK_CODED_SFD_0   (0x6F4E)

For the MR-FSK PHY, the SFD value when PHR + PSDU are coded/uncoded and with phyMRFSKSFD = 0 or 1 respectively.

802.15.4g, Table 131 (p. 51)

Definition at line 140 of file ieee802154.h.

◆ IEEE802154_PHY_MR_FSK_2FSK_CODED_SFD_1

#define IEEE802154_PHY_MR_FSK_2FSK_CODED_SFD_1   (0x632D)

Definition at line 141 of file ieee802154.h.

◆ IEEE802154_PHY_MR_FSK_2FSK_SFD_LEN

#define IEEE802154_PHY_MR_FSK_2FSK_SFD_LEN   (2)

MR-FSK SFD length on Filtered 2-FSK.

Definition at line 130 of file ieee802154.h.

◆ IEEE802154_PHY_MR_FSK_2FSK_UNCODED_SFD_0

#define IEEE802154_PHY_MR_FSK_2FSK_UNCODED_SFD_0   (0x90E4)

Definition at line 142 of file ieee802154.h.

◆ IEEE802154_PHY_MR_FSK_2FSK_UNCODED_SFD_1

#define IEEE802154_PHY_MR_FSK_2FSK_UNCODED_SFD_1   (0x7A0E)

Definition at line 143 of file ieee802154.h.

◆ IEEE802154_PHY_MR_FSK_PHR_LEN

#define IEEE802154_PHY_MR_FSK_PHR_LEN   (2)

MR-FSK PHY header length.

Definition at line 129 of file ieee802154.h.

◆ IEEE802154_RADIO_RSSI_OFFSET

#define IEEE802154_RADIO_RSSI_OFFSET   (-174)

value of measured power when RSSI is zero.

This value is defined in the IEEE 802.15.4 standard

Definition at line 127 of file ieee802154.h.

◆ IEEE802154_SFD

#define IEEE802154_SFD   (0xa7)

Default start frame delimiter.

Definition at line 38 of file ieee802154.h.

◆ IEEE802154_SHORT_ADDRESS_LEN

#define IEEE802154_SHORT_ADDRESS_LEN   (2U)

IEEE 802.15.4 address lengths.

short (16-bit) address

Definition at line 44 of file ieee802154.h.

◆ IEEE802154_SIFS_MAX_FRAME_SIZE

#define IEEE802154_SIFS_MAX_FRAME_SIZE   (18U)

Maximum frame size to consider a frame as short.

Definition at line 115 of file ieee802154.h.

◆ IEEE802154_SIFS_SYMS

#define IEEE802154_SIFS_SYMS   (12U)

Number of symbols to wait during Short Inter Frame Spacing.

Definition at line 110 of file ieee802154.h.

◆ IEEE802154G_ATURNAROUNDTIME_US

#define IEEE802154G_ATURNAROUNDTIME_US   (1 * US_PER_MS)

For the SUN PHYs, the value is 1 ms expressed in symbol periods, rounded up to the next integer number of symbol periods using the ceiling() function.

802.15.4g, Table 70 (p. 43)

Definition at line 152 of file ieee802154.h.

◆ IEEE802154G_FRAME_LEN_MAX

#define IEEE802154G_FRAME_LEN_MAX   (2047U)

maximum 802.15.4g-2012 frame length

Definition at line 99 of file ieee802154.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

802.15.4 forward error correction schemes

Enumerator
IEEE802154_FEC_NONE 

no forward error correction

IEEE802154_FEC_NRNSC 

non-recursive and non-systematic code

IEEE802154_FEC_RSC 

recursive and systematic code

Definition at line 185 of file ieee802154.h.

◆ ieee802154_phy_mode_t

802.15.4 PHY modes

Enumerator
IEEE802154_PHY_DISABLED 

PHY disabled, no mode selected.

IEEE802154_PHY_BPSK 

Binary Phase Shift Keying.

IEEE802154_PHY_ASK 

Amplitude-Shift Keying.

IEEE802154_PHY_OQPSK 

Offset Quadrature Phase-Shift Keying.

IEEE802154_PHY_MR_OQPSK 

Multi-Rate Offset Quadrature Phase-Shift Keying.

IEEE802154_PHY_MR_OFDM 

Multi-Rate Orthogonal Frequency-Division Multiplexing.

IEEE802154_PHY_MR_FSK 

Multi-Rate Frequency Shift Keying.

Definition at line 172 of file ieee802154.h.

Function Documentation

◆ ieee802154_dbm_to_rssi()

static uint8_t ieee802154_dbm_to_rssi ( int16_t  dbm)
inlinestatic

Convert from dBm scale to RSSI.

The RSSI calculation is based on the IEEE 802.15.4 2020 specification and it's represented as one octet of integer.

RSSI equal to zero maps to -174 dBm and has the same scale as dBm (1 RSSI step == 1 dBm). Therefore an RSSI value of 254 maps to +80 dBm.

Parameters
[in]dbmRF power in dBm scale.
Returns
RF power in RSSI scale.

Definition at line 654 of file ieee802154.h.

◆ ieee802154_dst_filter()

int ieee802154_dst_filter ( const uint8_t *  mhr,
uint16_t  pan,
network_uint16_t  short_addr,
const eui64_t ext_addr 
)

Check whether a frame pass the IEEE 802.15.4 frame filter.

A frame passes the frame filter only if:

  • The PAN ID matches the PAN ID of the frame filter or the broadcast PAN ID
  • Either the Short or Extended Address matches the frame filter OR the Short Address is the broadcast address.
Parameters
[in]mhrMAC header (PSDU)
[in]panPAN ID of the frame filter.
[in]short_addrShort Address of the frame filter.
[in]ext_addrExtended Address of the frame filter.
Returns
0 if frame passes the frame filter.
1 if frame doesn't pass the frame filter.

◆ ieee802154_get_dst()

int ieee802154_get_dst ( const uint8_t *  mhr,
uint8_t *  dst,
le_uint16_t dst_pan 
)

Gets destination address from MAC header.

Precondition
(dst != NULL) && (dst_pan != NULL)
Parameters
[in]mhrMAC header.
[out]dstDestination address in network byte order in MAC header.
[out]dst_panDestination PAN in little-endian byte order in MAC header.
Returns
Length of destination address.
-EINVAL, if mhr contains unexpected flags.

◆ ieee802154_get_frame_hdr_len()

size_t ieee802154_get_frame_hdr_len ( const uint8_t *  mhr)

Get length of MAC header.

Todo:
include security header implications
Parameters
[in]mhrMAC header.
Returns
Length of MAC header on success.
0, on error (source mode or destination mode set to reserved).

◆ ieee802154_get_iid()

static eui64_t * ieee802154_get_iid ( eui64_t eui64,
const uint8_t *  addr,
size_t  addr_len 
)
inlinestatic

Generates an IPv6 interface identifier from an IEEE 802.15.4 address.

Precondition
(eui64 != NULL) && (addr != NULL)
See also
RFC 4944, section 6
RFC 6282, section 3.2.2
Parameters
[out]eui64The resulting EUI-64.
[in]addrAn IEEE 802.15.4 address.
[in]addr_lenThe length of addr. Must be 2 (short address), 4 (PAN ID + short address), or 8 (long address).
Returns
Copy of eui64 on success.
NULL, if addr_len was of illegal length.

Definition at line 580 of file ieee802154.h.

◆ ieee802154_get_seq()

static uint8_t ieee802154_get_seq ( const uint8_t *  mhr)
inlinestatic

Gets sequence number from MAC header.

Precondition
length of allocated space at mhr > 3
Parameters
[in]mhrMAC header.
Returns
The sequence number in mhr.

Definition at line 556 of file ieee802154.h.

◆ ieee802154_get_src()

int ieee802154_get_src ( const uint8_t *  mhr,
uint8_t *  src,
le_uint16_t src_pan 
)

Gets source address from MAC header.

Precondition
(src != NULL) && (src_pan != NULL)
Parameters
[in]mhrMAC header.
[out]srcSource address in network byte order in MAC header.
[out]src_panSource PAN little-endian byte order in MAC header.
Returns
Length of source address.
-EINVAL, if mhr contains unexpected flags.

◆ ieee802154_rssi_to_dbm()

static int16_t ieee802154_rssi_to_dbm ( uint8_t  rssi)
inlinestatic

Convert from RSSI scale to dBm.

The RSSI calculation is based on the IEEE 802.15.4 2020 specification and it's represented as one octet of integer.

RSSI equal to zero maps to -174 dBm and has the same scale as dBm (1 RSSI step == 1 dBm). Therefore an RSSI value of 254 maps to +80 dBm.

Note
RSSI == 255 is defined as reserved by the standard and ignored by this function.
Parameters
[in]rssiRF power in RSSI scale
Returns
RF power in dBm scale

Definition at line 636 of file ieee802154.h.

◆ ieee802154_set_frame_hdr()

size_t ieee802154_set_frame_hdr ( uint8_t *  buf,
const uint8_t *  src,
size_t  src_len,
const uint8_t *  dst,
size_t  dst_len,
le_uint16_t  src_pan,
le_uint16_t  dst_pan,
uint8_t  flags,
uint8_t  seq 
)

Initializes an IEEE 802.15.4 MAC frame header in buf.

Precondition
Resulting header must fit in memory allocated at buf.
See also
IEEE Std 802.15.4-2011, 5.2.1 General MAC frame format.

If dst is NULL the IEEE802154_FCF_ACK_REQ will be unset to prevent flooding the network.

Parameters
[out]bufTarget memory for frame header.
[in]srcSource address for frame in network byteorder. May be NULL if IEEE802154_FCF_SRC_ADDR_VOID is set in flags.
[in]src_lenLength of src. Legal values are:
[in]dstDestination address for frame in network byteorder. May be NULL if IEEE802154_FCF_SRC_ADDR_VOID is set in flags.
[in]dst_lenLength of dst. Legal values are:
[in]src_panSource PAN ID in little-endian. May be 0 if IEEE802154_FCF_PAN_COMP is set in flags. Otherwise, it will be ignored, when IEEE802154_FCF_PAN_COMP is set.
[in]dst_panDestination PAN ID in little-endian.
[in]flagsFlags for the frame. These are interchangeable with the first byte of the IEEE 802.15.4 FCF. This means that it encompasses the type values, IEEE802154_FCF_SECURITY_EN, IEEE802154_FCF_FRAME_PEND, and IEEE802154_FCF_ACK_REQ.
[in]seqSequence number for frame.

The version field in the FCF will be set implicitly to version 1.

Returns
Size of frame header on success.
0, on error (flags set to unexpected state).