36#include "net/ieee802154/radio.h"
40#if !defined(MODULE_AT86RFA1) && !defined(MODULE_AT86RFR2)
52#define AT86RF2XX_MAX_PKT_LENGTH (IEEE802154_FRAME_LEN_MAX)
58#ifdef MODULE_AT86RF212B
60# define AT86RF2XX_MIN_CHANNEL (IEEE802154_CHANNEL_MIN_SUBGHZ)
61# define AT86RF2XX_MAX_CHANNEL (IEEE802154_CHANNEL_MAX_SUBGHZ)
62# define AT86RF2XX_DEFAULT_CHANNEL (CONFIG_IEEE802154_DEFAULT_SUBGHZ_CHANNEL)
64# define AT86RF2XX_MIN_CHANNEL (IEEE802154_CHANNEL_MIN)
65# define AT86RF2XX_MAX_CHANNEL (IEEE802154_CHANNEL_MAX)
66# define AT86RF2XX_DEFAULT_CHANNEL (CONFIG_IEEE802154_DEFAULT_CHANNEL)
73#define AT86RF2XX_DEFAULT_TXPOWER (CONFIG_IEEE802154_DEFAULT_TXPOWER)
79# define RSSI_BASE_VAL (-94)
80#elif MODULE_AT86RF212B
85# define RSSI_BASE_VAL (-98)
86#elif MODULE_AT86RFA1 || MODULE_AT86RFR2
87# define RSSI_BASE_VAL (-90)
89# define RSSI_BASE_VAL (-91)
96# define MIN_RX_SENSITIVITY (-101)
97#elif MODULE_AT86RF212B
98# define MIN_RX_SENSITIVITY (-110)
99#elif MODULE_AT86RFA1 || MODULE_AT86RFR2
100# define MIN_RX_SENSITIVITY (-100)
102# define MIN_RX_SENSITIVITY (-101)
108#if IS_USED(MODULE_AT86RFA1) || IS_USED(MODULE_AT86RFR2)
109# define AT86RF2XX_IS_PERIPH (1)
111# define AT86RF2XX_IS_PERIPH (0)
117#if defined(MODULE_AT86RF231) || IS_ACTIVE(AT86RF2XX_PERIPH)
118# define AT86RF2XX_HAVE_ED_REGISTER (1)
120# define AT86RF2XX_HAVE_ED_REGISTER (0)
126#ifdef MODULE_AT86RF212B
127# define AT86RF2XX_HAVE_SUBGHZ (1)
129# define AT86RF2XX_HAVE_SUBGHZ (0)
132#if defined(DOXYGEN) || defined(MODULE_AT86RF232) || defined(MODULE_AT86RF233) || defined(MODULE_AT86RFR2)
139# define AT86RF2XX_HAVE_RETRIES (1)
141# define AT86RF2XX_HAVE_RETRIES (0)
150#if AT86RF2XX_HAVE_RETRIES && defined(AT86RF2XX_REG__XAH_CTRL_2)
151# define AT86RF2XX_HAVE_RETRIES_REG (1)
153# define AT86RF2XX_HAVE_RETRIES_REG (0)
159#ifdef AT86RF2XX_REG__IRQ_MASK1
160# define AT86RF2XX_HAVE_TX_START_IRQ (1)
162# define AT86RF2XX_HAVE_TX_START_IRQ (0)
172#if defined(MODULE_AT86RF233) || defined(MODULE_AT86RF231) || defined(MODULE_AT86RFA1) || defined(MODULE_AT86RFR2)
173# ifndef AT86RF2XX_RANDOM_NUMBER_GENERATOR
174# define AT86RF2XX_RANDOM_NUMBER_GENERATOR (1)
177# ifndef AT86RF2XX_RANDOM_NUMBER_GENERATOR
178# define AT86RF2XX_RANDOM_NUMBER_GENERATOR (0)
190#if defined(MODULE_AT86RF233) || defined(MODULE_AT86RFR2)
191# ifndef AT86RF2XX_SMART_IDLE_LISTENING
192# define AT86RF2XX_SMART_IDLE_LISTENING (1)
195# define AT86RF2XX_SMART_IDLE_LISTENING (0)
202#define AT86RF2XX_STATE_P_ON (0x00)
203#define AT86RF2XX_STATE_BUSY_RX (0x01)
204#define AT86RF2XX_STATE_BUSY_TX (0x02)
205#define AT86RF2XX_STATE_FORCE_TRX_OFF (0x03)
206#define AT86RF2XX_STATE_RX_ON (0x06)
207#define AT86RF2XX_STATE_TRX_OFF (0x08)
208#define AT86RF2XX_STATE_PLL_ON (0x09)
209#define AT86RF2XX_STATE_SLEEP (0x0f)
210#define AT86RF2XX_STATE_BUSY_RX_AACK (0x11)
211#define AT86RF2XX_STATE_BUSY_TX_ARET (0x12)
212#define AT86RF2XX_STATE_RX_AACK_ON (0x16)
213#define AT86RF2XX_STATE_TX_ARET_ON (0x19)
214#define AT86RF2XX_STATE_IN_PROGRESS (0x1f)
221#define AT86RF2XX_OPT_CSMA (0x0010)
222#define AT86RF2XX_OPT_PROMISCUOUS (0x0020)
223#define AT86RF2XX_OPT_PRELOADING (0x0040)
224#define AT86RF2XX_OPT_AUTOACK (0x0080)
225#define AT86RF2XX_OPT_ACK_PENDING (0x0100)
229#if IS_ACTIVE(AT86RF2XX_BASIC_MODE) || defined(DOXYGEN)
233# define AT86RF2XX_PHY_STATE_RX AT86RF2XX_STATE_RX_ON
237# define AT86RF2XX_PHY_STATE_RX_BUSY AT86RF2XX_STATE_BUSY_RX
241# define AT86RF2XX_PHY_STATE_TX AT86RF2XX_STATE_PLL_ON
245# define AT86RF2XX_PHY_STATE_TX_BUSY AT86RF2XX_STATE_BUSY_TX
247# define AT86RF2XX_PHY_STATE_RX AT86RF2XX_STATE_RX_AACK_ON
248# define AT86RF2XX_PHY_STATE_RX_BUSY AT86RF2XX_STATE_BUSY_RX_AACK
249# define AT86RF2XX_PHY_STATE_TX AT86RF2XX_STATE_TX_ARET_ON
250# define AT86RF2XX_PHY_STATE_TX_BUSY AT86RF2XX_STATE_BUSY_TX_ARET
253#if AT86RF2XX_IS_PERIPH
278#if !AT86RF2XX_IS_PERIPH
282#if AT86RF2XX_HAVE_RETRIES && AT86RF2XX_IS_PERIPH
433 uint8_t min, uint8_t max);
be_uint16_t network_uint16_t
A 16 bit integer in network byte order.
Definitions for netdev common IEEE 802.15.4 code.
Definitions low-level network driver interface.
Low-level GPIO peripheral driver interface definitions.
int at86rf2xx_set_rate(at86rf2xx_t *dev, uint8_t rate)
Set the current O-QPSK rate mode of the PHY rate modes > 0 are proprietary.
int8_t at86rf2xx_get_cca_threshold(const at86rf2xx_t *dev)
Get the CCA threshold value.
void at86rf2xx_disable_smart_idle(at86rf2xx_t *dev)
Disable the smart receive technology (SRT)
void at86rf2xx_set_pan(at86rf2xx_t *dev, uint16_t pan)
Set the PAN ID of the given device.
bool at86rf2xx_cca(at86rf2xx_t *dev)
Perform one manual channel clear assessment (CCA)
void at86rf2xx_set_cca_threshold(const at86rf2xx_t *dev, int8_t value)
Set the CCA threshold value.
int at86rf2xx_init_event(at86rf2xx_bhp_ev_t *bhp, const at86rf2xx_params_t *params, ieee802154_dev_t *hal, event_queue_t *evq)
Init an AT86RF2XX device with an event based Bottom Half Processor.
void at86rf2xx_set_addr_long(at86rf2xx_t *dev, const eui64_t *addr)
Set the long address of the given device.
void at86rf2xx_set_csma_max_retries(const at86rf2xx_t *dev, int8_t retries)
Set the maximum number of channel access attempts per frame (CSMA)
uint8_t at86rf2xx_get_rate(at86rf2xx_t *dev)
Get the current O-QPSK rate mode of the PHY.
void at86rf2xx_set_csma_seed(const at86rf2xx_t *dev, const uint8_t entropy[2])
Set seed for CSMA random backoff.
uint8_t at86rf2xx_get_phy_mode(at86rf2xx_t *dev)
Get the PHY mode of the given device.
uint8_t at86rf2xx_set_state(at86rf2xx_t *dev, uint8_t state)
Set the state of the given device (trigger a state change)
int8_t at86rf2xx_get_rxsensitivity(const at86rf2xx_t *dev)
Get the configured receiver sensitivity of the given device [in dBm].
uint8_t at86rf2xx_get_csma_max_retries(const at86rf2xx_t *dev)
Get the maximum number of channel access attempts per frame (CSMA)
struct at86rf2xx_params at86rf2xx_params_t
struct holding all params needed for device initialization
void at86rf2xx_enable_smart_idle(at86rf2xx_t *dev)
Enable the smart receive technology (SRT)
void at86rf2xx_disable_clock_output(at86rf2xx_t *dev)
Disable AT86RF2XX clock output.
void at86rf2xx_set_max_retries(const at86rf2xx_t *dev, uint8_t max)
Set the maximum number of retransmissions.
void at86rf2xx_irq_handler(ieee802154_dev_t *hal)
Offload pending IRQ.
void at86rf2xx_set_csma_backoff_exp(const at86rf2xx_t *dev, uint8_t min, uint8_t max)
Set the min and max backoff exponent for CSMA/CA.
int at86rf2xx_init(at86rf2xx_t *dev, const at86rf2xx_params_t *params, ieee802154_dev_t *hal, void(*cb)(void *), void *ctx)
Init an AT86RF2XX device.
void at86rf2xx_set_option(at86rf2xx_t *dev, uint16_t option, bool state)
Enable or disable driver specific options.
uint8_t at86rf2xx_get_max_retries(const at86rf2xx_t *dev)
Get the maximum number of retransmissions.
void at86rf2xx_set_addr_short(at86rf2xx_t *dev, const network_uint16_t *addr)
Set the short address of the given device.
void at86rf2xx_set_rxsensitivity(const at86rf2xx_t *dev, int8_t rxsens)
Set the receiver sensitivity of the given device [in dBm].
int8_t at86rf2xx_get_ed_level(at86rf2xx_t *dev)
Get the latest ED level measurement.
struct ieee802154_dev ieee802154_dev_t
Forward declaration of the IEEE802.15.4 device descriptor.
gpio_t spi_cs_t
Chip select pin type overlaps with gpio_t so it can be casted to this.
struct PTRTAG event_queue_t
event queue structure
struct event event_t
event structure forward declaration
Common macros and compiler attributes/pragmas configuration.
Protocol type definitions.
Low-level SPI peripheral driver interface definition.
Event Bottom Half Processor descriptor for AT86RF2XX transceivers.
event_queue_t * evq
Pointer to the event queue.
event_t ev
ISR offload event.
at86rf2xx_t dev
Device descriptor.
ieee802154_dev_t * hal
Pointer to the Radio HAL descriptor.
struct holding all params needed for device initialization
spi_t spi
SPI bus the device is connected to.
spi_cs_t cs_pin
GPIO pin connected to chip select.
gpio_t reset_pin
GPIO pin connected to the reset pin.
gpio_t sleep_pin
GPIO pin connected to the sleep pin.
gpio_t int_pin
GPIO pin connected to the interrupt pin.
spi_clk_t spi_clk
SPI clock speed to use.
Device descriptor for AT86RF2XX radio devices.
bool sleep
whether the device is sleeping or not
at86rf2xx_params_t params
parameters for initialization
Bottom Half Processor descriptor.
Data type to represent an EUI-64.