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 
9 #pragma once
10 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 #include <stdbool.h>
29 #include "iolist.h"
30 #include "sys/uio.h"
31 #include "bitarithm.h"
32 #include "byteorder.h"
33 #include "net/eui64.h"
34 #include "net/ieee802154.h"
35 #include "errno.h"
36 
41 
47 typedef enum {
168 
172 #define IEEE802154_RF_CAPS_PHY_MASK \
173  (IEEE802154_CAP_PHY_BPSK \
174  | IEEE802154_CAP_PHY_ASK \
175  | IEEE802154_CAP_PHY_OQPSK \
176  | IEEE802154_CAP_PHY_MR_OQPSK \
177  | IEEE802154_CAP_PHY_MR_OFDM \
178  | IEEE802154_CAP_PHY_MR_FSK) \
179 
183 typedef enum {
217 
224 typedef enum {
231 
244 
253 
275 
292 
296 typedef enum {
333 
337 typedef enum {
343 
347 typedef enum {
373 
377 typedef struct {
378  uint8_t min;
379  uint8_t max;
381 
385 typedef struct {
392  uint8_t rssi;
393  uint8_t lqi;
395 
399 typedef struct {
401  int8_t retrans;
403 
407 typedef struct ieee802154_dev ieee802154_dev_t;
408 
415 typedef void (*ieee802154_cb_t)(ieee802154_dev_t *dev,
416  ieee802154_trx_ev_t status);
417 
429  void *priv;
434 };
435 
439 typedef enum {
457 
461 typedef struct {
463  uint16_t channel;
464  uint8_t page;
465  int8_t pow;
467 
471 typedef struct {
474  uint8_t rate_mode;
476 
480 typedef struct {
482  uint8_t option;
483  uint8_t scheme;
485 
489 typedef struct {
492  uint8_t mod_ord;
493  uint8_t mod_idx;
496 
500 typedef enum {
517 
518  /* add more as needed (e.g Energy Scanning, transmit slotted ACK) */
520 
531  const uint32_t caps;
532 
545  int (*write)(ieee802154_dev_t *dev, const iolist_t *psdu);
546 
560  int (*len)(ieee802154_dev_t *dev);
561 
585  int (*read)(ieee802154_dev_t *dev, void *buf, size_t size, ieee802154_rx_info_t *info);
598  int (*off)(ieee802154_dev_t *dev);
599 
614 
642 
658  int (*request_op)(ieee802154_dev_t *dev, ieee802154_hal_op_t op, void *ctx);
659 
674  int (*confirm_op)(ieee802154_dev_t *dev, ieee802154_hal_op_t op, void *ctx);
675 
687  int (*set_cca_threshold)(ieee802154_dev_t *dev, int8_t threshold);
688 
704 
725 
740  int (*set_frame_retrans)(ieee802154_dev_t *dev, uint8_t retrans);
741 
761  int8_t retries);
762 
775 
788 
804  int (*config_addr_filter)(ieee802154_dev_t *dev, ieee802154_af_cmd_t cmd, const void *value);
805 
825  const void *value);
826 };
827 
837 static inline bool ieee802154_radio_has_capability(ieee802154_dev_t *dev, uint32_t cap)
838 {
839  return (dev->driver->caps & cap) == cap;
840 }
841 
850 static inline int ieee802154_radio_write(ieee802154_dev_t *dev, const iolist_t *psdu)
851 {
852  return dev->driver->write(dev, psdu);
853 }
854 
875 {
876  return dev->driver->request_op(dev, IEEE802154_HAL_OP_TRANSMIT, NULL);
877 }
878 
905  ieee802154_tx_info_t *info)
906 {
907  return dev->driver->confirm_op(dev, IEEE802154_HAL_OP_TRANSMIT, info);
908 }
909 
917 static inline int ieee802154_radio_len(ieee802154_dev_t *dev)
918 {
919  return dev->driver->len(dev);
920 }
921 
934  void *buf,
935  size_t size,
936  ieee802154_rx_info_t *info)
937 {
938  return dev->driver->read(dev, buf, size, info);
939 }
940 
950  int8_t threshold)
951 {
952  return dev->driver->set_cca_threshold(dev, threshold);
953 }
954 
965 {
966  return dev->driver->set_cca_mode(dev, mode);
967 }
968 
980  const ieee802154_phy_conf_t *conf)
981 {
982  return dev->driver->config_phy(dev, conf);
983 }
984 
998  const void *value)
999 {
1000  return dev->driver->config_src_addr_match(dev, cmd, value);
1001 }
1002 
1013 {
1014  return dev->driver->off(dev);
1015 }
1016 
1029  ieee802154_af_cmd_t cmd,
1030  const void* value)
1031 {
1032  return dev->driver->config_addr_filter(dev, cmd, value);
1033 }
1034 
1047 {
1048  return dev->driver->set_frame_filter_mode(dev, mode);
1049 }
1050 
1063 {
1064  if (dev->driver->get_frame_filter_mode) {
1065  return dev->driver->get_frame_filter_mode(dev, mode);
1066  }
1067  return -ENOTSUP;
1068 }
1069 
1083  uint8_t retrans)
1084 {
1085  return dev->driver->set_frame_retrans(dev, retrans);
1086 }
1087 
1103  const ieee802154_csma_be_t *bd,
1104  int8_t retries)
1105 {
1106  return dev->driver->set_csma_params(dev, bd, retries);
1107 }
1108 
1117 {
1118  return dev->driver->request_on(dev);
1119 }
1120 
1129 {
1130  return dev->driver->confirm_on(dev);
1131 }
1132 
1156 static inline int ieee802154_radio_request_set_idle(ieee802154_dev_t *dev, bool force)
1157 {
1158  return dev->driver->request_op(dev, IEEE802154_HAL_OP_SET_IDLE, &force);
1159 }
1160 
1175 {
1176  return dev->driver->confirm_op(dev, IEEE802154_HAL_OP_SET_IDLE, NULL);
1177 }
1178 
1200 {
1201  return dev->driver->request_op(dev, IEEE802154_HAL_OP_SET_RX, NULL);
1202 }
1203 
1218 {
1219  return dev->driver->confirm_op(dev, IEEE802154_HAL_OP_SET_RX, NULL);
1220 }
1221 
1239 static inline int ieee802154_radio_set_idle(ieee802154_dev_t *dev, bool force)
1240 {
1241  int res = ieee802154_radio_request_set_idle(dev, force);
1242  if (res < 0) {
1243  return res;
1244  }
1245  while (ieee802154_radio_confirm_set_idle(dev) == -EAGAIN) {}
1246 
1247  return 0;
1248 }
1249 
1266 {
1267  int res = ieee802154_radio_request_set_rx(dev);
1268  if (res < 0) {
1269  return res;
1270  }
1271  while (ieee802154_radio_confirm_set_rx(dev) == -EAGAIN) {}
1272 
1273  return 0;
1274 }
1275 
1293 {
1294  return dev->driver->request_op(dev, IEEE802154_HAL_OP_CCA, NULL);
1295 }
1296 
1320 {
1321  bool clear;
1322  int res = dev->driver->confirm_op(dev, IEEE802154_HAL_OP_CCA, &clear);
1323  if (res < 0) {
1324  return res;
1325  }
1326  return clear;
1327 }
1328 
1346 {
1347  int res = ieee802154_radio_request_cca(dev);
1348  if (res < 0) {
1349  return res;
1350  }
1351  while ((res = ieee802154_radio_confirm_cca(dev)) == -EAGAIN) {}
1352 
1353  return res;
1354 }
1355 
1368 {
1369  return (dev->driver->caps & IEEE802154_CAP_IRQ_ACK_TIMEOUT);
1370 }
1371 
1384 {
1385  return (dev->driver->caps & IEEE802154_CAP_FRAME_RETRANS);
1386 }
1387 
1400 {
1401  return (dev->driver->caps & IEEE802154_CAP_AUTO_CSMA);
1402 }
1403 
1416 {
1417  return (dev->driver->caps & IEEE802154_CAP_SUB_GHZ);
1418 }
1419 
1432 {
1433  return (dev->driver->caps & IEEE802154_CAP_24_GHZ);
1434 }
1435 
1448 {
1449  return (dev->driver->caps & IEEE802154_CAP_IRQ_TX_DONE);
1450 }
1451 
1464 {
1465  return (dev->driver->caps & IEEE802154_CAP_IRQ_RX_START);
1466 }
1467 
1480 {
1481  return (dev->driver->caps & IEEE802154_CAP_IRQ_TX_START);
1482 }
1483 
1496 {
1497  return (dev->driver->caps & IEEE802154_CAP_IRQ_CCA_DONE);
1498 }
1499 
1513  ieee802154_dev_t *dev)
1514 {
1516 }
1517 
1530 {
1531  return (dev->driver->caps & IEEE802154_CAP_PHY_BPSK);
1532 }
1533 
1546 {
1547  return (dev->driver->caps & IEEE802154_CAP_PHY_ASK);
1548 }
1549 
1562 {
1563  return (dev->driver->caps & IEEE802154_CAP_PHY_OQPSK);
1564 }
1565 
1578 {
1579  return (dev->driver->caps & IEEE802154_CAP_PHY_MR_OQPSK);
1580 }
1581 
1594 {
1595  return (dev->driver->caps & IEEE802154_CAP_PHY_MR_OFDM);
1596 }
1597 
1610 {
1611  return (dev->driver->caps & IEEE802154_CAP_PHY_MR_FSK);
1612 }
1613 
1625 {
1626  return (dev->driver->caps & IEEE802154_RF_CAPS_PHY_MASK);
1627 }
1628 
1639 static inline uint32_t ieee802154_phy_mode_to_cap(
1640  ieee802154_phy_mode_t phy_mode)
1641 {
1642  switch (phy_mode) {
1643  case IEEE802154_PHY_BPSK:
1644  return IEEE802154_CAP_PHY_BPSK;
1645  case IEEE802154_PHY_ASK:
1646  return IEEE802154_CAP_PHY_ASK;
1647  case IEEE802154_PHY_OQPSK:
1648  return IEEE802154_CAP_PHY_OQPSK;
1653  case IEEE802154_PHY_MR_FSK:
1655 
1657  default:
1658  break;
1659  }
1660 
1661  return 0;
1662 }
1663 
1676 {
1677  switch (cap) {
1679  return IEEE802154_PHY_BPSK;
1681  return IEEE802154_PHY_ASK;
1683  return IEEE802154_PHY_OQPSK;
1685  return IEEE802154_PHY_MR_OQPSK;
1687  return IEEE802154_PHY_MR_OFDM;
1689  return IEEE802154_PHY_MR_FSK;
1690 
1691  default:
1692  break;
1693  }
1694 
1695  return IEEE802154_PHY_DISABLED;
1696 }
1697 
1698 #ifdef __cplusplus
1699 }
1700 #endif
1701 
Helper functions for bit arithmetic.
#define BIT8
Bit 8 set define.
Definition: bitarithm.h:66
#define BIT17
Bit 17 set define.
Definition: bitarithm.h:79
#define BIT11
Bit 11 set define.
Definition: bitarithm.h:71
#define BIT9
Bit 9 set define.
Definition: bitarithm.h:67
#define BIT14
Bit 14 set define.
Definition: bitarithm.h:74
#define BIT18
Bit 18 set define.
Definition: bitarithm.h:80
#define BIT1
Bit 1 set define.
Definition: bitarithm.h:59
#define BIT16
Bit 16 set define.
Definition: bitarithm.h:78
#define BIT10
Bit 10 set define.
Definition: bitarithm.h:70
#define BIT3
Bit 3 set define.
Definition: bitarithm.h:61
#define BIT13
Bit 13 set define.
Definition: bitarithm.h:73
#define BIT2
Bit 2 set define.
Definition: bitarithm.h:60
#define BIT19
Bit 19 set define.
Definition: bitarithm.h:81
#define BIT7
Bit 7 set define.
Definition: bitarithm.h:65
#define BIT4
Bit 4 set define.
Definition: bitarithm.h:62
#define BIT12
Bit 12 set define.
Definition: bitarithm.h:72
#define BIT6
Bit 6 set define.
Definition: bitarithm.h:64
#define BIT0
Bit 0 set define.
Definition: bitarithm.h:58
#define BIT15
Bit 15 set define.
Definition: bitarithm.h:75
#define BIT5
Bit 5 set define.
Definition: bitarithm.h:63
Functions to work with different byte orders.
EUI-64 data type definition.
#define ENOTSUP
Not supported (may be the same value as [EOPNOTSUPP]).
Definition: errno.h:129
#define EAGAIN
Resource unavailable, try again (may be the same value as [EWOULDBLOCK]).
Definition: errno.h:74
static int ieee802154_radio_confirm_on(ieee802154_dev_t *dev)
Shortcut to ieee802154_radio_ops::confirm_on.
Definition: radio.h:1128
static int ieee802154_radio_cca(ieee802154_dev_t *dev)
Perform a Clear Channel Assessment (blocking)
Definition: radio.h:1345
static bool ieee802154_radio_has_irq_tx_done(ieee802154_dev_t *dev)
Check if the device supports TX done interrupt.
Definition: radio.h:1447
static bool ieee802154_radio_has_capability(ieee802154_dev_t *dev, uint32_t cap)
Check if the device has a specific capability.
Definition: radio.h:837
static bool ieee802154_radio_has_phy_ask(ieee802154_dev_t *dev)
Check if the device supports the ASK PHY mode.
Definition: radio.h:1545
static int ieee802154_radio_set_idle(ieee802154_dev_t *dev, bool force)
Set transceiver state to IDLE (blocking)
Definition: radio.h:1239
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:996
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:933
ieee802154_cca_mode_t
IEEE802.15.4 CCA modes.
Definition: radio.h:439
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:979
static int ieee802154_radio_confirm_cca(ieee802154_dev_t *dev)
Shortcut to ieee802154_radio_confirm_cca.
Definition: radio.h:1319
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:1102
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:904
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:1675
static int ieee802154_radio_confirm_set_idle(ieee802154_dev_t *dev)
Confirmation function for ieee802154_radio_request_set_idle.
Definition: radio.h:1174
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:1431
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:963
ieee802154_src_match_t
Source Address Match commands.
Definition: radio.h:296
static int ieee802154_radio_request_set_idle(ieee802154_dev_t *dev, bool force)
Request the transceiver state to IDLE.
Definition: radio.h:1156
ieee802154_rf_caps_t
IEEE802.15.4 Radio capabilities.
Definition: radio.h:47
static int ieee802154_radio_off(ieee802154_dev_t *dev)
Shortcut to ieee802154_radio_ops::off.
Definition: radio.h:1012
static bool ieee802154_radio_has_irq_ack_timeout(ieee802154_dev_t *dev)
Check if the device supports ACK timeout.
Definition: radio.h:1367
static bool ieee802154_radio_has_irq_rx_start(ieee802154_dev_t *dev)
Check if the device supports RX start interrupt.
Definition: radio.h:1463
static bool ieee802154_radio_has_phy_bpsk(ieee802154_dev_t *dev)
Check if the device supports the BPSK PHY mode.
Definition: radio.h:1529
static int ieee802154_radio_request_cca(ieee802154_dev_t *dev)
Request Stand-Alone Clear Channel Assessment.
Definition: radio.h:1292
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:1609
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:1577
ieee802154_trx_ev_t
IEEE802.15.4 Radio HAL events.
Definition: radio.h:224
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:1512
ieee802154_hal_op_t
IEEE 802.15.4 radio operations.
Definition: radio.h:500
static bool ieee802154_radio_has_phy_oqpsk(ieee802154_dev_t *dev)
Check if the device supports the O-QPSK PHY mode.
Definition: radio.h:1561
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:1415
static int ieee802154_radio_request_transmit(ieee802154_dev_t *dev)
Transmit a preloaded frame.
Definition: radio.h:874
static bool ieee802154_radio_has_irq_tx_start(ieee802154_dev_t *dev)
Check if the device supports TX start interrupt.
Definition: radio.h:1479
static bool ieee802154_radio_has_irq_cca_done(ieee802154_dev_t *dev)
Check if the device supports CCA done interrupt.
Definition: radio.h:1495
ieee802154_tx_status_t
Transmission status.
Definition: radio.h:183
static int ieee802154_radio_len(ieee802154_dev_t *dev)
Shortcut to ieee802154_radio_ops::len.
Definition: radio.h:917
#define IEEE802154_RF_CAPS_PHY_MASK
Bit-mask for PHY modes capabilities.
Definition: radio.h:172
static int ieee802154_radio_request_on(ieee802154_dev_t *dev)
Shortcut to ieee802154_radio_ops::request_on.
Definition: radio.h:1116
ieee802154_af_cmd_t
Address filter command.
Definition: radio.h:337
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:1045
static int ieee802154_radio_set_rx(ieee802154_dev_t *dev)
Set transceiver state to RX (blocking)
Definition: radio.h:1265
static int ieee802154_radio_write(ieee802154_dev_t *dev, const iolist_t *psdu)
Shortcut to ieee802154_radio_ops::write.
Definition: radio.h:850
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:949
static uint32_t ieee802154_radio_get_phy_modes(ieee802154_dev_t *dev)
Get supported PHY modes of the device.
Definition: radio.h:1624
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:1028
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:415
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:1639
ieee802154_filter_mode_t
Frame Filter mode.
Definition: radio.h:347
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:1082
static int ieee802154_radio_get_frame_filter_mode(ieee802154_dev_t *dev, ieee802154_filter_mode_t *mode)
Shortcut to ieee802154_radio_ops::get_frame_filter_mode.
Definition: radio.h:1061
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:1593
static bool ieee802154_radio_has_auto_csma(ieee802154_dev_t *dev)
Check if the device supports Auto CSMA-CA for transmissions.
Definition: radio.h:1399
static int ieee802154_radio_confirm_set_rx(ieee802154_dev_t *dev)
Confirmation function for ieee802154_radio_request_set_rx.
Definition: radio.h:1217
static bool ieee802154_radio_has_frame_retrans(ieee802154_dev_t *dev)
Check if the device supports frame retransmissions (with CSMA-CA).
Definition: radio.h:1383
static int ieee802154_radio_request_set_rx(ieee802154_dev_t *dev)
Request the transceiver state to RX.
Definition: radio.h:1199
@ IEEE802154_CCA_MODE_ED_THRESHOLD
CCA using first mode (energy detection)
Definition: radio.h:443
@ IEEE802154_CCA_MODE_ED_THRESH_OR_CS
CCA using third mode (energy detection OR carrier sensing)
Definition: radio.h:455
@ IEEE802154_CCA_MODE_ED_THRESH_AND_CS
CCA using third mode (energy detection AND carrier sensing)
Definition: radio.h:451
@ IEEE802154_CCA_MODE_CARRIER_SENSING
CCA using second mode (carrier sensing)
Definition: radio.h:447
@ IEEE802154_SRC_MATCH_EXT_CLEAR
Clear extended address from entry.
Definition: radio.h:331
@ IEEE802154_SRC_MATCH_EN
Enable or disable source address match.
Definition: radio.h:305
@ IEEE802154_SRC_MATCH_EXT_ADD
Add a extended address to entry.
Definition: radio.h:324
@ IEEE802154_SRC_MATCH_SHORT_ADD
Add a short address to entry.
Definition: radio.h:312
@ IEEE802154_SRC_MATCH_SHORT_CLEAR
Clear short address from entry.
Definition: radio.h:318
@ IEEE802154_CAP_PHY_BPSK
Binary Phase Shift Keying PHY mode.
Definition: radio.h:137
@ IEEE802154_CAP_FRAME_RETRANS_INFO
the device provides the number of retransmissions
Definition: radio.h:129
@ IEEE802154_CAP_FRAME_RETRANS
the device supports frame retransmissions with CSMA-CA
Definition: radio.h:64
@ IEEE802154_CAP_IRQ_RX_START
the device reports the start of a frame (SFD) when received.
Definition: radio.h:115
@ IEEE802154_CAP_IRQ_ACK_TIMEOUT
the device support ACK timeout interrupt
Definition: radio.h:93
@ IEEE802154_CAP_IRQ_TX_DONE
the device reports when the transmission is done
Definition: radio.h:111
@ IEEE802154_CAP_SRC_ADDR_MATCH
the device supports source address match table.
Definition: radio.h:166
@ IEEE802154_CAP_PHY_OQPSK
Offset Quadrature Phase-Shift Keying.
Definition: radio.h:145
@ IEEE802154_CAP_PHY_MR_OQPSK
Multi-Rate Offset Quadrature Phase-Shift Keying PHY mode.
Definition: radio.h:149
@ IEEE802154_CAP_REG_RETENTION
the device retains all register values when off.
Definition: radio.h:133
@ IEEE802154_CAP_PHY_MR_FSK
Multi-Rate Frequency Shift Keying PHY mode.
Definition: radio.h:157
@ IEEE802154_CAP_PHY_ASK
Amplitude-Shift Keying PHY mode.
Definition: radio.h:141
@ IEEE802154_CAP_AUTO_CSMA
the device supports Auto CSMA-CA
Definition: radio.h:74
@ IEEE802154_CAP_IRQ_CRC_ERROR
the device reports reception off frames with invalid CRC.
Definition: radio.h:107
@ IEEE802154_CAP_SUB_GHZ
the device support the IEEE802.15.4 Sub GHz band
Definition: radio.h:103
@ IEEE802154_CAP_IRQ_TX_START
the device reports the start of a frame (SFD) was sent.
Definition: radio.h:119
@ IEEE802154_CAP_IRQ_CCA_DONE
the device reports the end of the CCA procedure
Definition: radio.h:123
@ IEEE802154_CAP_AUTO_ACK
the device supports automatic ACK frame transmission
Definition: radio.h:81
@ IEEE802154_CAP_24_GHZ
the device supports the IEEE802.15.4 2.4 GHz band
Definition: radio.h:99
@ IEEE802154_CAP_PHY_MR_OFDM
Multi-Rate Orthogonal Frequency-Division Multiplexing PHY mode.
Definition: radio.h:153
@ IEEE802154_RADIO_INDICATION_CRC_ERROR
the transceiver received a frame with an invalid crc.
Definition: radio.h:243
@ IEEE802154_RADIO_INDICATION_TX_START
the transceiver sent out a valid SFD
Definition: radio.h:252
@ IEEE802154_RADIO_CONFIRM_CCA
the CCA procedure finished
Definition: radio.h:290
@ IEEE802154_RADIO_INDICATION_RX_START
the transceiver detected a valid SFD
Definition: radio.h:230
@ IEEE802154_RADIO_INDICATION_RX_DONE
the transceiver received a frame and lies in the internal framebuffer.
Definition: radio.h:274
@ IEEE802154_RADIO_CONFIRM_TX_DONE
the transceiver either finished sending a frame, the retransmission procedure or the channel activity...
Definition: radio.h:284
@ IEEE802154_HAL_OP_TRANSMIT
Transmission of a preloaded frame.
Definition: radio.h:504
@ IEEE802154_HAL_OP_CCA
Request Clear Channel Assessment.
Definition: radio.h:516
@ IEEE802154_HAL_OP_SET_IDLE
Set the transceiver state to IDLE (RX off).
Definition: radio.h:512
@ IEEE802154_HAL_OP_SET_RX
Set the transceiver state to RX.
Definition: radio.h:508
@ TX_STATUS_FRAME_PENDING
the transceiver received a valid ACK with the frame pending bit
Definition: radio.h:204
@ TX_STATUS_SUCCESS
the transceiver successfully sent a frame.
Definition: radio.h:197
@ TX_STATUS_MEDIUM_BUSY
the CSMA-CA algorithm or CCA failed to measure a clear channel
Definition: radio.h:215
@ TX_STATUS_NO_ACK
the transceiver ran out of retransmission
Definition: radio.h:211
@ IEEE802154_AF_PAN_COORD
Set device as PAN coordinator (bool)
Definition: radio.h:341
@ IEEE802154_AF_EXT_ADDR
Set extended IEEE 802.15.4 address (eui64_t)
Definition: radio.h:339
@ IEEE802154_AF_SHORT_ADDR
Set short IEEE 802.15.4 address (network_uint16_t)
Definition: radio.h:338
@ IEEE802154_AF_PANID
Set PAN ID (uint16_t)
Definition: radio.h:340
@ IEEE802154_FILTER_SNIFFER
accept all frames, regardless of FCS
Definition: radio.h:371
@ IEEE802154_FILTER_ACCEPT
accept all valid frames that match address filter configuration
Definition: radio.h:351
@ IEEE802154_FILTER_ACK_ONLY
accept only ACK frames
Definition: radio.h:359
@ IEEE802154_FILTER_PROMISC
accept all valid frames
Definition: radio.h:365
ieee802154_mr_oqpsk_chips_t
802.15.4 MR-OQPSK chip rates
Definition: ieee802154.h:231
ieee802154_mr_fsk_srate_t
802.15.4 MR-FSK symbol rates
Definition: ieee802154.h:219
ieee802154_phy_mode_t
802.15.4 PHY modes
Definition: ieee802154.h:195
ieee802154_mr_fsk_fec_t
802.15.4 forward error correction schemes
Definition: ieee802154.h:210
@ IEEE802154_PHY_BPSK
Binary Phase Shift Keying.
Definition: ieee802154.h:197
@ IEEE802154_PHY_MR_OFDM
Multi-Rate Orthogonal Frequency-Division Multiplexing.
Definition: ieee802154.h:201
@ IEEE802154_PHY_OQPSK
Offset Quadrature Phase-Shift Keying.
Definition: ieee802154.h:199
@ IEEE802154_PHY_ASK
Amplitude-Shift Keying.
Definition: ieee802154.h:198
@ IEEE802154_PHY_MR_FSK
Multi-Rate Frequency Shift Keying.
Definition: ieee802154.h:202
@ IEEE802154_PHY_DISABLED
PHY disabled, no mode selected.
Definition: ieee802154.h:196
@ IEEE802154_PHY_MR_OQPSK
Multi-Rate Offset Quadrature Phase-Shift Keying.
Definition: ieee802154.h:200
iolist scatter / gather IO
CSMA-CA exponential backoff parameters.
Definition: radio.h:377
uint8_t max
maximum value of the exponential backoff
Definition: radio.h:379
uint8_t min
minimum value of the exponential backoff
Definition: radio.h:378
the IEEE802.15.4 device descriptor
Definition: radio.h:421
const ieee802154_radio_ops_t * driver
pointer to the operations of the device
Definition: radio.h:425
ieee802154_cb_t cb
the event callback of the device
Definition: radio.h:433
void * priv
pointer to the private descriptor of the device
Definition: radio.h:429
extension for IEEE 802.15.4g MR-FSK PHY
Definition: radio.h:489
uint8_t mod_idx
modulation index
Definition: radio.h:493
ieee802154_mr_fsk_srate_t srate
symbol rate
Definition: radio.h:491
ieee802154_phy_conf_t super
common settings
Definition: radio.h:490
uint8_t mod_ord
modulation order, 2 or 4
Definition: radio.h:492
ieee802154_mr_fsk_fec_t fec
forward error correction
Definition: radio.h:494
extension for IEEE 802.15.4g MR-ODFM PHY
Definition: radio.h:480
uint8_t option
OFDM Option.
Definition: radio.h:482
uint8_t scheme
Modulation & Coding Scheme.
Definition: radio.h:483
ieee802154_phy_conf_t super
common settings
Definition: radio.h:481
extension for IEEE 802.15.4g MR-OQPSK PHY
Definition: radio.h:471
uint8_t rate_mode
rate mode
Definition: radio.h:474
ieee802154_mr_oqpsk_chips_t chips
chip rate
Definition: radio.h:473
ieee802154_phy_conf_t super
common settings
Definition: radio.h:472
Holder of the PHY configuration.
Definition: radio.h:461
uint8_t page
IEEE802.15.4 channel page.
Definition: radio.h:464
uint16_t channel
IEEE802.15.4 channel number.
Definition: radio.h:463
int8_t pow
TX power in dBm.
Definition: radio.h:465
ieee802154_phy_mode_t phy_mode
IEEE802.15.4 PHY mode.
Definition: radio.h:462
Radio ops struct declaration.
Definition: radio.h:524
int(* set_cca_mode)(ieee802154_dev_t *dev, ieee802154_cca_mode_t mode)
Set CCA mode.
Definition: radio.h:703
const uint32_t caps
Radio device capabilities.
Definition: radio.h:531
int(* request_op)(ieee802154_dev_t *dev, ieee802154_hal_op_t op, void *ctx)
Request a radio operation.
Definition: radio.h:658
int(* confirm_on)(ieee802154_dev_t *dev)
Confirmation function for ieee802154_radio_ops::request_on.
Definition: radio.h:641
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:687
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:760
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:824
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:724
int(* off)(ieee802154_dev_t *dev)
Turn off the device.
Definition: radio.h:598
int(* write)(ieee802154_dev_t *dev, const iolist_t *psdu)
Write a frame into the framebuffer.
Definition: radio.h:545
int(* len)(ieee802154_dev_t *dev)
Get the length of the received PSDU frame.
Definition: radio.h:560
int(* set_frame_filter_mode)(ieee802154_dev_t *dev, ieee802154_filter_mode_t mode)
Set the frame filter mode.
Definition: radio.h:774
int(* get_frame_filter_mode)(ieee802154_dev_t *dev, ieee802154_filter_mode_t *mode)
Get the frame filter mode.
Definition: radio.h:787
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:585
int(* request_on)(ieee802154_dev_t *dev)
Request to turn on the device.
Definition: radio.h:613
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:674
int(* set_frame_retrans)(ieee802154_dev_t *dev, uint8_t retrans)
Set number of frame retransmissions.
Definition: radio.h:740
int(* config_addr_filter)(ieee802154_dev_t *dev, ieee802154_af_cmd_t cmd, const void *value)
Configure the address filter.
Definition: radio.h:804
RX information associated to a frame.
Definition: radio.h:385
uint8_t rssi
RSSI of the received frame.
Definition: radio.h:392
uint8_t lqi
LQI of the received frame.
Definition: radio.h:393
TX information of the last transmitted frame.
Definition: radio.h:399
int8_t retrans
number of frame retransmissions of the last TX
Definition: radio.h:401
ieee802154_tx_status_t status
status of the last transmission
Definition: radio.h:400
iolist structure definition
Definition: iolist.h:38
IEEE 802.15.4 header definitions.
libc header for scatter/gather I/O