hal_phy.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  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 __HAL_PHY_H__
  21. #define __HAL_PHY_H__
  22. #if DISABLE_BB_RF
  23. #define HAL_FW_ENABLE 0
  24. #define HAL_MAC_ENABLE 0
  25. #define HAL_BB_ENABLE 0
  26. #define HAL_RF_ENABLE 0
  27. #else /* FPGA_PHY and ASIC */
  28. #define HAL_FW_ENABLE 1
  29. #define HAL_MAC_ENABLE 1
  30. #define HAL_BB_ENABLE 1
  31. #define HAL_RF_ENABLE 1
  32. #endif
  33. #define RF6052_MAX_TX_PWR 0x3F
  34. #define RF6052_MAX_REG_88E 0xFF
  35. #define RF6052_MAX_REG_92C 0x7F
  36. #define RF6052_MAX_REG \
  37. ((RF6052_MAX_REG_88E > RF6052_MAX_REG_92C) ? RF6052_MAX_REG_88E : RF6052_MAX_REG_92C)
  38. #define GET_RF6052_REAL_MAX_REG(_Adapter) \
  39. (IS_HARDWARE_TYPE_8188E(_Adapter) ? RF6052_MAX_REG_88E : RF6052_MAX_REG_92C)
  40. #define RF6052_MAX_PATH 2
  41. /*
  42. * Antenna detection method, i.e., using single tone detection or RSSI reported from each antenna detected.
  43. * Added by Roger, 2013.05.22.
  44. * */
  45. #define ANT_DETECT_BY_SINGLE_TONE BIT0
  46. #define ANT_DETECT_BY_RSSI BIT1
  47. #define IS_ANT_DETECT_SUPPORT_SINGLE_TONE(__Adapter) ((GET_HAL_DATA(__Adapter)->AntDetection) & ANT_DETECT_BY_SINGLE_TONE)
  48. #define IS_ANT_DETECT_SUPPORT_RSSI(__Adapter) ((GET_HAL_DATA(__Adapter)->AntDetection) & ANT_DETECT_BY_RSSI)
  49. /*--------------------------Define Parameters-------------------------------*/
  50. typedef enum _RF_TYPE {
  51. RF_TYPE_MIN = 0, /* 0 */
  52. RF_8225 = 1, /* 1 11b/g RF for verification only */
  53. RF_8256 = 2, /* 2 11b/g/n */
  54. RF_8258 = 3, /* 3 11a/b/g/n RF */
  55. RF_6052 = 4, /* 4 11b/g/n RF */
  56. RF_PSEUDO_11N = 5, /* 5, It is a temporality RF. */
  57. RF_TYPE_MAX
  58. } RF_TYPE_E, *PRF_TYPE_E;
  59. #define TX_1S 0
  60. #define TX_2S 1
  61. #define TX_3S 2
  62. #define TX_4S 3
  63. typedef enum _ANTENNA_PATH {
  64. ANTENNA_NONE = 0,
  65. ANTENNA_D = 1,
  66. ANTENNA_C = 2,
  67. ANTENNA_CD = 3,
  68. ANTENNA_B = 4,
  69. ANTENNA_BD = 5,
  70. ANTENNA_BC = 6,
  71. ANTENNA_BCD = 7,
  72. ANTENNA_A = 8,
  73. ANTENNA_AD = 9,
  74. ANTENNA_AC = 10,
  75. ANTENNA_ACD = 11,
  76. ANTENNA_AB = 12,
  77. ANTENNA_ABD = 13,
  78. ANTENNA_ABC = 14,
  79. ANTENNA_ABCD = 15
  80. } ANTENNA_PATH;
  81. typedef enum _RF_CONTENT {
  82. radioa_txt = 0x1000,
  83. radiob_txt = 0x1001,
  84. radioc_txt = 0x1002,
  85. radiod_txt = 0x1003
  86. } RF_CONTENT;
  87. typedef enum _BaseBand_Config_Type {
  88. BaseBand_Config_PHY_REG = 0, /* Radio Path A */
  89. BaseBand_Config_AGC_TAB = 1, /* Radio Path B */
  90. BaseBand_Config_AGC_TAB_2G = 2,
  91. BaseBand_Config_AGC_TAB_5G = 3,
  92. BaseBand_Config_PHY_REG_PG
  93. } BaseBand_Config_Type, *PBaseBand_Config_Type;
  94. typedef enum _HW_BLOCK {
  95. HW_BLOCK_MAC = 0,
  96. HW_BLOCK_PHY0 = 1,
  97. HW_BLOCK_PHY1 = 2,
  98. HW_BLOCK_RF = 3,
  99. HW_BLOCK_MAXIMUM = 4, /* Never use this */
  100. } HW_BLOCK_E, *PHW_BLOCK_E;
  101. typedef enum _WIRELESS_MODE {
  102. WIRELESS_MODE_UNKNOWN = 0x00,
  103. WIRELESS_MODE_A = 0x01,
  104. WIRELESS_MODE_B = 0x02,
  105. WIRELESS_MODE_G = 0x04,
  106. WIRELESS_MODE_AUTO = 0x08,
  107. WIRELESS_MODE_N_24G = 0x10,
  108. WIRELESS_MODE_N_5G = 0x20,
  109. WIRELESS_MODE_AC_5G = 0x40,
  110. WIRELESS_MODE_AC_24G = 0x80,
  111. WIRELESS_MODE_AC_ONLY = 0x100,
  112. } WIRELESS_MODE;
  113. typedef enum _SwChnlCmdID {
  114. CmdID_End,
  115. CmdID_SetTxPowerLevel,
  116. CmdID_BBRegWrite10,
  117. CmdID_WritePortUlong,
  118. CmdID_WritePortUshort,
  119. CmdID_WritePortUchar,
  120. CmdID_RF_WriteReg,
  121. } SwChnlCmdID;
  122. typedef struct _SwChnlCmd {
  123. SwChnlCmdID CmdID;
  124. u32 Para1;
  125. u32 Para2;
  126. u32 msDelay;
  127. } SwChnlCmd;
  128. typedef struct _R_ANTENNA_SELECT_OFDM {
  129. u32 r_tx_antenna:4;
  130. u32 r_ant_l:4;
  131. u32 r_ant_non_ht:4;
  132. u32 r_ant_ht1:4;
  133. u32 r_ant_ht2:4;
  134. u32 r_ant_ht_s1:4;
  135. u32 r_ant_non_ht_s1:4;
  136. u32 OFDM_TXSC:2;
  137. u32 Reserved:2;
  138. } R_ANTENNA_SELECT_OFDM;
  139. typedef struct _R_ANTENNA_SELECT_CCK {
  140. u8 r_cckrx_enable_2:2;
  141. u8 r_cckrx_enable:2;
  142. u8 r_ccktx_enable:4;
  143. } R_ANTENNA_SELECT_CCK;
  144. typedef struct RF_Shadow_Compare_Map {
  145. /* Shadow register value */
  146. u32 Value;
  147. /* Compare or not flag */
  148. u8 Compare;
  149. /* Record If it had ever modified unpredicted */
  150. u8 ErrorOrNot;
  151. /* Recorver Flag */
  152. u8 Recorver;
  153. /* */
  154. u8 Driver_Write;
  155. } RF_SHADOW_T;
  156. /*--------------------------Exported Function prototype---------------------*/
  157. u32
  158. PHY_CalculateBitShift(
  159. u32 BitMask
  160. );
  161. u32
  162. PHY_RFShadowRead(
  163. IN PADAPTER Adapter,
  164. IN u8 eRFPath,
  165. IN u32 Offset);
  166. VOID
  167. PHY_RFShadowWrite(
  168. IN PADAPTER Adapter,
  169. IN u8 eRFPath,
  170. IN u32 Offset,
  171. IN u32 Data);
  172. BOOLEAN
  173. PHY_RFShadowCompare(
  174. IN PADAPTER Adapter,
  175. IN u8 eRFPath,
  176. IN u32 Offset);
  177. VOID
  178. PHY_RFShadowRecorver(
  179. IN PADAPTER Adapter,
  180. IN u8 eRFPath,
  181. IN u32 Offset);
  182. VOID
  183. PHY_RFShadowCompareAll(
  184. IN PADAPTER Adapter);
  185. VOID
  186. PHY_RFShadowRecorverAll(
  187. IN PADAPTER Adapter);
  188. VOID
  189. PHY_RFShadowCompareFlagSet(
  190. IN PADAPTER Adapter,
  191. IN u8 eRFPath,
  192. IN u32 Offset,
  193. IN u8 Type);
  194. VOID
  195. PHY_RFShadowRecorverFlagSet(
  196. IN PADAPTER Adapter,
  197. IN u8 eRFPath,
  198. IN u32 Offset,
  199. IN u8 Type);
  200. VOID
  201. PHY_RFShadowCompareFlagSetAll(
  202. IN PADAPTER Adapter);
  203. VOID
  204. PHY_RFShadowRecorverFlagSetAll(
  205. IN PADAPTER Adapter);
  206. VOID
  207. PHY_RFShadowRefresh(
  208. IN PADAPTER Adapter);
  209. #endif /* __HAL_COMMON_H__ */