phydm_pathdiv.h 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  1. /******************************************************************************
  2. *
  3. * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
  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. * You should have received a copy of the GNU General Public License along with
  15. * this program; if not, write to the Free Software Foundation, Inc.,
  16. * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
  17. *
  18. *
  19. ******************************************************************************/
  20. #ifndef __PHYDMPATHDIV_H__
  21. #define __PHYDMPATHDIV_H__
  22. /*#define PATHDIV_VERSION "2.0" //2014.11.04*/
  23. #define PATHDIV_VERSION "3.1" /*2015.07.29 by YuChen*/
  24. #if (defined(CONFIG_PATH_DIVERSITY))
  25. #define USE_PATH_A_AS_DEFAULT_ANT /* for 8814 dynamic TX path selection */
  26. #define NUM_RESET_DTP_PERIOD 5
  27. #define ANT_DECT_RSSI_TH 3
  28. #define PATH_A 1
  29. #define PATH_B 2
  30. #define PATH_C 3
  31. #define PATH_D 4
  32. #define PHYDM_AUTO_PATH 0
  33. #define PHYDM_FIX_PATH 1
  34. #define NUM_CHOOSE2_FROM4 6
  35. #define NUM_CHOOSE3_FROM4 4
  36. #define PHYDM_A BIT(0)
  37. #define PHYDM_B BIT(1)
  38. #define PHYDM_C BIT(2)
  39. #define PHYDM_D BIT(3)
  40. #define PHYDM_AB (BIT(0) | BIT1) /* 0 */
  41. #define PHYDM_AC (BIT(0) | BIT2) /* 1 */
  42. #define PHYDM_AD (BIT(0) | BIT3) /* 2 */
  43. #define PHYDM_BC (BIT(1) | BIT2) /* 3 */
  44. #define PHYDM_BD (BIT(1) | BIT3) /* 4 */
  45. #define PHYDM_CD (BIT(2) | BIT3) /* 5 */
  46. #define PHYDM_ABC (BIT(0) | BIT1 | BIT2) /* 0*/
  47. #define PHYDM_ABD (BIT(0) | BIT1 | BIT3) /* 1*/
  48. #define PHYDM_ACD (BIT(0) | BIT2 | BIT3) /* 2*/
  49. #define PHYDM_BCD (BIT(1) | BIT2 | BIT3) /* 3*/
  50. #define PHYDM_ABCD (BIT(0) | BIT(1) | BIT(2) | BIT(3))
  51. enum phydm_dtp_state {
  52. PHYDM_DTP_INIT = 1,
  53. PHYDM_DTP_RUNNING_1
  54. };
  55. enum phydm_path_div_type {
  56. PHYDM_2R_PATH_DIV = 1,
  57. PHYDM_4R_PATH_DIV = 2
  58. };
  59. void
  60. phydm_process_rssi_for_path_div(
  61. void *p_dm_void,
  62. void *p_phy_info_void,
  63. void *p_pkt_info_void
  64. );
  65. struct _ODM_PATH_DIVERSITY_ {
  66. u8 resp_tx_path;
  67. u8 path_sel[ODM_ASSOCIATE_ENTRY_NUM];
  68. u32 path_a_sum[ODM_ASSOCIATE_ENTRY_NUM];
  69. u32 path_b_sum[ODM_ASSOCIATE_ENTRY_NUM];
  70. u16 path_a_cnt[ODM_ASSOCIATE_ENTRY_NUM];
  71. u16 path_b_cnt[ODM_ASSOCIATE_ENTRY_NUM];
  72. u8 phydm_path_div_type;
  73. #if RTL8814A_SUPPORT
  74. u32 path_a_sum_all;
  75. u32 path_b_sum_all;
  76. u32 path_c_sum_all;
  77. u32 path_d_sum_all;
  78. u32 path_a_cnt_all;
  79. u32 path_b_cnt_all;
  80. u32 path_c_cnt_all;
  81. u32 path_d_cnt_all;
  82. u8 dtp_period;
  83. boolean is_become_linked;
  84. boolean is_u3_mode;
  85. u8 num_tx_path;
  86. u8 default_path;
  87. u8 num_candidate;
  88. u8 ant_candidate_1;
  89. u8 ant_candidate_2;
  90. u8 ant_candidate_3;
  91. u8 phydm_dtp_state;
  92. u8 dtp_check_patha_counter;
  93. boolean fix_path_bfer;
  94. u8 search_space_2[NUM_CHOOSE2_FROM4];
  95. u8 search_space_3[NUM_CHOOSE3_FROM4];
  96. u8 pre_tx_path;
  97. u8 use_path_a_as_default_ant;
  98. boolean is_path_a_exist;
  99. #endif
  100. };
  101. #endif /* #if(defined(CONFIG_PATH_DIVERSITY)) */
  102. void
  103. phydm_c2h_dtp_handler(
  104. void *p_dm_void,
  105. u8 *cmd_buf,
  106. u8 cmd_len
  107. );
  108. void
  109. odm_path_diversity_init(
  110. void *p_dm_void
  111. );
  112. void
  113. odm_path_diversity(
  114. void *p_dm_void
  115. );
  116. void
  117. odm_pathdiv_debug(
  118. void *p_dm_void,
  119. u32 *const dm_value,
  120. u32 *_used,
  121. char *output,
  122. u32 *_out_len
  123. );
  124. /* 1 [OLD IC]-------------------------------------------------------------------------------- */
  125. #if (DM_ODM_SUPPORT_TYPE & (ODM_WIN))
  126. /* #define PATHDIV_ENABLE 1 */
  127. #define dm_path_div_rssi_check odm_path_div_chk_per_pkt_rssi
  128. #define path_div_check_before_link8192c odm_path_diversity_before_link92c
  129. struct _path_div_parameter_define_ {
  130. u32 org_5g_rege30;
  131. u32 org_5g_regc14;
  132. u32 org_5g_regca0;
  133. u32 swt_5g_rege30;
  134. u32 swt_5g_regc14;
  135. u32 swt_5g_regca0;
  136. /* for 2G IQK information */
  137. u32 org_2g_regc80;
  138. u32 org_2g_regc4c;
  139. u32 org_2g_regc94;
  140. u32 org_2g_regc14;
  141. u32 org_2g_regca0;
  142. u32 swt_2g_regc80;
  143. u32 swt_2g_regc4c;
  144. u32 swt_2g_regc94;
  145. u32 swt_2g_regc14;
  146. u32 swt_2g_regca0;
  147. };
  148. void
  149. odm_path_diversity_init_92c(
  150. struct _ADAPTER *adapter
  151. );
  152. void
  153. odm_2t_path_diversity_init_92c(
  154. struct _ADAPTER *adapter
  155. );
  156. void
  157. odm_1t_path_diversity_init_92c(
  158. struct _ADAPTER *adapter
  159. );
  160. boolean
  161. odm_is_connected_92c(
  162. struct _ADAPTER *adapter
  163. );
  164. boolean
  165. odm_path_diversity_before_link92c(
  166. /* struct _ADAPTER* adapter */
  167. struct PHY_DM_STRUCT *p_dm_odm
  168. );
  169. void
  170. odm_path_diversity_after_link_92c(
  171. struct _ADAPTER *adapter
  172. );
  173. void
  174. odm_set_resp_path_92c(
  175. struct _ADAPTER *adapter,
  176. u8 default_resp_path
  177. );
  178. void
  179. odm_ofdm_tx_path_diversity_92c(
  180. struct _ADAPTER *adapter
  181. );
  182. void
  183. odm_cck_tx_path_diversity_92c(
  184. struct _ADAPTER *adapter
  185. );
  186. void
  187. odm_reset_path_diversity_92c(
  188. struct _ADAPTER *adapter
  189. );
  190. void
  191. odm_cck_tx_path_diversity_callback(
  192. struct timer_list *p_timer
  193. );
  194. void
  195. odm_cck_tx_path_diversity_work_item_callback(
  196. void *p_context
  197. );
  198. void
  199. odm_path_div_chk_ant_switch_callback(
  200. struct timer_list *p_timer
  201. );
  202. void
  203. odm_path_div_chk_ant_switch_workitem_callback(
  204. void *p_context
  205. );
  206. void
  207. odm_path_div_chk_ant_switch(
  208. struct PHY_DM_STRUCT *p_dm_odm
  209. );
  210. void
  211. odm_cck_path_diversity_chk_per_pkt_rssi(
  212. struct _ADAPTER *adapter,
  213. boolean is_def_port,
  214. boolean is_match_bssid,
  215. struct _WLAN_STA *p_entry,
  216. PRT_RFD p_rfd,
  217. u8 *p_desc
  218. );
  219. void
  220. odm_path_div_chk_per_pkt_rssi(
  221. struct _ADAPTER *adapter,
  222. boolean is_def_port,
  223. boolean is_match_bssid,
  224. struct _WLAN_STA *p_entry,
  225. PRT_RFD p_rfd
  226. );
  227. void
  228. odm_path_div_rest_after_link(
  229. struct PHY_DM_STRUCT *p_dm_odm
  230. );
  231. void
  232. odm_fill_tx_path_in_txdesc(
  233. struct _ADAPTER *adapter,
  234. PRT_TCB p_tcb,
  235. u8 *p_desc
  236. );
  237. void
  238. odm_path_div_init_92d(
  239. struct PHY_DM_STRUCT *p_dm_odm
  240. );
  241. u8
  242. odm_sw_ant_div_select_scan_chnl(
  243. struct _ADAPTER *adapter
  244. );
  245. void
  246. odm_sw_ant_div_construct_scan_chnl(
  247. struct _ADAPTER *adapter,
  248. u8 scan_chnl
  249. );
  250. #endif /* #if(DM_ODM_SUPPORT_TYPE & (ODM_WIN)) */
  251. #endif /* #ifndef __ODMPATHDIV_H__ */