odm.h 57 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222
  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. // Definition
  24. //============================================================
  25. //
  26. // 2011/09/22 MH Define all team supprt ability.
  27. //
  28. //
  29. // 2011/09/22 MH Define for all teams. Please Define the constan in your precomp header.
  30. //
  31. //#define DM_ODM_SUPPORT_AP 0
  32. //#define DM_ODM_SUPPORT_ADSL 0
  33. //#define DM_ODM_SUPPORT_CE 0
  34. //#define DM_ODM_SUPPORT_MP 1
  35. //
  36. // 2011/09/28 MH Define ODM SW team support flag.
  37. //
  38. //
  39. // Antenna Switch Relative Definition.
  40. //
  41. //
  42. // 20100503 Joseph:
  43. // Add new function SwAntDivCheck8192C().
  44. // This is the main function of Antenna diversity function before link.
  45. // Mainly, it just retains last scan result and scan again.
  46. // After that, it compares the scan result to see which one gets better RSSI.
  47. // It selects antenna with better receiving power and returns better scan result.
  48. //
  49. #define TP_MODE 0
  50. #define RSSI_MODE 1
  51. #define TRAFFIC_LOW 0
  52. #define TRAFFIC_HIGH 1
  53. //============================================================
  54. //3 Tx Power Tracking
  55. //3============================================================
  56. #define DPK_DELTA_MAPPING_NUM 13
  57. #define index_mapping_HP_NUM 15
  58. #define OFDM_TABLE_SIZE 37
  59. #define OFDM_TABLE_SIZE_92D 43
  60. #define CCK_TABLE_SIZE 33
  61. #define TXSCALE_TABLE_SIZE 37
  62. #define DELTA_SWINGIDX_SIZE 30
  63. #define BAND_NUM 3
  64. //============================================================
  65. //3 PSD Handler
  66. //3============================================================
  67. #define AFH_PSD 1 //0:normal PSD scan, 1: only do 20 pts PSD
  68. #define MODE_40M 0 //0:20M, 1:40M
  69. #define PSD_TH2 3
  70. #define PSD_CHMIN 20 // Minimum channel number for BT AFH
  71. #define SIR_STEP_SIZE 3
  72. #define Smooth_Size_1 5
  73. #define Smooth_TH_1 3
  74. #define Smooth_Size_2 10
  75. #define Smooth_TH_2 4
  76. #define Smooth_Size_3 20
  77. #define Smooth_TH_3 4
  78. #define Smooth_Step_Size 5
  79. #define Adaptive_SIR 1
  80. #if(RTL8723_FPGA_VERIFICATION == 1)
  81. #define PSD_RESCAN 1
  82. #else
  83. #define PSD_RESCAN 4
  84. #endif
  85. #define PSD_SCAN_INTERVAL 700 //ms
  86. //8723A High Power IGI Setting
  87. #define DM_DIG_HIGH_PWR_IGI_LOWER_BOUND 0x22
  88. #define DM_DIG_Gmode_HIGH_PWR_IGI_LOWER_BOUND 0x28
  89. #define DM_DIG_HIGH_PWR_THRESHOLD 0x3a
  90. #define DM_DIG_LOW_PWR_THRESHOLD 0x14
  91. //ANT Test
  92. #define ANTTESTALL 0x00 //Ant A or B will be Testing
  93. #define ANTTESTA 0x01 //Ant A will be Testing
  94. #define ANTTESTB 0x02 //Ant B will be testing
  95. // LPS define
  96. #define DM_DIG_FA_TH0_LPS 4 //-> 4 in lps
  97. #define DM_DIG_FA_TH1_LPS 15 //-> 15 lps
  98. #define DM_DIG_FA_TH2_LPS 30 //-> 30 lps
  99. #define RSSI_OFFSET_DIG 0x05;
  100. //for 8723A Ant Definition--2012--06--07 due to different IC may be different ANT define
  101. #define MAIN_ANT 1 //Ant A or Ant Main
  102. #define AUX_ANT 2 //AntB or Ant Aux
  103. #define MAX_ANT 3 // 3 for AP using
  104. //Antenna Diversity Type
  105. #define SW_ANTDIV 0
  106. #define HW_ANTDIV 1
  107. //Antenna Diversty Control Type
  108. #define ODM_AUTO_ANT 0
  109. #define ODM_FIX_MAIN_ANT 1
  110. #define ODM_FIX_AUX_ANT 2
  111. //============================================================
  112. // structure and define
  113. //============================================================
  114. //
  115. // 2011/09/20 MH Add for AP/ADSLpseudo DM structuer requirement.
  116. // We need to remove to other position???
  117. //
  118. #if(DM_ODM_SUPPORT_TYPE & (ODM_CE|ODM_WIN))
  119. typedef struct rtl8192cd_priv {
  120. u1Byte temp;
  121. }rtl8192cd_priv, *prtl8192cd_priv;
  122. #endif
  123. #if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
  124. typedef struct _ADAPTER{
  125. u1Byte temp;
  126. #ifdef AP_BUILD_WORKAROUND
  127. HAL_DATA_TYPE* temp2;
  128. prtl8192cd_priv priv;
  129. #endif
  130. }ADAPTER, *PADAPTER;
  131. #endif
  132. #if (DM_ODM_SUPPORT_TYPE == ODM_AP)
  133. typedef struct _WLAN_STA{
  134. u1Byte temp;
  135. } WLAN_STA, *PRT_WLAN_STA;
  136. #endif
  137. typedef struct _Dynamic_Initial_Gain_Threshold_
  138. {
  139. u1Byte Dig_Enable_Flag;
  140. u1Byte Dig_Ext_Port_Stage;
  141. int RssiLowThresh;
  142. int RssiHighThresh;
  143. u4Byte FALowThresh;
  144. u4Byte FAHighThresh;
  145. u1Byte CurSTAConnectState;
  146. u1Byte PreSTAConnectState;
  147. u1Byte CurMultiSTAConnectState;
  148. u1Byte PreIGValue;
  149. u1Byte CurIGValue;
  150. u1Byte BT30_CurIGI;
  151. u1Byte BackupIGValue;
  152. s1Byte BackoffVal;
  153. s1Byte BackoffVal_range_max;
  154. s1Byte BackoffVal_range_min;
  155. u1Byte rx_gain_range_max;
  156. u1Byte rx_gain_range_min;
  157. u1Byte Rssi_val_min;
  158. u1Byte PreCCK_CCAThres;
  159. u1Byte CurCCK_CCAThres;
  160. u1Byte PreCCKPDState;
  161. u1Byte CurCCKPDState;
  162. u1Byte LargeFAHit;
  163. u1Byte ForbiddenIGI;
  164. u4Byte Recover_cnt;
  165. u1Byte DIG_Dynamic_MIN_0;
  166. u1Byte DIG_Dynamic_MIN_1;
  167. BOOLEAN bMediaConnect_0;
  168. BOOLEAN bMediaConnect_1;
  169. u4Byte AntDiv_RSSI_max;
  170. u4Byte RSSI_max;
  171. }DIG_T,*pDIG_T;
  172. typedef struct _Dynamic_Power_Saving_
  173. {
  174. u1Byte PreCCAState;
  175. u1Byte CurCCAState;
  176. u1Byte PreRFState;
  177. u1Byte CurRFState;
  178. int Rssi_val_min;
  179. u1Byte initialize;
  180. u4Byte Reg874,RegC70,Reg85C,RegA74;
  181. }PS_T,*pPS_T;
  182. typedef struct _FALSE_ALARM_STATISTICS{
  183. u4Byte Cnt_Parity_Fail;
  184. u4Byte Cnt_Rate_Illegal;
  185. u4Byte Cnt_Crc8_fail;
  186. u4Byte Cnt_Mcs_fail;
  187. u4Byte Cnt_Ofdm_fail;
  188. u4Byte Cnt_Cck_fail;
  189. u4Byte Cnt_all;
  190. u4Byte Cnt_Fast_Fsync;
  191. u4Byte Cnt_SB_Search_fail;
  192. u4Byte Cnt_OFDM_CCA;
  193. u4Byte Cnt_CCK_CCA;
  194. u4Byte Cnt_CCA_all;
  195. u4Byte Cnt_BW_USC; //Gary
  196. u4Byte Cnt_BW_LSC; //Gary
  197. }FALSE_ALARM_STATISTICS, *PFALSE_ALARM_STATISTICS;
  198. typedef struct _Dynamic_Primary_CCA{
  199. u1Byte PriCCA_flag;
  200. u1Byte intf_flag;
  201. u1Byte intf_type;
  202. u1Byte DupRTS_flag;
  203. u1Byte Monitor_flag;
  204. u1Byte CH_offset;
  205. u1Byte MF_state;
  206. }Pri_CCA_T, *pPri_CCA_T;
  207. typedef struct _RX_High_Power_
  208. {
  209. u1Byte RXHP_flag;
  210. u1Byte PSD_func_trigger;
  211. u1Byte PSD_bitmap_RXHP[80];
  212. u1Byte Pre_IGI;
  213. u1Byte Cur_IGI;
  214. u1Byte Pre_pw_th;
  215. u1Byte Cur_pw_th;
  216. BOOLEAN First_time_enter;
  217. BOOLEAN RXHP_enable;
  218. u1Byte TP_Mode;
  219. RT_TIMER PSDTimer;
  220. #if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
  221. #if USE_WORKITEM
  222. RT_WORK_ITEM PSDTimeWorkitem;
  223. #endif
  224. #endif
  225. }RXHP_T, *pRXHP_T;
  226. #if(DM_ODM_SUPPORT_TYPE & (ODM_CE))
  227. #define ASSOCIATE_ENTRY_NUM 32 // Max size of AsocEntry[].
  228. #define ODM_ASSOCIATE_ENTRY_NUM ASSOCIATE_ENTRY_NUM
  229. #elif(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
  230. #define ASSOCIATE_ENTRY_NUM NUM_STAT
  231. #define ODM_ASSOCIATE_ENTRY_NUM ASSOCIATE_ENTRY_NUM+1
  232. #else
  233. //
  234. // 2012/01/12 MH Revise for compatiable with other SW team.
  235. // 0 is for STA 1-n is for AP clients.
  236. //
  237. #define ODM_ASSOCIATE_ENTRY_NUM ASSOCIATE_ENTRY_NUM+1// Default port only one
  238. #endif
  239. //#ifdef CONFIG_ANTENNA_DIVERSITY
  240. // This indicates two different the steps.
  241. // In SWAW_STEP_PEAK, driver needs to switch antenna and listen to the signal on the air.
  242. // In SWAW_STEP_DETERMINE, driver just compares the signal captured in SWAW_STEP_PEAK
  243. // with original RSSI to determine if it is necessary to switch antenna.
  244. #define SWAW_STEP_PEAK 0
  245. #define SWAW_STEP_DETERMINE 1
  246. #define TP_MODE 0
  247. #define RSSI_MODE 1
  248. #define TRAFFIC_LOW 0
  249. #define TRAFFIC_HIGH 1
  250. typedef struct _SW_Antenna_Switch_
  251. {
  252. u1Byte try_flag;
  253. s4Byte PreRSSI;
  254. u1Byte CurAntenna;
  255. u1Byte PreAntenna;
  256. u1Byte RSSI_Trying;
  257. u1Byte TestMode;
  258. u1Byte bTriggerAntennaSwitch;
  259. u1Byte SelectAntennaMap;
  260. u1Byte RSSI_target;
  261. // Before link Antenna Switch check
  262. u1Byte SWAS_NoLink_State;
  263. u4Byte SWAS_NoLink_BK_Reg860;
  264. BOOLEAN ANTA_ON; //To indicate Ant A is or not
  265. BOOLEAN ANTB_ON; //To indicate Ant B is on or not
  266. s4Byte RSSI_sum_A;
  267. s4Byte RSSI_sum_B;
  268. s4Byte RSSI_cnt_A;
  269. s4Byte RSSI_cnt_B;
  270. u8Byte lastTxOkCnt;
  271. u8Byte lastRxOkCnt;
  272. u8Byte TXByteCnt_A;
  273. u8Byte TXByteCnt_B;
  274. u8Byte RXByteCnt_A;
  275. u8Byte RXByteCnt_B;
  276. u1Byte TrafficLoad;
  277. RT_TIMER SwAntennaSwitchTimer;
  278. #if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
  279. #if USE_WORKITEM
  280. RT_WORK_ITEM SwAntennaSwitchWorkitem;
  281. #endif
  282. #endif
  283. /* CE Platform use
  284. #ifdef CONFIG_SW_ANTENNA_DIVERSITY
  285. _timer SwAntennaSwitchTimer;
  286. u8Byte lastTxOkCnt;
  287. u8Byte lastRxOkCnt;
  288. u8Byte TXByteCnt_A;
  289. u8Byte TXByteCnt_B;
  290. u8Byte RXByteCnt_A;
  291. u8Byte RXByteCnt_B;
  292. u1Byte DoubleComfirm;
  293. u1Byte TrafficLoad;
  294. //SW Antenna Switch
  295. #endif
  296. */
  297. #ifdef CONFIG_HW_ANTENNA_DIVERSITY
  298. //Hybrid Antenna Diversity
  299. u4Byte CCK_Ant1_Cnt[ASSOCIATE_ENTRY_NUM+1];
  300. u4Byte CCK_Ant2_Cnt[ASSOCIATE_ENTRY_NUM+1];
  301. u4Byte OFDM_Ant1_Cnt[ASSOCIATE_ENTRY_NUM+1];
  302. u4Byte OFDM_Ant2_Cnt[ASSOCIATE_ENTRY_NUM+1];
  303. u4Byte RSSI_Ant1_Sum[ASSOCIATE_ENTRY_NUM+1];
  304. u4Byte RSSI_Ant2_Sum[ASSOCIATE_ENTRY_NUM+1];
  305. u1Byte TxAnt[ASSOCIATE_ENTRY_NUM+1];
  306. u1Byte TargetSTA;
  307. u1Byte antsel;
  308. u1Byte RxIdleAnt;
  309. #endif
  310. }SWAT_T, *pSWAT_T;
  311. //#endif
  312. typedef struct _EDCA_TURBO_
  313. {
  314. BOOLEAN bCurrentTurboEDCA;
  315. BOOLEAN bIsCurRDLState;
  316. #if(DM_ODM_SUPPORT_TYPE == ODM_CE )
  317. u4Byte prv_traffic_idx; // edca turbo
  318. #endif
  319. }EDCA_T,*pEDCA_T;
  320. typedef struct _ODM_RATE_ADAPTIVE
  321. {
  322. u1Byte Type; // DM_Type_ByFW/DM_Type_ByDriver
  323. u1Byte LdpcThres; // if RSSI > LdpcThres => switch from LPDC to BCC
  324. BOOLEAN bUseLdpc;
  325. BOOLEAN bLowerRtsRate;
  326. u1Byte HighRSSIThresh; // if RSSI > HighRSSIThresh => RATRState is DM_RATR_STA_HIGH
  327. u1Byte LowRSSIThresh; // if RSSI <= LowRSSIThresh => RATRState is DM_RATR_STA_LOW
  328. u1Byte RATRState; // Current RSSI level, DM_RATR_STA_HIGH/DM_RATR_STA_MIDDLE/DM_RATR_STA_LOW
  329. } ODM_RATE_ADAPTIVE, *PODM_RATE_ADAPTIVE;
  330. #if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
  331. #ifdef ADSL_AP_BUILD_WORKAROUND
  332. #define MAX_TOLERANCE 5
  333. #define IQK_DELAY_TIME 1 //ms
  334. #endif
  335. //
  336. // Indicate different AP vendor for IOT issue.
  337. //
  338. typedef enum _HT_IOT_PEER
  339. {
  340. HT_IOT_PEER_UNKNOWN = 0,
  341. HT_IOT_PEER_REALTEK = 1,
  342. HT_IOT_PEER_REALTEK_92SE = 2,
  343. HT_IOT_PEER_BROADCOM = 3,
  344. HT_IOT_PEER_RALINK = 4,
  345. HT_IOT_PEER_ATHEROS = 5,
  346. HT_IOT_PEER_CISCO = 6,
  347. HT_IOT_PEER_MERU = 7,
  348. HT_IOT_PEER_MARVELL = 8,
  349. HT_IOT_PEER_REALTEK_SOFTAP = 9,// peer is RealTek SOFT_AP, by Bohn, 2009.12.17
  350. HT_IOT_PEER_SELF_SOFTAP = 10, // Self is SoftAP
  351. HT_IOT_PEER_AIRGO = 11,
  352. HT_IOT_PEER_INTEL = 12,
  353. HT_IOT_PEER_RTK_APCLIENT = 13,
  354. HT_IOT_PEER_REALTEK_81XX = 14,
  355. HT_IOT_PEER_REALTEK_WOW = 15,
  356. HT_IOT_PEER_MAX = 16
  357. }HT_IOT_PEER_E, *PHTIOT_PEER_E;
  358. #endif//#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
  359. #define IQK_MAC_REG_NUM 4
  360. #define IQK_ADDA_REG_NUM 16
  361. #define IQK_BB_REG_NUM_MAX 10
  362. #define IQK_BB_REG_NUM 10
  363. #define HP_THERMAL_NUM 8
  364. #define AVG_THERMAL_NUM 8
  365. #define IQK_Matrix_REG_NUM 8
  366. #define IQK_Matrix_Settings_NUM 14+24+21 // Channels_2_4G_NUM + Channels_5G_20M_NUM + Channels_5G
  367. #define DM_Type_ByFW 0
  368. #define DM_Type_ByDriver 1
  369. //
  370. // Declare for common info
  371. //
  372. #define MAX_PATH_NUM_92CS 2
  373. #define MAX_PATH_NUM_8188E 1
  374. #define MAX_PATH_NUM_8192E 2
  375. #define MAX_PATH_NUM_8723B 1
  376. #define MAX_PATH_NUM_8812A 2
  377. #define MAX_PATH_NUM_8821A 1
  378. #define IQK_THRESHOLD 8
  379. typedef struct _ODM_Phy_Status_Info_
  380. {
  381. //
  382. // Be care, if you want to add any element please insert between
  383. // RxPWDBAll & SignalStrength.
  384. //
  385. #if (DM_ODM_SUPPORT_TYPE & (ODM_WIN))
  386. u4Byte RxPWDBAll;
  387. #else
  388. u1Byte RxPWDBAll;
  389. #endif
  390. u1Byte SignalQuality; // in 0-100 index.
  391. s1Byte RxMIMOSignalQuality[4]; //per-path's EVM
  392. u1Byte RxMIMOEVMdbm[4]; //per-path's EVM dbm
  393. u1Byte RxMIMOSignalStrength[4];// in 0~100 index
  394. u2Byte Cfo_short[4]; // per-path's Cfo_short
  395. u2Byte Cfo_tail[4]; // per-path's Cfo_tail
  396. #if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE))
  397. s1Byte RxPower; // in dBm Translate from PWdB
  398. s1Byte RecvSignalPower; // Real power in dBm for this packet, no beautification and aggregation. Keep this raw info to be used for the other procedures.
  399. u1Byte BTRxRSSIPercentage;
  400. u1Byte SignalStrength; // in 0-100 index.
  401. u1Byte RxPwr[4]; //per-path's pwdb
  402. #endif
  403. u1Byte RxSNR[4]; //per-path's SNR
  404. u1Byte BandWidth;
  405. u1Byte btCoexPwrAdjust;
  406. }ODM_PHY_INFO_T,*PODM_PHY_INFO_T;
  407. typedef struct _ODM_Per_Pkt_Info_
  408. {
  409. //u1Byte Rate;
  410. u1Byte DataRate;
  411. u1Byte StationID;
  412. BOOLEAN bPacketMatchBSSID;
  413. BOOLEAN bPacketToSelf;
  414. BOOLEAN bPacketBeacon;
  415. }ODM_PACKET_INFO_T,*PODM_PACKET_INFO_T;
  416. typedef struct _ODM_Phy_Dbg_Info_
  417. {
  418. //ODM Write,debug info
  419. s1Byte RxSNRdB[4];
  420. u8Byte NumQryPhyStatus;
  421. u8Byte NumQryPhyStatusCCK;
  422. u8Byte NumQryPhyStatusOFDM;
  423. u1Byte NumQryBeaconPkt;
  424. //Others
  425. s4Byte RxEVM[4];
  426. }ODM_PHY_DBG_INFO_T;
  427. typedef struct _ODM_Mac_Status_Info_
  428. {
  429. u1Byte test;
  430. }ODM_MAC_INFO;
  431. typedef enum tag_Dynamic_ODM_Support_Ability_Type
  432. {
  433. // BB Team
  434. ODM_DIG = 0x00000001,
  435. ODM_HIGH_POWER = 0x00000002,
  436. ODM_CCK_CCA_TH = 0x00000004,
  437. ODM_FA_STATISTICS = 0x00000008,
  438. ODM_RAMASK = 0x00000010,
  439. ODM_RSSI_MONITOR = 0x00000020,
  440. ODM_SW_ANTDIV = 0x00000040,
  441. ODM_HW_ANTDIV = 0x00000080,
  442. ODM_BB_PWRSV = 0x00000100,
  443. ODM_2TPATHDIV = 0x00000200,
  444. ODM_1TPATHDIV = 0x00000400,
  445. ODM_PSD2AFH = 0x00000800
  446. }ODM_Ability_E;
  447. //
  448. // 2011/20/20 MH For MP driver RT_WLAN_STA = STA_INFO_T
  449. // Please declare below ODM relative info in your STA info structure.
  450. //
  451. #if 1
  452. typedef struct _ODM_STA_INFO{
  453. // Driver Write
  454. BOOLEAN bUsed; // record the sta status link or not?
  455. //u1Byte WirelessMode; //
  456. u1Byte IOTPeer; // Enum value. HT_IOT_PEER_E
  457. // ODM Write
  458. //1 PHY_STATUS_INFO
  459. u1Byte RSSI_Path[4]; //
  460. u1Byte RSSI_Ave;
  461. u1Byte RXEVM[4];
  462. u1Byte RXSNR[4];
  463. // ODM Write
  464. //1 TX_INFO (may changed by IC)
  465. //TX_INFO_T pTxInfo; // Define in IC folder. Move lower layer.
  466. #if 0
  467. u1Byte ANTSEL_A; //in Jagar: 4bit; others: 2bit
  468. u1Byte ANTSEL_B; //in Jagar: 4bit; others: 2bit
  469. u1Byte ANTSEL_C; //only in Jagar: 4bit
  470. u1Byte ANTSEL_D; //only in Jagar: 4bit
  471. u1Byte TX_ANTL; //not in Jagar: 2bit
  472. u1Byte TX_ANT_HT; //not in Jagar: 2bit
  473. u1Byte TX_ANT_CCK; //not in Jagar: 2bit
  474. u1Byte TXAGC_A; //not in Jagar: 4bit
  475. u1Byte TXAGC_B; //not in Jagar: 4bit
  476. u1Byte TXPWR_OFFSET; //only in Jagar: 3bit
  477. u1Byte TX_ANT; //only in Jagar: 4bit for TX_ANTL/TX_ANTHT/TX_ANT_CCK
  478. #endif
  479. //
  480. // Please use compile flag to disabe the strcutrue for other IC except 88E.
  481. // Move To lower layer.
  482. //
  483. // ODM Write Wilson will handle this part(said by Luke.Lee)
  484. //TX_RPT_T pTxRpt; // Define in IC folder. Move lower layer.
  485. #if 0
  486. //1 For 88E RA (don't redefine the naming)
  487. u1Byte rate_id;
  488. u1Byte rate_SGI;
  489. u1Byte rssi_sta_ra;
  490. u1Byte SGI_enable;
  491. u1Byte Decision_rate;
  492. u1Byte Pre_rate;
  493. u1Byte Active;
  494. // Driver write Wilson handle.
  495. //1 TX_RPT (don't redefine the naming)
  496. u2Byte RTY[4]; // ???
  497. u2Byte TOTAL; // ???
  498. u2Byte DROP; // ???
  499. //
  500. // Please use compile flag to disabe the strcutrue for other IC except 88E.
  501. //
  502. #endif
  503. }ODM_STA_INFO_T, *PODM_STA_INFO_T;
  504. #endif
  505. //
  506. // 2011/10/20 MH Define Common info enum for all team.
  507. //
  508. typedef enum _ODM_Common_Info_Definition
  509. {
  510. //-------------REMOVED CASE-----------//
  511. //ODM_CMNINFO_CCK_HP,
  512. //ODM_CMNINFO_RFPATH_ENABLE, // Define as ODM write???
  513. //ODM_CMNINFO_BT_COEXIST, // ODM_BT_COEXIST_E
  514. //ODM_CMNINFO_OP_MODE, // ODM_OPERATION_MODE_E
  515. //-------------REMOVED CASE-----------//
  516. //
  517. // Fixed value:
  518. //
  519. //-----------HOOK BEFORE REG INIT-----------//
  520. ODM_CMNINFO_PLATFORM = 0,
  521. ODM_CMNINFO_ABILITY, // ODM_ABILITY_E
  522. ODM_CMNINFO_INTERFACE, // ODM_INTERFACE_E
  523. ODM_CMNINFO_MP_TEST_CHIP,
  524. ODM_CMNINFO_IC_TYPE, // ODM_IC_TYPE_E
  525. ODM_CMNINFO_CUT_VER, // ODM_CUT_VERSION_E
  526. ODM_CMNINFO_FAB_VER, // ODM_FAB_E
  527. ODM_CMNINFO_RF_TYPE, // ODM_RF_PATH_E or ODM_RF_TYPE_E?
  528. ODM_CMNINFO_RFE_TYPE,
  529. ODM_CMNINFO_BOARD_TYPE, // ODM_BOARD_TYPE_E
  530. ODM_CMNINFO_EXT_LNA, // TRUE
  531. ODM_CMNINFO_5G_EXT_LNA,
  532. ODM_CMNINFO_EXT_PA,
  533. ODM_CMNINFO_5G_EXT_PA,
  534. ODM_CMNINFO_EXT_TRSW,
  535. ODM_CMNINFO_PATCH_ID, //CUSTOMER ID
  536. ODM_CMNINFO_BINHCT_TEST,
  537. ODM_CMNINFO_BWIFI_TEST,
  538. ODM_CMNINFO_SMART_CONCURRENT,
  539. //-----------HOOK BEFORE REG INIT-----------//
  540. //
  541. // Dynamic value:
  542. //
  543. //--------- POINTER REFERENCE-----------//
  544. ODM_CMNINFO_MAC_PHY_MODE, // ODM_MAC_PHY_MODE_E
  545. ODM_CMNINFO_TX_UNI,
  546. ODM_CMNINFO_RX_UNI,
  547. ODM_CMNINFO_WM_MODE, // ODM_WIRELESS_MODE_E
  548. ODM_CMNINFO_BAND, // ODM_BAND_TYPE_E
  549. ODM_CMNINFO_SEC_CHNL_OFFSET, // ODM_SEC_CHNL_OFFSET_E
  550. ODM_CMNINFO_SEC_MODE, // ODM_SECURITY_E
  551. ODM_CMNINFO_BW, // ODM_BW_E
  552. ODM_CMNINFO_CHNL,
  553. ODM_CMNINFO_FORCED_RATE,
  554. ODM_CMNINFO_DMSP_GET_VALUE,
  555. ODM_CMNINFO_BUDDY_ADAPTOR,
  556. ODM_CMNINFO_DMSP_IS_MASTER,
  557. ODM_CMNINFO_SCAN,
  558. ODM_CMNINFO_POWER_SAVING,
  559. ODM_CMNINFO_ONE_PATH_CCA, // ODM_CCA_PATH_E
  560. ODM_CMNINFO_DRV_STOP,
  561. ODM_CMNINFO_PNP_IN,
  562. ODM_CMNINFO_INIT_ON,
  563. ODM_CMNINFO_ANT_TEST,
  564. ODM_CMNINFO_NET_CLOSED,
  565. ODM_CMNINFO_MP_MODE,
  566. //ODM_CMNINFO_RTSTA_AID, // For win driver only?
  567. //--------- POINTER REFERENCE-----------//
  568. //------------CALL BY VALUE-------------//
  569. ODM_CMNINFO_WIFI_DIRECT,
  570. ODM_CMNINFO_WIFI_DISPLAY,
  571. ODM_CMNINFO_LINK_IN_PROGRESS,
  572. ODM_CMNINFO_LINK,
  573. ODM_CMNINFO_RSSI_MIN,
  574. ODM_CMNINFO_DBG_COMP, // u8Byte
  575. ODM_CMNINFO_DBG_LEVEL, // u4Byte
  576. ODM_CMNINFO_RA_THRESHOLD_HIGH, // u1Byte
  577. ODM_CMNINFO_RA_THRESHOLD_LOW, // u1Byte
  578. ODM_CMNINFO_RF_ANTENNA_TYPE, // u1Byte
  579. ODM_CMNINFO_BT_DISABLED,
  580. ODM_CMNINFO_BT_HS_CONNECT_PROCESS,
  581. ODM_CMNINFO_BT_HS_RSSI,
  582. ODM_CMNINFO_BT_OPERATION,
  583. ODM_CMNINFO_BT_LIMITED_DIG, //Need to Limited Dig or not
  584. ODM_CMNINFO_BT_DISABLE_EDCA,
  585. //------------CALL BY VALUE-------------//
  586. //
  587. // Dynamic ptr array hook itms.
  588. //
  589. ODM_CMNINFO_STA_STATUS,
  590. ODM_CMNINFO_PHY_STATUS,
  591. ODM_CMNINFO_MAC_STATUS,
  592. ODM_CMNINFO_MAX,
  593. }ODM_CMNINFO_E;
  594. //
  595. // 2011/10/20 MH Define ODM support ability. ODM_CMNINFO_ABILITY
  596. //
  597. typedef enum _ODM_Support_Ability_Definition
  598. {
  599. //
  600. // BB ODM section BIT 0-15
  601. //
  602. ODM_BB_DIG = BIT0,
  603. ODM_BB_RA_MASK = BIT1,
  604. ODM_BB_DYNAMIC_TXPWR = BIT2,
  605. ODM_BB_FA_CNT = BIT3,
  606. ODM_BB_RSSI_MONITOR = BIT4,
  607. ODM_BB_CCK_PD = BIT5,
  608. ODM_BB_ANT_DIV = BIT6,
  609. ODM_BB_PWR_SAVE = BIT7,
  610. ODM_BB_PWR_TRAIN = BIT8,
  611. ODM_BB_RATE_ADAPTIVE = BIT9,
  612. ODM_BB_PATH_DIV = BIT10,
  613. ODM_BB_PSD = BIT11,
  614. ODM_BB_RXHP = BIT12,
  615. ODM_BB_ADAPTIVITY = BIT13,
  616. ODM_BB_DYNAMIC_ATC = BIT14,
  617. //
  618. // MAC DM section BIT 16-23
  619. //
  620. ODM_MAC_EDCA_TURBO = BIT16,
  621. ODM_MAC_EARLY_MODE = BIT17,
  622. //
  623. // RF ODM section BIT 24-31
  624. //
  625. ODM_RF_TX_PWR_TRACK = BIT24,
  626. ODM_RF_RX_GAIN_TRACK = BIT25,
  627. ODM_RF_CALIBRATION = BIT26,
  628. }ODM_ABILITY_E;
  629. // ODM_CMNINFO_INTERFACE
  630. typedef enum tag_ODM_Support_Interface_Definition
  631. {
  632. ODM_ITRF_PCIE = 0x1,
  633. ODM_ITRF_USB = 0x2,
  634. ODM_ITRF_SDIO = 0x4,
  635. ODM_ITRF_ALL = 0x7,
  636. }ODM_INTERFACE_E;
  637. // ODM_CMNINFO_IC_TYPE
  638. typedef enum tag_ODM_Support_IC_Type_Definition
  639. {
  640. ODM_RTL8192S = BIT0,
  641. ODM_RTL8192C = BIT1,
  642. ODM_RTL8192D = BIT2,
  643. ODM_RTL8723A = BIT3,
  644. ODM_RTL8188E = BIT4,
  645. ODM_RTL8812 = BIT5,
  646. ODM_RTL8821 = BIT6,
  647. ODM_RTL8192E = BIT7,
  648. ODM_RTL8723B = BIT8,
  649. ODM_RTL8813A = BIT9
  650. }ODM_IC_TYPE_E;
  651. #define ODM_IC_11N_SERIES (ODM_RTL8192S|ODM_RTL8192C|ODM_RTL8192D|ODM_RTL8723A|ODM_RTL8188E|ODM_RTL8192E|ODM_RTL8723B)
  652. #define ODM_IC_11AC_SERIES (ODM_RTL8812 | ODM_RTL8821|ODM_RTL8813A)
  653. //ODM_CMNINFO_CUT_VER
  654. typedef enum tag_ODM_Cut_Version_Definition
  655. {
  656. ODM_CUT_A = 1,
  657. ODM_CUT_B = 2,
  658. ODM_CUT_C = 3,
  659. ODM_CUT_D = 4,
  660. ODM_CUT_E = 5,
  661. ODM_CUT_F = 6,
  662. ODM_CUT_I = 9,
  663. ODM_CUT_TEST = 7,
  664. }ODM_CUT_VERSION_E;
  665. // ODM_CMNINFO_FAB_VER
  666. typedef enum tag_ODM_Fab_Version_Definition
  667. {
  668. ODM_TSMC = 0,
  669. ODM_UMC = 1,
  670. ODM_SMIC = 2,
  671. }ODM_FAB_E;
  672. // ODM_CMNINFO_RF_TYPE
  673. //
  674. // For example 1T2R (A+AB = BIT0|BIT4|BIT5)
  675. //
  676. typedef enum tag_ODM_RF_Path_Bit_Definition
  677. {
  678. ODM_RF_TX_A = BIT0,
  679. ODM_RF_TX_B = BIT1,
  680. ODM_RF_TX_C = BIT2,
  681. ODM_RF_TX_D = BIT3,
  682. ODM_RF_RX_A = BIT4,
  683. ODM_RF_RX_B = BIT5,
  684. ODM_RF_RX_C = BIT6,
  685. ODM_RF_RX_D = BIT7,
  686. }ODM_RF_PATH_E;
  687. typedef enum tag_ODM_RF_Type_Definition
  688. {
  689. ODM_1T1R = 0,
  690. ODM_1T2R = 1,
  691. ODM_2T2R = 2,
  692. ODM_2T3R = 3,
  693. ODM_2T4R = 4,
  694. ODM_3T3R = 5,
  695. ODM_3T4R = 6,
  696. ODM_4T4R = 7,
  697. }ODM_RF_TYPE_E;
  698. //
  699. // ODM Dynamic common info value definition
  700. //
  701. //typedef enum _MACPHY_MODE_8192D{
  702. // SINGLEMAC_SINGLEPHY,
  703. // DUALMAC_DUALPHY,
  704. // DUALMAC_SINGLEPHY,
  705. //}MACPHY_MODE_8192D,*PMACPHY_MODE_8192D;
  706. // Above is the original define in MP driver. Please use the same define. THX.
  707. typedef enum tag_ODM_MAC_PHY_Mode_Definition
  708. {
  709. ODM_SMSP = 0,
  710. ODM_DMSP = 1,
  711. ODM_DMDP = 2,
  712. }ODM_MAC_PHY_MODE_E;
  713. typedef enum tag_BT_Coexist_Definition
  714. {
  715. ODM_BT_BUSY = 1,
  716. ODM_BT_ON = 2,
  717. ODM_BT_OFF = 3,
  718. ODM_BT_NONE = 4,
  719. }ODM_BT_COEXIST_E;
  720. // ODM_CMNINFO_OP_MODE
  721. typedef enum tag_Operation_Mode_Definition
  722. {
  723. ODM_NO_LINK = BIT0,
  724. ODM_LINK = BIT1,
  725. ODM_SCAN = BIT2,
  726. ODM_POWERSAVE = BIT3,
  727. ODM_AP_MODE = BIT4,
  728. ODM_CLIENT_MODE = BIT5,
  729. ODM_AD_HOC = BIT6,
  730. ODM_WIFI_DIRECT = BIT7,
  731. ODM_WIFI_DISPLAY = BIT8,
  732. }ODM_OPERATION_MODE_E;
  733. // ODM_CMNINFO_WM_MODE
  734. typedef enum tag_Wireless_Mode_Definition
  735. {
  736. ODM_WM_UNKNOW = 0x0,
  737. ODM_WM_B = BIT0,
  738. ODM_WM_G = BIT1,
  739. ODM_WM_A = BIT2,
  740. ODM_WM_N24G = BIT3,
  741. ODM_WM_N5G = BIT4,
  742. ODM_WM_AUTO = BIT5,
  743. ODM_WM_AC = BIT6,
  744. }ODM_WIRELESS_MODE_E;
  745. // ODM_CMNINFO_BAND
  746. typedef enum tag_Band_Type_Definition
  747. {
  748. ODM_BAND_2_4G = BIT0,
  749. ODM_BAND_5G = BIT1,
  750. }ODM_BAND_TYPE_E;
  751. // ODM_CMNINFO_SEC_CHNL_OFFSET
  752. typedef enum tag_Secondary_Channel_Offset_Definition
  753. {
  754. ODM_DONT_CARE = 0,
  755. ODM_BELOW = 1,
  756. ODM_ABOVE = 2
  757. }ODM_SEC_CHNL_OFFSET_E;
  758. // ODM_CMNINFO_SEC_MODE
  759. typedef enum tag_Security_Definition
  760. {
  761. ODM_SEC_OPEN = 0,
  762. ODM_SEC_WEP40 = 1,
  763. ODM_SEC_TKIP = 2,
  764. ODM_SEC_RESERVE = 3,
  765. ODM_SEC_AESCCMP = 4,
  766. ODM_SEC_WEP104 = 5,
  767. ODM_WEP_WPA_MIXED = 6, // WEP + WPA
  768. ODM_SEC_SMS4 = 7,
  769. }ODM_SECURITY_E;
  770. // ODM_CMNINFO_BW
  771. typedef enum tag_Bandwidth_Definition
  772. {
  773. ODM_BW20M = 0,
  774. ODM_BW40M = 1,
  775. ODM_BW80M = 2,
  776. ODM_BW160M = 3,
  777. ODM_BW10M = 4,
  778. }ODM_BW_E;
  779. // ODM_CMNINFO_CHNL
  780. // ODM_CMNINFO_BOARD_TYPE
  781. // For non-AC-series IC , ODM_BOARD_5G_EXT_PA and ODM_BOARD_5G_EXT_LNA are ignored
  782. // For AC-series IC, external PA & LNA can be indivisuallly added on 2.4G and/or 5G
  783. typedef enum tag_Board_Definition
  784. {
  785. ODM_BOARD_DEFAULT = 0, // The DEFAULT case.
  786. ODM_BOARD_MINICARD = BIT(0), // 0 = non-mini card, 1= mini card.
  787. ODM_BOARD_SLIM = BIT(1), // 0 = non-slim card, 1 = slim card
  788. ODM_BOARD_BT = BIT(2), // 0 = without BT card, 1 = with BT
  789. ODM_BOARD_EXT_PA = BIT(3), // 0 = no 2G ext-PA, 1 = existing 2G ext-PA
  790. ODM_BOARD_EXT_LNA = BIT(4), // 0 = no 2G ext-LNA, 1 = existing 2G ext-LNA
  791. ODM_BOARD_EXT_TRSW = BIT(5), // 0 = no ext-TRSW, 1 = existing ext-TRSW
  792. ODM_BOARD_EXT_PA_5G = BIT(6), // 0 = no 5G ext-PA, 1 = existing 5G ext-PA
  793. ODM_BOARD_EXT_LNA_5G = BIT(7), // 0 = no 5G ext-LNA, 1 = existing 5G ext-LNA
  794. }ODM_BOARD_TYPE_E;
  795. // ODM_CMNINFO_ONE_PATH_CCA
  796. typedef enum tag_CCA_Path
  797. {
  798. ODM_CCA_2R = 0,
  799. ODM_CCA_1R_A = 1,
  800. ODM_CCA_1R_B = 2,
  801. }ODM_CCA_PATH_E;
  802. typedef struct _ODM_RA_Info_
  803. {
  804. u1Byte RateID;
  805. u4Byte RateMask;
  806. u4Byte RAUseRate;
  807. u1Byte RateSGI;
  808. u1Byte RssiStaRA;
  809. u1Byte PreRssiStaRA;
  810. u1Byte SGIEnable;
  811. u1Byte DecisionRate;
  812. u1Byte PreRate;
  813. u1Byte HighestRate;
  814. u1Byte LowestRate;
  815. u4Byte NscUp;
  816. u4Byte NscDown;
  817. u2Byte RTY[5];
  818. u4Byte TOTAL;
  819. u2Byte DROP;
  820. u1Byte Active;
  821. u2Byte RptTime;
  822. u1Byte RAWaitingCounter;
  823. u1Byte RAPendingCounter;
  824. #if 1 //POWER_TRAINING_ACTIVE == 1 // For compile pass only~!
  825. u1Byte PTActive; // on or off
  826. u1Byte PTTryState; // 0 trying state, 1 for decision state
  827. u1Byte PTStage; // 0~6
  828. u1Byte PTStopCount; //Stop PT counter
  829. u1Byte PTPreRate; // if rate change do PT
  830. u1Byte PTPreRssi; // if RSSI change 5% do PT
  831. u1Byte PTModeSS; // decide whitch rate should do PT
  832. u1Byte RAstage; // StageRA, decide how many times RA will be done between PT
  833. u1Byte PTSmoothFactor;
  834. #endif
  835. } ODM_RA_INFO_T,*PODM_RA_INFO_T;
  836. typedef struct _IQK_MATRIX_REGS_SETTING{
  837. BOOLEAN bIQKDone;
  838. s4Byte Value[3][IQK_Matrix_REG_NUM];
  839. BOOLEAN bBWIqkResultSaved[3];
  840. }IQK_MATRIX_REGS_SETTING,*PIQK_MATRIX_REGS_SETTING;
  841. #if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
  842. typedef struct _PathDiv_Parameter_define_
  843. {
  844. u4Byte org_5g_RegE30;
  845. u4Byte org_5g_RegC14;
  846. u4Byte org_5g_RegCA0;
  847. u4Byte swt_5g_RegE30;
  848. u4Byte swt_5g_RegC14;
  849. u4Byte swt_5g_RegCA0;
  850. //for 2G IQK information
  851. u4Byte org_2g_RegC80;
  852. u4Byte org_2g_RegC4C;
  853. u4Byte org_2g_RegC94;
  854. u4Byte org_2g_RegC14;
  855. u4Byte org_2g_RegCA0;
  856. u4Byte swt_2g_RegC80;
  857. u4Byte swt_2g_RegC4C;
  858. u4Byte swt_2g_RegC94;
  859. u4Byte swt_2g_RegC14;
  860. u4Byte swt_2g_RegCA0;
  861. }PATHDIV_PARA,*pPATHDIV_PARA;
  862. #endif
  863. typedef struct ODM_RF_Calibration_Structure
  864. {
  865. //for tx power tracking
  866. u4Byte RegA24; // for TempCCK
  867. s4Byte RegE94;
  868. s4Byte RegE9C;
  869. s4Byte RegEB4;
  870. s4Byte RegEBC;
  871. u1Byte TXPowercount;
  872. BOOLEAN bTXPowerTrackingInit;
  873. BOOLEAN bTXPowerTracking;
  874. u1Byte TxPowerTrackControl; //for mp mode, turn off txpwrtracking as default
  875. u1Byte TM_Trigger;
  876. u1Byte InternalPA5G[2]; //pathA / pathB
  877. u1Byte ThermalMeter[2]; // ThermalMeter, index 0 for RFIC0, and 1 for RFIC1
  878. u1Byte ThermalValue;
  879. u1Byte ThermalValue_LCK;
  880. u1Byte ThermalValue_IQK;
  881. u1Byte ThermalValue_DPK;
  882. u1Byte ThermalValue_AVG[AVG_THERMAL_NUM];
  883. u1Byte ThermalValue_AVG_index;
  884. u1Byte ThermalValue_RxGain;
  885. u1Byte ThermalValue_Crystal;
  886. u1Byte ThermalValue_DPKstore;
  887. u1Byte ThermalValue_DPKtrack;
  888. BOOLEAN TxPowerTrackingInProgress;
  889. BOOLEAN bDPKenable;
  890. BOOLEAN bReloadtxpowerindex;
  891. u1Byte bRfPiEnable;
  892. u4Byte TXPowerTrackingCallbackCnt; //cosa add for debug
  893. //------------------------- Tx power Tracking -------------------------//
  894. u1Byte bCCKinCH14;
  895. u1Byte CCK_index;
  896. u1Byte OFDM_index[MAX_RF_PATH];
  897. s1Byte PowerIndexOffset[MAX_RF_PATH];
  898. s1Byte DeltaPowerIndex[MAX_RF_PATH];
  899. s1Byte DeltaPowerIndexLast[MAX_RF_PATH];
  900. BOOLEAN bTxPowerChanged;
  901. u1Byte ThermalValue_HP[HP_THERMAL_NUM];
  902. u1Byte ThermalValue_HP_index;
  903. IQK_MATRIX_REGS_SETTING IQKMatrixRegSetting[IQK_Matrix_Settings_NUM];
  904. BOOLEAN bNeedIQK;
  905. u1Byte Delta_IQK;
  906. u1Byte Delta_LCK;
  907. s1Byte BBSwingDiff2G, BBSwingDiff5G; // Unit: dB
  908. u1Byte DeltaSwingTableIdx_2GCCKA_P[DELTA_SWINGIDX_SIZE];
  909. u1Byte DeltaSwingTableIdx_2GCCKA_N[DELTA_SWINGIDX_SIZE];
  910. u1Byte DeltaSwingTableIdx_2GCCKB_P[DELTA_SWINGIDX_SIZE];
  911. u1Byte DeltaSwingTableIdx_2GCCKB_N[DELTA_SWINGIDX_SIZE];
  912. u1Byte DeltaSwingTableIdx_2GA_P[DELTA_SWINGIDX_SIZE];
  913. u1Byte DeltaSwingTableIdx_2GA_N[DELTA_SWINGIDX_SIZE];
  914. u1Byte DeltaSwingTableIdx_2GB_P[DELTA_SWINGIDX_SIZE];
  915. u1Byte DeltaSwingTableIdx_2GB_N[DELTA_SWINGIDX_SIZE];
  916. u1Byte DeltaSwingTableIdx_5GA_P[BAND_NUM][DELTA_SWINGIDX_SIZE];
  917. u1Byte DeltaSwingTableIdx_5GA_N[BAND_NUM][DELTA_SWINGIDX_SIZE];
  918. u1Byte DeltaSwingTableIdx_5GB_P[BAND_NUM][DELTA_SWINGIDX_SIZE];
  919. u1Byte DeltaSwingTableIdx_5GB_N[BAND_NUM][DELTA_SWINGIDX_SIZE];
  920. u1Byte DeltaSwingTableIdx_2GA_P_8188E[DELTA_SWINGIDX_SIZE];
  921. u1Byte DeltaSwingTableIdx_2GA_N_8188E[DELTA_SWINGIDX_SIZE];
  922. //--------------------------------------------------------------------//
  923. //for IQK
  924. u4Byte RegC04;
  925. u4Byte Reg874;
  926. u4Byte RegC08;
  927. u4Byte RegB68;
  928. u4Byte RegB6C;
  929. u4Byte Reg870;
  930. u4Byte Reg860;
  931. u4Byte Reg864;
  932. BOOLEAN bIQKInitialized;
  933. BOOLEAN bLCKInProgress;
  934. BOOLEAN bAntennaDetected;
  935. u4Byte ADDA_backup[IQK_ADDA_REG_NUM];
  936. u4Byte IQK_MAC_backup[IQK_MAC_REG_NUM];
  937. u4Byte IQK_BB_backup_recover[9];
  938. u4Byte IQK_BB_backup[IQK_BB_REG_NUM];
  939. //for APK
  940. u4Byte APKoutput[2][2]; //path A/B; output1_1a/output1_2a
  941. u1Byte bAPKdone;
  942. u1Byte bAPKThermalMeterIgnore;
  943. u1Byte bDPdone;
  944. u1Byte bDPPathAOK;
  945. u1Byte bDPPathBOK;
  946. u4Byte TxIQC_8723B[2][3][2]; // { {S0: 0xc94, 0xc80, 0xc4c} , {S1: 0xc9c, 0xc88, 0xc4c}}
  947. u4Byte RxIQC_8723B[2][2][2]; // { {S0: 0xc14, 0xca0} , {S1: 0xc1c, 0xc78}}
  948. }ODM_RF_CAL_T,*PODM_RF_CAL_T;
  949. //
  950. // ODM Dynamic common info value definition
  951. //
  952. typedef struct _FAST_ANTENNA_TRAINNING_
  953. {
  954. u1Byte Bssid[6];
  955. u1Byte antsel_rx_keep_0;
  956. u1Byte antsel_rx_keep_1;
  957. u1Byte antsel_rx_keep_2;
  958. u4Byte antSumRSSI[7];
  959. u4Byte antRSSIcnt[7];
  960. u4Byte antAveRSSI[7];
  961. u1Byte FAT_State;
  962. u4Byte TrainIdx;
  963. u1Byte antsel_a[ODM_ASSOCIATE_ENTRY_NUM];
  964. u1Byte antsel_b[ODM_ASSOCIATE_ENTRY_NUM];
  965. u1Byte antsel_c[ODM_ASSOCIATE_ENTRY_NUM];
  966. u4Byte MainAnt_Sum[ODM_ASSOCIATE_ENTRY_NUM];
  967. u4Byte AuxAnt_Sum[ODM_ASSOCIATE_ENTRY_NUM];
  968. u4Byte MainAnt_Cnt[ODM_ASSOCIATE_ENTRY_NUM];
  969. u4Byte AuxAnt_Cnt[ODM_ASSOCIATE_ENTRY_NUM];
  970. u1Byte RxIdleAnt;
  971. BOOLEAN bBecomeLinked;
  972. }FAT_T,*pFAT_T;
  973. typedef enum _FAT_STATE
  974. {
  975. FAT_NORMAL_STATE = 0,
  976. FAT_TRAINING_STATE = 1,
  977. }FAT_STATE_E, *PFAT_STATE_E;
  978. typedef enum _ANT_DIV_TYPE
  979. {
  980. NO_ANTDIV = 0xFF,
  981. CG_TRX_HW_ANTDIV = 0x01,
  982. CGCS_RX_HW_ANTDIV = 0x02,
  983. FIXED_HW_ANTDIV = 0x03,
  984. CG_TRX_SMART_ANTDIV = 0x04,
  985. CGCS_RX_SW_ANTDIV = 0x05,
  986. S0S1_HW_ANTDIV = 0x06, //8723B intrnal switch S0 S1
  987. }ANT_DIV_TYPE_E, *PANT_DIV_TYPE_E;
  988. typedef struct _ODM_PATH_DIVERSITY_
  989. {
  990. u1Byte RespTxPath;
  991. u1Byte PathSel[ODM_ASSOCIATE_ENTRY_NUM];
  992. u4Byte PathA_Sum[ODM_ASSOCIATE_ENTRY_NUM];
  993. u4Byte PathB_Sum[ODM_ASSOCIATE_ENTRY_NUM];
  994. u4Byte PathA_Cnt[ODM_ASSOCIATE_ENTRY_NUM];
  995. u4Byte PathB_Cnt[ODM_ASSOCIATE_ENTRY_NUM];
  996. }PATHDIV_T, *pPATHDIV_T;
  997. typedef enum _BASEBAND_CONFIG_PHY_REG_PG_VALUE_TYPE{
  998. PHY_REG_PG_RELATIVE_VALUE = 0,
  999. PHY_REG_PG_EXACT_VALUE = 1
  1000. } PHY_REG_PG_TYPE;
  1001. //
  1002. // Antenna detection information from single tone mechanism, added by Roger, 2012.11.27.
  1003. //
  1004. typedef struct _ANT_DETECTED_INFO{
  1005. BOOLEAN bAntDetected;
  1006. u4Byte dBForAntA;
  1007. u4Byte dBForAntB;
  1008. u4Byte dBForAntO;
  1009. }ANT_DETECTED_INFO, *PANT_DETECTED_INFO;
  1010. //
  1011. // 2011/09/22 MH Copy from SD4 defined structure. We use to support PHY DM integration.
  1012. //
  1013. #if(DM_ODM_SUPPORT_TYPE & ODM_WIN)
  1014. #if (RT_PLATFORM != PLATFORM_LINUX)
  1015. typedef
  1016. #endif
  1017. struct DM_Out_Source_Dynamic_Mechanism_Structure
  1018. #else// for AP,ADSL,CE Team
  1019. typedef struct DM_Out_Source_Dynamic_Mechanism_Structure
  1020. #endif
  1021. {
  1022. //RT_TIMER FastAntTrainingTimer;
  1023. //
  1024. // Add for different team use temporarily
  1025. //
  1026. PADAPTER Adapter; // For CE/NIC team
  1027. prtl8192cd_priv priv; // For AP/ADSL team
  1028. // WHen you use Adapter or priv pointer, you must make sure the pointer is ready.
  1029. BOOLEAN odm_ready;
  1030. #if(DM_ODM_SUPPORT_TYPE & (ODM_CE|ODM_WIN))
  1031. rtl8192cd_priv fake_priv;
  1032. #endif
  1033. #if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
  1034. // ADSL_AP_BUILD_WORKAROUND
  1035. ADAPTER fake_adapter;
  1036. #endif
  1037. PHY_REG_PG_TYPE PhyRegPgValueType;
  1038. u8Byte DebugComponents;
  1039. u4Byte DebugLevel;
  1040. u8Byte NumQryPhyStatusAll; //CCK + OFDM
  1041. u8Byte LastNumQryPhyStatusAll;
  1042. u8Byte RxPWDBAve;
  1043. u8Byte RxPWDBAve_final;
  1044. BOOLEAN MPDIG_2G; //off MPDIG
  1045. u1Byte Times_2G;
  1046. //------ ODM HANDLE, DRIVER NEEDS NOT TO HOOK------//
  1047. BOOLEAN bCckHighPower;
  1048. u1Byte RFPathRxEnable; // ODM_CMNINFO_RFPATH_ENABLE
  1049. u1Byte ControlChannel;
  1050. //------ ODM HANDLE, DRIVER NEEDS NOT TO HOOK------//
  1051. //--------REMOVED COMMON INFO----------//
  1052. //u1Byte PseudoMacPhyMode;
  1053. //BOOLEAN *BTCoexist;
  1054. //BOOLEAN PseudoBtCoexist;
  1055. //u1Byte OPMode;
  1056. //BOOLEAN bAPMode;
  1057. //BOOLEAN bClientMode;
  1058. //BOOLEAN bAdHocMode;
  1059. //BOOLEAN bSlaveOfDMSP;
  1060. //--------REMOVED COMMON INFO----------//
  1061. //1 COMMON INFORMATION
  1062. //
  1063. // Init Value
  1064. //
  1065. //-----------HOOK BEFORE REG INIT-----------//
  1066. // ODM Platform info AP/ADSL/CE/MP = 1/2/3/4
  1067. u1Byte SupportPlatform;
  1068. // ODM Support Ability DIG/RATR/TX_PWR_TRACK/ ¡K¡K = 1/2/3/¡K
  1069. u4Byte SupportAbility;
  1070. // ODM PCIE/USB/SDIO = 1/2/3
  1071. u1Byte SupportInterface;
  1072. // ODM composite or independent. Bit oriented/ 92C+92D+ .... or any other type = 1/2/3/...
  1073. u4Byte SupportICType;
  1074. // Cut Version TestChip/A-cut/B-cut... = 0/1/2/3/...
  1075. u1Byte CutVersion;
  1076. // Fab Version TSMC/UMC = 0/1
  1077. u1Byte FabVersion;
  1078. // RF Type 4T4R/3T3R/2T2R/1T2R/1T1R/...
  1079. u1Byte RFType;
  1080. u1Byte RFEType;
  1081. // Board Type Normal/HighPower/MiniCard/SLIM/Combo/... = 0/1/2/3/4/...
  1082. u1Byte BoardType;
  1083. // with external LNA NO/Yes = 0/1
  1084. u1Byte ExtLNA;
  1085. u1Byte ExtLNA5G;
  1086. // with external PA NO/Yes = 0/1
  1087. u1Byte ExtPA;
  1088. u1Byte ExtPA5G;
  1089. // with external TRSW NO/Yes = 0/1
  1090. u1Byte ExtTRSW;
  1091. u1Byte PatchID; //Customer ID
  1092. BOOLEAN bInHctTest;
  1093. BOOLEAN bWIFITest;
  1094. BOOLEAN bDualMacSmartConcurrent;
  1095. u4Byte BK_SupportAbility;
  1096. u1Byte AntDivType;
  1097. //-----------HOOK BEFORE REG INIT-----------//
  1098. //
  1099. // Dynamic Value
  1100. //
  1101. //--------- POINTER REFERENCE-----------//
  1102. u1Byte u1Byte_temp;
  1103. BOOLEAN BOOLEAN_temp;
  1104. PADAPTER PADAPTER_temp;
  1105. // MAC PHY Mode SMSP/DMSP/DMDP = 0/1/2
  1106. u1Byte *pMacPhyMode;
  1107. //TX Unicast byte count
  1108. u8Byte *pNumTxBytesUnicast;
  1109. //RX Unicast byte count
  1110. u8Byte *pNumRxBytesUnicast;
  1111. // Wireless mode B/G/A/N = BIT0/BIT1/BIT2/BIT3
  1112. u1Byte *pWirelessMode; //ODM_WIRELESS_MODE_E
  1113. // Frequence band 2.4G/5G = 0/1
  1114. u1Byte *pBandType;
  1115. // Secondary channel offset don't_care/below/above = 0/1/2
  1116. u1Byte *pSecChOffset;
  1117. // Security mode Open/WEP/AES/TKIP = 0/1/2/3
  1118. u1Byte *pSecurity;
  1119. // BW info 20M/40M/80M = 0/1/2
  1120. u1Byte *pBandWidth;
  1121. // Central channel location Ch1/Ch2/....
  1122. u1Byte *pChannel; //central channel number
  1123. // Common info for 92D DMSP
  1124. BOOLEAN *pbGetValueFromOtherMac;
  1125. PADAPTER *pBuddyAdapter;
  1126. BOOLEAN *pbMasterOfDMSP; //MAC0: master, MAC1: slave
  1127. // Common info for Status
  1128. BOOLEAN *pbScanInProcess;
  1129. BOOLEAN *pbPowerSaving;
  1130. // CCA Path 2-path/path-A/path-B = 0/1/2; using ODM_CCA_PATH_E.
  1131. u1Byte *pOnePathCCA;
  1132. //pMgntInfo->AntennaTest
  1133. u1Byte *pAntennaTest;
  1134. BOOLEAN *pbNet_closed;
  1135. u1Byte *mp_mode;
  1136. //u1Byte *pAidMap;
  1137. //--------- POINTER REFERENCE-----------//
  1138. pu2Byte pForcedDataRate;
  1139. //------------CALL BY VALUE-------------//
  1140. BOOLEAN bLinkInProcess;
  1141. BOOLEAN bWIFI_Direct;
  1142. BOOLEAN bWIFI_Display;
  1143. BOOLEAN bLinked;
  1144. u1Byte RSSI_Min;
  1145. u1Byte InterfaceIndex; // Add for 92D dual MAC: 0--Mac0 1--Mac1
  1146. BOOLEAN bIsMPChip;
  1147. BOOLEAN bOneEntryOnly;
  1148. // Common info for BTDM
  1149. BOOLEAN bBtDisabled; // BT is disabled
  1150. BOOLEAN bBtConnectProcess; // BT HS is under connection progress.
  1151. u1Byte btHsRssi; // BT HS mode wifi rssi value.
  1152. BOOLEAN bBtHsOperation; // BT HS mode is under progress
  1153. BOOLEAN bBtDisableEdcaTurbo; // Under some condition, don't enable the EDCA Turbo
  1154. BOOLEAN bBtLimitedDig; // BT is busy.
  1155. //------------CALL BY VALUE-------------//
  1156. u1Byte RSSI_A;
  1157. u1Byte RSSI_B;
  1158. u8Byte RSSI_TRSW;
  1159. u8Byte RSSI_TRSW_H;
  1160. u8Byte RSSI_TRSW_L;
  1161. u8Byte RSSI_TRSW_iso;
  1162. u1Byte RxRate;
  1163. BOOLEAN StopDIG;
  1164. u1Byte TxRate;
  1165. u1Byte LinkedInterval;
  1166. u1Byte preChannel;
  1167. u1Byte AntType;
  1168. u4Byte TxagcOffsetValueA;
  1169. BOOLEAN IsTxagcOffsetPositiveA;
  1170. u4Byte TxagcOffsetValueB;
  1171. BOOLEAN IsTxagcOffsetPositiveB;
  1172. u8Byte lastTxOkCnt;
  1173. u8Byte lastRxOkCnt;
  1174. u4Byte BbSwingOffsetA;
  1175. BOOLEAN IsBbSwingOffsetPositiveA;
  1176. u4Byte BbSwingOffsetB;
  1177. BOOLEAN IsBbSwingOffsetPositiveB;
  1178. u4Byte TH_H;
  1179. u4Byte TH_L;
  1180. u4Byte IGI_Base;
  1181. u4Byte IGI_target;
  1182. BOOLEAN ForceEDCCA;
  1183. u1Byte AdapEn_RSSI;
  1184. BOOLEAN bForceThresh;
  1185. u4Byte Force_TH_H;
  1186. u4Byte Force_TH_L;
  1187. //2 Define STA info.
  1188. // _ODM_STA_INFO
  1189. // 2012/01/12 MH For MP, we need to reduce one array pointer for default port.??
  1190. PSTA_INFO_T pODM_StaInfo[ODM_ASSOCIATE_ENTRY_NUM];
  1191. #if (RATE_ADAPTIVE_SUPPORT == 1)
  1192. u2Byte CurrminRptTime;
  1193. ODM_RA_INFO_T RAInfo[ODM_ASSOCIATE_ENTRY_NUM]; //See HalMacID support
  1194. #endif
  1195. //
  1196. // 2012/02/14 MH Add to share 88E ra with other SW team.
  1197. // We need to colelct all support abilit to a proper area.
  1198. //
  1199. BOOLEAN RaSupport88E;
  1200. // Define ...........
  1201. // Latest packet phy info (ODM write)
  1202. ODM_PHY_DBG_INFO_T PhyDbgInfo;
  1203. //PHY_INFO_88E PhyInfo;
  1204. // Latest packet phy info (ODM write)
  1205. ODM_MAC_INFO *pMacInfo;
  1206. //MAC_INFO_88E MacInfo;
  1207. // Different Team independt structure??
  1208. //
  1209. //TX_RTP_CMN TX_retrpo;
  1210. //TX_RTP_88E TX_retrpo;
  1211. //TX_RTP_8195 TX_retrpo;
  1212. //
  1213. //ODM Structure
  1214. //
  1215. FAT_T DM_FatTable;
  1216. DIG_T DM_DigTable;
  1217. PS_T DM_PSTable;
  1218. Pri_CCA_T DM_PriCCA;
  1219. RXHP_T DM_RXHP_Table;
  1220. FALSE_ALARM_STATISTICS FalseAlmCnt;
  1221. FALSE_ALARM_STATISTICS FlaseAlmCntBuddyAdapter;
  1222. //#ifdef CONFIG_ANTENNA_DIVERSITY
  1223. SWAT_T DM_SWAT_Table;
  1224. BOOLEAN RSSI_test;
  1225. //#endif
  1226. #if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
  1227. //Path Div Struct
  1228. PATHDIV_PARA pathIQK;
  1229. #endif
  1230. EDCA_T DM_EDCA_Table;
  1231. u4Byte WMMEDCA_BE;
  1232. PATHDIV_T DM_PathDiv;
  1233. // Copy from SD4 structure
  1234. //
  1235. // ==================================================
  1236. //
  1237. //common
  1238. //u1Byte DM_Type;
  1239. //u1Byte PSD_Report_RXHP[80]; // Add By Gary
  1240. //u1Byte PSD_func_flag; // Add By Gary
  1241. //for DIG
  1242. //u1Byte bDMInitialGainEnable;
  1243. //u1Byte binitialized; // for dm_initial_gain_Multi_STA use.
  1244. //for Antenna diversity
  1245. //u8 AntDivCfg;// 0:OFF , 1:ON, 2:by efuse
  1246. //PSTA_INFO_T RSSI_target;
  1247. BOOLEAN *pbDriverStopped;
  1248. BOOLEAN *pbDriverIsGoingToPnpSetPowerSleep;
  1249. BOOLEAN *pinit_adpt_in_progress;
  1250. //PSD
  1251. BOOLEAN bUserAssignLevel;
  1252. RT_TIMER PSDTimer;
  1253. u1Byte RSSI_BT; //come from BT
  1254. BOOLEAN bPSDinProcess;
  1255. BOOLEAN bPSDactive;
  1256. BOOLEAN bDMInitialGainEnable;
  1257. //MPT DIG
  1258. RT_TIMER MPT_DIGTimer;
  1259. //for rate adaptive, in fact, 88c/92c fw will handle this
  1260. u1Byte bUseRAMask;
  1261. ODM_RATE_ADAPTIVE RateAdaptive;
  1262. ANT_DETECTED_INFO AntDetectedInfo; // Antenna detected information for RSSI tool
  1263. ODM_RF_CAL_T RFCalibrateInfo;
  1264. //
  1265. // TX power tracking
  1266. //
  1267. u1Byte BbSwingIdxOfdm[MAX_RF_PATH];
  1268. u1Byte BbSwingIdxOfdmCurrent;
  1269. u1Byte BbSwingIdxOfdmBase[MAX_RF_PATH];
  1270. BOOLEAN BbSwingFlagOfdm;
  1271. u1Byte BbSwingIdxCck;
  1272. u1Byte BbSwingIdxCckCurrent;
  1273. u1Byte BbSwingIdxCckBase;
  1274. u1Byte DefaultOfdmIndex;
  1275. u1Byte DefaultCckIndex;
  1276. BOOLEAN BbSwingFlagCck;
  1277. s1Byte Aboslute_OFDMSwingIdx[MAX_RF_PATH];
  1278. s1Byte Remnant_OFDMSwingIdx[MAX_RF_PATH];
  1279. s1Byte Remnant_CCKSwingIdx;
  1280. s1Byte Modify_TxAGC_Value; //Remnat compensate value at TxAGC
  1281. BOOLEAN Modify_TxAGC_Flag_PathA;
  1282. BOOLEAN Modify_TxAGC_Flag_PathB;
  1283. //
  1284. // Dynamic ATC switch
  1285. //
  1286. BOOLEAN bATCStatus;
  1287. BOOLEAN largeCFOHit;
  1288. BOOLEAN bIsfreeze;
  1289. int CFO_tail[2];
  1290. int CFO_ave_pre;
  1291. int CrystalCap;
  1292. u1Byte CFOThreshold;
  1293. u4Byte packetCount;
  1294. u4Byte packetCount_pre;
  1295. //
  1296. // ODM system resource.
  1297. //
  1298. // ODM relative time.
  1299. RT_TIMER PathDivSwitchTimer;
  1300. //2011.09.27 add for Path Diversity
  1301. RT_TIMER CCKPathDiversityTimer;
  1302. RT_TIMER FastAntTrainingTimer;
  1303. // ODM relative workitem.
  1304. #if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
  1305. #if USE_WORKITEM
  1306. RT_WORK_ITEM PathDivSwitchWorkitem;
  1307. RT_WORK_ITEM CCKPathDiversityWorkitem;
  1308. RT_WORK_ITEM FastAntTrainingWorkitem;
  1309. RT_WORK_ITEM MPT_DIGWorkitem;
  1310. RT_WORK_ITEM RaRptWorkitem;
  1311. #endif
  1312. #endif
  1313. #if(DM_ODM_SUPPORT_TYPE & ODM_WIN)
  1314. #if (RT_PLATFORM != PLATFORM_LINUX)
  1315. } DM_ODM_T, *PDM_ODM_T; // DM_Dynamic_Mechanism_Structure
  1316. #else
  1317. };
  1318. #endif
  1319. #else// for AP,ADSL,CE Team
  1320. } DM_ODM_T, *PDM_ODM_T; // DM_Dynamic_Mechanism_Structure
  1321. #endif
  1322. #if 1 //92c-series
  1323. #define ODM_RF_PATH_MAX 2
  1324. #else //jaguar - series
  1325. #define ODM_RF_PATH_MAX 4
  1326. #endif
  1327. typedef enum _ODM_RF_RADIO_PATH {
  1328. ODM_RF_PATH_A = 0, //Radio Path A
  1329. ODM_RF_PATH_B = 1, //Radio Path B
  1330. ODM_RF_PATH_C = 2, //Radio Path C
  1331. ODM_RF_PATH_D = 3, //Radio Path D
  1332. // ODM_RF_PATH_MAX, //Max RF number 90 support
  1333. } ODM_RF_RADIO_PATH_E, *PODM_RF_RADIO_PATH_E;
  1334. typedef enum _ODM_RF_CONTENT{
  1335. odm_radioa_txt = 0x1000,
  1336. odm_radiob_txt = 0x1001,
  1337. odm_radioc_txt = 0x1002,
  1338. odm_radiod_txt = 0x1003
  1339. } ODM_RF_CONTENT;
  1340. typedef enum _ODM_BB_Config_Type{
  1341. CONFIG_BB_PHY_REG,
  1342. CONFIG_BB_AGC_TAB,
  1343. CONFIG_BB_AGC_TAB_2G,
  1344. CONFIG_BB_AGC_TAB_5G,
  1345. CONFIG_BB_PHY_REG_PG,
  1346. CONFIG_BB_PHY_REG_MP,
  1347. } ODM_BB_Config_Type, *PODM_BB_Config_Type;
  1348. typedef enum _ODM_RF_Config_Type{
  1349. CONFIG_RF_RADIO,
  1350. CONFIG_RF_TXPWR_LMT,
  1351. } ODM_RF_Config_Type, *PODM_RF_Config_Type;
  1352. typedef enum _ODM_FW_Config_Type{
  1353. CONFIG_FW_NIC,
  1354. CONFIG_FW_NIC_2,
  1355. CONFIG_FW_AP,
  1356. CONFIG_FW_MP,
  1357. CONFIG_FW_WoWLAN,
  1358. CONFIG_FW_WoWLAN_2,
  1359. CONFIG_FW_BT,
  1360. } ODM_FW_Config_Type;
  1361. // Status code
  1362. #if (DM_ODM_SUPPORT_TYPE != ODM_WIN)
  1363. typedef enum _RT_STATUS{
  1364. RT_STATUS_SUCCESS,
  1365. RT_STATUS_FAILURE,
  1366. RT_STATUS_PENDING,
  1367. RT_STATUS_RESOURCE,
  1368. RT_STATUS_INVALID_CONTEXT,
  1369. RT_STATUS_INVALID_PARAMETER,
  1370. RT_STATUS_NOT_SUPPORT,
  1371. RT_STATUS_OS_API_FAILED,
  1372. }RT_STATUS,*PRT_STATUS;
  1373. #endif // end of RT_STATUS definition
  1374. #ifdef REMOVE_PACK
  1375. #pragma pack()
  1376. #endif
  1377. //#include "odm_function.h"
  1378. //3===========================================================
  1379. //3 DIG
  1380. //3===========================================================
  1381. typedef enum tag_Dynamic_Init_Gain_Operation_Type_Definition
  1382. {
  1383. DIG_TYPE_THRESH_HIGH = 0,
  1384. DIG_TYPE_THRESH_LOW = 1,
  1385. DIG_TYPE_BACKOFF = 2,
  1386. DIG_TYPE_RX_GAIN_MIN = 3,
  1387. DIG_TYPE_RX_GAIN_MAX = 4,
  1388. DIG_TYPE_ENABLE = 5,
  1389. DIG_TYPE_DISABLE = 6,
  1390. DIG_OP_TYPE_MAX
  1391. }DM_DIG_OP_E;
  1392. /*
  1393. typedef enum tag_CCK_Packet_Detection_Threshold_Type_Definition
  1394. {
  1395. CCK_PD_STAGE_LowRssi = 0,
  1396. CCK_PD_STAGE_HighRssi = 1,
  1397. CCK_PD_STAGE_MAX = 3,
  1398. }DM_CCK_PDTH_E;
  1399. typedef enum tag_DIG_EXT_PORT_ALGO_Definition
  1400. {
  1401. DIG_EXT_PORT_STAGE_0 = 0,
  1402. DIG_EXT_PORT_STAGE_1 = 1,
  1403. DIG_EXT_PORT_STAGE_2 = 2,
  1404. DIG_EXT_PORT_STAGE_3 = 3,
  1405. DIG_EXT_PORT_STAGE_MAX = 4,
  1406. }DM_DIG_EXT_PORT_ALG_E;
  1407. typedef enum tag_DIG_Connect_Definition
  1408. {
  1409. DIG_STA_DISCONNECT = 0,
  1410. DIG_STA_CONNECT = 1,
  1411. DIG_STA_BEFORE_CONNECT = 2,
  1412. DIG_MultiSTA_DISCONNECT = 3,
  1413. DIG_MultiSTA_CONNECT = 4,
  1414. DIG_CONNECT_MAX
  1415. }DM_DIG_CONNECT_E;
  1416. #define DM_MultiSTA_InitGainChangeNotify(Event) {DM_DigTable.CurMultiSTAConnectState = Event;}
  1417. #define DM_MultiSTA_InitGainChangeNotify_CONNECT(_ADAPTER) \
  1418. DM_MultiSTA_InitGainChangeNotify(DIG_MultiSTA_CONNECT)
  1419. #define DM_MultiSTA_InitGainChangeNotify_DISCONNECT(_ADAPTER) \
  1420. DM_MultiSTA_InitGainChangeNotify(DIG_MultiSTA_DISCONNECT)
  1421. */
  1422. #define DM_DIG_THRESH_HIGH 40
  1423. #define DM_DIG_THRESH_LOW 35
  1424. #define DM_FALSEALARM_THRESH_LOW 400
  1425. #define DM_FALSEALARM_THRESH_HIGH 1000
  1426. #define DM_DIG_MAX_NIC 0x3e
  1427. #define DM_DIG_MIN_NIC 0x1e //0x22//0x1c
  1428. #define DM_DIG_MAX_AP 0x32
  1429. #define DM_DIG_MIN_AP 0x20
  1430. #define DM_DIG_MAX_NIC_HP 0x46
  1431. #define DM_DIG_MIN_NIC_HP 0x2e
  1432. #define DM_DIG_MAX_AP_HP 0x42
  1433. #define DM_DIG_MIN_AP_HP 0x30
  1434. //vivi 92c&92d has different definition, 20110504
  1435. //this is for 92c
  1436. #ifdef CONFIG_SPECIAL_SETTING_FOR_FUNAI_TV
  1437. #define DM_DIG_FA_TH0 0x80//0x20
  1438. #else
  1439. #define DM_DIG_FA_TH0 0x200//0x20
  1440. #endif
  1441. #define DM_DIG_FA_TH1 0x300//0x100
  1442. #define DM_DIG_FA_TH2 0x400//0x200
  1443. //this is for 92d
  1444. #define DM_DIG_FA_TH0_92D 0x100
  1445. #define DM_DIG_FA_TH1_92D 0x400
  1446. #define DM_DIG_FA_TH2_92D 0x600
  1447. #define DM_DIG_BACKOFF_MAX 12
  1448. #define DM_DIG_BACKOFF_MIN -4
  1449. #define DM_DIG_BACKOFF_DEFAULT 10
  1450. //3===========================================================
  1451. //3 AGC RX High Power Mode
  1452. //3===========================================================
  1453. #define LNA_Low_Gain_1 0x64
  1454. #define LNA_Low_Gain_2 0x5A
  1455. #define LNA_Low_Gain_3 0x58
  1456. #define FA_RXHP_TH1 5000
  1457. #define FA_RXHP_TH2 1500
  1458. #define FA_RXHP_TH3 800
  1459. #define FA_RXHP_TH4 600
  1460. #define FA_RXHP_TH5 500
  1461. //3===========================================================
  1462. //3 EDCA
  1463. //3===========================================================
  1464. //3===========================================================
  1465. //3 Dynamic Tx Power
  1466. //3===========================================================
  1467. //Dynamic Tx Power Control Threshold
  1468. #define TX_POWER_NEAR_FIELD_THRESH_LVL2 74
  1469. #define TX_POWER_NEAR_FIELD_THRESH_LVL1 67
  1470. #define TX_POWER_NEAR_FIELD_THRESH_AP 0x3F
  1471. #define TxHighPwrLevel_Normal 0
  1472. #define TxHighPwrLevel_Level1 1
  1473. #define TxHighPwrLevel_Level2 2
  1474. #define TxHighPwrLevel_BT1 3
  1475. #define TxHighPwrLevel_BT2 4
  1476. #define TxHighPwrLevel_15 5
  1477. #define TxHighPwrLevel_35 6
  1478. #define TxHighPwrLevel_50 7
  1479. #define TxHighPwrLevel_70 8
  1480. #define TxHighPwrLevel_100 9
  1481. //3===========================================================
  1482. //3 Tx Power Tracking
  1483. //3===========================================================
  1484. #if 0 //mask this, since these have been defined in typdef.h, vivi
  1485. #define OFDM_TABLE_SIZE 37
  1486. #define OFDM_TABLE_SIZE_92D 43
  1487. #define CCK_TABLE_SIZE 33
  1488. #endif
  1489. //3===========================================================
  1490. //3 Rate Adaptive
  1491. //3===========================================================
  1492. #define DM_RATR_STA_INIT 0
  1493. #define DM_RATR_STA_HIGH 1
  1494. #define DM_RATR_STA_MIDDLE 2
  1495. #define DM_RATR_STA_LOW 3
  1496. //3===========================================================
  1497. //3 BB Power Save
  1498. //3===========================================================
  1499. //3===========================================================
  1500. //3 Dynamic ATC switch
  1501. //3===========================================================
  1502. #define ATC_Status_Off 0x0 // enable
  1503. #define ATC_Status_On 0x1 // disable
  1504. #define CFO_Threshold_Xtal 10 // kHz
  1505. #define CFO_Threshold_ATC 80 // kHz
  1506. typedef enum tag_1R_CCA_Type_Definition
  1507. {
  1508. CCA_1R =0,
  1509. CCA_2R = 1,
  1510. CCA_MAX = 2,
  1511. }DM_1R_CCA_E;
  1512. typedef enum tag_RF_Type_Definition
  1513. {
  1514. RF_Save =0,
  1515. RF_Normal = 1,
  1516. RF_MAX = 2,
  1517. }DM_RF_E;
  1518. //3===========================================================
  1519. //3 Antenna Diversity
  1520. //3===========================================================
  1521. typedef enum tag_SW_Antenna_Switch_Definition
  1522. {
  1523. Antenna_A = 1,
  1524. Antenna_B = 2,
  1525. Antenna_MAX = 3,
  1526. }DM_SWAS_E;
  1527. // Maximal number of antenna detection mechanism needs to perform, added by Roger, 2011.12.28.
  1528. #define MAX_ANTENNA_DETECTION_CNT 10
  1529. //
  1530. // Extern Global Variables.
  1531. //
  1532. extern u4Byte OFDMSwingTable[OFDM_TABLE_SIZE_92D];
  1533. extern u1Byte CCKSwingTable_Ch1_Ch13[CCK_TABLE_SIZE][8];
  1534. extern u1Byte CCKSwingTable_Ch14 [CCK_TABLE_SIZE][8];
  1535. extern u4Byte OFDMSwingTable_New[OFDM_TABLE_SIZE_92D];
  1536. extern u1Byte CCKSwingTable_Ch1_Ch13_New[CCK_TABLE_SIZE][8];
  1537. extern u1Byte CCKSwingTable_Ch14_New [CCK_TABLE_SIZE][8];
  1538. extern u4Byte TxScalingTable_Jaguar[TXSCALE_TABLE_SIZE];
  1539. // <20121018, Kordan> In case fail to read TxPowerTrack.txt, we use the table of 88E as the default table.
  1540. static u1Byte DeltaSwingTableIdx_2GA_P_8188E[] = {0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 7, 7, 8, 8, 8, 9, 9, 9, 9, 9};
  1541. static u1Byte DeltaSwingTableIdx_2GA_N_8188E[] = {0, 0, 0, 2, 2, 3, 3, 4, 4, 4, 4, 5, 5, 6, 6, 7, 7, 7, 7, 8, 8, 9, 9, 10, 10, 10, 11, 11, 11, 11};
  1542. //
  1543. // check Sta pointer valid or not
  1544. //
  1545. #if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
  1546. #define IS_STA_VALID(pSta) (pSta && pSta->expire_to)
  1547. #elif (DM_ODM_SUPPORT_TYPE & ODM_WIN)
  1548. #define IS_STA_VALID(pSta) (pSta && pSta->bUsed)
  1549. #else
  1550. #define IS_STA_VALID(pSta) (pSta)
  1551. #endif
  1552. // 20100514 Joseph: Add definition for antenna switching test after link.
  1553. // This indicates two different the steps.
  1554. // In SWAW_STEP_PEAK, driver needs to switch antenna and listen to the signal on the air.
  1555. // In SWAW_STEP_DETERMINE, driver just compares the signal captured in SWAW_STEP_PEAK
  1556. // with original RSSI to determine if it is necessary to switch antenna.
  1557. #define SWAW_STEP_PEAK 0
  1558. #define SWAW_STEP_DETERMINE 1
  1559. VOID ODM_Write_DIG(IN PDM_ODM_T pDM_Odm, IN u1Byte CurrentIGI);
  1560. VOID ODM_Write_CCK_CCA_Thres(IN PDM_ODM_T pDM_Odm, IN u1Byte CurCCK_CCAThres);
  1561. VOID
  1562. ODM_SetAntenna(
  1563. IN PDM_ODM_T pDM_Odm,
  1564. IN u1Byte Antenna);
  1565. #define dm_RF_Saving ODM_RF_Saving
  1566. void ODM_RF_Saving( IN PDM_ODM_T pDM_Odm,
  1567. IN u1Byte bForceInNormal );
  1568. #define SwAntDivRestAfterLink ODM_SwAntDivRestAfterLink
  1569. VOID ODM_SwAntDivRestAfterLink( IN PDM_ODM_T pDM_Odm);
  1570. #define dm_CheckTXPowerTracking ODM_TXPowerTrackingCheck
  1571. VOID
  1572. ODM_TXPowerTrackingCheck(
  1573. IN PDM_ODM_T pDM_Odm
  1574. );
  1575. BOOLEAN
  1576. ODM_RAStateCheck(
  1577. IN PDM_ODM_T pDM_Odm,
  1578. IN s4Byte RSSI,
  1579. IN BOOLEAN bForceUpdate,
  1580. OUT pu1Byte pRATRState
  1581. );
  1582. #if(DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_AP|ODM_ADSL))
  1583. //============================================================
  1584. // function prototype
  1585. //============================================================
  1586. //#define DM_ChangeDynamicInitGainThresh ODM_ChangeDynamicInitGainThresh
  1587. //void ODM_ChangeDynamicInitGainThresh(IN PADAPTER pAdapter,
  1588. // IN INT32 DM_Type,
  1589. // IN INT32 DM_Value);
  1590. VOID
  1591. ODM_ChangeDynamicInitGainThresh(
  1592. IN PDM_ODM_T pDM_Odm,
  1593. IN u4Byte DM_Type,
  1594. IN u4Byte DM_Value
  1595. );
  1596. BOOLEAN
  1597. ODM_CheckPowerStatus(
  1598. IN PADAPTER Adapter
  1599. );
  1600. #if (DM_ODM_SUPPORT_TYPE != ODM_ADSL)
  1601. VOID
  1602. ODM_RateAdaptiveStateApInit(
  1603. IN PADAPTER Adapter ,
  1604. IN PRT_WLAN_STA pEntry
  1605. );
  1606. #endif
  1607. #define AP_InitRateAdaptiveState ODM_RateAdaptiveStateApInit
  1608. #if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
  1609. #ifdef WIFI_WMM
  1610. VOID
  1611. ODM_IotEdcaSwitch(
  1612. IN PDM_ODM_T pDM_Odm,
  1613. IN unsigned char enable
  1614. );
  1615. #endif
  1616. BOOLEAN
  1617. ODM_ChooseIotMainSTA(
  1618. IN PDM_ODM_T pDM_Odm,
  1619. IN PSTA_INFO_T pstat
  1620. );
  1621. #endif
  1622. #if(DM_ODM_SUPPORT_TYPE==ODM_AP)
  1623. #ifdef HW_ANT_SWITCH
  1624. u1Byte
  1625. ODM_Diversity_AntennaSelect(
  1626. IN PDM_ODM_T pDM_Odm,
  1627. IN u1Byte *data
  1628. );
  1629. #endif
  1630. #endif
  1631. #define SwAntDivResetBeforeLink ODM_SwAntDivResetBeforeLink
  1632. VOID ODM_SwAntDivResetBeforeLink(IN PDM_ODM_T pDM_Odm);
  1633. //#define SwAntDivCheckBeforeLink8192C ODM_SwAntDivCheckBeforeLink8192C
  1634. #define SwAntDivCheckBeforeLink ODM_SwAntDivCheckBeforeLink8192C
  1635. BOOLEAN
  1636. ODM_SwAntDivCheckBeforeLink8192C(
  1637. IN PDM_ODM_T pDM_Odm
  1638. );
  1639. #endif
  1640. #define dm_SWAW_RSSI_Check ODM_SwAntDivChkPerPktRssi
  1641. VOID ODM_SwAntDivChkPerPktRssi(
  1642. IN PDM_ODM_T pDM_Odm,
  1643. IN u1Byte StationID,
  1644. IN PODM_PHY_INFO_T pPhyInfo
  1645. );
  1646. #if((DM_ODM_SUPPORT_TYPE==ODM_WIN)||(DM_ODM_SUPPORT_TYPE==ODM_CE))
  1647. u4Byte ConvertTo_dB(u4Byte Value);
  1648. u4Byte
  1649. GetPSDData(
  1650. PDM_ODM_T pDM_Odm,
  1651. unsigned int point,
  1652. u1Byte initial_gain_psd);
  1653. #endif
  1654. #if (DM_ODM_SUPPORT_TYPE == ODM_CE)
  1655. VOID
  1656. odm_DIGbyRSSI_LPS(
  1657. IN PDM_ODM_T pDM_Odm
  1658. );
  1659. u4Byte ODM_Get_Rate_Bitmap(
  1660. IN PDM_ODM_T pDM_Odm,
  1661. IN u4Byte macid,
  1662. IN u4Byte ra_mask,
  1663. IN u1Byte rssi_level);
  1664. #endif
  1665. #if(DM_ODM_SUPPORT_TYPE & (ODM_WIN))
  1666. #define dm_PSDMonitorCallback odm_PSDMonitorCallback
  1667. VOID odm_PSDMonitorCallback(PRT_TIMER pTimer);
  1668. VOID
  1669. odm_PSDMonitorWorkItemCallback(
  1670. IN PVOID pContext
  1671. );
  1672. VOID
  1673. ODM_MPT_DIG(
  1674. IN PDM_ODM_T pDM_Odm
  1675. );
  1676. VOID
  1677. PatchDCTone(
  1678. IN PDM_ODM_T pDM_Odm,
  1679. pu4Byte PSD_report,
  1680. u1Byte initial_gain_psd
  1681. );
  1682. VOID
  1683. ODM_PSDMonitor(
  1684. IN PDM_ODM_T pDM_Odm
  1685. );
  1686. VOID odm_PSD_Monitor(PDM_ODM_T pDM_Odm);
  1687. VOID odm_PSDMonitorInit(PDM_ODM_T pDM_Odm);
  1688. VOID
  1689. ODM_PSDDbgControl(
  1690. IN PADAPTER Adapter,
  1691. IN u4Byte mode,
  1692. IN u4Byte btRssi
  1693. );
  1694. #endif // DM_ODM_SUPPORT_TYPE
  1695. #if (BEAMFORMING_SUPPORT == 1)
  1696. BEAMFORMING_CAP
  1697. Beamforming_GetEntryBeamCapByMacId(
  1698. IN PMGNT_INFO pMgntInfo,
  1699. IN u1Byte MacId
  1700. );
  1701. #endif
  1702. VOID ODM_DMInit( IN PDM_ODM_T pDM_Odm);
  1703. VOID
  1704. ODM_DMWatchdog(
  1705. IN PDM_ODM_T pDM_Odm // For common use in the future
  1706. );
  1707. VOID
  1708. ODM_CmnInfoInit(
  1709. IN PDM_ODM_T pDM_Odm,
  1710. IN ODM_CMNINFO_E CmnInfo,
  1711. IN u4Byte Value
  1712. );
  1713. VOID
  1714. ODM_CmnInfoHook(
  1715. IN PDM_ODM_T pDM_Odm,
  1716. IN ODM_CMNINFO_E CmnInfo,
  1717. IN PVOID pValue
  1718. );
  1719. VOID
  1720. ODM_CmnInfoPtrArrayHook(
  1721. IN PDM_ODM_T pDM_Odm,
  1722. IN ODM_CMNINFO_E CmnInfo,
  1723. IN u2Byte Index,
  1724. IN PVOID pValue
  1725. );
  1726. VOID
  1727. ODM_CmnInfoUpdate(
  1728. IN PDM_ODM_T pDM_Odm,
  1729. IN u4Byte CmnInfo,
  1730. IN u8Byte Value
  1731. );
  1732. VOID
  1733. ODM_InitAllTimers(
  1734. IN PDM_ODM_T pDM_Odm
  1735. );
  1736. VOID
  1737. ODM_CancelAllTimers(
  1738. IN PDM_ODM_T pDM_Odm
  1739. );
  1740. VOID
  1741. ODM_ReleaseAllTimers(
  1742. IN PDM_ODM_T pDM_Odm
  1743. );
  1744. VOID
  1745. ODM_ResetIQKResult(
  1746. IN PDM_ODM_T pDM_Odm
  1747. );
  1748. #if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
  1749. VOID ODM_InitAllWorkItems(IN PDM_ODM_T pDM_Odm );
  1750. VOID ODM_FreeAllWorkItems(IN PDM_ODM_T pDM_Odm );
  1751. VOID odm_PathDivChkAntSwitch(PDM_ODM_T pDM_Odm);
  1752. VOID ODM_PathDivRestAfterLink(
  1753. IN PDM_ODM_T pDM_Odm
  1754. );
  1755. //===========================================//
  1756. // Neil Chen----2011--06--15--
  1757. //3 Path Diversity
  1758. //===========================================================
  1759. #define TP_MODE 0
  1760. #define RSSI_MODE 1
  1761. #define TRAFFIC_LOW 0
  1762. #define TRAFFIC_HIGH 1
  1763. //#define PATHDIV_ENABLE 1
  1764. //VOID odm_PathDivChkAntSwitch(PADAPTER Adapter,u1Byte Step);
  1765. VOID ODM_PathDivRestAfterLink(
  1766. IN PDM_ODM_T pDM_Odm
  1767. );
  1768. #define dm_PathDiv_RSSI_Check ODM_PathDivChkPerPktRssi
  1769. VOID ODM_PathDivChkPerPktRssi(PADAPTER Adapter,
  1770. BOOLEAN bIsDefPort,
  1771. BOOLEAN bMatchBSSID,
  1772. PRT_WLAN_STA pEntry,
  1773. PRT_RFD pRfd );
  1774. u8Byte
  1775. PlatformDivision64(
  1776. IN u8Byte x,
  1777. IN u8Byte y
  1778. );
  1779. // 20100514 Joseph: Add definition for antenna switching test after link.
  1780. // This indicates two different the steps.
  1781. // In SWAW_STEP_PEAK, driver needs to switch antenna and listen to the signal on the air.
  1782. // In SWAW_STEP_DETERMINE, driver just compares the signal captured in SWAW_STEP_PEAK
  1783. // with original RSSI to determine if it is necessary to switch antenna.
  1784. #define SWAW_STEP_PEAK 0
  1785. #define SWAW_STEP_DETERMINE 1
  1786. //====================================================
  1787. //3 PathDiV End
  1788. //====================================================
  1789. #define PathDivCheckBeforeLink8192C ODM_PathDiversityBeforeLink92C
  1790. BOOLEAN
  1791. ODM_PathDiversityBeforeLink92C(
  1792. //IN PADAPTER Adapter
  1793. IN PDM_ODM_T pDM_Odm
  1794. );
  1795. #define DM_ChangeDynamicInitGainThresh ODM_ChangeDynamicInitGainThresh
  1796. //void ODM_ChangeDynamicInitGainThresh(IN PADAPTER pAdapter,
  1797. // IN INT32 DM_Type,
  1798. // IN INT32 DM_Value);
  1799. //
  1800. VOID
  1801. ODM_CCKPathDiversityChkPerPktRssi(
  1802. PADAPTER Adapter,
  1803. BOOLEAN bIsDefPort,
  1804. BOOLEAN bMatchBSSID,
  1805. PRT_WLAN_STA pEntry,
  1806. PRT_RFD pRfd,
  1807. pu1Byte pDesc
  1808. );
  1809. typedef enum tag_DIG_Connect_Definition
  1810. {
  1811. DIG_STA_DISCONNECT = 0,
  1812. DIG_STA_CONNECT = 1,
  1813. DIG_STA_BEFORE_CONNECT = 2,
  1814. DIG_MultiSTA_DISCONNECT = 3,
  1815. DIG_MultiSTA_CONNECT = 4,
  1816. DIG_CONNECT_MAX
  1817. }DM_DIG_CONNECT_E;
  1818. VOID
  1819. ODM_FillTXPathInTXDESC(
  1820. IN PADAPTER Adapter,
  1821. IN PRT_TCB pTcb,
  1822. IN pu1Byte pDesc
  1823. );
  1824. #define dm_SWAW_RSSI_Check ODM_SwAntDivChkPerPktRssi
  1825. //
  1826. // 2012/01/12 MH Check afapter status. Temp fix BSOD.
  1827. //
  1828. #define HAL_ADAPTER_STS_CHK(pDM_Odm)\
  1829. if (pDM_Odm->Adapter == NULL)\
  1830. {\
  1831. return;\
  1832. }\
  1833. //
  1834. // For new definition in MP temporarily fro power tracking,
  1835. //
  1836. #define odm_TXPowerTrackingDirectCall(_Adapter) \
  1837. IS_HARDWARE_TYPE_8192D(_Adapter) ? odm_TXPowerTrackingCallback_ThermalMeter_92D(_Adapter) : \
  1838. IS_HARDWARE_TYPE_8192C(_Adapter) ? odm_TXPowerTrackingCallback_ThermalMeter_92C(_Adapter) : \
  1839. IS_HARDWARE_TYPE_8723A(_Adapter) ? odm_TXPowerTrackingCallback_ThermalMeter_8723A(_Adapter) :\
  1840. ODM_TXPowerTrackingCallback_ThermalMeter(_Adapter)
  1841. VOID
  1842. ODM_SetTxAntByTxInfo_88C_92D(
  1843. IN PDM_ODM_T pDM_Odm,
  1844. IN pu1Byte pDesc,
  1845. IN u1Byte macId
  1846. );
  1847. #endif // #if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
  1848. VOID
  1849. ODM_AntselStatistics_88C(
  1850. IN PDM_ODM_T pDM_Odm,
  1851. IN u1Byte MacId,
  1852. IN u4Byte PWDBAll,
  1853. IN BOOLEAN isCCKrate
  1854. );
  1855. #if( DM_ODM_SUPPORT_TYPE & (ODM_WIN |ODM_CE))
  1856. VOID
  1857. ODM_SingleDualAntennaDefaultSetting(
  1858. IN PDM_ODM_T pDM_Odm
  1859. );
  1860. BOOLEAN
  1861. ODM_SingleDualAntennaDetection(
  1862. IN PDM_ODM_T pDM_Odm,
  1863. IN u1Byte mode
  1864. );
  1865. #endif // #if((DM_ODM_SUPPORT_TYPE==ODM_WIN)||(DM_ODM_SUPPORT_TYPE==ODM_CE))
  1866. VOID
  1867. ODM_UpdateInitRate(
  1868. IN PDM_ODM_T pDM_Odm,
  1869. IN u1Byte Rate
  1870. );
  1871. #if (DM_ODM_SUPPORT_TYPE == ODM_CE)
  1872. void odm_dtc(PDM_ODM_T pDM_Odm);
  1873. #endif /* #if (DM_ODM_SUPPORT_TYPE == ODM_CE) */
  1874. #endif