Loading...
Searching...
No Matches

Detailed Description

Files

file  ieee802154.h
 Definitions for netdev common IEEE 802.15.4 code.
 

Data Structures

struct  netdev_ieee802154_t
 Extended structure to hold IEEE 802.15.4 driver state. More...
 
struct  netdev_ieee802154_rx_info
 Received packet status information for IEEE 802.15.4 radios. More...
 

Typedefs

typedef struct netdev_ieee802154_rx_info netdev_ieee802154_rx_info_t
 Received packet status information for IEEE 802.15.4 radios.
 

Enumerations

enum  netdev_ieee802154_cca_mode_t {
  NETDEV_IEEE802154_CCA_MODE_1 = 1 , NETDEV_IEEE802154_CCA_MODE_2 , NETDEV_IEEE802154_CCA_MODE_3 , NETDEV_IEEE802154_CCA_MODE_4 ,
  NETDEV_IEEE802154_CCA_MODE_5 , NETDEV_IEEE802154_CCA_MODE_6
}
 Option parameter to be used with NETOPT_CCA_MODE to set the mode of the clear channel assessment (CCA) defined in Std 802.15.4. More...
 

Functions

static void netdev_ieee802154_rx_info_set_timestamp (netdev_ieee802154_rx_info_t *dest, uint64_t timestamp)
 Write the given timestamp to the given RX info struct.
 
static int netdev_ieee802154_rx_info_get_timestamp (const netdev_ieee802154_rx_info_t *info, uint64_t *dest)
 Get the timestamp to from the RX info.
 
void netdev_ieee802154_reset (netdev_ieee802154_t *dev)
 Reset function for ieee802154 common fields.
 
int netdev_ieee802154_get (netdev_ieee802154_t *dev, netopt_t opt, void *value, size_t max_len)
 Fallback function for netdev IEEE 802.15.4 devices' _get function.
 
int netdev_ieee802154_set (netdev_ieee802154_t *dev, netopt_t opt, const void *value, size_t value_len)
 Fallback function for netdev IEEE 802.15.4 devices' _set function.
 
int netdev_ieee802154_dst_filter (netdev_ieee802154_t *dev, const uint8_t *mhr)
 This function compares destination address and pan id with addresses and pan id of the device.
 
static void netdev_ieee802154_setup (netdev_ieee802154_t *dev)
 Configure the hardware address of a IEEE 802.15.4 devices.
 

IEEE 802.15.4 netdev flags

Flags for netdev_ieee802154_t::flags

The flag-space 0xff00 is available for device-specific flags. The flag-space 0x00ff was chosen for global flags to be in accordance to the IEEE 802.15.4 MAC header flags.

#define NETDEV_IEEE802154_SEND_MASK   (0x0028)
 flags to take for send packets
 
#define NETDEV_IEEE802154_RAW   (0x0002)
 pass raw frame to upper layer
 
#define NETDEV_IEEE802154_SRC_MODE_LONG   (0x0004)
 use long source address (set) or short source address (unset)
 
#define NETDEV_IEEE802154_SECURITY_EN   (IEEE802154_FCF_SECURITY_EN)
 enable security
 
#define NETDEV_IEEE802154_ACK_REQ   (IEEE802154_FCF_ACK_REQ)
 request ACK from receiver
 
#define NETDEV_IEEE802154_FRAME_PEND   (IEEE802154_FCF_FRAME_PEND)
 set frame pending bit
 

Flags for use in @ref netdev_ieee802154_rx_info::flags

#define NETDEV_RX_IEEE802154_INFO_FLAG_TIMESTAMP   (0x01)
 Timestamp valid.
 

Macro Definition Documentation

◆ NETDEV_IEEE802154_ACK_REQ

#define NETDEV_IEEE802154_ACK_REQ   (IEEE802154_FCF_ACK_REQ)

request ACK from receiver

Definition at line 60 of file ieee802154.h.

◆ NETDEV_IEEE802154_FRAME_PEND

#define NETDEV_IEEE802154_FRAME_PEND   (IEEE802154_FCF_FRAME_PEND)

set frame pending bit

Definition at line 65 of file ieee802154.h.

◆ NETDEV_IEEE802154_RAW

#define NETDEV_IEEE802154_RAW   (0x0002)

pass raw frame to upper layer

Definition at line 47 of file ieee802154.h.

◆ NETDEV_IEEE802154_SECURITY_EN

#define NETDEV_IEEE802154_SECURITY_EN   (IEEE802154_FCF_SECURITY_EN)

enable security

Definition at line 55 of file ieee802154.h.

◆ NETDEV_IEEE802154_SEND_MASK

#define NETDEV_IEEE802154_SEND_MASK   (0x0028)

flags to take for send packets

Definition at line 46 of file ieee802154.h.

◆ NETDEV_IEEE802154_SRC_MODE_LONG

#define NETDEV_IEEE802154_SRC_MODE_LONG   (0x0004)

use long source address (set) or short source address (unset)

Definition at line 51 of file ieee802154.h.

