Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
nu11secur1ty
GitHub Repository: nu11secur1ty/Kali-Linux
Path: blob/master/ALFA-W1F1/RTL8814AU/hal/phydm/phydm_dig.h
1307 views
1
/******************************************************************************
2
*
3
* Copyright(c) 2007 - 2017 Realtek Corporation.
4
*
5
* This program is free software; you can redistribute it and/or modify it
6
* under the terms of version 2 of the GNU General Public License as
7
* published by the Free Software Foundation.
8
*
9
* This program is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12
* more details.
13
*
14
* The full GNU General Public License is included in this distribution in the
15
* file called LICENSE.
16
*
17
* Contact Information:
18
* wlanfae <[email protected]>
19
* Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20
* Hsinchu 300, Taiwan.
21
*
22
* Larry Finger <[email protected]>
23
*
24
*****************************************************************************/
25
26
#ifndef __PHYDMDIG_H__
27
#define __PHYDMDIG_H__
28
29
#define DIG_VERSION "2.5" /* @Add new fa_cnt for VHT-SIGA/VHT-SIGB*/
30
31
#define DIG_HW 0
32
#define DIG_LIMIT_PERIOD 60 /*@60 sec*/
33
34
/*@--------------------Define ---------------------------------------*/
35
36
/*@=== [DIG Boundary] ========================================*/
37
/*@DIG coverage mode*/
38
#define DIG_MAX_COVERAGR 0x26
39
#define DIG_MIN_COVERAGE 0x1c
40
#define DIG_MAX_OF_MIN_COVERAGE 0x22
41
42
/*@[DIG Balance mode]*/
43
#if (DIG_HW == 1)
44
#define DIG_MAX_BALANCE_MODE 0x32
45
#else
46
#define DIG_MAX_BALANCE_MODE 0x3e
47
#endif
48
#define DIG_MAX_OF_MIN_BALANCE_MODE 0x2a
49
50
/*@[DIG Performance mode]*/
51
#define DIG_MAX_PERFORMANCE_MODE 0x5a
52
#define DIG_MAX_OF_MIN_PERFORMANCE_MODE 0x40 /*@[WLANBB-871]*/
53
#define DIG_MIN_PERFORMANCE 0x20
54
55
/*@DIG DFS function*/
56
#define DIG_MAX_DFS 0x28
57
#define DIG_MIN_DFS 0x20
58
59
/*@DIG LPS function*/
60
#define DIG_MAX_LPS 0x3e
61
#define DIG_MIN_LPS 0x20
62
63
#ifdef PHYDM_TDMA_DIG_SUPPORT
64
#define DIG_NUM_OF_TDMA_STATES 2 /*@L, H state*/
65
#define DIG_TIMER_MS 250
66
#define ONE_SEC_MS 1000
67
#endif
68
69
/*@=== [DIG FA Threshold] ======================================*/
70
71
/*Normal*/
72
#define DM_DIG_FA_TH0 500
73
#define DM_DIG_FA_TH1 750
74
75
/*@LPS*/
76
#define DM_DIG_FA_TH0_LPS 4 /* @-> 4 lps */
77
#define DM_DIG_FA_TH1_LPS 15 /* @-> 15 lps */
78
#define DM_DIG_FA_TH2_LPS 30 /* @-> 30 lps */
79
80
#define RSSI_OFFSET_DIG_LPS 5
81
#define DIG_RECORD_NUM 4
82
83
/*@--------------------Enum-----------------------------------*/
84
enum dig_goupcheck_level {
85
DIG_GOUPCHECK_LEVEL_0,
86
DIG_GOUPCHECK_LEVEL_1,
87
DIG_GOUPCHECK_LEVEL_2
88
};
89
90
enum phydm_dig_mode {
91
PHYDM_DIG_PERFORAMNCE_MODE = 0,
92
PHYDM_DIG_COVERAGE_MODE = 1,
93
};
94
95
#ifdef PHYDM_TDMA_DIG_SUPPORT
96
enum upd_type {
97
ENABLE_TDMA,
98
MODE_DECISION
99
};
100
101
enum tdma_opmode {
102
MODE_PERFORMANCE = 1,
103
MODE_COVERAGE = 2
104
};
105
106
#ifdef IS_USE_NEW_TDMA
107
enum tdma_dig_timer {
108
INIT_TDMA_DIG_TIMMER,
109
CANCEL_TDMA_DIG_TIMMER,
110
RELEASE_TDMA_DIG_TIMMER
111
};
112
113
enum tdma_dig_state {
114
TDMA_DIG_LOW_STATE = 0,
115
TDMA_DIG_HIGH_STATE = 1,
116
NORMAL_DIG = 2
117
};
118
#endif
119
#endif
120
121
/*@--------------------Define Struct-----------------------------------*/
122
#ifdef CFG_DIG_DAMPING_CHK
123
struct phydm_dig_recorder_strcut {
124
u8 igi_bitmap; /*@Don't add any new parameter before this*/
125
u8 igi_history[DIG_RECORD_NUM];
126
u32 fa_history[DIG_RECORD_NUM];
127
u8 damping_limit_en;
128
u8 damping_limit_val; /*@Limit IGI_dyn_min*/
129
u32 limit_time;
130
u8 limit_rssi;
131
};
132
#endif
133
134
struct phydm_mcc_dig {
135
u8 mcc_rssi_A;
136
u8 mcc_rssi_B;
137
};
138
139
struct phydm_dig_struct {
140
#ifdef CFG_DIG_DAMPING_CHK
141
struct phydm_dig_recorder_strcut dig_recorder_t;
142
u8 dig_dl_en; /*@damping limit function enable*/
143
#endif
144
boolean is_dbg_fa_th;
145
u8 cur_ig_value;
146
u32 rvrt_val; /*all rvrt_val for pause API must set to u32*/
147
u8 igi_backup;
148
u8 rx_gain_range_max; /*@dig_dynamic_max*/
149
u8 rx_gain_range_min; /*@dig_dynamic_min*/
150
u8 dm_dig_max; /*@Absolutly upper bound*/
151
u8 dm_dig_min; /*@Absolutly lower bound*/
152
u8 dig_max_of_min; /*@Absolutly max of min*/
153
u32 ant_div_rssi_max;
154
u8 *is_p2p_in_process;
155
enum dig_goupcheck_level go_up_chk_lv;
156
u16 fa_th[3];
157
#if (RTL8822B_SUPPORT || RTL8197F_SUPPORT || RTL8821C_SUPPORT ||\
158
RTL8198F_SUPPORT || RTL8192F_SUPPORT || RTL8195B_SUPPORT ||\
159
RTL8822C_SUPPORT || RTL8814B_SUPPORT || RTL8721D_SUPPORT ||\
160
RTL8710C_SUPPORT || RTL8812F_SUPPORT || RTL8197G_SUPPORT)
161
u8 rf_gain_idx;
162
u8 agc_table_idx;
163
u8 big_jump_lmt[16];
164
u8 enable_adjust_big_jump:1;
165
u8 big_jump_step1:3;
166
u8 big_jump_step2:2;
167
u8 big_jump_step3:2;
168
#endif
169
u8 upcheck_init_val;
170
u8 lv0_ratio_reciprocal;
171
u8 lv1_ratio_reciprocal;
172
#ifdef PHYDM_TDMA_DIG_SUPPORT
173
u8 cur_ig_value_tdma;
174
u8 low_ig_value;
175
u8 tdma_dig_state; /*@To distinguish which state is now.(L-sate or H-state)*/
176
u32 tdma_dig_cnt; /*@for phydm_tdma_dig_timer_check use*/
177
u8 pre_tdma_dig_cnt;
178
u8 sec_factor;
179
u32 cur_timestamp;
180
u32 pre_timestamp;
181
u32 fa_start_timestamp;
182
u32 fa_end_timestamp;
183
u32 fa_acc_1sec_timestamp;
184
#ifdef IS_USE_NEW_TDMA
185
u8 tdma_dig_block_cnt;/*@for 1 second dump indicator use*/
186
/*@dynamic upper bound for L/H state*/
187
u8 tdma_rx_gain_max[DIG_NUM_OF_TDMA_STATES];
188
/*@dynamic lower bound for L/H state*/
189
u8 tdma_rx_gain_min[DIG_NUM_OF_TDMA_STATES];
190
/*To distinguish current state(L-sate or H-state)*/
191
#endif
192
#endif
193
};
194
195
struct phydm_fa_struct {
196
u32 cnt_parity_fail;
197
u32 cnt_rate_illegal;
198
u32 cnt_crc8_fail;
199
u32 cnt_crc8_fail_vhta;
200
u32 cnt_crc8_fail_vhtb;
201
u32 cnt_mcs_fail;
202
u32 cnt_mcs_fail_vht;
203
u32 cnt_ofdm_fail;
204
u32 cnt_ofdm_fail_pre; /* @For RTL8881A */
205
u32 cnt_cck_fail;
206
u32 cnt_all;
207
u32 cnt_all_accumulated;
208
u32 cnt_all_pre;
209
u32 cnt_fast_fsync;
210
u32 cnt_sb_search_fail;
211
u32 cnt_ofdm_cca;
212
u32 cnt_cck_cca;
213
u32 cnt_cca_all;
214
u32 cnt_bw_usc;
215
u32 cnt_bw_lsc;
216
u32 cnt_cck_crc32_error;
217
u32 cnt_cck_crc32_ok;
218
u32 cnt_ofdm_crc32_error;
219
u32 cnt_ofdm_crc32_ok;
220
u32 cnt_ht_crc32_error;
221
u32 cnt_ht_crc32_ok;
222
u32 cnt_ht_crc32_error_agg;
223
u32 cnt_ht_crc32_ok_agg;
224
u32 cnt_vht_crc32_error;
225
u32 cnt_vht_crc32_ok;
226
u32 cnt_crc32_error_all;
227
u32 cnt_crc32_ok_all;
228
u32 time_fa_all;
229
boolean cck_block_enable;
230
boolean ofdm_block_enable;
231
u32 dbg_port0;
232
boolean edcca_flag;
233
};
234
235
#ifdef PHYDM_TDMA_DIG_SUPPORT
236
struct phydm_fa_acc_struct {
237
u32 cnt_parity_fail;
238
u32 cnt_rate_illegal;
239
u32 cnt_crc8_fail;
240
u32 cnt_mcs_fail;
241
u32 cnt_ofdm_fail;
242
u32 cnt_ofdm_fail_pre; /*@For RTL8881A*/
243
u32 cnt_cck_fail;
244
u32 cnt_all;
245
u32 cnt_all_pre;
246
u32 cnt_fast_fsync;
247
u32 cnt_sb_search_fail;
248
u32 cnt_ofdm_cca;
249
u32 cnt_cck_cca;
250
u32 cnt_cca_all;
251
u32 cnt_cck_crc32_error;
252
u32 cnt_cck_crc32_ok;
253
u32 cnt_ofdm_crc32_error;
254
u32 cnt_ofdm_crc32_ok;
255
u32 cnt_ht_crc32_error;
256
u32 cnt_ht_crc32_ok;
257
u32 cnt_vht_crc32_error;
258
u32 cnt_vht_crc32_ok;
259
u32 cnt_crc32_error_all;
260
u32 cnt_crc32_ok_all;
261
u32 cnt_all_1sec;
262
u32 cnt_cca_all_1sec;
263
u32 cnt_cck_fail_1sec;
264
};
265
266
#endif /*@#ifdef PHYDM_TDMA_DIG_SUPPORT*/
267
268
/*@--------------------Function declaration-----------------------------*/
269
void phydm_write_dig_reg(void *dm_void, u8 igi);
270
271
void odm_write_dig(void *dm_void, u8 current_igi);
272
273
u8 phydm_get_igi(void *dm_void, enum bb_path path);
274
275
void phydm_set_dig_val(void *dm_void, u32 *val_buf, u8 val_len);
276
277
void odm_pause_dig(void *dm_void, enum phydm_pause_type pause_type,
278
enum phydm_pause_level pause_level, u8 igi_value);
279
280
void phydm_dig_init(void *dm_void);
281
282
void phydm_dig(void *dm_void);
283
284
void phydm_dig_lps_32k(void *dm_void);
285
286
void phydm_dig_by_rssi_lps(void *dm_void);
287
288
void phydm_false_alarm_counter_statistics(void *dm_void);
289
290
#ifdef PHYDM_TDMA_DIG_SUPPORT
291
void phydm_set_tdma_dig_timer(void *dm_void);
292
293
void phydm_tdma_dig_timer_check(void *dm_void);
294
295
void phydm_tdma_dig(void *dm_void);
296
297
void phydm_tdma_false_alarm_counter_check(void *dm_void);
298
299
void phydm_tdma_dig_add_interrupt_mask_handler(void *dm_void);
300
301
void phydm_false_alarm_counter_reset(void *dm_void);
302
303
void phydm_false_alarm_counter_acc(void *dm_void, boolean rssi_dump_en);
304
305
void phydm_false_alarm_counter_acc_reset(void *dm_void);
306
307
void phydm_tdma_dig_para_upd(void *dm_void, enum upd_type type, u8 input);
308
309
#ifdef IS_USE_NEW_TDMA
310
void phydm_tdma_dig_timers(void *dm_void, u8 state);
311
312
void phydm_tdma_dig_cbk(void *dm_void);
313
314
void phydm_tdma_dig_workitem_callback(void *dm_void);
315
316
void phydm_tdma_fa_cnt_chk(void *dm_void);
317
318
void phydm_tdma_low_dig(void *dm_void);
319
320
void phydm_tdma_high_dig(void *dm_void);
321
322
void phydm_fa_cnt_acc(void *dm_void, boolean rssi_dump_en,
323
u8 cur_tdma_dig_state);
324
#endif /*@#ifdef IS_USE_NEW_TDMA*/
325
#endif /*@#ifdef PHYDM_TDMA_DIG_SUPPORT*/
326
327
void phydm_set_ofdm_agc_tab(void *dm_void, u8 tab_sel);
328
329
void phydm_dig_debug(void *dm_void, char input[][16], u32 *_used, char *output,
330
u32 *_out_len);
331
332
#ifdef CONFIG_MCC_DM
333
void phydm_mcc_igi_cal(void *dm_void);
334
#endif
335
336
337
#endif
338
339