Loading...
Searching...
No Matches
radio.h
1/*
2 * SPDX-FileCopyrightText: 2020 HAW Hamburg
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
25#include <stdbool.h>
26#include "iolist.h"
27#include "sys/uio.h"
28#include "bitarithm.h"
29#include "byteorder.h"
30#include "net/eui64.h"
31#include "net/ieee802154.h"
32#include "errno.h"
33
38
43
185
189#define IEEE802154_RF_CAPS_PHY_MASK \
190 (IEEE802154_CAP_PHY_BPSK \
191 | IEEE802154_CAP_PHY_ASK \
192 | IEEE802154_CAP_PHY_OQPSK \
193 | IEEE802154_CAP_PHY_MR_OQPSK \
194 | IEEE802154_CAP_PHY_MR_OFDM \
195 | IEEE802154_CAP_PHY_MR_FSK) \
196
197
234
299
340
350
380
384typedef struct {
385 uint8_t min;
386 uint8_t max;
388
392typedef struct {
399 uint8_t rssi;
400 uint8_t lqi;
401 uint64_t timestamp;
403
411
416
424 ieee802154_trx_ev_t status);
425
443
465
474
483
492
503
507typedef enum {
524
525 /* add more as needed (e.g Energy Scanning, transmit slotted ACK) */
527
538 const uint32_t caps;
539
552 int (*write)(ieee802154_dev_t *dev, const iolist_t *psdu);
553
570 int (*len)(ieee802154_dev_t *dev);
571
636 int (*read)(ieee802154_dev_t *dev, void *buf, size_t size, ieee802154_rx_info_t *info);
637
668 int (*peek)(ieee802154_dev_t *dev, void *buf, size_t offset, size_t size);
669
682 int (*off)(ieee802154_dev_t *dev);
683
698
726
743
759
771 int (*set_cca_threshold)(ieee802154_dev_t *dev, int8_t threshold);
772
788
809
824 int (*set_frame_retrans)(ieee802154_dev_t *dev, uint8_t retrans);
825
845 int8_t retries);
846
859
872
888 int (*config_addr_filter)(ieee802154_dev_t *dev, ieee802154_af_cmd_t cmd, const void *value);
889
909 const void *value);
910
917};
918
928static inline bool ieee802154_radio_has_capability(ieee802154_dev_t *dev, uint32_t cap)
929{
930 return (dev->driver->caps & cap) == cap;
931}
932
943{
944 return dev->driver->peek != NULL;
945}
946
955static inline int ieee802154_radio_write(ieee802154_dev_t *dev, const iolist_t *psdu)
956{
957 return dev->driver->write(dev, psdu);
958}
959
980{
981 return dev->driver->request_op(dev, IEEE802154_HAL_OP_TRANSMIT, NULL);
982}
983
1011{
1012 return dev->driver->confirm_op(dev, IEEE802154_HAL_OP_TRANSMIT, info);
1013}
1014
1023{
1024 return dev->driver->len(dev);
1025}
1026
1039 void *buf,
1040 size_t size,
1042{
1043 return dev->driver->read(dev, buf, size, info);
1044}
1045
1061 void *buf, size_t offset, size_t size)
1062{
1063 return dev->driver->peek(dev, buf, offset, size);
1064}
1065
1075 int8_t threshold)
1076{
1077 return dev->driver->set_cca_threshold(dev, threshold);
1078}
1079
1090{
1091 return dev->driver->set_cca_mode(dev, mode);
1092}
1093
1105 const ieee802154_phy_conf_t *conf)
1106{
1107 return dev->driver->config_phy(dev, conf);
1108}
1109
1123 const void *value)
1124{
1125 return dev->driver->config_src_addr_match(dev, cmd, value);
1126}
1127
1138{
1139 return dev->driver->off(dev);
1140}
1141
1155 const void* value)
1156{
1157 return dev->driver->config_addr_filter(dev, cmd, value);
1158}
1159
1172{
1173 return dev->driver->set_frame_filter_mode(dev, mode);
1174}
1175
1188{
1189 if (dev->driver->get_frame_filter_mode) {
1190 return dev->driver->get_frame_filter_mode(dev, mode);
1191 }
1192 return -ENOTSUP;
1193}
1194
1208 uint8_t retrans)
1209{
1210 return dev->driver->set_frame_retrans(dev, retrans);
1211}
1212
1228 const ieee802154_csma_be_t *bd,
1229 int8_t retries)
1230{
1231 return dev->driver->set_csma_params(dev, bd, retries);
1232}
1233
1242{
1243 return dev->driver->request_on(dev);
1244}
1245
1254{
1255 return dev->driver->confirm_on(dev);
1256}
1257
1281static inline int ieee802154_radio_request_set_idle(ieee802154_dev_t *dev, bool force)
1282{
1283 return dev->driver->request_op(dev, IEEE802154_HAL_OP_SET_IDLE, &force);
1284}
1285
1300{
1301 return dev->driver->confirm_op(dev, IEEE802154_HAL_OP_SET_IDLE, NULL);
1302}
1303
1325{
1326 return dev->driver->request_op(dev, IEEE802154_HAL_OP_SET_RX, NULL);
1327}
1328
1343{
1344 return dev->driver->confirm_op(dev, IEEE802154_HAL_OP_SET_RX, NULL);
1345}
1346
1364static inline int ieee802154_radio_set_idle(ieee802154_dev_t *dev, bool force)
1365{
1366 int res = ieee802154_radio_request_set_idle(dev, force);
1367 if (res < 0) {
1368 return res;
1369 }
1370 while (ieee802154_radio_confirm_set_idle(dev) == -EAGAIN) {}
1371
1372 return 0;
1373}
1374
1391{
1392 int res = ieee802154_radio_request_set_rx(dev);
1393 if (res < 0) {
1394 return res;
1395 }
1396 while (ieee802154_radio_confirm_set_rx(dev) == -EAGAIN) {}
1397
1398 return 0;
1399}
1400
1418{
1419 return dev->driver->request_op(dev, IEEE802154_HAL_OP_CCA, NULL);
1420}
1421
1445{
1446 bool clear;
1447 int res = dev->driver->confirm_op(dev, IEEE802154_HAL_OP_CCA, &clear);
1448 if (res < 0) {
1449 return res;
1450 }
1451 return clear;
1452}
1453
1471{
1472 int res = ieee802154_radio_request_cca(dev);
1473 if (res < 0) {
1474 return res;
1475 }
1476 while ((res = ieee802154_radio_confirm_cca(dev)) == -EAGAIN) {}
1477
1478 return res;
1479}
1480
1489{
1490 return dev->driver->cipher_ops;
1491}
1492
1505{
1507}
1508
1521{
1522 return (dev->driver->caps & IEEE802154_CAP_FRAME_RETRANS);
1523}
1524
1537{
1538 return (dev->driver->caps & IEEE802154_CAP_AUTO_CSMA);
1539}
1540
1553{
1554 return (dev->driver->caps & IEEE802154_CAP_SUB_GHZ);
1555}
1556
1569{
1570 return (dev->driver->caps & IEEE802154_CAP_24_GHZ);
1571}
1572
1585{
1586 return (dev->driver->caps & IEEE802154_CAP_IRQ_TX_DONE);
1587}
1588
1601{
1602 return (dev->driver->caps & IEEE802154_CAP_IRQ_RX_START);
1603}
1604
1617{
1618 return (dev->driver->caps & IEEE802154_CAP_IRQ_TX_START);
1619}
1620
1633{
1634 return (dev->driver->caps & IEEE802154_CAP_IRQ_CCA_DONE);
1635}
1636
1650 ieee802154_dev_t *dev)
1651{
1653}
1654
1667{
1668 return (dev->driver->caps & IEEE802154_CAP_PHY_BPSK);
1669}
1670
1683{
1684 return (dev->driver->caps & IEEE802154_CAP_PHY_ASK);
1685}
1686
1699{
1700 return (dev->driver->caps & IEEE802154_CAP_PHY_OQPSK);
1701}
1702
1715{
1716 return (dev->driver->caps & IEEE802154_CAP_PHY_MR_OQPSK);
1717}
1718
1731{
1732 return (dev->driver->caps & IEEE802154_CAP_PHY_MR_OFDM);
1733}
1734
1747{
1748 return (dev->driver->caps & IEEE802154_CAP_PHY_MR_FSK);
1749}
1750
1762{
1763 return (dev->driver->caps & IEEE802154_RF_CAPS_PHY_MASK);
1764}
1765
1776static inline uint32_t ieee802154_phy_mode_to_cap(
1777 ieee802154_phy_mode_t phy_mode)
1778{
1779 switch (phy_mode) {
1782 case IEEE802154_PHY_ASK:
1792
1794 default:
1795 break;
1796 }
1797
1798 return 0;
1799}
1800
1813{
1814 switch (cap) {
1816 return IEEE802154_PHY_BPSK;
1818 return IEEE802154_PHY_ASK;
1820 return IEEE802154_PHY_OQPSK;
1826 return IEEE802154_PHY_MR_FSK;
1827
1828 default:
1829 break;
1830 }
1831
1833}
1834
1835#ifdef __cplusplus
1836}
1837#endif
1838
Helper functions for bit arithmetic.
#define BIT8
Bit 8 set define.
Definition bitarithm.h:63
#define BIT21
Bit 21 set define.
Definition bitarithm.h:80
#define BIT17
Bit 17 set define.
Definition bitarithm.h:76
#define BIT11
Bit 11 set define.
Definition bitarithm.h:68
#define BIT9
Bit 9 set define.
Definition bitarithm.h:64
#define BIT14
Bit 14 set define.
Definition bitarithm.h:71
#define BIT18
Bit 18 set define.
Definition bitarithm.h:77
#define BIT1
Bit 1 set define.
Definition bitarithm.h:56
#define BIT16
Bit 16 set define.
Definition bitarithm.h:75
#define BIT20
Bit 20 set define.
Definition bitarithm.h:79
#define BIT10
Bit 10 set define.
Definition bitarithm.h:67
#define BIT3
Bit 3 set define.
Definition bitarithm.h:58
#define BIT13
Bit 13 set define.
Definition bitarithm.h:70
#define BIT2
Bit 2 set define.
Definition bitarithm.h:57
#define BIT19
Bit 19 set define.
Definition bitarithm.h:78
#define BIT7
Bit 7 set define.
Definition bitarithm.h:62
#define BIT4
Bit 4 set define.
Definition bitarithm.h:59
#define BIT12
Bit 12 set define.
Definition bitarithm.h:69
#define BIT6
Bit 6 set define.
Definition bitarithm.h:61
#define BIT0
Bit 0 set define.
Definition bitarithm.h:55
#define BIT15
Bit 15 set define.
Definition bitarithm.h:72
#define BIT5
Bit 5 set define.
Definition bitarithm.h:60
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:1253
static bool ieee802154_radio_has_peek(ieee802154_dev_t *dev)
Check if the device implements the peek function.
Definition radio.h:942
static int ieee802154_radio_cca(ieee802154_dev_t *dev)
Perform a Clear Channel Assessment (blocking)
Definition radio.h:1470
static bool ieee802154_radio_has_irq_tx_done(ieee802154_dev_t *dev)
Check if the device supports TX done interrupt.
Definition radio.h:1584
static bool ieee802154_radio_has_capability(ieee802154_dev_t *dev, uint32_t cap)
Check if the device has a specific capability.
Definition radio.h:928
static bool ieee802154_radio_has_phy_ask(ieee802154_dev_t *dev)
Check if the device supports the ASK PHY mode.
Definition radio.h:1682
static int ieee802154_radio_set_idle(ieee802154_dev_t *dev, bool force)
Set transceiver state to IDLE (blocking)
Definition radio.h:1364
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:1121
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:1038
ieee802154_cca_mode_t
IEEE802.15.4 CCA modes.
Definition radio.h:447
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:1104
static int ieee802154_radio_confirm_cca(ieee802154_dev_t *dev)
Shortcut to ieee802154_radio_confirm_cca.
Definition radio.h:1444
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:1227
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:1009
struct ieee802154_radio_ops ieee802154_radio_ops_t
Forward declaration of the radio ops structure.
Definition radio.h:37
struct ieee802154_dev ieee802154_dev_t
Forward declaration of the IEEE802.15.4 device descriptor.
Definition radio.h:415
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:1812
static int ieee802154_radio_confirm_set_idle(ieee802154_dev_t *dev)
Confirmation function for ieee802154_radio_request_set_idle.
Definition radio.h:1299
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:1568
static int ieee802154_radio_peek(ieee802154_dev_t *dev, void *buf, size_t offset, size_t size)
Shortcut to ieee802154_radio_ops::peek.
Definition radio.h:1060
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:1088
ieee802154_src_match_t
Source Address Match commands.
Definition radio.h:303
static int ieee802154_radio_request_set_idle(ieee802154_dev_t *dev, bool force)
Request the transceiver state to IDLE.
Definition radio.h:1281
ieee802154_rf_caps_t
IEEE802.15.4 Radio capabilities.
Definition radio.h:49
static int ieee802154_radio_off(ieee802154_dev_t *dev)
Shortcut to ieee802154_radio_ops::off.
Definition radio.h:1137
static bool ieee802154_radio_has_irq_ack_timeout(ieee802154_dev_t *dev)
Check if the device supports ACK timeout.
Definition radio.h:1504
static const struct ieee802154_radio_cipher_ops * ieee802154_radio_get_cipher_ops(const ieee802154_dev_t *dev)
Retrieve radio cipher ops.
Definition radio.h:1488
static bool ieee802154_radio_has_irq_rx_start(ieee802154_dev_t *dev)
Check if the device supports RX start interrupt.
Definition radio.h:1600
static bool ieee802154_radio_has_phy_bpsk(ieee802154_dev_t *dev)
Check if the device supports the BPSK PHY mode.
Definition radio.h:1666
static int ieee802154_radio_request_cca(ieee802154_dev_t *dev)
Request Stand-Alone Clear Channel Assessment.
Definition radio.h:1417
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:1746
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:1714
ieee802154_trx_ev_t
IEEE802.15.4 Radio HAL events.
Definition radio.h:241
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:1649
ieee802154_hal_op_t
IEEE 802.15.4 radio operations.
Definition radio.h:507
static bool ieee802154_radio_has_phy_oqpsk(ieee802154_dev_t *dev)
Check if the device supports the O-QPSK PHY mode.
Definition radio.h:1698
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:1552
static int ieee802154_radio_request_transmit(ieee802154_dev_t *dev)
Transmit a preloaded frame.
Definition radio.h:979
static bool ieee802154_radio_has_irq_tx_start(ieee802154_dev_t *dev)
Check if the device supports TX start interrupt.
Definition radio.h:1616
static bool ieee802154_radio_has_irq_cca_done(ieee802154_dev_t *dev)
Check if the device supports CCA done interrupt.
Definition radio.h:1632
ieee802154_tx_status_t
Transmission status.
Definition radio.h:200
static int ieee802154_radio_len(ieee802154_dev_t *dev)
Shortcut to ieee802154_radio_ops::len.
Definition radio.h:1022
#define IEEE802154_RF_CAPS_PHY_MASK
Bit-mask for PHY modes capabilities.
Definition radio.h:189
static int ieee802154_radio_request_on(ieee802154_dev_t *dev)
Shortcut to ieee802154_radio_ops::request_on.
Definition radio.h:1241
ieee802154_af_cmd_t
Address filter command.
Definition radio.h:344
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:1170
static int ieee802154_radio_set_rx(ieee802154_dev_t *dev)
Set transceiver state to RX (blocking)
Definition radio.h:1390
static int ieee802154_radio_write(ieee802154_dev_t *dev, const iolist_t *psdu)
Shortcut to ieee802154_radio_ops::write.
Definition radio.h:955
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:1074
static uint32_t ieee802154_radio_get_phy_modes(ieee802154_dev_t *dev)
Get supported PHY modes of the device.
Definition radio.h:1761
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:1153
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:423
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:1776
ieee802154_filter_mode_t
Frame Filter mode.
Definition radio.h:354
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:1207
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:1186
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:1730
static bool ieee802154_radio_has_auto_csma(ieee802154_dev_t *dev)
Check if the device supports Auto CSMA-CA for transmissions.
Definition radio.h:1536
static int ieee802154_radio_confirm_set_rx(ieee802154_dev_t *dev)
Confirmation function for ieee802154_radio_request_set_rx.
Definition radio.h:1342
static bool ieee802154_radio_has_frame_retrans(ieee802154_dev_t *dev)
Check if the device supports frame retransmissions (with CSMA-CA).
Definition radio.h:1520
static int ieee802154_radio_request_set_rx(ieee802154_dev_t *dev)
Request the transceiver state to RX.
Definition radio.h:1324
@ IEEE802154_CCA_MODE_ED_THRESHOLD
CCA using first mode (energy detection)
Definition radio.h:451
@ IEEE802154_CCA_MODE_ED_THRESH_OR_CS
CCA using third mode (energy detection OR carrier sensing)
Definition radio.h:463
@ IEEE802154_CCA_MODE_ED_THRESH_AND_CS
CCA using third mode (energy detection AND carrier sensing)
Definition radio.h:459
@ IEEE802154_CCA_MODE_CARRIER_SENSING
CCA using second mode (carrier sensing)
Definition radio.h:455
@ IEEE802154_SRC_MATCH_EXT_CLEAR
Clear extended address from entry.
Definition radio.h:338
@ IEEE802154_SRC_MATCH_EN
Enable or disable source address match.
Definition radio.h:312
@ IEEE802154_SRC_MATCH_EXT_ADD
Add a extended address to entry.
Definition radio.h:331
@ IEEE802154_SRC_MATCH_SHORT_ADD
Add a short address to entry.
Definition radio.h:319
@ IEEE802154_SRC_MATCH_SHORT_CLEAR
Clear short address from entry.
Definition radio.h:325
@ IEEE802154_CAP_PHY_BPSK
Binary Phase Shift Keying PHY mode.
Definition radio.h:139
@ IEEE802154_CAP_FRAME_RETRANS_INFO
the device provides the number of retransmissions
Definition radio.h:131
@ IEEE802154_CAP_FRAME_RETRANS
the device supports frame retransmissions with CSMA-CA
Definition radio.h:66
@ IEEE802154_CAP_IRQ_RX_START
the device reports the start of a frame (SFD) when received.
Definition radio.h:117
@ IEEE802154_CAP_FRAME_RETENTION
the received frame remains valid until the reception is closed
Definition radio.h:183
@ IEEE802154_CAP_IRQ_ACK_TIMEOUT
the device support ACK timeout interrupt
Definition radio.h:95
@ IEEE802154_CAP_RX_TIMESTAMP
the devices records timestamps on received frames
Definition radio.h:172
@ IEEE802154_CAP_IRQ_TX_DONE
the device reports when the transmission is done
Definition radio.h:113
@ IEEE802154_CAP_SRC_ADDR_MATCH
the device supports source address match table.
Definition radio.h:168
@ IEEE802154_CAP_PHY_OQPSK
Offset Quadrature Phase-Shift Keying.
Definition radio.h:147
@ IEEE802154_CAP_PHY_MR_OQPSK
Multi-Rate Offset Quadrature Phase-Shift Keying PHY mode.
Definition radio.h:151
@ IEEE802154_CAP_REG_RETENTION
the device retains all register values when off.
Definition radio.h:135
@ IEEE802154_CAP_PHY_MR_FSK
Multi-Rate Frequency Shift Keying PHY mode.
Definition radio.h:159
@ IEEE802154_CAP_PHY_ASK
Amplitude-Shift Keying PHY mode.
Definition radio.h:143
@ IEEE802154_CAP_AUTO_CSMA
the device supports Auto CSMA-CA
Definition radio.h:76
@ IEEE802154_CAP_IRQ_CRC_ERROR
the device reports reception off frames with invalid CRC.
Definition radio.h:109
@ IEEE802154_CAP_SUB_GHZ
the device support the IEEE802.15.4 Sub GHz band
Definition radio.h:105
@ IEEE802154_CAP_IRQ_TX_START
the device reports the start of a frame (SFD) was sent.
Definition radio.h:121
@ IEEE802154_CAP_IRQ_CCA_DONE
the device reports the end of the CCA procedure
Definition radio.h:125
@ IEEE802154_CAP_AUTO_ACK
the device supports automatic ACK frame transmission
Definition radio.h:83
@ IEEE802154_CAP_24_GHZ
the device supports the IEEE802.15.4 2.4 GHz band
Definition radio.h:101
@ IEEE802154_CAP_PHY_MR_OFDM
Multi-Rate Orthogonal Frequency-Division Multiplexing PHY mode.
Definition radio.h:155
@ IEEE802154_RADIO_INDICATION_CRC_ERROR
The transceiver received a frame with an invalid crc.
Definition radio.h:257
@ IEEE802154_RADIO_INDICATION_TX_START
The transceiver sent out a valid SFD.
Definition radio.h:266
@ IEEE802154_RADIO_CONFIRM_CCA
the CCA procedure finished
Definition radio.h:297
@ IEEE802154_RADIO_INDICATION_RX_START
The transceiver detected a valid SFD.
Definition radio.h:247
@ IEEE802154_RADIO_INDICATION_RX_DONE
The transceiver received a frame and lies in the internal framebuffer.
Definition radio.h:281
@ IEEE802154_RADIO_CONFIRM_TX_DONE
The transceiver either finished sending a frame, the retransmission procedure or the channel activity...
Definition radio.h:291
@ IEEE802154_HAL_OP_TRANSMIT
Transmission of a preloaded frame.
Definition radio.h:511
@ IEEE802154_HAL_OP_CCA
Request Clear Channel Assessment.
Definition radio.h:523
@ IEEE802154_HAL_OP_SET_IDLE
Set the transceiver state to IDLE (RX off).
Definition radio.h:519
@ IEEE802154_HAL_OP_SET_RX
Set the transceiver state to RX.
Definition radio.h:515
@ TX_STATUS_FRAME_PENDING
The transceiver received a valid ACK with the frame pending bit.
Definition radio.h:221
@ TX_STATUS_SUCCESS
The transceiver successfully sent a frame.
Definition radio.h:214
@ TX_STATUS_MEDIUM_BUSY
the CSMA-CA algorithm or CCA failed to measure a clear channel
Definition radio.h:232
@ TX_STATUS_NO_ACK
The transceiver ran out of retransmission.
Definition radio.h:228
@ IEEE802154_AF_PAN_COORD
Set device as PAN coordinator (bool)
Definition radio.h:348
@ IEEE802154_AF_EXT_ADDR
Set extended IEEE 802.15.4 address (eui64_t)
Definition radio.h:346
@ IEEE802154_AF_SHORT_ADDR
Set short IEEE 802.15.4 address (network_uint16_t)
Definition radio.h:345
@ IEEE802154_AF_PANID
Set PAN ID (uint16_t)
Definition radio.h:347
@ IEEE802154_FILTER_SNIFFER
accept all frames, regardless of FCS
Definition radio.h:378
@ IEEE802154_FILTER_ACCEPT
accept all valid frames that match address filter configuration
Definition radio.h:358
@ IEEE802154_FILTER_ACK_ONLY
accept only ACK frames
Definition radio.h:366
@ IEEE802154_FILTER_PROMISC
accept all valid frames
Definition radio.h:372
ieee802154_mr_oqpsk_chips_t
802.15.4 MR-OQPSK chip rates
Definition ieee802154.h:228
ieee802154_mr_fsk_srate_t
802.15.4 MR-FSK symbol rates
Definition ieee802154.h:216
ieee802154_phy_mode_t
802.15.4 PHY modes
Definition ieee802154.h:192
ieee802154_mr_fsk_fec_t
802.15.4 forward error correction schemes
Definition ieee802154.h:207
@ IEEE802154_PHY_BPSK
Binary Phase Shift Keying.
Definition ieee802154.h:194
@ IEEE802154_PHY_MR_OFDM
Multi-Rate Orthogonal Frequency-Division Multiplexing.
Definition ieee802154.h:198
@ IEEE802154_PHY_OQPSK
Offset Quadrature Phase-Shift Keying.
Definition ieee802154.h:196
@ IEEE802154_PHY_ASK
Amplitude-Shift Keying.
Definition ieee802154.h:195
@ IEEE802154_PHY_MR_FSK
Multi-Rate Frequency Shift Keying.
Definition ieee802154.h:199
@ IEEE802154_PHY_DISABLED
PHY disabled, no mode selected.
Definition ieee802154.h:193
@ IEEE802154_PHY_MR_OQPSK
Multi-Rate Offset Quadrature Phase-Shift Keying.
Definition ieee802154.h:197
struct iolist iolist_t
iolist forward declaration
Definition iolist.h:30
iolist scatter / gather IO
CSMA-CA exponential backoff parameters.
Definition radio.h:384
uint8_t max
maximum value of the exponential backoff
Definition radio.h:386
uint8_t min
minimum value of the exponential backoff
Definition radio.h:385
the IEEE802.15.4 device descriptor
Definition radio.h:429
const ieee802154_radio_ops_t * driver
pointer to the operations of the device
Definition radio.h:433
ieee802154_cb_t cb
the event callback of the device
Definition radio.h:441
void * priv
pointer to the private descriptor of the device
Definition radio.h:437
extension for IEEE 802.15.4g MR-FSK PHY
Definition radio.h:496
uint8_t mod_idx
modulation index
Definition radio.h:500
ieee802154_mr_fsk_srate_t srate
symbol rate
Definition radio.h:498
ieee802154_phy_conf_t super
common settings
Definition radio.h:497
uint8_t mod_ord
modulation order, 2 or 4
Definition radio.h:499
ieee802154_mr_fsk_fec_t fec
forward error correction
Definition radio.h:501
extension for IEEE 802.15.4g MR-ODFM PHY
Definition radio.h:487
uint8_t option
OFDM Option.
Definition radio.h:489
uint8_t scheme
Modulation & Coding Scheme.
Definition radio.h:490
ieee802154_phy_conf_t super
common settings
Definition radio.h:488
extension for IEEE 802.15.4g MR-OQPSK PHY
Definition radio.h:478
uint8_t rate_mode
rate mode
Definition radio.h:481
ieee802154_mr_oqpsk_chips_t chips
chip rate
Definition radio.h:480
ieee802154_phy_conf_t super
common settings
Definition radio.h:479
Holder of the PHY configuration.
Definition radio.h:469
uint16_t channel
IEEE802.15.4 channel number.
Definition radio.h:471
int8_t pow
TX power in dBm.
Definition radio.h:472
ieee802154_phy_mode_t phy_mode
IEEE802.15.4 PHY mode.
Definition radio.h:470
Struct of security operations.
Radio ops struct declaration.
Definition radio.h:531
int(* set_cca_mode)(ieee802154_dev_t *dev, ieee802154_cca_mode_t mode)
Set CCA mode.
Definition radio.h:787
const uint32_t caps
Radio device capabilities.
Definition radio.h:538
int(* request_op)(ieee802154_dev_t *dev, ieee802154_hal_op_t op, void *ctx)
Request a radio operation.
Definition radio.h:742
int(* confirm_on)(ieee802154_dev_t *dev)
Confirmation function for ieee802154_radio_ops::request_on.
Definition radio.h:725
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:771
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:844
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:908
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:808
int(* off)(ieee802154_dev_t *dev)
Turn off the device.
Definition radio.h:682
int(* write)(ieee802154_dev_t *dev, const iolist_t *psdu)
Write a frame into the framebuffer.
Definition radio.h:552
int(* peek)(ieee802154_dev_t *dev, void *buf, size_t offset, size_t size)
Peek a part of a received frame from the internal framebuffer.
Definition radio.h:668
int(* len)(ieee802154_dev_t *dev)
Get the length of the received PSDU frame.
Definition radio.h:570
int(* set_frame_filter_mode)(ieee802154_dev_t *dev, ieee802154_filter_mode_t mode)
Set the frame filter mode.
Definition radio.h:858
const struct ieee802154_radio_cipher_ops * cipher_ops
Radio cipher ops.
Definition radio.h:916
int(* get_frame_filter_mode)(ieee802154_dev_t *dev, ieee802154_filter_mode_t *mode)
Get the frame filter mode.
Definition radio.h:871
int(* read)(ieee802154_dev_t *dev, void *buf, size_t size, ieee802154_rx_info_t *info)
Read or discard the received frame and close the reception.
Definition radio.h:636
int(* request_on)(ieee802154_dev_t *dev)
Request to turn on the device.
Definition radio.h:697
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:758
int(* set_frame_retrans)(ieee802154_dev_t *dev, uint8_t retrans)
Set number of frame retransmissions.
Definition radio.h:824
int(* config_addr_filter)(ieee802154_dev_t *dev, ieee802154_af_cmd_t cmd, const void *value)
Configure the address filter.
Definition radio.h:888
RX information associated to a frame.
Definition radio.h:392
uint64_t timestamp
Timestamp value of a received frame in ns.
Definition radio.h:401
uint8_t rssi
RSSI of the received frame.
Definition radio.h:399
uint8_t lqi
LQI of the received frame.
Definition radio.h:400
TX information of the last transmitted frame.
Definition radio.h:407
int8_t retrans
number of frame retransmissions of the last TX
Definition radio.h:409
ieee802154_tx_status_t status
status of the last transmission
Definition radio.h:408
IEEE 802.15.4 header definitions.
libc header for scatter/gather I/O