2009-02-09 13:26:54 +05:30
/*
2011-05-17 13:36:18 +05:30
* Copyright ( c ) 2008 - 2011 Atheros Communications Inc .
2009-02-09 13:26:54 +05:30
*
* Permission to use , copy , modify , and / or distribute this software for any
* purpose with or without fee is hereby granted , provided that the above
* copyright notice and this permission notice appear in all copies .
*
* THE SOFTWARE IS PROVIDED " AS IS " AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS . IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL , DIRECT , INDIRECT , OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE , DATA OR PROFITS , WHETHER IN AN
* ACTION OF CONTRACT , NEGLIGENCE OR OTHER TORTIOUS ACTION , ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE .
*/
# ifndef ANI_H
# define ANI_H
2009-08-19 16:23:40 +05:30
# define BEACON_RSSI(ahp) (ahp->stats.avgbrssi)
2009-02-09 13:26:54 +05:30
2010-06-12 00:33:45 -04:00
/* units are errors per second */
2013-06-17 14:24:36 +05:30
# define ATH9K_ANI_OFDM_TRIG_HIGH 3500
# define ATH9K_ANI_OFDM_TRIG_HIGH_BELOW_INI 1000
2012-06-15 15:25:24 +02:00
# define ATH9K_ANI_OFDM_TRIG_LOW 400
2013-06-17 14:24:36 +05:30
# define ATH9K_ANI_OFDM_TRIG_LOW_ABOVE_INI 900
2012-06-15 15:25:24 +02:00
# define ATH9K_ANI_CCK_TRIG_HIGH 600
# define ATH9K_ANI_CCK_TRIG_LOW 300
2010-06-12 00:33:45 -04:00
2012-06-15 15:25:24 +02:00
# define ATH9K_ANI_SPUR_IMMUNE_LVL 3
# define ATH9K_ANI_FIRSTEP_LVL 2
2010-06-12 00:33:45 -04:00
2009-02-09 13:26:54 +05:30
# define ATH9K_ANI_RSSI_THR_HIGH 40
# define ATH9K_ANI_RSSI_THR_LOW 7
2010-06-12 00:33:45 -04:00
2012-06-15 15:25:24 +02:00
# define ATH9K_ANI_PERIOD 300
2010-06-12 00:33:45 -04:00
/* in ms */
2012-06-15 15:25:24 +02:00
# define ATH9K_ANI_POLLINTERVAL 1000
2009-02-09 13:26:54 +05:30
2010-06-12 00:33:45 -04:00
# define ATH9K_SIG_FIRSTEP_SETTING_MIN 0
# define ATH9K_SIG_FIRSTEP_SETTING_MAX 20
# define ATH9K_SIG_SPUR_IMM_SETTING_MIN 0
# define ATH9K_SIG_SPUR_IMM_SETTING_MAX 22
/* values here are relative to the INI */
2009-02-09 13:26:54 +05:30
enum ath9k_ani_cmd {
ATH9K_ANI_PRESENT = 0x1 ,
ATH9K_ANI_NOISE_IMMUNITY_LEVEL = 0x2 ,
ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION = 0x4 ,
ATH9K_ANI_CCK_WEAK_SIGNAL_THR = 0x8 ,
ATH9K_ANI_FIRSTEP_LEVEL = 0x10 ,
ATH9K_ANI_SPUR_IMMUNITY_LEVEL = 0x20 ,
ATH9K_ANI_MODE = 0x40 ,
ATH9K_ANI_PHYERR_RESET = 0x80 ,
2010-06-12 00:33:45 -04:00
ATH9K_ANI_MRC_CCK = 0x100 ,
ATH9K_ANI_ALL = 0xfff
2009-02-09 13:26:54 +05:30
} ;
struct ath9k_mib_stats {
u32 ackrcv_bad ;
u32 rts_bad ;
u32 rts_good ;
u32 fcs_bad ;
u32 beacons ;
} ;
2010-06-12 00:33:45 -04:00
/* INI default values for ANI registers */
struct ath9k_ani_default {
u16 m1ThreshLow ;
u16 m2ThreshLow ;
u16 m1Thresh ;
u16 m2Thresh ;
u16 m2CountThr ;
u16 m2CountThrLow ;
u16 m1ThreshLowExt ;
u16 m2ThreshLowExt ;
u16 m1ThreshExt ;
u16 m2ThreshExt ;
u16 firstep ;
u16 firstepLow ;
u16 cycpwrThr1 ;
u16 cycpwrThr1Ext ;
} ;
2009-02-09 13:29:49 +05:30
struct ar5416AniState {
u8 noiseImmunityLevel ;
2010-06-12 00:33:45 -04:00
u8 ofdmNoiseImmunityLevel ;
u8 cckNoiseImmunityLevel ;
bool ofdmsTurn ;
2012-06-21 20:33:59 +05:30
u8 mrcCCK ;
2009-02-09 13:29:49 +05:30
u8 spurImmunityLevel ;
u8 firstepLevel ;
2013-06-03 09:19:27 +05:30
bool ofdmWeakSigDetect ;
2009-02-09 13:29:49 +05:30
u32 listenTime ;
u32 ofdmPhyErrCount ;
u32 cckPhyErrCount ;
2010-06-12 00:33:45 -04:00
struct ath9k_ani_default iniDef ;
2009-02-09 13:29:49 +05:30
} ;
2009-02-09 13:26:54 +05:30
struct ar5416Stats {
u32 ast_ani_spurup ;
u32 ast_ani_spurdown ;
u32 ast_ani_ofdmon ;
u32 ast_ani_ofdmoff ;
u32 ast_ani_cckhigh ;
u32 ast_ani_ccklow ;
u32 ast_ani_stepup ;
u32 ast_ani_stepdown ;
u32 ast_ani_ofdmerrs ;
u32 ast_ani_cckerrs ;
u32 ast_ani_reset ;
2011-08-26 11:19:57 +05:30
u32 ast_ani_lneg_or_lzero ;
2009-08-19 16:23:40 +05:30
u32 avgbrssi ;
2009-02-09 13:26:54 +05:30
struct ath9k_mib_stats ast_mibstats ;
} ;
2009-02-09 13:27:26 +05:30
# define ah_mibStats stats.ast_mibstats
2009-02-09 13:26:54 +05:30
2009-02-09 13:27:12 +05:30
void ath9k_enable_mib_counters ( struct ath_hw * ah ) ;
void ath9k_hw_disable_mib_counters ( struct ath_hw * ah ) ;
2009-08-03 12:24:46 -07:00
void ath9k_hw_ani_init ( struct ath_hw * ah ) ;
2009-02-09 13:26:54 +05:30
# endif /* ANI_H */