hal_phy.h 5.4 KB

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