phydm.h 31 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363
  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. #ifndef __HALDMOUTSRC_H__
  21. #define __HALDMOUTSRC_H__
  22. /*============================================================*/
  23. /*include files*/
  24. /*============================================================*/
  25. #include "phydm_pre_define.h"
  26. #include "phydm_dig.h"
  27. #if PHYDM_SUPPORT_EDCA
  28. #include "phydm_edcaturbocheck.h"
  29. #endif
  30. #include "phydm_pathdiv.h"
  31. #include "phydm_antdiv.h"
  32. #include "phydm_antdect.h"
  33. #include "phydm_dynamicbbpowersaving.h"
  34. #include "phydm_rainfo.h"
  35. #include "phydm_dynamictxpower.h"
  36. #include "phydm_cfotracking.h"
  37. #include "phydm_acs.h"
  38. #include "phydm_adaptivity.h"
  39. #include "phydm_iqk.h"
  40. #include "phydm_dfs.h"
  41. #include "phydm_ccx.h"
  42. #include "txbf/phydm_hal_txbf_api.h"
  43. #include "phydm_adc_sampling.h"
  44. #include "phydm_dynamic_rx_path.h"
  45. #include "phydm_psd.h"
  46. #if (DM_ODM_SUPPORT_TYPE & (ODM_CE | ODM_WIN))
  47. #include "phydm_beamforming.h"
  48. #endif
  49. #if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
  50. #include "halphyrf_ap.h"
  51. #endif
  52. #if (DM_ODM_SUPPORT_TYPE & (ODM_CE))
  53. #include "phydm_noisemonitor.h"
  54. #include "halphyrf_ce.h"
  55. #endif
  56. #if (DM_ODM_SUPPORT_TYPE & (ODM_WIN))
  57. #include "halphyrf_win.h"
  58. #include "phydm_noisemonitor.h"
  59. #endif
  60. /*============================================================*/
  61. /*Definition */
  62. /*============================================================*/
  63. /* Traffic load decision */
  64. #define TRAFFIC_ULTRA_LOW 1
  65. #define TRAFFIC_LOW 2
  66. #define TRAFFIC_MID 3
  67. #define TRAFFIC_HIGH 4
  68. #define NONE 0
  69. /*NBI API------------------------------------*/
  70. #define NBI_ENABLE 1
  71. #define NBI_DISABLE 2
  72. #define NBI_TABLE_SIZE_128 27
  73. #define NBI_TABLE_SIZE_256 59
  74. #define NUM_START_CH_80M 7
  75. #define NUM_START_CH_40M 14
  76. #define CH_OFFSET_40M 2
  77. #define CH_OFFSET_80M 6
  78. /*CSI MASK API------------------------------------*/
  79. #define CSI_MASK_ENABLE 1
  80. #define CSI_MASK_DISABLE 2
  81. /*------------------------------------------------*/
  82. #define FFT_128_TYPE 1
  83. #define FFT_256_TYPE 2
  84. #define SET_SUCCESS 1
  85. #define SET_ERROR 2
  86. #define SET_NO_NEED 3
  87. #define FREQ_POSITIVE 1
  88. #define FREQ_NEGATIVE 2
  89. #define MAX_2(_x_, _y_) (((_x_)>(_y_))? (_x_) : (_y_))
  90. #define MIN_2(_x_, _y_) (((_x_)<(_y_))? (_x_) : (_y_))
  91. #if (DM_ODM_SUPPORT_TYPE == ODM_AP)
  92. #define PHYDM_WATCH_DOG_PERIOD 1
  93. #else
  94. #define PHYDM_WATCH_DOG_PERIOD 2
  95. #endif
  96. /*============================================================*/
  97. /*structure and define*/
  98. /*============================================================*/
  99. /*2011/09/20 MH Add for AP/ADSLpseudo DM structuer requirement.*/
  100. /*We need to remove to other position???*/
  101. #if (DM_ODM_SUPPORT_TYPE & (ODM_CE | ODM_WIN))
  102. struct rtl8192cd_priv {
  103. u8 temp;
  104. };
  105. #endif
  106. #if (DM_ODM_SUPPORT_TYPE & ODM_AP)
  107. struct _ADAPTER {
  108. u8 temp;
  109. #ifdef AP_BUILD_WORKAROUND
  110. HAL_DATA_TYPE *temp2;
  111. struct rtl8192cd_priv *priv;
  112. #endif
  113. };
  114. #endif
  115. #if (DM_ODM_SUPPORT_TYPE == ODM_AP)
  116. struct _WLAN_STA {
  117. u8 temp;
  118. };
  119. #endif
  120. struct _dynamic_primary_cca {
  121. u8 pri_cca_flag;
  122. u8 intf_flag;
  123. u8 intf_type;
  124. u8 dup_rts_flag;
  125. u8 monitor_flag;
  126. u8 CH_offset;
  127. u8 MF_state;
  128. };
  129. #if (DM_ODM_SUPPORT_TYPE & ODM_AP)
  130. #ifdef ADSL_AP_BUILD_WORKAROUND
  131. #define MAX_TOLERANCE 5
  132. #define IQK_DELAY_TIME 1 /*ms*/
  133. #endif
  134. #endif /*#if(DM_ODM_SUPPORT_TYPE & (ODM_AP))*/
  135. #define dm_type_by_fw 0
  136. #define dm_type_by_driver 1
  137. /*Declare for common info*/
  138. #define IQK_THRESHOLD 8
  139. #define DPK_THRESHOLD 4
  140. #if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
  141. __PACK struct _odm_phy_status_info_ {
  142. u8 rx_pwdb_all;
  143. u8 signal_quality; /* in 0-100 index. */
  144. u8 rx_mimo_signal_strength[4]; /* in 0~100 index */
  145. u8 rx_mimo_evm_dbm[4]; /* per-path's original EVM (dbm) */
  146. s8 rx_mimo_signal_quality[4]; /* EVM */
  147. s8 rx_snr[4]; /* per-path's SNR */
  148. #if (ODM_PHY_STATUS_NEW_TYPE_SUPPORT == 1)
  149. u8 rx_count:2; /* RX path counter---*/
  150. u8 band_width:2;
  151. u8 rxsc:4; /* sub-channel---*/
  152. #else
  153. u8 band_width;
  154. #endif
  155. #if (ODM_PHY_STATUS_NEW_TYPE_SUPPORT == 1)
  156. u8 channel; /* channel number---*/
  157. boolean is_mu_packet; /* is MU packet or not---*/
  158. boolean is_beamformed; /* BF packet---*/
  159. #endif
  160. };
  161. struct _odm_phy_status_info_append_ {
  162. u8 MAC_CRC32;
  163. };
  164. #else
  165. struct _odm_phy_status_info_ {
  166. /* */
  167. /* Be care, if you want to add any element please insert between */
  168. /* rx_pwdb_all & signal_strength. */
  169. /* */
  170. #if (DM_ODM_SUPPORT_TYPE & (ODM_WIN))
  171. u32 rx_pwdb_all; /*in new Phy-status IC, represent the max PWDB among all path*/
  172. #else
  173. u8 rx_pwdb_all;
  174. #endif
  175. u8 signal_quality; /* in 0-100 index. */
  176. s8 rx_mimo_signal_quality[4]; /* per-path's EVM translate to 0~100% */
  177. u8 rx_mimo_evm_dbm[4]; /* per-path's original EVM (dbm) */
  178. u8 rx_mimo_signal_strength[4]; /* in 0~100 index */
  179. s16 cfo_short[4]; /* per-path's cfo_short */
  180. s16 cfo_tail[4]; /* per-path's cfo_tail */
  181. s8 rx_power; /* in dBm Translate from PWdB */
  182. s8 recv_signal_power; /* Real power in dBm for this packet, no beautification and aggregation. Keep this raw info to be used for the other procedures. */
  183. u8 bt_rx_rssi_percentage;
  184. u8 signal_strength; /* in 0-100 index. */
  185. s8 rx_pwr[4]; /* per-path's pwdb */
  186. s8 rx_snr[4]; /* per-path's SNR */
  187. /* s8 BB_Backup[13]; backup reg. */
  188. #if (ODM_PHY_STATUS_NEW_TYPE_SUPPORT == 1)
  189. u8 rx_count:2; /* RX path counter---*/
  190. u8 band_width:2;
  191. u8 rxsc:4; /* sub-channel---*/
  192. #else
  193. u8 band_width;
  194. #endif
  195. #if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
  196. u8 bt_coex_pwr_adjust;
  197. #endif
  198. #if (ODM_PHY_STATUS_NEW_TYPE_SUPPORT == 1)
  199. u8 channel; /* channel number---*/
  200. boolean is_mu_packet; /* is MU packet or not---*/
  201. boolean is_beamformed; /* BF packet---*/
  202. #endif
  203. };
  204. #endif
  205. struct _odm_per_pkt_info_ {
  206. u8 data_rate;
  207. u8 station_id;
  208. boolean is_packet_match_bssid;
  209. boolean is_packet_to_self;
  210. boolean is_packet_beacon;
  211. boolean is_to_self;
  212. u8 ppdu_cnt;
  213. };
  214. struct _odm_phy_dbg_info_ {
  215. /*ODM Write,debug info*/
  216. s8 rx_snr_db[4];
  217. u32 num_qry_phy_status;
  218. u32 num_qry_phy_status_cck;
  219. u32 num_qry_phy_status_ofdm;
  220. #if (ODM_PHY_STATUS_NEW_TYPE_SUPPORT == 1)
  221. u32 num_qry_mu_pkt;
  222. u32 num_qry_bf_pkt;
  223. u32 num_qry_mu_vht_pkt[40];
  224. u32 num_qry_vht_pkt[40];
  225. boolean is_ldpc_pkt;
  226. boolean is_stbc_pkt;
  227. u8 num_of_ppdu[4];
  228. u8 gid_num[4];
  229. #endif
  230. u8 num_qry_beacon_pkt;
  231. /* Others */
  232. s32 rx_evm[4];
  233. };
  234. /*2011/20/20 MH For MP driver RT_WLAN_STA = struct sta_info*/
  235. /*Please declare below ODM relative info in your STA info structure.*/
  236. #if 1
  237. struct _ODM_STA_INFO {
  238. /*Driver Write*/
  239. boolean is_used; /*record the sta status link or not?*/
  240. u8 iot_peer; /*Enum value. HT_IOT_PEER_E*/
  241. /*ODM Write*/
  242. /*PHY_STATUS_INFO*/
  243. u8 rssi_path[4];
  244. u8 rssi_ave;
  245. u8 RXEVM[4];
  246. u8 RXSNR[4];
  247. };
  248. #endif
  249. enum odm_cmninfo_e {
  250. /*Fixed value*/
  251. /*-----------HOOK BEFORE REG INIT-----------*/
  252. ODM_CMNINFO_PLATFORM = 0,
  253. ODM_CMNINFO_ABILITY,
  254. ODM_CMNINFO_INTERFACE,
  255. ODM_CMNINFO_MP_TEST_CHIP,
  256. ODM_CMNINFO_IC_TYPE,
  257. ODM_CMNINFO_CUT_VER,
  258. ODM_CMNINFO_FAB_VER,
  259. ODM_CMNINFO_RF_TYPE,
  260. ODM_CMNINFO_RFE_TYPE,
  261. ODM_CMNINFO_DPK_EN,
  262. ODM_CMNINFO_BOARD_TYPE,
  263. ODM_CMNINFO_PACKAGE_TYPE,
  264. ODM_CMNINFO_EXT_LNA,
  265. ODM_CMNINFO_5G_EXT_LNA,
  266. ODM_CMNINFO_EXT_PA,
  267. ODM_CMNINFO_5G_EXT_PA,
  268. ODM_CMNINFO_GPA,
  269. ODM_CMNINFO_APA,
  270. ODM_CMNINFO_GLNA,
  271. ODM_CMNINFO_ALNA,
  272. ODM_CMNINFO_EXT_TRSW,
  273. ODM_CMNINFO_EXT_LNA_GAIN,
  274. ODM_CMNINFO_PATCH_ID,
  275. ODM_CMNINFO_BINHCT_TEST,
  276. ODM_CMNINFO_BWIFI_TEST,
  277. ODM_CMNINFO_SMART_CONCURRENT,
  278. ODM_CMNINFO_CONFIG_BB_RF,
  279. ODM_CMNINFO_DOMAIN_CODE_2G,
  280. ODM_CMNINFO_DOMAIN_CODE_5G,
  281. ODM_CMNINFO_IQKFWOFFLOAD,
  282. ODM_CMNINFO_IQKPAOFF,
  283. ODM_CMNINFO_HUBUSBMODE,
  284. ODM_CMNINFO_FWDWRSVDPAGEINPROGRESS,
  285. ODM_CMNINFO_TX_TP,
  286. ODM_CMNINFO_RX_TP,
  287. ODM_CMNINFO_SOUNDING_SEQ,
  288. ODM_CMNINFO_REGRFKFREEENABLE,
  289. ODM_CMNINFO_RFKFREEENABLE,
  290. ODM_CMNINFO_NORMAL_RX_PATH_CHANGE,
  291. ODM_CMNINFO_EFUSE0X3D8,
  292. ODM_CMNINFO_EFUSE0X3D7,
  293. ODM_CMNINFO_SOFT_AP_SPECIAL_SETTING,
  294. ODM_CMNINFO_HALMAC_ABILITY,
  295. /*-----------HOOK BEFORE REG INIT-----------*/
  296. /*Dynamic value:*/
  297. /*--------- POINTER REFERENCE-----------*/
  298. ODM_CMNINFO_MAC_PHY_MODE,
  299. ODM_CMNINFO_TX_UNI,
  300. ODM_CMNINFO_RX_UNI,
  301. ODM_CMNINFO_WM_MODE,
  302. ODM_CMNINFO_BAND,
  303. ODM_CMNINFO_SEC_CHNL_OFFSET,
  304. ODM_CMNINFO_SEC_MODE,
  305. ODM_CMNINFO_BW,
  306. ODM_CMNINFO_CHNL,
  307. ODM_CMNINFO_FORCED_RATE,
  308. ODM_CMNINFO_ANT_DIV,
  309. ODM_CMNINFO_ADAPTIVITY,
  310. ODM_CMNINFO_DMSP_GET_VALUE,
  311. ODM_CMNINFO_BUDDY_ADAPTOR,
  312. ODM_CMNINFO_DMSP_IS_MASTER,
  313. ODM_CMNINFO_SCAN,
  314. ODM_CMNINFO_POWER_SAVING,
  315. ODM_CMNINFO_ONE_PATH_CCA,
  316. ODM_CMNINFO_DRV_STOP,
  317. ODM_CMNINFO_PNP_IN,
  318. ODM_CMNINFO_INIT_ON,
  319. ODM_CMNINFO_ANT_TEST,
  320. ODM_CMNINFO_NET_CLOSED,
  321. ODM_CMNINFO_FORCED_IGI_LB,
  322. ODM_CMNINFO_P2P_LINK,
  323. ODM_CMNINFO_FCS_MODE,
  324. ODM_CMNINFO_IS1ANTENNA,
  325. ODM_CMNINFO_RFDEFAULTPATH,
  326. ODM_CMNINFO_DFS_MASTER_ENABLE,
  327. ODM_CMNINFO_FORCE_TX_ANT_BY_TXDESC,
  328. ODM_CMNINFO_SET_S0S1_DEFAULT_ANTENNA,
  329. ODM_CMNINFO_SOFT_AP_MODE,
  330. /*--------- POINTER REFERENCE-----------*/
  331. /*------------CALL BY VALUE-------------*/
  332. ODM_CMNINFO_WIFI_DIRECT,
  333. ODM_CMNINFO_WIFI_DISPLAY,
  334. ODM_CMNINFO_LINK_IN_PROGRESS,
  335. ODM_CMNINFO_LINK,
  336. ODM_CMNINFO_CMW500LINK,
  337. ODM_CMNINFO_LPSPG,
  338. ODM_CMNINFO_STATION_STATE,
  339. ODM_CMNINFO_RSSI_MIN,
  340. ODM_CMNINFO_DBG_COMP,
  341. ODM_CMNINFO_DBG_LEVEL,
  342. ODM_CMNINFO_RA_THRESHOLD_HIGH,
  343. ODM_CMNINFO_RA_THRESHOLD_LOW,
  344. ODM_CMNINFO_RF_ANTENNA_TYPE,
  345. ODM_CMNINFO_WITH_EXT_ANTENNA_SWITCH,
  346. ODM_CMNINFO_BE_FIX_TX_ANT,
  347. ODM_CMNINFO_BT_ENABLED,
  348. ODM_CMNINFO_BT_HS_CONNECT_PROCESS,
  349. ODM_CMNINFO_BT_HS_RSSI,
  350. ODM_CMNINFO_BT_OPERATION,
  351. ODM_CMNINFO_BT_LIMITED_DIG,
  352. ODM_CMNINFO_BT_DIG,
  353. ODM_CMNINFO_BT_BUSY,
  354. ODM_CMNINFO_BT_DISABLE_EDCA,
  355. #if (DM_ODM_SUPPORT_TYPE & ODM_AP) /*for repeater mode add by YuChen 2014.06.23*/
  356. #ifdef UNIVERSAL_REPEATER
  357. ODM_CMNINFO_VXD_LINK,
  358. #endif
  359. #endif
  360. ODM_CMNINFO_AP_TOTAL_NUM,
  361. ODM_CMNINFO_POWER_TRAINING,
  362. ODM_CMNINFO_DFS_REGION_DOMAIN,
  363. /*------------CALL BY VALUE-------------*/
  364. /*Dynamic ptr array hook itms.*/
  365. ODM_CMNINFO_STA_STATUS,
  366. ODM_CMNINFO_MAX,
  367. };
  368. enum phydm_info_query_e {
  369. PHYDM_INFO_FA_OFDM,
  370. PHYDM_INFO_FA_CCK,
  371. PHYDM_INFO_FA_TOTAL,
  372. PHYDM_INFO_CCA_OFDM,
  373. PHYDM_INFO_CCA_CCK,
  374. PHYDM_INFO_CCA_ALL,
  375. PHYDM_INFO_CRC32_OK_VHT,
  376. PHYDM_INFO_CRC32_OK_HT,
  377. PHYDM_INFO_CRC32_OK_LEGACY,
  378. PHYDM_INFO_CRC32_OK_CCK,
  379. PHYDM_INFO_CRC32_ERROR_VHT,
  380. PHYDM_INFO_CRC32_ERROR_HT,
  381. PHYDM_INFO_CRC32_ERROR_LEGACY,
  382. PHYDM_INFO_CRC32_ERROR_CCK,
  383. PHYDM_INFO_EDCCA_FLAG,
  384. PHYDM_INFO_OFDM_ENABLE,
  385. PHYDM_INFO_CCK_ENABLE,
  386. PHYDM_INFO_DBG_PORT_0
  387. };
  388. enum phydm_api_e {
  389. PHYDM_API_NBI = 1,
  390. PHYDM_API_CSI_MASK,
  391. };
  392. /*2011/10/20 MH Define ODM support ability. ODM_CMNINFO_ABILITY*/
  393. enum odm_ability_e {
  394. /*BB ODM section BIT 0-19*/
  395. ODM_BB_DIG = BIT(0),
  396. ODM_BB_RA_MASK = BIT(1),
  397. ODM_BB_DYNAMIC_TXPWR = BIT(2),
  398. ODM_BB_FA_CNT = BIT(3),
  399. ODM_BB_RSSI_MONITOR = BIT(4),
  400. ODM_BB_CCK_PD = BIT(5),
  401. ODM_BB_ANT_DIV = BIT(6),
  402. ODM_BB_PWR_TRAIN = BIT(8),
  403. ODM_BB_RATE_ADAPTIVE = BIT(9),
  404. ODM_BB_PATH_DIV = BIT(10),
  405. ODM_BB_ADAPTIVITY = BIT(13),
  406. ODM_BB_CFO_TRACKING = BIT(14),
  407. ODM_BB_NHM_CNT = BIT(15),
  408. ODM_BB_PRIMARY_CCA = BIT(16),
  409. ODM_BB_TXBF = BIT(17),
  410. ODM_BB_DYNAMIC_ARFR = BIT(18),
  411. ODM_MAC_EDCA_TURBO = BIT(20),
  412. ODM_BB_DYNAMIC_RX_PATH = BIT(21),
  413. /*RF ODM section BIT 24-31*/
  414. ODM_RF_TX_PWR_TRACK = BIT(24),
  415. ODM_RF_RX_GAIN_TRACK = BIT(25),
  416. ODM_RF_CALIBRATION = BIT(26),
  417. };
  418. enum odm_halmac_ability {
  419. ODM_PHY_PARAM_OFFLOAD = BIT(0)
  420. };
  421. /*ODM_CMNINFO_ONE_PATH_CCA*/
  422. enum odm_cca_path_e {
  423. ODM_CCA_2R = 0,
  424. ODM_CCA_1R_A = 1,
  425. ODM_CCA_1R_B = 2,
  426. };
  427. enum cca_pathdiv_en_e {
  428. CCA_PATHDIV_DISABLE = 0,
  429. CCA_PATHDIV_ENABLE = 1,
  430. };
  431. enum phy_reg_pg_type {
  432. PHY_REG_PG_RELATIVE_VALUE = 0,
  433. PHY_REG_PG_EXACT_VALUE = 1
  434. };
  435. /*2011/09/22 MH Copy from SD4 defined structure. We use to support PHY DM integration.*/
  436. #if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
  437. #if (RT_PLATFORM != PLATFORM_LINUX)
  438. typedef
  439. #endif
  440. struct PHY_DM_STRUCT
  441. #else/*for AP,ADSL,CE Team*/
  442. struct PHY_DM_STRUCT
  443. #endif
  444. {
  445. /*Add for different team use temporarily*/
  446. struct _ADAPTER *adapter; /*For CE/NIC team*/
  447. struct rtl8192cd_priv *priv; /*For AP/ADSL team*/
  448. /*WHen you use adapter or priv pointer, you must make sure the pointer is ready.*/
  449. boolean odm_ready;
  450. #if (DM_ODM_SUPPORT_TYPE & (ODM_CE | ODM_WIN))
  451. struct rtl8192cd_priv fake_priv;
  452. #endif
  453. #if (DM_ODM_SUPPORT_TYPE & ODM_AP)
  454. /* ADSL_AP_BUILD_WORKAROUND */
  455. struct _ADAPTER fake_adapter;
  456. #endif
  457. enum phy_reg_pg_type phy_reg_pg_value_type;
  458. u8 phy_reg_pg_version;
  459. u32 debug_components;
  460. u32 fw_debug_components;
  461. u32 debug_level;
  462. u32 num_qry_phy_status_all; /*CCK + OFDM*/
  463. u32 last_num_qry_phy_status_all;
  464. u32 rx_pwdb_ave;
  465. boolean MPDIG_2G; /*off MPDIG*/
  466. u8 times_2g;
  467. boolean is_init_hw_info_by_rfe;
  468. /*------ ODM HANDLE, DRIVER NEEDS NOT TO HOOK------*/
  469. boolean is_cck_high_power;
  470. u8 rf_path_rx_enable;
  471. u8 control_channel;
  472. /*------ ODM HANDLE, DRIVER NEEDS NOT TO HOOK------*/
  473. /* 1 COMMON INFORMATION */
  474. /*Init value*/
  475. /*-----------HOOK BEFORE REG INIT-----------*/
  476. /*ODM Platform info AP/ADSL/CE/MP = 1/2/3/4*/
  477. u8 support_platform;
  478. /* ODM Platform info WIN/AP/CE = 1/2/3 */
  479. u8 normal_rx_path;
  480. /*ODM Support Ability DIG/RATR/TX_PWR_TRACK/ ¡K¡K = 1/2/3/¡K*/
  481. u32 support_ability;
  482. /*ODM PCIE/USB/SDIO = 1/2/3*/
  483. u8 support_interface;
  484. /*ODM composite or independent. Bit oriented/ 92C+92D+ .... or any other type = 1/2/3/...*/
  485. u32 support_ic_type;
  486. /*cut version TestChip/A-cut/B-cut... = 0/1/2/3/...*/
  487. u8 cut_version;
  488. /*Fab version TSMC/UMC = 0/1*/
  489. u8 fab_version;
  490. /*RF type 4T4R/3T3R/2T2R/1T2R/1T1R/...*/
  491. u8 rf_type;
  492. u8 rfe_type;
  493. /*Board type Normal/HighPower/MiniCard/SLIM/Combo/... = 0/1/2/3/4/...*/
  494. /*Enable Function DPK OFF/ON = 0/1*/
  495. u8 dpk_en;
  496. u8 board_type;
  497. u8 package_type;
  498. u16 type_glna;
  499. u16 type_gpa;
  500. u16 type_alna;
  501. u16 type_apa;
  502. /*with external LNA NO/Yes = 0/1*/
  503. u8 ext_lna; /*2G*/
  504. u8 ext_lna_5g; /*5G*/
  505. /*with external PA NO/Yes = 0/1*/
  506. u8 ext_pa; /*2G*/
  507. u8 ext_pa_5g; /*5G*/
  508. /*with Efuse number*/
  509. u8 efuse0x3d7;
  510. u8 efuse0x3d8;
  511. /*with external TRSW NO/Yes = 0/1*/
  512. u8 ext_trsw;
  513. u8 ext_lna_gain; /*2G*/
  514. u8 patch_id; /*Customer ID*/
  515. boolean is_in_hct_test;
  516. u8 wifi_test;
  517. boolean is_dual_mac_smart_concurrent;
  518. u32 bk_support_ability;
  519. u8 ant_div_type;
  520. u8 with_extenal_ant_switch;
  521. boolean config_bbrf;
  522. u8 odm_regulation_2_4g;
  523. u8 odm_regulation_5g;
  524. u8 iqk_fw_offload;
  525. boolean cck_new_agc;
  526. u8 phydm_period;
  527. u32 phydm_sys_up_time;
  528. u8 num_rf_path;
  529. u32 soft_ap_special_setting;
  530. u32 halmac_ability;
  531. u8 is_receiver_blocking_en;
  532. /*-----------HOOK BEFORE REG INIT-----------*/
  533. /*Dynamic value*/
  534. /*--------- POINTER REFERENCE-----------*/
  535. u8 u1_byte_temp;
  536. boolean BOOLEAN_temp;
  537. struct _ADAPTER *PADAPTER_temp;
  538. /*MAC PHY mode SMSP/DMSP/DMDP = 0/1/2*/
  539. u8 *p_mac_phy_mode;
  540. /*TX Unicast byte count*/
  541. u64 *p_num_tx_bytes_unicast;
  542. /*RX Unicast byte count*/
  543. u64 *p_num_rx_bytes_unicast;
  544. /*Wireless mode B/G/A/N = BIT0/BIT1/BIT2/BIT3*/
  545. u8 *p_wireless_mode;
  546. /*Frequence band 2.4G/5G = 0/1*/
  547. u8 *p_band_type;
  548. /*Secondary channel offset don't_care/below/above = 0/1/2*/
  549. u8 *p_sec_ch_offset;
  550. /*security mode Open/WEP/AES/TKIP = 0/1/2/3*/
  551. u8 *p_security;
  552. /*BW info 20M/40M/80M = 0/1/2*/
  553. u8 *p_band_width;
  554. /*Central channel location Ch1/Ch2/....*/
  555. u8 *p_channel; /*central channel number*/
  556. boolean dpk_done;
  557. /*Common info for 92D DMSP*/
  558. boolean *p_is_get_value_from_other_mac;
  559. struct _ADAPTER **p_buddy_adapter;
  560. boolean *p_is_master_of_dmsp; /* MAC0: master, MAC1: slave */
  561. /*Common info for status*/
  562. boolean *p_is_scan_in_process;
  563. boolean *p_is_power_saving;
  564. /*CCA path 2-path/path-A/path-B = 0/1/2; using enum odm_cca_path_e.*/
  565. u8 *p_one_path_cca;
  566. u8 *p_antenna_test;
  567. boolean *p_is_net_closed;
  568. u8 *pu1_forced_igi_lb;
  569. boolean *p_is_fcs_mode_enable;
  570. /*--------- For 8723B IQK-----------*/
  571. boolean *p_is_1_antenna;
  572. u8 *p_rf_default_path;
  573. /* 0:S1, 1:S0 */
  574. /*--------- POINTER REFERENCE-----------*/
  575. u16 *p_forced_data_rate;
  576. u8 *p_enable_antdiv;
  577. u8 *p_enable_adaptivity;
  578. u8 *hub_usb_mode; /*1: USB 2.0, 2: USB 3.0*/
  579. boolean *p_is_fw_dw_rsvd_page_in_progress;
  580. u32 *p_current_tx_tp;
  581. u32 *p_current_rx_tp;
  582. u8 *p_sounding_seq;
  583. u32 *p_soft_ap_mode;
  584. /*------------CALL BY VALUE-------------*/
  585. boolean is_link_in_process;
  586. boolean is_wifi_direct;
  587. boolean is_wifi_display;
  588. boolean is_linked;
  589. boolean bLinkedcmw500;
  590. boolean is_in_lps_pg;
  591. boolean bsta_state;
  592. #if (DM_ODM_SUPPORT_TYPE & ODM_AP) /*for repeater mode add by YuChen 2014.06.23*/
  593. #ifdef UNIVERSAL_REPEATER
  594. boolean vxd_linked;
  595. #endif
  596. #endif
  597. u8 rssi_min;
  598. u8 interface_index; /*Add for 92D dual MAC: 0--Mac0 1--Mac1*/
  599. boolean is_mp_chip;
  600. boolean is_one_entry_only;
  601. boolean mp_mode;
  602. u32 one_entry_macid;
  603. u8 pre_number_linked_client;
  604. u8 number_linked_client;
  605. u8 pre_number_active_client;
  606. u8 number_active_client;
  607. /*Common info for BTDM*/
  608. boolean is_bt_enabled; /*BT is enabled*/
  609. boolean is_bt_connect_process; /*BT HS is under connection progress.*/
  610. u8 bt_hs_rssi; /*BT HS mode wifi rssi value.*/
  611. boolean is_bt_hs_operation; /*BT HS mode is under progress*/
  612. u8 bt_hs_dig_val; /*use BT rssi to decide the DIG value*/
  613. boolean is_bt_disable_edca_turbo; /*Under some condition, don't enable the EDCA Turbo*/
  614. boolean is_bt_busy; /*BT is busy.*/
  615. boolean is_bt_limited_dig; /*BT is busy.*/
  616. boolean is_disable_phy_api;
  617. /*------------CALL BY VALUE-------------*/
  618. u8 RSSI_A;
  619. u8 RSSI_B;
  620. u8 RSSI_C;
  621. u8 RSSI_D;
  622. u64 RSSI_TRSW;
  623. u64 RSSI_TRSW_H;
  624. u64 RSSI_TRSW_L;
  625. u64 RSSI_TRSW_iso;
  626. u8 tx_ant_status;
  627. u8 rx_ant_status;
  628. u8 cck_lna_idx;
  629. u8 cck_vga_idx;
  630. u8 curr_station_id;
  631. u8 ofdm_agc_idx[4];
  632. u8 rx_rate;
  633. boolean is_noisy_state;
  634. u8 tx_rate;
  635. u8 linked_interval;
  636. u8 pre_channel;
  637. u32 txagc_offset_value_a;
  638. boolean is_txagc_offset_positive_a;
  639. u32 txagc_offset_value_b;
  640. boolean is_txagc_offset_positive_b;
  641. u32 tx_tp;
  642. u32 rx_tp;
  643. u32 total_tp;
  644. u64 cur_tx_ok_cnt;
  645. u64 cur_rx_ok_cnt;
  646. u64 last_tx_ok_cnt;
  647. u64 last_rx_ok_cnt;
  648. u16 consecutive_idlel_time; /*unit: second*/
  649. u32 bb_swing_offset_a;
  650. boolean is_bb_swing_offset_positive_a;
  651. u32 bb_swing_offset_b;
  652. boolean is_bb_swing_offset_positive_b;
  653. u8 igi_lower_bound;
  654. u8 igi_upper_bound;
  655. u8 antdiv_rssi;
  656. u8 fat_comb_a;
  657. u8 fat_comb_b;
  658. u8 antdiv_intvl;
  659. u8 ant_type;
  660. u8 pre_ant_type;
  661. u8 antdiv_period;
  662. u8 evm_antdiv_period;
  663. u8 antdiv_select;
  664. u8 path_select;
  665. u8 antdiv_evm_en;
  666. u8 bdc_holdstate;
  667. u8 ndpa_period;
  668. boolean h2c_rarpt_connect;
  669. boolean cck_agc_report_type;
  670. u8 dm_dig_max_TH;
  671. u8 dm_dig_min_TH;
  672. u8 print_agc;
  673. u8 traffic_load;
  674. u8 pre_traffic_load;
  675. /*8821C Antenna and RF Set BTG/WLG/WLA Select*/
  676. u8 current_rf_set_8821c;
  677. u8 default_rf_set_8821c;
  678. u8 current_ant_num_8821c;
  679. u8 default_ant_num_8821c;
  680. /*For Adaptivtiy*/
  681. u16 nhm_cnt_0;
  682. u16 nhm_cnt_1;
  683. s8 TH_L2H_default;
  684. s8 th_edcca_hl_diff_default;
  685. s8 th_l2h_ini;
  686. s8 th_edcca_hl_diff;
  687. s8 th_l2h_ini_mode2;
  688. s8 th_edcca_hl_diff_mode2;
  689. boolean carrier_sense_enable;
  690. u8 adaptivity_igi_upper;
  691. boolean adaptivity_flag;
  692. u8 dc_backoff;
  693. boolean adaptivity_enable;
  694. u8 ap_total_num;
  695. boolean edcca_enable;
  696. u8 pre_dbg_priority;
  697. struct _ADAPTIVITY_STATISTICS adaptivity;
  698. /*For Adaptivtiy*/
  699. u8 last_usb_hub;
  700. u8 tx_bf_data_rate;
  701. u8 nbi_set_result;
  702. u8 c2h_cmd_start;
  703. u8 fw_debug_trace[60];
  704. u8 pre_c2h_seq;
  705. boolean fw_buff_is_enpty;
  706. u32 data_frame_num;
  707. /*for noise detection*/
  708. boolean noisy_decision; /*b_noisy*/
  709. boolean pre_b_noisy;
  710. u32 noisy_decision_smooth;
  711. boolean is_disable_dym_ecs;
  712. #if (DM_ODM_SUPPORT_TYPE & (ODM_CE | ODM_WIN))
  713. struct _ODM_NOISE_MONITOR_ noise_level;
  714. #endif
  715. /*Define STA info.*/
  716. /*_ODM_STA_INFO*/
  717. /*2012/01/12 MH For MP, we need to reduce one array pointer for default port.??*/
  718. struct sta_info *p_odm_sta_info[ODM_ASSOCIATE_ENTRY_NUM];
  719. u16 platform2phydm_macid_table[ODM_ASSOCIATE_ENTRY_NUM];
  720. /* platform_macid_table[platform_macid] = phydm_macid */
  721. #if (ODM_PHY_STATUS_NEW_TYPE_SUPPORT == 1)
  722. s32 accumulate_pwdb[ODM_ASSOCIATE_ENTRY_NUM];
  723. #endif
  724. #if (RATE_ADAPTIVE_SUPPORT == 1)
  725. u16 currmin_rpt_time;
  726. struct _odm_ra_info_ ra_info[ODM_ASSOCIATE_ENTRY_NUM];
  727. /*Use mac_id as array index. STA mac_id=0, VWiFi Client mac_id={1, ODM_ASSOCIATE_ENTRY_NUM-1} //YJ,add,120119*/
  728. #endif
  729. /*2012/02/14 MH Add to share 88E ra with other SW team.*/
  730. /*We need to colelct all support abilit to a proper area.*/
  731. boolean ra_support88e;
  732. struct _odm_phy_dbg_info_ phy_dbg_info;
  733. /*ODM Structure*/
  734. struct _DFS_STATISTICS dfs;
  735. #if (defined(CONFIG_PHYDM_ANTENNA_DIVERSITY))
  736. #if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
  737. struct _BF_DIV_COEX_ dm_bdc_table;
  738. #endif
  739. #if (defined(CONFIG_HL_SMART_ANTENNA_TYPE1)) || (defined(CONFIG_HL_SMART_ANTENNA_TYPE2))
  740. struct _SMART_ANTENNA_TRAINNING_ dm_sat_table;
  741. #endif
  742. #endif
  743. struct _FAST_ANTENNA_TRAINNING_ dm_fat_table;
  744. struct _dynamic_initial_gain_threshold_ dm_dig_table;
  745. #if (defined(CONFIG_BB_POWER_SAVING))
  746. struct _dynamic_power_saving dm_ps_table;
  747. #endif
  748. struct _dynamic_primary_cca dm_pri_cca;
  749. struct _rate_adaptive_table_ dm_ra_table;
  750. struct _FALSE_ALARM_STATISTICS false_alm_cnt;
  751. struct _FALSE_ALARM_STATISTICS flase_alm_cnt_buddy_adapter;
  752. struct _sw_antenna_switch_ dm_swat_table;
  753. struct _CFO_TRACKING_ dm_cfo_track;
  754. struct _ACS_ dm_acs;
  755. struct _CCX_INFO dm_ccx_info;
  756. #if (CONFIG_PSD_TOOL == 1)
  757. struct _PHYDM_PSD_ dm_psd_table;
  758. #endif
  759. #if (PHYDM_LA_MODE_SUPPORT == 1)
  760. struct _RT_ADCSMP adcsmp;
  761. #endif
  762. #if (CONFIG_DYNAMIC_RX_PATH == 1)
  763. struct _DYNAMIC_RX_PATH_ dm_drp_table;
  764. #endif
  765. #if (RTL8814A_SUPPORT == 1 || RTL8822B_SUPPORT == 1 || RTL8821C_SUPPORT == 1)
  766. struct _IQK_INFORMATION IQK_info;
  767. #endif
  768. #if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
  769. /*path Div Struct*/
  770. struct _path_div_parameter_define_ path_iqk;
  771. #endif
  772. #if (defined(CONFIG_PATH_DIVERSITY))
  773. struct _ODM_PATH_DIVERSITY_ dm_path_div;
  774. #endif
  775. #if PHYDM_SUPPORT_EDCA
  776. struct _EDCA_TURBO_ dm_edca_table;
  777. u32 WMMEDCA_BE;
  778. #endif
  779. boolean *p_is_driver_stopped;
  780. boolean *p_is_driver_is_going_to_pnp_set_power_sleep;
  781. boolean *pinit_adpt_in_progress;
  782. /*PSD*/
  783. boolean is_user_assign_level;
  784. u8 RSSI_BT; /*come from BT*/
  785. boolean is_psd_in_process;
  786. boolean is_psd_active;
  787. boolean is_dm_initial_gain_enable;
  788. /*MPT DIG*/
  789. struct timer_list mpt_dig_timer;
  790. /*for rate adaptive, in fact, 88c/92c fw will handle this*/
  791. u8 is_use_ra_mask;
  792. /* for dynamic SoML control */
  793. boolean bsomlenabled;
  794. /* for dynamic HTSTF gain control */
  795. boolean bhtstfenabled;
  796. struct _ODM_RATE_ADAPTIVE rate_adaptive;
  797. #if (defined(CONFIG_ANT_DETECTION))
  798. struct _ANT_DETECTED_INFO ant_detected_info; /* Antenna detected information for RSSI tool*/
  799. #endif
  800. struct odm_rf_calibration_structure rf_calibrate_info;
  801. struct odm_power_trim_data power_trim_data;
  802. u32 n_iqk_cnt;
  803. u32 n_iqk_ok_cnt;
  804. u32 n_iqk_fail_cnt;
  805. #if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
  806. /*Power Training*/
  807. u8 force_power_training_state;
  808. boolean is_change_state;
  809. u32 PT_score;
  810. u64 ofdm_rx_cnt;
  811. u64 cck_rx_cnt;
  812. #endif
  813. boolean is_disable_power_training;
  814. u8 dynamic_tx_high_power_lvl;
  815. u8 last_dtp_lvl;
  816. u32 tx_agc_ofdm_18_6;
  817. u8 rx_pkt_type;
  818. /*ODM relative time.*/
  819. struct timer_list path_div_switch_timer;
  820. /*2011.09.27 add for path Diversity*/
  821. struct timer_list cck_path_diversity_timer;
  822. struct timer_list fast_ant_training_timer;
  823. #ifdef ODM_EVM_ENHANCE_ANTDIV
  824. struct timer_list evm_fast_ant_training_timer;
  825. #endif
  826. struct timer_list sbdcnt_timer;
  827. /*ODM relative workitem.*/
  828. #if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
  829. #if USE_WORKITEM
  830. RT_WORK_ITEM path_div_switch_workitem;
  831. RT_WORK_ITEM cck_path_diversity_workitem;
  832. RT_WORK_ITEM fast_ant_training_workitem;
  833. RT_WORK_ITEM mpt_dig_workitem;
  834. RT_WORK_ITEM ra_rpt_workitem;
  835. RT_WORK_ITEM sbdcnt_workitem;
  836. #endif
  837. #endif
  838. #if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
  839. #if (BEAMFORMING_SUPPORT == 1)
  840. struct _RT_BEAMFORMING_INFO beamforming_info;
  841. #endif
  842. #endif
  843. #ifdef CONFIG_PHYDM_DFS_MASTER
  844. u8 dfs_region_domain;
  845. u8 *dfs_master_enabled;
  846. /*====== phydm_radar_detect_with_dbg_parm start ======*/
  847. u8 radar_detect_dbg_parm_en;
  848. u32 radar_detect_reg_918;
  849. u32 radar_detect_reg_91c;
  850. u32 radar_detect_reg_920;
  851. u32 radar_detect_reg_924;
  852. /*====== phydm_radar_detect_with_dbg_parm end ======*/
  853. #endif
  854. #if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
  855. #if (RT_PLATFORM != PLATFORM_LINUX)
  856. }PHY_DM_STRUCT; /*DM_Dynamic_Mechanism_Structure*/
  857. #else
  858. };
  859. #endif
  860. #else /*for AP,ADSL,CE Team*/
  861. };
  862. #endif
  863. enum phydm_structure_type {
  864. PHYDM_FALSEALMCNT,
  865. PHYDM_CFOTRACK,
  866. PHYDM_ADAPTIVITY,
  867. PHYDM_DFS,
  868. PHYDM_ROMINFO,
  869. };
  870. enum odm_rf_content {
  871. odm_radioa_txt = 0x1000,
  872. odm_radiob_txt = 0x1001,
  873. odm_radioc_txt = 0x1002,
  874. odm_radiod_txt = 0x1003
  875. };
  876. enum odm_bb_config_type {
  877. CONFIG_BB_PHY_REG,
  878. CONFIG_BB_AGC_TAB,
  879. CONFIG_BB_AGC_TAB_2G,
  880. CONFIG_BB_AGC_TAB_5G,
  881. CONFIG_BB_PHY_REG_PG,
  882. CONFIG_BB_PHY_REG_MP,
  883. CONFIG_BB_AGC_TAB_DIFF,
  884. };
  885. enum odm_rf_config_type {
  886. CONFIG_RF_RADIO,
  887. CONFIG_RF_TXPWR_LMT,
  888. };
  889. enum odm_fw_config_type {
  890. CONFIG_FW_NIC,
  891. CONFIG_FW_NIC_2,
  892. CONFIG_FW_AP,
  893. CONFIG_FW_AP_2,
  894. CONFIG_FW_MP,
  895. CONFIG_FW_WOWLAN,
  896. CONFIG_FW_WOWLAN_2,
  897. CONFIG_FW_AP_WOWLAN,
  898. CONFIG_FW_BT,
  899. };
  900. /*status code*/
  901. #if (DM_ODM_SUPPORT_TYPE != ODM_WIN)
  902. enum rt_status {
  903. RT_STATUS_SUCCESS,
  904. RT_STATUS_FAILURE,
  905. RT_STATUS_PENDING,
  906. RT_STATUS_RESOURCE,
  907. RT_STATUS_INVALID_CONTEXT,
  908. RT_STATUS_INVALID_PARAMETER,
  909. RT_STATUS_NOT_SUPPORT,
  910. RT_STATUS_OS_API_FAILED,
  911. };
  912. #endif /*end of enum rt_status definition*/
  913. #ifdef REMOVE_PACK
  914. #pragma pack()
  915. #endif
  916. /*===========================================================*/
  917. /*AGC RX High Power mode*/
  918. /*===========================================================*/
  919. #define lna_low_gain_1 0x64
  920. #define lna_low_gain_2 0x5A
  921. #define lna_low_gain_3 0x58
  922. #define FA_RXHP_TH1 5000
  923. #define FA_RXHP_TH2 1500
  924. #define FA_RXHP_TH3 800
  925. #define FA_RXHP_TH4 600
  926. #define FA_RXHP_TH5 500
  927. enum dm_1r_cca_e {
  928. CCA_1R = 0,
  929. CCA_2R = 1,
  930. CCA_MAX = 2,
  931. };
  932. enum dm_rf_e {
  933. rf_save = 0,
  934. rf_normal = 1,
  935. RF_MAX = 2,
  936. };
  937. /*check Sta pointer valid or not*/
  938. #if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
  939. #define IS_STA_VALID(p_sta) (p_sta && p_sta->expire_to)
  940. #elif (DM_ODM_SUPPORT_TYPE & ODM_WIN)
  941. #define IS_STA_VALID(p_sta) (p_sta && p_sta->bUsed)
  942. #else
  943. #define IS_STA_VALID(p_sta) (p_sta)
  944. #endif
  945. #if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_AP))
  946. boolean
  947. odm_check_power_status(
  948. struct _ADAPTER *adapter
  949. );
  950. #endif
  951. u32 odm_convert_to_db(u32 value);
  952. u32 odm_convert_to_linear(u32 value);
  953. #if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
  954. void
  955. odm_dm_watchdog_lps(
  956. struct PHY_DM_STRUCT *p_dm_odm
  957. );
  958. #endif
  959. s32
  960. odm_pwdb_conversion(
  961. s32 X,
  962. u32 total_bit,
  963. u32 decimal_bit
  964. );
  965. s32
  966. odm_sign_conversion(
  967. s32 value,
  968. u32 total_bit
  969. );
  970. void
  971. odm_init_mp_driver_status(
  972. struct PHY_DM_STRUCT *p_dm_odm
  973. );
  974. void
  975. phydm_txcurrentcalibration(
  976. struct PHY_DM_STRUCT *p_dm_odm
  977. );
  978. void
  979. phydm_seq_sorting(
  980. void *p_dm_void,
  981. u32 *p_value,
  982. u32 *rank_idx,
  983. u32 *p_idx_out,
  984. u8 seq_length
  985. );
  986. void
  987. odm_dm_init(
  988. struct PHY_DM_STRUCT *p_dm_odm
  989. );
  990. void
  991. odm_dm_reset(
  992. struct PHY_DM_STRUCT *p_dm_odm
  993. );
  994. void
  995. phydm_support_ability_debug(
  996. void *p_dm_void,
  997. u32 *const dm_value,
  998. u32 *_used,
  999. char *output,
  1000. u32 *_out_len
  1001. );
  1002. void
  1003. phydm_config_ofdm_rx_path(
  1004. struct PHY_DM_STRUCT *p_dm_odm,
  1005. u32 path
  1006. );
  1007. void
  1008. phydm_config_trx_path(
  1009. void *p_dm_void,
  1010. u32 *const dm_value,
  1011. u32 *_used,
  1012. char *output,
  1013. u32 *_out_len
  1014. );
  1015. void
  1016. odm_dm_watchdog(
  1017. struct PHY_DM_STRUCT *p_dm_odm
  1018. );
  1019. void
  1020. phydm_watchdog_mp(
  1021. struct PHY_DM_STRUCT *p_dm_odm
  1022. );
  1023. void
  1024. odm_cmn_info_init(
  1025. struct PHY_DM_STRUCT *p_dm_odm,
  1026. enum odm_cmninfo_e cmn_info,
  1027. u32 value
  1028. );
  1029. void
  1030. odm_cmn_info_hook(
  1031. struct PHY_DM_STRUCT *p_dm_odm,
  1032. enum odm_cmninfo_e cmn_info,
  1033. void *p_value
  1034. );
  1035. void
  1036. odm_cmn_info_ptr_array_hook(
  1037. struct PHY_DM_STRUCT *p_dm_odm,
  1038. enum odm_cmninfo_e cmn_info,
  1039. u16 index,
  1040. void *p_value
  1041. );
  1042. void
  1043. odm_cmn_info_update(
  1044. struct PHY_DM_STRUCT *p_dm_odm,
  1045. u32 cmn_info,
  1046. u64 value
  1047. );
  1048. u32
  1049. phydm_cmn_info_query(
  1050. struct PHY_DM_STRUCT *p_dm_odm,
  1051. enum phydm_info_query_e info_type
  1052. );
  1053. #if (DM_ODM_SUPPORT_TYPE == ODM_AP)
  1054. void
  1055. odm_init_all_threads(
  1056. struct PHY_DM_STRUCT *p_dm_odm
  1057. );
  1058. void
  1059. odm_stop_all_threads(
  1060. struct PHY_DM_STRUCT *p_dm_odm
  1061. );
  1062. #endif
  1063. void
  1064. odm_init_all_timers(
  1065. struct PHY_DM_STRUCT *p_dm_odm
  1066. );
  1067. void
  1068. odm_cancel_all_timers(
  1069. struct PHY_DM_STRUCT *p_dm_odm
  1070. );
  1071. void
  1072. odm_release_all_timers(
  1073. struct PHY_DM_STRUCT *p_dm_odm
  1074. );
  1075. #if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
  1076. void odm_init_all_work_items(struct PHY_DM_STRUCT *p_dm_odm);
  1077. void odm_free_all_work_items(struct PHY_DM_STRUCT *p_dm_odm);
  1078. u64
  1079. platform_division64(
  1080. u64 x,
  1081. u64 y
  1082. );
  1083. #define dm_change_dynamic_init_gain_thresh odm_change_dynamic_init_gain_thresh
  1084. enum dm_dig_connect_e {
  1085. DIG_STA_DISCONNECT = 0,
  1086. DIG_STA_CONNECT = 1,
  1087. DIG_STA_BEFORE_CONNECT = 2,
  1088. DIG_MULTI_STA_DISCONNECT = 3,
  1089. DIG_MULTI_STA_CONNECT = 4,
  1090. DIG_CONNECT_MAX
  1091. };
  1092. /*2012/01/12 MH Check afapter status. Temp fix BSOD.*/
  1093. #define HAL_ADAPTER_STS_CHK(p_dm_odm) do {\
  1094. if (p_dm_odm->adapter == NULL) { \
  1095. \
  1096. return;\
  1097. } \
  1098. } while (0)
  1099. #endif /*#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)*/
  1100. void
  1101. odm_asoc_entry_init(
  1102. struct PHY_DM_STRUCT *p_dm_odm
  1103. );
  1104. void *
  1105. phydm_get_structure(
  1106. struct PHY_DM_STRUCT *p_dm_odm,
  1107. u8 structure_type
  1108. );
  1109. #if (DM_ODM_SUPPORT_TYPE == ODM_WIN) || (DM_ODM_SUPPORT_TYPE == ODM_CE)
  1110. /*===========================================================*/
  1111. /* The following is for compile only*/
  1112. /*===========================================================*/
  1113. #define IS_HARDWARE_TYPE_8723A(_adapter) false
  1114. #define IS_HARDWARE_TYPE_8723AE(_adapter) false
  1115. #define IS_HARDWARE_TYPE_8192C(_adapter) false
  1116. #define IS_HARDWARE_TYPE_8192D(_adapter) false
  1117. #define RF_T_METER_92D 0x42
  1118. #define GET_RX_STATUS_DESC_RX_MCS(__prx_status_desc) LE_BITS_TO_1BYTE(__prx_status_desc+12, 0, 6)
  1119. #define REG_CONFIG_RAM64X16 0xb2c
  1120. #define TARGET_CHNL_NUM_2G_5G 59
  1121. #if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
  1122. u8 get_right_chnl_place_for_iqk(u8 chnl);
  1123. #endif
  1124. /* *********************************************************** */
  1125. #endif
  1126. #if (DM_ODM_SUPPORT_TYPE == ODM_CE)
  1127. void odm_dtc(struct PHY_DM_STRUCT *p_dm_odm);
  1128. #endif /* #if (DM_ODM_SUPPORT_TYPE == ODM_CE) */
  1129. void phydm_noisy_detection(struct PHY_DM_STRUCT *p_dm_odm);
  1130. #endif
  1131. void
  1132. phydm_set_ext_switch(
  1133. void *p_dm_void,
  1134. u32 *const dm_value,
  1135. u32 *_used,
  1136. char *output,
  1137. u32 *_out_len
  1138. );
  1139. void
  1140. phydm_api_debug(
  1141. void *p_dm_void,
  1142. u32 function_map,
  1143. u32 *const dm_value,
  1144. u32 *_used,
  1145. char *output,
  1146. u32 *_out_len
  1147. );
  1148. u8
  1149. phydm_nbi_setting(
  1150. void *p_dm_void,
  1151. u32 enable,
  1152. u32 channel,
  1153. u32 bw,
  1154. u32 f_interference,
  1155. u32 second_ch
  1156. );
  1157. void
  1158. phydm_receiver_blocking(
  1159. void *p_dm_void
  1160. );