Hal8192CPhyCfg.h 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  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. /*****************************************************************************
  21. * Module: __INC_HAL8192CPHYCFG_H
  22. *
  23. *
  24. * Note:
  25. *
  26. *
  27. * Export: Constants, macro, functions(API), global variables(None).
  28. *
  29. * Abbrev:
  30. *
  31. * History:
  32. * Data Who Remark
  33. * 08/07/2007 MHC 1. Porting from 9x series PHYCFG.h.
  34. * 2. Reorganize code architecture.
  35. *
  36. *****************************************************************************/
  37. /* Check to see if the file has been included already. */
  38. #ifndef __INC_HAL8192CPHYCFG_H
  39. #define __INC_HAL8192CPHYCFG_H
  40. /*--------------------------Define Parameters-------------------------------*/
  41. #define LOOP_LIMIT 5
  42. #define MAX_STALL_TIME 50 //us
  43. #define AntennaDiversityValue 0x80 //(Adapter->bSoftwareAntennaDiversity ? 0x00:0x80)
  44. #define MAX_TXPWR_IDX_NMODE_92S 63
  45. #define Reset_Cnt_Limit 3
  46. #ifdef CONFIG_PCI_HCI
  47. #define MAX_AGGR_NUM 0x0A0A
  48. #else
  49. #define MAX_AGGR_NUM 0x0909
  50. #endif
  51. #ifdef CONFIG_PCI_HCI
  52. #define SET_RTL8192SE_RF_SLEEP(_pAdapter) \
  53. { \
  54. u1Byte u1bTmp; \
  55. u1bTmp = PlatformEFIORead1Byte(_pAdapter, REG_LDOV12D_CTRL); \
  56. u1bTmp |= BIT0; \
  57. PlatformEFIOWrite1Byte(_pAdapter, REG_LDOV12D_CTRL, u1bTmp); \
  58. PlatformEFIOWrite1Byte(_pAdapter, REG_SPS_OCP_CFG, 0x0); \
  59. PlatformEFIOWrite1Byte(_pAdapter, TXPAUSE, 0xFF); \
  60. PlatformEFIOWrite2Byte(_pAdapter, CMDR, 0x57FC); \
  61. delay_us(100); \
  62. PlatformEFIOWrite2Byte(_pAdapter, CMDR, 0x77FC); \
  63. PlatformEFIOWrite1Byte(_pAdapter, PHY_CCA, 0x0); \
  64. delay_us(10); \
  65. PlatformEFIOWrite2Byte(_pAdapter, CMDR, 0x37FC); \
  66. delay_us(10); \
  67. PlatformEFIOWrite2Byte(_pAdapter, CMDR, 0x77FC); \
  68. delay_us(10); \
  69. PlatformEFIOWrite2Byte(_pAdapter, CMDR, 0x57FC); \
  70. }
  71. #endif
  72. /*--------------------------Define Parameters-------------------------------*/
  73. /*------------------------------Define structure----------------------------*/
  74. /* BB/RF related */
  75. /*------------------------------Define structure----------------------------*/
  76. /*------------------------Export global variable----------------------------*/
  77. /*------------------------Export global variable----------------------------*/
  78. /*------------------------Export Marco Definition---------------------------*/
  79. /*------------------------Export Marco Definition---------------------------*/
  80. /*--------------------------Exported Function prototype---------------------*/
  81. //
  82. // BB and RF register read/write
  83. //
  84. u32 PHY_QueryBBReg8192C( IN PADAPTER Adapter,
  85. IN u32 RegAddr,
  86. IN u32 BitMask );
  87. void PHY_SetBBReg8192C( IN PADAPTER Adapter,
  88. IN u32 RegAddr,
  89. IN u32 BitMask,
  90. IN u32 Data );
  91. u32 PHY_QueryRFReg8192C( IN PADAPTER Adapter,
  92. IN u8 eRFPath,
  93. IN u32 RegAddr,
  94. IN u32 BitMask );
  95. void PHY_SetRFReg8192C( IN PADAPTER Adapter,
  96. IN u8 eRFPath,
  97. IN u32 RegAddr,
  98. IN u32 BitMask,
  99. IN u32 Data );
  100. //
  101. // Initialization related function
  102. //
  103. /* MAC/BB/RF HAL config */
  104. int PHY_MACConfig8192C( IN PADAPTER Adapter );
  105. int PHY_BBConfig8192C( IN PADAPTER Adapter );
  106. int PHY_RFConfig8192C( IN PADAPTER Adapter );
  107. /* RF config */
  108. int rtl8192c_PHY_ConfigRFWithParaFile( IN PADAPTER Adapter,
  109. IN u8* pFileName,
  110. IN u8 eRFPath);
  111. int rtl8192c_PHY_ConfigRFWithHeaderFile( IN PADAPTER Adapter,
  112. IN u8 eRFPath);
  113. /* BB/RF readback check for making sure init OK */
  114. int rtl8192c_PHY_CheckBBAndRFOK( IN PADAPTER Adapter,
  115. IN HW_BLOCK_E CheckBlock,
  116. IN u8 eRFPath );
  117. /* Read initi reg value for tx power setting. */
  118. void rtl8192c_PHY_GetHWRegOriginalValue( IN PADAPTER Adapter );
  119. //
  120. // RF Power setting
  121. //
  122. //extern BOOLEAN PHY_SetRFPowerState(IN PADAPTER Adapter,
  123. // IN RT_RF_POWER_STATE eRFPowerState);
  124. //
  125. // BB TX Power R/W
  126. //
  127. void PHY_GetTxPowerLevel8192C( IN PADAPTER Adapter,
  128. OUT u32* powerlevel );
  129. void PHY_SetTxPowerLevel8192C( IN PADAPTER Adapter,
  130. IN u8 channel );
  131. BOOLEAN PHY_UpdateTxPowerDbm8192C( IN PADAPTER Adapter,
  132. IN int powerInDbm );
  133. //
  134. VOID
  135. PHY_ScanOperationBackup8192C(IN PADAPTER Adapter,
  136. IN u8 Operation );
  137. //
  138. // Switch bandwidth for 8192S
  139. //
  140. //extern void PHY_SetBWModeCallback8192C( IN PRT_TIMER pTimer );
  141. void PHY_SetBWMode8192C( IN PADAPTER pAdapter,
  142. IN CHANNEL_WIDTH ChnlWidth,
  143. IN unsigned char Offset );
  144. //
  145. // Set FW CMD IO for 8192S.
  146. //
  147. //extern BOOLEAN HalSetIO8192C( IN PADAPTER Adapter,
  148. // IN IO_TYPE IOType);
  149. //
  150. // Set A2 entry to fw for 8192S
  151. //
  152. extern void FillA2Entry8192C( IN PADAPTER Adapter,
  153. IN u8 index,
  154. IN u8* val);
  155. //
  156. // channel switch related funciton
  157. //
  158. //extern void PHY_SwChnlCallback8192C( IN PRT_TIMER pTimer );
  159. void PHY_SwChnl8192C( IN PADAPTER pAdapter,
  160. IN u8 channel );
  161. VOID
  162. PHY_SetSwChnlBWMode8192C(
  163. IN PADAPTER Adapter,
  164. IN u8 channel,
  165. IN CHANNEL_WIDTH Bandwidth,
  166. IN u8 Offset40,
  167. IN u8 Offset80
  168. );
  169. //
  170. // BB/MAC/RF other monitor API
  171. //
  172. void PHY_SetMonitorMode8192C(IN PADAPTER pAdapter,
  173. IN BOOLEAN bEnableMonitorMode );
  174. BOOLEAN PHY_CheckIsLegalRfPath8192C(IN PADAPTER pAdapter,
  175. IN u32 eRFPath );
  176. VOID rtl8192c_PHY_SetRFPathSwitch(IN PADAPTER pAdapter, IN BOOLEAN bMain);
  177. //
  178. // Modify the value of the hw register when beacon interval be changed.
  179. //
  180. void
  181. rtl8192c_PHY_SetBeaconHwReg( IN PADAPTER Adapter,
  182. IN u16 BeaconInterval );
  183. extern VOID
  184. PHY_SwitchEphyParameter(
  185. IN PADAPTER Adapter
  186. );
  187. extern VOID
  188. PHY_EnableHostClkReq(
  189. IN PADAPTER Adapter
  190. );
  191. BOOLEAN
  192. SetAntennaConfig92C(
  193. IN PADAPTER Adapter,
  194. IN u8 DefaultAnt
  195. );
  196. #ifdef RTL8192C_RECONFIG_TO_1T1R
  197. extern void PHY_Reconfig_To_1T1R(_adapter *padapter);
  198. #endif
  199. /*--------------------------Exported Function prototype---------------------*/
  200. #endif // __INC_HAL8192CPHYCFG_H