ieee802154.h File Reference

IEEE 802.15.4 header definitions. More...

Detailed Description

IEEE 802.15.4 header definitions.

Author
Hauke Petersen hauke.nosp@m..pet.nosp@m.ersen.nosp@m.@fu-.nosp@m.berli.nosp@m.n.de

Definition in file ieee802154.h.

#include <stdint.h>
#include <stdlib.h>
#include "byteorder.h"
#include "net/eui64.h"
+ Include dependency graph for ieee802154.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

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_RADIO_RSSI_OFFSET   (-174)
 value of measured power when RSSI is zero. More...
 
#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. More...
 
#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. More...
 
#define CONFIG_IEEE802154_DEFAULT_SUBGHZ_CHANNEL   (5U)
 IEEE802.15.4 default sub-GHZ channel.
 
#define CONFIG_IEEE802154_DEFAULT_CHANNEL   (26U)
 IEEE802.15.4 default channel.
 
#define CONFIG_IEEE802154_DEFAULT_SUBGHZ_PAGE   (2U)
 IEEE802.15.4 default sub-GHZ page.
 
#define CONFIG_IEEE802154_DEFAULT_PANID   (0x0023U)
 IEEE802.15.4 default PANID.
 
#define IEEE802154_PANID_BCAST   { 0xff, 0xff }
 IEEE802.15.4 Broadcast PANID.
 
#define CONFIG_IEEE802154_DEFAULT_TXPOWER   (0)
 IEEE802.15.4 default TX power (in dBm)
 
#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)
 

Enumerations

enum  {
  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. More...
 
size_t ieee802154_get_frame_hdr_len (const uint8_t *mhr)
 Get length of MAC header. More...
 
int ieee802154_get_src (const uint8_t *mhr, uint8_t *src, le_uint16_t *src_pan)
 Gets source address from MAC header. More...
 
int ieee802154_get_dst (const uint8_t *mhr, uint8_t *dst, le_uint16_t *dst_pan)
 Gets destination address from MAC header. More...
 
static uint8_t ieee802154_get_seq (const uint8_t *mhr)
 Gets sequence number from MAC header. More...
 
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. More...
 
#define IEEE802154_SHORT_ADDRESS_LEN   (2U)
 IEEE 802.15.4 address lengths. More...
 
#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. More...
 
#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_ADDR_BCAST   { 0xff, 0xff }
 Special address definitions. More...
 
#define IEEE802154_ADDR_BCAST_LEN   (IEEE802154_SHORT_ADDRESS_LEN)
 Length in byte of IEEE802154_ADDR_BCAST.
 
const uint8_t ieee802154_addr_bcast [IEEE802154_ADDR_BCAST_LEN]
 Broadcast address.