phydm_smt_ant.h 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  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 __PHYDMSMTANT_H__
  26. #define __PHYDMSMTANT_H__
  27. /*@#define SMT_ANT_VERSION "1.1"*/ /*@2017.03.13*/
  28. /*@#define SMT_ANT_VERSION "1.2"*/ /*@2017.03.28*/
  29. #define SMT_ANT_VERSION "2.0" /* @Add Cumitek SmtAnt 2017.05.25*/
  30. #define SMTANT_RTK 1
  31. #define SMTANT_HON_BO 2
  32. #define SMTANT_CUMITEK 3
  33. #if (defined(CONFIG_SMART_ANTENNA))
  34. #if (defined(CONFIG_CUMITEK_SMART_ANTENNA))
  35. struct smt_ant_cumitek {
  36. u8 tx_ant_idx[2][ODM_ASSOCIATE_ENTRY_NUM]; /*@[pathA~B] [MACID 0~128]*/
  37. u8 rx_default_ant_idx[2]; /*@[pathA~B]*/
  38. };
  39. #endif
  40. #if (defined(CONFIG_HL_SMART_ANTENNA))
  41. struct smt_ant_honbo {
  42. u32 latch_time;
  43. boolean pkt_skip_statistic_en;
  44. u32 fix_beam_pattern_en;
  45. u32 fix_training_num_en;
  46. u32 fix_beam_pattern_codeword;
  47. u32 update_beam_codeword;
  48. u32 ant_num; /*number of "used" smart beam antenna*/
  49. u32 ant_num_total;/*number of "total" smart beam antenna*/
  50. u32 first_train_ant; /*@decide witch antenna to train first*/
  51. #ifdef CONFIG_HL_SMART_ANTENNA_TYPE1
  52. u32 pkt_rssi_pre[SUPPORT_RF_PATH_NUM][SUPPORT_BEAM_PATTERN_NUM];/*@rssi of each path with a certain beam pattern*/
  53. u8 beam_train_rssi_diff[SUPPORT_RF_PATH_NUM][SUPPORT_BEAM_PATTERN_NUM];
  54. u8 beam_train_cnt[SUPPORT_RF_PATH_NUM][SUPPORT_BEAM_PATTERN_NUM];
  55. u32 rfu_codeword_table[4]; /*@2G beam truth table*/
  56. u32 rfu_codeword_table_5g[4]; /*@5G beam truth table*/
  57. u32 beam_patten_num_each_ant;/*@number of beam can be switched in each antenna*/
  58. u32 rx_idle_beam[SUPPORT_RF_PATH_NUM];
  59. u32 pkt_rssi_sum[8][SUPPORT_BEAM_PATTERN_NUM];
  60. u32 pkt_rssi_cnt[8][SUPPORT_BEAM_PATTERN_NUM];
  61. #endif
  62. u32 fast_training_beam_num;/*@current training beam_set index*/
  63. u32 pre_fast_training_beam_num;/*pre training beam_set index*/
  64. u32 rfu_codeword_total_bit_num; /* @total bit number of RFU protocol*/
  65. u32 rfu_each_ant_bit_num; /* @bit number of RFU protocol for each ant*/
  66. u8 per_beam_training_pkt_num;
  67. u8 decision_holding_period;
  68. u32 pre_codeword;
  69. boolean force_update_beam_en;
  70. u32 beacon_counter;
  71. u32 pre_beacon_counter;
  72. u8 pkt_counter; /*@packet number that each beam-set should be colected in training state*/
  73. u8 update_beam_idx; /*@the index announce that the beam can be updated*/
  74. u8 rfu_protocol_type;
  75. u16 rfu_protocol_delay_time;
  76. #if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
  77. RT_WORK_ITEM hl_smart_antenna_workitem;
  78. RT_WORK_ITEM hl_smart_antenna_decision_workitem;
  79. #endif
  80. #ifdef CONFIG_HL_SMART_ANTENNA_TYPE2
  81. u8 beam_set_avg_rssi_pre[SUPPORT_BEAM_SET_PATTERN_NUM]; /*@avg pre_rssi of each beam set*/
  82. u8 beam_set_train_val_diff[SUPPORT_BEAM_SET_PATTERN_NUM]; /*@rssi of a beam pattern set, ex: a set = {ant1_beam=1, ant2_beam=3}*/
  83. u8 beam_set_train_cnt[SUPPORT_BEAM_SET_PATTERN_NUM]; /*@training pkt num of each beam set*/
  84. u32 beam_set_rssi_avg_sum[SUPPORT_BEAM_SET_PATTERN_NUM]; /*@RSSI_sum of avg(pathA,pathB) for each beam-set)*/
  85. u32 beam_path_rssi_sum[SUPPORT_BEAM_SET_PATTERN_NUM][MAX_PATH_NUM_8822B];/*@RSSI_sum of each path for each beam-set)*/
  86. u8 beam_set_avg_evm_2ss_pre[SUPPORT_BEAM_SET_PATTERN_NUM];
  87. u32 beam_path_evm_2ss_sum[SUPPORT_BEAM_SET_PATTERN_NUM][MAX_PATH_NUM_8822B];/*@2SS evm_sum of each path for each beam-set)*/
  88. u32 beam_path_evm_2ss_cnt[SUPPORT_BEAM_SET_PATTERN_NUM];
  89. u8 beam_set_avg_evm_1ss_pre[SUPPORT_BEAM_SET_PATTERN_NUM];
  90. u32 beam_path_evm_1ss_sum[SUPPORT_BEAM_SET_PATTERN_NUM];/*@1SS evm_sum of each path for each beam-set)*/
  91. u32 beam_path_evm_1ss_cnt[SUPPORT_BEAM_SET_PATTERN_NUM];
  92. u32 statistic_pkt_cnt[SUPPORT_BEAM_SET_PATTERN_NUM]; /*@statistic_pkt_cnt for SmtAnt make decision*/
  93. u8 total_beam_set_num; /*@number of beam set can be switched*/
  94. u8 total_beam_set_num_2g;/*@number of beam set can be switched in 2G*/
  95. u8 total_beam_set_num_5g;/*@number of beam set can be switched in 5G*/
  96. u8 rfu_codeword_table_2g[SUPPORT_BEAM_SET_PATTERN_NUM][MAX_PATH_NUM_8822B]; /*@2G beam truth table*/
  97. u8 rfu_codeword_table_5g[SUPPORT_BEAM_SET_PATTERN_NUM][MAX_PATH_NUM_8822B]; /*@5G beam truth table*/
  98. u8 rx_idle_beam_set_idx; /*the filanl decsion result*/
  99. #endif
  100. };
  101. #endif /*@#if (defined(CONFIG_HL_SMART_ANTENNA))*/
  102. struct smt_ant {
  103. u8 smt_ant_vendor;
  104. u8 smt_ant_type;
  105. u8 tx_desc_mode; /*@0:3 bit mode, 1:2 bit mode*/
  106. #if (defined(CONFIG_CUMITEK_SMART_ANTENNA))
  107. struct smt_ant_cumitek cumi_smtant_table;
  108. #endif
  109. };
  110. #if (defined(CONFIG_CUMITEK_SMART_ANTENNA))
  111. void phydm_cumitek_smt_tx_ant_update(
  112. void *dm_void,
  113. u8 tx_ant_idx_path_a,
  114. u8 tx_ant_idx_path_b,
  115. u32 mac_id);
  116. void phydm_cumitek_smt_rx_default_ant_update(
  117. void *dm_void,
  118. u8 rx_ant_idx_path_a,
  119. u8 rx_ant_idx_path_b);
  120. void phydm_cumitek_smt_ant_debug(
  121. void *dm_void,
  122. char input[][16],
  123. u32 *_used,
  124. char *output,
  125. u32 *_out_len);
  126. #endif
  127. #if (defined(CONFIG_HL_SMART_ANTENNA))
  128. #if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
  129. void phydm_beam_switch_workitem_callback(
  130. void *context);
  131. void phydm_beam_decision_workitem_callback(
  132. void *context);
  133. #endif /*@#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)*/
  134. #ifdef CONFIG_HL_SMART_ANTENNA_TYPE2
  135. void phydm_hl_smart_ant_type2_init_8822b(
  136. void *dm_void);
  137. void phydm_update_beam_pattern_type2(
  138. void *dm_void,
  139. u32 codeword,
  140. u32 codeword_length);
  141. void phydm_set_rfu_beam_pattern_type2(
  142. void *dm_void);
  143. void phydm_hl_smt_ant_dbg_type2(
  144. void *dm_void,
  145. char input[][16],
  146. u32 *_used,
  147. char *output,
  148. u32 *_out_len);
  149. void phydm_process_rssi_for_hb_smtant_type2(
  150. void *dm_void,
  151. void *phy_info_void,
  152. void *pkt_info_void,
  153. u8 rssi_avg);
  154. #endif /*@#if (defined(CONFIG_HL_SMART_ANTENNA_TYPE2))*/
  155. #if (defined(CONFIG_HL_SMART_ANTENNA_TYPE1))
  156. void phydm_update_beam_pattern(
  157. void *dm_void,
  158. u32 codeword,
  159. u32 codeword_length);
  160. void phydm_set_all_ant_same_beam_num(
  161. void *dm_void);
  162. void phydm_hl_smart_ant_debug(
  163. void *dm_void,
  164. char input[][16],
  165. u32 *_used,
  166. char *output,
  167. u32 *_out_len);
  168. #endif /*@#if (defined(CONFIG_HL_SMART_ANTENNA_TYPE1))*/
  169. #endif /*@#if (defined(CONFIG_HL_SMART_ANTENNA))*/
  170. void phydm_smt_ant_init(void *dm_void);
  171. #endif /*@#if (defined(CONFIG_SMART_ANTENNA))*/
  172. #endif