Go to the documentation of this file.
21 #ifndef NET_IEEE802154_H
22 #define NET_IEEE802154_H
37 #define IEEE802154_SFD (0xa7)
43 #define IEEE802154_SHORT_ADDRESS_LEN (2U)
44 #define IEEE802154_LONG_ADDRESS_LEN (8U)
53 #define IEEE802154_MAX_HDR_LEN (23U)
54 #define IEEE802154_MIN_FRAME_LEN (IEEE802154_FCF_LEN + sizeof(uint8_t))
56 #define IEEE802154_FCF_LEN (2U)
57 #define IEEE802154_FCS_LEN (2U)
59 #define IEEE802154_FCF_TYPE_MASK (0x07)
60 #define IEEE802154_FCF_TYPE_BEACON (0x00)
61 #define IEEE802154_FCF_TYPE_DATA (0x01)
62 #define IEEE802154_FCF_TYPE_ACK (0x02)
63 #define IEEE802154_FCF_TYPE_MACCMD (0x03)
65 #define IEEE802154_FCF_SECURITY_EN (0x08)
66 #define IEEE802154_FCF_FRAME_PEND (0x10)
67 #define IEEE802154_FCF_ACK_REQ (0x20)
68 #define IEEE802154_FCF_PAN_COMP (0x40)
70 #define IEEE802154_FCF_DST_ADDR_MASK (0x0c)
71 #define IEEE802154_FCF_DST_ADDR_VOID (0x00)
72 #define IEEE802154_FCF_DST_ADDR_RESV (0x04)
73 #define IEEE802154_FCF_DST_ADDR_SHORT (0x08)
74 #define IEEE802154_FCF_DST_ADDR_LONG (0x0c)
76 #define IEEE802154_FCF_VERS_MASK (0x30)
77 #define IEEE802154_FCF_VERS_V0 (0x00)
78 #define IEEE802154_FCF_VERS_V1 (0x10)
80 #define IEEE802154_FCF_SRC_ADDR_MASK (0xc0)
81 #define IEEE802154_FCF_SRC_ADDR_VOID (0x00)
82 #define IEEE802154_FCF_SRC_ADDR_RESV (0x40)
83 #define IEEE802154_FCF_SRC_ADDR_SHORT (0x80)
84 #define IEEE802154_FCF_SRC_ADDR_LONG (0xc0)
91 #define IEEE802154_CHANNEL_MIN_SUBGHZ (0U)
92 #define IEEE802154_CHANNEL_MAX_SUBGHZ (10U)
93 #define IEEE802154_CHANNEL_MIN (11U)
94 #define IEEE802154_CHANNEL_MAX (26U)
97 #define IEEE802154_FRAME_LEN_MAX (127U)
98 #define IEEE802154G_FRAME_LEN_MAX (2047U)
99 #define IEEE802154_ACK_FRAME_LEN (5U)
104 #define IEEE802154_LIFS_SYMS (40U)
109 #define IEEE802154_SIFS_SYMS (12U)
114 #define IEEE802154_SIFS_MAX_FRAME_SIZE (18U)
121 #define IEEE802154_RADIO_RSSI_OFFSET (-174)
129 #define IEEE802154G_ATURNAROUNDTIME_US (1 * US_PER_MS)
135 #define IEEE802154_ATURNAROUNDTIME_IN_SYMBOLS (12)
144 #define IEEE802154_CCA_DURATION_IN_SYMBOLS (8)
175 #define IEEE802154_ADDR_BCAST { 0xff, 0xff }
180 #define IEEE802154_ADDR_BCAST_LEN (IEEE802154_SHORT_ADDRESS_LEN)
196 #ifndef CONFIG_IEEE802154_DEFAULT_SUBGHZ_CHANNEL
197 #define CONFIG_IEEE802154_DEFAULT_SUBGHZ_CHANNEL (5U)
203 #ifndef CONFIG_IEEE802154_DEFAULT_CHANNEL
204 #define CONFIG_IEEE802154_DEFAULT_CHANNEL (26U)
210 #ifndef CONFIG_IEEE802154_DEFAULT_SUBGHZ_PAGE
211 #define CONFIG_IEEE802154_DEFAULT_SUBGHZ_PAGE (2U)
217 #ifndef CONFIG_IEEE802154_DEFAULT_PANID
218 #define CONFIG_IEEE802154_DEFAULT_PANID (0x0023U)
224 #ifndef IEEE802154_PANID_BCAST
225 #define IEEE802154_PANID_BCAST { 0xff, 0xff }
231 #ifndef CONFIG_IEEE802154_DEFAULT_TXPOWER
232 #define CONFIG_IEEE802154_DEFAULT_TXPOWER (0)
239 #ifndef CONFIG_IEEE802154_DEFAULT_CSMA_CA_MIN_BE
240 #define CONFIG_IEEE802154_DEFAULT_CSMA_CA_MIN_BE (3U)
246 #ifndef CONFIG_IEEE802154_DEFAULT_CSMA_CA_RETRIES
247 #define CONFIG_IEEE802154_DEFAULT_CSMA_CA_RETRIES (4U)
253 #ifndef CONFIG_IEEE802154_DEFAULT_CSMA_CA_MAX_BE
254 #define CONFIG_IEEE802154_DEFAULT_CSMA_CA_MAX_BE (5U)
260 #ifndef CONFIG_IEEE802154_CCA_THRESH_DEFAULT
261 #define CONFIG_IEEE802154_CCA_THRESH_DEFAULT (-70)
308 const uint8_t *dst,
size_t dst_len,
310 uint8_t flags, uint8_t seq);
394 eui64->
uint8[0] = addr[i++] ^ 0x02;
395 eui64->
uint8[1] = addr[i++];
396 eui64->
uint8[2] = addr[i++];
397 eui64->
uint8[3] = addr[i++];
398 eui64->
uint8[4] = addr[i++];
399 eui64->
uint8[5] = addr[i++];
400 eui64->
uint8[6] = addr[i++];
401 eui64->
uint8[7] = addr[i++];
405 eui64->
uint8[0] = addr[i++] ^ 0x02;
406 eui64->
uint8[1] = addr[i++];
411 eui64->
uint8[3] = 0xff;
412 eui64->
uint8[4] = 0xfe;
414 eui64->
uint8[6] = addr[i++];
415 eui64->
uint8[7] = addr[i++];
uint8_t uint8[8]
split into 8 8-bit words.
A 16 bit integer in little endian.
@ IEEE802154_PHY_BPSK
Binary Phase Shift Keying.
int ieee802154_get_src(const uint8_t *mhr, uint8_t *src, le_uint16_t *src_pan)
Gets source address from MAC header.
Functions to work with different byte orders.
@ IEEE802154_FEC_NRNSC
non-recursive and non-systematic code
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.
@ IEEE802154_PHY_MR_OFDM
Multi-Rate Orthogonal Frequency-Division Multiplexing.
@ IEEE802154_FEC_NONE
no forward error correction
@ IEEE802154_PHY_MR_FSK
Multi-Rate Frequency Shift Keying.
@ IEEE802154_PHY_DISABLED
PHY disabled, no mode selected.
@ IEEE802154_FEC_RSC
recursive and systematic code
static eui64_t * ieee802154_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.
@ IEEE802154_PHY_ASK
Amplitude-Shift Keying.
int ieee802154_get_dst(const uint8_t *mhr, uint8_t *dst, le_uint16_t *dst_pan)
Gets destination address from MAC header.
Data type to represent an EUI-64.
size_t ieee802154_get_frame_hdr_len(const uint8_t *mhr)
Get length of MAC header.
@ IEEE802154_PHY_MR_OQPSK
Multi-Rate Offset Quadrature Phase-Shift Keying.
EUI-64 data type definition.
const uint8_t ieee802154_addr_bcast[IEEE802154_ADDR_BCAST_LEN]
Broadcast address.
static uint8_t ieee802154_get_seq(const uint8_t *mhr)
Gets sequence number from MAC header.
@ IEEE802154_PHY_OQPSK
Offset Quadrature Phase-Shift Keying.
#define IEEE802154_ADDR_BCAST_LEN
Length in byte of IEEE802154_ADDR_BCAST.