drivers/net/ieee802154/at86rf230.c
Source file repositories/reference/linux-study-clean/drivers/net/ieee802154/at86rf230.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ieee802154/at86rf230.c- Extension
.c- Size
- 40125 bytes
- Lines
- 1675
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/module.hlinux/gpio/consumer.hlinux/hrtimer.hlinux/jiffies.hlinux/interrupt.hlinux/irq.hlinux/delay.hlinux/property.hlinux/spi/spi.hlinux/regmap.hlinux/skbuff.hlinux/ieee802154.hnet/mac802154.hnet/cfg802154.hat86rf230.h
Detected Declarations
struct at86rf230_localstruct at86rf2xx_chip_datastruct at86rf230_state_changestruct at86rf230_localfunction at86rf230_sleepfunction at86rf230_awakefunction __at86rf230_writefunction __at86rf230_readfunction at86rf230_read_subregfunction at86rf230_write_subregfunction at86rf230_slp_tr_rising_edgefunction at86rf230_reg_writeablefunction at86rf230_reg_readablefunction at86rf230_reg_volatilefunction at86rf230_reg_preciousfunction at86rf230_async_error_recover_completefunction at86rf230_async_error_recoverfunction at86rf230_async_errorfunction at86rf230_async_read_regfunction at86rf230_async_write_regfunction at86rf230_async_state_assertfunction at86rf230_async_state_timerfunction at86rf230_async_state_delayfunction at86rf230_async_state_change_startfunction at86rf230_async_state_changefunction at86rf230_sync_state_change_completefunction at86rf230_sync_state_changefunction at86rf230_tx_completefunction at86rf230_tx_onfunction at86rf230_tx_trac_checkfunction at86rf230_rx_read_frame_completefunction at86rf230_rx_trac_checkfunction at86rf230_irq_trx_endfunction at86rf230_irq_statusfunction at86rf230_setup_spi_messagesfunction at86rf230_isrfunction at86rf230_write_frame_completefunction at86rf230_write_framefunction at86rf230_xmit_tx_onfunction at86rf230_xmit_startfunction at86rf230_xmitfunction at86rf230_edfunction at86rf230_startfunction at86rf230_stopfunction at86rf23x_set_channelfunction at86rf212_update_cca_ed_levelfunction at86rf212_set_channelfunction at86rf230_channel
Annotated Snippet
struct at86rf2xx_chip_data {
u16 t_sleep_cycle;
u16 t_channel_switch;
u16 t_reset_to_off;
u16 t_off_to_aack;
u16 t_off_to_tx_on;
u16 t_off_to_sleep;
u16 t_sleep_to_off;
u16 t_frame;
u16 t_p_ack;
int rssi_base_val;
int (*set_channel)(struct at86rf230_local *, u8, u8);
int (*set_txpower)(struct at86rf230_local *, s32);
};
#define AT86RF2XX_MAX_BUF (127 + 3)
/* tx retries to access the TX_ON state
* if it's above then force change will be started.
*
* We assume the max_frame_retries (7) value of 802.15.4 here.
*/
#define AT86RF2XX_MAX_TX_RETRIES 7
/* We use the recommended 5 minutes timeout to recalibrate */
#define AT86RF2XX_CAL_LOOP_TIMEOUT (5 * 60 * HZ)
struct at86rf230_state_change {
struct at86rf230_local *lp;
int irq;
struct hrtimer timer;
struct spi_message msg;
struct spi_transfer trx;
u8 buf[AT86RF2XX_MAX_BUF];
void (*complete)(void *context);
u8 from_state;
u8 to_state;
int trac;
bool free;
};
struct at86rf230_local {
struct spi_device *spi;
struct ieee802154_hw *hw;
struct at86rf2xx_chip_data *data;
struct regmap *regmap;
struct gpio_desc *slp_tr;
bool sleep;
struct completion state_complete;
struct at86rf230_state_change state;
unsigned long cal_timeout;
bool is_tx;
bool is_tx_from_off;
bool was_tx;
u8 tx_retry;
struct sk_buff *tx_skb;
struct at86rf230_state_change tx;
};
#define AT86RF2XX_NUMREGS 0x3F
static void
at86rf230_async_state_change(struct at86rf230_local *lp,
struct at86rf230_state_change *ctx,
const u8 state, void (*complete)(void *context));
static inline void
at86rf230_sleep(struct at86rf230_local *lp)
{
if (lp->slp_tr) {
gpiod_set_value(lp->slp_tr, 1);
usleep_range(lp->data->t_off_to_sleep,
lp->data->t_off_to_sleep + 10);
lp->sleep = true;
}
}
static inline void
at86rf230_awake(struct at86rf230_local *lp)
{
if (lp->slp_tr) {
gpiod_set_value(lp->slp_tr, 0);
usleep_range(lp->data->t_sleep_to_off,
lp->data->t_sleep_to_off + 100);
lp->sleep = false;
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/module.h`, `linux/gpio/consumer.h`, `linux/hrtimer.h`, `linux/jiffies.h`, `linux/interrupt.h`, `linux/irq.h`, `linux/delay.h`.
- Detected declarations: `struct at86rf230_local`, `struct at86rf2xx_chip_data`, `struct at86rf230_state_change`, `struct at86rf230_local`, `function at86rf230_sleep`, `function at86rf230_awake`, `function __at86rf230_write`, `function __at86rf230_read`, `function at86rf230_read_subreg`, `function at86rf230_write_subreg`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.