34#define BASE_ACTIVATE_DELAY 100
35#define PLL_SETTLE_DELAY 300
40 const struct ieee80211_channel *);
42 const struct ieee80211_channel *);
45 const struct ieee80211_channel *);
47 const struct ieee80211_channel *);
49 const struct ieee80211_channel *chan, uint16_t *rfXpdGain);
51 const struct ieee80211_channel *, int16_t tpcScaleReduction,
53 HAL_BOOL commit, int16_t *minPower, int16_t *maxPower);
56 const struct ieee80211_channel *,
62 const struct ieee80211_channel *);
64 const struct ieee80211_channel *);
68 uint16_t *pList, uint16_t listSize,
69 uint16_t *pLowerValue, uint16_t *pUpperValue);
71 uint32_t numBits, uint32_t firstBit, uint32_t column);
77#define IS_NO_RESET_TIMER_ADDR(x) \
78 ( (((x) >= AR_BEACON) && ((x) <= AR_CFP_DUR)) || \
79 (((x) >= AR_SLEEP1) && ((x) <= AR_SLEEP3)))
80#define V(r, c) (ia)->data[((r)*(ia)->cols) + (c)]
84 for (r = 0; r < ia->
rows; r++) {
85 uint32_t reg =
V(r, 0);
94#undef IS_NO_RESET_TIMER_ADDR
98#define IS_DISABLE_FAST_ADC_CHAN(x) (((x) == 2462) || ((x) == 2467))
104#define MAX_RESET_WAIT 10
106#define TX_QUEUEPEND_CHECK 1
107#define TX_ENABLE_CHECK 2
108#define RX_ENABLE_CHECK 4
120 struct ieee80211_channel *chan,
125#define N(a) (sizeof (a) / sizeof (a[0]))
126#define FAIL(_code) do { ecode = _code; goto bad; } while (0)
130 uint32_t softLedCfg, softLedState;
131 uint32_t saveFrameSeqCount, saveDefAntenna, saveLedState;
132 uint32_t macStaId1, synthDelay, txFrm2TxDStart;
134 int16_t cckOfdmPwrDelta = 0;
135 u_int modesIndex, freqIndex;
138 uint32_t testReg, powerVal;
139 int8_t twiceAntennaGain, twiceAntennaReduction;
140 uint32_t ackTpcPow, ctsTpcPow, chirpTpcPow;
178 if (bChannelChange) {
201 saveFrameSeqCount = 0;
223 if (bChannelChange &&
225 (chan->ic_freq !=
AH_PRIVATE(ah)->ah_curchan->ic_freq) &&
226 ((chan->ic_flags & IEEE80211_CHAN_ALLTURBO) ==
227 (
AH_PRIVATE(ah)->ah_curchan->ic_flags & IEEE80211_CHAN_ALLTURBO))) {
240 if (saveDefAntenna == 0)
268 if (IEEE80211_IS_CHAN_2GHZ(chan)) {
270 if (IEEE80211_IS_CHAN_108G(chan))
272 else if (IEEE80211_IS_CHAN_G(chan))
274 else if (IEEE80211_IS_CHAN_B(chan))
278 "%s: invalid channel %u/0x%x\n",
279 __func__, chan->ic_freq, chan->ic_flags);
284 if (IEEE80211_IS_CHAN_TURBO(chan))
286 else if (IEEE80211_IS_CHAN_A(chan))
290 "%s: invalid channel %u/0x%x\n",
291 __func__, chan->ic_freq, chan->ic_flags);
304#ifdef AH_RXCFG_SDMAMW_4BYTES
316 if (IEEE80211_IS_CHAN_HALF(chan) || IEEE80211_IS_CHAN_QUARTER(chan)) {
347 if (IEEE80211_IS_CHAN_G(chan)) {
351 SM((cckOfdmPwrDelta*-1),
395 "%s: error init'ing transmit power\n", __func__);
407 if (IEEE80211_IS_CHAN_OFDM(chan)) {
417 "%s: error setting board options\n", __func__);
470 (IEEE80211_IS_CHAN_HALF(chan) || IEEE80211_IS_CHAN_QUARTER(chan))) {
472 IEEE80211_IS_CHAN_HALF(chan) ?
501 if (IEEE80211_IS_CHAN_B(chan)) {
502 synthDelay = (4 * synthDelay) / 22;
517 if (IEEE80211_IS_CHAN_HALF(chan)) {
519 }
else if (IEEE80211_IS_CHAN_QUARTER(chan)) {
562 for (i = 0; i <
AH_PRIVATE(ah)->ah_caps.halTotalQueues; i++)
588 "%s: offset calibration failed to complete in 1ms;"
589 " noisy environment?\n", __func__);
624 if (IEEE80211_IS_CHAN_5GHZ(chan)) {
629 twiceAntennaReduction =
638 if (ackTpcPow > (2*chan->ic_maxregpower - twiceAntennaReduction))
639 ackTpcPow = (2*chan->ic_maxregpower - twiceAntennaReduction)
646 if (ctsTpcPow > (2*chan->ic_maxregpower - twiceAntennaReduction))
647 ctsTpcPow = (2*chan->ic_maxregpower - twiceAntennaReduction)
654 if (chirpTpcPow > (2*chan->ic_maxregpower - twiceAntennaReduction))
655 chirpTpcPow = (2*chan->ic_maxregpower - twiceAntennaReduction)
662 if (chirpTpcPow > 63)
689 if (bChannelChange && !IEEE80211_IS_CHAN_DFS(chan))
690 chan->ic_state &= ~IEEE80211_CHANSTATE_CWINT;
734 uint32_t data, synthDelay, qnum;
745 for (qnum = 0; qnum <
AH_PRIVATE(ah)->ah_caps.halTotalQueues; qnum++) {
756 for (ulCount = 0; ulCount < 100; ulCount++) {
773 if (IEEE80211_IS_CHAN_B(chan)) {
774 synthDelay = (4 * data) / 22;
776 synthDelay = data / 10;
783 "%s: error init'ing transmit power\n", __func__);
788 if (IEEE80211_IS_CHAN_OFDM(chan)) {
894 uint32_t rfMode, phyPLL = 0, curPhyPLL, turbo;
898 if (IEEE80211_IS_CHAN_HALF(chan))
900 else if (IEEE80211_IS_CHAN_QUARTER(chan))
903 if (IEEE80211_IS_CHAN_CCK(chan))
909 if (IEEE80211_IS_CHAN_CCK(chan))
913 if (IEEE80211_IS_CHAN_HALF(chan))
915 else if (IEEE80211_IS_CHAN_QUARTER(chan))
919 if (IEEE80211_IS_CHAN_CCK(chan))
923 if (IEEE80211_IS_CHAN_HALF(chan))
925 else if (IEEE80211_IS_CHAN_QUARTER(chan))
928 if (IEEE80211_IS_CHAN_G(chan))
930 else if (IEEE80211_IS_CHAN_OFDM(chan))
934 if (IEEE80211_IS_CHAN_5GHZ(chan))
938 turbo = IEEE80211_IS_CHAN_TURBO(chan) ?
948 if (IEEE80211_IS_CHAN_CCK(chan)) {
951 if (curPhyPLL != phyPLL) {
957 if (curPhyPLL != phyPLL) {
975 struct ieee80211_channel *chan,
978#define IQ_CAL_TRIES 10
981 int32_t qCoff, qCoffDenom;
982 int32_t iqCorrMeas, iCoff, iCoffDenom;
983 uint32_t powerMeasQ, powerMeasI;
991 "%s: invalid channel %u/0x%x; no mapping\n",
992 __func__, chan->ic_freq, chan->ic_flags);
1017 if (powerMeasI && powerMeasQ)
1025 "%s: IQ cal finished: %d tries\n", __func__, i);
1027 "%s: powerMeasI %u powerMeasQ %u iqCorrMeas %d\n",
1028 __func__, powerMeasI, powerMeasQ, iqCorrMeas);
1034 iCoffDenom = (powerMeasI / 2 + powerMeasQ / 2) / 128;
1035 qCoffDenom = powerMeasQ / 128;
1038 if (iCoffDenom != 0 && qCoffDenom >= 2) {
1039 iCoff = (int8_t)(-iqCorrMeas) / iCoffDenom;
1043 }
else if (iCoff > 31) {
1048 qCoff = (powerMeasI / qCoffDenom) - 128;
1051 }
else if (qCoff > 15) {
1056 "%s: iCoff %d qCoff %d\n", __func__, iCoff, qCoff);
1068 ichan->
iCoff = iCoff;
1069 ichan->
qCoff = qCoff;
1071 }
else if (!IEEE80211_IS_CHAN_B(chan) &&
1090 if (!IEEE80211_IS_CHAN_CWINT(chan)) {
1092 if (IEEE80211_IS_CHAN_5GHZ(chan) ||
1093 (
IS_RAD5112(ah) && IEEE80211_IS_CHAN_OFDM(chan)))
1118 "%s: invalid channel %u/0x%x; no mapping\n",
1119 __func__, chan->ic_freq, chan->ic_flags);
1137 uint32_t pendFrameCount;
1138 uint32_t macStateFlag;
1148 ar5212SetTxdpInvalid(ah);
1158 macStateFlag &= ~RX_ENABLE_CHECK;
1164 macStateFlag &= ~TX_ENABLE_CHECK;
1170 for (queue = 0; queue <
AR_NUM_DCU; queue++) {
1175 if (pendFrameCount == 0) {
1176 macStateFlag &= ~TX_QUEUEPEND_CHECK;
1179 if (macStateFlag == 0) {
1188 "%s:Failed to stop the MAC state 0x%x\n",
1189 __func__, macStateFlag);
1201 uint32_t mask = resetMask ? resetMask : ~0;
1206 resetMask &= ~AR_RC_PCI;
1245 if (
AH_PRIVATE(ah)->ah_bustype == HAL_BUS_TYPE_PCI) {
1246 if (!IS_5112_REV5_UP(ah)) {
1247#define PCI_COMMON_CONFIG_STATUS 0x06
1251 for (i = 0; i < 32; i++) {
1252 ath_hal_read_pci_config_space(ah,
1253 PCI_COMMON_CONFIG_STATUS,
1254 ®16,
sizeof(reg16));
1257#undef PCI_COMMON_CONFIG_STATUS
1265 resetMask &= ~AR_RC_PCI;
1286#ifndef AH_NEED_DESC_SWAP
1306 nf = 0 - ((nf ^ 0x1ff) + 1);
1319 case IEEE80211_CHAN_A:
1322 case IEEE80211_CHAN_B:
1325 case IEEE80211_CHAN_G:
1326 case IEEE80211_CHAN_PUREG:
1331 "%s: invalid channel flags %u/0x%x\n",
1332 __func__, chan->ic_freq, chan->ic_flags);
1378 if (sort[j] > sort[j-1]) {
1379 int16_t nf = sort[j];
1380 sort[j] = sort[j-1];
1397 int16_t nf, nfThresh;
1402 "%s: NF did not complete in calibration window\n", __func__);
1412 if (nf > nfThresh) {
1414 "%s: noise floor failed detected; detected %u, "
1415 "threshold %u\n", __func__, nf, nfThresh);
1421 chan->ic_state |= IEEE80211_CHANSTATE_CWINT;
1451 val |= (((uint32_t)nf << 1) & 0x1FF);
1469 val |= (((uint32_t)(-50) << 1) & 0x1FF);
1488 if (!
AH_PRIVATE(ah)->ah_caps.halCompressSupport)
1512 const struct ieee80211_channel *chan)
1514#define ANT_SWITCH_TABLE1 AR_PHY(88)
1515#define ANT_SWITCH_TABLE2 AR_PHY(89)
1518 uint32_t antSwitchA, antSwitchB;
1525 case IEEE80211_CHAN_A:
1528 case IEEE80211_CHAN_G:
1529 case IEEE80211_CHAN_PUREG:
1532 case IEEE80211_CHAN_B:
1541 __func__, chan->ic_flags);
1562 antSwitchB = antSwitchA;
1565 antSwitchA = antSwitchB;
1571 __func__, settings);
1574 if (antSwitchB == antSwitchA) {
1576 "%s: Setting fast diversity off.\n", __func__);
1582 "%s: Setting fast diversity on.\n", __func__);
1593#undef ANT_SWITCH_TABLE2
1594#undef ANT_SWITCH_TABLE1
1601 uint32_t clockFreq =
1603 return ( ((freq % clockFreq) != 0)
1604 && (((freq % clockFreq) < 10)
1605 || (((freq) % clockFreq) > 22)) );
1615#define NO_FALSE_DETECT_BACKOFF 2
1616#define CB22_FALSE_DETECT_BACKOFF 6
1617#define AR_PHY_BIS(_ah, _reg, _mask, _val) \
1618 OS_REG_WRITE(_ah, AR_PHY(_reg), \
1619 (OS_REG_READ(_ah, AR_PHY(_reg)) & _mask) | (_val));
1622 int arrayMode, falseDectectBackoff;
1623 int is2GHz = IEEE80211_IS_CHAN_2GHZ(chan);
1625 int8_t adcDesiredSize, pgaDesiredSize;
1626 uint16_t switchSettling, txrxAtten, rxtxMargin;
1632 case IEEE80211_CHAN_A:
1633 case IEEE80211_CHAN_ST:
1640 case IEEE80211_CHAN_B:
1643 case IEEE80211_CHAN_G:
1644 case IEEE80211_CHAN_108G:
1649 __func__, chan->ic_flags);
1704 if (
AH_PRIVATE(ah)->ah_subvendorid == 0x1022 &&
1705 IEEE80211_IS_CHAN_OFDM(chan))
1711 AR_PHY_BIS(ah, 73, 0xFFFFFF01, (falseDectectBackoff << 1) & 0xFE);
1714 iCoff = ichan->
iCoff;
1715 qCoff = ichan->
qCoff;
1741#undef NO_FALSE_DETECT_BACKOFF
1742#undef CB22_FALSE_DETECT_BACKOFF
1752 const struct ieee80211_channel *chan)
1754 uint32_t pilotMask[2] = {0, 0}, binMagMask[4] = {0, 0, 0 , 0};
1755 uint16_t i, finalSpur, curChanAsSpur, binWidth = 0, spurDetectWidth, spurChan;
1756 int32_t spurDeltaPhase = 0, spurFreqSd = 0, spurOffset, binOffsetNumT16, curBinOffset;
1757 int16_t numBinOffsets;
1758 static const uint16_t magMapFor4[4] = {1, 2, 2, 1};
1759 static const uint16_t magMapFor3[3] = {1, 2, 1};
1760 const uint16_t *pMagMap;
1761 HAL_BOOL is2GHz = IEEE80211_IS_CHAN_2GHZ(chan);
1765#define CHAN_TO_SPUR(_f, _freq) ( ((_freq) - ((_f) ? 2300 : 4900)) * 10 )
1784 if (IEEE80211_IS_CHAN_TURBO(chan))
1785 spurDetectWidth *= 2;
1833 spurOffset = finalSpur - curChanAsSpur;
1839 if (IEEE80211_IS_CHAN_TURBO(chan)) {
1841 spurDeltaPhase = (spurOffset << 16) / 25;
1842 spurFreqSd = spurDeltaPhase >> 10;
1844 }
else if (IEEE80211_IS_CHAN_G(chan)) {
1846 spurFreqSd = (spurOffset << 8) / 55;
1847 spurDeltaPhase = (spurOffset << 17) / 25;
1852 spurDeltaPhase = (spurOffset << 17) / 25;
1853 spurFreqSd = spurDeltaPhase >> 10;
1858 binOffsetNumT16 = ((spurOffset * 1000) << 4) / binWidth;
1860 if (binOffsetNumT16 & 0xF) {
1862 pMagMap = magMapFor4;
1865 pMagMap = magMapFor3;
1867 for (i = 0; i < numBinOffsets; i++) {
1870 "Too man bins in spur mitigation\n");
1875 curBinOffset = (binOffsetNumT16 >> 4) + i + 25;
1876 if ((curBinOffset >= 0) && (curBinOffset <= 32)) {
1877 if (curBinOffset <= 25)
1878 pilotMask[0] |= 1 << curBinOffset;
1879 else if (curBinOffset >= 27)
1880 pilotMask[0] |= 1 << (curBinOffset - 1);
1881 }
else if ((curBinOffset >= 33) && (curBinOffset <= 52))
1882 pilotMask[1] |= 1 << (curBinOffset - 33);
1885 if ((curBinOffset >= -1) && (curBinOffset <= 14))
1886 binMagMask[0] |= pMagMap[i] << (curBinOffset + 1) * 2;
1887 else if ((curBinOffset >= 15) && (curBinOffset <= 30))
1888 binMagMask[1] |= pMagMap[i] << (curBinOffset - 15) * 2;
1889 else if ((curBinOffset >= 31) && (curBinOffset <= 46))
1890 binMagMask[2] |= pMagMap[i] << (curBinOffset -31) * 2;
1891 else if((curBinOffset >= 47) && (curBinOffset <= 53))
1892 binMagMask[3] |= pMagMap[i] << (curBinOffset -47) * 2;
1932#define COEF_SCALE_S 24
1933#define INIT_CLOCKMHZSCALED 0x64000000
1935 unsigned long coef_scaled, coef_exp, coef_man, ds_coef_exp, ds_coef_man;
1938 if (IEEE80211_IS_CHAN_TURBO(chan))
1939 clockMhzScaled *= 2;
1942 if (IEEE80211_IS_CHAN_HALF(chan)) {
1943 clockMhzScaled = clockMhzScaled >> 1;
1944 }
else if (IEEE80211_IS_CHAN_QUARTER(chan)) {
1945 clockMhzScaled = clockMhzScaled >> 2;
1952 coef_scaled = clockMhzScaled / freq;
1958 for (coef_exp = 31; coef_exp > 0; coef_exp--)
1959 if ((coef_scaled >> coef_exp) & 0x1)
1969 coef_man = coef_scaled + (1 << (
COEF_SCALE_S - coef_exp - 1));
1971 ds_coef_exp = coef_exp - 16;
1977#undef INIT_CLOCKMHZSCALED
1991 struct ieee80211_channel dummy = *
AH_PRIVATE(ah)->ah_curchan;
1992 uint16_t dummyXpdGains[2];
2006 const struct ieee80211_channel *chan, uint16_t *rfXpdGain)
2008#define POW_OFDM(_r, _s) (((0 & 1)<< ((_s)+6)) | (((_r) & 0x3f) << (_s)))
2009#define POW_CCK(_r, _s) (((_r) & 0x3f) << (_s))
2010#define N(a) (sizeof (a) / sizeof (a[0]))
2011 static const uint16_t tpcScaleReductionTable[5] =
2016 int16_t minPower, maxPower, tpcInDb, powerLimit;
2026 tpcInDb = tpcScaleReductionTable[
AH_PRIVATE(ah)->ah_tpScale];
2030 AH_TRUE, &minPower, &maxPower)) {
2036 &minPower, &maxPower, chan, rfXpdGain)) {
2064 IEEE80211_IS_CHAN_G(chan)) {
2065 uint16_t cckOfdmPwrDelta;
2082 ((((ahp->
ah_pcdacTable[2*i + 1] << 8) | 0xff) & 0xffff) << 16)
2135 int16_t tpcScaleReduction, int16_t powerLimit,
HAL_BOOL commit,
2136 int16_t *pMinPower, int16_t *pMaxPower)
2147 int8_t twiceAntennaGain, twiceAntennaReduction;
2150 int16_t scaledPower, maxAvailPower = 0;
2151 int16_t r13, r9, r7, r0;
2155 twiceMaxRDPower = chan->ic_maxregpower * 2;
2162 uint16_t twiceMinEdgePower;
2166 if (ee->
ee_ctl[i] == cfgCtl ||
2172 twiceMaxEdgePower =
AH_MIN(twiceMaxEdgePower, twiceMinEdgePower);
2174 twiceMaxEdgePower = twiceMinEdgePower;
2180 if (IEEE80211_IS_CHAN_G(chan)) {
2182 cfgCtl = (cfgCtl & ~CTL_MODE_M) |
CTL_11B;
2184 uint16_t twiceMinEdgePowerCck;
2188 if (ee->
ee_ctl[i] == cfgCtl ||
2194 twiceMaxEdgePowerCck =
AH_MIN(twiceMaxEdgePowerCck, twiceMinEdgePowerCck);
2196 twiceMaxEdgePowerCck = twiceMinEdgePowerCck;
2203 twiceMaxEdgePowerCck = twiceMaxEdgePower;
2207 if (IEEE80211_IS_CHAN_5GHZ(chan)) {
2212 twiceAntennaReduction =
2215 if (IEEE80211_IS_CHAN_OFDM(chan)) {
2217 if (IEEE80211_IS_CHAN_2GHZ(chan)) {
2219 ee->ee_numTargetPwr_11g, &targetPowerOfdm);
2222 ee->ee_numTargetPwr_11a, &targetPowerOfdm);
2227 scaledPower =
AH_MIN(twiceMaxEdgePower,
2228 twiceMaxRDPower - twiceAntennaReduction);
2236 if (IEEE80211_IS_CHAN_TURBO(chan)
2237#ifdef AH_ENABLE_AP_SUPPORT
2246 scaledPower =
AH_MIN(scaledPower,
2253 IEEE80211_IS_CHAN_2GHZ(chan))
2254 scaledPower =
AH_MIN(scaledPower,
2258 maxAvailPower =
AH_MIN(scaledPower,
2262 scaledPower = maxAvailPower - (tpcScaleReduction * 2);
2263 scaledPower = (scaledPower < 0) ? 0 : scaledPower;
2264 scaledPower =
AH_MIN(scaledPower, powerLimit);
2268 r0 = rpow[0] = rpow[1] = rpow[2] = rpow[3] = rpow[4] = scaledPower;
2277 rpow[15] =
AH_MIN(scaledPower, IEEE80211_IS_CHAN_2GHZ(chan) ?
2293 "%s: MaxRD: %d TurboMax: %d MaxCTL: %d "
2294 "TPC_Reduction %d chan=%d (0x%x) maxAvailPower=%d pwr6_24=%d, maxPower=%d\n",
2296 twiceMaxEdgePower, tpcScaleReduction * 2,
2297 chan->ic_freq, chan->ic_flags,
2298 maxAvailPower, targetPowerOfdm.
twicePwr6_24, *pMaxPower);
2301 if (IEEE80211_IS_CHAN_CCK(chan)) {
2304 ee->ee_numTargetPwr_11b, &targetPowerCck);
2307 scaledPower =
AH_MIN(twiceMaxEdgePowerCck,
2308 twiceMaxRDPower - twiceAntennaReduction);
2313 scaledPower =
AH_MIN(scaledPower, targetPowerCck.
twicePwr6_24) - (tpcScaleReduction * 2);
2314 scaledPower = (scaledPower < 0) ? 0 : scaledPower;
2315 scaledPower =
AH_MIN(scaledPower, powerLimit);
2323 rpow[12] = rpow[11];
2325 rpow[14] = rpow[13];
2332 if (r13 < *pMinPower)
2334 if (r9 > *pMaxPower)
2338 "%s: cck: MaxRD: %d MaxCTL: %d "
2339 "TPC_Reduction %d chan=%d (0x%x) maxAvailPower=%d pwr6_24=%d, maxPower=%d\n",
2340 __func__, twiceMaxRDPower, twiceMaxEdgePowerCck,
2341 tpcScaleReduction * 2, chan->ic_freq, chan->ic_flags,
2342 maxAvailPower, targetPowerCck.
twicePwr6_24, *pMaxPower);
2356 static const uint16_t tpcScaleReductionTable[5] =
2358 int16_t tpcInDb, powerLimit;
2360 int16_t minPower, maxPower;
2367 chan->ic_maxpower = maxPower / 2;
2368 chan->ic_minpower = minPower / 2;
2371 "%s: no min/max power for %u/0x%x\n",
2372 __func__, chan->ic_freq, chan->ic_flags);
2374 chan->ic_minpower = 0;
2383 tpcInDb = tpcScaleReductionTable[
AH_PRIVATE(ah)->ah_tpScale];
2389 "%s: unable to find max/min power\n",__func__);
2392 if (maxPower < chan->ic_maxpower)
2393 chan->ic_maxpower = maxPower;
2394 if (minPower < chan->ic_minpower)
2395 chan->ic_minpower = minPower;
2397 "Chan %d: MaxPow = %d MinPow = %d\n",
2398 chan->ic_freq, chan->ic_maxpower, chans->ic_minpower);
2419#define N(_a) (sizeof(_a) / sizeof(_a[0]))
2423 uint16_t ii, jj, iter;
2425 int16_t gainDeltaAdjust;
2435 for (ii = 8; ii < 15; ii++) {
2437 ratesIndex[ii] -= gainDeltaAdjust;
2444 if (ratesIndex[ii] < 0)
2453 else if (iter > 50) {
2483 for (ii = 8; ii < 15; ii++)
2496 uint16_t clo, chi, twiceMaxEdgePower;
2501 if (pRdEdgesPower[i].rdEdge == 0)
2503 tempChannelList[i] = pRdEdgesPower[i].
rdEdge;
2508 numEdges, &clo, &chi);
2510 for (i = 0; i < numEdges && clo != tempChannelList[i]; i++)
2515 if ((clo == chi && clo == channel) || (pRdEdgesPower[i].flag)) {
2524 return twiceMaxEdgePower;
2532 uint16_t targetLeft, uint16_t targetRight)
2538 if ((targetLeft * targetRight) == 0)
2541 if (srcRight != srcLeft) {
2546 lRatio = (target - srcLeft) *
EEP_SCALE / (srcRight - srcLeft);
2554 rv = (lRatio * targetRight + (
EEP_SCALE - lRatio) *
2575 uint16_t clo, chi, ixlo, ixhi;
2579 for (i = 0; i < numChannels; i++)
2580 tempChannelList[i] = powInfo[i].testChannel;
2583 numChannels, &clo, &chi);
2587 for (i = 0; i < numChannels; i++) {
2588 if (clo == tempChannelList[i]) {
2591 if (chi == tempChannelList[i]) {
2602 powInfo[ixlo].twicePwr6_24, powInfo[ixhi].twicePwr6_24);
2604 powInfo[ixlo].twicePwr36, powInfo[ixhi].twicePwr36);
2606 powInfo[ixlo].twicePwr48, powInfo[ixhi].twicePwr48);
2608 powInfo[ixlo].twicePwr54, powInfo[ixhi].twicePwr54);
2614 return (u >= v ? u - v : v - u);
2628 uint16_t *vlo, uint16_t *vhi)
2631 uint16_t *ep = lp+listSize;
2637 *vlo = *vhi = lp[0];
2641 *vlo = *vhi = ep[-1];
2646 for (; lp < ep; lp++) {
2652 *vlo = *vhi = lp[0];
2675 uint32_t firstBit, uint32_t column)
2677#define MAX_ANALOG_START 319
2678 uint32_t tmp32, mask, arrayEntry, lastBit;
2679 int32_t bitPosition, bitsLeft;
2686 arrayEntry = (firstBit - 1) / 8;
2687 bitPosition = (firstBit - 1) % 8;
2689 while (bitsLeft > 0) {
2690 lastBit = (bitPosition + bitsLeft > 8) ?
2691 8 : bitPosition + bitsLeft;
2692 mask = (((1 << lastBit) - 1) ^ ((1 << bitPosition) - 1)) <<
2694 rfBuf[arrayEntry] &= ~mask;
2695 rfBuf[arrayEntry] |= ((tmp32 << bitPosition) <<
2696 (column * 8)) & mask;
2697 bitsLeft -= 8 - bitPosition;
2698 tmp32 = tmp32 >> (8 - bitPosition);
2702#undef MAX_ANALOG_START
2718 const struct ieee80211_channel *chan)
2724 if (IEEE80211_IS_CHAN_HALF(chan)) {
2726 }
else if (IEEE80211_IS_CHAN_QUARTER(chan)) {
2739 if (!IEEE80211_IS_CHAN_TURBO(chan)) {
2745 if (rt->
info[i].
phy != IEEE80211_T_CCK)
2773 uint32_t txLat, rxLat, usec, slot, refClock, eifs, init_usec;
2775 HALASSERT(IEEE80211_IS_CHAN_HALF(chan) ||
2776 IEEE80211_IS_CHAN_QUARTER(chan));
2779 if (IEEE80211_IS_CHAN_HALF(chan)) {
uint32_t ath_hal_reverseBits(uint32_t val, uint32_t n)
uint16_t ath_hal_computetxtime(struct ath_hal *ah, const HAL_RATE_TABLE *rates, uint32_t frameLen, uint16_t rateix, HAL_BOOL shortPreamble, HAL_BOOL includeSifs)
int ath_hal_ini_write(struct ath_hal *ah, const HAL_INI_ARRAY *ia, int col, int regWr)
void ath_hal_survey_clear(struct ath_hal *ah)
HAL_BOOL ath_hal_wait(struct ath_hal *ah, u_int reg, uint32_t mask, uint32_t val)
@ HAL_MODE_11A_QUARTER_RATE
#define MAX_NUM_PDGAINS_PER_CHANNEL
#define AR_EEPROM_MODAL_SPURS
#define SCALE_OC_DELTA(_x)
#define NUM_TEST_FREQUENCIES
#define OS_REG_SET_BIT(_a, _r, _f)
u_int ath_hal_getantennareduction(struct ath_hal *ah, const struct ieee80211_channel *chan, u_int twiceGain)
u_int ath_hal_getctl(struct ath_hal *, const struct ieee80211_channel *)
#define HAL_SPUR_CHAN_WIDTH
#define HAL_MAX_BINS_ALLOWED
#define HAL_SPUR_VAL_MASK
#define HAL_BIN_WIDTH_TURBO_100HZ
static OS_INLINE HAL_CHANNEL_INTERNAL * ath_hal_checkchannel(struct ath_hal *ah, const struct ieee80211_channel *c)
#define HAL_BIN_WIDTH_BASE_100HZ
#define IEEE80211_CHAN_ALLTURBOFULL
#define ath_hal_eepromGet(_ah, _param, _val)
#define OS_REG_CLR_BIT(_a, _r, _f)
#define ath_hal_getSpurChan(_ah, _ix, _is2G)
static __inline__ int isBigEndian(void)
static OS_INLINE uint16_t ath_hal_gethwchannel(struct ath_hal *ah, const struct ieee80211_channel *c)
#define IEEE80211_CHAN_ALLFULL
#define OS_REG_RMW_FIELD(_a, _r, _f, _v)
#define HALDEBUG(_ah, __m,...)
#define WLAN_CTRL_FRAME_SIZE
#define OS_REG_IS_BIT_SET(_a, _r, _f)
void ath_hal_printf(struct ath_hal *, const char *,...)
#define OS_MEMZERO(_a, _n)
#define OS_REG_WRITE(_ah, _reg, _val)
#define OS_MARK(_ah, _id, _v)
#define OS_MEMCPY(_d, _s, _n)
#define OS_REG_READ(_ah, _reg)
#define INIT_CONFIG_STATUS
#define AR_BEACON_RESET_TSF
#define INIT_IQCAL_LOG_COUNT_MAX
#define AR_PHY_POWER_TX_RATE2
#define AR_PHY_IQCAL_RES_IQ_CORR_MEAS
#define AR_PHY_AGC_CONTROL_CAL
#define AR_PHY_FRAME_CTL_TX_CLIP
#define AR_PHY_TIMING_CTRL4_DO_IQCAL
#define AR_PHY_AGC_CONTROL_NF
#define AR_PHY_FC_TURBO_SHORT
#define AR_PHY_PLL_CTL_40
#define AR_PHY_POWER_TX_RATE1
#define AR_PHY_FC_TURBO_MODE
#define AR_PHY_IQCAL_RES_PWR_MEAS_I
#define AR_PHY_POWER_TX_RATE_MAX
#define AR_PHY_TIMING_CTRL4
#define AR_PHY_TIMING_CTRL4_IQCORR_ENABLE
#define AR_PHY_PLL_CTL_44
#define AR_PHY_AGC_CONTROL
#define AR_PHY_IQCAL_RES_PWR_MEAS_Q
#define AR_CFG_AP_ADHOC_INDICATION
#define AR_STA_ID1_RTS_USE_DEF
#define AR_D_GBL_IFS_SLOT
#define AR_PCICFG_LEDSLOW
#define AR_D_GBL_IFS_MISC_USEC_DURATION
#define AR_PCICFG_LEDMODE
#define AR_STA_ID1_STA_AP
#define AR_D_GBL_IFS_MISC
#define AR_PCICFG_LEDBLINK
#define AR_STA_ID1_BASE_RATE_11B
#define AR_D_GBL_IFS_EIFS
#define RESTORE_CCK(_ah, _chan, _flag)
#define AR512_NF_CAL_HIST_MAX
HAL_BOOL ar5212SetCTSTimeout(struct ath_hal *, u_int)
HAL_RFGAIN ar5212GetRfgain(struct ath_hal *ah)
HAL_BOOL ar5212SetSlotTime(struct ath_hal *, u_int)
#define TX_HALF_RATE_LATENCY
#define IFS_EIFS_QUARTER_RATE
#define HAL_DECOMP_MASK_SIZE
#define TX_FRAME_D_START_QUARTER_RATE
#define RX_NON_FULL_RATE_LATENCY
#define TX_QUARTER_RATE_LATENCY
uint32_t ar5212NumTxPending(struct ath_hal *ah, u_int q)
#define QUARTER_RATE_USEC
HAL_BOOL ar5212SetAckTimeout(struct ath_hal *, u_int)
HAL_BOOL ar5212SetSifsTime(struct ath_hal *, u_int)
HAL_BOOL ar5212SetPowerMode(struct ath_hal *ah, HAL_POWER_MODE mode, int setChip)
#define IFS_EIFS_HALF_RATE
#define SAVE_CCK(_ah, _chan, _flag)
HAL_BOOL ar5212ResetTxQueue(struct ath_hal *ah, u_int q)
#define TX_FRAME_D_START_HALF_RATE
#define IS_RAD5112_ANY(ah)
void ar5212EnableRfKill(struct ath_hal *)
const HAL_RATE_TABLE * ar5212GetRateTable(struct ath_hal *, u_int mode)
void ar5212SetCoverageClass(struct ath_hal *, uint8_t, int)
#define AR5212_CCA_MIN_BAD_VALUE
#define AR5212_CCA_MAX_GOOD_VALUE
void ar5212RequestRfgain(struct ath_hal *)
#define IFS_SLOT_QUARTER_RATE
void ar5212SetupClock(struct ath_hal *ah, HAL_OPMODE opmode)
#define AR5212_CCA_MAX_HIGH_VALUE
#define IFS_SLOT_HALF_RATE
void ar5212RestoreClock(struct ath_hal *ah, HAL_OPMODE opmode)
static uint32_t udiff(uint32_t u, uint32_t v)
void ar5212SetSpurMitigation(struct ath_hal *ah, const struct ieee80211_channel *chan)
int16_t ar5212GetNf(struct ath_hal *, struct ieee80211_channel *)
#define BASE_ACTIVATE_DELAY
int16_t ar5212GetNoiseFloor(struct ath_hal *ah)
static __inline void updateNFHistBuff(struct ar5212NfCalHist *h, int16_t nf)
HAL_BOOL ar5212ResetCalValid(struct ath_hal *ah, const struct ieee80211_channel *chan)
HAL_BOOL ar5212SetTxPowerLimit(struct ath_hal *ah, uint32_t limit)
static HAL_BOOL ar5212SetRateTable(struct ath_hal *, const struct ieee80211_channel *, int16_t tpcScaleReduction, int16_t powerLimit, HAL_BOOL commit, int16_t *minPower, int16_t *maxPower)
HAL_BOOL ar5212PerCalibration(struct ath_hal *ah, struct ieee80211_channel *chan, HAL_BOOL *isIQdone)
#define AR_PHY_BIS(_ah, _reg, _mask, _val)
#define CHAN_TO_SPUR(_f, _freq)
void ar5212ModifyRfBuffer(uint32_t *rfBuf, uint32_t reg32, uint32_t numBits, uint32_t firstBit, uint32_t column)
void ar5212SetOperatingMode(struct ath_hal *ah, int opmode)
HAL_BOOL ar5212ChannelChange(struct ath_hal *, const struct ieee80211_channel *)
static HAL_BOOL ar5212MacStop(struct ath_hal *ah)
void ar5212SetRateDurationTable(struct ath_hal *, const struct ieee80211_channel *)
static HAL_BOOL getNoiseFloorThresh(struct ath_hal *ah, const struct ieee80211_channel *chan, int16_t *nft)
static uint16_t interpolate(uint16_t target, uint16_t srcLeft, uint16_t srcRight, uint16_t targetLeft, uint16_t targetRight)
#define CB22_FALSE_DETECT_BACKOFF
static uint16_t ar5212GetMaxEdgePower(uint16_t channel, const RD_EDGES_POWER *pRdEdgesPower)
void ar5212SetIFSTiming(struct ath_hal *, const struct ieee80211_channel *)
static void ar5212CorrectGainDelta(struct ath_hal *, int twiceOfdmCckDelta)
#define INIT_CLOCKMHZSCALED
#define ANT_SWITCH_TABLE2
void ar5212SetCompRegs(struct ath_hal *ah)
#define ANT_SWITCH_TABLE1
HAL_BOOL ar5212SetChannel(struct ath_hal *ah, const struct ieee80211_channel *chan)
void ar5212InitNfCalHistBuffer(struct ath_hal *ah)
HAL_BOOL ar5212GetChipPowerLimits(struct ath_hal *ah, struct ieee80211_channel *chan)
void ar5212GetLowerUpperValues(uint16_t value, uint16_t *pList, uint16_t listSize, uint16_t *pLowerValue, uint16_t *pUpperValue)
HAL_BOOL ar5212Disable(struct ath_hal *ah)
#define TX_QUEUEPEND_CHECK
int16_t ar5212GetNfHistMid(const int16_t calData[AR512_NF_CAL_HIST_MAX])
HAL_BOOL ar5212PerCalibrationN(struct ath_hal *ah, struct ieee80211_channel *chan, u_int chainMask, HAL_BOOL longCal, HAL_BOOL *isCalDone)
#define IS_NO_RESET_TIMER_ADDR(x)
HAL_BOOL ar5212ChipReset(struct ath_hal *ah, const struct ieee80211_channel *chan)
#define NO_FALSE_DETECT_BACKOFF
static void ar5212GetTargetPowers(struct ath_hal *, const struct ieee80211_channel *, const TRGT_POWER_INFO *pPowerInfo, uint16_t numChannels, TRGT_POWER_INFO *pNewPower)
static int write_common(struct ath_hal *ah, const HAL_INI_ARRAY *ia, HAL_BOOL bChannelChange, int writes)
static HAL_BOOL ar5212SetResetReg(struct ath_hal *, uint32_t resetMask)
HAL_BOOL ar5212SetTransmitPower(struct ath_hal *ah, const struct ieee80211_channel *chan, uint16_t *rfXpdGain)
#define IS_DISABLE_FAST_ADC_CHAN(x)
HAL_BOOL ar5212PhyDisable(struct ath_hal *ah)
HAL_BOOL ar5212SetAntennaSwitchInternal(struct ath_hal *ah, HAL_ANT_SETTING settings, const struct ieee80211_channel *chan)
HAL_BOOL ar5212SetBoardValues(struct ath_hal *, const struct ieee80211_channel *)
HAL_BOOL ar5212IsSpurChannel(struct ath_hal *, const struct ieee80211_channel *)
HAL_BOOL ar5212Reset(struct ath_hal *ah, HAL_OPMODE opmode, struct ieee80211_channel *chan, HAL_BOOL bChannelChange, HAL_RESET_TYPE resetType, HAL_STATUS *status)
void ar5212SetDeltaSlope(struct ath_hal *, const struct ieee80211_channel *)
#define AR_PHY_ADC_CTL_OFF_INBUFGAIN
#define AR_PHY_MODE_DYNAMIC
#define AR_PHY_DESIRED_SZ_PGA
#define AR_PHY_POWER_TX_RATE3
#define AR_PHY_CHIP_ID_REV_3
#define AR_PHY_POWER_TX_RATE_MAX_TPC_ENABLE
#define AR_PHY_ADC_CTL_OFF_PWDADC
#define AR_PHY_HEAVY_CLIP_ENABLE
#define AR_PHY_CCK_DETECT
#define AR_PHY_SETTLING_SWITCH
#define AR_PHY_TIMING_CTRL4_ENABLE_CHAN_MASK
#define AR_PHY_BIN_MASK2_4_MASK_4
#define AR_PHY_RX_DELAY_DELAY
#define AR_PHY_BIN_MASK2_2
#define AR_PHY_TIMING11_SPUR_FREQ_SD
#define AR_PHY_TIMING_CTRL4_ENABLE_SPUR_FILTER
#define AR_PHY_MODE_QUARTER
#define AR_PHY_PLL_CTL_QUARTER
#define AR_PHY_RFBUS_REQ_REQUEST
#define AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF
#define AR_PHY_DAG_CTRLCCK
#define AR_PHY_PLL_CTL_44_5112
#define AR_PHY_TXPWRADJ_CCK_GAIN_DELTA
#define AR_PHY_TXPWRADJ_CCK_PCDAC_INDEX
#define AR_PHY_RXGAIN_TXRX_ATTEN
#define AR_PHY_POWER_TX_RATE4
#define AR_PHY_BIN_MASK2_3
#define AR_PHY_TIMING3_DSC_MAN
#define AR_PHY_MODE_AR5111
#define AR_PHY_TIMING10_PILOT_MASK_2
#define AR_PHY_BIN_MASK_1
#define AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF
#define AR_PHY_BIN_MASK2_4
#define AR_PHY_DESIRED_SZ_ADC
#define AR_PHY_TIMING8_PILOT_MASK_2
#define AR_PHY_TIMING11_USE_SPUR_IN_AGC
#define AR_PHY_MODE_RF5GHZ
#define AR_PHY_BIN_MASK2_1
#define AR_PHY_PCDAC_TX_POWER(_n)
#define AR_PHY_PLL_CTL_40_5112
#define AR_PHY_CCK_DETECT_BB_ENABLE_ANT_FAST_DIV
#define AR_PHY_MODE_RF2GHZ
#define AR_PHY_GAIN_2GHZ_RXTX_MARGIN
#define AR_PHY_TESTCTRL_TXHOLD
#define AR_PHY_CHIP_ID_REV_2
#define AR_PHY_TX_FRAME_TO_TX_DATA_START
#define AR_PHY_DAG_CTRLCCK_RSSI_THR
#define AR_PHY_AGC_CONTROL_ENABLE_NF
#define AR_PHY_BIN_MASK_3
#define AR_PHY_PLL_CTL_40_5413
#define AR_PHY_ADC_CTL_ON_INBUFGAIN
#define AR_PHY_MASK_CTL_RATE
#define AR_PHY_TIMING_CTRL4_ENABLE_PILOT_MASK
#define AR_PHY_DESIRED_SZ
#define AR_PHY_SLEEP_SCAL
#define AR_PHY_PLL_CTL_HALF
#define AR_PHY_FRAME_CTL_WINLEN
#define AR_PHY_BIN_MASK_2
#define AR_PHY_CHIP_ID_REV_4
#define AR_PHY_MASK_CTL_MASK_4
#define AR_PHY_DAG_CTRLCCK_EN_RSSI_THR
#define AR_PHY_TIMING_CTRL4_IQCAL_LOG_COUNT_MAX
#define AR_PHY_AGC_CONTROL_NO_UPDATE_NF
#define AR_PHY_TIMING11_SPUR_DELTA_PHASE
#define AR_PHY_TIMING3_DSC_EXP
#define AR_PHY_ADC_CTL_OFF_PWDDAC
#define AR_PHY_MODE_AR5112
#define AR_CCUCFG_RESET_VAL
#define AR_NOACK_2BIT_VALUE
#define AR_COMPRESSION_WINDOW_SIZE
#define AR_CCFG_MIB_INT_EN
#define AR5212_USEC_TX_LAT_S
#define AR_NOACK_BIT_OFFSET
#define AR_STA_ID1_USE_DEFANT
#define AR_NOACK_BYTE_OFFSET
#define AR_RATE_DURATION(_n)
#define AR_SREV_VERSION_VENICE
#define AR_Q_STS_PEND_FR_CNT
#define AR_SREV_GRIFFIN_LITE
#define AR5212_USEC_RX_LAT_S
#define AR_STA_ID1_KSRCH_MODE
#define AR_CCUCFG_CATCHUP_EN
const GAIN_OPTIMIZATION_STEP * currStep
uint16_t ee_rxtxMarginTurbo[2]
uint8_t ee_cckOfdmPwrDelta
RD_EDGES_POWER ee_rdEdgesPower[NUM_EDGES *NUM_CTLS_MAX]
int8_t ee_pgaDesiredSize[3]
uint16_t ee_antennaControl[11][3]
uint16_t ee_rxtxMargin[3]
uint16_t ee_txFrameToXPAOn[3]
uint16_t ee_xrTargetPower5
uint16_t ee_switchSettling[3]
int16_t ee_noiseFloorThresh[3]
uint16_t ee_switchSettlingTurbo[2]
uint16_t ee_scaledCh14FilterCckDelta
uint16_t ee_turbo2WMaxPower5
uint16_t ee_turbo2WMaxPower2
uint16_t ee_cckOfdmGainDelta
uint16_t ee_txEndToXLNAOn[3]
uint16_t ee_xrTargetPower2
uint16_t ee_txrxAttenTurbo[2]
int8_t ee_adcDesiredSize[3]
uint16_t ee_txEndToXPAOff[3]
uint16_t ee_falseDetectBackoff[3]
int8_t ee_adcDesiredSizeTurbo[2]
uint16_t ee_ctl[NUM_CTLS_MAX]
int8_t ee_pgaDesiredSizeTurbo[2]
struct HAL_RATE_TABLE::@3 info[64]
uint16_t twice_rdEdgePower
HAL_BOOL(* getChannelMaxMinPower)(struct ath_hal *ah, const struct ieee80211_channel *, int16_t *maxPow, int16_t *minPow)
HAL_BOOL(* setRfRegs)(struct ath_hal *, const struct ieee80211_channel *, uint16_t modesIndex, uint16_t *rfXpdGain)
HAL_BOOL(* setPowerTable)(struct ath_hal *ah, int16_t *minPower, int16_t *maxPower, const struct ieee80211_channel *, uint16_t *rfXpdGain)
HAL_BOOL(* setChannel)(struct ath_hal *, const struct ieee80211_channel *)
void(* writeRegs)(struct ath_hal *, u_int modeIndex, u_int freqIndex, int regWrites)
int16_t nfCalBuffer[AR512_NF_CAL_HIST_MAX]
GAIN_VALUES ah_gainValues
HAL_ANT_SETTING ah_antControl
HAL_INI_ARRAY ah_ini_common
int16_t ah_txPowerIndexOffset
struct ar5212NfCalHist ah_nfCalHist
uint8_t ah_bssidmask[IEEE80211_ADDR_LEN]
enum ath_hal_5212::@22 ah_bIQCalibration
uint32_t ah_tx6PowerInHalfDbm
uint32_t ah_staId1Defaults
uint8_t ah_macaddr[IEEE80211_ADDR_LEN]
uint8_t ah_bssid[IEEE80211_ADDR_LEN]
uint16_t ah_ratesArray[37]
uint8_t ah_decompMask[HAL_DECOMP_MASK_SIZE]
HAL_INI_ARRAY ah_ini_modes