18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * Copyright (c) 2008-2011 Atheros Communications Inc. 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * Permission to use, copy, modify, and/or distribute this software for any 58c2ecf20Sopenharmony_ci * purpose with or without fee is hereby granted, provided that the above 68c2ecf20Sopenharmony_ci * copyright notice and this permission notice appear in all copies. 78c2ecf20Sopenharmony_ci * 88c2ecf20Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 98c2ecf20Sopenharmony_ci * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 108c2ecf20Sopenharmony_ci * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 118c2ecf20Sopenharmony_ci * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 128c2ecf20Sopenharmony_ci * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 138c2ecf20Sopenharmony_ci * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 148c2ecf20Sopenharmony_ci * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 158c2ecf20Sopenharmony_ci */ 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ci#ifndef ANI_H 188c2ecf20Sopenharmony_ci#define ANI_H 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci#define BEACON_RSSI(ahp) (ahp->stats.avgbrssi) 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ci/* units are errors per second */ 238c2ecf20Sopenharmony_ci#define ATH9K_ANI_OFDM_TRIG_HIGH 3500 248c2ecf20Sopenharmony_ci#define ATH9K_ANI_OFDM_TRIG_HIGH_BELOW_INI 1000 258c2ecf20Sopenharmony_ci#define ATH9K_ANI_OFDM_TRIG_HIGH_OLD 500 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci#define ATH9K_ANI_OFDM_TRIG_LOW 400 288c2ecf20Sopenharmony_ci#define ATH9K_ANI_OFDM_TRIG_LOW_ABOVE_INI 900 298c2ecf20Sopenharmony_ci#define ATH9K_ANI_OFDM_TRIG_LOW_OLD 200 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ci#define ATH9K_ANI_CCK_TRIG_HIGH 600 328c2ecf20Sopenharmony_ci#define ATH9K_ANI_CCK_TRIG_HIGH_OLD 200 338c2ecf20Sopenharmony_ci#define ATH9K_ANI_CCK_TRIG_LOW 300 348c2ecf20Sopenharmony_ci#define ATH9K_ANI_CCK_TRIG_LOW_OLD 100 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_ci#define ATH9K_ANI_SPUR_IMMUNE_LVL 3 378c2ecf20Sopenharmony_ci#define ATH9K_ANI_FIRSTEP_LVL 2 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_ci#define ATH9K_ANI_RSSI_THR_HIGH 40 408c2ecf20Sopenharmony_ci#define ATH9K_ANI_RSSI_THR_LOW 7 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ci#define ATH9K_ANI_PERIOD 300 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_ci/* in ms */ 458c2ecf20Sopenharmony_ci#define ATH9K_ANI_POLLINTERVAL 1000 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_ci#define ATH9K_SIG_FIRSTEP_SETTING_MIN 0 488c2ecf20Sopenharmony_ci#define ATH9K_SIG_FIRSTEP_SETTING_MAX 20 498c2ecf20Sopenharmony_ci#define ATH9K_SIG_SPUR_IMM_SETTING_MIN 0 508c2ecf20Sopenharmony_ci#define ATH9K_SIG_SPUR_IMM_SETTING_MAX 22 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_ci/* values here are relative to the INI */ 538c2ecf20Sopenharmony_ci 548c2ecf20Sopenharmony_cienum ath9k_ani_cmd { 558c2ecf20Sopenharmony_ci ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION = 0x1, 568c2ecf20Sopenharmony_ci ATH9K_ANI_FIRSTEP_LEVEL = 0x2, 578c2ecf20Sopenharmony_ci ATH9K_ANI_SPUR_IMMUNITY_LEVEL = 0x4, 588c2ecf20Sopenharmony_ci ATH9K_ANI_MRC_CCK = 0x8, 598c2ecf20Sopenharmony_ci ATH9K_ANI_ALL = 0xfff 608c2ecf20Sopenharmony_ci}; 618c2ecf20Sopenharmony_ci 628c2ecf20Sopenharmony_cistruct ath9k_mib_stats { 638c2ecf20Sopenharmony_ci u32 ackrcv_bad; 648c2ecf20Sopenharmony_ci u32 rts_bad; 658c2ecf20Sopenharmony_ci u32 rts_good; 668c2ecf20Sopenharmony_ci u32 fcs_bad; 678c2ecf20Sopenharmony_ci u32 beacons; 688c2ecf20Sopenharmony_ci}; 698c2ecf20Sopenharmony_ci 708c2ecf20Sopenharmony_ci/* INI default values for ANI registers */ 718c2ecf20Sopenharmony_cistruct ath9k_ani_default { 728c2ecf20Sopenharmony_ci u16 m1ThreshLow; 738c2ecf20Sopenharmony_ci u16 m2ThreshLow; 748c2ecf20Sopenharmony_ci u16 m1Thresh; 758c2ecf20Sopenharmony_ci u16 m2Thresh; 768c2ecf20Sopenharmony_ci u16 m2CountThr; 778c2ecf20Sopenharmony_ci u16 m2CountThrLow; 788c2ecf20Sopenharmony_ci u16 m1ThreshLowExt; 798c2ecf20Sopenharmony_ci u16 m2ThreshLowExt; 808c2ecf20Sopenharmony_ci u16 m1ThreshExt; 818c2ecf20Sopenharmony_ci u16 m2ThreshExt; 828c2ecf20Sopenharmony_ci u16 firstep; 838c2ecf20Sopenharmony_ci u16 firstepLow; 848c2ecf20Sopenharmony_ci u16 cycpwrThr1; 858c2ecf20Sopenharmony_ci u16 cycpwrThr1Ext; 868c2ecf20Sopenharmony_ci}; 878c2ecf20Sopenharmony_ci 888c2ecf20Sopenharmony_cistruct ar5416AniState { 898c2ecf20Sopenharmony_ci u8 noiseImmunityLevel; 908c2ecf20Sopenharmony_ci u8 ofdmNoiseImmunityLevel; 918c2ecf20Sopenharmony_ci u8 cckNoiseImmunityLevel; 928c2ecf20Sopenharmony_ci bool ofdmsTurn; 938c2ecf20Sopenharmony_ci u8 mrcCCK; 948c2ecf20Sopenharmony_ci u8 spurImmunityLevel; 958c2ecf20Sopenharmony_ci u8 firstepLevel; 968c2ecf20Sopenharmony_ci bool ofdmWeakSigDetect; 978c2ecf20Sopenharmony_ci u32 listenTime; 988c2ecf20Sopenharmony_ci u32 ofdmPhyErrCount; 998c2ecf20Sopenharmony_ci u32 cckPhyErrCount; 1008c2ecf20Sopenharmony_ci struct ath9k_ani_default iniDef; 1018c2ecf20Sopenharmony_ci}; 1028c2ecf20Sopenharmony_ci 1038c2ecf20Sopenharmony_cistruct ar5416Stats { 1048c2ecf20Sopenharmony_ci u32 ast_ani_spurup; 1058c2ecf20Sopenharmony_ci u32 ast_ani_spurdown; 1068c2ecf20Sopenharmony_ci u32 ast_ani_ofdmon; 1078c2ecf20Sopenharmony_ci u32 ast_ani_ofdmoff; 1088c2ecf20Sopenharmony_ci u32 ast_ani_cckhigh; 1098c2ecf20Sopenharmony_ci u32 ast_ani_ccklow; 1108c2ecf20Sopenharmony_ci u32 ast_ani_stepup; 1118c2ecf20Sopenharmony_ci u32 ast_ani_stepdown; 1128c2ecf20Sopenharmony_ci u32 ast_ani_ofdmerrs; 1138c2ecf20Sopenharmony_ci u32 ast_ani_cckerrs; 1148c2ecf20Sopenharmony_ci u32 ast_ani_reset; 1158c2ecf20Sopenharmony_ci u32 ast_ani_lneg_or_lzero; 1168c2ecf20Sopenharmony_ci u32 avgbrssi; 1178c2ecf20Sopenharmony_ci struct ath9k_mib_stats ast_mibstats; 1188c2ecf20Sopenharmony_ci}; 1198c2ecf20Sopenharmony_ci#define ah_mibStats stats.ast_mibstats 1208c2ecf20Sopenharmony_ci 1218c2ecf20Sopenharmony_civoid ath9k_enable_mib_counters(struct ath_hw *ah); 1228c2ecf20Sopenharmony_civoid ath9k_hw_disable_mib_counters(struct ath_hw *ah); 1238c2ecf20Sopenharmony_civoid ath9k_hw_ani_init(struct ath_hw *ah); 1248c2ecf20Sopenharmony_ci 1258c2ecf20Sopenharmony_ci#endif /* ANI_H */ 126