Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ani.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2010 Bruno Randolf <[email protected]>
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 
19 #include "../ath.h"
20 
22 
23 /* these thresholds are relative to the ATH5K_ANI_LISTEN_PERIOD */
24 #define ATH5K_ANI_LISTEN_PERIOD 100
25 #define ATH5K_ANI_OFDM_TRIG_HIGH 500
26 #define ATH5K_ANI_OFDM_TRIG_LOW 200
27 #define ATH5K_ANI_CCK_TRIG_HIGH 200
28 #define ATH5K_ANI_CCK_TRIG_LOW 100
29 
30 /* average beacon RSSI thresholds */
31 #define ATH5K_ANI_RSSI_THR_HIGH 40
32 #define ATH5K_ANI_RSSI_THR_LOW 7
33 
34 /* maximum available levels */
35 #define ATH5K_ANI_MAX_FIRSTEP_LVL 2
36 #define ATH5K_ANI_MAX_NOISE_IMM_LVL 1
37 
38 
56 };
57 
58 
80 
81  /* state */
87 
89 
90  /* used by the algorithm */
91  unsigned int listen_time;
92  unsigned int ofdm_errors;
93  unsigned int cck_errors;
94 
95  /* debug/statistics only: numbers from last ANI calibration */
97  unsigned int last_listen;
98  unsigned int last_ofdm_errors;
99  unsigned int last_cck_errors;
100  unsigned int sum_ofdm_errors;
101  unsigned int sum_cck_errors;
102 };
103 
104 void ath5k_ani_init(struct ath5k_hw *ah, enum ath5k_ani_mode mode);
105 void ath5k_ani_mib_intr(struct ath5k_hw *ah);
106 void ath5k_ani_calibration(struct ath5k_hw *ah);
108  enum ath5k_phy_error_code phyerr);
109 
110 /* for manual control */
113 void ath5k_ani_set_firstep_level(struct ath5k_hw *ah, int level);
116 
117 void ath5k_ani_print_counters(struct ath5k_hw *ah);
118 
119 #endif /* ANI_H */