Loading...
Searching...
No Matches
IEEE802.15.4 Radio Hardware Abstraction Layer

This is a Hardware Abstraction Layer for IEEE802.15.4 compatible radios. More...

Detailed Description

This is a Hardware Abstraction Layer for IEEE802.15.4 compatible radios.

Warning
This feature is experimental!
This API is experimental and in an early state - expect changes!
Author
José I. Alamos jose..nosp@m.alam.nosp@m.os@ha.nosp@m.w-ha.nosp@m.mburg.nosp@m..de

Data Structures

struct  ieee802154_csma_be_t
 CSMA-CA exponential backoff parameters. More...
 
struct  ieee802154_rx_info_t
 RX information associated to a frame. More...
 
struct  ieee802154_tx_info_t
 TX information of the last transmitted frame. More...
 
struct  ieee802154_dev
 the IEEE802.15.4 device descriptor More...
 
struct  ieee802154_phy_conf_t
 Holder of the PHY configuration. More...
 
struct  ieee802154_radio_ops
 Radio ops struct declaration. More...
 

Macros

#define IEEE802154_RF_CAPS_PHY_MASK
 Bit-mask for PHY modes capabilities.
 

Typedefs

typedef struct ieee802154_radio_ops ieee802154_radio_ops_t
 Forward declaration of the radio ops structure.
 
typedef struct ieee802154_dev ieee802154_dev_t
 Forward declaration of the IEEE802.15.4 device descriptor.
 
typedef void(* ieee802154_cb_t) (ieee802154_dev_t *dev, ieee802154_trx_ev_t status)
 Prototype of the IEEE802.15.4 device event callback.
 

Enumerations

enum  ieee802154_rf_caps_t {
  IEEE802154_CAP_FRAME_RETRANS = BIT0 , IEEE802154_CAP_AUTO_CSMA = BIT1 , IEEE802154_CAP_IRQ_ACK_TIMEOUT = BIT2 , IEEE802154_CAP_24_GHZ = BIT3 ,
  IEEE802154_CAP_SUB_GHZ = BIT4 , IEEE802154_CAP_IRQ_CRC_ERROR = BIT5 , IEEE802154_CAP_IRQ_TX_DONE = BIT6 , IEEE802154_CAP_IRQ_RX_START = BIT7 ,
  IEEE802154_CAP_IRQ_TX_START = BIT8 , IEEE802154_CAP_IRQ_CCA_DONE = BIT9 , IEEE802154_CAP_FRAME_RETRANS_INFO = BIT10 , IEEE802154_CAP_REG_RETENTION = BIT11 ,
  IEEE802154_CAP_PHY_BPSK = BIT12 , IEEE802154_CAP_PHY_ASK = BIT13 , IEEE802154_CAP_PHY_OQPSK = BIT14 , IEEE802154_CAP_PHY_MR_OQPSK = BIT15 ,
  IEEE802154_CAP_PHY_MR_OFDM = BIT16 , IEEE802154_CAP_PHY_MR_FSK = BIT17 , IEEE802154_CAP_SRC_ADDR_MATCH = BIT18
}
 IEEE802.15.4 Radio capabilities. More...
 
enum  ieee802154_tx_status_t { TX_STATUS_SUCCESS , TX_STATUS_FRAME_PENDING , TX_STATUS_NO_ACK , TX_STATUS_MEDIUM_BUSY }
 Transmission status. More...
 
enum  ieee802154_trx_ev_t {
  IEEE802154_RADIO_INDICATION_RX_START , IEEE802154_RADIO_INDICATION_CRC_ERROR , IEEE802154_RADIO_INDICATION_TX_START , IEEE802154_RADIO_INDICATION_RX_DONE ,
  IEEE802154_RADIO_CONFIRM_TX_DONE , IEEE802154_RADIO_CONFIRM_CCA
}
 IEEE802.15.4 Radio HAL events. More...
 
enum  ieee802154_src_match_t {
  IEEE802154_SRC_MATCH_EN , IEEE802154_SRC_MATCH_SHORT_ADD , IEEE802154_SRC_MATCH_SHORT_CLEAR , IEEE802154_SRC_MATCH_EXT_ADD ,
  IEEE802154_SRC_MATCH_EXT_CLEAR
}
 Source Address Match commands. More...
 
enum  ieee802154_af_cmd_t { IEEE802154_AF_SHORT_ADDR , IEEE802154_AF_EXT_ADDR , IEEE802154_AF_PANID , IEEE802154_AF_PAN_COORD }
 Address filter command. More...
 
enum  ieee802154_filter_mode_t { IEEE802154_FILTER_ACCEPT , IEEE802154_FILTER_ACK_ONLY , IEEE802154_FILTER_PROMISC , IEEE802154_FILTER_SNIFFER }
 Frame Filter mode. More...
 
enum  ieee802154_cca_mode_t { IEEE802154_CCA_MODE_ED_THRESHOLD , IEEE802154_CCA_MODE_CARRIER_SENSING , IEEE802154_CCA_MODE_ED_THRESH_AND_CS , IEEE802154_CCA_MODE_ED_THRESH_OR_CS }
 IEEE802.15.4 CCA modes. More...
 
enum  ieee802154_hal_op_t { IEEE802154_HAL_OP_TRANSMIT , IEEE802154_HAL_OP_SET_RX , IEEE802154_HAL_OP_SET_IDLE , IEEE802154_HAL_OP_CCA }
 IEEE 802.15.4 radio operations. More...
 

Functions

static int ieee802154_radio_write (ieee802154_dev_t *dev, const iolist_t *psdu)
 Shortcut to ieee802154_radio_ops::write.
 
static int ieee802154_radio_request_transmit (ieee802154_dev_t *dev)
 Transmit a preloaded frame.
 
static int ieee802154_radio_confirm_transmit (ieee802154_dev_t *dev, ieee802154_tx_info_t *info)
 Confirmation function for ieee802154_radio_request_transmit This function must be called to finish the transmission procedure and get the transmission status.
 
