IEEE802.15.4¶
IEEE802.15.4 header definitions and utility functions.
-
IEEE802154_SHORT_ADDRESS_LEN
¶ IEEE 802.15.4 address lengths.
1
(2U)
short (16-bit) address
-
IEEE802154_LONG_ADDRESS_LEN
¶ long address (EUI-64)
1
(8U)
-
IEEE802154_MAX_HDR_LEN
¶ IEEE802.15.4 FCF field definitions.
1
(23U)
-
IEEE802154_MIN_FRAME_LEN
¶ 1
(IEEE802154_FCF_LEN + sizeof(uint8_t))
-
IEEE802154_FCF_LEN
¶ 1
(2U)
-
IEEE802154_FCS_LEN
¶ 1
(2U)
-
IEEE802154_FCF_TYPE_MASK
¶ 1
(0x07)
-
IEEE802154_FCF_TYPE_BEACON
¶ 1
(0x00)
-
IEEE802154_FCF_TYPE_DATA
¶ 1
(0x01)
-
IEEE802154_FCF_TYPE_ACK
¶ 1
(0x02)
-
IEEE802154_FCF_TYPE_MACCMD
¶ 1
(0x03)
-
IEEE802154_FCF_SECURITY_EN
¶ enable security
1
(0x08)
-
IEEE802154_FCF_FRAME_PEND
¶ follow-up frame is pending
1
(0x10)
-
IEEE802154_FCF_ACK_REQ
¶ acknowledgement requested from receiver
1
(0x20)
-
IEEE802154_FCF_PAN_COMP
¶ compress source PAN ID
1
(0x40)
-
IEEE802154_FCF_DST_ADDR_MASK
¶ 1
(0x0c)
-
IEEE802154_FCF_DST_ADDR_VOID
¶ no destination address
1
(0x00)
-
IEEE802154_FCF_DST_ADDR_RESV
¶ reserved address mode
1
(0x04)
-
IEEE802154_FCF_DST_ADDR_SHORT
¶ destination address length is 2
1
(0x08)
-
IEEE802154_FCF_DST_ADDR_LONG
¶ destination address length is 8
1
(0x0c)
-
IEEE802154_FCF_VERS_MASK
¶ 1
(0x30)
-
IEEE802154_FCF_VERS_V0
¶ 1
(0x00)
-
IEEE802154_FCF_VERS_V1
¶ 1
(0x10)
-
IEEE802154_FCF_SRC_ADDR_MASK
¶ 1
(0xc0)
-
IEEE802154_FCF_SRC_ADDR_VOID
¶ no source address
1
(0x00)
-
IEEE802154_FCF_SRC_ADDR_RESV
¶ reserved address mode
1
(0x40)
-
IEEE802154_FCF_SRC_ADDR_SHORT
¶ source address length is 2
1
(0x80)
-
IEEE802154_FCF_SRC_ADDR_LONG
¶ source address length is 8
1
(0xc0)
-
IEEE802154_CHANNEL_MIN_SUBGHZ
¶ Channel ranges.
1
(0U)
Minimum channel for sub-GHz band
-
IEEE802154_CHANNEL_MAX_SUBGHZ
¶ Maximum channel for sub-GHz band.
1
(10U)
-
IEEE802154_CHANNEL_MIN
¶ Minimum channel for 2.4 GHz band.
1
(11U)
-
IEEE802154_CHANNEL_MAX
¶ Maximum channel for 2.4 GHz band.
1
(26U)
-
const uint8_t
ieee802154_addr_bcast
()¶ Broadcast address.
-
IEEE802154_ADDR_BCAST
¶ Special address defintions.
1
{ 0xff, 0xff }
Static initializer for broadcast address
-
IEEE802154_ADDR_BCAST_LEN
¶ Length in byte of
sys/include/net/ieee802154.h::IEEE802154_ADDR_BCAST
.1
(IEEE802154_SHORT_ADDRESS_LEN)
-
IEEE802154_DEFAULT_SUBGHZ_CHANNEL
¶ 1
(5U)
-
IEEE802154_DEFAULT_CHANNEL
¶ 1
(26U)
-
IEEE802154_DEFAULT_SUBGHZ_PAGE
¶ 1
(2U)
-
IEEE802154_DEFAULT_PANID
¶ 1
(0x0023U)
-
IEEE802154_DEFAULT_TXPOWER
¶ 1
(0) /* in dBm */
-
msp430_types.h::size_t
ieee802154_set_frame_hdr
(uint8_t * buf, const uint8_t * src,msp430_types.h::size_t
src_len, const uint8_t * dst,msp430_types.h::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
.See also
IEEE Std 802.15.4-2011, 5.2.1 General MAC frame format.
dst
is NULL the IEEE802154_FCF_ACK_REQ will be unset to prevent flooding the network.Parameters
buf: Target memory for frame header. src: Source address for frame in network byteorder. May be NULL if sys/include/net/ieee802154.h::IEEE802154_FCF_SRC_ADDR_VOID
is set inflags
.src_len: Length of src
. Legal values are:- 0 (will set
sys/include/net/ieee802154.h::IEEE802154_FCF_SRC_ADDR_VOID
in MHR) - 2 (will set
sys/include/net/ieee802154.h::IEEE802154_FCF_SRC_ADDR_SHORT
in MHR) - 8 (will set
sys/include/net/ieee802154.h::IEEE802154_FCF_SRC_ADDR_LONG
in MHR)
dst: Destination address for frame in network byteorder. May be NULL if sys/include/net/ieee802154.h::IEEE802154_FCF_SRC_ADDR_VOID
is set inflags
.dst_len: Length of dst
. Legal values are:- 0 (will set
sys/include/net/ieee802154.h::IEEE802154_FCF_DST_ADDR_VOID
in MHR) - 2 (will set
sys/include/net/ieee802154.h::IEEE802154_FCF_DST_ADDR_SHORT
in MHR) - 8 (will set
sys/include/net/ieee802154.h::IEEE802154_FCF_DST_ADDR_LONG
in MHR)
src_pan: Source PAN ID in little-endian. May be 0 if sys/include/net/ieee802154.h::IEEE802154_FCF_PAN_COMP
is set inflags
. Otherwise, it will be ignored, whensys/include/net/ieee802154.h::IEEE802154_FCF_PAN_COMP
is set.dst_pan: Destination PAN ID in little-endian. flags: Flags for the frame. These are interchangable with the first byte of the IEEE 802.15.4 FCF. This means that it encompasses the type values, sys/include/net/ieee802154.h::IEEE802154_FCF_SECURITY_EN
,sys/include/net/ieee802154.h::IEEE802154_FCF_FRAME_PEND
, andsys/include/net/ieee802154.h::IEEE802154_FCF_ACK_REQ
.seq: Sequence number for frame. Return values
- Size of frame header on success.
- 0, on error (flags set to unexpected state).
- 0 (will set
-
msp430_types.h::size_t
ieee802154_get_frame_hdr_len
(const uint8_t * mhr)¶ Get length of MAC header.
include security header implications
Parameters
mhr: MAC header. Return values
- Length of MAC header on success.
- 0, on error (source mode or destination mode set to reserved).
-
int
ieee802154_get_src
(const uint8_t * mhr, uint8_t * src, le_uint16_t * src_pan)¶ Gets source address from MAC header.
Parameters
mhr: MAC header. src: Source address in network byte order in MAC header. src_pan: Source PAN little-endian byte order in MAC header. Return values
- Length of source address.
- -EINVAL, if
mhr
contains unexpected flags.
-
int
ieee802154_get_dst
(const uint8_t * mhr, uint8_t * dst, le_uint16_t * dst_pan)¶ Gets destination address from MAC header.
Parameters
mhr: MAC header. dst: Destination address in network byte order in MAC header. dst_pan: Destination PAN in little-endian byte order in MAC header. Return values
- Length of destination address.
- -EINVAL, if
mhr
contains unexpected flags.
-
uint8_t
ieee802154_get_seq
(const uint8_t * mhr)¶ Gets sequence number from MAC header.
Parameters
mhr: MAC header. Return values
- The sequence number in
mhr
.
- The sequence number in
-
eui64_t *
ieee802154_get_iid
(eui64_t * eui64, const uint8_t * addr,msp430_types.h::size_t
addr_len)¶ Generates an IPv6 interface identifier from an IEEE 802.15.4 address.
See also
See also
Parameters
eui64: The resulting EUI-64. addr: An IEEE 802.15.4 address. addr_len: The length of addr
. Must be 2 (short address), 4 (PAN ID + short address), or 8 (long address).Return values
- Copy of
eui64
on success. - NULL, if
addr_len
was of illegal length.
- Copy of
-
IEEE802154_FRAME_LEN_MAX
¶ maximum frame length
1
(127U)