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 <wlanfae@realtek.com> 19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, 20 * Hsinchu 300, Taiwan. 21 * 22 * Larry Finger <Larry.Finger@lwfinger.net> 23 * 24 *****************************************************************************/ 25 26 #ifndef __PHYDM_DFS_H__ 27 #define __PHYDM_DFS_H__ 28 29 #define DFS_VERSION "1.1" 30 31 /*@ 32 * ============================================================ 33 * Definition 34 * ============================================================ 35 */ 36 37 /*@ 38 * ============================================================ 39 * 1 structure 40 * ============================================================ 41 */ 42 43 struct _DFS_STATISTICS { 44 u8 mask_idx; 45 u8 igi_cur; 46 u8 igi_pre; 47 u8 st_l2h_cur; 48 u16 fa_count_pre; 49 u16 fa_inc_hist[5]; 50 u16 short_pulse_cnt_pre; 51 u16 long_pulse_cnt_pre; 52 u8 pwdb_th; 53 u8 pwdb_th_cur; 54 u8 pwdb_scalar_factor; 55 u8 peak_th; 56 u8 short_pulse_cnt_th; 57 u8 long_pulse_cnt_th; 58 u8 peak_window; 59 u8 three_peak_opt; 60 u8 three_peak_th2; 61 u8 fa_mask_th; 62 u8 st_l2h_max; 63 u8 st_l2h_min; 64 u8 dfs_polling_time; 65 u8 mask_hist_checked : 3; 66 boolean pulse_flag_hist[5]; 67 boolean pulse_type_hist[5]; 68 boolean radar_det_mask_hist[5]; 69 boolean idle_mode; 70 boolean force_TP_mode; 71 boolean dbg_mode; 72 boolean sw_trigger_mode; 73 boolean det_print; 74 boolean det_print2; 75 boolean det_print_jar3; 76 boolean det_jar3_en; 77 boolean radar_type; 78 boolean print_hist_rpt; 79 boolean hist_cond_on; 80 /*@dfs histogram*/ 81 boolean pri_cond1; 82 boolean pri_cond2; 83 boolean pri_cond3; 84 boolean pri_cond4; 85 boolean pri_cond5; 86 boolean pw_cond1; 87 boolean pw_cond2; 88 boolean pw_cond3; 89 boolean pri_type3_4_cond1; /*@for ETSI*/ 90 boolean pri_type3_4_cond2; /*@for ETSI*/ 91 boolean pw_long_cond1; /*@for long radar*/ 92 boolean pw_long_cond2; /*@for long radar*/ 93 boolean pri_long_cond1; /*@for long radar*/ 94 boolean pw_flag; 95 boolean pri_flag; 96 boolean loct_flag; 97 boolean pri_type3_4_flag; /*@for ETSI*/ 98 boolean long_radar_flag; 99 u8 pri_hold_sum[6]; 100 u8 pw_hold_sum[6]; 101 u8 pri_long_hold_sum[6]; 102 u8 pw_long_hold_sum[6]; 103 u8 hist_idx; 104 u8 hist_long_idx; 105 u8 pw_hold[4][6]; 106 u8 pri_hold[4][6]; 107 u8 pw_std; /*@The std(var) of reasonable num of pw group*/ 108 u8 pri_std;/*@The std(var) of reasonable num of pri group*/ 109 /*@dfs histogram threshold*/ 110 u8 pri_hist_th : 3; 111 u8 pri_sum_g1_th : 4; 112 u8 pri_sum_g5_th : 4; 113 u8 pri_sum_g1_fcc_th : 3; 114 u8 pri_sum_g3_fcc_th : 3; 115 u8 pri_sum_safe_fcc_th : 7; 116 u8 pri_sum_type4_th : 5; 117 u8 pri_sum_type6_th : 5; 118 u8 pri_sum_safe_th : 6; 119 u8 pri_sum_g5_under_g1_th : 3; 120 u8 pri_pw_diff_th : 3; 121 u8 pri_pw_diff_fcc_th : 4; 122 u8 pri_pw_diff_fcc_idle_th : 2; 123 u8 pri_pw_diff_w53_th : 4; 124 u8 pri_type1_low_fcc_th : 7; 125 u8 pri_type1_upp_fcc_th : 7; 126 u8 pri_type1_cen_fcc_th : 7; 127 u8 pw_g0_th : 4; 128 u8 pw_long_lower_20m_th : 4; 129 u8 pw_long_lower_th : 3; 130 u8 pri_long_upper_th : 6; 131 u8 pw_long_sum_upper_th : 7; 132 u8 pw_std_th : 4; 133 u8 pw_std_idle_th : 4; 134 u8 pri_std_th : 4; 135 u8 pri_std_idle_th : 4; 136 u8 type4_pw_max_cnt : 4; 137 u8 type4_safe_pri_sum_th : 3; 138 u8 pw_rslt[12]; 139 u8 pri_rslt[12]; 140 s8 loct_rslt[12]; 141 /* 142 u8 pw_lth[10]; 143 u8 pri_lth[10]; 144 u16 pw_uth[10]; 145 u8 pri_uth[10]; 146 */ 147 boolean nhm_dfs_en; 148 boolean nhm_dfs_flag; 149 u8 nhm_dfs_cnt; 150 u8 nhm_cnt_th; 151 u8 nhm_dty_th; 152 boolean b_flag; 153 boolean pw_flag_en; 154 boolean loct_flag_en; 155 boolean pri_flag_en; 156 u8 pri_var_offset; 157 u8 pri_var_tp_offset; 158 u8 pri_cnt_th; 159 u8 loct_diff_th; 160 u8 dc_cnt_th; 161 }; 162 163 /*@ 164 * ============================================================ 165 * enumeration 166 * ============================================================ 167 */ 168 169 enum phydm_dfs_region_domain { 170 PHYDM_DFS_DOMAIN_UNKNOWN = 0, 171 PHYDM_DFS_DOMAIN_FCC = 1, 172 PHYDM_DFS_DOMAIN_MKK = 2, 173 PHYDM_DFS_DOMAIN_ETSI = 3, 174 }; 175 176 /*@ 177 * ============================================================ 178 * function prototype 179 * ============================================================ 180 */ 181 #if defined(CONFIG_PHYDM_DFS_MASTER) 182 void phydm_radar_detect_reset(void *dm_void); 183 void phydm_radar_detect_disable(void *dm_void); 184 void phydm_radar_detect_enable(void *dm_void); 185 boolean phydm_radar_detect(void *dm_void); 186 void phydm_dfs_histogram_radar_distinguish(void *dm_void); 187 boolean phydm_dfs_hist_log(void *dm_void, u8 index); 188 void phydm_dfs_parameter_init(void *dm_void); 189 void phydm_dfs_rpt_distinguish(void *dm_void); 190 void phydm_dfs_hist_dbg(void *dm_void, char input[][16], u32 *_used, 191 char *output, u32 *_out_len); 192 void phydm_dfs_debug(void *dm_void, char input[][16], u32 *_used, 193 char *output, u32 *_out_len); 194 u8 phydm_dfs_polling_time(void *dm_void); 195 #endif /* @defined(CONFIG_PHYDM_DFS_MASTER) */ 196 197 boolean 198 phydm_dfs_is_meteorology_channel(void *dm_void); 199 200 void 201 phydm_dfs_segment_distinguish(void *dm_void, enum rf_syn syn_path); 202 203 void 204 phydm_dfs_segment_flag_reset(void *dm_void); 205 206 boolean 207 phydm_is_dfs_band(void *dm_void); 208 209 boolean 210 phydm_dfs_master_enabled(void *dm_void); 211 212 #if (DM_ODM_SUPPORT_TYPE & ODM_WIN) 213 #ifdef PHYDM_IC_JGR3_SERIES_SUPPORT 214 void phydm_dfs_ap_reset_radar_detect_counter_and_flag(void *dm_void); 215 #endif 216 #endif 217 218 #endif /*@#ifndef __PHYDM_DFS_H__ */ 219