1 /******************************************************************************
2 * Copyright(c) 2008 - 2010 Realtek Corporation. All rights reserved.
4 * This program is distributed in the hope that it will be useful, but WITHOUT
5 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
6 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
9 * You should have received a copy of the GNU General Public License along with
10 * this program; if not, write to the Free Software Foundation, Inc.,
11 * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
13 * The full GNU General Public License is included in this distribution in the
14 * file called LICENSE.
16 * Contact Information:
17 * wlanfae <wlanfae@realtek.com>
18 ******************************************************************************/
19 #ifndef __R8192UDM_H__
20 #define __R8192UDM_H__
23 /*--------------------------Define Parameters-------------------------------*/
24 #define OFDM_Table_Length 19
25 #define CCK_Table_length 12
27 #define DM_DIG_THRESH_HIGH 40
28 #define DM_DIG_THRESH_LOW 35
30 #define DM_DIG_HIGH_PWR_THRESH_HIGH 75
31 #define DM_DIG_HIGH_PWR_THRESH_LOW 70
33 #define BW_AUTO_SWITCH_HIGH_LOW 25
34 #define BW_AUTO_SWITCH_LOW_HIGH 30
36 #define DM_DIG_BACKOFF 12
37 #define DM_DIG_MAX 0x36
38 #define DM_DIG_MIN 0x1c
39 #define DM_DIG_MIN_Netcore 0x12
41 #define RxPathSelection_SS_TH_low 30
42 #define RxPathSelection_diff_TH 18
44 #define RateAdaptiveTH_High 50
45 #define RateAdaptiveTH_Low_20M 30
46 #define RateAdaptiveTH_Low_40M 10
47 #define VeryLowRSSI 15
51 #define E_FOR_TX_POWER_TRACK 300
52 #define TX_POWER_NEAR_FIELD_THRESH_HIGH 68
53 #define TX_POWER_NEAR_FIELD_THRESH_LOW 62
54 #define TX_POWER_ATHEROAP_THRESH_HIGH 78
55 #define TX_POWER_ATHEROAP_THRESH_LOW 72
57 #define Current_Tx_Rate_Reg 0x1e0
58 #define Initial_Tx_Rate_Reg 0x1e1
59 #define Tx_Retry_Count_Reg 0x1ac
62 #define DM_Type_ByDriver 1
64 /*--------------------------Define Parameters-------------------------------*/
67 /*------------------------------Define structure----------------------------*/
71 u8 dig_algorithm_switch;
74 long rssi_high_thresh;
76 long rssi_high_power_lowthresh;
77 long rssi_high_power_highthresh;
81 u8 CurSTAConnectState;
82 u8 PreSTAConnectState;
107 DM_RATR_STA_HIGH = 0,
108 DM_RATR_STA_MIDDLE = 1,
114 DIG_ALGO_BY_FALSE_ALARM = 0,
115 DIG_ALGO_BY_RSSI = 1,
116 DIG_ALGO_BEFORE_CONNECT_BY_RSSI_AND_ALARM = 2,
117 DIG_ALGO_BY_TOW_PORT = 3,
121 enum dm_dig_connect {
122 DIG_STA_DISCONNECT = 0,
124 DIG_STA_BEFORE_CONNECT = 2,
125 DIG_AP_DISCONNECT = 3,
127 DIG_AP_ADD_STATION = 5,
132 DIG_PD_AT_LOW_POWER = 0,
133 DIG_PD_AT_NORMAL_POWER = 1,
134 DIG_PD_AT_HIGH_POWER = 2,
138 enum dm_dig_cs_ratio {
139 DIG_CS_RATIO_LOWER = 0,
140 DIG_CS_RATIO_HIGHER = 1,
144 struct drx_path_sel {
155 u8 rf_enable_rssi_th[4];
156 long cck_pwdb_sta[4];
159 enum dm_cck_rx_path_method {
160 CCK_Rx_Version_1 = 0,
161 CCK_Rx_Version_2 = 1,
171 /*------------------------------Define structure----------------------------*/
174 /*------------------------Export global variable----------------------------*/
175 extern struct dig_t dm_digtable;
176 extern struct drx_path_sel DM_RxPathSelTable;
178 /* Pre-calculated gain tables */
179 extern const u32 dm_tx_bb_gain[TxBBGainTableLength];
180 extern const u8 dm_cck_tx_bb_gain[CCKTxBBGainTableLength][8];
181 extern const u8 dm_cck_tx_bb_gain_ch14[CCKTxBBGainTableLength][8];
182 /* Maps table index to iq amplify gain (dB, 12 to -24dB) */
183 #define dm_tx_bb_gain_idx_to_amplify(idx) (-idx + 12)
185 /*------------------------Export global variable----------------------------*/
188 /*--------------------------Exported Function prototype---------------------*/
189 /*--------------------------Exported Function prototype---------------------*/
191 void rtl92e_dm_init(struct net_device *dev);
192 void rtl92e_dm_deinit(struct net_device *dev);
194 void rtl92e_dm_watchdog(struct net_device *dev);
197 void rtl92e_init_adaptive_rate(struct net_device *dev);
198 void rtl92e_dm_txpower_tracking_wq(void *data);
200 void rtl92e_dm_cck_txpower_adjust(struct net_device *dev, bool binch14);
202 void rtl92e_dm_restore_state(struct net_device *dev);
203 void rtl92e_dm_backup_state(struct net_device *dev);
204 void rtl92e_dm_init_edca_turbo(struct net_device *dev);
205 void rtl92e_dm_rf_pathcheck_wq(void *data);
206 void rtl92e_dm_init_txpower_tracking(struct net_device *dev);
207 #endif /*__R8192UDM_H__ */