drivers/net/wireless/ralink/rt2x00/rt2800lib.h

Source file repositories/reference/linux-study-clean/drivers/net/wireless/ralink/rt2x00/rt2800lib.h

File Facts

System
Linux kernel
Corpus path
drivers/net/wireless/ralink/rt2x00/rt2800lib.h
Extension
.h
Size
9339 bytes
Lines
277
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.

Dependency Surface

Detected Declarations

Annotated Snippet

struct rf_reg_pair {
	u8 bank;
	u8 reg;
	u8 value;
};

/* RT2800 driver data structure */
struct rt2800_drv_data {
	u8 calibration_bw20;
	u8 calibration_bw40;
	s8 rx_calibration_bw20;
	s8 rx_calibration_bw40;
	s8 tx_calibration_bw20;
	s8 tx_calibration_bw40;
	u8 bbp25;
	u8 bbp26;
	u8 txmixer_gain_24g;
	u8 txmixer_gain_5g;
	u8 max_psdu;
	unsigned int tbtt_tick;
	unsigned int ampdu_factor_cnt[4];
	DECLARE_BITMAP(sta_ids, STA_IDS_SIZE);
	struct ieee80211_sta *wcid_to_sta[STA_IDS_SIZE];
};

struct rt2800_ops {
	u32 (*register_read)(struct rt2x00_dev *rt2x00dev,
			      const unsigned int offset);
	u32 (*register_read_lock)(struct rt2x00_dev *rt2x00dev,
				   const unsigned int offset);
	void (*register_write)(struct rt2x00_dev *rt2x00dev,
			       const unsigned int offset, u32 value);
	void (*register_write_lock)(struct rt2x00_dev *rt2x00dev,
				    const unsigned int offset, u32 value);

	void (*register_multiread)(struct rt2x00_dev *rt2x00dev,
				   const unsigned int offset,
				   void *value, const u32 length);
	void (*register_multiwrite)(struct rt2x00_dev *rt2x00dev,
				    const unsigned int offset,
				    const void *value, const u32 length);

	int (*regbusy_read)(struct rt2x00_dev *rt2x00dev,
			    const unsigned int offset,
			    const struct rt2x00_field32 field, u32 *reg);

	int (*read_eeprom)(struct rt2x00_dev *rt2x00dev);
	bool (*hwcrypt_disabled)(struct rt2x00_dev *rt2x00dev);

	int (*drv_write_firmware)(struct rt2x00_dev *rt2x00dev,
				  const u8 *data, const size_t len);
	int (*drv_init_registers)(struct rt2x00_dev *rt2x00dev);
	__le32 *(*drv_get_txwi)(struct queue_entry *entry);
	unsigned int (*drv_get_dma_done)(struct data_queue *queue);
};

static inline u32 rt2800_register_read(struct rt2x00_dev *rt2x00dev,
				       const unsigned int offset)
{
	const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;

	return rt2800ops->register_read(rt2x00dev, offset);
}

static inline u32 rt2800_register_read_lock(struct rt2x00_dev *rt2x00dev,
					    const unsigned int offset)
{
	const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;

	return rt2800ops->register_read_lock(rt2x00dev, offset);
}

static inline void rt2800_register_write(struct rt2x00_dev *rt2x00dev,
					 const unsigned int offset,
					 u32 value)
{
	const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;

	rt2800ops->register_write(rt2x00dev, offset, value);
}

static inline void rt2800_register_write_lock(struct rt2x00_dev *rt2x00dev,
					      const unsigned int offset,
					      u32 value)
{
	const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;

	rt2800ops->register_write_lock(rt2x00dev, offset, value);
}

Annotation

Implementation Notes