phydm.h 34 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340
  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 __HALDMOUTSRC_H__
  26. #define __HALDMOUTSRC_H__
  27. /*@============================================================*/
  28. /*@include files*/
  29. /*@============================================================*/
  30. /*PHYDM header*/
  31. #include "phydm_pre_define.h"
  32. #include "phydm_features.h"
  33. #include "phydm_dig.h"
  34. #include "phydm_pathdiv.h"
  35. #ifdef CONFIG_PHYDM_ANTENNA_DIVERSITY
  36. #include "phydm_antdiv.h"
  37. #endif
  38. #include "phydm_soml.h"
  39. #ifdef CONFIG_SMART_ANTENNA
  40. #include "phydm_smt_ant.h"
  41. #endif
  42. #ifdef CONFIG_ANT_DETECTION
  43. #include "phydm_antdect.h"
  44. #endif
  45. #include "phydm_rainfo.h"
  46. #ifdef CONFIG_DYNAMIC_TX_TWR
  47. #include "phydm_dynamictxpower.h"
  48. #endif
  49. #include "phydm_cfotracking.h"
  50. #include "phydm_adaptivity.h"
  51. #include "phydm_dfs.h"
  52. #include "phydm_ccx.h"
  53. #include "txbf/phydm_hal_txbf_api.h"
  54. #if (PHYDM_LA_MODE_SUPPORT == 1)
  55. #include "phydm_adc_sampling.h"
  56. #endif
  57. #ifdef CONFIG_PSD_TOOL
  58. #include "phydm_psd.h"
  59. #endif
  60. #ifdef PHYDM_PRIMARY_CCA
  61. #include "phydm_primary_cca.h"
  62. #endif
  63. #include "phydm_cck_pd.h"
  64. #include "phydm_rssi_monitor.h"
  65. #ifdef PHYDM_AUTO_DEGBUG
  66. #include "phydm_auto_dbg.h"
  67. #endif
  68. #include "phydm_math_lib.h"
  69. #include "phydm_noisemonitor.h"
  70. #include "phydm_api.h"
  71. #ifdef PHYDM_POWER_TRAINING_SUPPORT
  72. #include "phydm_pow_train.h"
  73. #endif
  74. #ifdef PHYDM_LNA_SAT_CHK_SUPPORT
  75. #include "phydm_lna_sat.h"
  76. #endif
  77. #ifdef PHYDM_PMAC_TX_SETTING_SUPPORT
  78. #include "phydm_pmac_tx_setting.h"
  79. #endif
  80. #ifdef PHYDM_MP_SUPPORT
  81. #include "phydm_mp.h"
  82. #endif
  83. #if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
  84. #include "phydm_beamforming.h"
  85. #endif
  86. #include "phydm_regtable.h"
  87. /*@HALRF header*/
  88. #include "halrf/halrf_iqk.h"
  89. #include "halrf/halrf_dpk.h"
  90. #include "halrf/halrf.h"
  91. #include "halrf/halrf_powertracking.h"
  92. #if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
  93. #include "halrf/halphyrf_ap.h"
  94. #elif(DM_ODM_SUPPORT_TYPE & (ODM_CE))
  95. #include "halrf/halphyrf_ce.h"
  96. #elif (DM_ODM_SUPPORT_TYPE & (ODM_WIN))
  97. #include "halrf/halphyrf_win.h"
  98. #elif(DM_ODM_SUPPORT_TYPE & (ODM_IOT))
  99. #include "halrf/halphyrf_iot.h"
  100. #endif
  101. extern const u16 phy_rate_table[28];
  102. /*@============================================================*/
  103. /*@Definition */
  104. /*@============================================================*/
  105. /* Traffic load decision */
  106. #define TRAFFIC_NO_TP 0
  107. #define TRAFFIC_ULTRA_LOW 1
  108. #define TRAFFIC_LOW 2
  109. #define TRAFFIC_MID 3
  110. #define TRAFFIC_HIGH 4
  111. #define NONE 0
  112. #if defined(DM_ODM_CE_MAC80211)
  113. #define MAX_2(x, y) \
  114. __max2(typeof(x), typeof(y), \
  115. x, y)
  116. #define __max2(t1, t2, x, y) ({ \
  117. t1 m80211_max1 = (x); \
  118. t2 m80211_max2 = (y); \
  119. m80211_max1 > m80211_max2 ? m80211_max1 : m80211_max2; })
  120. #define MIN_2(x, y) \
  121. __min2(typeof(x), typeof(y), \
  122. x, y)
  123. #define __min2(t1, t2, x, y) ({ \
  124. t1 m80211_min1 = (x); \
  125. t2 m80211_min2 = (y); \
  126. m80211_min1 < m80211_min2 ? m80211_min1 : m80211_min2; })
  127. #define DIFF_2(x, y) \
  128. __diff2(typeof(x), typeof(y), \
  129. x, y)
  130. #define __diff2(t1, t2, x, y) ({ \
  131. t1 __d1 = (x); \
  132. t2 __d2 = (y); \
  133. (__d1 >= __d2) ? (__d1 - __d2) : (__d2 - __d1); })
  134. #else
  135. #define MAX_2(_x_, _y_) (((_x_) > (_y_)) ? (_x_) : (_y_))
  136. #define MIN_2(_x_, _y_) (((_x_) < (_y_)) ? (_x_) : (_y_))
  137. #define DIFF_2(_x_, _y_) ((_x_ >= _y_) ? (_x_ - _y_) : (_y_ - _x_))
  138. #endif
  139. #define IS_GREATER(_x_, _y_) (((_x_) >= (_y_)) ? true : false)
  140. #define IS_LESS(_x_, _y_) (((_x_) < (_y_)) ? true : false)
  141. #if defined(DM_ODM_CE_MAC80211)
  142. #define BYTE_DUPLICATE_2_DWORD(B0) ({ \
  143. u32 __b_dup = (B0);\
  144. (((__b_dup) << 24) | ((__b_dup) << 16) | ((__b_dup) << 8) | (__b_dup));\
  145. })
  146. #else
  147. #define BYTE_DUPLICATE_2_DWORD(B0) \
  148. (((B0) << 24) | ((B0) << 16) | ((B0) << 8) | (B0))
  149. #endif
  150. #define BYTE_2_DWORD(B3, B2, B1, B0) \
  151. (((B3) << 24) | ((B2) << 16) | ((B1) << 8) | (B0))
  152. #define BIT_2_BYTE(B3, B2, B1, B0) \
  153. (((B3) << 3) | ((B2) << 2) | ((B1) << 1) | (B0))
  154. /*@For cmn sta info*/
  155. #if defined(DM_ODM_CE_MAC80211)
  156. #define is_sta_active(sta) ({ \
  157. struct cmn_sta_info *__sta = (sta); \
  158. ((__sta) && (__sta->dm_ctrl & STA_DM_CTRL_ACTIVE)); \
  159. })
  160. #define IS_FUNC_EN(name) ({ \
  161. u8 *__is_func_name = (name); \
  162. (__is_func_name) && (*__is_func_name); \
  163. })
  164. #else
  165. #define is_sta_active(sta) ((sta) && (sta->dm_ctrl & STA_DM_CTRL_ACTIVE))
  166. #define IS_FUNC_EN(name) ((name) && (*name))
  167. #endif
  168. #if (DM_ODM_SUPPORT_TYPE == ODM_AP)
  169. #define PHYDM_WATCH_DOG_PERIOD 1 /*second*/
  170. #else
  171. #define PHYDM_WATCH_DOG_PERIOD 2 /*second*/
  172. #endif
  173. #define PHY_HIST_SIZE 12
  174. /*@============================================================*/
  175. /*structure and define*/
  176. /*@============================================================*/
  177. #define dm_type_by_fw 0
  178. #define dm_type_by_driver 1
  179. #ifdef BB_RAM_SUPPORT
  180. struct phydm_bb_ram_per_sta {
  181. /* @Reg0x1E84 for RAM I/O*/
  182. boolean hw_igi_en;
  183. boolean tx_pwr_offset0_en;
  184. boolean tx_pwr_offset1_en;
  185. /* @ macid from 0 to 63, above 63 => mapping to 63*/
  186. u8 macid_addr;
  187. /* @hw_igi value for paths after packet Tx in a period of time*/
  188. u8 hw_igi;
  189. /* @tx_pwr_offset0 offset for Tx power index*/
  190. s8 tx_pwr_offset0;
  191. s8 tx_pwr_offset1;
  192. };
  193. struct phydm_bb_ram_ctrl {
  194. /*@ For 98F/14B/22C/12F, each TxAGC step will be 0.25dB*/
  195. struct phydm_bb_ram_per_sta pram_sta_ctrl[ODM_ASSOCIATE_ENTRY_NUM];
  196. /*------------ For table2 do not set power offset by macid --------*/
  197. /* For type == 2'b10, 0x1e70[22:16] = tx_pwr_offset_reg0, 0x1e70[23] = enable */
  198. boolean tx_pwr_offset_reg0_en;
  199. u8 tx_pwr_offset_reg0;
  200. /* For type == 2'b11, 0x1e70[30:24] = tx_pwr_offset_reg1, 0x1e70[31] = enable */
  201. boolean tx_pwr_offset_reg1_en;
  202. u8 tx_pwr_offset_reg1;
  203. };
  204. #endif
  205. struct phydm_phystatus_statistic {
  206. /*@[CCK]*/
  207. u32 rssi_cck_sum;
  208. u32 rssi_cck_cnt;
  209. /*@[OFDM]*/
  210. u32 rssi_ofdm_sum;
  211. u32 rssi_ofdm_cnt;
  212. u32 evm_ofdm_sum;
  213. u32 snr_ofdm_sum;
  214. u16 evm_ofdm_hist[PHY_HIST_SIZE];
  215. u16 snr_ofdm_hist[PHY_HIST_SIZE];
  216. /*@[1SS]*/
  217. u32 rssi_1ss_cnt;
  218. u32 rssi_1ss_sum;
  219. u32 evm_1ss_sum;
  220. u32 snr_1ss_sum;
  221. u16 evm_1ss_hist[PHY_HIST_SIZE];
  222. u16 snr_1ss_hist[PHY_HIST_SIZE];
  223. /*@[2SS]*/
  224. #if (defined(PHYDM_COMPILE_ABOVE_2SS))
  225. u32 rssi_2ss_cnt;
  226. u32 rssi_2ss_sum[2];
  227. u32 evm_2ss_sum[2];
  228. u32 snr_2ss_sum[2];
  229. u16 evm_2ss_hist[2][PHY_HIST_SIZE];
  230. u16 snr_2ss_hist[2][PHY_HIST_SIZE];
  231. #endif
  232. /*@[3SS]*/
  233. #if (defined(PHYDM_COMPILE_ABOVE_3SS))
  234. u32 rssi_3ss_cnt;
  235. u32 rssi_3ss_sum[3];
  236. u32 evm_3ss_sum[3];
  237. u32 snr_3ss_sum[3];
  238. u16 evm_3ss_hist[3][PHY_HIST_SIZE];
  239. u16 snr_3ss_hist[3][PHY_HIST_SIZE];
  240. #endif
  241. /*@[4SS]*/
  242. #if (defined(PHYDM_COMPILE_ABOVE_4SS))
  243. u32 rssi_4ss_cnt;
  244. u32 rssi_4ss_sum[4];
  245. u32 evm_4ss_sum[4];
  246. u32 snr_4ss_sum[4];
  247. u16 evm_4ss_hist[4][PHY_HIST_SIZE];
  248. u16 snr_4ss_hist[4][PHY_HIST_SIZE];
  249. #endif
  250. };
  251. struct phydm_phystatus_avg {
  252. /*@[CCK]*/
  253. u8 rssi_cck_avg;
  254. /*@[OFDM]*/
  255. u8 rssi_ofdm_avg;
  256. u8 evm_ofdm_avg;
  257. u8 snr_ofdm_avg;
  258. /*@[1SS]*/
  259. u8 rssi_1ss_avg;
  260. u8 evm_1ss_avg;
  261. u8 snr_1ss_avg;
  262. /*@[2SS]*/
  263. #if (defined(PHYDM_COMPILE_ABOVE_2SS))
  264. u8 rssi_2ss_avg[2];
  265. u8 evm_2ss_avg[2];
  266. u8 snr_2ss_avg[2];
  267. #endif
  268. /*@[3SS]*/
  269. #if (defined(PHYDM_COMPILE_ABOVE_3SS))
  270. u8 rssi_3ss_avg[3];
  271. u8 evm_3ss_avg[3];
  272. u8 snr_3ss_avg[3];
  273. #endif
  274. /*@[4SS]*/
  275. #if (defined(PHYDM_COMPILE_ABOVE_4SS))
  276. u8 rssi_4ss_avg[4];
  277. u8 evm_4ss_avg[4];
  278. u8 snr_4ss_avg[4];
  279. #endif
  280. };
  281. struct odm_phy_dbg_info {
  282. /*@ODM Write,debug info*/
  283. u32 num_qry_phy_status_cck;
  284. u32 num_qry_phy_status_ofdm;
  285. #if (ODM_PHY_STATUS_NEW_TYPE_SUPPORT == 1) || (defined(PHYSTS_3RD_TYPE_SUPPORT))
  286. u32 num_qry_mu_pkt;
  287. u32 num_qry_bf_pkt;
  288. u16 num_mu_vht_pkt[VHT_RATE_NUM];
  289. boolean is_ldpc_pkt;
  290. boolean is_stbc_pkt;
  291. u8 num_of_ppdu[4];
  292. u8 gid_num[4];
  293. #endif
  294. u32 condi_num; /*@condition number U(18,4)*/
  295. u8 condi_num_cdf[CN_CNT_MAX];
  296. u8 num_qry_beacon_pkt;
  297. u8 beacon_cnt_in_period; /*@beacon cnt within watchdog period*/
  298. u8 beacon_phy_rate;
  299. u8 show_phy_sts_all_pkt; /*@Show phy status witch not match BSSID*/
  300. u16 show_phy_sts_max_cnt; /*@show number of phy-status row data per PHYDM watchdog*/
  301. u16 show_phy_sts_cnt;
  302. u16 num_qry_legacy_pkt[LEGACY_RATE_NUM];
  303. u16 num_qry_ht_pkt[HT_RATE_NUM];
  304. u16 num_qry_pkt_sc_20m[LOW_BW_RATE_NUM]; /*@20M SC*/
  305. boolean ht_pkt_not_zero;
  306. boolean low_bw_20_occur;
  307. #if ODM_IC_11AC_SERIES_SUPPORT
  308. u16 num_qry_vht_pkt[VHT_RATE_NUM];
  309. u16 num_qry_pkt_sc_40m[LOW_BW_RATE_NUM]; /*@40M SC*/
  310. boolean vht_pkt_not_zero;
  311. boolean low_bw_40_occur;
  312. #endif
  313. u16 snr_hist_th[PHY_HIST_SIZE - 1];
  314. u16 evm_hist_th[PHY_HIST_SIZE - 1];
  315. struct phydm_phystatus_statistic physts_statistic_info;
  316. struct phydm_phystatus_avg phystatus_statistic_avg;
  317. };
  318. enum odm_cmninfo {
  319. /*@Fixed value*/
  320. /*@-----------HOOK BEFORE REG INIT-----------*/
  321. ODM_CMNINFO_PLATFORM = 0,
  322. ODM_CMNINFO_ABILITY,
  323. ODM_CMNINFO_INTERFACE,
  324. ODM_CMNINFO_MP_TEST_CHIP,
  325. ODM_CMNINFO_IC_TYPE,
  326. ODM_CMNINFO_CUT_VER,
  327. ODM_CMNINFO_FAB_VER,
  328. ODM_CMNINFO_FW_VER,
  329. ODM_CMNINFO_FW_SUB_VER,
  330. ODM_CMNINFO_RF_TYPE,
  331. ODM_CMNINFO_RFE_TYPE,
  332. ODM_CMNINFO_DPK_EN,
  333. ODM_CMNINFO_BOARD_TYPE,
  334. ODM_CMNINFO_PACKAGE_TYPE,
  335. ODM_CMNINFO_EXT_LNA,
  336. ODM_CMNINFO_5G_EXT_LNA,
  337. ODM_CMNINFO_EXT_PA,
  338. ODM_CMNINFO_5G_EXT_PA,
  339. ODM_CMNINFO_GPA,
  340. ODM_CMNINFO_APA,
  341. ODM_CMNINFO_GLNA,
  342. ODM_CMNINFO_ALNA,
  343. ODM_CMNINFO_EXT_TRSW,
  344. ODM_CMNINFO_EXT_LNA_GAIN,
  345. ODM_CMNINFO_PATCH_ID,
  346. ODM_CMNINFO_BINHCT_TEST,
  347. ODM_CMNINFO_BWIFI_TEST,
  348. ODM_CMNINFO_SMART_CONCURRENT,
  349. ODM_CMNINFO_CONFIG_BB_RF,
  350. ODM_CMNINFO_IQKPAOFF,
  351. ODM_CMNINFO_HUBUSBMODE,
  352. ODM_CMNINFO_FWDWRSVDPAGEINPROGRESS,
  353. ODM_CMNINFO_TX_TP,
  354. ODM_CMNINFO_RX_TP,
  355. ODM_CMNINFO_SOUNDING_SEQ,
  356. ODM_CMNINFO_REGRFKFREEENABLE,
  357. ODM_CMNINFO_RFKFREEENABLE,
  358. ODM_CMNINFO_NORMAL_RX_PATH_CHANGE,
  359. ODM_CMNINFO_EFUSE0X3D8,
  360. ODM_CMNINFO_EFUSE0X3D7,
  361. ODM_CMNINFO_SOFT_AP_SPECIAL_SETTING,
  362. ODM_CMNINFO_X_CAP_SETTING,
  363. ODM_CMNINFO_ADVANCE_OTA,
  364. ODM_CMNINFO_HP_HWID,
  365. /*@-----------HOOK BEFORE REG INIT-----------*/
  366. /*@Dynamic value:*/
  367. /*@--------- POINTER REFERENCE-----------*/
  368. ODM_CMNINFO_TX_UNI,
  369. ODM_CMNINFO_RX_UNI,
  370. ODM_CMNINFO_BAND,
  371. ODM_CMNINFO_SEC_CHNL_OFFSET,
  372. ODM_CMNINFO_SEC_MODE,
  373. ODM_CMNINFO_BW,
  374. ODM_CMNINFO_CHNL,
  375. ODM_CMNINFO_FORCED_RATE,
  376. ODM_CMNINFO_ANT_DIV,
  377. ODM_CMNINFO_ADAPTIVE_SOML,
  378. ODM_CMNINFO_ADAPTIVITY,
  379. ODM_CMNINFO_SCAN,
  380. ODM_CMNINFO_POWER_SAVING,
  381. ODM_CMNINFO_ONE_PATH_CCA,
  382. ODM_CMNINFO_DRV_STOP,
  383. ODM_CMNINFO_PNP_IN,
  384. ODM_CMNINFO_INIT_ON,
  385. ODM_CMNINFO_ANT_TEST,
  386. ODM_CMNINFO_NET_CLOSED,
  387. ODM_CMNINFO_P2P_LINK,
  388. ODM_CMNINFO_FCS_MODE,
  389. ODM_CMNINFO_IS1ANTENNA,
  390. ODM_CMNINFO_RFDEFAULTPATH,
  391. ODM_CMNINFO_DFS_MASTER_ENABLE,
  392. ODM_CMNINFO_FORCE_TX_ANT_BY_TXDESC,
  393. ODM_CMNINFO_SET_S0S1_DEFAULT_ANTENNA,
  394. ODM_CMNINFO_SOFT_AP_MODE,
  395. ODM_CMNINFO_MP_MODE,
  396. ODM_CMNINFO_INTERRUPT_MASK,
  397. ODM_CMNINFO_BB_OPERATION_MODE,
  398. ODM_CMNINFO_BF_ANTDIV_DECISION,
  399. /*@--------- POINTER REFERENCE-----------*/
  400. /*@------------CALL BY VALUE-------------*/
  401. ODM_CMNINFO_WIFI_DIRECT,
  402. ODM_CMNINFO_WIFI_DISPLAY,
  403. ODM_CMNINFO_LINK_IN_PROGRESS,
  404. ODM_CMNINFO_LINK,
  405. ODM_CMNINFO_CMW500LINK,
  406. ODM_CMNINFO_STATION_STATE,
  407. ODM_CMNINFO_RSSI_MIN,
  408. ODM_CMNINFO_RSSI_MIN_BY_PATH,
  409. ODM_CMNINFO_DBG_COMP,
  410. ODM_CMNINFO_RA_THRESHOLD_HIGH, /*to be removed*/
  411. ODM_CMNINFO_RA_THRESHOLD_LOW, /*to be removed*/
  412. ODM_CMNINFO_RF_ANTENNA_TYPE,
  413. ODM_CMNINFO_WITH_EXT_ANTENNA_SWITCH,
  414. ODM_CMNINFO_BE_FIX_TX_ANT,
  415. ODM_CMNINFO_BT_ENABLED,
  416. ODM_CMNINFO_BT_HS_CONNECT_PROCESS,
  417. ODM_CMNINFO_BT_HS_RSSI,
  418. ODM_CMNINFO_BT_OPERATION,
  419. ODM_CMNINFO_BT_LIMITED_DIG,
  420. ODM_CMNINFO_AP_TOTAL_NUM,
  421. ODM_CMNINFO_POWER_TRAINING,
  422. ODM_CMNINFO_DFS_REGION_DOMAIN,
  423. ODM_CMNINFO_BT_CONTINUOUS_TURN,
  424. /*@------------CALL BY VALUE-------------*/
  425. /*@Dynamic ptr array hook itms.*/
  426. ODM_CMNINFO_STA_STATUS,
  427. ODM_CMNINFO_MAX,
  428. };
  429. enum phydm_rfe_bb_source_sel {
  430. PAPE_2G = 0,
  431. PAPE_5G = 1,
  432. LNA0N_2G = 2,
  433. LNAON_5G = 3,
  434. TRSW = 4,
  435. TRSW_B = 5,
  436. GNT_BT = 6,
  437. ZERO = 7,
  438. ANTSEL_0 = 8,
  439. ANTSEL_1 = 9,
  440. ANTSEL_2 = 0xa,
  441. ANTSEL_3 = 0xb,
  442. ANTSEL_4 = 0xc,
  443. ANTSEL_5 = 0xd,
  444. ANTSEL_6 = 0xe,
  445. ANTSEL_7 = 0xf
  446. };
  447. enum phydm_info_query {
  448. PHYDM_INFO_FA_OFDM,
  449. PHYDM_INFO_FA_CCK,
  450. PHYDM_INFO_FA_TOTAL,
  451. PHYDM_INFO_CCA_OFDM,
  452. PHYDM_INFO_CCA_CCK,
  453. PHYDM_INFO_CCA_ALL,
  454. PHYDM_INFO_CRC32_OK_VHT,
  455. PHYDM_INFO_CRC32_OK_HT,
  456. PHYDM_INFO_CRC32_OK_LEGACY,
  457. PHYDM_INFO_CRC32_OK_CCK,
  458. PHYDM_INFO_CRC32_ERROR_VHT,
  459. PHYDM_INFO_CRC32_ERROR_HT,
  460. PHYDM_INFO_CRC32_ERROR_LEGACY,
  461. PHYDM_INFO_CRC32_ERROR_CCK,
  462. PHYDM_INFO_EDCCA_FLAG,
  463. PHYDM_INFO_OFDM_ENABLE,
  464. PHYDM_INFO_CCK_ENABLE,
  465. PHYDM_INFO_CRC32_OK_HT_AGG,
  466. PHYDM_INFO_CRC32_ERROR_HT_AGG,
  467. PHYDM_INFO_DBG_PORT_0,
  468. PHYDM_INFO_CURR_IGI,
  469. PHYDM_INFO_RSSI_MIN,
  470. PHYDM_INFO_RSSI_MAX,
  471. PHYDM_INFO_CLM_RATIO,
  472. PHYDM_INFO_NHM_RATIO,
  473. };
  474. enum phydm_api {
  475. PHYDM_API_NBI = 1,
  476. PHYDM_API_CSI_MASK = 2,
  477. };
  478. enum phydm_func_idx { /*@F_XXX = PHYDM XXX function*/
  479. F00_DIG = 0,
  480. F01_RA_MASK = 1,
  481. F02_DYN_TXPWR = 2,
  482. F03_FA_CNT = 3,
  483. F04_RSSI_MNTR = 4,
  484. F05_CCK_PD = 5,
  485. F06_ANT_DIV = 6,
  486. F07_SMT_ANT = 7,
  487. F08_PWR_TRAIN = 8,
  488. F09_RA = 9,
  489. F10_PATH_DIV = 10,
  490. F11_DFS = 11,
  491. F12_DYN_ARFR = 12,
  492. F13_ADPTVTY = 13,
  493. F14_CFO_TRK = 14,
  494. F15_ENV_MNTR = 15,
  495. F16_PRI_CCA = 16,
  496. F17_ADPTV_SOML = 17,
  497. F18_LNA_SAT_CHK = 18,
  498. };
  499. /*@=[PHYDM supportability]==========================================*/
  500. enum odm_ability {
  501. ODM_BB_DIG = BIT(F00_DIG),
  502. ODM_BB_RA_MASK = BIT(F01_RA_MASK),
  503. ODM_BB_DYNAMIC_TXPWR = BIT(F02_DYN_TXPWR),
  504. ODM_BB_FA_CNT = BIT(F03_FA_CNT),
  505. ODM_BB_RSSI_MONITOR = BIT(F04_RSSI_MNTR),
  506. ODM_BB_CCK_PD = BIT(F05_CCK_PD),
  507. ODM_BB_ANT_DIV = BIT(F06_ANT_DIV),
  508. ODM_BB_SMT_ANT = BIT(F07_SMT_ANT),
  509. ODM_BB_PWR_TRAIN = BIT(F08_PWR_TRAIN),
  510. ODM_BB_RATE_ADAPTIVE = BIT(F09_RA),
  511. ODM_BB_PATH_DIV = BIT(F10_PATH_DIV),
  512. ODM_BB_DFS = BIT(F11_DFS),
  513. ODM_BB_DYNAMIC_ARFR = BIT(F12_DYN_ARFR),
  514. ODM_BB_ADAPTIVITY = BIT(F13_ADPTVTY),
  515. ODM_BB_CFO_TRACKING = BIT(F14_CFO_TRK),
  516. ODM_BB_ENV_MONITOR = BIT(F15_ENV_MNTR),
  517. ODM_BB_PRIMARY_CCA = BIT(F16_PRI_CCA),
  518. ODM_BB_ADAPTIVE_SOML = BIT(F17_ADPTV_SOML),
  519. ODM_BB_LNA_SAT_CHK = BIT(F18_LNA_SAT_CHK),
  520. };
  521. /*@=[PHYDM Debug Component]=====================================*/
  522. enum phydm_dbg_comp {
  523. /*@BB Driver Functions*/
  524. DBG_DIG = BIT(F00_DIG),
  525. DBG_RA_MASK = BIT(F01_RA_MASK),
  526. DBG_DYN_TXPWR = BIT(F02_DYN_TXPWR),
  527. DBG_FA_CNT = BIT(F03_FA_CNT),
  528. DBG_RSSI_MNTR = BIT(F04_RSSI_MNTR),
  529. DBG_CCKPD = BIT(F05_CCK_PD),
  530. DBG_ANT_DIV = BIT(F06_ANT_DIV),
  531. DBG_SMT_ANT = BIT(F07_SMT_ANT),
  532. DBG_PWR_TRAIN = BIT(F08_PWR_TRAIN),
  533. DBG_RA = BIT(F09_RA),
  534. DBG_PATH_DIV = BIT(F10_PATH_DIV),
  535. DBG_DFS = BIT(F11_DFS),
  536. DBG_DYN_ARFR = BIT(F12_DYN_ARFR),
  537. DBG_ADPTVTY = BIT(F13_ADPTVTY),
  538. DBG_CFO_TRK = BIT(F14_CFO_TRK),
  539. DBG_ENV_MNTR = BIT(F15_ENV_MNTR),
  540. DBG_PRI_CCA = BIT(F16_PRI_CCA),
  541. DBG_ADPTV_SOML = BIT(F17_ADPTV_SOML),
  542. DBG_LNA_SAT_CHK = BIT(F18_LNA_SAT_CHK),
  543. /*BIT(19)*/
  544. /*Neet to re-arrange*/
  545. DBG_PHY_STATUS = BIT(20),
  546. DBG_TMP = BIT(21),
  547. DBG_FW_TRACE = BIT(22),
  548. DBG_TXBF = BIT(23),
  549. DBG_COMMON_FLOW = BIT(24),
  550. DBG_COMP_MCC = BIT(25),
  551. /*BIT(26)*/
  552. DBG_DM_SUMMARY = BIT(27),
  553. ODM_PHY_CONFIG = BIT(28),
  554. ODM_COMP_INIT = BIT(29),
  555. DBG_CMN = BIT(30),/*@common*/
  556. ODM_COMP_API = BIT(31)
  557. };
  558. /*@=========================================================*/
  559. /*@ODM_CMNINFO_ONE_PATH_CCA*/
  560. enum odm_cca_path {
  561. ODM_CCA_2R = 0,
  562. ODM_CCA_1R_A = 1,
  563. ODM_CCA_1R_B = 2,
  564. };
  565. enum phy_reg_pg_type {
  566. PHY_REG_PG_RELATIVE_VALUE = 0,
  567. PHY_REG_PG_EXACT_VALUE = 1
  568. };
  569. enum phydm_offload_ability {
  570. PHYDM_PHY_PARAM_OFFLOAD = BIT(0),
  571. PHYDM_RF_IQK_OFFLOAD = BIT(1),
  572. };
  573. struct phydm_pause_lv {
  574. s8 lv_dig;
  575. s8 lv_cckpd;
  576. s8 lv_antdiv;
  577. s8 lv_adapt;
  578. s8 lv_adsl;
  579. };
  580. struct phydm_func_poiner {
  581. void (*pause_phydm_handler)(void *dm_void, u32 *val_buf, u8 val_len);
  582. };
  583. struct pkt_process_info {
  584. u8 phystatus_smp_mode_en; /*@send phystatus every sampling time*/
  585. u8 pre_ppdu_cnt;
  586. u8 lna_idx;
  587. u8 vga_idx;
  588. };
  589. #ifdef ODM_CONFIG_BT_COEXIST
  590. struct phydm_bt_info {
  591. boolean is_bt_enabled; /*@BT is enabled*/
  592. boolean is_bt_connect_process; /*@BT HS is under connection progress.*/
  593. u8 bt_hs_rssi; /*@BT HS mode wifi rssi value.*/
  594. boolean is_bt_hs_operation; /*@BT HS mode is under progress*/
  595. boolean is_bt_limited_dig; /*@BT is busy.*/
  596. };
  597. #endif
  598. struct phydm_iot_center {
  599. boolean is_linked_cmw500;
  600. u8 win_patch_id; /*@Customer ID*/
  601. u32 phydm_patch_id;
  602. };
  603. #if (RTL8822B_SUPPORT == 1)
  604. struct drp_rtl8822b_struct {
  605. enum bb_path path_judge;
  606. u16 path_a_cck_fa;
  607. u16 path_b_cck_fa;
  608. };
  609. #endif
  610. #ifdef CONFIG_MCC_DM
  611. #define MCC_DM_REG_NUM 32
  612. struct _phydm_mcc_dm_ {
  613. u8 mcc_status;
  614. u8 mcc_pre_status;
  615. u8 mcc_reg_id[MCC_DM_REG_NUM];
  616. u16 mcc_dm_reg[MCC_DM_REG_NUM];
  617. u8 mcc_dm_val[MCC_DM_REG_NUM][2];
  618. /*mcc DIG*/
  619. u8 mcc_rssi[2];
  620. /*u8 mcc_igi[2];*/
  621. u8 port[2][NUM_STA];
  622. };
  623. #endif
  624. #if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
  625. #if (RT_PLATFORM != PLATFORM_LINUX)
  626. typedef
  627. #endif
  628. struct dm_struct {
  629. #else/*for AP, CE Team*/
  630. struct dm_struct {
  631. #endif
  632. /*@Add for different team use temporarily*/
  633. void *adapter; /*@For CE/NIC team*/
  634. struct rtl8192cd_priv *priv; /*@For AP team*/
  635. boolean odm_ready;
  636. enum phy_reg_pg_type phy_reg_pg_value_type;
  637. u8 phy_reg_pg_version;
  638. u64 support_ability; /*@PHYDM function Supportability*/
  639. u64 pause_ability; /*@PHYDM function pause Supportability*/
  640. u64 debug_components;
  641. u8 cmn_dbg_msg_period;
  642. u8 cmn_dbg_msg_cnt;
  643. u32 fw_debug_components;
  644. u32 num_qry_phy_status_all; /*@CCK + OFDM*/
  645. u32 last_num_qry_phy_status_all;
  646. u32 rx_pwdb_ave;
  647. boolean is_init_hw_info_by_rfe;
  648. /*@------ ODM HANDLE, DRIVER NEEDS NOT TO HOOK------*/
  649. boolean is_cck_high_power;
  650. u8 rf_path_rx_enable;
  651. /*@------ ODM HANDLE, DRIVER NEEDS NOT TO HOOK------*/
  652. /* @COMMON INFORMATION */
  653. /*@Init value*/
  654. /*@-----------HOOK BEFORE REG INIT-----------*/
  655. u8 support_platform; /*@PHYDM Platform info WIN/AP/CE = 1/2/3 */
  656. u8 normal_rx_path;
  657. boolean brxagcswitch; /* @for rx AGC table switch in Microsoft case */
  658. u8 support_interface; /*@PHYDM PCIE/USB/SDIO = 1/2/3*/
  659. u32 support_ic_type; /*@PHYDM supported IC*/
  660. u8 ic_ip_series; /*N/AC/JGR3*/
  661. u8 cut_version; /*@cut version TestChip/A-cut/B-cut... = 0/1/2/3/...*/
  662. u8 fab_version; /*@Fab version TSMC/UMC = 0/1*/
  663. u8 fw_version;
  664. u8 fw_sub_version;
  665. u8 rf_type; /*@RF type 4T4R/3T3R/2T2R/1T2R/1T1R/...*/
  666. u8 rfe_type;
  667. u8 board_type;
  668. u8 package_type;
  669. u16 type_glna;
  670. u16 type_gpa;
  671. u16 type_alna;
  672. u16 type_apa;
  673. u8 ext_lna; /*@with 2G external LNA NO/Yes = 0/1*/
  674. u8 ext_lna_5g; /*@with 5G external LNA NO/Yes = 0/1*/
  675. u8 ext_pa; /*@with 2G external PNA NO/Yes = 0/1*/
  676. u8 ext_pa_5g; /*@with 5G external PNA NO/Yes = 0/1*/
  677. u8 efuse0x3d7; /*@with Efuse number*/
  678. u8 efuse0x3d8;
  679. u8 ext_trsw; /*@with external TRSW NO/Yes = 0/1*/
  680. u8 ext_lna_gain; /*@gain of external lna*/
  681. boolean is_in_hct_test;
  682. u8 wifi_test;
  683. boolean is_dual_mac_smart_concurrent;
  684. u32 bk_support_ability; /*SD4 only*/
  685. u8 with_extenal_ant_switch;
  686. /*@cck agc relative*/
  687. boolean cck_new_agc;
  688. s8 cck_lna_gain_table[8];
  689. /*@-------------------------------------*/
  690. u32 phydm_sys_up_time;
  691. u8 num_rf_path; /*@ex: 8821C=1, 8192E=2, 8814B=4*/
  692. u32 soft_ap_special_setting;
  693. s8 s8_dummy;
  694. u8 u8_dummy;
  695. u16 u16_dummy;
  696. u32 u32_dummy;
  697. u8 rfe_hwsetting_band;
  698. u8 p_advance_ota;
  699. boolean hp_hw_id;
  700. boolean BOOLEAN_temp;
  701. boolean is_dfs_band;
  702. u8 is_rx_blocking_en;
  703. u16 fw_offload_ability;
  704. /*@-----------HOOK BEFORE REG INIT-----------*/
  705. /*@===========================================================*/
  706. /*@====[ CALL BY Reference ]=========================================*/
  707. /*@===========================================================*/
  708. u64 *num_tx_bytes_unicast; /*@TX Unicast byte cnt*/
  709. u64 *num_rx_bytes_unicast; /*@RX Unicast byte cnt*/
  710. u8 *band_type; /*@2.4G/5G = 0/1*/
  711. u8 *sec_ch_offset; /*@Secondary channel offset don't_care/below/above = 0/1/2*/
  712. u8 *security; /*@security mode Open/WEP/AES/TKIP = 0/1/2/3*/
  713. u8 *band_width; /*@20M/40M/80M = 0/1/2*/
  714. u8 *channel; /*@central CH number*/
  715. boolean *is_scan_in_process;
  716. boolean *is_power_saving;
  717. u8 *one_path_cca; /*@CCA path 2-path/path-A/path-B = 0/1/2; using enum odm_cca_path.*/
  718. u8 *antenna_test;
  719. boolean *is_net_closed;
  720. boolean *is_fcs_mode_enable;
  721. /*@--------- For 8723B IQK-------------------------------------*/
  722. boolean *is_1_antenna;
  723. u8 *rf_default_path; /* @0:S1, 1:S0 */
  724. /*@-----------------------------------------------------------*/
  725. u16 *forced_data_rate;
  726. u8 *enable_antdiv;
  727. u8 *en_adap_soml;
  728. u8 *enable_adaptivity;
  729. u8 *hub_usb_mode; /*@1:USB2.0, 2:USB3.0*/
  730. boolean *is_fw_dw_rsvd_page_in_progress;
  731. u32 *current_tx_tp;
  732. u32 *current_rx_tp;
  733. u8 *sounding_seq;
  734. u32 *soft_ap_mode;
  735. u8 *mp_mode;
  736. u32 *interrupt_mask;
  737. u8 *bb_op_mode;
  738. /*@===========================================================*/
  739. /*@====[ CALL BY VALUE ]===========================================*/
  740. /*@===========================================================*/
  741. u8 disable_phydm_watchdog;
  742. boolean is_link_in_process;
  743. boolean is_wifi_direct;
  744. boolean is_wifi_display;
  745. boolean is_linked;
  746. boolean bsta_state;
  747. u8 rssi_min;
  748. u8 rssi_min_macid;
  749. u8 pre_rssi_min;
  750. u8 rssi_max;
  751. u8 rssi_max_macid;
  752. u8 rssi_min_by_path;
  753. boolean is_mp_chip;
  754. boolean is_one_entry_only;
  755. u32 one_entry_macid;
  756. u32 one_entry_tp;
  757. u32 pre_one_entry_tp;
  758. u8 pre_number_linked_client;
  759. u8 number_linked_client;
  760. u8 pre_number_active_client;
  761. u8 number_active_client;
  762. boolean is_disable_phy_api;
  763. u8 rssi_a;
  764. u8 rssi_b;
  765. u8 rssi_c;
  766. u8 rssi_d;
  767. s8 rxsc_80;
  768. s8 rxsc_40;
  769. s8 rxsc_20;
  770. s8 rxsc_l;
  771. u64 rssi_trsw;
  772. u64 rssi_trsw_h;
  773. u64 rssi_trsw_l;
  774. u64 rssi_trsw_iso;
  775. u8 tx_ant_status;
  776. u8 rx_ant_status;
  777. u8 cck_lna_idx;
  778. u8 cck_vga_idx;
  779. u8 curr_station_id;
  780. u8 ofdm_agc_idx[4];
  781. u8 rx_rate;
  782. u8 rate_ss;
  783. u8 tx_rate;
  784. u8 linked_interval;
  785. u8 pre_channel;
  786. u32 txagc_offset_value_a;
  787. boolean is_txagc_offset_positive_a;
  788. u32 txagc_offset_value_b;
  789. boolean is_txagc_offset_positive_b;
  790. u8 ap_total_num;
  791. /*@[traffic]*/
  792. u8 traffic_load;
  793. u8 pre_traffic_load;
  794. u32 tx_tp; /*@Mbps*/
  795. u32 rx_tp; /*@Mbps*/
  796. u32 total_tp; /*@Mbps*/
  797. u8 txrx_state_all; /*@0:tx, 1:rx, 2:bi-dir*/
  798. u64 cur_tx_ok_cnt;
  799. u64 cur_rx_ok_cnt;
  800. u64 last_tx_ok_cnt;
  801. u64 last_rx_ok_cnt;
  802. u16 consecutive_idlel_time; /*@unit: second*/
  803. /*@---------------------------*/
  804. boolean is_bb_swing_offset_positive_a;
  805. boolean is_bb_swing_offset_positive_b;
  806. /*@[DIG]*/
  807. boolean MPDIG_2G; /*off MPDIG*/
  808. u8 times_2g; /*@for MP DIG*/
  809. u8 force_igi; /*@for debug*/
  810. /*@[TDMA-DIG]*/
  811. u8 tdma_dig_timer_ms;
  812. u8 tdma_dig_state_number;
  813. u8 tdma_dig_low_upper_bond;
  814. u8 force_tdma_low_igi;
  815. u8 force_tdma_high_igi;
  816. u8 fix_expire_to_zero;
  817. boolean original_dig_restore;
  818. /*@---------------------------*/
  819. /*@[AntDiv]*/
  820. u8 ant_div_type;
  821. u8 antdiv_rssi;
  822. u8 fat_comb_a;
  823. u8 fat_comb_b;
  824. u8 antdiv_intvl;
  825. u8 ant_type;
  826. u8 ant_type2;
  827. u8 pre_ant_type;
  828. u8 pre_ant_type2;
  829. u8 antdiv_period;
  830. u8 evm_antdiv_period;
  831. u8 antdiv_select;
  832. u8 antdiv_train_num; /*@training time for each antenna in EVM method*/
  833. u8 stop_antdiv_rssi_th;
  834. u16 stop_antdiv_tp_diff_th;
  835. u16 stop_antdiv_tp_th;
  836. u8 antdiv_tp_period;
  837. u16 tp_active_th;
  838. u8 tp_active_occur;
  839. u8 path_select;
  840. u8 antdiv_evm_en;
  841. u8 bdc_holdstate;
  842. u8 antdiv_counter;
  843. /*@---------------------------*/
  844. u8 ndpa_period;
  845. boolean h2c_rarpt_connect;
  846. boolean cck_agc_report_type; /*@1:4bit LNA, 0:3bit LNA */
  847. u8 print_agc;
  848. u8 la_mode;
  849. /*@---8821C Antenna and RF Set BTG/WLG/WLA Select---------------*/
  850. u8 current_rf_set_8821c;
  851. u8 default_rf_set_8821c;
  852. u8 current_ant_num_8821c;
  853. u8 default_ant_num_8821c;
  854. u8 rfe_type_expand;
  855. /*@-----------------------------------------------------------*/
  856. /*@---For Adaptivtiy---------------------------------------------*/
  857. s8 TH_L2H_default;
  858. s8 th_edcca_hl_diff_default;
  859. s8 th_l2h_ini;
  860. s8 th_edcca_hl_diff;
  861. boolean carrier_sense_enable;
  862. /*@-----------------------------------------------------------*/
  863. u8 pre_dbg_priority;
  864. u8 nbi_set_result;
  865. u8 c2h_cmd_start;
  866. u8 fw_debug_trace[60];
  867. u8 pre_c2h_seq;
  868. boolean fw_buff_is_enpty;
  869. u32 data_frame_num;
  870. /*@--- for noise detection ---------------------------------------*/
  871. boolean is_noisy_state;
  872. boolean noisy_decision; /*@b_noisy*/
  873. boolean pre_b_noisy;
  874. u32 noisy_decision_smooth;
  875. /*@-----------------------------------------------------------*/
  876. /*@--- for MCC ant weighting ------------------------------------*/
  877. boolean is_stop_dym_ant_weighting;
  878. /*@-----------------------------------------------------------*/
  879. boolean is_disable_dym_ecs;
  880. boolean is_disable_dym_ant_weighting;
  881. struct sta_info *odm_sta_info[ODM_ASSOCIATE_ENTRY_NUM];
  882. struct cmn_sta_info *phydm_sta_info[ODM_ASSOCIATE_ENTRY_NUM];
  883. u8 phydm_macid_table[ODM_ASSOCIATE_ENTRY_NUM];/*@sta_idx = phydm_macid_table[HW_macid]*/
  884. #if (RATE_ADAPTIVE_SUPPORT == 1)
  885. u16 currmin_rpt_time;
  886. struct _phydm_txstatistic_ hw_stats;
  887. struct _odm_ra_info_ ra_info[ODM_ASSOCIATE_ENTRY_NUM];
  888. /*Use mac_id as array index. STA mac_id=0*/
  889. /*VWiFi Client mac_id={1, ODM_ASSOCIATE_ENTRY_NUM-1} //YJ,add,120119*/
  890. #endif
  891. /*@2012/02/14 MH Add to share 88E ra with other SW team*/
  892. /*We need to colelct all support abilit to a proper area.*/
  893. boolean ra_support88e;
  894. boolean *is_driver_stopped;
  895. boolean *is_driver_is_going_to_pnp_set_power_sleep;
  896. boolean *pinit_adpt_in_progress;
  897. boolean is_user_assign_level;
  898. u8 RSSI_BT; /*@come from BT*/
  899. /*@---PSD Relative ---------------------------------------------*/
  900. boolean is_psd_in_process;
  901. boolean is_psd_active;
  902. /*@-----------------------------------------------------------*/
  903. boolean bsomlenabled; /* @D-SoML control */
  904. boolean bhtstfdisabled; /* @dynamic HTSTF gain control*/
  905. boolean disrxhpsoml; /* @RxHP control with D-SoML*/
  906. u32 n_iqk_cnt;
  907. u32 n_iqk_ok_cnt;
  908. u32 n_iqk_fail_cnt;
  909. #if (DM_ODM_SUPPORT_TYPE & ODM_AP)
  910. boolean config_bbrf;
  911. #endif
  912. boolean is_disable_power_training;
  913. boolean is_bt_continuous_turn;
  914. u8 enhance_pwr_th[3];
  915. u8 set_pwr_th[3];
  916. /*@----------Dyn Tx Pwr ---------------------------------------*/
  917. #ifdef BB_RAM_SUPPORT
  918. struct phydm_bb_ram_ctrl p_bb_ram_ctrl;
  919. #endif
  920. u8 dynamic_tx_high_power_lvl;
  921. void (*fill_desc_dyntxpwr)(void *dm, u8 *desc, u8 dyn_tx_power);
  922. u8 last_dtp_lvl;
  923. u8 min_power_index;
  924. u32 tx_agc_ofdm_18_6;
  925. /*-------------------------------------------------------------*/
  926. u8 rx_pkt_type;
  927. #ifdef CONFIG_PHYDM_DFS_MASTER
  928. u8 dfs_region_domain;
  929. u8 *dfs_master_enabled;
  930. /*@---phydm_radar_detect_with_dbg_parm start --------------------*/
  931. u8 radar_detect_dbg_parm_en;
  932. u32 radar_detect_reg_918;
  933. u32 radar_detect_reg_91c;
  934. u32 radar_detect_reg_920;
  935. u32 radar_detect_reg_924;
  936. /*@-----------------------------------------------------------*/
  937. #endif
  938. /*@=== PHYDM Timer ========================================== (start)*/
  939. struct phydm_timer_list mpt_dig_timer;
  940. struct phydm_timer_list fast_ant_training_timer;
  941. #ifdef ODM_EVM_ENHANCE_ANTDIV
  942. struct phydm_timer_list evm_fast_ant_training_timer;
  943. #endif
  944. #ifdef PHYDM_TDMA_DIG_SUPPORT
  945. struct phydm_timer_list tdma_dig_timer;
  946. #endif
  947. struct phydm_timer_list sbdcnt_timer;
  948. /*@=== PHYDM Workitem ======================================= (start)*/
  949. #if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
  950. #if USE_WORKITEM
  951. RT_WORK_ITEM fast_ant_training_workitem;
  952. RT_WORK_ITEM ra_rpt_workitem;
  953. RT_WORK_ITEM sbdcnt_workitem;
  954. RT_WORK_ITEM phydm_evm_antdiv_workitem;
  955. #endif
  956. #endif
  957. /*@=== PHYDM Structure ======================================== (start)*/
  958. struct phydm_func_poiner phydm_func_handler;
  959. struct phydm_iot_center iot_table;
  960. #ifdef ODM_CONFIG_BT_COEXIST
  961. struct phydm_bt_info bt_info_table;
  962. #endif
  963. struct pkt_process_info pkt_proc_struct;
  964. struct phydm_adaptivity_struct adaptivity;
  965. struct _DFS_STATISTICS dfs;
  966. struct odm_noise_monitor noise_level;
  967. struct odm_phy_dbg_info phy_dbg_info;
  968. #ifdef CONFIG_ADAPTIVE_SOML
  969. struct adaptive_soml dm_soml_table;
  970. #endif
  971. #if (defined(CONFIG_PHYDM_ANTENNA_DIVERSITY))
  972. #if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
  973. struct _BF_DIV_COEX_ dm_bdc_table;
  974. #endif
  975. #if (defined(CONFIG_HL_SMART_ANTENNA))
  976. struct smt_ant_honbo dm_sat_table;
  977. #endif
  978. #endif
  979. #if (defined(CONFIG_SMART_ANTENNA))
  980. struct smt_ant smtant_table;
  981. #endif
  982. struct _hal_rf_ rf_table; /*@for HALRF function*/
  983. struct dm_rf_calibration_struct rf_calibrate_info;
  984. struct dm_iqk_info IQK_info;
  985. struct dm_dpk_info dpk_info;
  986. #ifdef CONFIG_PHYDM_ANTENNA_DIVERSITY
  987. struct phydm_fat_struct dm_fat_table;
  988. struct sw_antenna_switch dm_swat_table;
  989. #endif
  990. struct phydm_dig_struct dm_dig_table;
  991. #ifdef PHYDM_LNA_SAT_CHK_SUPPORT
  992. struct phydm_lna_sat_t dm_lna_sat_info;
  993. #endif
  994. #ifdef CONFIG_MCC_DM
  995. struct _phydm_mcc_dm_ mcc_dm;
  996. #endif
  997. #ifdef PHYDM_SUPPORT_CCKPD
  998. struct phydm_cckpd_struct dm_cckpd_table;
  999. #endif
  1000. #ifdef PHYDM_PRIMARY_CCA
  1001. struct phydm_pricca_struct dm_pri_cca;
  1002. #endif
  1003. struct ra_table dm_ra_table;
  1004. struct phydm_fa_struct false_alm_cnt;
  1005. #ifdef PHYDM_TDMA_DIG_SUPPORT
  1006. struct phydm_fa_acc_struct false_alm_cnt_acc;
  1007. #ifdef IS_USE_NEW_TDMA
  1008. struct phydm_fa_acc_struct false_alm_cnt_acc_low;
  1009. #endif
  1010. #endif
  1011. struct phydm_cfo_track_struct dm_cfo_track;
  1012. struct ccx_info dm_ccx_info;
  1013. struct odm_power_trim_data power_trim_data;
  1014. #if (RTL8822B_SUPPORT == 1)
  1015. struct drp_rtl8822b_struct phydm_rtl8822b;
  1016. #endif
  1017. #ifdef CONFIG_PSD_TOOL
  1018. struct psd_info dm_psd_table;
  1019. #endif
  1020. #if (PHYDM_LA_MODE_SUPPORT == 1)
  1021. struct rt_adcsmp adcsmp;
  1022. #endif
  1023. #if (defined(CONFIG_PATH_DIVERSITY))
  1024. struct _ODM_PATH_DIVERSITY_ dm_path_div;
  1025. #endif
  1026. #if (defined(CONFIG_ANT_DETECTION))
  1027. struct _ANT_DETECTED_INFO ant_detected_info;
  1028. #endif
  1029. #if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
  1030. #if (BEAMFORMING_SUPPORT == 1)
  1031. struct _RT_BEAMFORMING_INFO beamforming_info;
  1032. #endif
  1033. #endif
  1034. #ifdef PHYDM_AUTO_DEGBUG
  1035. struct phydm_auto_dbg_struct auto_dbg_table;
  1036. #endif
  1037. struct phydm_pause_lv pause_lv_table;
  1038. struct phydm_api_stuc api_table;
  1039. #ifdef PHYDM_POWER_TRAINING_SUPPORT
  1040. struct phydm_pow_train_stuc pow_train_table;
  1041. #endif
  1042. #ifdef PHYDM_PMAC_TX_SETTING_SUPPORT
  1043. struct phydm_pmac_tx dm_pmac_tx_table;
  1044. #endif
  1045. #ifdef PHYDM_MP_SUPPORT
  1046. struct phydm_mp dm_mp_table;
  1047. #endif
  1048. /*@==========================================================*/
  1049. #if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
  1050. #if (RT_PLATFORM != PLATFORM_LINUX)
  1051. } dm_struct; /*@DM_Dynamic_Mechanism_Structure*/
  1052. #else
  1053. };
  1054. #endif
  1055. #else /*@for AP,CE Team*/
  1056. };
  1057. #endif
  1058. enum phydm_adv_ota {
  1059. PHYDM_PATHB_1RCCA = BIT(0),
  1060. PHYDM_HP_OTA_SETTING_A = BIT(1),
  1061. PHYDM_HP_OTA_SETTING_B = BIT(2),
  1062. PHYDM_ASUS_OTA_SETTING = BIT(3),
  1063. PHYDM_ASUS_OTA_SETTING_CCK_PATH = BIT(4),
  1064. PHYDM_HP_OTA_SETTING_CCK_PATH = BIT(5),
  1065. PHYDM_LENOVO_OTA_SETTING_NBI_CSI = BIT(6),
  1066. };
  1067. enum phydm_bb_op_mode {
  1068. PHYDM_PERFORMANCE_MODE = 0, /*Service one device*/
  1069. PHYDM_BALANCE_MODE = 1, /*@Service more than one device*/
  1070. };
  1071. enum phydm_structure_type {
  1072. PHYDM_FALSEALMCNT,
  1073. PHYDM_CFOTRACK,
  1074. PHYDM_ADAPTIVITY,
  1075. PHYDM_DFS,
  1076. PHYDM_ROMINFO,
  1077. };
  1078. enum odm_bb_config_type {
  1079. CONFIG_BB_PHY_REG,
  1080. CONFIG_BB_AGC_TAB,
  1081. CONFIG_BB_AGC_TAB_2G,
  1082. CONFIG_BB_AGC_TAB_5G,
  1083. CONFIG_BB_PHY_REG_PG,
  1084. CONFIG_BB_PHY_REG_MP,
  1085. CONFIG_BB_AGC_TAB_DIFF,
  1086. CONFIG_BB_RF_CAL_INIT,
  1087. };
  1088. enum odm_rf_config_type {
  1089. CONFIG_RF_RADIO,
  1090. CONFIG_RF_TXPWR_LMT,
  1091. };
  1092. enum odm_fw_config_type {
  1093. CONFIG_FW_NIC,
  1094. CONFIG_FW_NIC_2,
  1095. CONFIG_FW_AP,
  1096. CONFIG_FW_AP_2,
  1097. CONFIG_FW_MP,
  1098. CONFIG_FW_WOWLAN,
  1099. CONFIG_FW_WOWLAN_2,
  1100. CONFIG_FW_AP_WOWLAN,
  1101. CONFIG_FW_BT,
  1102. };
  1103. /*status code*/
  1104. #if (DM_ODM_SUPPORT_TYPE != ODM_WIN)
  1105. enum rt_status {
  1106. RT_STATUS_SUCCESS,
  1107. RT_STATUS_FAILURE,
  1108. RT_STATUS_PENDING,
  1109. RT_STATUS_RESOURCE,
  1110. RT_STATUS_INVALID_CONTEXT,
  1111. RT_STATUS_INVALID_PARAMETER,
  1112. RT_STATUS_NOT_SUPPORT,
  1113. RT_STATUS_OS_API_FAILED,
  1114. };
  1115. #endif /*@end of enum rt_status definition*/
  1116. void
  1117. phydm_watchdog_lps(struct dm_struct *dm);
  1118. void
  1119. phydm_watchdog_lps_32k(struct dm_struct *dm);
  1120. void
  1121. phydm_txcurrentcalibration(struct dm_struct *dm);
  1122. void
  1123. phydm_dm_early_init(struct dm_struct *dm);
  1124. void
  1125. odm_dm_init(struct dm_struct *dm);
  1126. void
  1127. odm_dm_reset(struct dm_struct *dm);
  1128. void
  1129. phydm_fwoffload_ability_init(struct dm_struct *dm,
  1130. enum phydm_offload_ability offload_ability);
  1131. void
  1132. phydm_fwoffload_ability_clear(struct dm_struct *dm,
  1133. enum phydm_offload_ability offload_ability);
  1134. void
  1135. phydm_supportability_en(void *dm_void, char input[][16], u32 *_used,
  1136. char *output, u32 *_out_len);
  1137. void
  1138. phydm_pause_dm_watchdog(void *dm_void, enum phydm_pause_type pause_type);
  1139. void
  1140. phydm_watchdog(struct dm_struct *dm);
  1141. void
  1142. phydm_watchdog_mp(struct dm_struct *dm);
  1143. u8
  1144. phydm_pause_func(void *dm_void, enum phydm_func_idx pause_func,
  1145. enum phydm_pause_type pause_type,
  1146. enum phydm_pause_level pause_lv, u8 val_lehgth, u32 *val_buf);
  1147. void
  1148. phydm_pause_func_console(void *dm_void, char input[][16], u32 *_used,
  1149. char *output, u32 *_out_len);
  1150. void
  1151. odm_cmn_info_init(struct dm_struct *dm, enum odm_cmninfo cmn_info, u64 value);
  1152. void
  1153. odm_cmn_info_hook(struct dm_struct *dm, enum odm_cmninfo cmn_info, void *value);
  1154. void
  1155. odm_cmn_info_update(struct dm_struct *dm, u32 cmn_info, u64 value);
  1156. u32
  1157. phydm_cmn_info_query(struct dm_struct *dm, enum phydm_info_query info_type);
  1158. void
  1159. odm_init_all_timers(struct dm_struct *dm);
  1160. void
  1161. odm_cancel_all_timers(struct dm_struct *dm);
  1162. void
  1163. odm_release_all_timers(struct dm_struct *dm);
  1164. void *
  1165. phydm_get_structure(struct dm_struct *dm, u8 structure_type);
  1166. void
  1167. phydm_dc_cancellation(struct dm_struct *dm);
  1168. void
  1169. phydm_receiver_blocking(void *dm_void);
  1170. #if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
  1171. void
  1172. odm_init_all_work_items(
  1173. struct dm_struct *dm
  1174. );
  1175. void
  1176. odm_free_all_work_items(
  1177. struct dm_struct *dm
  1178. );
  1179. #endif /*@#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)*/
  1180. #if (DM_ODM_SUPPORT_TYPE == ODM_CE)
  1181. void
  1182. odm_dtc(struct dm_struct *dm);
  1183. #endif
  1184. #if (DM_ODM_SUPPORT_TYPE == ODM_AP)
  1185. void
  1186. odm_init_all_threads(
  1187. struct dm_struct *dm
  1188. );
  1189. void
  1190. odm_stop_all_threads(
  1191. struct dm_struct *dm
  1192. );
  1193. #endif
  1194. #endif