static int ieee802154_radio_len (ieee802154_dev_t *dev)
 Shortcut to ieee802154_radio_ops::len.
 
static int ieee802154_radio_read (ieee802154_dev_t *dev, void *buf, size_t size, ieee802154_rx_info_t *info)
 Shortcut to ieee802154_radio_ops::read.
 
static int ieee802154_radio_set_cca_threshold (ieee802154_dev_t *dev, int8_t threshold)
 Shortcut to ieee802154_radio_ops::set_cca_threshold.
 
static int ieee802154_radio_set_cca_mode (ieee802154_dev_t *dev, ieee802154_cca_mode_t mode)
 Shortcut to ieee802154_radio_ops::set_cca_mode.
 
static int ieee802154_radio_config_phy (ieee802154_dev_t *dev, const ieee802154_phy_conf_t *conf)
 Shortcut to ieee802154_radio_ops::config_phy.
 
static int ieee802154_radio_config_src_address_match (ieee802154_dev_t *dev, ieee802154_src_match_t cmd, const void *value)
 Shortcut to ieee802154_radio_ops::config_src_addr_match.
 
static int ieee802154_radio_off (ieee802154_dev_t *dev)
 Shortcut to ieee802154_radio_ops::off.
 
static int ieee802154_radio_config_addr_filter (ieee802154_dev_t *dev, ieee802154_af_cmd_t cmd, const void *value)
 Shortcut to ieee802154_radio_ops::config_addr_filter.
 
static int ieee802154_radio_set_frame_filter_mode (ieee802154_dev_t *dev, ieee802154_filter_mode_t mode)
 Shortcut to ieee802154_radio_ops::set_frame_filter_mode.
 
static int ieee802154_radio_set_frame_retrans (ieee802154_dev_t *dev, uint8_t retrans)
 Shortcut to ieee802154_radio_ops::set_frame_retrans.
 
static int ieee802154_radio_set_csma_params (ieee802154_dev_t *dev, const ieee802154_csma_be_t *bd, int8_t retries)
 Shortcut to ieee802154_radio_ops::set_csma_params.
 
static int ieee802154_radio_request_on (ieee802154_dev_t *dev)
 Shortcut to ieee802154_radio_ops::request_on.
 
static int ieee802154_radio_confirm_on (ieee802154_dev_t *dev)
 Shortcut to ieee802154_radio_ops::confirm_on.
 
static int ieee802154_radio_request_set_idle (ieee802154_dev_t *dev, bool force)
 Request the transceiver state to IDLE.
 
static int ieee802154_radio_confirm_set_idle (ieee802154_dev_t *dev)
 Confirmation function for ieee802154_radio_request_set_idle.
 
static int ieee802154_radio_request_set_rx (ieee802154_dev_t *dev)
 Request the transceiver state to RX.
 
static int ieee802154_radio_confirm_set_rx (ieee802154_dev_t *dev)
 Confirmation function for ieee802154_radio_request_set_rx.
 
static int ieee802154_radio_set_idle (ieee802154_dev_t *dev, bool force)
 Set transceiver state to IDLE (blocking)
 
static int ieee802154_radio_set_rx (ieee802154_dev_t *dev)
 Set transceiver state to RX (blocking)
 
static int ieee802154_radio_request_cca (ieee802154_dev_t *dev)
 Request Stand-Alone Clear Channel Assessment.
 
static int ieee802154_radio_confirm_cca (ieee802154_dev_t *dev)
 Shortcut to ieee802154_radio_confirm_cca.
 
static int ieee802154_radio_cca (ieee802154_dev_t *dev)
 Perform a Clear Channel Assessment (blocking)
 
static bool ieee802154_radio_has_irq_ack_timeout (ieee802154_dev_t *dev)
 Check if the device supports ACK timeout.
 
static bool ieee802154_radio_has_frame_retrans (ieee802154_dev_t *dev)
 Check if the device supports frame retransmissions (with CSMA-CA).
 
static bool ieee802154_radio_has_auto_csma (ieee802154_dev_t *dev)
 Check if the device supports Auto CSMA-CA for transmissions.
 
static bool ieee802154_radio_has_sub_ghz (ieee802154_dev_t *dev)
 Check if the device supports the IEEE802.15.4 Sub-GHz band.
 
static bool ieee802154_radio_has_24_ghz (ieee802154_dev_t *dev)
 Check if the device supports the IEEE802.15.4 2.4 GHz band.
 
static bool ieee802154_radio_has_irq_tx_done (ieee802154_dev_t *dev)
 Check if the device supports TX done interrupt.
 
static bool ieee802154_radio_has_irq_rx_start (ieee802154_dev_t *dev)
 Check if the device supports RX start interrupt.
 
static bool ieee802154_radio_has_irq_tx_start (ieee802154_dev_t *dev)
 Check if the device supports TX start interrupt.
 
static bool ieee802154_radio_has_irq_cca_done (ieee802154_dev_t *dev)
 Check if the device supports CCA done interrupt.
 
static bool ieee802154_radio_has_frame_retrans_info (ieee802154_dev_t *dev)
 Check if the device reports the number of retransmissions of the last TX procedure.
 
static bool ieee802154_radio_has_phy_bpsk (ieee802154_dev_t *dev)
 Check if the device supports the BPSK PHY mode.
 
static bool ieee802154_radio_has_phy_ask (ieee802154_dev_t *dev)
 Check if the device supports the ASK PHY mode.
 
static bool ieee802154_radio_has_phy_oqpsk (ieee802154_dev_t *dev)
 Check if the device supports the O-QPSK PHY mode.
 
static bool ieee802154_radio_has_phy_mr_oqpsk (ieee802154_dev_t *dev)
 Check if the device supports the MR-O-QPSK PHY mode.
 
static bool ieee802154_radio_has_phy_mr_ofdm (ieee802154_dev_t *dev)
 Check if the device supports the MR-OFDM PHY mode.
 
static bool ieee802154_radio_has_phy_mr_fsk (ieee802154_dev_t *dev)
 Check if the device supports the MR-FSK PHY mode.
 
