GUI: Fix Tomato RAF theme for all builds. Compilation typo.
[tomato.git] / release / src-rt-6.x.4708 / linux / linux-2.6.36 / drivers / net / wireless / ath / ath5k / ani.h
blob55cf26d8522c7d78c1bffe4b7dddb3bb85913317
1 /*
2 * Copyright (C) 2010 Bruno Randolf <br1@einfach.org>
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.
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.
16 #ifndef ANI_H
17 #define ANI_H
19 /* these thresholds are relative to the ATH5K_ANI_LISTEN_PERIOD */
20 #define ATH5K_ANI_LISTEN_PERIOD 100
21 #define ATH5K_ANI_OFDM_TRIG_HIGH 500
22 #define ATH5K_ANI_OFDM_TRIG_LOW 200
23 #define ATH5K_ANI_CCK_TRIG_HIGH 200
24 #define ATH5K_ANI_CCK_TRIG_LOW 100
26 /* average beacon RSSI thresholds */
27 #define ATH5K_ANI_RSSI_THR_HIGH 40
28 #define ATH5K_ANI_RSSI_THR_LOW 7
30 /* maximum availabe levels */
31 #define ATH5K_ANI_MAX_FIRSTEP_LVL 2
32 #define ATH5K_ANI_MAX_NOISE_IMM_LVL 1
35 /**
36 * enum ath5k_ani_mode - mode for ANI / noise sensitivity
38 * @ATH5K_ANI_MODE_OFF: Turn ANI off. This can be useful to just stop the ANI
39 * algorithm after it has been on auto mode.
40 * ATH5K_ANI_MODE_MANUAL_LOW: Manually set all immunity parameters to low,
41 * maximizing sensitivity. ANI will not run.
42 * ATH5K_ANI_MODE_MANUAL_HIGH: Manually set all immunity parameters to high,
43 * minimizing sensitivity. ANI will not run.
44 * ATH5K_ANI_MODE_AUTO: Automatically control immunity parameters based on the
45 * amount of OFDM and CCK frame errors (default).
47 enum ath5k_ani_mode {
48 ATH5K_ANI_MODE_OFF = 0,
49 ATH5K_ANI_MODE_MANUAL_LOW = 1,
50 ATH5K_ANI_MODE_MANUAL_HIGH = 2,
51 ATH5K_ANI_MODE_AUTO = 3
55 /**
56 * struct ath5k_ani_state - ANI state and associated counters
58 * @max_spur_level: the maximum spur level is chip dependent
60 struct ath5k_ani_state {
61 enum ath5k_ani_mode ani_mode;
63 /* state */
64 int noise_imm_level;
65 int spur_level;
66 int firstep_level;
67 bool ofdm_weak_sig;
68 bool cck_weak_sig;
70 int max_spur_level;
72 /* used by the algorithm */
73 unsigned int listen_time;
74 unsigned int ofdm_errors;
75 unsigned int cck_errors;
77 /* debug/statistics only: numbers from last ANI calibration */
78 unsigned int pfc_tx;
79 unsigned int pfc_rx;
80 unsigned int pfc_busy;
81 unsigned int pfc_cycles;
82 unsigned int last_listen;
83 unsigned int last_ofdm_errors;
84 unsigned int last_cck_errors;
85 unsigned int sum_ofdm_errors;
86 unsigned int sum_cck_errors;
89 void ath5k_ani_init(struct ath5k_hw *ah, enum ath5k_ani_mode mode);
90 void ath5k_ani_mib_intr(struct ath5k_hw *ah);
91 void ath5k_ani_calibration(struct ath5k_hw *ah);
92 void ath5k_ani_phy_error_report(struct ath5k_hw *ah,
93 enum ath5k_phy_error_code phyerr);
95 /* for manual control */
96 void ath5k_ani_set_noise_immunity_level(struct ath5k_hw *ah, int level);
97 void ath5k_ani_set_spur_immunity_level(struct ath5k_hw *ah, int level);
98 void ath5k_ani_set_firstep_level(struct ath5k_hw *ah, int level);
99 void ath5k_ani_set_ofdm_weak_signal_detection(struct ath5k_hw *ah, bool on);
100 void ath5k_ani_set_cck_weak_signal_detection(struct ath5k_hw *ah, bool on);
102 void ath5k_ani_print_counters(struct ath5k_hw *ah);
104 #endif /* ANI_H */