ani.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. /*
  2. * Copyright (c) 2008-2011 Atheros Communications Inc.
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for any
  5. * purpose with or without fee is hereby granted, provided that the above
  6. * copyright notice and this permission notice appear in all copies.
  7. *
  8. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  9. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  10. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  11. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  12. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  13. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  14. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. #ifndef ANI_H
  17. #define ANI_H
  18. #define BEACON_RSSI(ahp) (ahp->stats.avgbrssi)
  19. /* units are errors per second */
  20. #define ATH9K_ANI_OFDM_TRIG_HIGH 3500
  21. #define ATH9K_ANI_OFDM_TRIG_HIGH_BELOW_INI 1000
  22. #define ATH9K_ANI_OFDM_TRIG_HIGH_OLD 500
  23. #define ATH9K_ANI_OFDM_TRIG_LOW 400
  24. #define ATH9K_ANI_OFDM_TRIG_LOW_ABOVE_INI 900
  25. #define ATH9K_ANI_OFDM_TRIG_LOW_OLD 200
  26. #define ATH9K_ANI_CCK_TRIG_HIGH 600
  27. #define ATH9K_ANI_CCK_TRIG_HIGH_OLD 200
  28. #define ATH9K_ANI_CCK_TRIG_LOW 300
  29. #define ATH9K_ANI_CCK_TRIG_LOW_OLD 100
  30. #define ATH9K_ANI_SPUR_IMMUNE_LVL 3
  31. #define ATH9K_ANI_FIRSTEP_LVL 2
  32. #define ATH9K_ANI_RSSI_THR_HIGH 40
  33. #define ATH9K_ANI_RSSI_THR_LOW 7
  34. #define ATH9K_ANI_PERIOD 300
  35. /* in ms */
  36. #define ATH9K_ANI_POLLINTERVAL 1000
  37. #define ATH9K_SIG_FIRSTEP_SETTING_MIN 0
  38. #define ATH9K_SIG_FIRSTEP_SETTING_MAX 20
  39. #define ATH9K_SIG_SPUR_IMM_SETTING_MIN 0
  40. #define ATH9K_SIG_SPUR_IMM_SETTING_MAX 22
  41. /* values here are relative to the INI */
  42. enum ath9k_ani_cmd {
  43. ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION = 0x1,
  44. ATH9K_ANI_FIRSTEP_LEVEL = 0x2,
  45. ATH9K_ANI_SPUR_IMMUNITY_LEVEL = 0x4,
  46. ATH9K_ANI_MRC_CCK = 0x8,
  47. ATH9K_ANI_ALL = 0xfff
  48. };
  49. struct ath9k_mib_stats {
  50. u32 ackrcv_bad;
  51. u32 rts_bad;
  52. u32 rts_good;
  53. u32 fcs_bad;
  54. u32 beacons;
  55. };
  56. /* INI default values for ANI registers */
  57. struct ath9k_ani_default {
  58. u16 m1ThreshLow;
  59. u16 m2ThreshLow;
  60. u16 m1Thresh;
  61. u16 m2Thresh;
  62. u16 m2CountThr;
  63. u16 m2CountThrLow;
  64. u16 m1ThreshLowExt;
  65. u16 m2ThreshLowExt;
  66. u16 m1ThreshExt;
  67. u16 m2ThreshExt;
  68. u16 firstep;
  69. u16 firstepLow;
  70. u16 cycpwrThr1;
  71. u16 cycpwrThr1Ext;
  72. };
  73. struct ar5416AniState {
  74. u8 noiseImmunityLevel;
  75. u8 ofdmNoiseImmunityLevel;
  76. u8 cckNoiseImmunityLevel;
  77. bool ofdmsTurn;
  78. u8 mrcCCK;
  79. u8 spurImmunityLevel;
  80. u8 firstepLevel;
  81. bool ofdmWeakSigDetect;
  82. u32 listenTime;
  83. u32 ofdmPhyErrCount;
  84. u32 cckPhyErrCount;
  85. struct ath9k_ani_default iniDef;
  86. };
  87. struct ar5416Stats {
  88. u32 ast_ani_spurup;
  89. u32 ast_ani_spurdown;
  90. u32 ast_ani_ofdmon;
  91. u32 ast_ani_ofdmoff;
  92. u32 ast_ani_cckhigh;
  93. u32 ast_ani_ccklow;
  94. u32 ast_ani_stepup;
  95. u32 ast_ani_stepdown;
  96. u32 ast_ani_ofdmerrs;
  97. u32 ast_ani_cckerrs;
  98. u32 ast_ani_reset;
  99. u32 ast_ani_lneg_or_lzero;
  100. u32 avgbrssi;
  101. struct ath9k_mib_stats ast_mibstats;
  102. };
  103. #define ah_mibStats stats.ast_mibstats
  104. void ath9k_enable_mib_counters(struct ath_hw *ah);
  105. void ath9k_hw_disable_mib_counters(struct ath_hw *ah);
  106. void ath9k_hw_ani_init(struct ath_hw *ah);
  107. #endif /* ANI_H */