◆ NETDEV_RX_IEEE802154_INFO_FLAG_TIMESTAMP

#define NETDEV_RX_IEEE802154_INFO_FLAG_TIMESTAMP   (0x01)

Timestamp valid.

Definition at line 74 of file ieee802154.h.

Enumeration Type Documentation

◆ netdev_ieee802154_cca_mode_t

Option parameter to be used with NETOPT_CCA_MODE to set the mode of the clear channel assessment (CCA) defined in Std 802.15.4.

Enumerator
NETDEV_IEEE802154_CCA_MODE_1 

Energy above threshold.

NETDEV_IEEE802154_CCA_MODE_2 

Carrier sense only.

NETDEV_IEEE802154_CCA_MODE_3 

Carrier sense with energy above threshold.

NETDEV_IEEE802154_CCA_MODE_4 

ALOHA.

NETDEV_IEEE802154_CCA_MODE_5 

UWB preamble sense based on the SHR of a frame.

NETDEV_IEEE802154_CCA_MODE_6 

UWB preamble sense based on the packet with the multiplexed preamble.

Definition at line 82 of file ieee802154.h.

Function Documentation

◆ netdev_ieee802154_dst_filter()

int netdev_ieee802154_dst_filter ( netdev_ieee802154_t dev,
const uint8_t *  mhr 
)

This function compares destination address and pan id with addresses and pan id of the device.

this function is meant top be used by drivers that do not support address filtering in hw

Deprecated:
This function is currently deprecated and will be removed after Release 2022.01. Use ieee802154_dst_filter instead.
Parameters
[in]devnetwork device descriptor
[in]mhrmac header
Returns
0 successful if packet is for the device
1 fails if packet is not for the device or pan

◆ netdev_ieee802154_get()

int netdev_ieee802154_get ( netdev_ieee802154_t dev,
netopt_t  opt,
void *  value,
size_t  max_len 
)

Fallback function for netdev IEEE 802.15.4 devices' _get function.

Supposed to be used by netdev drivers as default case.

Parameters
[in]devnetwork device descriptor
[in]optoption type
[out]valuepointer to store the option's value in
[in]max_lenmaximal amount of byte that fit into value
Returns
number of bytes written to value
<0 on error

◆ netdev_ieee802154_reset()

void netdev_ieee802154_reset ( netdev_ieee802154_t dev)

Reset function for ieee802154 common fields.

Supposed to be used by netdev drivers to reset the ieee802154 fields when resetting the device

Parameters
[in]devnetwork device descriptor

◆ netdev_ieee802154_rx_info_get_timestamp()

static int netdev_ieee802154_rx_info_get_timestamp ( const netdev_ieee802154_rx_info_t info,
uint64_t *  dest 
)
inlinestatic

Get the timestamp to from the RX info.

This function is safe to call even when module netdev_ieee802154_rx_timestamp is not used. It will become a no-op then.

Return values
0Success
-1No timestamp present or module netdev_ieee802154_rx_timestamp not used

Definition at line 177 of file ieee802154.h.

◆ netdev_ieee802154_rx_info_set_timestamp()

static void netdev_ieee802154_rx_info_set_timestamp ( netdev_ieee802154_rx_info_t dest,
uint64_t  timestamp 
)
inlinestatic

Write the given timestamp to the given RX info struct.

This function is safe to call even when module netdev_ieee802154_rx_timestamp is not used. It will become a no-op then.

Definition at line 154 of file ieee802154.h.

◆ netdev_ieee802154_set()

int netdev_ieee802154_set ( netdev_ieee802154_t dev,
netopt_t  opt,
const void *  value,
size_t  value_len 
)

Fallback function for netdev IEEE 802.15.4 devices' _set function.

Sets netdev_ieee802154_t::pan, netdev_ieee802154_t::short_addr, and netdev_ieee802154_t::long_addr in device struct. Additionally NETDEV_IEEE802154_SRC_MODE_LONG, NETDEV_IEEE802154_RAW and, NETDEV_IEEE802154_ACK_REQ in netdev_ieee802154_t::flags can be set or unset.

The setting of netdev_ieee802154_t::chan is omitted since the legality of its value can be very device specific and can't be checked in this function. Please set it in the netdev_driver_t::set function of your driver.

Be aware that this only manipulates the netdev_ieee802154_t struct. Configuration to the device needs to be done in the netdev_driver_t::set function of the device driver (which should call this function as a fallback afterwards).

Parameters
[in]devnetwork device descriptor
[in]optoption type
[in]valuevalue to set
[in]value_lenthe length of value
Returns
number of bytes used from value
<0 on error

◆ netdev_ieee802154_setup()

static void netdev_ieee802154_setup ( netdev_ieee802154_t dev)
inlinestatic

Configure the hardware address of a IEEE 802.15.4 devices.

This will obtain a long and short address based on the netdev ID. The addresses is stored in the netdev's long_addr & short_addr. The caller must take care of writing them to the hardware.

Precondition
the netdev registered itself with
See also
netdev_register
Parameters
[out]devNetdev to configure

Definition at line 277 of file ieee802154.h.