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...
 

Typedefs

typedef struct netdev_radio_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

void netdev_ieee802154_reset (netdev_ieee802154_t *dev)
 Reset function for ieee802154 common fields. More...
 
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. More...
 
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. More...
 
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. More...
 
static void netdev_ieee802154_setup (netdev_ieee802154_t *dev)
 Configure the hardware address of a IEEE 802.15.4 devices. More...
 

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
 

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 72 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

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_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 209 of file ieee802154.h.