22 #ifndef NET_IEEE802154_RADIO_H
23 #define NET_IEEE802154_RADIO_H
668 const uint16_t *pan_id);
786 return dev->
driver->
read(dev, buf, size, info);
864 const uint16_t *pan_id)
Holder of the PHY configuration.
uint8_t rssi
RSSI of the received frame.
@ IEEE802154_CAP_FRAME_RETRANS_INFO
the device provides the number of retransmissions
static int ieee802154_radio_set_rx_mode(ieee802154_dev_t *dev, ieee802154_rx_mode_t mode)
Shortcut to ieee802154_radio_ops::set_rx_mode.
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_CCA_MODE_ED_THRESH_OR_CS
CCA using third mode (energy detection OR carrier sensing)
int(* off)(ieee802154_dev_t *dev)
Turn off the device.
@ IEEE802154_CAP_IRQ_CCA_DONE
the device reports the end of the CCA procedure
int(* set_cca_mode)(ieee802154_dev_t *dev, ieee802154_cca_mode_t mode)
Set CCA mode.
void * ctx
pointer to the context of the device
@ IEEE802154_CCA_MODE_ED_THRESHOLD
CCA using first mode (energy detection)
int8_t retrans
number of frame retransmissions of the last TX
@ IEEE802154_RX_AACK_DISABLED
Auto ACK is disabled.
int(* set_cca_threshold)(ieee802154_dev_t *dev, int8_t threshold)
Set the threshold for the Energy Detection (first mode of CCA)
int(* confirm_cca)(ieee802154_dev_t *dev)
Confirmation function for ieee802154_radio_ops::request_cca.
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_transmit(ieee802154_dev_t *dev, ieee802154_tx_info_t *info)
Shortcut to ieee802154_radio_ops::confirm_transmit.
Functions to work with different byte orders.
@ TX_STATUS_FRAME_PENDING
the transceiver received a valid ACK with the frame pending bit
A 16 bit integer in big endian aka network byte order.
@ TX_STATUS_MEDIUM_BUSY
the CSMA-CA algorithm or CCA failed to measure a clear channel
int(* request_on)(ieee802154_dev_t *dev)
Request to turn on the device.
uint8_t lqi
LQI of the received frame.
@ IEEE802154_CAP_IRQ_ACK_TIMEOUT
the device support ACK timeout interrupt
int(* confirm_transmit)(ieee802154_dev_t *dev, ieee802154_tx_info_t *info)
Confirmation function for ieee802154_radio_ops::request_transmit.
@ TX_STATUS_NO_ACK
the transceiver ran out of retransmission
static int ieee802154_radio_len(ieee802154_dev_t *dev)
Shortcut to ieee802154_radio_ops::len.
static int ieee802154_radio_request_cca(ieee802154_dev_t *dev)
Shortcut to ieee802154_radio_ops::request_cca.
RX information associated to a frame.
static bool ieee802154_radio_has_irq_rx_start(ieee802154_dev_t *dev)
Check if the device supports RX start interrupt.
@ IEEE802154_RX_AACK_ENABLED
Auto ACK is enabled.
uint16_t channel
IEEE802.15.4 channel number.
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_set_hw_addr_filter(ieee802154_dev_t *dev, const network_uint16_t *short_addr, const eui64_t *ext_addr, const uint16_t *pan_id)
Shortcut to ieee802154_radio_ops::set_hw_addr_filter.
static int ieee802154_radio_confirm_cca(ieee802154_dev_t *dev)
Shortcut to ieee802154_radio_ops::confirm_cca.
static bool ieee802154_radio_has_irq_ack_timeout(ieee802154_dev_t *dev)
Check if the device supports ACK timeout.
int(* config_phy)(ieee802154_dev_t *dev, const ieee802154_phy_conf_t *conf)
Set IEEE802.15.4 PHY configuration (channel, TX power)
@ IEEE802154_CAP_24_GHZ
the device supports the IEEE802.15.4 2.4 GHz band
int(* confirm_set_trx_state)(ieee802154_dev_t *dev)
Confirmation function for ieee802154_radio_ops::request_set_trx_state.
@ IEEE802154_CCA_MODE_ED_THRESH_AND_CS
CCA using third mode (energy detection AND carrier sensing)
iolist scatter / gather IO
int(* request_set_trx_state)(ieee802154_dev_t *dev, ieee802154_trx_state_t state)
Request a PHY state change.
int(* confirm_on)(ieee802154_dev_t *dev)
Confirmation function for ieee802154_radio_ops::request_on.
CSMA-CA exponential backoff parameters.
ieee802154_tx_status_t status
status of the last transmission
@ IEEE802154_RADIO_CONFIRM_CCA
the CCA procedure finished
static int ieee802154_radio_request_set_trx_state(ieee802154_dev_t *dev, ieee802154_trx_state_t state)
Shortcut to ieee802154_radio_ops::request_set_trx_state.
@ IEEE802154_RX_AACK_FRAME_PENDING
Auto ACK is enabled and frame pending bit set in the next ACK frame.
ieee802154_trx_state_t
IEEE802.15.4 transceiver states (not to confuse with device states)
int(* read)(ieee802154_dev_t *dev, void *buf, size_t size, ieee802154_rx_info_t *info)
Read a frame from the internal framebuffer.
static int ieee802154_radio_confirm_on(ieee802154_dev_t *dev)
Shortcut to ieee802154_radio_ops::confirm_on.
TX information of the last transmitted frame.
@ IEEE802154_CAP_REG_RETENTION
the device retains all register values when off.
@ IEEE802154_CAP_SUB_GHZ
the device support the IEEE802.15.4 Sub GHz band
static int ieee802154_radio_off(ieee802154_dev_t *dev)
Shortcut to ieee802154_radio_ops::off.
uint8_t page
IEEE802.15.4 channel page.
int(* write)(ieee802154_dev_t *dev, const iolist_t *psdu)
Write a frame into the framebuffer.
static bool ieee802154_radio_has_irq_cca_done(ieee802154_dev_t *dev)
Check if the device supports CCA done interrupt.
@ IEEE802154_CAP_IRQ_RX_START
the device reports the start of a frame (SFD) when received.
@ IEEE802154_CAP_FRAME_RETRANS
the device supports frame retransmissions with CSMA-CA
@ IEEE802154_CCA_MODE_CARRIER_SENSING
CCA using second mode (carrier sensing)
@ IEEE802154_CAP_AUTO_CSMA
the device supports Auto CSMA-CA
@ IEEE802154_RADIO_INDICATION_RX_START
the transceiver detected a valid SFD
int(* request_transmit)(ieee802154_dev_t *dev)
Request the transmission of a preloaded frame.
@ IEEE802154_TRX_STATE_TRX_OFF
the transceiver state is off
@ IEEE802154_CAP_IRQ_TX_START
the device reports the start of a frame (SFD) was sent.
static int ieee802154_radio_write(ieee802154_dev_t *dev, const iolist_t *psdu)
Shortcut to ieee802154_radio_ops::write.
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_confirm_set_trx_state(ieee802154_dev_t *dev)
Shortcut to ieee802154_radio_ops::confirm_set_trx_state.
iolist structure definition
ieee802154_trx_ev_t
IEEE802.15.4 Radio HAL events.
the IEEE802.15.4 device descriptor
void(* ieee802154_cb_t)(ieee802154_dev_t *dev, ieee802154_trx_ev_t status)
Prototype of the IEEE802.15.4 device event callback.
uint8_t max
maximum value of the exponential backoff
ieee802154_rf_caps_t
IEEE802.15.4 Radio capabilities.
libc header for scatter/gather I/O
bool(* get_cap)(ieee802154_dev_t *dev, ieee802154_rf_caps_t cap)
Get a cap from the radio.
static int ieee802154_radio_set_cca_mode(ieee802154_dev_t *dev, ieee802154_cca_mode_t mode)
Shortcut to ieee802154_radio_ops::set_cca_mode.
uint8_t min
minimum value of the exponential backoff
ieee802154_rx_mode_t
RX mode configuration.
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_RX_PROMISC
Radio is in promiscuous mode.
Radio ops struct declaration.
static int ieee802154_radio_request_transmit(ieee802154_dev_t *dev)
Shortcut to ieee802154_radio_ops::request_transmit.
static int ieee802154_radio_set_cca_threshold(ieee802154_dev_t *dev, int8_t threshold)
Shortcut to ieee802154_radio_ops::set_cca_threshold.
@ IEEE802154_TRX_STATE_TX_ON
the transceiver is ready to transmit/transmitting a frame
@ IEEE802154_RADIO_CONFIRM_TX_DONE
the transceiver either finished sending a frame, the retransmission procedure or the channel activity...
int(* set_csma_params)(ieee802154_dev_t *dev, const ieee802154_csma_be_t *bd, int8_t retries)
Set the CSMA-CA parameters.
static bool ieee802154_radio_has_irq_tx_start(ieee802154_dev_t *dev)
Check if the device supports TX start interrupt.
Data type to represent an EUI-64.
int8_t pow
TX power in dBm.
@ TX_STATUS_SUCCESS
the transceiver successfully sent a frame.
ieee802154_tx_status_t
Transmission status.
static int ieee802154_radio_request_on(ieee802154_dev_t *dev)
Shortcut to ieee802154_radio_ops::request_on.
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.
int(* set_rx_mode)(ieee802154_dev_t *dev, ieee802154_rx_mode_t mode)
Set the RX mode.
int(* len)(ieee802154_dev_t *dev)
Get the length of the received PSDU frame.
ieee802154_cb_t cb
the event callback of the device
@ IEEE802154_TRX_STATE_RX_ON
the transceiver is ready to receive/receiving frames
EUI-64 data type definition.
@ IEEE802154_RADIO_INDICATION_RX_DONE
the transceiver received a frame and lies in the internal framebuffer.
int(* set_hw_addr_filter)(ieee802154_dev_t *dev, const network_uint16_t *short_addr, const eui64_t *ext_addr, const uint16_t *pan_id)
Set IEEE802.15.4 addresses in hardware address filter.
@ IEEE802154_RX_WAIT_FOR_ACK
Radio is ready to receive ACK frames.
static bool ieee802154_radio_has_24_ghz(ieee802154_dev_t *dev)
Check if the device supports the IEEE802.15.4 2.4 GHz band.
ieee802154_cca_mode_t
IEEE802.15.4 CCA modes.
int(* set_frame_retrans)(ieee802154_dev_t *dev, uint8_t retrans)
Set number of frame retransmissions.
@ IEEE802154_CAP_IRQ_TX_DONE
the device reports when the transmission is done
static bool ieee802154_radio_has_irq_tx_done(ieee802154_dev_t *dev)
Check if the device supports TX done interrupt.
int(* request_cca)(ieee802154_dev_t *dev)
Request Stand-Alone Clear Channel Assessment.
const ieee802154_radio_ops_t * driver
pointer to the operations of the device
static bool ieee802154_radio_has_sub_ghz(ieee802154_dev_t *dev)
Check if the device supports the IEEE802.15.4 Sub-GHz band.
@ IEEE802154_RADIO_INDICATION_TX_START
the transceiver sent out a valid SFD
static int ieee802154_radio_set_frame_retrans(ieee802154_dev_t *dev, uint8_t retrans)
Shortcut to ieee802154_radio_ops::set_frame_retrans.