1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*****************************************************************************
3 * Copyright(c) 2007, RealTEK Technology Inc. All Right Reserved.
5 * Module: Hal819xUsbDM.h (RTL8192 Header H File)
8 * Note: For dynamic control definition constant structure.
17 * 10/04/2007 MHC Create initial version.
19 *****************************************************************************/
20 /* Check to see if the file has been included already. */
21 #ifndef __R8192UDM_H__
22 #define __R8192UDM_H__
25 /*--------------------------Define Parameters-------------------------------*/
26 #define DM_DIG_THRESH_HIGH 40
27 #define DM_DIG_THRESH_LOW 35
29 #define DM_DIG_HIGH_PWR_THRESH_HIGH 75
30 #define DM_DIG_HIGH_PWR_THRESH_LOW 70
32 #define BW_AUTO_SWITCH_HIGH_LOW 25
33 #define BW_AUTO_SWITCH_LOW_HIGH 30
35 #define DM_check_fsync_time_interval 500
38 #define DM_DIG_BACKOFF 12
39 #define DM_DIG_MAX 0x36
40 #define DM_DIG_MIN 0x1c
41 #define DM_DIG_MIN_Netcore 0x12
43 #define RxPathSelection_SS_TH_low 30
44 #define RxPathSelection_diff_TH 18
46 #define RateAdaptiveTH_High 50
47 #define RateAdaptiveTH_Low_20M 30
48 #define RateAdaptiveTH_Low_40M 10
49 #define VeryLowRSSI 15
50 #define CTSToSelfTHVal 30
52 /* defined by vivi, for tx power track */
53 #define E_FOR_TX_POWER_TRACK 300
54 /* Dynamic Tx Power Control Threshold */
55 #define TX_POWER_NEAR_FIELD_THRESH_HIGH 68
56 #define TX_POWER_NEAR_FIELD_THRESH_LOW 62
57 /* added by amy for atheros AP */
58 #define TX_POWER_ATHEROAP_THRESH_HIGH 78
59 #define TX_POWER_ATHEROAP_THRESH_LOW 72
61 /* defined by vivi, for showing on UI */
62 #define Current_Tx_Rate_Reg 0x1b8
63 #define Initial_Tx_Rate_Reg 0x1b9
64 #define Tx_Retry_Count_Reg 0x1ac
66 /*--------------------------Define Parameters-------------------------------*/
69 /*------------------------------Define structure----------------------------*/
70 /* 2007/10/04 MH Define upper and lower threshold of DIG enable or disable. */
75 u8 dig_algorithm_switch;
78 long rssi_high_thresh;
80 long rssi_high_power_lowthresh;
81 long rssi_high_power_highthresh;
99 bool initialgain_lowerbound_state;
104 typedef enum tag_dynamic_init_gain_state_definition {
111 /* 2007/10/08 MH Define RATR state. */
112 typedef enum tag_dynamic_ratr_state_definition {
113 DM_RATR_STA_HIGH = 0,
114 DM_RATR_STA_MIDDLE = 1,
119 /* 2007/10/11 MH Define DIG operation type. */
120 typedef enum tag_dynamic_init_gain_operation_type_definition {
121 DIG_TYPE_THRESH_HIGH = 0,
122 DIG_TYPE_THRESH_LOW = 1,
123 DIG_TYPE_THRESH_HIGHPWR_HIGH = 2,
124 DIG_TYPE_THRESH_HIGHPWR_LOW = 3,
125 DIG_TYPE_DBG_MODE = 4,
127 DIG_TYPE_ALGORITHM = 6,
128 DIG_TYPE_BACKOFF = 7,
129 DIG_TYPE_PWDB_FACTOR = 8,
130 DIG_TYPE_RX_GAIN_MIN = 9,
131 DIG_TYPE_RX_GAIN_MAX = 10,
132 DIG_TYPE_ENABLE = 20,
133 DIG_TYPE_DISABLE = 30,
137 typedef enum tag_dig_algorithm_definition {
138 DIG_ALGO_BY_FALSE_ALARM = 0,
139 DIG_ALGO_BY_RSSI = 1,
143 typedef enum tag_dig_dbgmode_definition {
149 typedef enum tag_dig_connect_definition {
155 typedef enum tag_dig_packetdetection_threshold_definition {
156 DIG_PD_AT_LOW_POWER = 0,
157 DIG_PD_AT_NORMAL_POWER = 1,
158 DIG_PD_AT_HIGH_POWER = 2,
162 typedef enum tag_dig_cck_cs_ratio_state_definition {
163 DIG_CS_RATIO_LOWER = 0,
164 DIG_CS_RATIO_HIGHER = 1,
167 struct dynamic_rx_path_sel {
179 u8 rf_enable_rssi_th[4];
180 long cck_pwdb_sta[4];
183 typedef enum tag_CCK_Rx_Path_Method_Definition {
184 CCK_Rx_Version_1 = 0,
185 CCK_Rx_Version_2 = 1,
187 } DM_CCK_Rx_Path_Method;
189 typedef enum tag_DM_DbgMode_Definition {
195 typedef struct tag_Tx_Config_Cmd_Format {
196 u32 Op; /* Command packet type. */
197 u32 Length; /* Command packet length. */
199 } DCMD_TXCMD_T, *PDCMD_TXCMD_T;
200 /*------------------------------Define structure----------------------------*/
203 /*------------------------Export global variable----------------------------*/
204 extern struct dig dm_digtable;
205 extern u8 dm_shadow[16][256];
206 extern struct dynamic_rx_path_sel DM_RxPathSelTable;
207 /*------------------------Export global variable----------------------------*/
210 /*------------------------Export Marco Definition---------------------------*/
212 /*------------------------Export Marco Definition---------------------------*/
215 /*--------------------------Exported Function prototype---------------------*/
216 void init_hal_dm(struct net_device *dev);
217 void deinit_hal_dm(struct net_device *dev);
218 void hal_dm_watchdog(struct net_device *dev);
219 void init_rate_adaptive(struct net_device *dev);
220 void dm_txpower_trackingcallback(struct work_struct *work);
221 void dm_restore_dynamic_mechanism_state(struct net_device *dev);
222 void dm_backup_dynamic_mechanism_state(struct net_device *dev);
223 void dm_change_dynamic_initgain_thresh(struct net_device *dev,
224 u32 dm_type, u32 dm_value);
225 void dm_force_tx_fw_info(struct net_device *dev,
226 u32 force_type, u32 force_value);
227 void dm_init_edca_turbo(struct net_device *dev);
228 void dm_rf_operation_test_callback(unsigned long data);
229 void dm_rf_pathcheck_workitemcallback(struct work_struct *work);
230 void dm_fsync_timer_callback(unsigned long data);
231 void dm_cck_txpower_adjust(struct net_device *dev, bool binch14);
232 void dm_shadow_init(struct net_device *dev);
233 void dm_initialize_txpower_tracking(struct net_device *dev);
234 /*--------------------------Exported Function prototype---------------------*/
237 #endif /*__R8192UDM_H__ */
240 /* End of r8192U_dm.h */