radio.h
1 /*
2  * Copyright (C) 2020 HAW Hamburg
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser General
5  * Public License v2.1. See the file LICENSE in the top level directory for more
6  * details.
7  */
8 
22 #ifndef NET_IEEE802154_RADIO_H
23 #define NET_IEEE802154_RADIO_H
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 #include <stdbool.h>
30 #include "iolist.h"
31 #include "sys/uio.h"
32 #include "bitarithm.h"
33 #include "byteorder.h"
34 #include "net/eui64.h"
35 #include "net/ieee802154.h"
36 #include "errno.h"
37 
42 
48 typedef enum {
162 
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) \
173 
177 typedef enum {
211 
218 typedef enum {
225 
238 
247 
269 
286 
290 typedef enum {
327 
331 typedef enum {
337 
341 typedef enum {
367 
371 typedef struct {
372  uint8_t min;
373  uint8_t max;
375 
379 typedef struct {
386  uint8_t rssi;
387  uint8_t lqi;
389 
393 typedef struct {
395  int8_t retrans;
397 
401 typedef struct ieee802154_dev ieee802154_dev_t;
402 
409 typedef void (*ieee802154_cb_t)(ieee802154_dev_t *dev,
410  ieee802154_trx_ev_t status);
411 
423  void *priv;
428 };
429 
433 typedef enum {
451 
455 typedef struct {
457  uint16_t channel;
458  uint8_t page;
459  int8_t pow;
461 
465 typedef enum {
482 
483  /* add more as needed (e.g Energy Scanning, transmit slotted ACK) */
485 
496  const uint32_t caps;
497 
510  int (*write)(ieee802154_dev_t *dev, const iolist_t *psdu);
511 
525  int (*len)(ieee802154_dev_t *dev);
526 
550  int (*read)(ieee802154_dev_t *dev, void *buf, size_t size, ieee802154_rx_info_t *info);
563  int (*off)(ieee802154_dev_t *dev);
564 
579 
607 
623  int (*request_op)(ieee802154_dev_t *dev, ieee802154_hal_op_t op, void *ctx);
624 
639  int (*confirm_op)(ieee802154_dev_t *dev, ieee802154_hal_op_t op, void *ctx);
640 
652  int (*set_cca_threshold)(ieee802154_dev_t *dev, int8_t threshold);
653 
669 
690 
705  int (*set_frame_retrans)(ieee802154_dev_t *dev, uint8_t retrans);
706 
726  int8_t retries);
727 
740 
756  int (*config_addr_filter)(ieee802154_dev_t *dev, ieee802154_af_cmd_t cmd, const void *value);
757 
777  const void *value);
778 };
779 
788 static inline int ieee802154_radio_write(ieee802154_dev_t *dev, const iolist_t *psdu)
789 {
790  return dev->driver->write(dev, psdu);
791 }
792 
813 {
814  return dev->driver->request_op(dev, IEEE802154_HAL_OP_TRANSMIT, NULL);
815 }
816 
843  ieee802154_tx_info_t *info)
844 {
845  return dev->driver->confirm_op(dev, IEEE802154_HAL_OP_TRANSMIT, info);
846 }
847 
855 static inline int ieee802154_radio_len(ieee802154_dev_t *dev)
856 {
857  return dev->driver->len(dev);
858 }
859 
872  void *buf,
873  size_t size,
874  ieee802154_rx_info_t *info)
875 {
876  return dev->driver->read(dev, buf, size, info);
877 }
878 
888  int8_t threshold)
889 {
890  return dev->driver->set_cca_threshold(dev, threshold);
891 }
892 
903 {
904  return dev->driver->set_cca_mode(dev, mode);
905 }
906 
918  const ieee802154_phy_conf_t *conf)
919 {
920  return dev->driver->config_phy(dev, conf);
921 }
922 
936  const void *value)
937 {
938  return dev->driver->config_src_addr_match(dev, cmd, value);
939 }
940 
950 static inline int ieee802154_radio_off(ieee802154_dev_t *dev)
951 {
952  return dev->driver->off(dev);
953 }
954 
968  const void* value)
969 {
970  return dev->driver->config_addr_filter(dev, cmd, value);
971 }
972 
985 {
986  return dev->driver->set_frame_filter_mode(dev, mode);
987 }
988 
1002  uint8_t retrans)
1003 {
1004  return dev->driver->set_frame_retrans(dev, retrans);
1005 }
1006 
1022  const ieee802154_csma_be_t *bd,
1023  int8_t retries)
1024 {
1025  return dev->driver->set_csma_params(dev, bd, retries);
1026 }
1027 
1036 {
1037  return dev->driver->request_on(dev);
1038 }
1039 
1048 {
1049  return dev->driver->confirm_on(dev);
1050 }
1051 
1075 static inline int ieee802154_radio_request_set_idle(ieee802154_dev_t *dev, bool force)
1076 {
1077  return dev->driver->request_op(dev, IEEE802154_HAL_OP_SET_IDLE, &force);
1078 }
1079 
1094 {
1095  return dev->driver->confirm_op(dev, IEEE802154_HAL_OP_SET_IDLE, NULL);
1096 }
1097 
1119 {
1120  return dev->driver->request_op(dev, IEEE802154_HAL_OP_SET_RX, NULL);
1121 }
1122 
1137 {
1138  return dev->driver->confirm_op(dev, IEEE802154_HAL_OP_SET_RX, NULL);
1139 }
1140 
1158 static inline int ieee802154_radio_set_idle(ieee802154_dev_t *dev, bool force)
1159 {
1160  int res = ieee802154_radio_request_set_idle(dev, force);
1161  if (res < 0) {
1162  return res;
1163  }
1164  while (ieee802154_radio_confirm_set_idle(dev) == -EAGAIN) {}
1165 
1166  return 0;
1167 }
1168 
1185 {
1186  int res = ieee802154_radio_request_set_rx(dev);
1187  if (res < 0) {
1188  return res;
1189  }
1190  while (ieee802154_radio_confirm_set_rx(dev) == -EAGAIN) {}
1191 
1192  return 0;
1193 }
1194 
1212 {
1213  return dev->driver->request_op(dev, IEEE802154_HAL_OP_CCA, NULL);
1214 }
1215 
1239 {
1240  bool clear;
1241  int res = dev->driver->confirm_op(dev, IEEE802154_HAL_OP_CCA, &clear);
1242  if (res < 0) {
1243  return res;
1244  }
1245  return clear;
1246 }
1247 
1265 {
1266  int res = ieee802154_radio_request_cca(dev);
1267  if (res < 0) {
1268  return res;
1269  }
1270  while (ieee802154_radio_confirm_cca(dev) == -EAGAIN) {}
1271 
1272  return 0;
1273 }
1274 
1287 {
1288  return (dev->driver->caps & IEEE802154_CAP_IRQ_ACK_TIMEOUT);
1289 }
1290 
1303 {
1304  return (dev->driver->caps & IEEE802154_CAP_FRAME_RETRANS);
1305 }
1306 
1319 {
1320  return (dev->driver->caps & IEEE802154_CAP_AUTO_CSMA);
1321 }
1322 
1335 {
1336  return (dev->driver->caps & IEEE802154_CAP_SUB_GHZ);
1337 }
1338 
1351 {
1352  return (dev->driver->caps & IEEE802154_CAP_24_GHZ);
1353 }
1354 
1367 {
1368  return (dev->driver->caps & IEEE802154_CAP_IRQ_TX_DONE);
1369 }
1370 
1383 {
1384  return (dev->driver->caps & IEEE802154_CAP_IRQ_RX_START);
1385 }
1386 
1399 {
1400  return (dev->driver->caps & IEEE802154_CAP_IRQ_TX_START);
1401 }
1402 
1415 {
1416  return (dev->driver->caps & IEEE802154_CAP_IRQ_CCA_DONE);
1417 }
1418 
1432  ieee802154_dev_t *dev)
1433 {
1435 }
1436 
1449 {
1450  return (dev->driver->caps & IEEE802154_CAP_PHY_BPSK);
1451 }
1452 
1465 {
1466  return (dev->driver->caps & IEEE802154_CAP_PHY_ASK);
1467 }
1468 
1481 {
1482  return (dev->driver->caps & IEEE802154_CAP_PHY_OQPSK);
1483 }
1484 
1497 {
1498  return (dev->driver->caps & IEEE802154_CAP_PHY_MR_OQPSK);
1499 }
1500 
1513 {
1514  return (dev->driver->caps & IEEE802154_CAP_PHY_MR_OFDM);
1515 }
1516 
1529 {
1530  return (dev->driver->caps & IEEE802154_CAP_PHY_MR_FSK);
1531 }
1532 
1544 {
1545  return (dev->driver->caps & IEEE802154_RF_CAPS_PHY_MASK);
1546 }
1547 
1558 static inline uint32_t ieee802154_phy_mode_to_cap(
1559  ieee802154_phy_mode_t phy_mode)
1560 {
1561  switch (phy_mode) {
1562  case IEEE802154_PHY_BPSK:
1563  return IEEE802154_CAP_PHY_BPSK;
1564  case IEEE802154_PHY_ASK:
1565  return IEEE802154_CAP_PHY_ASK;
1566  case IEEE802154_PHY_OQPSK:
1567  return IEEE802154_CAP_PHY_OQPSK;
1572  case IEEE802154_PHY_MR_FSK:
1574 
1576  default:
1577  break;
1578  }
1579 
1580  return 0;
1581 }
1582 
1595 {
1596  switch (cap) {
1598  return IEEE802154_PHY_BPSK;
1600  return IEEE802154_PHY_ASK;
1602  return IEEE802154_PHY_OQPSK;
1604  return IEEE802154_PHY_MR_OQPSK;
1606  return IEEE802154_PHY_MR_OFDM;
1608  return IEEE802154_PHY_MR_FSK;
1609 
1610  default:
1611  break;
1612  }
1613 
1614  return IEEE802154_PHY_DISABLED;
1615 }
1616 
1617 #ifdef __cplusplus
1618 }
1619 #endif
1620 
1621 #endif /* NET_IEEE802154_RADIO_H */
Helper functions for bit arithmetic.
#define BIT8
Bit 8 set define.
Definition: bitarithm.h:67
#define BIT17
Bit 17 set define.
Definition: bitarithm.h:78
#define BIT11
Bit 11 set define.
Definition: bitarithm.h:70
#define BIT9
Bit 9 set define.
Definition: bitarithm.h:68
#define BIT14
Bit 14 set define.
Definition: bitarithm.h:73
#define BIT18
Bit 18 set define.
Definition: bitarithm.h:79
#define BIT1
Bit 1 set define.
Definition: bitarithm.h:60
#define BIT16
Bit 16 set define.
Definition: bitarithm.h:77
#define BIT10
Bit 10 set define.
Definition: bitarithm.h:69
#define BIT3
Bit 3 set define.
Definition: bitarithm.h:62
#define BIT13
Bit 13 set define.
Definition: bitarithm.h:72
#define BIT2
Bit 2 set define.
Definition: bitarithm.h:61
#define BIT7
Bit 7 set define.
Definition: bitarithm.h:66
#define BIT4
Bit 4 set define.
Definition: bitarithm.h:63
#define BIT12
Bit 12 set define.
Definition: bitarithm.h:71
#define BIT6
Bit 6 set define.
Definition: bitarithm.h:65
#define BIT0
Bit 0 set define.
Definition: bitarithm.h:59
#define BIT15
Bit 15 set define.
Definition: bitarithm.h:74
#define BIT5
Bit 5 set define.
Definition: bitarithm.h:64
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]).
Definition: errno.h:75
static int ieee802154_radio_confirm_on(ieee802154_dev_t *dev)
Shortcut to ieee802154_radio_ops::confirm_on.
Definition: radio.h:1047
static int ieee802154_radio_cca(ieee802154_dev_t *dev)
Perform a Clear Channel Assessment (blocking)
Definition: radio.h:1264
static bool ieee802154_radio_has_irq_tx_done(ieee802154_dev_t *dev)
Check if the device supports TX done interrupt.
Definition: radio.h:1366
static bool ieee802154_radio_has_phy_ask(ieee802154_dev_t *dev)
Check if the device supports the ASK PHY mode.
Definition: radio.h:1464
static int ieee802154_radio_set_idle(ieee802154_dev_t *dev, bool force)
Set transceiver state to IDLE (blocking)
Definition: radio.h:1158
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.
Definition: radio.h:934
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.
Definition: radio.h:871
ieee802154_cca_mode_t
IEEE802.15.4 CCA modes.
Definition: radio.h:433
static int ieee802154_radio_config_phy(ieee802154_dev_t *dev, const ieee802154_phy_conf_t *conf)
Shortcut to ieee802154_radio_ops::config_phy.
Definition: radio.h:917
static int ieee802154_radio_confirm_cca(ieee802154_dev_t *dev)
Shortcut to ieee802154_radio_confirm_cca.
Definition: radio.h:1238
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.
Definition: radio.h:1021
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...
Definition: radio.h:842
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.
Definition: radio.h:1594
static int ieee802154_radio_confirm_set_idle(ieee802154_dev_t *dev)
Confirmation function for ieee802154_radio_request_set_idle.
Definition: radio.h:1093
static bool ieee802154_radio_has_24_ghz(ieee802154_dev_t *dev)
Check if the device supports the IEEE802.15.4 2.4 GHz band.
Definition: radio.h:1350
static int ieee802154_radio_set_cca_mode(ieee802154_dev_t *dev, ieee802154_cca_mode_t mode)
Shortcut to ieee802154_radio_ops::set_cca_mode.
Definition: radio.h:901
ieee802154_src_match_t
Source Address Match commands.
Definition: radio.h:290
static int ieee802154_radio_request_set_idle(ieee802154_dev_t *dev, bool force)
Request the transceiver state to IDLE.
Definition: radio.h:1075
ieee802154_rf_caps_t
IEEE802.15.4 Radio capabilities.
Definition: radio.h:48
static int ieee802154_radio_off(ieee802154_dev_t *dev)
Shortcut to ieee802154_radio_ops::off.
Definition: radio.h:950
static bool ieee802154_radio_has_irq_ack_timeout(ieee802154_dev_t *dev)
Check if the device supports ACK timeout.
Definition: radio.h:1286
static bool ieee802154_radio_has_irq_rx_start(ieee802154_dev_t *dev)
Check if the device supports RX start interrupt.
Definition: radio.h:1382
static bool ieee802154_radio_has_phy_bpsk(ieee802154_dev_t *dev)
Check if the device supports the BPSK PHY mode.
Definition: radio.h:1448
static int ieee802154_radio_request_cca(ieee802154_dev_t *dev)
Request Stand-Alone Clear Channel Assessment.
Definition: radio.h:1211
static bool ieee802154_radio_has_phy_mr_fsk(ieee802154_dev_t *dev)
Check if the device supports the MR-FSK PHY mode.
Definition: radio.h:1528
static bool ieee802154_radio_has_phy_mr_oqpsk(ieee802154_dev_t *dev)
Check if the device supports the MR-O-QPSK PHY mode.
Definition: radio.h:1496
ieee802154_trx_ev_t
IEEE802.15.4 Radio HAL events.
Definition: radio.h:218
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.
Definition: radio.h:1431
ieee802154_hal_op_t
IEEE 802.15.4 radio operations.
Definition: radio.h:465
static bool ieee802154_radio_has_phy_oqpsk(ieee802154_dev_t *dev)
Check if the device supports the O-QPSK PHY mode.
Definition: radio.h:1480
static bool ieee802154_radio_has_sub_ghz(ieee802154_dev_t *dev)
Check if the device supports the IEEE802.15.4 Sub-GHz band.
Definition: radio.h:1334
static int ieee802154_radio_request_transmit(ieee802154_dev_t *dev)
Transmit a preloaded frame.
Definition: radio.h:812
static bool ieee802154_radio_has_irq_tx_start(ieee802154_dev_t *dev)
Check if the device supports TX start interrupt.
Definition: radio.h:1398
static bool ieee802154_radio_has_irq_cca_done(ieee802154_dev_t *dev)
Check if the device supports CCA done interrupt.
Definition: radio.h:1414
ieee802154_tx_status_t
Transmission status.
Definition: radio.h:177
static int ieee802154_radio_len(ieee802154_dev_t *dev)
Shortcut to ieee802154_radio_ops::len.
Definition: radio.h:855
#define IEEE802154_RF_CAPS_PHY_MASK
Bit-mask for PHY modes capabilities.
Definition: radio.h:166
static int ieee802154_radio_request_on(ieee802154_dev_t *dev)
Shortcut to ieee802154_radio_ops::request_on.
Definition: radio.h:1035
ieee802154_af_cmd_t
Address filter command.
Definition: radio.h:331
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.
Definition: radio.h:983
static int ieee802154_radio_set_rx(ieee802154_dev_t *dev)
Set transceiver state to RX (blocking)
Definition: radio.h:1184
static int ieee802154_radio_write(ieee802154_dev_t *dev, const iolist_t *psdu)
Shortcut to ieee802154_radio_ops::write.
Definition: radio.h:788
static int ieee802154_radio_set_cca_threshold(ieee802154_dev_t *dev, int8_t threshold)
Shortcut to ieee802154_radio_ops::set_cca_threshold.
Definition: radio.h:887
static uint32_t ieee802154_radio_get_phy_modes(ieee802154_dev_t *dev)
Get supported PHY modes of the device.
Definition: radio.h:1543
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.
Definition: radio.h:966
void(* ieee802154_cb_t)(ieee802154_dev_t *dev, ieee802154_trx_ev_t status)
Prototype of the IEEE802.15.4 device event callback.
Definition: radio.h:409
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.
Definition: radio.h:1558
ieee802154_filter_mode_t
Frame Filter mode.
Definition: radio.h:341
static int ieee802154_radio_set_frame_retrans(ieee802154_dev_t *dev, uint8_t retrans)
Shortcut to ieee802154_radio_ops::set_frame_retrans.
Definition: radio.h:1001
static bool ieee802154_radio_has_phy_mr_ofdm(ieee802154_dev_t *dev)
Check if the device supports the MR-OFDM PHY mode.
Definition: radio.h:1512
static bool ieee802154_radio_has_auto_csma(ieee802154_dev_t *dev)
Check if the device supports Auto CSMA-CA for transmissions.
Definition: radio.h:1318
static int ieee802154_radio_confirm_set_rx(ieee802154_dev_t *dev)
Confirmation function for ieee802154_radio_request_set_rx.
Definition: radio.h:1136
static bool ieee802154_radio_has_frame_retrans(ieee802154_dev_t *dev)
Check if the device supports frame retransmissions (with CSMA-CA).
Definition: radio.h:1302
static int ieee802154_radio_request_set_rx(ieee802154_dev_t *dev)
Request the transceiver state to RX.
Definition: radio.h:1118
@ IEEE802154_CCA_MODE_ED_THRESHOLD
CCA using first mode (energy detection)
Definition: radio.h:437
@ IEEE802154_CCA_MODE_ED_THRESH_OR_CS
CCA using third mode (energy detection OR carrier sensing)
Definition: radio.h:449
@ IEEE802154_CCA_MODE_ED_THRESH_AND_CS
CCA using third mode (energy detection AND carrier sensing)
Definition: radio.h:445
@ IEEE802154_CCA_MODE_CARRIER_SENSING
CCA using second mode (carrier sensing)
Definition: radio.h:441
@ IEEE802154_SRC_MATCH_EXT_CLEAR
Clear extended address from entry.
Definition: radio.h:325
@ IEEE802154_SRC_MATCH_EN
Enable or disable source address match.
Definition: radio.h:299
@ IEEE802154_SRC_MATCH_EXT_ADD
Add a extended address to entry.
Definition: radio.h:318
@ IEEE802154_SRC_MATCH_SHORT_ADD
Add a short address to entry.
Definition: radio.h:306
@ IEEE802154_SRC_MATCH_SHORT_CLEAR
Clear short address from entry.
Definition: radio.h:312
@ IEEE802154_CAP_PHY_BPSK
Binary Phase Shift Keying PHY mode.
Definition: radio.h:131
@ IEEE802154_CAP_FRAME_RETRANS_INFO
the device provides the number of retransmissions
Definition: radio.h:123
@ IEEE802154_CAP_FRAME_RETRANS
the device supports frame retransmissions with CSMA-CA
Definition: radio.h:65
@ IEEE802154_CAP_IRQ_RX_START
the device reports the start of a frame (SFD) when received.
Definition: radio.h:109
@ IEEE802154_CAP_IRQ_ACK_TIMEOUT
the device support ACK timeout interrupt
Definition: radio.h:87
@ IEEE802154_CAP_IRQ_TX_DONE
the device reports when the transmission is done
Definition: radio.h:105
@ IEEE802154_CAP_SRC_ADDR_MATCH
the device supports source address match table.
Definition: radio.h:160
@ 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_REG_RETENTION
the device retains all register values when off.
Definition: radio.h:127
@ 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_AUTO_CSMA
the device supports Auto CSMA-CA
Definition: radio.h:75
@ IEEE802154_CAP_IRQ_CRC_ERROR
the device reports reception off frames with invalid CRC.
Definition: radio.h:101
@ IEEE802154_CAP_SUB_GHZ
the device support the IEEE802.15.4 Sub GHz band
Definition: radio.h:97
@ IEEE802154_CAP_IRQ_TX_START
the device reports the start of a frame (SFD) was sent.
Definition: radio.h:113
@ IEEE802154_CAP_IRQ_CCA_DONE
the device reports the end of the CCA procedure
Definition: radio.h:117
@ IEEE802154_CAP_24_GHZ
the device supports the IEEE802.15.4 2.4 GHz band
Definition: radio.h:93
@ IEEE802154_CAP_PHY_MR_OFDM
Multi-Rate Orthogonal Frequency-Division Multiplexing PHY mode.
Definition: radio.h:147
@ IEEE802154_RADIO_INDICATION_CRC_ERROR
the transceiver received a frame with an invalid crc.
Definition: radio.h:237
@ IEEE802154_RADIO_INDICATION_TX_START
the transceiver sent out a valid SFD
Definition: radio.h:246
@ IEEE802154_RADIO_CONFIRM_CCA
the CCA procedure finished
Definition: radio.h:284
@ IEEE802154_RADIO_INDICATION_RX_START
the transceiver detected a valid SFD
Definition: radio.h:224
@ IEEE802154_RADIO_INDICATION_RX_DONE
the transceiver received a frame and lies in the internal framebuffer.
Definition: radio.h:268
@ IEEE802154_RADIO_CONFIRM_TX_DONE
the transceiver either finished sending a frame, the retransmission procedure or the channel activity...
Definition: radio.h:278
@ IEEE802154_HAL_OP_TRANSMIT
Transmission of a preloaded frame.
Definition: radio.h:469
@ IEEE802154_HAL_OP_CCA
Request Clear Channel Assessment.
Definition: radio.h:481
@ IEEE802154_HAL_OP_SET_IDLE
Set the transceiver state to IDLE (RX off).
Definition: radio.h:477
@ IEEE802154_HAL_OP_SET_RX
Set the transceiver state to RX.
Definition: radio.h:473
@ TX_STATUS_FRAME_PENDING
the transceiver received a valid ACK with the frame pending bit
Definition: radio.h:198
@ TX_STATUS_SUCCESS
the transceiver successfully sent a frame.
Definition: radio.h:191
@ TX_STATUS_MEDIUM_BUSY
the CSMA-CA algorithm or CCA failed to measure a clear channel
Definition: radio.h:209
@ TX_STATUS_NO_ACK
the transceiver ran out of retransmission
Definition: radio.h:205
@ IEEE802154_AF_PAN_COORD
Set device as PAN coordinator (bool)
Definition: radio.h:335
@ IEEE802154_AF_EXT_ADDR
Set extended IEEE 802.15.4 address (eui64_t)
Definition: radio.h:333
@ IEEE802154_AF_SHORT_ADDR
Set short IEEE 802.15.4 address (network_uint16_t)
Definition: radio.h:332
@ IEEE802154_AF_PANID
Set PAN ID (uint16_t)
Definition: radio.h:334
@ IEEE802154_FILTER_SNIFFER
accept all frames, regardless of FCS
Definition: radio.h:365
@ IEEE802154_FILTER_ACCEPT
accept all valid frames that match address filter configuration
Definition: radio.h:345
@ IEEE802154_FILTER_ACK_ONLY
accept only ACK frames
Definition: radio.h:353
@ IEEE802154_FILTER_PROMISC
accept all valid frames
Definition: radio.h:359
ieee802154_phy_mode_t
802.15.4 PHY modes
Definition: ieee802154.h:167
@ IEEE802154_PHY_BPSK
Binary Phase Shift Keying.
Definition: ieee802154.h:169
@ IEEE802154_PHY_MR_OFDM
Multi-Rate Orthogonal Frequency-Division Multiplexing.
Definition: ieee802154.h:173
@ IEEE802154_PHY_OQPSK
Offset Quadrature Phase-Shift Keying.
Definition: ieee802154.h:171
@ IEEE802154_PHY_ASK
Amplitude-Shift Keying.
Definition: ieee802154.h:170
@ IEEE802154_PHY_MR_FSK
Multi-Rate Frequency Shift Keying.
Definition: ieee802154.h:174
@ IEEE802154_PHY_DISABLED
PHY disabled, no mode selected.
Definition: ieee802154.h:168
@ IEEE802154_PHY_MR_OQPSK
Multi-Rate Offset Quadrature Phase-Shift Keying.
Definition: ieee802154.h:172
iolist scatter / gather IO
CSMA-CA exponential backoff parameters.
Definition: radio.h:371
uint8_t max
maximum value of the exponential backoff
Definition: radio.h:373
uint8_t min
minimum value of the exponential backoff
Definition: radio.h:372
the IEEE802.15.4 device descriptor
Definition: radio.h:415
const ieee802154_radio_ops_t * driver
pointer to the operations of the device
Definition: radio.h:419
ieee802154_cb_t cb
the event callback of the device
Definition: radio.h:427
void * priv
pointer to the private descriptor of the device
Definition: radio.h:423
Holder of the PHY configuration.
Definition: radio.h:455
uint8_t page
IEEE802.15.4 channel page.
Definition: radio.h:458
uint16_t channel
IEEE802.15.4 channel number.
Definition: radio.h:457
int8_t pow
TX power in dBm.
Definition: radio.h:459
ieee802154_phy_mode_t phy_mode
IEEE802.15.4 PHY mode.
Definition: radio.h:456
Radio ops struct declaration.
Definition: radio.h:489
int(* set_cca_mode)(ieee802154_dev_t *dev, ieee802154_cca_mode_t mode)
Set CCA mode.
Definition: radio.h:668
const uint32_t caps
Radio device capabilities.
Definition: radio.h:496
int(* request_op)(ieee802154_dev_t *dev, ieee802154_hal_op_t op, void *ctx)
Request a radio operation.
Definition: radio.h:623
int(* confirm_on)(ieee802154_dev_t *dev)
Confirmation function for ieee802154_radio_ops::request_on.
Definition: radio.h:606
int(* set_cca_threshold)(ieee802154_dev_t *dev, int8_t threshold)
Set the threshold for the Energy Detection (first mode of CCA)
Definition: radio.h:652
int(* set_csma_params)(ieee802154_dev_t *dev, const ieee802154_csma_be_t *bd, int8_t retries)
Set the CSMA-CA parameters.
Definition: radio.h:725
int(* config_src_addr_match)(ieee802154_dev_t *dev, ieee802154_src_match_t cmd, const void *value)
Set the source address match configuration.
Definition: radio.h:776
int(* config_phy)(ieee802154_dev_t *dev, const ieee802154_phy_conf_t *conf)
Set IEEE802.15.4 PHY configuration (channel, TX power)
Definition: radio.h:689
int(* off)(ieee802154_dev_t *dev)
Turn off the device.
Definition: radio.h:563
int(* write)(ieee802154_dev_t *dev, const iolist_t *psdu)
Write a frame into the framebuffer.
Definition: radio.h:510
int(* len)(ieee802154_dev_t *dev)
Get the length of the received PSDU frame.
Definition: radio.h:525
int(* set_frame_filter_mode)(ieee802154_dev_t *dev, ieee802154_filter_mode_t mode)
Set the frame filter moder.
Definition: radio.h:739
int(* read)(ieee802154_dev_t *dev, void *buf, size_t size, ieee802154_rx_info_t *info)
Read a frame from the internal framebuffer.
Definition: radio.h:550
int(* request_on)(ieee802154_dev_t *dev)
Request to turn on the device.
Definition: radio.h:578
int(* confirm_op)(ieee802154_dev_t *dev, ieee802154_hal_op_t op, void *ctx)
Confirmation function for ieee802154_radio_ops::request_op.
Definition: radio.h:639
int(* set_frame_retrans)(ieee802154_dev_t *dev, uint8_t retrans)
Set number of frame retransmissions.
Definition: radio.h:705
int(* config_addr_filter)(ieee802154_dev_t *dev, ieee802154_af_cmd_t cmd, const void *value)
Configure the address filter.
Definition: radio.h:756
RX information associated to a frame.
Definition: radio.h:379
uint8_t rssi
RSSI of the received frame.
Definition: radio.h:386
uint8_t lqi
LQI of the received frame.
Definition: radio.h:387
TX information of the last transmitted frame.
Definition: radio.h:393
int8_t retrans
number of frame retransmissions of the last TX
Definition: radio.h:395
ieee802154_tx_status_t status
status of the last transmission
Definition: radio.h:394
iolist structure definition
Definition: iolist.h:39
IEEE 802.15.4 header definitions.
libc header for scatter/gather I/O