odm_RegConfig8821A.c 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  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. //#include "Mp_Precomp.h"
  21. #include "../odm_precomp.h"
  22. #if (RTL8821A_SUPPORT == 1)
  23. void
  24. odm_ConfigRFReg_8821A(
  25. IN PDM_ODM_T pDM_Odm,
  26. IN u4Byte Addr,
  27. IN u4Byte Data,
  28. IN ODM_RF_RADIO_PATH_E RF_PATH,
  29. IN u4Byte RegAddr
  30. )
  31. {
  32. if(Addr == 0xfe || Addr == 0xffe)
  33. {
  34. #ifdef CONFIG_LONG_DELAY_ISSUE
  35. ODM_sleep_ms(50);
  36. #else
  37. ODM_delay_ms(50);
  38. #endif
  39. }
  40. else if (Addr == 0xfd)
  41. {
  42. ODM_delay_ms(5);
  43. }
  44. else if (Addr == 0xfc)
  45. {
  46. ODM_delay_ms(1);
  47. }
  48. else if (Addr == 0xfb)
  49. {
  50. ODM_delay_us(50);
  51. }
  52. else if (Addr == 0xfa)
  53. {
  54. ODM_delay_us(5);
  55. }
  56. else if (Addr == 0xf9)
  57. {
  58. ODM_delay_us(1);
  59. }
  60. else
  61. {
  62. ODM_SetRFReg(pDM_Odm, RF_PATH, RegAddr, bRFRegOffsetMask, Data);
  63. // Add 1us delay between BB/RF register setting.
  64. ODM_delay_us(1);
  65. }
  66. }
  67. void
  68. odm_ConfigRF_RadioA_8821A(
  69. IN PDM_ODM_T pDM_Odm,
  70. IN u4Byte Addr,
  71. IN u4Byte Data
  72. )
  73. {
  74. u4Byte content = 0x1000; // RF_Content: radioa_txt
  75. u4Byte maskforPhySet= (u4Byte)(content&0xE000);
  76. odm_ConfigRFReg_8821A(pDM_Odm, Addr, Data, ODM_RF_PATH_A, Addr|maskforPhySet);
  77. ODM_RT_TRACE(pDM_Odm,ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ConfigRFWithHeaderFile: [RadioA] %08X %08X\n", Addr, Data));
  78. }
  79. // 8821 no RF B
  80. /*
  81. void
  82. odm_ConfigRF_RadioB_8821A(
  83. IN PDM_ODM_T pDM_Odm,
  84. IN u4Byte Addr,
  85. IN u4Byte Data
  86. )
  87. {
  88. u4Byte content = 0x1001; // RF_Content: radiob_txt
  89. u4Byte maskforPhySet= (u4Byte)(content&0xE000);
  90. odm_ConfigRFReg_8812A(pDM_Odm, Addr, Data, ODM_RF_PATH_B, Addr|maskforPhySet);
  91. ODM_RT_TRACE(pDM_Odm,ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ConfigRFWithHeaderFile: [RadioB] %08X %08X\n", Addr, Data));
  92. }
  93. */
  94. void
  95. odm_ConfigMAC_8821A(
  96. IN PDM_ODM_T pDM_Odm,
  97. IN u4Byte Addr,
  98. IN u1Byte Data
  99. )
  100. {
  101. ODM_Write1Byte(pDM_Odm, Addr, Data);
  102. ODM_RT_TRACE(pDM_Odm,ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ConfigMACWithHeaderFile: [MAC_REG] %08X %08X\n", Addr, Data));
  103. }
  104. void
  105. odm_ConfigBB_AGC_8821A(
  106. IN PDM_ODM_T pDM_Odm,
  107. IN u4Byte Addr,
  108. IN u4Byte Bitmask,
  109. IN u4Byte Data
  110. )
  111. {
  112. ODM_SetBBReg(pDM_Odm, Addr, Bitmask, Data);
  113. // Add 1us delay between BB/RF register setting.
  114. ODM_delay_us(1);
  115. ODM_RT_TRACE(pDM_Odm,ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ConfigBBWithHeaderFile: [AGC_TAB] %08X %08X\n", Addr, Data));
  116. }
  117. void
  118. odm_ConfigBB_PHY_REG_PG_8821A(
  119. IN PDM_ODM_T pDM_Odm,
  120. IN u4Byte Addr,
  121. IN u4Byte Bitmask,
  122. IN u4Byte Data
  123. )
  124. {
  125. if (Addr == 0xfe)
  126. #ifdef CONFIG_LONG_DELAY_ISSUE
  127. ODM_sleep_ms(50);
  128. #else
  129. ODM_delay_ms(50);
  130. #endif
  131. else if (Addr == 0xfd)
  132. ODM_delay_ms(5);
  133. else if (Addr == 0xfc)
  134. ODM_delay_ms(1);
  135. else if (Addr == 0xfb)
  136. ODM_delay_us(50);
  137. else if (Addr == 0xfa)
  138. ODM_delay_us(5);
  139. else if (Addr == 0xf9)
  140. ODM_delay_us(1);
  141. ODM_RT_TRACE(pDM_Odm,ODM_COMP_INIT, ODM_DBG_LOUD, ("===> @@@@@@@ ODM_ConfigBBWithHeaderFile: [PHY_REG] %08X %08X %08X\n", Addr, Bitmask, Data));
  142. #if !(DM_ODM_SUPPORT_TYPE&ODM_AP)
  143. storePwrIndexDiffRateOffset(pDM_Odm->Adapter, Addr, Bitmask, Data);
  144. #endif
  145. }
  146. void
  147. odm_ConfigBB_PHY_8821A(
  148. IN PDM_ODM_T pDM_Odm,
  149. IN u4Byte Addr,
  150. IN u4Byte Bitmask,
  151. IN u4Byte Data
  152. )
  153. {
  154. if (Addr == 0xfe)
  155. #ifdef CONFIG_LONG_DELAY_ISSUE
  156. ODM_sleep_ms(50);
  157. #else
  158. ODM_delay_ms(50);
  159. #endif
  160. else if (Addr == 0xfd)
  161. ODM_delay_ms(5);
  162. else if (Addr == 0xfc)
  163. ODM_delay_ms(1);
  164. else if (Addr == 0xfb)
  165. ODM_delay_us(50);
  166. else if (Addr == 0xfa)
  167. ODM_delay_us(5);
  168. else if (Addr == 0xf9)
  169. ODM_delay_us(1);
  170. else if (Addr == 0xa24)
  171. pDM_Odm->RFCalibrateInfo.RegA24 = Data;
  172. ODM_SetBBReg(pDM_Odm, Addr, Bitmask, Data);
  173. // Add 1us delay between BB/RF register setting.
  174. ODM_delay_us(1);
  175. ODM_RT_TRACE(pDM_Odm,ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ConfigBBWithHeaderFile: [PHY_REG] %08X %08X\n", Addr, Data));
  176. }
  177. void
  178. odm_ConfigBB_TXPWR_LMT_8821A(
  179. IN PDM_ODM_T pDM_Odm,
  180. IN pu1Byte Regulation,
  181. IN pu1Byte Band,
  182. IN pu1Byte Bandwidth,
  183. IN pu1Byte RateSection,
  184. IN pu1Byte RfPath,
  185. IN pu1Byte Channel,
  186. IN pu1Byte PowerLimit
  187. )
  188. {
  189. #if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE))
  190. PHY_SetPowerLimitTableValue(pDM_Odm, Regulation, Band,
  191. Bandwidth, RateSection, RfPath, Channel, PowerLimit);
  192. #endif
  193. }
  194. #endif