22#ifndef NET_IEEE802154_RADIO_H
23#define NET_IEEE802154_RADIO_H
166#define IEEE802154_RF_CAPS_PHY_MASK \
167 (IEEE802154_CAP_PHY_BPSK \
168 | IEEE802154_CAP_PHY_ASK \
169 | IEEE802154_CAP_PHY_OQPSK \
170 | IEEE802154_CAP_PHY_MR_OQPSK \
171 | IEEE802154_CAP_PHY_MR_OFDM \
172 | IEEE802154_CAP_PHY_MR_FSK) \
876 return dev->
driver->
read(dev, buf, size, info);
Helper functions for bit arithmetic.
#define BIT8
Bit 8 set define.
#define BIT17
Bit 17 set define.
#define BIT11
Bit 11 set define.
#define BIT9
Bit 9 set define.
#define BIT14
Bit 14 set define.
#define BIT18
Bit 18 set define.
#define BIT1
Bit 1 set define.
#define BIT16
Bit 16 set define.
#define BIT10
Bit 10 set define.
#define BIT3
Bit 3 set define.
#define BIT13
Bit 13 set define.
#define BIT2
Bit 2 set define.
#define BIT7
Bit 7 set define.
#define BIT4
Bit 4 set define.
#define BIT12
Bit 12 set define.
#define BIT6
Bit 6 set define.
#define BIT0
Bit 0 set define.
#define BIT15
Bit 15 set define.
#define BIT5
Bit 5 set define.
Functions to work with different byte orders.
EUI-64 data type definition.
#define EAGAIN
Resource unavailable, try again (may be the same value as [EWOULDBLOCK]).
static int ieee802154_radio_confirm_on(ieee802154_dev_t *dev)
Shortcut to ieee802154_radio_ops::confirm_on.
static int ieee802154_radio_cca(ieee802154_dev_t *dev)
Perform a Clear Channel Assessment (blocking)
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_phy_ask(ieee802154_dev_t *dev)
Check if the device supports the ASK PHY mode.
static int ieee802154_radio_set_idle(ieee802154_dev_t *dev, bool force)
Set transceiver state to IDLE (blocking)
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_read(ieee802154_dev_t *dev, void *buf, size_t size, ieee802154_rx_info_t *info)
Shortcut to ieee802154_radio_ops::read.
ieee802154_cca_mode_t
IEEE802.15.4 CCA modes.
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_confirm_cca(ieee802154_dev_t *dev)
Shortcut to ieee802154_radio_confirm_cca.
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_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 th...
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.
static int ieee802154_radio_confirm_set_idle(ieee802154_dev_t *dev)
Confirmation function for ieee802154_radio_request_set_idle.
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 int ieee802154_radio_set_cca_mode(ieee802154_dev_t *dev, ieee802154_cca_mode_t mode)
Shortcut to ieee802154_radio_ops::set_cca_mode.
ieee802154_src_match_t
Source Address Match commands.
static int ieee802154_radio_request_set_idle(ieee802154_dev_t *dev, bool force)
Request the transceiver state to IDLE.
ieee802154_rf_caps_t
IEEE802.15.4 Radio capabilities.
static int ieee802154_radio_off(ieee802154_dev_t *dev)
Shortcut to ieee802154_radio_ops::off.
static bool ieee802154_radio_has_irq_ack_timeout(ieee802154_dev_t *dev)
Check if the device supports ACK timeout.
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_phy_bpsk(ieee802154_dev_t *dev)
Check if the device supports the BPSK PHY mode.
static int ieee802154_radio_request_cca(ieee802154_dev_t *dev)
Request Stand-Alone Clear Channel Assessment.
static bool ieee802154_radio_has_phy_mr_fsk(ieee802154_dev_t *dev)
Check if the device supports the MR-FSK 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.
ieee802154_trx_ev_t
IEEE802.15.4 Radio HAL events.
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.
ieee802154_hal_op_t
IEEE 802.15.4 radio operations.
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_sub_ghz(ieee802154_dev_t *dev)
Check if the device supports the IEEE802.15.4 Sub-GHz band.
static int ieee802154_radio_request_transmit(ieee802154_dev_t *dev)
Transmit a preloaded frame.
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.
ieee802154_tx_status_t
Transmission status.
static int ieee802154_radio_len(ieee802154_dev_t *dev)
Shortcut to ieee802154_radio_ops::len.
#define IEEE802154_RF_CAPS_PHY_MASK
Bit-mask for PHY modes capabilities.
static int ieee802154_radio_request_on(ieee802154_dev_t *dev)
Shortcut to ieee802154_radio_ops::request_on.
ieee802154_af_cmd_t
Address filter command.
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_rx(ieee802154_dev_t *dev)
Set transceiver state to RX (blocking)
static int ieee802154_radio_write(ieee802154_dev_t *dev, const iolist_t *psdu)
Shortcut to ieee802154_radio_ops::write.
static int ieee802154_radio_set_cca_threshold(ieee802154_dev_t *dev, int8_t threshold)
Shortcut to ieee802154_radio_ops::set_cca_threshold.
static uint32_t ieee802154_radio_get_phy_modes(ieee802154_dev_t *dev)
Get supported PHY modes of the device.
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.
void(* ieee802154_cb_t)(ieee802154_dev_t *dev, ieee802154_trx_ev_t status)
Prototype of the IEEE802.15.4 device event callback.
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.
ieee802154_filter_mode_t
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 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_auto_csma(ieee802154_dev_t *dev)
Check if the device supports Auto CSMA-CA for transmissions.
static int ieee802154_radio_confirm_set_rx(ieee802154_dev_t *dev)
Confirmation function for ieee802154_radio_request_set_rx.
static bool ieee802154_radio_has_frame_retrans(ieee802154_dev_t *dev)
Check if the device supports frame retransmissions (with CSMA-CA).
static int ieee802154_radio_request_set_rx(ieee802154_dev_t *dev)
Request the transceiver state to RX.
@ IEEE802154_CCA_MODE_ED_THRESHOLD
CCA using first mode (energy detection)
@ IEEE802154_CCA_MODE_ED_THRESH_OR_CS
CCA using third mode (energy detection OR carrier sensing)
@ IEEE802154_CCA_MODE_ED_THRESH_AND_CS
CCA using third mode (energy detection AND carrier sensing)
@ IEEE802154_CCA_MODE_CARRIER_SENSING
CCA using second mode (carrier sensing)
@ IEEE802154_SRC_MATCH_EXT_CLEAR
Clear extended address from entry.
@ IEEE802154_SRC_MATCH_EN
Enable or disable source address match.
@ IEEE802154_SRC_MATCH_EXT_ADD
Add a extended address to entry.
@ IEEE802154_SRC_MATCH_SHORT_ADD
Add a short address to entry.
@ IEEE802154_SRC_MATCH_SHORT_CLEAR
Clear short address from entry.
@ IEEE802154_CAP_PHY_BPSK
Binary Phase Shift Keying PHY mode.
@ IEEE802154_CAP_FRAME_RETRANS_INFO
the device provides the number of retransmissions
@ IEEE802154_CAP_FRAME_RETRANS
the device supports frame retransmissions with CSMA-CA
@ IEEE802154_CAP_IRQ_RX_START
the device reports the start of a frame (SFD) when received.
@ IEEE802154_CAP_IRQ_ACK_TIMEOUT
the device support ACK timeout interrupt
@ IEEE802154_CAP_IRQ_TX_DONE
the device reports when the transmission is done
@ IEEE802154_CAP_SRC_ADDR_MATCH
the device supports source address match table.
@ 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_REG_RETENTION
the device retains all register values when off.
@ IEEE802154_CAP_PHY_MR_FSK
Multi-Rate Frequency Shift Keying PHY mode.
@ IEEE802154_CAP_PHY_ASK
Amplitude-Shift Keying PHY mode.
@ IEEE802154_CAP_AUTO_CSMA
the device supports Auto CSMA-CA
@ IEEE802154_CAP_IRQ_CRC_ERROR
the device reports reception off frames with invalid CRC.
@ IEEE802154_CAP_SUB_GHZ
the device support the IEEE802.15.4 Sub GHz band
@ 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_24_GHZ
the device supports the IEEE802.15.4 2.4 GHz band
@ IEEE802154_CAP_PHY_MR_OFDM
Multi-Rate Orthogonal Frequency-Division Multiplexing PHY mode.
@ IEEE802154_RADIO_INDICATION_CRC_ERROR
the transceiver received a frame with an invalid crc.
@ IEEE802154_RADIO_INDICATION_TX_START
the transceiver sent out a valid SFD
@ IEEE802154_RADIO_CONFIRM_CCA
the CCA procedure finished
@ IEEE802154_RADIO_INDICATION_RX_START
the transceiver detected a valid SFD
@ IEEE802154_RADIO_INDICATION_RX_DONE
the transceiver received a frame and lies in the internal framebuffer.
@ IEEE802154_RADIO_CONFIRM_TX_DONE
the transceiver either finished sending a frame, the retransmission procedure or the channel activity...
@ IEEE802154_HAL_OP_TRANSMIT
Transmission of a preloaded frame.
@ IEEE802154_HAL_OP_CCA
Request Clear Channel Assessment.
@ IEEE802154_HAL_OP_SET_IDLE
Set the transceiver state to IDLE (RX off).
@ IEEE802154_HAL_OP_SET_RX
Set the transceiver state to RX.
@ TX_STATUS_FRAME_PENDING
the transceiver received a valid ACK with the frame pending bit
@ TX_STATUS_SUCCESS
the transceiver successfully sent a frame.
@ TX_STATUS_MEDIUM_BUSY
the CSMA-CA algorithm or CCA failed to measure a clear channel
@ TX_STATUS_NO_ACK
the transceiver ran out of retransmission
@ IEEE802154_AF_PAN_COORD
Set device as PAN coordinator (bool)
@ IEEE802154_AF_EXT_ADDR
Set extended IEEE 802.15.4 address (eui64_t)
@ IEEE802154_AF_SHORT_ADDR
Set short IEEE 802.15.4 address (network_uint16_t)
@ IEEE802154_AF_PANID
Set PAN ID (uint16_t)
@ IEEE802154_FILTER_SNIFFER
accept all frames, regardless of FCS
@ IEEE802154_FILTER_ACCEPT
accept all valid frames that match address filter configuration
@ IEEE802154_FILTER_ACK_ONLY
accept only ACK frames
@ IEEE802154_FILTER_PROMISC
accept all valid frames
iolist scatter / gather IO
CSMA-CA exponential backoff parameters.
uint8_t max
maximum value of the exponential backoff
uint8_t min
minimum value of the exponential backoff
the IEEE802.15.4 device descriptor
const ieee802154_radio_ops_t * driver
pointer to the operations of the device
ieee802154_cb_t cb
the event callback of the device
void * priv
pointer to the private descriptor of the device
Holder of the PHY configuration.
uint8_t page
IEEE802.15.4 channel page.
uint16_t channel
IEEE802.15.4 channel number.
int8_t pow
TX power in dBm.
ieee802154_phy_mode_t phy_mode
IEEE802.15.4 PHY mode.
Radio ops struct declaration.
int(* set_cca_mode)(ieee802154_dev_t *dev, ieee802154_cca_mode_t mode)
Set CCA mode.
const uint32_t caps
Radio device capabilities.
int(* request_op)(ieee802154_dev_t *dev, ieee802154_hal_op_t op, void *ctx)
Request a radio operation.
int(* confirm_on)(ieee802154_dev_t *dev)
Confirmation function for ieee802154_radio_ops::request_on.
int(* set_cca_threshold)(ieee802154_dev_t *dev, int8_t threshold)
Set the threshold for the Energy Detection (first mode of CCA)
int(* set_csma_params)(ieee802154_dev_t *dev, const ieee802154_csma_be_t *bd, int8_t retries)
Set the CSMA-CA parameters.
int(* config_src_addr_match)(ieee802154_dev_t *dev, ieee802154_src_match_t cmd, const void *value)
Set the source address match configuration.
int(* config_phy)(ieee802154_dev_t *dev, const ieee802154_phy_conf_t *conf)
Set IEEE802.15.4 PHY configuration (channel, TX power)
int(* off)(ieee802154_dev_t *dev)
Turn off the device.
int(* write)(ieee802154_dev_t *dev, const iolist_t *psdu)
Write a frame into the framebuffer.
int(* len)(ieee802154_dev_t *dev)
Get the length of the received PSDU frame.
int(* set_frame_filter_mode)(ieee802154_dev_t *dev, ieee802154_filter_mode_t mode)
Set the frame filter moder.
int(* read)(ieee802154_dev_t *dev, void *buf, size_t size, ieee802154_rx_info_t *info)
Read a frame from the internal framebuffer.
int(* request_on)(ieee802154_dev_t *dev)
Request to turn on the device.
int(* confirm_op)(ieee802154_dev_t *dev, ieee802154_hal_op_t op, void *ctx)
Confirmation function for ieee802154_radio_ops::request_op.
int(* set_frame_retrans)(ieee802154_dev_t *dev, uint8_t retrans)
Set number of frame retransmissions.
int(* config_addr_filter)(ieee802154_dev_t *dev, ieee802154_af_cmd_t cmd, const void *value)
Configure the address filter.
RX information associated to a frame.
uint8_t rssi
RSSI of the received frame.
uint8_t lqi
LQI of the received frame.
TX information of the last transmitted frame.
int8_t retrans
number of frame retransmissions of the last TX
ieee802154_tx_status_t status
status of the last transmission
iolist structure definition
IEEE 802.15.4 header definitions.
libc header for scatter/gather I/O