odm_RegConfig8812A.c 4.6 KB

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