hal_phy.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  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. /*--------------------------Define Parameters-------------------------------*/
  42. typedef enum _BAND_TYPE{
  43. BAND_ON_2_4G = 0,
  44. BAND_ON_5G,
  45. BAND_ON_BOTH,
  46. BANDMAX
  47. }BAND_TYPE,*PBAND_TYPE;
  48. typedef enum _RF_TYPE{
  49. RF_TYPE_MIN = 0, // 0
  50. RF_8225=1, // 1 11b/g RF for verification only
  51. RF_8256=2, // 2 11b/g/n
  52. RF_8258=3, // 3 11a/b/g/n RF
  53. RF_6052=4, // 4 11b/g/n RF
  54. RF_PSEUDO_11N=5, // 5, It is a temporality RF.
  55. RF_TYPE_MAX
  56. }RF_TYPE_E,*PRF_TYPE_E;
  57. typedef enum _RF_PATH{
  58. RF_PATH_A = 0,
  59. RF_PATH_B,
  60. RF_PATH_C,
  61. RF_PATH_D
  62. }RF_PATH, *PRF_PATH;
  63. #define TX_1S 0
  64. #define TX_2S 1
  65. #define TX_3S 2
  66. #define TX_4S 3
  67. #define RF_PATH_MAX_92C_88E 2
  68. #define RF_PATH_MAX_90_8812 4 //Max RF number 90 support
  69. typedef enum _ANTENNA_PATH{
  70. ANTENNA_NONE = 0,
  71. ANTENNA_D = 1,
  72. ANTENNA_C = 2,
  73. ANTENNA_CD = 3,
  74. ANTENNA_B = 4,
  75. ANTENNA_BD = 5,
  76. ANTENNA_BC = 6,
  77. ANTENNA_BCD = 7,
  78. ANTENNA_A = 8,
  79. ANTENNA_AD = 9,
  80. ANTENNA_AC = 10,
  81. ANTENNA_ACD = 11,
  82. ANTENNA_AB = 12,
  83. ANTENNA_ABD = 13,
  84. ANTENNA_ABC = 14,
  85. ANTENNA_ABCD = 15
  86. } ANTENNA_PATH;
  87. typedef enum _RF_CONTENT{
  88. radioa_txt = 0x1000,
  89. radiob_txt = 0x1001,
  90. radioc_txt = 0x1002,
  91. radiod_txt = 0x1003
  92. } RF_CONTENT;
  93. typedef enum _BaseBand_Config_Type{
  94. BaseBand_Config_PHY_REG = 0, //Radio Path A
  95. BaseBand_Config_AGC_TAB = 1, //Radio Path B
  96. BaseBand_Config_AGC_TAB_2G = 2,
  97. BaseBand_Config_AGC_TAB_5G = 3,
  98. BaseBand_Config_PHY_REG_PG
  99. }BaseBand_Config_Type, *PBaseBand_Config_Type;
  100. typedef enum _HW_BLOCK{
  101. HW_BLOCK_MAC = 0,
  102. HW_BLOCK_PHY0 = 1,
  103. HW_BLOCK_PHY1 = 2,
  104. HW_BLOCK_RF = 3,
  105. HW_BLOCK_MAXIMUM = 4, // Never use this
  106. }HW_BLOCK_E, *PHW_BLOCK_E;
  107. typedef enum _WIRELESS_MODE {
  108. WIRELESS_MODE_UNKNOWN = 0x00,
  109. WIRELESS_MODE_A = 0x01,
  110. WIRELESS_MODE_B = 0x02,
  111. WIRELESS_MODE_G = 0x04,
  112. WIRELESS_MODE_AUTO = 0x08,
  113. WIRELESS_MODE_N_24G = 0x10,
  114. WIRELESS_MODE_N_5G = 0x20,
  115. WIRELESS_MODE_AC_5G = 0x40
  116. } WIRELESS_MODE;
  117. typedef enum _SwChnlCmdID{
  118. CmdID_End,
  119. CmdID_SetTxPowerLevel,
  120. CmdID_BBRegWrite10,
  121. CmdID_WritePortUlong,
  122. CmdID_WritePortUshort,
  123. CmdID_WritePortUchar,
  124. CmdID_RF_WriteReg,
  125. }SwChnlCmdID;
  126. typedef struct _SwChnlCmd{
  127. SwChnlCmdID CmdID;
  128. u32 Para1;
  129. u32 Para2;
  130. u32 msDelay;
  131. }SwChnlCmd;
  132. typedef struct _R_ANTENNA_SELECT_OFDM{
  133. u32 r_tx_antenna:4;
  134. u32 r_ant_l:4;
  135. u32 r_ant_non_ht:4;
  136. u32 r_ant_ht1:4;
  137. u32 r_ant_ht2:4;
  138. u32 r_ant_ht_s1:4;
  139. u32 r_ant_non_ht_s1:4;
  140. u32 OFDM_TXSC:2;
  141. u32 Reserved:2;
  142. }R_ANTENNA_SELECT_OFDM;
  143. typedef struct _R_ANTENNA_SELECT_CCK{
  144. u8 r_cckrx_enable_2:2;
  145. u8 r_cckrx_enable:2;
  146. u8 r_ccktx_enable:4;
  147. }R_ANTENNA_SELECT_CCK;
  148. typedef struct RF_Shadow_Compare_Map {
  149. // Shadow register value
  150. u32 Value;
  151. // Compare or not flag
  152. u8 Compare;
  153. // Record If it had ever modified unpredicted
  154. u8 ErrorOrNot;
  155. // Recorver Flag
  156. u8 Recorver;
  157. //
  158. u8 Driver_Write;
  159. }RF_SHADOW_T;
  160. /*--------------------------Exported Function prototype---------------------*/
  161. u32
  162. PHY_CalculateBitShift(
  163. u32 BitMask
  164. );
  165. u32
  166. PHY_RFShadowRead(
  167. IN PADAPTER Adapter,
  168. IN u8 eRFPath,
  169. IN u32 Offset);
  170. VOID
  171. PHY_RFShadowWrite(
  172. IN PADAPTER Adapter,
  173. IN u8 eRFPath,
  174. IN u32 Offset,
  175. IN u32 Data);
  176. BOOLEAN
  177. PHY_RFShadowCompare(
  178. IN PADAPTER Adapter,
  179. IN u8 eRFPath,
  180. IN u32 Offset);
  181. VOID
  182. PHY_RFShadowRecorver(
  183. IN PADAPTER Adapter,
  184. IN u8 eRFPath,
  185. IN u32 Offset);
  186. VOID
  187. PHY_RFShadowCompareAll(
  188. IN PADAPTER Adapter);
  189. VOID
  190. PHY_RFShadowRecorverAll(
  191. IN PADAPTER Adapter);
  192. VOID
  193. PHY_RFShadowCompareFlagSet(
  194. IN PADAPTER Adapter,
  195. IN u8 eRFPath,
  196. IN u32 Offset,
  197. IN u8 Type);
  198. VOID
  199. PHY_RFShadowRecorverFlagSet(
  200. IN PADAPTER Adapter,
  201. IN u8 eRFPath,
  202. IN u32 Offset,
  203. IN u8 Type);
  204. VOID
  205. PHY_RFShadowCompareFlagSetAll(
  206. IN PADAPTER Adapter);
  207. VOID
  208. PHY_RFShadowRecorverFlagSetAll(
  209. IN PADAPTER Adapter);
  210. VOID
  211. PHY_RFShadowRefresh(
  212. IN PADAPTER Adapter);
  213. #endif //__HAL_COMMON_H__