Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Copyright (c) 2008-2011 Atheros Communications Inc.
0003  *
0004  * Permission to use, copy, modify, and/or distribute this software for any
0005  * purpose with or without fee is hereby granted, provided that the above
0006  * copyright notice and this permission notice appear in all copies.
0007  *
0008  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
0009  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
0010  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
0011  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
0012  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
0013  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
0014  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
0015  */
0016 
0017 #ifndef ANI_H
0018 #define ANI_H
0019 
0020 #define BEACON_RSSI(ahp) (ahp->stats.avgbrssi)
0021 
0022 /* units are errors per second */
0023 #define ATH9K_ANI_OFDM_TRIG_HIGH           3500
0024 #define ATH9K_ANI_OFDM_TRIG_HIGH_BELOW_INI 1000
0025 #define ATH9K_ANI_OFDM_TRIG_HIGH_OLD       500
0026 
0027 #define ATH9K_ANI_OFDM_TRIG_LOW           400
0028 #define ATH9K_ANI_OFDM_TRIG_LOW_ABOVE_INI 900
0029 #define ATH9K_ANI_OFDM_TRIG_LOW_OLD       200
0030 
0031 #define ATH9K_ANI_CCK_TRIG_HIGH           600
0032 #define ATH9K_ANI_CCK_TRIG_HIGH_OLD       200
0033 #define ATH9K_ANI_CCK_TRIG_LOW            300
0034 #define ATH9K_ANI_CCK_TRIG_LOW_OLD        100
0035 
0036 #define ATH9K_ANI_SPUR_IMMUNE_LVL         3
0037 #define ATH9K_ANI_FIRSTEP_LVL             2
0038 
0039 #define ATH9K_ANI_RSSI_THR_HIGH           40
0040 #define ATH9K_ANI_RSSI_THR_LOW            7
0041 
0042 #define ATH9K_ANI_PERIOD                  300
0043 
0044 /* in ms */
0045 #define ATH9K_ANI_POLLINTERVAL            1000
0046 
0047 #define ATH9K_SIG_FIRSTEP_SETTING_MIN     0
0048 #define ATH9K_SIG_FIRSTEP_SETTING_MAX     20
0049 #define ATH9K_SIG_SPUR_IMM_SETTING_MIN    0
0050 #define ATH9K_SIG_SPUR_IMM_SETTING_MAX    22
0051 
0052 /* values here are relative to the INI */
0053 
0054 enum ath9k_ani_cmd {
0055     ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION = 0x1,
0056     ATH9K_ANI_FIRSTEP_LEVEL = 0x2,
0057     ATH9K_ANI_SPUR_IMMUNITY_LEVEL = 0x4,
0058     ATH9K_ANI_MRC_CCK = 0x8,
0059     ATH9K_ANI_ALL = 0xfff
0060 };
0061 
0062 struct ath9k_mib_stats {
0063     u32 ackrcv_bad;
0064     u32 rts_bad;
0065     u32 rts_good;
0066     u32 fcs_bad;
0067     u32 beacons;
0068 };
0069 
0070 /* INI default values for ANI registers */
0071 struct ath9k_ani_default {
0072     u16 m1ThreshLow;
0073     u16 m2ThreshLow;
0074     u16 m1Thresh;
0075     u16 m2Thresh;
0076     u16 m2CountThr;
0077     u16 m2CountThrLow;
0078     u16 m1ThreshLowExt;
0079     u16 m2ThreshLowExt;
0080     u16 m1ThreshExt;
0081     u16 m2ThreshExt;
0082     u16 firstep;
0083     u16 firstepLow;
0084     u16 cycpwrThr1;
0085     u16 cycpwrThr1Ext;
0086 };
0087 
0088 struct ar5416AniState {
0089     u8 noiseImmunityLevel;
0090     u8 ofdmNoiseImmunityLevel;
0091     u8 cckNoiseImmunityLevel;
0092     bool ofdmsTurn;
0093     u8 mrcCCK;
0094     u8 spurImmunityLevel;
0095     u8 firstepLevel;
0096     bool ofdmWeakSigDetect;
0097     u32 listenTime;
0098     u32 ofdmPhyErrCount;
0099     u32 cckPhyErrCount;
0100     struct ath9k_ani_default iniDef;
0101 };
0102 
0103 struct ar5416Stats {
0104     u32 ast_ani_spurup;
0105     u32 ast_ani_spurdown;
0106     u32 ast_ani_ofdmon;
0107     u32 ast_ani_ofdmoff;
0108     u32 ast_ani_cckhigh;
0109     u32 ast_ani_ccklow;
0110     u32 ast_ani_stepup;
0111     u32 ast_ani_stepdown;
0112     u32 ast_ani_ofdmerrs;
0113     u32 ast_ani_cckerrs;
0114     u32 ast_ani_reset;
0115     u32 ast_ani_lneg_or_lzero;
0116     u32 avgbrssi;
0117     struct ath9k_mib_stats ast_mibstats;
0118 };
0119 #define ah_mibStats stats.ast_mibstats
0120 
0121 void ath9k_enable_mib_counters(struct ath_hw *ah);
0122 void ath9k_hw_disable_mib_counters(struct ath_hw *ah);
0123 void ath9k_hw_ani_init(struct ath_hw *ah);
0124 
0125 #endif /* ANI_H */