static uint32_t ieee802154_radio_get_phy_modes (ieee802154_dev_t *dev)
 Get supported PHY modes of the device.
 
static uint32_t ieee802154_phy_mode_to_cap (ieee802154_phy_mode_t phy_mode)
 Convert a ieee802154_phy_mode_t to a ieee802154_rf_caps_t value.
 
static ieee802154_phy_mode_t ieee802154_cap_to_phy_mode (uint32_t cap)
 Convert a ieee802154_rf_caps_t to a ieee802154_phy_mode_t value.
 

Macro Definition Documentation

◆ IEEE802154_RF_CAPS_PHY_MASK

#define IEEE802154_RF_CAPS_PHY_MASK
Value:
@ IEEE802154_CAP_PHY_BPSK
Binary Phase Shift Keying PHY mode.
Definition radio.h:131
@ IEEE802154_CAP_PHY_OQPSK
Offset Quadrature Phase-Shift Keying.
Definition radio.h:139
@ IEEE802154_CAP_PHY_MR_OQPSK
Multi-Rate Offset Quadrature Phase-Shift Keying PHY mode.
Definition radio.h:143
@ IEEE802154_CAP_PHY_MR_FSK
Multi-Rate Frequency Shift Keying PHY mode.
Definition radio.h:151
@ IEEE802154_CAP_PHY_ASK
Amplitude-Shift Keying PHY mode.
Definition radio.h:135
@ IEEE802154_CAP_PHY_MR_OFDM
Multi-Rate Orthogonal Frequency-Division Multiplexing PHY mode.
Definition radio.h:147

Bit-mask for PHY modes capabilities.

Definition at line 166 of file radio.h.

Typedef Documentation

◆ ieee802154_cb_t

typedef void(* ieee802154_cb_t) (ieee802154_dev_t *dev, ieee802154_trx_ev_t status)

Prototype of the IEEE802.15.4 device event callback.

Parameters
[in]devIEEE802.15.4 device descriptor
[in]statusthe status

Definition at line 409 of file radio.h.

◆ ieee802154_dev_t

Forward declaration of the IEEE802.15.4 device descriptor.

Definition at line 401 of file radio.h.

◆ ieee802154_radio_ops_t

Forward declaration of the radio ops structure.

Definition at line 41 of file radio.h.

Enumeration Type Documentation

◆ ieee802154_af_cmd_t

Address filter command.

Enumerator
IEEE802154_AF_SHORT_ADDR 

Set short IEEE 802.15.4 address (network_uint16_t)

IEEE802154_AF_EXT_ADDR 

Set extended IEEE 802.15.4 address (eui64_t)

IEEE802154_AF_PANID 

Set PAN ID (uint16_t)

IEEE802154_AF_PAN_COORD 

Set device as PAN coordinator (bool)

Definition at line 331 of file radio.h.

◆ ieee802154_cca_mode_t

IEEE802.15.4 CCA modes.

Enumerator
IEEE802154_CCA_MODE_ED_THRESHOLD 

CCA using first mode (energy detection)

IEEE802154_CCA_MODE_CARRIER_SENSING 

CCA using second mode (carrier sensing)

IEEE802154_CCA_MODE_ED_THRESH_AND_CS 

CCA using third mode (energy detection AND carrier sensing)

IEEE802154_CCA_MODE_ED_THRESH_OR_CS 

CCA using third mode (energy detection OR carrier sensing)

Definition at line 433 of file radio.h.

◆ ieee802154_filter_mode_t

Frame Filter mode.

Enumerator
IEEE802154_FILTER_ACCEPT 

accept all valid frames that match address filter configuration

IEEE802154_FILTER_ACK_ONLY 

accept only ACK frames

Note
This mode should only be implemented if the transceiver doesn't handle ACK frame reception (when IEEE802154_CAP_FRAME_RETRANS and IEEE802154_CAP_IRQ_ACK_TIMEOUT are not present).
IEEE802154_FILTER_PROMISC 

accept all valid frames

Note
This mode is optional
IEEE802154_FILTER_SNIFFER 

accept all frames, regardless of FCS

Note
This mode is optional

Definition at line 341 of file radio.h.

◆ ieee802154_hal_op_t

IEEE 802.15.4 radio operations.

Enumerator
IEEE802154_HAL_OP_TRANSMIT 

Transmission of a preloaded frame.

IEEE802154_HAL_OP_SET_RX 

Set the transceiver state to RX.

IEEE802154_HAL_OP_SET_IDLE 

Set the transceiver state to IDLE (RX off).

IEEE802154_HAL_OP_CCA 

Request Clear Channel Assessment.

Definition at line 465 of file radio.h.

◆ ieee802154_rf_caps_t

IEEE802.15.4 Radio capabilities.

These flags represent the hardware capabilities of a given device.

Enumerator
IEEE802154_CAP_FRAME_RETRANS 

the device supports frame retransmissions with CSMA-CA

The device supports sending with CSMA-CA and retransmissions. If the CSMA-CA fails, the device reports a TX_STATUS_MEDIUM_BUSY when calling ieee802154_radio_confirm_transmit. In case CSMA-CA succeeds and the ACK frame is expected, the device reports a TX_STATUS_SUCCESS if the ACK frame is received during any retransmission attempt. Otherwise, it reports a TX_STATUS_NO_ACK

ACK frames are not indicated to the upper layer.

Note
it's implicit that a radio supports IEEE802154_CAP_AUTO_CSMA if this cap is available
IEEE802154_CAP_AUTO_CSMA 

the device supports Auto CSMA-CA

The device supports performing CSMA-CA before transmitting a frame. If CSMA-CA procedure succeeds, the device sends the frame and reports a TX_STATUS_SUCCESS when calling ieee802154_radio_confirm_transmit. If it fails, the device reports TX_STATUS_MEDIUM_BUSY.

IEEE802154_CAP_IRQ_ACK_TIMEOUT 

the device support ACK timeout interrupt

The device will automatically attempt to receive and handle the ACK frame if expected. If the ACK frame is not received, the device reports TX_STATUS_NO_ACK when calling ieee802154_radio_confirm_transmit. Otherwise, it reports TX_STATUS_SUCCESS.

