Path: blob/main/sys/dev/ath/ath_hal/ar5212/ar5212.h
39566 views
/*-1* SPDX-License-Identifier: ISC2*3* Copyright (c) 2002-2009 Sam Leffler, Errno Consulting4* Copyright (c) 2002-2008 Atheros Communications, Inc.5*6* Permission to use, copy, modify, and/or distribute this software for any7* purpose with or without fee is hereby granted, provided that the above8* copyright notice and this permission notice appear in all copies.9*10* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES11* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF12* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR13* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES14* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN15* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF16* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.17*/18#ifndef _ATH_AR5212_H_19#define _ATH_AR5212_H_2021#include "ah_eeprom.h"2223#define AR5212_MAGIC 0x195410142425/* DCU Transmit Filter macros */26#define CALC_MMR(dcu, idx) \27( (4 * dcu) + (idx < 32 ? 0 : (idx < 64 ? 1 : (idx < 96 ? 2 : 3))) )28#define TXBLK_FROM_MMR(mmr) \29(AR_D_TXBLK_BASE + ((mmr & 0x1f) << 6) + ((mmr & 0x20) >> 3))30#define CALC_TXBLK_ADDR(dcu, idx) (TXBLK_FROM_MMR(CALC_MMR(dcu, idx)))31#define CALC_TXBLK_VALUE(idx) (1 << (idx & 0x1f))3233/* MAC register values */3435#define INIT_INTERRUPT_MASK \36( AR_IMR_TXERR | AR_IMR_TXOK | AR_IMR_RXORN | \37AR_IMR_RXERR | AR_IMR_RXOK | AR_IMR_TXURN | \38AR_IMR_HIUERR )39#define INIT_BEACON_CONTROL \40((INIT_RESET_TSF << 24) | (INIT_BEACON_EN << 23) | \41(INIT_TIM_OFFSET << 16) | INIT_BEACON_PERIOD)4243#define INIT_CONFIG_STATUS 0x0000000044#define INIT_RSSI_THR 0x00000781 /* Missed beacon counter initialized to 0x7 (max is 0xff) */45#define INIT_IQCAL_LOG_COUNT_MAX 0xF46#define INIT_BCON_CNTRL_REG 0x000000004748#define INIT_USEC 4049#define HALF_RATE_USEC 19 /* ((40 / 2) - 1 ) */50#define QUARTER_RATE_USEC 9 /* ((40 / 4) - 1 ) */5152#define RX_NON_FULL_RATE_LATENCY 6353#define TX_HALF_RATE_LATENCY 10854#define TX_QUARTER_RATE_LATENCY 2165556#define IFS_SLOT_FULL_RATE 0x168 /* 9 us half, 40 MHz core clock (9*40) */57#define IFS_SLOT_HALF_RATE 0x104 /* 13 us half, 20 MHz core clock (13*20) */58#define IFS_SLOT_QUARTER_RATE 0xD2 /* 21 us quarter, 10 MHz core clock (21*10) */59#define IFS_EIFS_FULL_RATE 0xE60 /* (74 + (2 * 9)) * 40MHz core clock */60#define IFS_EIFS_HALF_RATE 0xDAC /* (149 + (2 * 13)) * 20MHz core clock */61#define IFS_EIFS_QUARTER_RATE 0xD48 /* (298 + (2 * 21)) * 10MHz core clock */6263#define ACK_CTS_TIMEOUT_11A 0x3E8 /* ACK timeout in 11a core clocks */6465/* Tx frame start to tx data start delay */66#define TX_FRAME_D_START_HALF_RATE 0xc67#define TX_FRAME_D_START_QUARTER_RATE 0xd6869/*70* Various fifo fill before Tx start, in 64-byte units71* i.e. put the frame in the air while still DMAing72*/73#define MIN_TX_FIFO_THRESHOLD 0x174#define MAX_TX_FIFO_THRESHOLD ((IEEE80211_MAX_LEN / 64) + 1)75#define INIT_TX_FIFO_THRESHOLD MIN_TX_FIFO_THRESHOLD7677#define HAL_DECOMP_MASK_SIZE 128 /* 1 byte per key */7879/*80* Gain support.81*/82#define NUM_CORNER_FIX_BITS 483#define NUM_CORNER_FIX_BITS_5112 784#define DYN_ADJ_UP_MARGIN 1585#define DYN_ADJ_LO_MARGIN 2086#define PHY_PROBE_CCK_CORRECTION 587#define CCK_OFDM_GAIN_DELTA 158889enum GAIN_PARAMS {90GP_TXCLIP,91GP_PD90,92GP_PD84,93GP_GSEL,94};9596enum GAIN_PARAMS_5112 {97GP_MIXGAIN_OVR,98GP_PWD_138,99GP_PWD_137,100GP_PWD_136,101GP_PWD_132,102GP_PWD_131,103GP_PWD_130,104};105106typedef struct _gainOptStep {107int16_t paramVal[NUM_CORNER_FIX_BITS_5112];108int32_t stepGain;109int8_t stepName[16];110} GAIN_OPTIMIZATION_STEP;111112typedef struct {113uint32_t numStepsInLadder;114uint32_t defaultStepNum;115GAIN_OPTIMIZATION_STEP optStep[10];116} GAIN_OPTIMIZATION_LADDER;117118typedef struct {119uint32_t currStepNum;120uint32_t currGain;121uint32_t targetGain;122uint32_t loTrig;123uint32_t hiTrig;124uint32_t active;125const GAIN_OPTIMIZATION_STEP *currStep;126} GAIN_VALUES;127128/* RF HAL structures */129typedef struct RfHalFuncs {130void *priv; /* private state */131132void (*rfDetach)(struct ath_hal *ah);133void (*writeRegs)(struct ath_hal *,134u_int modeIndex, u_int freqIndex, int regWrites);135uint32_t *(*getRfBank)(struct ath_hal *ah, int bank);136HAL_BOOL (*setChannel)(struct ath_hal *,137const struct ieee80211_channel *);138HAL_BOOL (*setRfRegs)(struct ath_hal *,139const struct ieee80211_channel *, uint16_t modesIndex,140uint16_t *rfXpdGain);141HAL_BOOL (*setPowerTable)(struct ath_hal *ah,142int16_t *minPower, int16_t *maxPower,143const struct ieee80211_channel *, uint16_t *rfXpdGain);144HAL_BOOL (*getChannelMaxMinPower)(struct ath_hal *ah,145const struct ieee80211_channel *,146int16_t *maxPow, int16_t *minPow);147int16_t (*getNfAdjust)(struct ath_hal *, const HAL_CHANNEL_INTERNAL*);148} RF_HAL_FUNCS;149150struct ar5212AniParams {151int maxNoiseImmunityLevel; /* [0..4] */152int totalSizeDesired[5];153int coarseHigh[5];154int coarseLow[5];155int firpwr[5];156157int maxSpurImmunityLevel; /* [0..7] */158int cycPwrThr1[8];159160int maxFirstepLevel; /* [0..2] */161int firstep[3];162163uint32_t ofdmTrigHigh;164uint32_t ofdmTrigLow;165uint32_t cckTrigHigh;166uint32_t cckTrigLow;167int32_t rssiThrLow;168uint32_t rssiThrHigh;169170int period; /* update listen period */171172/* NB: intentionally ordered so data exported to user space is first */173uint32_t ofdmPhyErrBase; /* Base value for ofdm err counter */174uint32_t cckPhyErrBase; /* Base value for cck err counters */175};176177/*178* Per-channel ANI state private to the driver.179*/180struct ar5212AniState {181uint8_t noiseImmunityLevel;182uint8_t spurImmunityLevel;183uint8_t firstepLevel;184uint8_t ofdmWeakSigDetectOff;185uint8_t cckWeakSigThreshold;186uint32_t listenTime;187188/* NB: intentionally ordered so data exported to user space is first */189uint32_t txFrameCount; /* Last txFrameCount */190uint32_t rxFrameCount; /* Last rx Frame count */191uint32_t cycleCount; /* Last cycleCount192(to detect wrap-around) */193uint32_t ofdmPhyErrCount;/* OFDM err count since last reset */194uint32_t cckPhyErrCount; /* CCK err count since last reset */195196const struct ar5212AniParams *params;197};198199#define HAL_ANI_ENA 0x00000001 /* ANI operation enabled */200#define HAL_RSSI_ANI_ENA 0x00000002 /* rssi-based processing ena'd*/201202#if 0203struct ar5212Stats {204uint32_t ast_ani_niup; /* ANI increased noise immunity */205uint32_t ast_ani_nidown; /* ANI decreased noise immunity */206uint32_t ast_ani_spurup; /* ANI increased spur immunity */207uint32_t ast_ani_spurdown;/* ANI descreased spur immunity */208uint32_t ast_ani_ofdmon; /* ANI OFDM weak signal detect on */209uint32_t ast_ani_ofdmoff;/* ANI OFDM weak signal detect off */210uint32_t ast_ani_cckhigh;/* ANI CCK weak signal threshold high */211uint32_t ast_ani_ccklow; /* ANI CCK weak signal threshold low */212uint32_t ast_ani_stepup; /* ANI increased first step level */213uint32_t ast_ani_stepdown;/* ANI decreased first step level */214uint32_t ast_ani_ofdmerrs;/* ANI cumulative ofdm phy err count */215uint32_t ast_ani_cckerrs;/* ANI cumulative cck phy err count */216uint32_t ast_ani_reset; /* ANI parameters zero'd for non-STA */217uint32_t ast_ani_lzero; /* ANI listen time forced to zero */218uint32_t ast_ani_lneg; /* ANI listen time calculated < 0 */219HAL_MIB_STATS ast_mibstats; /* MIB counter stats */220HAL_NODE_STATS ast_nodestats; /* Latest rssi stats from driver */221};222#endif223224/*225* NF Cal history buffer226*/227#define AR5212_CCA_MAX_GOOD_VALUE -95228#define AR5212_CCA_MAX_HIGH_VALUE -62229#define AR5212_CCA_MIN_BAD_VALUE -125230231#define AR512_NF_CAL_HIST_MAX 5232233struct ar5212NfCalHist {234int16_t nfCalBuffer[AR512_NF_CAL_HIST_MAX];235int16_t privNF;236uint8_t currIndex;237uint8_t first_run;238uint8_t invalidNFcount;239};240241struct ath_hal_5212 {242struct ath_hal_private ah_priv; /* base class */243244/*245* Per-chip common Initialization data.246* NB: RF backends have their own ini data.247*/248HAL_INI_ARRAY ah_ini_modes;249HAL_INI_ARRAY ah_ini_common;250251GAIN_VALUES ah_gainValues;252253uint8_t ah_macaddr[IEEE80211_ADDR_LEN];254uint8_t ah_bssid[IEEE80211_ADDR_LEN];255uint8_t ah_bssidmask[IEEE80211_ADDR_LEN];256uint16_t ah_assocId;257258/*259* Runtime state.260*/261uint32_t ah_maskReg; /* copy of AR_IMR */262HAL_ANI_STATS ah_stats; /* various statistics */263RF_HAL_FUNCS *ah_rfHal;264uint32_t ah_txDescMask; /* mask for TXDESC */265uint32_t ah_txOkInterruptMask;266uint32_t ah_txErrInterruptMask;267uint32_t ah_txDescInterruptMask;268uint32_t ah_txEolInterruptMask;269uint32_t ah_txUrnInterruptMask;270HAL_TX_QUEUE_INFO ah_txq[HAL_NUM_TX_QUEUES];271uint32_t ah_intrTxqs; /* tx q interrupt state */272/* decomp mask array */273uint8_t ah_decompMask[HAL_DECOMP_MASK_SIZE];274HAL_ANT_SETTING ah_antControl; /* antenna setting */275HAL_BOOL ah_diversity; /* fast diversity setting */276enum {277IQ_CAL_INACTIVE,278IQ_CAL_RUNNING,279IQ_CAL_DONE280} ah_bIQCalibration; /* IQ calibrate state */281HAL_RFGAIN ah_rfgainState; /* RF gain calibrartion state */282uint32_t ah_tx6PowerInHalfDbm; /* power output for 6Mb tx */283uint32_t ah_staId1Defaults; /* STA_ID1 default settings */284uint32_t ah_miscMode; /* MISC_MODE settings */285uint32_t ah_rssiThr; /* RSSI_THR settings */286HAL_BOOL ah_cwCalRequire; /* for ap51 */287HAL_BOOL ah_tpcEnabled; /* per-packet tpc enabled */288HAL_BOOL ah_phyPowerOn; /* PHY power state */289HAL_BOOL ah_isHb63; /* cached HB63 check */290uint32_t ah_macTPC; /* tpc register */291uint32_t ah_beaconInterval; /* XXX */292enum {293AUTO_32KHZ, /* use it if 32kHz crystal present */294USE_32KHZ, /* do it regardless */295DONT_USE_32KHZ, /* don't use it regardless */296} ah_enable32kHzClock; /* whether to sleep at 32kHz */297uint32_t ah_ofdmTxPower;298int16_t ah_txPowerIndexOffset;299/*300* Noise floor cal histogram support.301*/302struct ar5212NfCalHist ah_nfCalHist;303304u_int ah_slottime; /* user-specified slot time */305u_int ah_acktimeout; /* user-specified ack timeout */306u_int ah_ctstimeout; /* user-specified cts timeout */307u_int ah_sifstime; /* user-specified sifs time */308/*309* RF Silent handling; setup according to the EEPROM.310*/311uint32_t ah_gpioSelect; /* GPIO pin to use */312uint32_t ah_polarity; /* polarity to disable RF */313uint32_t ah_gpioBit; /* after init, prev value */314/*315* ANI support.316*/317uint32_t ah_procPhyErr; /* Process Phy errs */318HAL_BOOL ah_hasHwPhyCounters; /* Hardware has phy counters */319struct ar5212AniParams ah_aniParams24; /* 2.4GHz parameters */320struct ar5212AniParams ah_aniParams5; /* 5GHz parameters */321struct ar5212AniState *ah_curani; /* cached last reference */322struct ar5212AniState ah_ani[AH_MAXCHAN]; /* per-channel state */323324/* AR5416 uses some of the AR5212 ANI code; these are the ANI methods */325HAL_BOOL (*ah_aniControl) (struct ath_hal *, HAL_ANI_CMD cmd, int param);326327/*328* Transmit power state. Note these are maintained329* here so they can be retrieved by diagnostic tools.330*/331uint16_t *ah_pcdacTable;332u_int ah_pcdacTableSize;333uint16_t ah_ratesArray[37];334335uint8_t ah_txTrigLev; /* current Tx trigger level */336uint8_t ah_maxTxTrigLev; /* max tx trigger level */337338/*339* Channel Tx, Rx, Rx Clear State340*/341uint32_t ah_cycleCount;342uint32_t ah_ctlBusy;343uint32_t ah_rxBusy;344uint32_t ah_txBusy;345uint32_t ah_rx_chainmask;346uint32_t ah_tx_chainmask;347348/* Used to return ANI statistics to the diagnostic API */349HAL_ANI_STATS ext_ani_stats;350};351#define AH5212(_ah) ((struct ath_hal_5212 *)(_ah))352353/*354* IS_XXXX macros test the MAC version355* IS_RADXXX macros test the radio/RF version (matching both 2G-only and 2/5G)356*357* Some single chip radios have equivalent radio/RF (e.g. 5112)358* for those use IS_RADXXX_ANY macros.359*/360#define IS_2317(ah) \361((AH_PRIVATE(ah)->ah_devid == AR5212_AR2317_REV1) || \362(AH_PRIVATE(ah)->ah_devid == AR5212_AR2317_REV2))363#define IS_2316(ah) \364(AH_PRIVATE(ah)->ah_macVersion == AR_SREV_2415)365#define IS_2413(ah) \366(AH_PRIVATE(ah)->ah_macVersion == AR_SREV_2413 || IS_2316(ah))367#define IS_5424(ah) \368(AH_PRIVATE(ah)->ah_macVersion == AR_SREV_5424 || \369(AH_PRIVATE(ah)->ah_macVersion == AR_SREV_5413 && \370AH_PRIVATE(ah)->ah_macRev <= AR_SREV_D2PLUS_MS))371#define IS_5413(ah) \372(AH_PRIVATE(ah)->ah_macVersion == AR_SREV_5413 || IS_5424(ah))373#define IS_2425(ah) \374(AH_PRIVATE(ah)->ah_macVersion == AR_SREV_2425)375#define IS_2417(ah) \376((AH_PRIVATE(ah)->ah_macVersion) == AR_SREV_2417)377#define IS_HB63(ah) (AH5212(ah)->ah_isHb63 == AH_TRUE)378379#define AH_RADIO_MAJOR(ah) \380(AH_PRIVATE(ah)->ah_analog5GhzRev & AR_RADIO_SREV_MAJOR)381#define AH_RADIO_MINOR(ah) \382(AH_PRIVATE(ah)->ah_analog5GhzRev & AR_RADIO_SREV_MINOR)383#define IS_RAD5111(ah) \384(AH_RADIO_MAJOR(ah) == AR_RAD5111_SREV_MAJOR || \385AH_RADIO_MAJOR(ah) == AR_RAD2111_SREV_MAJOR)386#define IS_RAD5112(ah) \387(AH_RADIO_MAJOR(ah) == AR_RAD5112_SREV_MAJOR || \388AH_RADIO_MAJOR(ah) == AR_RAD2112_SREV_MAJOR)389/* NB: does not include 5413 as Atheros' IS_5112 macro does */390#define IS_RAD5112_ANY(ah) \391(AR_RAD5112_SREV_MAJOR <= AH_RADIO_MAJOR(ah) && \392AH_RADIO_MAJOR(ah) <= AR_RAD2413_SREV_MAJOR)393#define IS_RAD5112_REV1(ah) \394(IS_RAD5112(ah) && \395AH_RADIO_MINOR(ah) < (AR_RAD5112_SREV_2_0 & AR_RADIO_SREV_MINOR))396#define IS_RADX112_REV2(ah) \397(AH_PRIVATE(ah)->ah_analog5GhzRev == AR_RAD5112_SREV_2_0 || \398AH_PRIVATE(ah)->ah_analog5GhzRev == AR_RAD2112_SREV_2_0 || \399AH_PRIVATE(ah)->ah_analog5GhzRev == AR_RAD2112_SREV_2_1 || \400AH_PRIVATE(ah)->ah_analog5GhzRev == AR_RAD5112_SREV_2_1)401402#define ar5212RfDetach(ah) do { \403if (AH5212(ah)->ah_rfHal != AH_NULL) \404AH5212(ah)->ah_rfHal->rfDetach(ah); \405} while (0)406#define ar5212GetRfBank(ah, b) \407AH5212(ah)->ah_rfHal->getRfBank(ah, b)408409/*410* Hack macros for Nala/San: 11b is handled411* using 11g; flip the channel flags to accomplish this.412*/413#define SAVE_CCK(_ah, _chan, _flag) do { \414if ((IS_2425(_ah) || IS_2417(_ah)) && \415(((_chan)->ic_flags) & IEEE80211_CHAN_CCK)) { \416(_chan)->ic_flags &= ~IEEE80211_CHAN_CCK; \417(_chan)->ic_flags |= IEEE80211_CHAN_DYN; \418(_flag) = AH_TRUE; \419} else \420(_flag) = AH_FALSE; \421} while (0)422#define RESTORE_CCK(_ah, _chan, _flag) do { \423if ((_flag) && (IS_2425(_ah) || IS_2417(_ah))) { \424(_chan)->ic_flags &= ~IEEE80211_CHAN_DYN; \425(_chan)->ic_flags |= IEEE80211_CHAN_CCK; \426} \427} while (0)428429struct ath_hal;430431extern uint32_t ar5212GetRadioRev(struct ath_hal *ah);432extern void ar5212InitState(struct ath_hal_5212 *, uint16_t devid, HAL_SOFTC,433HAL_BUS_TAG st, HAL_BUS_HANDLE sh, HAL_STATUS *status);434extern void ar5212Detach(struct ath_hal *ah);435extern HAL_BOOL ar5212ChipTest(struct ath_hal *ah);436extern HAL_BOOL ar5212GetChannelEdges(struct ath_hal *ah,437uint16_t flags, uint16_t *low, uint16_t *high);438extern HAL_BOOL ar5212FillCapabilityInfo(struct ath_hal *ah);439440extern void ar5212SetBeaconTimers(struct ath_hal *ah,441const HAL_BEACON_TIMERS *);442extern void ar5212BeaconInit(struct ath_hal *ah,443uint32_t next_beacon, uint32_t beacon_period);444extern void ar5212ResetStaBeaconTimers(struct ath_hal *ah);445extern void ar5212SetStaBeaconTimers(struct ath_hal *ah,446const HAL_BEACON_STATE *);447extern uint64_t ar5212GetNextTBTT(struct ath_hal *);448449extern HAL_BOOL ar5212IsInterruptPending(struct ath_hal *ah);450extern HAL_BOOL ar5212GetPendingInterrupts(struct ath_hal *ah, HAL_INT *);451extern HAL_INT ar5212GetInterrupts(struct ath_hal *ah);452extern HAL_INT ar5212SetInterrupts(struct ath_hal *ah, HAL_INT ints);453454extern uint32_t ar5212GetKeyCacheSize(struct ath_hal *);455extern HAL_BOOL ar5212IsKeyCacheEntryValid(struct ath_hal *, uint16_t entry);456extern HAL_BOOL ar5212ResetKeyCacheEntry(struct ath_hal *ah, uint16_t entry);457extern HAL_BOOL ar5212SetKeyCacheEntryMac(struct ath_hal *,458uint16_t entry, const uint8_t *mac);459extern HAL_BOOL ar5212SetKeyCacheEntry(struct ath_hal *ah, uint16_t entry,460const HAL_KEYVAL *k, const uint8_t *mac, int xorKey);461462extern void ar5212GetMacAddress(struct ath_hal *ah, uint8_t *mac);463extern HAL_BOOL ar5212SetMacAddress(struct ath_hal *ah, const uint8_t *);464extern void ar5212GetBssIdMask(struct ath_hal *ah, uint8_t *mac);465extern HAL_BOOL ar5212SetBssIdMask(struct ath_hal *, const uint8_t *);466extern HAL_BOOL ar5212EepromRead(struct ath_hal *, u_int off, uint16_t *data);467extern HAL_BOOL ar5212EepromWrite(struct ath_hal *, u_int off, uint16_t data);468extern HAL_BOOL ar5212SetRegulatoryDomain(struct ath_hal *ah,469uint16_t regDomain, HAL_STATUS *stats);470extern u_int ar5212GetWirelessModes(struct ath_hal *ah);471extern void ar5212EnableRfKill(struct ath_hal *);472extern HAL_BOOL ar5212GpioCfgOutput(struct ath_hal *, uint32_t gpio,473HAL_GPIO_MUX_TYPE);474extern HAL_BOOL ar5212GpioCfgInput(struct ath_hal *, uint32_t gpio);475extern HAL_BOOL ar5212GpioSet(struct ath_hal *, uint32_t gpio, uint32_t val);476extern uint32_t ar5212GpioGet(struct ath_hal *ah, uint32_t gpio);477extern void ar5212GpioSetIntr(struct ath_hal *ah, u_int, uint32_t ilevel);478extern void ar5212SetLedState(struct ath_hal *ah, HAL_LED_STATE state);479extern void ar5212WriteAssocid(struct ath_hal *ah, const uint8_t *bssid,480uint16_t assocId);481extern uint32_t ar5212GetTsf32(struct ath_hal *ah);482extern uint64_t ar5212GetTsf64(struct ath_hal *ah);483extern void ar5212SetTsf64(struct ath_hal *ah, uint64_t tsf64);484extern void ar5212ResetTsf(struct ath_hal *ah);485extern void ar5212SetBasicRate(struct ath_hal *ah, HAL_RATE_SET *pSet);486extern uint32_t ar5212GetRandomSeed(struct ath_hal *ah);487extern HAL_BOOL ar5212DetectCardPresent(struct ath_hal *ah);488extern void ar5212EnableMibCounters(struct ath_hal *);489extern void ar5212DisableMibCounters(struct ath_hal *);490extern void ar5212UpdateMibCounters(struct ath_hal *ah, HAL_MIB_STATS* stats);491extern HAL_BOOL ar5212IsJapanChannelSpreadSupported(struct ath_hal *ah);492extern uint32_t ar5212GetCurRssi(struct ath_hal *ah);493extern u_int ar5212GetDefAntenna(struct ath_hal *ah);494extern void ar5212SetDefAntenna(struct ath_hal *ah, u_int antenna);495extern HAL_ANT_SETTING ar5212GetAntennaSwitch(struct ath_hal *);496extern HAL_BOOL ar5212SetAntennaSwitch(struct ath_hal *, HAL_ANT_SETTING);497extern HAL_BOOL ar5212IsSleepAfterBeaconBroken(struct ath_hal *ah);498extern HAL_BOOL ar5212SetSifsTime(struct ath_hal *, u_int);499extern u_int ar5212GetSifsTime(struct ath_hal *);500extern HAL_BOOL ar5212SetSlotTime(struct ath_hal *, u_int);501extern u_int ar5212GetSlotTime(struct ath_hal *);502extern HAL_BOOL ar5212SetAckTimeout(struct ath_hal *, u_int);503extern u_int ar5212GetAckTimeout(struct ath_hal *);504extern HAL_BOOL ar5212SetAckCTSRate(struct ath_hal *, u_int);505extern u_int ar5212GetAckCTSRate(struct ath_hal *);506extern HAL_BOOL ar5212SetCTSTimeout(struct ath_hal *, u_int);507extern u_int ar5212GetCTSTimeout(struct ath_hal *);508extern HAL_BOOL ar5212SetDecompMask(struct ath_hal *, uint16_t, int);509void ar5212SetCoverageClass(struct ath_hal *, uint8_t, int);510extern void ar5212SetPCUConfig(struct ath_hal *);511extern HAL_BOOL ar5212Use32KHzclock(struct ath_hal *ah, HAL_OPMODE opmode);512extern void ar5212SetupClock(struct ath_hal *ah, HAL_OPMODE opmode);513extern void ar5212RestoreClock(struct ath_hal *ah, HAL_OPMODE opmode);514extern int16_t ar5212GetNfAdjust(struct ath_hal *,515const HAL_CHANNEL_INTERNAL *);516extern void ar5212SetCompRegs(struct ath_hal *ah);517extern HAL_STATUS ar5212GetCapability(struct ath_hal *, HAL_CAPABILITY_TYPE,518uint32_t, uint32_t *);519extern HAL_BOOL ar5212SetCapability(struct ath_hal *, HAL_CAPABILITY_TYPE,520uint32_t, uint32_t, HAL_STATUS *);521extern HAL_BOOL ar5212GetDiagState(struct ath_hal *ah, int request,522const void *args, uint32_t argsize,523void **result, uint32_t *resultsize);524extern HAL_STATUS ar5212SetQuiet(struct ath_hal *ah, uint32_t period,525uint32_t duration, uint32_t nextStart, HAL_QUIET_FLAG flag);526extern HAL_BOOL ar5212GetMibCycleCounts(struct ath_hal *,527HAL_SURVEY_SAMPLE *);528extern void ar5212SetChainMasks(struct ath_hal *, uint32_t, uint32_t);529extern u_int ar5212GetNav(struct ath_hal *);530extern void ar5212SetNav(struct ath_hal *, u_int);531532extern HAL_BOOL ar5212SetPowerMode(struct ath_hal *ah, HAL_POWER_MODE mode,533int setChip);534extern HAL_POWER_MODE ar5212GetPowerMode(struct ath_hal *ah);535extern HAL_BOOL ar5212GetPowerStatus(struct ath_hal *ah);536537extern uint32_t ar5212GetRxDP(struct ath_hal *ath, HAL_RX_QUEUE);538extern void ar5212SetRxDP(struct ath_hal *ah, uint32_t rxdp, HAL_RX_QUEUE);539extern void ar5212EnableReceive(struct ath_hal *ah);540extern HAL_BOOL ar5212StopDmaReceive(struct ath_hal *ah);541extern void ar5212StartPcuReceive(struct ath_hal *ah, HAL_BOOL);542extern void ar5212StopPcuReceive(struct ath_hal *ah);543extern void ar5212SetMulticastFilter(struct ath_hal *ah,544uint32_t filter0, uint32_t filter1);545extern HAL_BOOL ar5212ClrMulticastFilterIndex(struct ath_hal *, uint32_t ix);546extern HAL_BOOL ar5212SetMulticastFilterIndex(struct ath_hal *, uint32_t ix);547extern uint32_t ar5212GetRxFilter(struct ath_hal *ah);548extern void ar5212SetRxFilter(struct ath_hal *ah, uint32_t bits);549extern HAL_BOOL ar5212SetupRxDesc(struct ath_hal *,550struct ath_desc *, uint32_t size, u_int flags);551extern HAL_STATUS ar5212ProcRxDesc(struct ath_hal *ah, struct ath_desc *,552uint32_t, struct ath_desc *, uint64_t,553struct ath_rx_status *);554555extern HAL_BOOL ar5212Reset(struct ath_hal *ah, HAL_OPMODE opmode,556struct ieee80211_channel *chan, HAL_BOOL bChannelChange,557HAL_RESET_TYPE, HAL_STATUS *status);558extern HAL_BOOL ar5212SetChannel(struct ath_hal *,559const struct ieee80211_channel *);560extern void ar5212SetOperatingMode(struct ath_hal *ah, int opmode);561extern HAL_BOOL ar5212PhyDisable(struct ath_hal *ah);562extern HAL_BOOL ar5212Disable(struct ath_hal *ah);563extern HAL_BOOL ar5212ChipReset(struct ath_hal *ah,564const struct ieee80211_channel *);565extern HAL_BOOL ar5212PerCalibration(struct ath_hal *ah,566struct ieee80211_channel *chan, HAL_BOOL *isIQdone);567extern HAL_BOOL ar5212PerCalibrationN(struct ath_hal *ah,568struct ieee80211_channel *chan, u_int chainMask,569HAL_BOOL longCal, HAL_BOOL *isCalDone);570extern HAL_BOOL ar5212ResetCalValid(struct ath_hal *ah,571const struct ieee80211_channel *);572extern int16_t ar5212GetNoiseFloor(struct ath_hal *ah);573extern void ar5212InitNfCalHistBuffer(struct ath_hal *);574extern int16_t ar5212GetNfHistMid(const int16_t calData[AR512_NF_CAL_HIST_MAX]);575extern void ar5212SetSpurMitigation(struct ath_hal *,576const struct ieee80211_channel *);577extern HAL_BOOL ar5212SetAntennaSwitchInternal(struct ath_hal *ah,578HAL_ANT_SETTING settings, const struct ieee80211_channel *);579extern HAL_BOOL ar5212SetTxPowerLimit(struct ath_hal *ah, uint32_t limit);580extern HAL_BOOL ar5212GetChipPowerLimits(struct ath_hal *ah,581struct ieee80211_channel *chan);582extern void ar5212InitializeGainValues(struct ath_hal *);583extern HAL_RFGAIN ar5212GetRfgain(struct ath_hal *ah);584extern void ar5212RequestRfgain(struct ath_hal *);585586extern HAL_BOOL ar5212UpdateTxTrigLevel(struct ath_hal *,587HAL_BOOL IncTrigLevel);588extern HAL_BOOL ar5212SetTxQueueProps(struct ath_hal *ah, int q,589const HAL_TXQ_INFO *qInfo);590extern HAL_BOOL ar5212GetTxQueueProps(struct ath_hal *ah, int q,591HAL_TXQ_INFO *qInfo);592extern int ar5212SetupTxQueue(struct ath_hal *ah, HAL_TX_QUEUE type,593const HAL_TXQ_INFO *qInfo);594extern HAL_BOOL ar5212ReleaseTxQueue(struct ath_hal *ah, u_int q);595extern HAL_BOOL ar5212ResetTxQueue(struct ath_hal *ah, u_int q);596extern uint32_t ar5212GetTxDP(struct ath_hal *ah, u_int q);597extern HAL_BOOL ar5212SetTxDP(struct ath_hal *ah, u_int q, uint32_t txdp);598extern HAL_BOOL ar5212StartTxDma(struct ath_hal *ah, u_int q);599extern uint32_t ar5212NumTxPending(struct ath_hal *ah, u_int q);600extern HAL_BOOL ar5212StopTxDma(struct ath_hal *ah, u_int q);601extern HAL_BOOL ar5212SetupTxDesc(struct ath_hal *ah, struct ath_desc *ds,602u_int pktLen, u_int hdrLen, HAL_PKT_TYPE type, u_int txPower,603u_int txRate0, u_int txTries0,604u_int keyIx, u_int antMode, u_int flags,605u_int rtsctsRate, u_int rtsctsDuration,606u_int compicvLen, u_int compivLen, u_int comp);607extern HAL_BOOL ar5212SetupXTxDesc(struct ath_hal *, struct ath_desc *,608u_int txRate1, u_int txRetries1,609u_int txRate2, u_int txRetries2,610u_int txRate3, u_int txRetries3);611extern HAL_BOOL ar5212FillTxDesc(struct ath_hal *ah, struct ath_desc *ds,612HAL_DMA_ADDR *bufAddrList, uint32_t *segLenList,613u_int descId, u_int qcuId, HAL_BOOL firstSeg, HAL_BOOL lastSeg,614const struct ath_desc *ds0);615extern HAL_STATUS ar5212ProcTxDesc(struct ath_hal *ah,616struct ath_desc *, struct ath_tx_status *);617extern void ar5212GetTxIntrQueue(struct ath_hal *ah, uint32_t *);618extern void ar5212IntrReqTxDesc(struct ath_hal *ah, struct ath_desc *);619extern HAL_BOOL ar5212GetTxCompletionRates(struct ath_hal *ah,620const struct ath_desc *ds0, int *rates, int *tries);621extern void ar5212SetTxDescLink(struct ath_hal *ah, void *ds,622uint32_t link);623extern void ar5212GetTxDescLink(struct ath_hal *ah, void *ds,624uint32_t *link);625extern void ar5212GetTxDescLinkPtr(struct ath_hal *ah, void *ds,626uint32_t **linkptr);627628extern const HAL_RATE_TABLE *ar5212GetRateTable(struct ath_hal *, u_int mode);629630extern void ar5212AniAttach(struct ath_hal *, const struct ar5212AniParams *,631const struct ar5212AniParams *, HAL_BOOL ena);632extern void ar5212AniDetach(struct ath_hal *);633extern struct ar5212AniState *ar5212AniGetCurrentState(struct ath_hal *);634extern HAL_ANI_STATS *ar5212AniGetCurrentStats(struct ath_hal *);635extern HAL_BOOL ar5212AniControl(struct ath_hal *, HAL_ANI_CMD cmd, int param);636extern HAL_BOOL ar5212AniSetParams(struct ath_hal *,637const struct ar5212AniParams *, const struct ar5212AniParams *);638struct ath_rx_status;639extern void ar5212AniPhyErrReport(struct ath_hal *ah,640const struct ath_rx_status *rs);641extern void ar5212ProcessMibIntr(struct ath_hal *, const HAL_NODE_STATS *);642extern void ar5212RxMonitor(struct ath_hal *, const HAL_NODE_STATS *,643const struct ieee80211_channel *);644extern void ar5212AniPoll(struct ath_hal *, const struct ieee80211_channel *);645extern void ar5212AniReset(struct ath_hal *, const struct ieee80211_channel *,646HAL_OPMODE, int);647648extern HAL_BOOL ar5212IsNFCalInProgress(struct ath_hal *ah);649extern HAL_BOOL ar5212WaitNFCalComplete(struct ath_hal *ah, int i);650extern void ar5212EnableDfs(struct ath_hal *ah, HAL_PHYERR_PARAM *pe);651extern HAL_BOOL ar5212GetDfsDefaultThresh(struct ath_hal *ah,652HAL_PHYERR_PARAM *pe);653extern void ar5212GetDfsThresh(struct ath_hal *ah, HAL_PHYERR_PARAM *pe);654extern HAL_BOOL ar5212ProcessRadarEvent(struct ath_hal *ah,655struct ath_rx_status *rxs, uint64_t fulltsf, const char *buf,656HAL_DFS_EVENT *event);657extern HAL_BOOL ar5212IsFastClockEnabled(struct ath_hal *ah);658extern uint32_t ar5212Get11nExtBusy(struct ath_hal *ah);659660#endif /* _ATH_AR5212_H_ */661662663