phydm_dfs.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  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. #ifndef __PHYDM_DFS_H__
  26. #define __PHYDM_DFS_H__
  27. #define DFS_VERSION "1.1"
  28. /*@
  29. * ============================================================
  30. * Definition
  31. * ============================================================
  32. */
  33. /*@
  34. * ============================================================
  35. * 1 structure
  36. * ============================================================
  37. */
  38. struct _DFS_STATISTICS {
  39. u8 mask_idx;
  40. u8 igi_cur;
  41. u8 igi_pre;
  42. u8 st_l2h_cur;
  43. u16 fa_count_pre;
  44. u16 fa_inc_hist[5];
  45. u16 vht_crc_ok_cnt_pre;
  46. u16 ht_crc_ok_cnt_pre;
  47. u16 leg_crc_ok_cnt_pre;
  48. u16 short_pulse_cnt_pre;
  49. u16 long_pulse_cnt_pre;
  50. u8 pwdb_th;
  51. u8 pwdb_th_cur;
  52. u8 pwdb_scalar_factor;
  53. u8 peak_th;
  54. u8 short_pulse_cnt_th;
  55. u8 long_pulse_cnt_th;
  56. u8 peak_window;
  57. u8 three_peak_opt;
  58. u8 three_peak_th2;
  59. u8 fa_mask_th;
  60. u8 det_flag_offset;
  61. u8 st_l2h_max;
  62. u8 st_l2h_min;
  63. u8 mask_hist_checked;
  64. boolean pulse_flag_hist[5];
  65. boolean pulse_type_hist[5];
  66. boolean radar_det_mask_hist[5];
  67. boolean idle_mode;
  68. boolean force_TP_mode;
  69. boolean dbg_mode;
  70. boolean det_print;
  71. boolean det_print2;
  72. boolean radar_type;
  73. /*@dfs histogram*/
  74. boolean print_hist_rpt;
  75. boolean hist_cond_on;
  76. boolean pri_cond1;
  77. boolean pri_cond2;
  78. boolean pri_cond3;
  79. boolean pri_cond4;
  80. boolean pri_cond5;
  81. boolean pw_cond1;
  82. boolean pw_cond2;
  83. boolean pw_cond3;
  84. boolean pri_type3_4_cond1; /*@for ETSI*/
  85. boolean pri_type3_4_cond2; /*@for ETSI*/
  86. boolean pw_long_cond1; /*@for long radar*/
  87. boolean pw_long_cond2; /*@for long radar*/
  88. boolean pri_long_cond1; /*@for long radar*/
  89. boolean pw_flag;
  90. boolean pri_flag;
  91. boolean pri_type3_4_flag; /*@for ETSI*/
  92. boolean long_radar_flag;
  93. u16 pri_hold_sum[6];
  94. u16 pw_hold_sum[6];
  95. u16 pri_long_hold_sum[6];
  96. u16 pw_long_hold_sum[6];
  97. u8 pri_hist_th;
  98. u8 hist_idx;
  99. u8 hist_long_idx;
  100. u8 pw_hold[4][6];
  101. u8 pri_hold[4][6];
  102. u8 pw_long_hold[300][6];
  103. u8 pri_long_hold[300][6];
  104. u16 pw_std; /*@The std(var) of reasonable num of pw group*/
  105. u16 pri_std;/*@The std(var) of reasonable num of pri group*/
  106. /*@dfs histogram threshold*/
  107. u8 pri_sum_g1_th;
  108. u8 pri_sum_g5_th;
  109. u8 pri_sum_g1_fcc_th;
  110. u8 pri_sum_g3_fcc_th;
  111. u8 pri_sum_safe_fcc_th;
  112. u8 pri_sum_type4_th;
  113. u8 pri_sum_type6_th;
  114. u8 pri_sum_safe_th;
  115. u8 pri_sum_g5_under_g1_th;
  116. u8 pri_pw_diff_th;
  117. u8 pri_pw_diff_fcc_th;
  118. u8 pri_pw_diff_fcc_idle_th;
  119. u8 pri_pw_diff_w53_th;
  120. u8 pri_type1_low_fcc_th;
  121. u8 pri_type1_upp_fcc_th;
  122. u8 pri_type1_cen_fcc_th;
  123. u8 pw_g0_th;
  124. u8 pw_long_lower_20m_th;
  125. u8 pw_long_lower_th;
  126. u8 pri_long_upper_th;
  127. u8 pw_long_sum_upper_th;
  128. u8 pw_std_th;
  129. u8 pw_std_idle_th;
  130. u8 pri_std_th;
  131. u8 pri_std_idle_th;
  132. u8 type4_pw_max_cnt;
  133. u8 type4_safe_pri_sum_th;
  134. };
  135. /*@
  136. * ============================================================
  137. * enumeration
  138. * ============================================================
  139. */
  140. enum phydm_dfs_region_domain {
  141. PHYDM_DFS_DOMAIN_UNKNOWN = 0,
  142. PHYDM_DFS_DOMAIN_FCC = 1,
  143. PHYDM_DFS_DOMAIN_MKK = 2,
  144. PHYDM_DFS_DOMAIN_ETSI = 3,
  145. };
  146. /*@
  147. * ============================================================
  148. * function prototype
  149. * ============================================================
  150. */
  151. #if defined(CONFIG_PHYDM_DFS_MASTER)
  152. void phydm_radar_detect_reset(void *dm_void);
  153. void phydm_radar_detect_disable(void *dm_void);
  154. void phydm_radar_detect_enable(void *dm_void);
  155. boolean phydm_radar_detect(void *dm_void);
  156. void phydm_dfs_histogram_radar_distinguish(void *dm_void);
  157. boolean phydm_dfs_hist_log(void *dm_void, u8 index);
  158. void phydm_dfs_parameter_init(void *dm_void);
  159. void phydm_dfs_debug(void *dm_void, char input[][16], u32 *_used,
  160. char *output, u32 *_out_len);
  161. u8 phydm_dfs_polling_time(void *dm_void);
  162. #endif /* @defined(CONFIG_PHYDM_DFS_MASTER) */
  163. boolean
  164. phydm_dfs_is_meteorology_channel(void *dm_void);
  165. boolean
  166. phydm_is_dfs_band(void *dm_void);
  167. boolean
  168. phydm_dfs_master_enabled(void *dm_void);
  169. #endif /*@#ifndef __PHYDM_DFS_H__ */