Hal8192DPhyCfg.h 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  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. *
  22. * Module: __INC_HAL8192DPHYCFG_H
  23. *
  24. *
  25. * Note:
  26. *
  27. *
  28. * Export: Constants, macro, functions(API), global variables(None).
  29. *
  30. * Abbrev:
  31. *
  32. * History:
  33. * Data Who Remark
  34. * 08/07/2007 MHC 1. Porting from 9x series PHYCFG.h.
  35. * 2. Reorganize code architecture.
  36. *
  37. *****************************************************************************/
  38. /* Check to see if the file has been included already. */
  39. #ifndef __INC_HAL8192DPHYCFG_H
  40. #define __INC_HAL8192DPHYCFG_H
  41. /*--------------------------Define Parameters-------------------------------*/
  42. #define LOOP_LIMIT 5
  43. #define MAX_STALL_TIME 50 //us
  44. #define AntennaDiversityValue 0x80 //(Adapter->bSoftwareAntennaDiversity ? 0x00:0x80)
  45. #define MAX_TXPWR_IDX_NMODE_92S 63
  46. #define Reset_Cnt_Limit 3
  47. #ifdef CONFIG_PCI_HCI
  48. #define SET_RTL8192SE_RF_SLEEP(_pAdapter) \
  49. { \
  50. u1Byte u1bTmp; \
  51. u1bTmp = PlatformEFIORead1Byte(_pAdapter, REG_LDOV12D_CTRL); \
  52. u1bTmp |= BIT0; \
  53. PlatformEFIOWrite1Byte(_pAdapter, REG_LDOV12D_CTRL, u1bTmp); \
  54. PlatformEFIOWrite1Byte(_pAdapter, REG_SPS_OCP_CFG, 0x0); \
  55. PlatformEFIOWrite1Byte(_pAdapter, TXPAUSE, 0xFF); \
  56. PlatformEFIOWrite2Byte(_pAdapter, CMDR, 0x57FC); \
  57. delay_us(100); \
  58. PlatformEFIOWrite2Byte(_pAdapter, CMDR, 0x77FC); \
  59. PlatformEFIOWrite1Byte(_pAdapter, PHY_CCA, 0x0); \
  60. delay_us(10); \
  61. PlatformEFIOWrite2Byte(_pAdapter, CMDR, 0x37FC); \
  62. delay_us(10); \
  63. PlatformEFIOWrite2Byte(_pAdapter, CMDR, 0x77FC); \
  64. delay_us(10); \
  65. PlatformEFIOWrite2Byte(_pAdapter, CMDR, 0x57FC); \
  66. }
  67. #endif
  68. /*--------------------------Define Parameters-------------------------------*/
  69. /*------------------------------Define structure----------------------------*/
  70. #define CHANNEL_GROUP_MAX_2G 3
  71. #define CHANNEL_GROUP_IDX_5GL 3
  72. #define CHANNEL_GROUP_IDX_5GM 6
  73. #define CHANNEL_GROUP_IDX_5GH 9
  74. #define CHANNEL_GROUP_MAX_5G 9
  75. #define CHANNEL_MAX_NUMBER_2G 14
  76. typedef enum _MACPHY_MODE_CHANGE_ACTION{
  77. DMDP2DMSP = 0,
  78. DMSP2DMDP = 1,
  79. DMDP2SMSP = 2,
  80. SMSP2DMDP = 3,
  81. DMSP2SMSP = 4,
  82. SMSP2DMSP = 5,
  83. MAXACTION
  84. }MACPHY_MODE_CHANGE_ACTION,*PMACPHY_MODE_CHANGE_ACTION;
  85. /* BB/RF related */
  86. /*------------------------------Define structure----------------------------*/
  87. /*------------------------Export global variable----------------------------*/
  88. /*------------------------Export global variable----------------------------*/
  89. /*------------------------Export Marco Definition---------------------------*/
  90. /*--------------------------Exported Function prototype---------------------*/
  91. //
  92. // BB and RF register read/write
  93. //
  94. void PHY_SetBBReg1Byte8192D( IN PADAPTER Adapter,
  95. IN u32 RegAddr,
  96. IN u32 BitMask,
  97. IN u32 Data );
  98. u32 PHY_QueryBBReg8192D( IN PADAPTER Adapter,
  99. IN u32 RegAddr,
  100. IN u32 BitMask );
  101. void PHY_SetBBReg8192D( IN PADAPTER Adapter,
  102. IN u32 RegAddr,
  103. IN u32 BitMask,
  104. IN u32 Data );
  105. u32 PHY_QueryRFReg8192D( IN PADAPTER Adapter,
  106. IN u8 eRFPath,
  107. IN u32 RegAddr,
  108. IN u32 BitMask );
  109. void PHY_SetRFReg8192D( IN PADAPTER Adapter,
  110. IN u8 eRFPath,
  111. IN u32 RegAddr,
  112. IN u32 BitMask,
  113. IN u32 Data );
  114. //
  115. // Initialization related function
  116. //
  117. /* MAC/BB/RF HAL config */
  118. extern int PHY_MACConfig8192D( IN PADAPTER Adapter );
  119. extern int PHY_BBConfig8192D( IN PADAPTER Adapter );
  120. extern int PHY_RFConfig8192D( IN PADAPTER Adapter );
  121. /* RF config */
  122. int rtl8192d_PHY_ConfigRFWithParaFile( IN PADAPTER Adapter,
  123. IN u8* pFileName,
  124. IN u8 eRFPath);
  125. int rtl8192d_PHY_ConfigRFWithHeaderFile( IN PADAPTER Adapter,
  126. IN RF_CONTENT Content,
  127. IN u8 eRFPath);
  128. /* BB/RF readback check for making sure init OK */
  129. int rtl8192d_PHY_CheckBBAndRFOK( IN PADAPTER Adapter,
  130. IN HW_BLOCK_E CheckBlock,
  131. IN u8 eRFPath );
  132. /* Read initi reg value for tx power setting. */
  133. void rtl8192d_PHY_GetHWRegOriginalValue( IN PADAPTER Adapter );
  134. //
  135. // RF Power setting
  136. //
  137. //extern BOOLEAN PHY_SetRFPowerState(IN PADAPTER Adapter,
  138. // IN RT_RF_POWER_STATE eRFPowerState);
  139. //
  140. // BB TX Power R/W
  141. //
  142. void PHY_GetTxPowerLevel8192D( IN PADAPTER Adapter,
  143. OUT u32* powerlevel );
  144. void PHY_SetTxPowerLevel8192D( IN PADAPTER Adapter,
  145. IN u8 channel );
  146. BOOLEAN PHY_UpdateTxPowerDbm8192D( IN PADAPTER Adapter,
  147. IN int powerInDbm );
  148. //
  149. VOID
  150. PHY_ScanOperationBackup8192D(IN PADAPTER Adapter,
  151. IN u8 Operation );
  152. //
  153. // Switch bandwidth for 8192S
  154. //
  155. //void PHY_SetBWModeCallback8192C( IN PRT_TIMER pTimer );
  156. void PHY_SetBWMode8192D( IN PADAPTER pAdapter,
  157. IN CHANNEL_WIDTH ChnlWidth,
  158. IN unsigned char Offset );
  159. //
  160. // Set FW CMD IO for 8192S.
  161. //
  162. //extern BOOLEAN HalSetIO8192C( IN PADAPTER Adapter,
  163. // IN IO_TYPE IOType);
  164. //
  165. // Set A2 entry to fw for 8192S
  166. //
  167. extern void FillA2Entry8192C( IN PADAPTER Adapter,
  168. IN u8 index,
  169. IN u8* val);
  170. //
  171. // channel switch related funciton
  172. //
  173. //extern void PHY_SwChnlCallback8192C( IN PRT_TIMER pTimer );
  174. void PHY_SwChnl8192D( IN PADAPTER pAdapter,
  175. IN u8 channel );
  176. VOID
  177. PHY_SetSwChnlBWMode8192D(
  178. IN PADAPTER Adapter,
  179. IN u8 channel,
  180. IN CHANNEL_WIDTH Bandwidth,
  181. IN u8 Offset40,
  182. IN u8 Offset80
  183. );
  184. //
  185. // BB/MAC/RF other monitor API
  186. //
  187. void PHY_SetMonitorMode8192D(IN PADAPTER pAdapter,
  188. IN BOOLEAN bEnableMonitorMode );
  189. BOOLEAN PHY_CheckIsLegalRfPath8192D(IN PADAPTER pAdapter,
  190. IN u32 eRFPath );
  191. //
  192. // Modify the value of the hw register when beacon interval be changed.
  193. //
  194. void
  195. rtl8192d_PHY_SetBeaconHwReg( IN PADAPTER Adapter,
  196. IN u16 BeaconInterval );
  197. extern VOID
  198. PHY_SwitchEphyParameter(
  199. IN PADAPTER Adapter
  200. );
  201. extern VOID
  202. PHY_EnableHostClkReq(
  203. IN PADAPTER Adapter
  204. );
  205. BOOLEAN
  206. SetAntennaConfig92C(
  207. IN PADAPTER Adapter,
  208. IN u8 DefaultAnt
  209. );
  210. VOID
  211. PHY_UpdateBBRFConfiguration8192D(
  212. IN PADAPTER Adapter,
  213. IN BOOLEAN bisBandSwitch
  214. );
  215. VOID PHY_ReadMacPhyMode92D(
  216. IN PADAPTER Adapter,
  217. IN BOOLEAN AutoloadFail
  218. );
  219. VOID PHY_ConfigMacPhyMode92D(
  220. IN PADAPTER Adapter
  221. );
  222. VOID PHY_ConfigMacPhyModeInfo92D(
  223. IN PADAPTER Adapter
  224. );
  225. VOID PHY_ConfigMacCoexist_RFPage92D(
  226. IN PADAPTER Adapter
  227. );
  228. VOID
  229. rtl8192d_PHY_InitRxSetting(
  230. IN PADAPTER Adapter
  231. );
  232. VOID
  233. rtl8192d_PHY_SetRFPathSwitch(IN PADAPTER pAdapter, IN BOOLEAN bMain);
  234. VOID
  235. HalChangeCCKStatus8192D(
  236. IN PADAPTER Adapter,
  237. IN BOOLEAN bCCKDisable
  238. );
  239. VOID
  240. PHY_InitPABias92D(IN PADAPTER Adapter);
  241. /*--------------------------Exported Function prototype---------------------*/
  242. #define PHY_SetBBReg1Byte(Adapter, RegAddr, BitMask, Data) PHY_SetBBReg1Byte8192D((Adapter), (RegAddr), (BitMask), (Data))
  243. #endif // __INC_HAL8192SPHYCFG_H