⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ar5212.h

📁 Atheros wifi driver source code
💻 H
📖 第 1 页 / 共 2 页
字号:
/* * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting * Copyright (c) 2002-2005 Atheros Communications, Inc. * All rights reserved. * * $Id: ar5212.h,v 1.2 2006/10/13 07:10:49 steven Exp $ */#ifndef _ATH_AR5212_H_#define _ATH_AR5212_H_#include "ah_eeprom.h"#include "ar5212/ar5212radar.h"#define	AR5212_MAGIC	0x19541014#define IS_5416(ah) 0/* DCU Transmit Filter macros */#define CALC_MMR(dcu, idx) \	( (4 * dcu) + (idx < 32 ? 0 : (idx < 64 ? 1 : (idx < 96 ? 2 : 3))) )#define TXBLK_FROM_MMR(mmr) \	(AR_D_TXBLK_BASE + ((mmr & 0x1f) << 6) + ((mmr & 0x20) >> 3))#define CALC_TXBLK_ADDR(dcu, idx)	(TXBLK_FROM_MMR(CALC_MMR(dcu, idx)))#define CALC_TXBLK_VALUE(idx)		(1 << (idx & 0x1f))/* MAC register values */#define INIT_INTERRUPT_MASK \	( AR_IMR_TXERR  | AR_IMR_TXOK | AR_IMR_RXORN | \	  AR_IMR_RXERR  | AR_IMR_RXOK | AR_IMR_TXURN | \	  AR_IMR_HIUERR )#define INIT_BEACON_CONTROL \	((INIT_RESET_TSF << 24)  | (INIT_BEACON_EN << 23) | \	  (INIT_TIM_OFFSET << 16) | INIT_BEACON_PERIOD)#define INIT_CONFIG_STATUS	0x00000000#define INIT_RSSI_THR		0x00000700	/* Missed beacon counter initialized to 0x7 (max is 0xff) */#define INIT_IQCAL_LOG_COUNT_MAX	0xF#define INIT_BCON_CNTRL_REG	0x00000000#define INIT_USEC		40#define HALF_RATE_USEC		19 /* ((40 / 2) - 1 ) */#define QUARTER_RATE_USEC	9  /* ((40 / 4) - 1 ) */#define RX_NON_FULL_RATE_LATENCY	63#define TX_HALF_RATE_LATENCY		108#define TX_QUARTER_RATE_LATENCY		216#define IFS_SLOT_FULL_RATE	0x168 /* 9 us half, 40 MHz core clock (9*40) */#define IFS_SLOT_HALF_RATE	0x104 /* 13 us half, 20 MHz core clock (13*20) */#define IFS_SLOT_QUARTER_RATE	0xD2 /* 21 us quarter, 10 MHz core clock (21*10) */#define IFS_EIFS_FULL_RATE	0xE60 /* (74 + (2 * 9)) * 40MHz core clock */#define IFS_EIFS_HALF_RATE	0xDAC /* (149 + (2 * 13)) * 20MHz core clock */#define IFS_EIFS_QUARTER_RATE	0xD48 /* (298 + (2 * 21)) * 10MHz core clock */#define ACK_CTS_TIMEOUT_11A	0x3E8 /* ACK timeout in 11a core clocks *//* Tx frame start to tx data start delay */#define TX_FRAME_D_START_HALF_RATE 	0xc#define TX_FRAME_D_START_QUARTER_RATE 	0xd/* * Various fifo fill before Tx start, in 64-byte units * i.e. put the frame in the air while still DMAing */#define MIN_TX_FIFO_THRESHOLD	0x1#define MAX_TX_FIFO_THRESHOLD	((IEEE80211_MAX_LEN / 64) + 1)#define INIT_TX_FIFO_THRESHOLD	MIN_TX_FIFO_THRESHOLD/* * Gain support. */#define	NUM_CORNER_FIX_BITS		4#define	NUM_CORNER_FIX_BITS_5112	7#define	DYN_ADJ_UP_MARGIN		15#define	DYN_ADJ_LO_MARGIN		20#define	PHY_PROBE_CCK_CORRECTION	5#define	CCK_OFDM_GAIN_DELTA		15enum GAIN_PARAMS {	GP_TXCLIP,	GP_PD90,	GP_PD84,	GP_GSEL,};enum GAIN_PARAMS_5112 {	GP_MIXGAIN_OVR,	GP_PWD_138,	GP_PWD_137,	GP_PWD_136,	GP_PWD_132,	GP_PWD_131,	GP_PWD_130,};typedef struct _gainOptStep {	int16_t	paramVal[NUM_CORNER_FIX_BITS_5112];	int32_t	stepGain;	int8_t	stepName[16];} GAIN_OPTIMIZATION_STEP;typedef struct {	u_int32_t	numStepsInLadder;	u_int32_t	defaultStepNum;	GAIN_OPTIMIZATION_STEP optStep[10];} GAIN_OPTIMIZATION_LADDER;typedef struct {	u_int32_t	currStepNum;	u_int32_t	currGain;	u_int32_t	targetGain;	u_int32_t	loTrig;	u_int32_t	hiTrig;	u_int32_t	gainFCorrection;	u_int32_t	active;	const GAIN_OPTIMIZATION_STEP *currStep;} GAIN_VALUES;/* RF HAL structures */typedef struct RfHalFuncs {	void	  (*rfDetach)(struct ath_hal *ah);	void	  (*writeRegs)(struct ath_hal *,			u_int modeIndex, u_int freqIndex, int regWrites);	u_int32_t *(*getRfBank)(struct ath_hal *ah, int bank);	HAL_BOOL  (*setChannel)(struct ath_hal *, HAL_CHANNEL_INTERNAL *);	HAL_BOOL  (*setRfRegs)(struct ath_hal *,		      HAL_CHANNEL_INTERNAL *, u_int16_t modesIndex,		      u_int16_t *rfXpdGain);	HAL_BOOL  (*setPowerTable)(struct ath_hal *ah,		      int16_t *minPower, int16_t *maxPower,		      HAL_CHANNEL_INTERNAL *, u_int16_t *rfXpdGain);	HAL_BOOL  (*getChipPowerLim)(struct ath_hal *ah, HAL_CHANNEL *chans,				       u_int32_t nchancs);} RF_HAL_FUNCS;/* * Per-channel ANI state private to the driver. */struct ar5212AniState {	HAL_CHANNEL	c;	/*	 * Max spur immunity level needs to be set to different levels	 * depending on whether we have a venice chip or something later	 * like Griffin or Cobra, Spider, etc... Not sure if Eagle should	 * follow venice values or Griffin values....	 *	 */	u_int8_t	maxSpurImmunity;	u_int8_t	noiseImmunityLevel;	u_int8_t	spurImmunityLevel;	u_int8_t	firstepLevel;	u_int8_t	ofdmWeakSigDetectOff;	u_int8_t	cckWeakSigThreshold;	/* Thresholds */	u_int32_t	listenTime;	u_int32_t	ofdmTrigHigh;	u_int32_t	ofdmTrigLow;	int32_t		cckTrigHigh;	int32_t		cckTrigLow;	int32_t		rssiThrLow;	int32_t		rssiThrHigh;	int8_t		attenOnThreshold;	int8_t		attenOffThreshold;	int8_t		rssiThrMaxNoiseImmunity;	int8_t		rssiThrDefNoiseImmunity;	u_int32_t	noiseFloor;	/* The current noise floor */	u_int32_t	txFrameCount;	/* Last txFrameCount */	u_int32_t	rxFrameCount;	/* Last rx Frame count */	u_int32_t	cycleCount;	/* Last cycleCount (can detect wrap-around) */	u_int32_t	ofdmPhyErrCount;/* OFDM err count since last reset */	u_int32_t	cckPhyErrCount;	/* CCK err count since last reset */	u_int32_t	ofdmPhyErrBase;	/* Base value for ofdm err counter */	u_int32_t	cckPhyErrBase;	/* Base value for cck err counters */	int16_t		pktRssi[2];	/* Average rssi of pkts for 2 antennas */	int16_t		ofdmErrRssi[2];	/* Average rssi of ofdm phy errs for 2 ant */	int16_t		cckErrRssi[2];	/* Average rssi of cck phy errs for 2 ant */	int8_t		totalSizeDesired;	int8_t		coarseHigh;	int8_t		coarseLow;	int8_t		firpwr;};#define	HAL_PROCESS_ANI		0x00000001	/* ANI state setup */#define HAL_RADAR_EN		0x80000000	/* Radar detect is capable */#define HAL_AR_EN		0x40000000	/* AR detect is capable */#define DO_ANI(ah) \	(((AH5212(ah)->ah_procPhyErr & HAL_PROCESS_ANI)) && (!(AH_PRIVATE(ah)->ah_curchan->channelFlags & CHANNEL_DFS)))struct ar5212Stats {	u_int32_t	ast_ani_niup;	/* ANI increased noise immunity */	u_int32_t	ast_ani_nidown;	/* ANI decreased noise immunity */	u_int32_t	ast_ani_spurup;	/* ANI increased spur immunity */	u_int32_t	ast_ani_spurdown;/* ANI descreased spur immunity */	u_int32_t	ast_ani_ofdmon;	/* ANI OFDM weak signal detect on */	u_int32_t	ast_ani_ofdmoff;/* ANI OFDM weak signal detect off */	u_int32_t	ast_ani_cckhigh;/* ANI CCK weak signal threshold high */	u_int32_t	ast_ani_ccklow;	/* ANI CCK weak signal threshold low */	u_int32_t	ast_ani_stepup;	/* ANI increased first step level */	u_int32_t	ast_ani_stepdown;/* ANI decreased first step level */	u_int32_t	ast_ani_ofdmerrs;/* ANI cumulative ofdm phy err count */	u_int32_t	ast_ani_cckerrs;/* ANI cumulative cck phy err count */	u_int32_t	ast_ani_reset;	/* ANI parameters zero'd for non-STA */	u_int32_t	ast_ani_lzero;	/* ANI listen time forced to zero */	u_int32_t	ast_ani_lneg;	/* ANI listen time calculated < 0 */	HAL_MIB_STATS	ast_mibstats;	/* MIB counter stats */	HAL_NODE_STATS	ast_nodestats;	/* Latest rssi stats from driver */	int8_t		ast_ani_state;	/* ANI operation On or Off */};struct ath_hal_5212 {	struct ath_hal_private	ah_priv;	/* base class */	/*	 * Information retrieved from EEPROM.	 */	HAL_EEPROM	ah_eeprom;	GAIN_VALUES	ah_gainValues;	u_int8_t	ah_macaddr[IEEE80211_ADDR_LEN];	u_int8_t	ah_bssid[IEEE80211_ADDR_LEN];	u_int8_t	ah_bssidmask[IEEE80211_ADDR_LEN];		/*	 * Runtime state.	 */	u_int32_t	ah_maskReg;		/* copy of AR_IMR */	struct ar5212Stats ah_stats;		/* various statistics */	RF_HAL_FUNCS	ah_rfHal;	u_int32_t	ah_txDescMask;		/* mask for TXDESC */	u_int32_t	ah_txOkInterruptMask;	u_int32_t	ah_txErrInterruptMask;	u_int32_t	ah_txDescInterruptMask;	u_int32_t	ah_txEolInterruptMask;	u_int32_t	ah_txUrnInterruptMask;	HAL_TX_QUEUE_INFO ah_txq[HAL_NUM_TX_QUEUES];	HAL_POWER_MODE	ah_powerMode;	u_int32_t	ah_atimWindow;	HAL_ANT_SETTING ah_diversityControl;	/* antenna setting */	enum {		IQ_CAL_INACTIVE,		IQ_CAL_RUNNING,		IQ_CAL_DONE	} ah_bIQCalibration;			/* IQ calibrate state */	HAL_RFGAIN	ah_rfgainState;		/* RF gain calibrartion state */	u_int32_t	ah_tx6PowerInHalfDbm;	/* power output for 6Mb tx */	u_int32_t	ah_staId1Defaults;	/* STA_ID1 default settings */	u_int32_t	ah_miscMode;		/* MISC_MODE settings */	HAL_BOOL	ah_tpcEnabled;		/* per-packet tpc enabled */	u_int32_t	ah_macTPC;		/* tpc register */	u_int32_t	ah_beaconInterval;	/* XXX */	enum {		AUTO_32KHZ,		/* use it if 32kHz crystal present */		USE_32KHZ,		/* do it regardless */		DONT_USE_32KHZ,		/* don't use it regardless */	} ah_enable32kHzClock;			/* whether to sleep at 32kHz */	void		*ah_analogBanks;	/* RF register banks */	u_int32_t	ah_ofdmTxPower;	int16_t		ah_txPowerIndexOffset;	u_int		ah_slottime;		/* user-specified slot time */	u_int		ah_acktimeout;		/* user-specified ack timeout */	u_int		ah_ctstimeout;		/* user-specified cts timeout */	/*	 * XXX	 * 11g-specific stuff; belongs in the driver.	 */	u_int8_t	ah_gBeaconRate;		/* fixed rate for G beacons */	/*	 * RF Silent handling; setup according to the EEPROM.	 */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -