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 * The full GNU General Public License is included in this distribution in the
10 * file called LICENSE.
12 * Contact Information:
13 * wlanfae <wlanfae@realtek.com>
14 ******************************************************************************/
15 #ifndef __R8192UDM_H__
16 #define __R8192UDM_H__
19 /*--------------------------Define Parameters-------------------------------*/
20 #define OFDM_Table_Length 19
21 #define CCK_Table_length 12
23 #define DM_DIG_THRESH_HIGH 40
24 #define DM_DIG_THRESH_LOW 35
26 #define DM_DIG_HIGH_PWR_THRESH_HIGH 75
27 #define DM_DIG_HIGH_PWR_THRESH_LOW 70
29 #define BW_AUTO_SWITCH_HIGH_LOW 25
30 #define BW_AUTO_SWITCH_LOW_HIGH 30
32 #define DM_DIG_BACKOFF 12
33 #define DM_DIG_MAX 0x36
34 #define DM_DIG_MIN 0x1c
35 #define DM_DIG_MIN_Netcore 0x12
37 #define RxPathSelection_SS_TH_low 30
38 #define RxPathSelection_diff_TH 18
40 #define RateAdaptiveTH_High 50
41 #define RateAdaptiveTH_Low_20M 30
42 #define RateAdaptiveTH_Low_40M 10
43 #define VeryLowRSSI 15
47 #define E_FOR_TX_POWER_TRACK 300
48 #define TX_POWER_NEAR_FIELD_THRESH_HIGH 68
49 #define TX_POWER_NEAR_FIELD_THRESH_LOW 62
50 #define TX_POWER_ATHEROAP_THRESH_HIGH 78
51 #define TX_POWER_ATHEROAP_THRESH_LOW 72
53 #define Current_Tx_Rate_Reg 0x1e0
54 #define Initial_Tx_Rate_Reg 0x1e1
55 #define Tx_Retry_Count_Reg 0x1ac
58 #define DM_Type_ByDriver 1
60 /*--------------------------Define Parameters-------------------------------*/
63 /*------------------------------Define structure----------------------------*/
67 u8 dig_algorithm_switch;
70 long rssi_high_thresh;
72 long rssi_high_power_lowthresh;
73 long rssi_high_power_highthresh;
77 u8 CurSTAConnectState;
78 u8 PreSTAConnectState;
103 DM_RATR_STA_HIGH = 0,
104 DM_RATR_STA_MIDDLE = 1,
110 DIG_ALGO_BY_FALSE_ALARM = 0,
111 DIG_ALGO_BY_RSSI = 1,
112 DIG_ALGO_BEFORE_CONNECT_BY_RSSI_AND_ALARM = 2,
113 DIG_ALGO_BY_TOW_PORT = 3,
117 enum dm_dig_connect {
118 DIG_STA_DISCONNECT = 0,
120 DIG_STA_BEFORE_CONNECT = 2,
121 DIG_AP_DISCONNECT = 3,
123 DIG_AP_ADD_STATION = 5,
128 DIG_PD_AT_LOW_POWER = 0,
129 DIG_PD_AT_NORMAL_POWER = 1,
130 DIG_PD_AT_HIGH_POWER = 2,
134 enum dm_dig_cs_ratio {
135 DIG_CS_RATIO_LOWER = 0,
136 DIG_CS_RATIO_HIGHER = 1,
140 struct drx_path_sel {
151 u8 rf_enable_rssi_th[4];
152 long cck_pwdb_sta[4];
155 enum dm_cck_rx_path_method {
156 CCK_Rx_Version_1 = 0,
157 CCK_Rx_Version_2 = 1,
167 /*------------------------------Define structure----------------------------*/
170 /*------------------------Export global variable----------------------------*/
171 extern struct dig_t dm_digtable;
172 extern struct drx_path_sel DM_RxPathSelTable;
174 /* Pre-calculated gain tables */
175 extern const u32 dm_tx_bb_gain[TxBBGainTableLength];
176 extern const u8 dm_cck_tx_bb_gain[CCKTxBBGainTableLength][8];
177 extern const u8 dm_cck_tx_bb_gain_ch14[CCKTxBBGainTableLength][8];
178 /* Maps table index to iq amplify gain (dB, 12 to -24dB) */
179 #define dm_tx_bb_gain_idx_to_amplify(idx) (-idx + 12)
181 /*------------------------Export global variable----------------------------*/
184 /*--------------------------Exported Function prototype---------------------*/
185 /*--------------------------Exported Function prototype---------------------*/
187 void rtl92e_dm_init(struct net_device *dev);
188 void rtl92e_dm_deinit(struct net_device *dev);
190 void rtl92e_dm_watchdog(struct net_device *dev);
193 void rtl92e_init_adaptive_rate(struct net_device *dev);
194 void rtl92e_dm_txpower_tracking_wq(void *data);
196 void rtl92e_dm_cck_txpower_adjust(struct net_device *dev, bool binch14);
198 void rtl92e_dm_restore_state(struct net_device *dev);
199 void rtl92e_dm_backup_state(struct net_device *dev);
200 void rtl92e_dm_init_edca_turbo(struct net_device *dev);
201 void rtl92e_dm_rf_pathcheck_wq(void *data);
202 void rtl92e_dm_init_txpower_tracking(struct net_device *dev);
203 #endif /*__R8192UDM_H__ */