Hal8188EPhyCfg.h 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  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 __INC_HAL8188EPHYCFG_H__
  21. #define __INC_HAL8188EPHYCFG_H__
  22. /*--------------------------Define Parameters-------------------------------*/
  23. #define LOOP_LIMIT 5
  24. #define MAX_STALL_TIME 50 /* us */
  25. #define AntennaDiversityValue 0x80
  26. #define MAX_TXPWR_IDX_NMODE_92S 63
  27. #define Reset_Cnt_Limit 3
  28. #define IQK_MAC_REG_NUM 4
  29. #define IQK_ADDA_REG_NUM 16
  30. #define IQK_BB_REG_NUM 9
  31. #define HP_THERMAL_NUM 8
  32. #define MAX_AGGR_NUM 0x07
  33. /*--------------------------Define Parameters-------------------------------*/
  34. /*------------------------------Define structure----------------------------*/
  35. enum sw_chnl_cmd_id {
  36. CmdID_End,
  37. CmdID_SetTxPowerLevel,
  38. CmdID_BBRegWrite10,
  39. CmdID_WritePortUlong,
  40. CmdID_WritePortUshort,
  41. CmdID_WritePortUchar,
  42. CmdID_RF_WriteReg,
  43. };
  44. /* 1. Switch channel related */
  45. struct sw_chnl_cmd {
  46. enum sw_chnl_cmd_id CmdID;
  47. u32 Para1;
  48. u32 Para2;
  49. u32 msDelay;
  50. };
  51. enum hw90_block {
  52. HW90_BLOCK_MAC = 0,
  53. HW90_BLOCK_PHY0 = 1,
  54. HW90_BLOCK_PHY1 = 2,
  55. HW90_BLOCK_RF = 3,
  56. HW90_BLOCK_MAXIMUM = 4, /* Never use this */
  57. };
  58. enum rf_radio_path {
  59. RF_PATH_A = 0, /* Radio Path A */
  60. RF_PATH_B = 1, /* Radio Path B */
  61. RF_PATH_C = 2, /* Radio Path C */
  62. RF_PATH_D = 3, /* Radio Path D */
  63. };
  64. #define MAX_PG_GROUP 13
  65. #define RF_PATH_MAX 3
  66. #define MAX_RF_PATH RF_PATH_MAX
  67. #define MAX_TX_COUNT 4 /* path numbers */
  68. #define CHANNEL_MAX_NUMBER 14 /* 14 is the max chnl number */
  69. #define MAX_CHNL_GROUP_24G 6 /* ch1~2, ch3~5, ch6~8,
  70. *ch9~11, ch12~13, CH 14
  71. * total three groups */
  72. #define CHANNEL_GROUP_MAX_88E 6
  73. enum wireless_mode {
  74. WIRELESS_MODE_UNKNOWN = 0x00,
  75. WIRELESS_MODE_A = BIT(2),
  76. WIRELESS_MODE_B = BIT(0),
  77. WIRELESS_MODE_G = BIT(1),
  78. WIRELESS_MODE_AUTO = BIT(5),
  79. WIRELESS_MODE_N_24G = BIT(3),
  80. WIRELESS_MODE_N_5G = BIT(4),
  81. WIRELESS_MODE_AC = BIT(6)
  82. };
  83. enum phy_rate_tx_offset_area {
  84. RA_OFFSET_LEGACY_OFDM1,
  85. RA_OFFSET_LEGACY_OFDM2,
  86. RA_OFFSET_HT_OFDM1,
  87. RA_OFFSET_HT_OFDM2,
  88. RA_OFFSET_HT_OFDM3,
  89. RA_OFFSET_HT_OFDM4,
  90. RA_OFFSET_HT_CCK,
  91. };
  92. /* BB/RF related */
  93. enum RF_TYPE_8190P {
  94. RF_TYPE_MIN, /* 0 */
  95. RF_8225 = 1, /* 1 11b/g RF for verification only */
  96. RF_8256 = 2, /* 2 11b/g/n */
  97. RF_8258 = 3, /* 3 11a/b/g/n RF */
  98. RF_6052 = 4, /* 4 11b/g/n RF */
  99. /* TODO: We should remove this psudo PHY RF after we get new RF. */
  100. RF_PSEUDO_11N = 5, /* 5, It is a temporality RF. */
  101. };
  102. struct bb_reg_def {
  103. u32 rfintfs; /* set software control: */
  104. /* 0x870~0x877[8 bytes] */
  105. u32 rfintfi; /* readback data: */
  106. /* 0x8e0~0x8e7[8 bytes] */
  107. u32 rfintfo; /* output data: */
  108. /* 0x860~0x86f [16 bytes] */
  109. u32 rfintfe; /* output enable: */
  110. /* 0x860~0x86f [16 bytes] */
  111. u32 rf3wireOffset; /* LSSI data: */
  112. /* 0x840~0x84f [16 bytes] */
  113. u32 rfLSSI_Select; /* BB Band Select: */
  114. /* 0x878~0x87f [8 bytes] */
  115. u32 rfTxGainStage; /* Tx gain stage: */
  116. /* 0x80c~0x80f [4 bytes] */
  117. u32 rfHSSIPara1; /* wire parameter control1 : */
  118. /* 0x820~0x823,0x828~0x82b,
  119. * 0x830~0x833, 0x838~0x83b [16 bytes] */
  120. u32 rfHSSIPara2; /* wire parameter control2 : */
  121. /* 0x824~0x827,0x82c~0x82f, 0x834~0x837,
  122. * 0x83c~0x83f [16 bytes] */
  123. u32 rfSwitchControl; /* Tx Rx antenna control : */
  124. /* 0x858~0x85f [16 bytes] */
  125. u32 rfAGCControl1; /* AGC parameter control1 : */
  126. /* 0xc50~0xc53,0xc58~0xc5b, 0xc60~0xc63,
  127. * 0xc68~0xc6b [16 bytes] */
  128. u32 rfAGCControl2; /* AGC parameter control2 : */
  129. /* 0xc54~0xc57,0xc5c~0xc5f, 0xc64~0xc67,
  130. * 0xc6c~0xc6f [16 bytes] */
  131. u32 rfRxIQImbalance; /* OFDM Rx IQ imbalance matrix : */
  132. /* 0xc14~0xc17,0xc1c~0xc1f, 0xc24~0xc27,
  133. * 0xc2c~0xc2f [16 bytes] */
  134. u32 rfRxAFE; /* Rx IQ DC ofset and Rx digital filter,
  135. * Rx DC notch filter : */
  136. /* 0xc10~0xc13,0xc18~0xc1b, 0xc20~0xc23,
  137. * 0xc28~0xc2b [16 bytes] */
  138. u32 rfTxIQImbalance; /* OFDM Tx IQ imbalance matrix */
  139. /* 0xc80~0xc83,0xc88~0xc8b, 0xc90~0xc93,
  140. * 0xc98~0xc9b [16 bytes] */
  141. u32 rfTxAFE; /* Tx IQ DC Offset and Tx DFIR type */
  142. /* 0xc84~0xc87,0xc8c~0xc8f, 0xc94~0xc97,
  143. * 0xc9c~0xc9f [16 bytes] */
  144. u32 rfLSSIReadBack; /* LSSI RF readback data SI mode */
  145. /* 0x8a0~0x8af [16 bytes] */
  146. u32 rfLSSIReadBackPi; /* LSSI RF readback data PI mode 0x8b8-8bc for
  147. * Path A and B */
  148. };
  149. struct ant_sel_ofdm {
  150. u32 r_tx_antenna:4;
  151. u32 r_ant_l:4;
  152. u32 r_ant_non_ht:4;
  153. u32 r_ant_ht1:4;
  154. u32 r_ant_ht2:4;
  155. u32 r_ant_ht_s1:4;
  156. u32 r_ant_non_ht_s1:4;
  157. u32 OFDM_TXSC:2;
  158. u32 reserved:2;
  159. };
  160. struct ant_sel_cck {
  161. u8 r_cckrx_enable_2:2;
  162. u8 r_cckrx_enable:2;
  163. u8 r_ccktx_enable:4;
  164. };
  165. /*------------------------------Define structure----------------------------*/
  166. /*------------------------Export global variable----------------------------*/
  167. /*------------------------Export global variable----------------------------*/
  168. /*------------------------Export Marco Definition---------------------------*/
  169. /*------------------------Export Marco Definition---------------------------*/
  170. /*--------------------------Exported Function prototype---------------------*/
  171. /* */
  172. /* BB and RF register read/write */
  173. /* */
  174. /* Read initi reg value for tx power setting. */
  175. void rtl8192c_PHY_GetHWRegOriginalValue(struct adapter *adapter);
  176. /* BB TX Power R/W */
  177. void PHY_GetTxPowerLevel8188E(struct adapter *adapter, u32 *powerlevel);
  178. void PHY_ScanOperationBackup8188E(struct adapter *Adapter, u8 Operation);
  179. /* Call after initialization */
  180. void ChkFwCmdIoDone(struct adapter *adapter);
  181. /* BB/MAC/RF other monitor API */
  182. void PHY_SetRFPathSwitch_8188E(struct adapter *adapter, bool main);
  183. void PHY_SwitchEphyParameter(struct adapter *adapter);
  184. void PHY_EnableHostClkReq(struct adapter *adapter);
  185. bool SetAntennaConfig92C(struct adapter *adapter, u8 defaultant);
  186. /*--------------------------Exported Function prototype---------------------*/
  187. #define PHY_SetMacReg PHY_SetBBReg
  188. #define SIC_HW_SUPPORT 0
  189. #define SIC_MAX_POLL_CNT 5
  190. #define SIC_CMD_READY 0
  191. #define SIC_CMD_WRITE 1
  192. #define SIC_CMD_READ 2
  193. #define SIC_CMD_REG 0x1EB /* 1byte */
  194. #define SIC_ADDR_REG 0x1E8 /* 1b9~1ba, 2 bytes */
  195. #define SIC_DATA_REG 0x1EC /* 1bc~1bf */
  196. #endif /* __INC_HAL8192CPHYCFG_H */