The ACK frame is not indicated to the upper layer.

IEEE802154_CAP_24_GHZ 

the device supports the IEEE802.15.4 2.4 GHz band

It's assumed that IEEE802154_CAP_IRQ_TX_DONE is present.

IEEE802154_CAP_SUB_GHZ 

the device support the IEEE802.15.4 Sub GHz band

IEEE802154_CAP_IRQ_CRC_ERROR 

the device reports reception off frames with invalid CRC.

IEEE802154_CAP_IRQ_TX_DONE 

the device reports when the transmission is done

IEEE802154_CAP_IRQ_RX_START 

the device reports the start of a frame (SFD) when received.

IEEE802154_CAP_IRQ_TX_START 

the device reports the start of a frame (SFD) was sent.

IEEE802154_CAP_IRQ_CCA_DONE 

the device reports the end of the CCA procedure

IEEE802154_CAP_FRAME_RETRANS_INFO 

the device provides the number of retransmissions

It's assumed that IEEE802154_CAP_FRAME_RETRANS is present.

IEEE802154_CAP_REG_RETENTION 

the device retains all register values when off.

IEEE802154_CAP_PHY_BPSK 

Binary Phase Shift Keying PHY mode.

IEEE802154_CAP_PHY_ASK 

Amplitude-Shift Keying PHY mode.

IEEE802154_CAP_PHY_OQPSK 

Offset Quadrature Phase-Shift Keying.

IEEE802154_CAP_PHY_MR_OQPSK 

Multi-Rate Offset Quadrature Phase-Shift Keying PHY mode.

IEEE802154_CAP_PHY_MR_OFDM 

Multi-Rate Orthogonal Frequency-Division Multiplexing PHY mode.

IEEE802154_CAP_PHY_MR_FSK 

Multi-Rate Frequency Shift Keying PHY mode.

IEEE802154_CAP_SRC_ADDR_MATCH 

the device supports source address match table.

A Source Address Match table contains source addresses with pending data. When a coordinator device receives an IEEE 802.15.4 Data Request command from a child node, the Frame Pending bit of the ACK is set if the source address matches one from the table.

Definition at line 48 of file radio.h.

◆ ieee802154_src_match_t

Source Address Match commands.

Enumerator
IEEE802154_SRC_MATCH_EN 

Enable or disable source address match.

