phydm_precomp.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469
  1. /******************************************************************************
  2. *
  3. * Copyright(c) 2007 - 2017 Realtek Corporation.
  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. * The full GNU General Public License is included in this distribution in the
  15. * file called LICENSE.
  16. *
  17. * Contact Information:
  18. * wlanfae <wlanfae@realtek.com>
  19. * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
  20. * Hsinchu 300, Taiwan.
  21. *
  22. * Larry Finger <Larry.Finger@lwfinger.net>
  23. *
  24. *****************************************************************************/
  25. #ifndef __ODM_PRECOMP_H__
  26. #define __ODM_PRECOMP_H__
  27. #include "phydm_types.h"
  28. #include "halrf/halrf_features.h"
  29. #if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
  30. #include "Precomp.h" /* @We need to include mp_precomp.h due to batch file setting. */
  31. #else
  32. #define TEST_FALG___ 1
  33. #endif
  34. /* @2 Config Flags and Structs - defined by each ODM type */
  35. #if (DM_ODM_SUPPORT_TYPE == ODM_AP)
  36. #include "../8192cd_cfg.h"
  37. #include "../odm_inc.h"
  38. #include "../8192cd.h"
  39. #include "../8192cd_util.h"
  40. #include "../8192cd_hw.h"
  41. #ifdef _BIG_ENDIAN_
  42. #define ODM_ENDIAN_TYPE ODM_ENDIAN_BIG
  43. #else
  44. #define ODM_ENDIAN_TYPE ODM_ENDIAN_LITTLE
  45. #endif
  46. #include "../8192cd_headers.h"
  47. #include "../8192cd_debug.h"
  48. #elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
  49. #ifdef DM_ODM_CE_MAC80211
  50. #include "../wifi.h"
  51. #include "rtl_phydm.h"
  52. #elif defined(DM_ODM_CE_MAC80211_V2)
  53. #include "../main.h"
  54. #include "../hw.h"
  55. #include "../fw.h"
  56. #endif
  57. #define __PACK
  58. #define __WLAN_ATTRIB_PACK__
  59. #elif (DM_ODM_SUPPORT_TYPE == ODM_WIN)
  60. #include "mp_precomp.h"
  61. #define ODM_ENDIAN_TYPE ODM_ENDIAN_LITTLE
  62. #define __PACK
  63. #define __WLAN_ATTRIB_PACK__
  64. #elif (DM_ODM_SUPPORT_TYPE == ODM_IOT)
  65. #include <drv_types.h>
  66. #include <wifi.h>
  67. #define ODM_ENDIAN_TYPE ODM_ENDIAN_LITTLE
  68. #define __PACK
  69. #endif
  70. /* @2 OutSrc Header Files */
  71. #include "phydm.h"
  72. #include "phydm_hwconfig.h"
  73. #include "phydm_phystatus.h"
  74. #include "phydm_debug.h"
  75. #include "phydm_regdefine11ac.h"
  76. #include "phydm_regdefine11n.h"
  77. #include "phydm_interface.h"
  78. #include "phydm_reg.h"
  79. #include "halrf/halrf_debug.h"
  80. #if (DM_ODM_SUPPORT_TYPE & ODM_CE) && \
  81. (!defined(DM_ODM_CE_MAC80211) && !defined(DM_ODM_CE_MAC80211_V2))
  82. void phy_set_tx_power_limit(
  83. struct dm_struct *dm,
  84. u8 *regulation,
  85. u8 *band,
  86. u8 *bandwidth,
  87. u8 *rate_section,
  88. u8 *rf_path,
  89. u8 *channel,
  90. u8 *power_limit);
  91. enum hal_status
  92. rtw_phydm_fw_iqk(
  93. struct dm_struct *dm,
  94. u8 clear,
  95. u8 segment);
  96. enum hal_status
  97. rtw_phydm_cfg_phy_para(
  98. struct dm_struct *dm,
  99. enum phydm_halmac_param config_type,
  100. u32 offset,
  101. u32 data,
  102. u32 mask,
  103. enum rf_path e_rf_path,
  104. u32 delay_time);
  105. #endif
  106. /* @Judy ADD 20180125 */
  107. #if (DM_ODM_SUPPORT_TYPE & (ODM_AP | ODM_IOT))
  108. #define RTL8710B_SUPPORT 0
  109. #endif
  110. #if RTL8188E_SUPPORT == 1
  111. #define RTL8188E_T_SUPPORT 1
  112. #ifdef CONFIG_SFW_SUPPORTED
  113. #define RTL8188E_S_SUPPORT 1
  114. #else
  115. #define RTL8188E_S_SUPPORT 0
  116. #endif
  117. #endif
  118. #if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
  119. #define RTL8197F_SUPPORT 0 /*@Just for PHYDM API development*/
  120. #define RTL8195B_SUPPORT 0 /*@Just for PHYDM API development*/
  121. #define RTL8198F_SUPPORT 0 /*@Just for PHYDM API development*/
  122. #endif
  123. #if (RTL8188E_SUPPORT == 1)
  124. #include "rtl8188e/hal8188erateadaptive.h" /* @for RA,Power training */
  125. #include "rtl8188e/halhwimg8188e_mac.h"
  126. #include "rtl8188e/halhwimg8188e_rf.h"
  127. #include "rtl8188e/halhwimg8188e_bb.h"
  128. #include "rtl8188e/phydm_regconfig8188e.h"
  129. #include "rtl8188e/phydm_rtl8188e.h"
  130. #include "rtl8188e/hal8188ereg.h"
  131. #include "rtl8188e/version_rtl8188e.h"
  132. #if (DM_ODM_SUPPORT_TYPE == ODM_CE)
  133. #include "rtl8188e_hal.h"
  134. #include "halrf/rtl8188e/halrf_8188e_ce.h"
  135. #endif
  136. #if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
  137. #include "halrf/rtl8188e/halrf_8188e_win.h"
  138. #endif
  139. #if (DM_ODM_SUPPORT_TYPE == ODM_AP)
  140. #include "halrf/rtl8188e/halrf_8188e_ap.h"
  141. #endif
  142. #endif /* @88E END */
  143. #if (RTL8192E_SUPPORT == 1)
  144. #if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
  145. #include "halrf/rtl8192e/halrf_8192e_win.h" /*@FOR_8192E_IQK*/
  146. #elif (DM_ODM_SUPPORT_TYPE == ODM_AP)
  147. #include "halrf/rtl8192e/halrf_8192e_ap.h" /*@FOR_8192E_IQK*/
  148. #elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
  149. #include "halrf/rtl8192e/halrf_8192e_ce.h" /*@FOR_8192E_IQK*/
  150. #endif
  151. #include "rtl8192e/phydm_rtl8192e.h" /* @FOR_8192E_IQK */
  152. #include "rtl8192e/version_rtl8192e.h"
  153. #if (DM_ODM_SUPPORT_TYPE != ODM_AP)
  154. #include "rtl8192e/halhwimg8192e_bb.h"
  155. #include "rtl8192e/halhwimg8192e_mac.h"
  156. #include "rtl8192e/halhwimg8192e_rf.h"
  157. #include "rtl8192e/phydm_regconfig8192e.h"
  158. #include "rtl8192e/hal8192ereg.h"
  159. #endif
  160. #if (DM_ODM_SUPPORT_TYPE == ODM_CE)
  161. #include "rtl8192e_hal.h"
  162. #endif
  163. #endif /* @92E END */
  164. #if (RTL8812A_SUPPORT == 1)
  165. #if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
  166. #include "halrf/rtl8812a/halrf_8812a_win.h"
  167. #elif (DM_ODM_SUPPORT_TYPE == ODM_AP)
  168. #include "halrf/rtl8812a/halrf_8812a_ap.h"
  169. #elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
  170. #include "halrf/rtl8812a/halrf_8812a_ce.h"
  171. #endif
  172. /* @#include "halrf/rtl8812a/halrf_8812a.h" */ /* @FOR_8812_IQK */
  173. #if (DM_ODM_SUPPORT_TYPE != ODM_AP)
  174. #include "rtl8812a/halhwimg8812a_bb.h"
  175. #include "rtl8812a/halhwimg8812a_mac.h"
  176. #include "rtl8812a/halhwimg8812a_rf.h"
  177. #include "rtl8812a/phydm_regconfig8812a.h"
  178. #endif
  179. #include "rtl8812a/phydm_rtl8812a.h"
  180. #if (DM_ODM_SUPPORT_TYPE == ODM_CE)
  181. #include "rtl8812a_hal.h"
  182. #endif
  183. #include "rtl8812a/version_rtl8812a.h"
  184. #endif /* @8812 END */
  185. #if (RTL8814A_SUPPORT == 1)
  186. #include "rtl8814a/halhwimg8814a_mac.h"
  187. #include "rtl8814a/halhwimg8814a_rf.h"
  188. #include "rtl8814a/halhwimg8814a_bb.h"
  189. #include "rtl8814a/version_rtl8814a.h"
  190. #include "rtl8814a/phydm_rtl8814a.h"
  191. #if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
  192. #include "halrf/rtl8814a/halrf_8814a_win.h"
  193. #elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
  194. #include "halrf/rtl8814a/halrf_8814a_ce.h"
  195. #elif (DM_ODM_SUPPORT_TYPE == ODM_AP)
  196. #include "halrf/rtl8814a/halrf_8814a_ap.h"
  197. #endif
  198. #include "rtl8814a/phydm_regconfig8814a.h"
  199. #if (DM_ODM_SUPPORT_TYPE == ODM_CE)
  200. #include "rtl8814a_hal.h"
  201. #include "halrf/rtl8814a/halrf_iqk_8814a.h"
  202. #endif
  203. #endif /* @8814 END */
  204. #if (RTL8881A_SUPPORT == 1)/* @FOR_8881_IQK */
  205. #if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
  206. #include "halrf/rtl8821a/halrf_iqk_8821a_win.h"
  207. #elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
  208. #include "halrf/rtl8821a/halrf_iqk_8821a_ce.h"
  209. #else
  210. #include "halrf/rtl8821a/halrf_iqk_8821a_ap.h"
  211. #endif
  212. /* @#include "rtl8881a/HalHWImg8881A_BB.h" */
  213. /* @#include "rtl8881a/HalHWImg8881A_MAC.h" */
  214. /* @#include "rtl8881a/HalHWImg8881A_RF.h" */
  215. /* @#include "rtl8881a/odm_RegConfig8881A.h" */
  216. #endif
  217. #if (RTL8723B_SUPPORT == 1)
  218. #include "rtl8723b/halhwimg8723b_mac.h"
  219. #include "rtl8723b/halhwimg8723b_rf.h"
  220. #include "rtl8723b/halhwimg8723b_bb.h"
  221. #include "rtl8723b/phydm_regconfig8723b.h"
  222. #include "rtl8723b/phydm_rtl8723b.h"
  223. #include "rtl8723b/hal8723breg.h"
  224. #include "rtl8723b/version_rtl8723b.h"
  225. #if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
  226. #include "halrf/rtl8723b/halrf_8723b_win.h"
  227. #elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
  228. #include "halrf/rtl8723b/halrf_8723b_ce.h"
  229. #include "rtl8723b/halhwimg8723b_mp.h"
  230. #include "rtl8723b_hal.h"
  231. #else
  232. #include "halrf/rtl8723b/halrf_8723b_ap.h"
  233. #endif
  234. #endif
  235. #if (RTL8821A_SUPPORT == 1)
  236. #include "rtl8821a/halhwimg8821a_mac.h"
  237. #include "rtl8821a/halhwimg8821a_rf.h"
  238. #include "rtl8821a/halhwimg8821a_bb.h"
  239. #include "rtl8821a/phydm_regconfig8821a.h"
  240. #include "rtl8821a/phydm_rtl8821a.h"
  241. #include "rtl8821a/version_rtl8821a.h"
  242. #if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
  243. #include "halrf/rtl8821a/halrf_8821a_win.h"
  244. #elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
  245. #include "halrf/rtl8821a/halrf_8821a_ce.h"
  246. #include "halrf/rtl8821a/halrf_iqk_8821a_ce.h"/*@for IQK*/
  247. #include "halrf/rtl8812a/halrf_8812a_ce.h"/*@for IQK,LCK,Power-tracking*/
  248. #include "rtl8812a_hal.h"
  249. #else
  250. #endif
  251. #endif
  252. #if (DM_ODM_SUPPORT_TYPE == ODM_CE) && defined(DM_ODM_CE_MAC80211)
  253. #include "../halmac/halmac_reg2.h"
  254. #elif (DM_ODM_SUPPORT_TYPE == ODM_CE) && defined(DM_ODM_CE_MAC80211_V2)
  255. #include "../halmac/halmac_reg2.h"
  256. #endif
  257. #if (RTL8822B_SUPPORT == 1)
  258. #include "rtl8822b/halhwimg8822b_mac.h"
  259. #include "rtl8822b/halhwimg8822b_rf.h"
  260. #include "rtl8822b/halhwimg8822b_bb.h"
  261. #include "rtl8822b/phydm_regconfig8822b.h"
  262. #include "halrf/rtl8822b/halrf_8822b.h"
  263. #include "rtl8822b/phydm_rtl8822b.h"
  264. #include "rtl8822b/phydm_hal_api8822b.h"
  265. #include "rtl8822b/version_rtl8822b.h"
  266. #if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
  267. #elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
  268. #ifdef DM_ODM_CE_MAC80211
  269. #include "../halmac/halmac_reg_8822b.h"
  270. #elif defined(DM_ODM_CE_MAC80211_V2)
  271. #include "../halmac/halmac_reg_8822b.h"
  272. #else
  273. #include <hal_data.h> /* @struct HAL_DATA_TYPE */
  274. #include <rtl8822b_hal.h> /* @RX_SMOOTH_FACTOR, reg definition and etc.*/
  275. #endif
  276. #elif (DM_ODM_SUPPORT_TYPE == ODM_AP)
  277. #endif
  278. #endif
  279. #if (RTL8703B_SUPPORT == 1)
  280. #include "rtl8703b/phydm_rtl8703b.h"
  281. #include "rtl8703b/phydm_regconfig8703b.h"
  282. #include "rtl8703b/halhwimg8703b_mac.h"
  283. #include "rtl8703b/halhwimg8703b_rf.h"
  284. #include "rtl8703b/halhwimg8703b_bb.h"
  285. #include "halrf/rtl8703b/halrf_8703b.h"
  286. #include "rtl8703b/version_rtl8703b.h"
  287. #if (DM_ODM_SUPPORT_TYPE == ODM_CE)
  288. #include "rtl8703b_hal.h"
  289. #endif
  290. #endif
  291. #if (RTL8188F_SUPPORT == 1)
  292. #include "rtl8188f/halhwimg8188f_mac.h"
  293. #include "rtl8188f/halhwimg8188f_rf.h"
  294. #include "rtl8188f/halhwimg8188f_bb.h"
  295. #include "rtl8188f/hal8188freg.h"
  296. #include "rtl8188f/phydm_rtl8188f.h"
  297. #include "rtl8188f/phydm_regconfig8188f.h"
  298. #include "halrf/rtl8188f/halrf_8188f.h" /*@for IQK,LCK,Power-tracking*/
  299. #include "rtl8188f/version_rtl8188f.h"
  300. #if (DM_ODM_SUPPORT_TYPE == ODM_CE)
  301. #include "rtl8188f_hal.h"
  302. #endif
  303. #endif
  304. #if (RTL8723D_SUPPORT == 1)
  305. #if (DM_ODM_SUPPORT_TYPE != ODM_AP)
  306. #include "rtl8723d/halhwimg8723d_bb.h"
  307. #include "rtl8723d/halhwimg8723d_mac.h"
  308. #include "rtl8723d/halhwimg8723d_rf.h"
  309. #include "rtl8723d/phydm_regconfig8723d.h"
  310. #include "rtl8723d/hal8723dreg.h"
  311. #include "rtl8723d/phydm_rtl8723d.h"
  312. #include "halrf/rtl8723d/halrf_8723d.h"
  313. #include "rtl8723d/version_rtl8723d.h"
  314. #endif
  315. #if (DM_ODM_SUPPORT_TYPE == ODM_CE)
  316. #ifdef DM_ODM_CE_MAC80211
  317. #else
  318. #include "rtl8723d_hal.h"
  319. #endif
  320. #endif
  321. #endif /* @8723D End */
  322. #if (RTL8710B_SUPPORT == 1)
  323. #if (DM_ODM_SUPPORT_TYPE != ODM_AP)
  324. #include "rtl8710b/halhwimg8710b_bb.h"
  325. #include "rtl8710b/halhwimg8710b_mac.h"
  326. #include "rtl8710b/halhwimg8710b_rf.h"
  327. #include "rtl8710b/phydm_regconfig8710b.h"
  328. #include "rtl8710b/hal8710breg.h"
  329. #include "rtl8710b/phydm_rtl8710b.h"
  330. #include "halrf/rtl8710b/halrf_8710b.h"
  331. #include "rtl8710b/version_rtl8710b.h"
  332. #endif
  333. #if (DM_ODM_SUPPORT_TYPE == ODM_CE)
  334. #include "rtl8710b_hal.h"
  335. #endif
  336. #endif /* @8710B End */
  337. #if (RTL8197F_SUPPORT == 1)
  338. #include "rtl8197f/halhwimg8197f_mac.h"
  339. #include "rtl8197f/halhwimg8197f_rf.h"
  340. #include "rtl8197f/halhwimg8197f_bb.h"
  341. #include "rtl8197f/phydm_hal_api8197f.h"
  342. #include "rtl8197f/version_rtl8197f.h"
  343. #include "rtl8197f/phydm_rtl8197f.h"
  344. #include "rtl8197f/phydm_regconfig8197f.h"
  345. #include "halrf/rtl8197f/halrf_8197f.h"
  346. #include "halrf/rtl8197f/halrf_iqk_8197f.h"
  347. #include "halrf/rtl8197f/halrf_dpk_8197f.h"
  348. #endif
  349. #if (RTL8821C_SUPPORT == 1)
  350. #include "rtl8821c/phydm_hal_api8821c.h"
  351. #include "rtl8821c/halhwimg8821c_mac.h"
  352. #include "rtl8821c/halhwimg8821c_rf.h"
  353. #include "rtl8821c/halhwimg8821c_bb.h"
  354. #include "rtl8821c/phydm_regconfig8821c.h"
  355. #include "halrf/rtl8821c/halrf_8821c.h"
  356. #include "rtl8821c/version_rtl8821c.h"
  357. #if (DM_ODM_SUPPORT_TYPE == ODM_CE)
  358. #ifdef DM_ODM_CE_MAC80211
  359. #include "../halmac/halmac_reg_8821c.h"
  360. #else
  361. #include "rtl8821c_hal.h"
  362. #endif
  363. #endif
  364. #endif
  365. #if (RTL8192F_SUPPORT == 1)
  366. #include "rtl8192f/halhwimg8192f_mac.h"
  367. #include "rtl8192f/halhwimg8192f_rf.h"
  368. #include "rtl8192f/halhwimg8192f_bb.h"
  369. #include "rtl8192f/phydm_hal_api8192f.h"
  370. #include "rtl8192f/version_rtl8192f.h"
  371. #include "rtl8192f/phydm_rtl8192f.h"
  372. #include "rtl8192f/phydm_regconfig8192f.h"
  373. #include "halrf/rtl8192f/halrf_8192f.h"
  374. #if (DM_ODM_SUPPORT_TYPE == ODM_AP)
  375. #include "halrf/rtl8192f/halrf_dpk_8192f.h"
  376. #endif
  377. #if (DM_ODM_SUPPORT_TYPE == ODM_CE)
  378. #include "rtl8192f_hal.h"
  379. #endif
  380. #endif
  381. #if (RTL8195B_SUPPORT == 1)
  382. #include "halrf/rtl8195b/halrf_8195b.h"
  383. #include "rtl8195b/phydm_hal_api8195b.h"
  384. #include "rtl8195b/phydm_regconfig8195b.h"
  385. #include "rtl8195b/halhwimg8195b_mac.h"
  386. #include "rtl8195b/halhwimg8195b_rf.h"
  387. #include "rtl8195b/halhwimg8195b_bb.h"
  388. #include "rtl8195b/version_rtl8195b.h"
  389. #include <hal_data.h> /*@HAL_DATA_TYPE*/
  390. #endif
  391. #if (RTL8198F_SUPPORT == 1)
  392. #include "rtl8198f/phydm_regconfig8198f.h"
  393. #include "rtl8198f/phydm_hal_api8198f.h"
  394. #include "rtl8198f/halhwimg8198f_mac.h"
  395. #include "rtl8198f/halhwimg8198f_rf.h"
  396. #include "rtl8198f/halhwimg8198f_bb.h"
  397. #include "rtl8198f/version_rtl8198f.h"
  398. #include "halrf/rtl8198f/halrf_8198f.h"
  399. #include "halrf/rtl8198f/halrf_iqk_8198f.h"
  400. #endif
  401. #if (RTL8822C_SUPPORT)
  402. #include "rtl8822c/halhwimg8822c_mac.h"
  403. #include "rtl8822c/halhwimg8822c_rf.h"
  404. #include "rtl8822c/halhwimg8822c_bb.h"
  405. #include "rtl8822c/phydm_regconfig8822c.h"
  406. /*@#include "halrf/rtl8822c/halrf_8822c.h"*/
  407. #include "rtl8822c/phydm_hal_api8822c.h"
  408. #include "rtl8822c/version_rtl8822c.h"
  409. #endif
  410. #if (RTL8814B_SUPPORT == 1)
  411. /*#include "rtl8814b/halhwimg8814b_mac.h"*/
  412. /*#include "rtl8814b/halhwimg8814b_rf.h"*/
  413. /*#include "rtl8814b/halhwimg8814b_bb.h"*/
  414. /*#include "rtl8814b/phydm_regconfig8814b.h"*/
  415. /*@#include "halrf/rtl8814b/halrf_8814b.h"*/
  416. #include "rtl8814b/phydm_hal_api8814b.h"
  417. /*#include "rtl8814b/version_rtl8814b.h"*/
  418. #endif
  419. #endif /* @__ODM_PRECOMP_H__ */