Enabling it sets the frame pending to all ACK frames in response to a Data Request command (if the radio doesn't support Source Address Matching) or to a specific address in the Source Address Matching table

IEEE802154_SRC_MATCH_SHORT_ADD 

Add a short address to entry.

This command should only be implemented if IEEE802154_CAP_SRC_ADDR_MATCH is available.

IEEE802154_SRC_MATCH_SHORT_CLEAR 

Clear short address from entry.

This command should only be implemented if IEEE802154_CAP_SRC_ADDR_MATCH is available.

IEEE802154_SRC_MATCH_EXT_ADD 

Add a extended address to entry.

This command should only be implemented if IEEE802154_CAP_SRC_ADDR_MATCH is available.

IEEE802154_SRC_MATCH_EXT_CLEAR 

Clear extended address from entry.

This command should only be implemented if IEEE802154_CAP_SRC_ADDR_MATCH is available.

Definition at line 290 of file radio.h.

◆ ieee802154_trx_ev_t

IEEE802.15.4 Radio HAL events.

To follow the IEEE802.15.4 convention, an event that responds to a Request is a confirmation (Confirm). Otherwise an Indication.

Enumerator
IEEE802154_RADIO_INDICATION_RX_START 

the transceiver detected a valid SFD

This event is present if radio has IEEE802154_CAP_IRQ_RX_START cap.

IEEE802154_RADIO_INDICATION_CRC_ERROR 

the transceiver received a frame with an invalid crc.

Note
some radios won't flush the framebuffer on reception of a frame with invalid CRC. Therefore it's required to call ieee802154_radio_read.
since the behavior of radios after frame reception is undefined, the upper layer should set the transceiver state to IDLE as soon as possible before calling ieee802154_radio_read
IEEE802154_RADIO_INDICATION_TX_START 

the transceiver sent out a valid SFD

This event is present if radio has IEEE802154_CAP_IRQ_TX_START cap.

Note
The SFD of an outgoing ACK (AUTOACK) should not be indicated
IEEE802154_RADIO_INDICATION_RX_DONE 

the transceiver received a frame and lies in the internal framebuffer.

This indication should be generated only if CRC is valid and the frame passes the address matching filter (this includes ACK and Beacon frames). The latter only applies if the radio is not in promiscuous mode.

The transceiver or driver MUST handle the ACK reply if the Ack Request bit is set in the received frame and promiscuous mode is disabled.

The transceiver might be in a "FB Lock" state where no more frames are received. This is done in order to avoid overwriting the Frame Buffer with new frame arrivals. In order to leave this state, the upper layer must call ieee802154_radio_read

Note
since the behavior of radios after frame reception is undefined, the upper layer should set the transceiver state to IDLE as soon as possible before calling ieee802154_radio_read
IEEE802154_RADIO_CONFIRM_TX_DONE 

the transceiver either finished sending a frame, the retransmission procedure or the channel activity detection prior transmission.

This event is present if radio has IEEE802154_CAP_IRQ_TX_DONE cap. The upper layer should immediately call ieee802154_radio_confirm_transmit when on this event.

IEEE802154_RADIO_CONFIRM_CCA 

the CCA procedure finished

This event is present if radio has IEEE802154_CAP_IRQ_CCA_DONE.

Definition at line 218 of file radio.h.

◆ ieee802154_tx_status_t

Transmission status.

Enumerator
TX_STATUS_SUCCESS 

the transceiver successfully sent a frame.

Depending of the type of transmissions and available caps, this could mean one of the following:

If the device supports IEEE802154_CAP_FRAME_RETRANS or IEEE802154_CAP_IRQ_ACK_TIMEOUT this means either:

  • The frame was sent without ACK Req bit
  • The frame was sent with the ACK Req bit and a valid ACK was received.

Otherwise, this notifies that a frame was sent.

TX_STATUS_FRAME_PENDING 

the transceiver received a valid ACK with the frame pending bit

This status is present only if the device supports IEEE802154_CAP_FRAME_RETRANS or IEEE802154_CAP_IRQ_ACK_TIMEOUT.

TX_STATUS_NO_ACK 

the transceiver ran out of retransmission

This status is present only if the device supports IEEE802154_CAP_FRAME_RETRANS or IEEE802154_CAP_IRQ_ACK_TIMEOUT.

TX_STATUS_MEDIUM_BUSY 

the CSMA-CA algorithm or CCA failed to measure a clear channel

Definition at line 177 of file radio.h.

Function Documentation

◆ ieee802154_cap_to_phy_mode()

static ieee802154_phy_mode_t ieee802154_cap_to_phy_mode ( uint32_t  cap)
inlinestatic

Convert a ieee802154_rf_caps_t to a ieee802154_phy_mode_t value.

Note
The parameter must be one of the PHY capabilities.
Parameters
[in]capThe IEEE 802.15.4 capability.
Returns
Equivalent phy mode given the capability.
0 on invalid values

Definition at line 1594 of file radio.h.

◆ ieee802154_phy_mode_to_cap()

static uint32_t ieee802154_phy_mode_to_cap ( ieee802154_phy_mode_t  phy_mode)
inlinestatic

Convert a ieee802154_phy_mode_t to a ieee802154_rf_caps_t value.

Parameters
[in]phy_modePHY mode
Returns
Equivalent capability given the PHY mode.
0 on invalid values
0 when IEEE802154_PHY_DISABLED is given as the parameter.

Definition at line 1558 of file radio.h.

◆ ieee802154_radio_cca()

static int ieee802154_radio_cca ( ieee802154_dev_t dev)
inlinestatic

Perform a Clear Channel Assessment (blocking)

This function will internally call ieee802154_radio_request_cca and poll ieee802154_radio_confirm_cca.

Precondition
the device is on
Parameters
[in]devIEEE802.15.4 device descriptor
Returns
status of the CCA
Return values
positivenumber if the channel is clear
0if the channel is busy
negativeerrno on error

Definition at line 1264 of file radio.h.

◆ ieee802154_radio_config_addr_filter()

static int ieee802154_radio_config_addr_filter ( ieee802154_dev_t dev,
ieee802154_af_cmd_t  cmd,
const void *  value 
)
inlinestatic

Shortcut to ieee802154_radio_ops::config_addr_filter.

Precondition
the device is on
Parameters
[in]devIEEE802.15.4 device descriptor
[in]cmdcommand for the address filter
[in]valuevalue for cmd.
Returns
result of ieee802154_radio_ops::config_addr_filter

Definition at line 966 of file radio.h.

◆ ieee802154_radio_config_phy()

static int ieee802154_radio_config_phy ( ieee802154_dev_t dev,
const ieee802154_phy_conf_t conf 
)
inlinestatic

Shortcut to ieee802154_radio_ops::config_phy.

Precondition
the transceiver state is IDLE.
Parameters
[in]devIEEE802.15.4 device descriptor
[in]confthe PHY configuration
Returns
result of ieee802154_radio_ops::config_phy

Definition at line 917 of file radio.h.

◆ ieee802154_radio_config_src_address_match()

static int ieee802154_radio_config_src_address_match ( ieee802154_dev_t dev,
ieee802154_src_match_t  cmd,
const void *  value 
)
inlinestatic

Shortcut to ieee802154_radio_ops::config_src_addr_match.

Precondition
the device is on
Parameters
[in]devIEEE802.15.4 device descriptor
[in]cmdcommand for the source address match configuration
[in]valuevalue associated to cmd.
Returns
result of ieee802154_radio_ops::config_src_addr_match

Definition at line 934 of file radio.h.

◆ ieee802154_radio_confirm_cca()

static int ieee802154_radio_confirm_cca ( ieee802154_dev_t dev)
inlinestatic

Shortcut to ieee802154_radio_confirm_cca.

This function must be called to finish the CCA procedure. This function should be called on IEEE802154_RADIO_CONFIRM_CCA, If no interrupt is available, this function can be polled.

This functions calls ieee802154_radio_ops::request_op with IEEE802154_HAL_OP_CCA and sets the context to a boolean where the result of the CCA should be store. Setting it to true means the channel is clear.

Precondition
call to ieee802154_radio_request_cca was successful.
the device is on
Parameters
[in]devIEEE802.15.4 device descriptor
Returns
status of the CCA procedure
Return values
positivenumber if the channel is clear
0if the channel is busy
-EAGAINif the CCA procedure hasn't finished.

Definition at line 1238 of file radio.h.

◆ ieee802154_radio_confirm_on()

static int ieee802154_radio_confirm_on ( ieee802154_dev_t dev)
inlinestatic

Shortcut to ieee802154_radio_ops::confirm_on.

Parameters
[in]devIEEE802.15.4 device descriptor
Returns
result of ieee802154_radio_ops::confirm_on

Definition at line 1047 of file radio.h.

◆ ieee802154_radio_confirm_set_idle()

static int ieee802154_radio_confirm_set_idle ( ieee802154_dev_t dev)
inlinestatic

Confirmation function for ieee802154_radio_request_set_idle.

Precondition
call to ieee802154_radio_request_set_idle was successful.
the device is on
Parameters
[in]devIEEE802.15.4 device descriptor
Returns
whether the state transition finished or not
0 if the transition finished
-EAGAIN otherwise.

Definition at line 1093 of file radio.h.

◆ ieee802154_radio_confirm_set_rx()

static int ieee802154_radio_confirm_set_rx ( ieee802154_dev_t dev)
inlinestatic

Confirmation function for ieee802154_radio_request_set_rx.

Precondition
call to ieee802154_radio_request_set_rx was successful.
the device is on
Parameters
[in]devIEEE802.15.4 device descriptor
Returns
whether the state transition finished or not
0 if the transition finished
-EAGAIN otherwise.

Definition at line 1136 of file radio.h.

◆ ieee802154_radio_confirm_transmit()

static int ieee802154_radio_confirm_transmit ( ieee802154_dev_t dev,
ieee802154_tx_info_t info 
)
inlinestatic

Confirmation function for ieee802154_radio_request_transmit This function must be called to finish the transmission procedure and get the transmission status.

This function should be called on IEEE802154_RADIO_CONFIRM_TX_DONE. If no interrupt is available, this function can be polled.

This functions calls ieee802154_radio_ops::confirm_op with IEEE802154_HAL_OP_TRANSMIT and sets the context to info.

Precondition
the device is on
call to ieee802154_radio_request_transmit was successful.
Parameters
[in]devIEEE802.15.4 device descriptor
[out]infothe TX information. Pass NULL if the information is not needed. If the radio supports AutoCCA, the status should indicate transmission done or channel busy. If the radio supports frame retransmissions, the status should indicate if medium was busy, no ACK was received or transmission succeeded.
Return values
whetherthe transmission finished or not
Returns
0 if the transmission finished
-EAGAIN otherwise

Definition at line 842 of file radio.h.

◆ ieee802154_radio_get_phy_modes()

static uint32_t ieee802154_radio_get_phy_modes ( ieee802154_dev_t dev)
inlinestatic

Get supported PHY modes of the device.

Internally this function reads ieee802154_radio_ops::caps and returns only the bits from IEEE802154_RF_CAPS_PHY_MASK.

Parameters
[in]devIEEE802.15.4 device descriptor
Returns
PHY modes bit mask.

Definition at line 1543 of file radio.h.

◆ ieee802154_radio_has_24_ghz()

static bool ieee802154_radio_has_24_ghz ( ieee802154_dev_t dev)
inlinestatic

Check if the device supports the IEEE802.15.4 2.4 GHz band.

Internally this function reads ieee802154_radio_ops::caps and checks for IEEE802154_CAP_24_GHZ.

Parameters
[in]devIEEE802.15.4 device descriptor
Returns
true if the device has support
false otherwise

Definition at line 1350 of file radio.h.

◆ ieee802154_radio_has_auto_csma()

static bool ieee802154_radio_has_auto_csma ( ieee802154_dev_t dev)
inlinestatic

Check if the device supports Auto CSMA-CA for transmissions.

Internally this function reads ieee802154_radio_ops::caps and checks for IEEE802154_CAP_AUTO_CSMA.

Parameters
[in]devIEEE802.15.4 device descriptor
Returns
true if the device has support
false otherwise

Definition at line 1318 of file radio.h.

◆ ieee802154_radio_has_frame_retrans()

static bool ieee802154_radio_has_frame_retrans ( ieee802154_dev_t dev)
inlinestatic

Check if the device supports frame retransmissions (with CSMA-CA).

Internally this function reads ieee802154_radio_ops::caps and checks for IEEE802154_CAP_FRAME_RETRANS.

Parameters
[in]devIEEE802.15.4 device descriptor
Returns
true if the device has support
false otherwise

Definition at line 1302 of file radio.h.

◆ ieee802154_radio_has_frame_retrans_info()

static bool ieee802154_radio_has_frame_retrans_info ( ieee802154_dev_t dev)
inlinestatic

Check if the device reports the number of retransmissions of the last TX procedure.

Internally this function reads ieee802154_radio_ops::caps and checks for IEEE802154_CAP_FRAME_RETRANS_INFO.

Parameters
[in]devIEEE802.15.4 device descriptor
Returns
true if the device has support
false otherwise

Definition at line 1431 of file radio.h.

◆ ieee802154_radio_has_irq_ack_timeout()

static bool ieee802154_radio_has_irq_ack_timeout ( ieee802154_dev_t dev)
inlinestatic

Check if the device supports ACK timeout.

Internally this function reads ieee802154_radio_ops::caps and checks for IEEE802154_CAP_IRQ_ACK_TIMEOUT.

Parameters
[in]devIEEE802.15.4 device descriptor
Returns
true if the device has support
false otherwise

Definition at line 1286 of file radio.h.

◆ ieee802154_radio_has_irq_cca_done()

static bool ieee802154_radio_has_irq_cca_done ( ieee802154_dev_t dev)
inlinestatic

Check if the device supports CCA done interrupt.

Internally this function reads ieee802154_radio_ops::caps with IEEE802154_CAP_IRQ_CCA_DONE.

Parameters
[in]devIEEE802.15.4 device descriptor
Returns
true if the device has support
false otherwise

Definition at line 1414 of file radio.h.

◆ ieee802154_radio_has_irq_rx_start()

static bool ieee802154_radio_has_irq_rx_start ( ieee802154_dev_t dev)
inlinestatic

Check if the device supports RX start interrupt.

Internally this function reads ieee802154_radio_ops::caps and checks for IEEE802154_CAP_IRQ_RX_START.

Parameters
[in]devIEEE802.15.4 device descriptor
Returns
true if the device has support
false otherwise

Definition at line 1382 of file radio.h.

◆ ieee802154_radio_has_irq_tx_done()

static bool ieee802154_radio_has_irq_tx_done ( ieee802154_dev_t dev)
inlinestatic

Check if the device supports TX done interrupt.

Internally this function reads ieee802154_radio_ops::caps and checks for IEEE802154_CAP_IRQ_TX_DONE.

Parameters
[in]devIEEE802.15.4 device descriptor
Returns
true if the device has support
false otherwise

Definition at line 1366 of file radio.h.

◆ ieee802154_radio_has_irq_tx_start()

static bool ieee802154_radio_has_irq_tx_start ( ieee802154_dev_t dev)
inlinestatic

Check if the device supports TX start interrupt.

Internally this function reads ieee802154_radio_ops::caps and checks for IEEE802154_CAP_IRQ_TX_START.

Parameters
[in]devIEEE802.15.4 device descriptor
Returns
true if the device has support
false otherwise

Definition at line 1398 of file radio.h.

◆ ieee802154_radio_has_phy_ask()

static bool ieee802154_radio_has_phy_ask ( ieee802154_dev_t dev)
inlinestatic

Check if the device supports the ASK PHY mode.

Internally this function reads ieee802154_radio_ops::caps and checks for IEEE802154_CAP_PHY_ASK.

Parameters
[in]devIEEE802.15.4 device descriptor
Returns
true if the device has support
false otherwise

Definition at line 1464 of file radio.h.

◆ ieee802154_radio_has_phy_bpsk()

static bool ieee802154_radio_has_phy_bpsk ( ieee802154_dev_t dev)
inlinestatic

Check if the device supports the BPSK PHY mode.

Internally this function reads ieee802154_radio_ops::caps and checks for IEEE802154_CAP_PHY_BPSK.

Parameters
[in]devIEEE802.15.4 device descriptor
Returns
true if the device has support
false otherwise

Definition at line 1448 of file radio.h.

◆ ieee802154_radio_has_phy_mr_fsk()

static bool ieee802154_radio_has_phy_mr_fsk ( ieee802154_dev_t dev)
inlinestatic

Check if the device supports the MR-FSK PHY mode.

Internally this function reads ieee802154_radio_ops::caps and checks for IEEE802154_CAP_PHY_MR_FSK.

Parameters
[in]devIEEE802.15.4 device descriptor
Returns
true if the device has support
false otherwise

Definition at line 1528 of file radio.h.

◆ ieee802154_radio_has_phy_mr_ofdm()

static bool ieee802154_radio_has_phy_mr_ofdm ( ieee802154_dev_t dev)
inlinestatic

Check if the device supports the MR-OFDM PHY mode.

Internally this function reads ieee802154_radio_ops::caps and checks for IEEE802154_CAP_PHY_MR_OFDM.

Parameters
[in]devIEEE802.15.4 device descriptor
Returns
true if the device has support
false otherwise

Definition at line 1512 of file radio.h.

◆ ieee802154_radio_has_phy_mr_oqpsk()

static bool ieee802154_radio_has_phy_mr_oqpsk ( ieee802154_dev_t dev)
inlinestatic

Check if the device supports the MR-O-QPSK PHY mode.

Internally this function reads ieee802154_radio_ops::caps and checks for IEEE802154_CAP_PHY_MR_OQPSK.

Parameters
[in]devIEEE802.15.4 device descriptor
Returns
true if the device has support
false otherwise

Definition at line 1496 of file radio.h.

◆ ieee802154_radio_has_phy_oqpsk()

static bool ieee802154_radio_has_phy_oqpsk ( ieee802154_dev_t dev)
inlinestatic

Check if the device supports the O-QPSK PHY mode.

Internally this function reads ieee802154_radio_ops::caps and checks for IEEE802154_CAP_PHY_OQPSK.

Parameters
[in]devIEEE802.15.4 device descriptor
Returns
true if the device has support
false otherwise

Definition at line 1480 of file radio.h.

◆ ieee802154_radio_has_sub_ghz()

static bool ieee802154_radio_has_sub_ghz ( ieee802154_dev_t dev)
inlinestatic

Check if the device supports the IEEE802.15.4 Sub-GHz band.

Internally this function reads ieee802154_radio_ops::caps and checks for IEEE802154_CAP_SUB_GHZ.

Parameters
[in]devIEEE802.15.4 device descriptor
Returns
true if the device has support
false otherwise

Definition at line 1334 of file radio.h.

◆ ieee802154_radio_len()

static int ieee802154_radio_len ( ieee802154_dev_t dev)
inlinestatic

Shortcut to ieee802154_radio_ops::len.

Parameters
[in]devIEEE802.15.4 device descriptor
Returns
result of ieee802154_radio_ops::len

Definition at line 855 of file radio.h.

◆ ieee802154_radio_off()

static int ieee802154_radio_off ( ieee802154_dev_t dev)
inlinestatic

Shortcut to ieee802154_radio_ops::off.

Parameters
[in]devIEEE802.15.4 device descriptor
Postcondition
the transceiver state is IDLE.
Returns
result of ieee802154_radio_ops::off

Definition at line 950 of file radio.h.

◆ ieee802154_radio_read()

static int ieee802154_radio_read ( ieee802154_dev_t dev,
void *  buf,
size_t  size,
ieee802154_rx_info_t info 
)
inlinestatic

Shortcut to ieee802154_radio_ops::read.

Parameters
[in]devIEEE802.15.4 device descriptor
[out]bufbuffer to write the received frame into.
[in]sizesize of buf
[in]infoinformation of the received frame (LQI, RSSI). Can be NULL if this information is not needed.
Returns
result of ieee802154_radio_ops::read

Definition at line 871 of file radio.h.

◆ ieee802154_radio_request_cca()

static int ieee802154_radio_request_cca ( ieee802154_dev_t dev)
inlinestatic

Request Stand-Alone Clear Channel Assessment.

This functions calls ieee802154_radio_ops::request_op with IEEE802154_HAL_OP_CCA and NULL context.

Precondition
the device is on
Note
ieee802154_radio_confirm_cca MUST be used to finish the CCA procedure and get the channel status.
Parameters
[in]devIEEE802.15.4 device descriptor
Returns
0 on success
negative errno on error

Definition at line 1211 of file radio.h.

◆ ieee802154_radio_request_on()

static int ieee802154_radio_request_on ( ieee802154_dev_t dev)
inlinestatic

Shortcut to ieee802154_radio_ops::request_on.

Parameters
[in]devIEEE802.15.4 device descriptor
Returns
result of ieee802154_radio_ops::request_on

Definition at line 1035 of file radio.h.

◆ ieee802154_radio_request_set_idle()

static int ieee802154_radio_request_set_idle ( ieee802154_dev_t dev,
bool  force 
)
inlinestatic

Request the transceiver state to IDLE.

During IDLE, the radio won't be able to receive frames but it's still responsive to other HAL functions.

This functions calls ieee802154_radio_ops::request_op with IEEE802154_HAL_OP_SET_IDLE and sets the context to force

Precondition
the device is on
Note
ieee802154_radio_confirm_set_idle MUST be used to finish the state transition.
Parameters
[in]devIEEE802.15.4 device descriptor
[in]forcewhether the state transition should be forced or not. If forced, the transceiver aborts any ongoing operation.
Returns
status of the request
Return values
0on success
negativeerrno on error

Definition at line 1075 of file radio.h.

◆ ieee802154_radio_request_set_rx()

static int ieee802154_radio_request_set_rx ( ieee802154_dev_t dev)
inlinestatic

Request the transceiver state to RX.

During RX, the radio will listen to incoming frames

This functions calls ieee802154_radio_ops::request_op with IEEE802154_HAL_OP_SET_RX and NULL context.

Precondition
the device is on
Note
ieee802154_radio_confirm_set_rx MUST be used to finish the state transition.
Parameters
[in]devIEEE802.15.4 device descriptor
Returns
status of the request
Return values
0on success
negativeerrno on error

Definition at line 1118 of file radio.h.

◆ ieee802154_radio_request_transmit()

static int ieee802154_radio_request_transmit ( ieee802154_dev_t dev)
inlinestatic

Transmit a preloaded frame.

This functions calls ieee802154_radio_ops::request_op with IEEE802154_HAL_OP_TRANSMIT and NULL context.

Precondition
The upper layer should have called set the transceiver to IDLE (see ieee802154_radio_set_idle) and the frame is already in the framebuffer (ieee802154_radio_ops_t::write).
the device is on
Note
ieee802154_radio_confirm_transmit MUST be used to finish the transmission.
Returns
result of ieee802154_radio_request_transmit
Return values
0on success
negativeerrno on error

Definition at line 812 of file radio.h.

◆ ieee802154_radio_set_cca_mode()

static int ieee802154_radio_set_cca_mode ( ieee802154_dev_t dev,
ieee802154_cca_mode_t  mode 
)
inlinestatic

Shortcut to ieee802154_radio_ops::set_cca_mode.

Parameters
[in]devIEEE802.15.4 device descriptor
[in]modethe CCA mode
Returns
result of ieee802154_radio_ops::set_cca_mode

Definition at line 901 of file radio.h.

◆ ieee802154_radio_set_cca_threshold()

static int ieee802154_radio_set_cca_threshold ( ieee802154_dev_t dev,
int8_t  threshold 
)
inlinestatic

Shortcut to ieee802154_radio_ops::set_cca_threshold.

Parameters
[in]devIEEE802.15.4 device descriptor
[in]thresholdthe threshold in dBm
Returns
result of ieee802154_radio_ops::set_cca_threshold

Definition at line 887 of file radio.h.

◆ ieee802154_radio_set_csma_params()

static int ieee802154_radio_set_csma_params ( ieee802154_dev_t dev,
const ieee802154_csma_be_t bd,
int8_t  retries 
)
inlinestatic

Shortcut to ieee802154_radio_ops::set_csma_params.

Precondition
the device is on
the device supports frame retransmissions (ieee802154_radio_has_frame_retrans() == true)
Parameters
[in]devIEEE802.15.4 device descriptor
[in]bdparameters of the exponential backoff
[in]retriesnumber of CSMA-CA retries. If restries < 0, retransmissions with CSMA-CA are disabled
Returns
result of ieee802154_radio_ops::set_csma_params

Definition at line 1021 of file radio.h.

◆ ieee802154_radio_set_frame_filter_mode()

static int ieee802154_radio_set_frame_filter_mode ( ieee802154_dev_t dev,
ieee802154_filter_mode_t  mode 
)
inlinestatic

Shortcut to ieee802154_radio_ops::set_frame_filter_mode.

Precondition
the device is on
Parameters
[in]devIEEE802.15.4 device descriptor
[in]modeframe filter mode
Returns
result of ieee802154_radio_ops::set_frame_filter_mode

Definition at line 983 of file radio.h.

◆ ieee802154_radio_set_frame_retrans()

static int ieee802154_radio_set_frame_retrans ( ieee802154_dev_t dev,
uint8_t  retrans 
)
inlinestatic

Shortcut to ieee802154_radio_ops::set_frame_retrans.

Precondition
the device is on
the device supports frame retransmissions (ieee802154_radio_has_frame_retrans() == true)
Parameters
[in]devIEEE802.15.4 device descriptor
[in]retransthe number of retransmissions
Returns
result of ieee802154_radio_ops::set_frame_retrans

Definition at line 1001 of file radio.h.

◆ ieee802154_radio_set_idle()

static int ieee802154_radio_set_idle ( ieee802154_dev_t dev,
bool  force 
)
inlinestatic

Set transceiver state to IDLE (blocking)

This function will internally call ieee802154_radio_request_set_idle and poll ieee802154_radio_confirm_set_idle.

Precondition
the device is on
Parameters
[in]devIEEE802.15.4 device descriptor
[in]forcewhether the state transition should be forced or not. If forced, the transceiver aborts any ongoing operation.
Returns
result of the state transition
Return values
0on success
negativeerrno on error

Definition at line 1158 of file radio.h.

◆ ieee802154_radio_set_rx()

static int ieee802154_radio_set_rx ( ieee802154_dev_t dev)
inlinestatic

Set transceiver state to RX (blocking)

This function will internally call ieee802154_radio_request_set_rx and poll ieee802154_radio_confirm_set_rx.

Precondition
the device is on
Parameters
[in]devIEEE802.15.4 device descriptor
Returns
result of the state transition
Return values
0on success
negativeerrno on error

Definition at line 1184 of file radio.h.

◆ ieee802154_radio_write()

static int ieee802154_radio_write ( ieee802154_dev_t dev,
const iolist_t psdu 
)
inlinestatic

Shortcut to ieee802154_radio_ops::write.

Parameters
[in]devIEEE802.15.4 device descriptor
[in]psduPSDU frame to be sent
Returns
result of ieee802154_radio_ops::write

Definition at line 788 of file radio.h.