1 //============================================================
\r
4 // This file is for RTL8723A Co-exist mechanism
\r
7 // 2012/08/22 Cosa first check in.
\r
8 // 2012/11/14 Cosa Revise for 8723A 2Ant out sourcing.
\r
10 //============================================================
\r
12 //============================================================
\r
14 //============================================================
\r
15 #include "Mp_Precomp.h"
\r
17 #if WPP_SOFTWARE_TRACE
\r
18 #include "HalBtc8723a2Ant.tmh"
\r
21 #if(BT_30_SUPPORT == 1)
\r
22 //============================================================
\r
23 // Global variables, these are static variables
\r
24 //============================================================
\r
25 static COEX_DM_8723A_2ANT GLCoexDm8723a2Ant;
\r
26 static PCOEX_DM_8723A_2ANT pCoexDm=&GLCoexDm8723a2Ant;
\r
27 static COEX_STA_8723A_2ANT GLCoexSta8723a2Ant;
\r
28 static PCOEX_STA_8723A_2ANT pCoexSta=&GLCoexSta8723a2Ant;
\r
30 const char *const GLBtInfoSrc8723a2Ant[]={
\r
33 "BT Info[bt auto report]",
\r
36 //============================================================
\r
37 // local function proto type if needed
\r
38 //============================================================
\r
39 //============================================================
\r
40 // local function start with halbtc8723a2ant_
\r
41 //============================================================
\r
43 halbtc8723a2ant_IsWifiIdle(
\r
44 IN PBTC_COEXIST pBtCoexist
\r
47 BOOLEAN bWifiConnected=FALSE, bScan=FALSE, bLink=FALSE, bRoam=FALSE;
\r
49 pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
\r
50 pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_SCAN, &bScan);
\r
51 pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_LINK, &bLink);
\r
52 pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_ROAM, &bRoam);
\r
67 halbtc8723a2ant_IsWifiConnectedIdle(
\r
68 IN PBTC_COEXIST pBtCoexist
\r
71 BOOLEAN bWifiConnected=FALSE, bScan=FALSE, bLink=FALSE, bRoam=FALSE, bWifiBusy=FALSE;
\r
73 pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
\r
74 pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_SCAN, &bScan);
\r
75 pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_LINK, &bLink);
\r
76 pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_ROAM, &bRoam);
\r
77 pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy);
\r
85 if(bWifiConnected && !bWifiBusy)
\r
92 halbtc8723a2ant_BtRssiState(
\r
99 u1Byte btRssiState=pCoexSta->preBtRssiState;
\r
101 btRssi = pCoexSta->btRssi;
\r
105 if( (pCoexSta->preBtRssiState == BTC_RSSI_STATE_LOW) ||
\r
106 (pCoexSta->preBtRssiState == BTC_RSSI_STATE_STAY_LOW))
\r
108 if(btRssi >= (rssiThresh+BTC_RSSI_COEX_THRESH_TOL_8723A_2ANT))
\r
110 btRssiState = BTC_RSSI_STATE_HIGH;
\r
114 btRssiState = BTC_RSSI_STATE_STAY_LOW;
\r
119 if(btRssi < rssiThresh)
\r
121 btRssiState = BTC_RSSI_STATE_LOW;
\r
125 btRssiState = BTC_RSSI_STATE_STAY_HIGH;
\r
129 else if(levelNum == 3)
\r
131 if(rssiThresh > rssiThresh1)
\r
133 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], BT Rssi thresh error!!\n"));
\r
134 return pCoexSta->preBtRssiState;
\r
137 if( (pCoexSta->preBtRssiState == BTC_RSSI_STATE_LOW) ||
\r
138 (pCoexSta->preBtRssiState == BTC_RSSI_STATE_STAY_LOW))
\r
140 if(btRssi >= (rssiThresh+BTC_RSSI_COEX_THRESH_TOL_8723A_2ANT))
\r
142 btRssiState = BTC_RSSI_STATE_MEDIUM;
\r
146 btRssiState = BTC_RSSI_STATE_STAY_LOW;
\r
149 else if( (pCoexSta->preBtRssiState == BTC_RSSI_STATE_MEDIUM) ||
\r
150 (pCoexSta->preBtRssiState == BTC_RSSI_STATE_STAY_MEDIUM))
\r
152 if(btRssi >= (rssiThresh1+BTC_RSSI_COEX_THRESH_TOL_8723A_2ANT))
\r
154 btRssiState = BTC_RSSI_STATE_HIGH;
\r
156 else if(btRssi < rssiThresh)
\r
158 btRssiState = BTC_RSSI_STATE_LOW;
\r
162 btRssiState = BTC_RSSI_STATE_STAY_MEDIUM;
\r
167 if(btRssi < rssiThresh1)
\r
169 btRssiState = BTC_RSSI_STATE_MEDIUM;
\r
173 btRssiState = BTC_RSSI_STATE_STAY_HIGH;
\r
178 pCoexSta->preBtRssiState = btRssiState;
\r
180 return btRssiState;
\r
184 halbtc8723a2ant_WifiRssiState(
\r
185 IN PBTC_COEXIST pBtCoexist,
\r
187 IN u1Byte levelNum,
\r
188 IN u1Byte rssiThresh,
\r
189 IN u1Byte rssiThresh1
\r
193 u1Byte wifiRssiState=pCoexSta->preWifiRssiState[index];
\r
195 pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_S4_WIFI_RSSI, &wifiRssi);
\r
199 if( (pCoexSta->preWifiRssiState[index] == BTC_RSSI_STATE_LOW) ||
\r
200 (pCoexSta->preWifiRssiState[index] == BTC_RSSI_STATE_STAY_LOW))
\r
202 if(wifiRssi >= (rssiThresh+BTC_RSSI_COEX_THRESH_TOL_8723A_2ANT))
\r
204 wifiRssiState = BTC_RSSI_STATE_HIGH;
\r
208 wifiRssiState = BTC_RSSI_STATE_STAY_LOW;
\r
213 if(wifiRssi < rssiThresh)
\r
215 wifiRssiState = BTC_RSSI_STATE_LOW;
\r
219 wifiRssiState = BTC_RSSI_STATE_STAY_HIGH;
\r
223 else if(levelNum == 3)
\r
225 if(rssiThresh > rssiThresh1)
\r
227 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], wifi RSSI thresh error!!\n"));
\r
228 return pCoexSta->preWifiRssiState[index];
\r
231 if( (pCoexSta->preWifiRssiState[index] == BTC_RSSI_STATE_LOW) ||
\r
232 (pCoexSta->preWifiRssiState[index] == BTC_RSSI_STATE_STAY_LOW))
\r
234 if(wifiRssi >= (rssiThresh+BTC_RSSI_COEX_THRESH_TOL_8723A_2ANT))
\r
236 wifiRssiState = BTC_RSSI_STATE_MEDIUM;
\r
240 wifiRssiState = BTC_RSSI_STATE_STAY_LOW;
\r
243 else if( (pCoexSta->preWifiRssiState[index] == BTC_RSSI_STATE_MEDIUM) ||
\r
244 (pCoexSta->preWifiRssiState[index] == BTC_RSSI_STATE_STAY_MEDIUM))
\r
246 if(wifiRssi >= (rssiThresh1+BTC_RSSI_COEX_THRESH_TOL_8723A_2ANT))
\r
248 wifiRssiState = BTC_RSSI_STATE_HIGH;
\r
250 else if(wifiRssi < rssiThresh)
\r
252 wifiRssiState = BTC_RSSI_STATE_LOW;
\r
256 wifiRssiState = BTC_RSSI_STATE_STAY_MEDIUM;
\r
261 if(wifiRssi < rssiThresh1)
\r
263 wifiRssiState = BTC_RSSI_STATE_MEDIUM;
\r
267 wifiRssiState = BTC_RSSI_STATE_STAY_HIGH;
\r
272 pCoexSta->preWifiRssiState[index] = wifiRssiState;
\r
274 return wifiRssiState;
\r
278 halbtc8723a2ant_IndicateWifiChnlBwInfo(
\r
279 IN PBTC_COEXIST pBtCoexist,
\r
283 u1Byte H2C_Parameter[3] ={0};
\r
285 u1Byte wifiCentralChnl;
\r
287 // only 2.4G we need to inform bt the chnl mask
\r
288 pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U1_WIFI_CENTRAL_CHNL, &wifiCentralChnl);
\r
289 if( (BTC_MEDIA_CONNECT == type) &&
\r
290 (wifiCentralChnl <= 14) )
\r
292 H2C_Parameter[0] = 0x1;
\r
293 H2C_Parameter[1] = wifiCentralChnl;
\r
294 pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
\r
295 if(BTC_WIFI_BW_HT40 == wifiBw)
\r
296 H2C_Parameter[2] = 0x30;
\r
298 H2C_Parameter[2] = 0x20;
\r
301 pCoexDm->wifiChnlInfo[0] = H2C_Parameter[0];
\r
302 pCoexDm->wifiChnlInfo[1] = H2C_Parameter[1];
\r
303 pCoexDm->wifiChnlInfo[2] = H2C_Parameter[2];
\r
305 RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], FW write 0x19=0x%x\n",
\r
306 H2C_Parameter[0]<<16|H2C_Parameter[1]<<8|H2C_Parameter[2]));
\r
308 pBtCoexist->fBtcFillH2c(pBtCoexist, 0x19, 3, H2C_Parameter);
\r
312 halbtc8723a2ant_QueryBtInfo(
\r
313 IN PBTC_COEXIST pBtCoexist
\r
316 u1Byte H2C_Parameter[1] ={0};
\r
318 pCoexSta->bC2hBtInfoReqSent = TRUE;
\r
320 H2C_Parameter[0] |= BIT0; // trigger
\r
322 RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], Query Bt Info, FW write 0x38=0x%x\n",
\r
323 H2C_Parameter[0]));
\r
325 pBtCoexist->fBtcFillH2c(pBtCoexist, 0x38, 1, H2C_Parameter);
\r
328 halbtc8723a2ant_ActionAlgorithm(
\r
329 IN PBTC_COEXIST pBtCoexist
\r
332 PBTC_STACK_INFO pStackInfo=&pBtCoexist->stackInfo;
\r
333 BOOLEAN bBtHsOn=FALSE, bBtBusy=FALSE, bLimitedDig=FALSE;
\r
334 u1Byte algorithm=BT_8723A_2ANT_COEX_ALGO_UNDEFINED;
\r
335 u1Byte numOfDiffProfile=0;
\r
337 pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
\r
339 //======================
\r
340 // here we get BT status first
\r
341 //======================
\r
342 pCoexDm->btStatus = BT_8723A_2ANT_BT_STATUS_IDLE;
\r
344 if((pStackInfo->bScoExist) ||(bBtHsOn) ||(pStackInfo->bHidExist))
\r
346 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], SCO or HID or HS exists, set BT non-idle !!!\n"));
\r
347 pCoexDm->btStatus = BT_8723A_2ANT_BT_STATUS_NON_IDLE;
\r
352 if( (pBtCoexist->stackInfo.numOfLink == 1) &&
\r
353 (pStackInfo->bA2dpExist) )
\r
355 if( (pCoexSta->lowPriorityTx+ pCoexSta->lowPriorityRx) < 100)
\r
357 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], A2DP, low priority tx+rx < 100, set BT connected-idle!!!\n"));
\r
358 pCoexDm->btStatus = BT_8723A_2ANT_BT_STATUS_CONNECTED_IDLE;
\r
362 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], A2DP, low priority tx+rx >= 100, set BT non-idle!!!\n"));
\r
363 pCoexDm->btStatus = BT_8723A_2ANT_BT_STATUS_NON_IDLE;
\r
367 if( (pBtCoexist->stackInfo.numOfLink == 1) &&
\r
368 (pStackInfo->bPanExist) )
\r
370 if((pCoexSta->lowPriorityTx+ pCoexSta->lowPriorityRx) < 600)
\r
372 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], PAN, low priority tx+rx < 600, set BT connected-idle!!!\n"));
\r
373 pCoexDm->btStatus = BT_8723A_2ANT_BT_STATUS_CONNECTED_IDLE;
\r
377 if(pCoexSta->lowPriorityTx)
\r
379 if((pCoexSta->lowPriorityRx /pCoexSta->lowPriorityTx)>9 )
\r
381 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], PAN, low priority rx/tx > 9, set BT connected-idle!!!\n"));
\r
382 pCoexDm->btStatus = BT_8723A_2ANT_BT_STATUS_CONNECTED_IDLE;
\r
386 if(BT_8723A_2ANT_BT_STATUS_CONNECTED_IDLE != pCoexDm->btStatus)
\r
388 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], PAN, set BT non-idle!!!\n"));
\r
389 pCoexDm->btStatus = BT_8723A_2ANT_BT_STATUS_NON_IDLE;
\r
392 // Pan+A2dp profile
\r
393 if( (pBtCoexist->stackInfo.numOfLink == 2) &&
\r
394 (pStackInfo->bA2dpExist) &&
\r
395 (pStackInfo->bPanExist) )
\r
397 if((pCoexSta->lowPriorityTx+ pCoexSta->lowPriorityRx) < 600)
\r
399 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], PAN+A2DP, low priority tx+rx < 600, set BT connected-idle!!!\n"));
\r
400 pCoexDm->btStatus = BT_8723A_2ANT_BT_STATUS_CONNECTED_IDLE;
\r
404 if(pCoexSta->lowPriorityTx)
\r
406 if((pCoexSta->lowPriorityRx /pCoexSta->lowPriorityTx)>9 )
\r
408 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], PAN+A2DP, low priority rx/tx > 9, set BT connected-idle!!!\n"));
\r
409 pCoexDm->btStatus = BT_8723A_2ANT_BT_STATUS_CONNECTED_IDLE;
\r
413 if(BT_8723A_2ANT_BT_STATUS_CONNECTED_IDLE != pCoexDm->btStatus)
\r
415 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], PAN+A2DP, set BT non-idle!!!\n"));
\r
416 pCoexDm->btStatus = BT_8723A_2ANT_BT_STATUS_NON_IDLE;
\r
420 if(BT_8723A_2ANT_BT_STATUS_IDLE != pCoexDm->btStatus)
\r
423 bLimitedDig = TRUE;
\r
428 bLimitedDig = FALSE;
\r
430 pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_BT_TRAFFIC_BUSY, &bBtBusy);
\r
431 pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_BT_LIMITED_DIG, &bLimitedDig);
\r
432 //======================
\r
434 if(!pStackInfo->bBtLinkExist)
\r
436 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], No profile exists!!!\n"));
\r
440 if(pStackInfo->bScoExist)
\r
441 numOfDiffProfile++;
\r
442 if(pStackInfo->bHidExist)
\r
443 numOfDiffProfile++;
\r
444 if(pStackInfo->bPanExist)
\r
445 numOfDiffProfile++;
\r
446 if(pStackInfo->bA2dpExist)
\r
447 numOfDiffProfile++;
\r
449 if(numOfDiffProfile == 1)
\r
451 if(pStackInfo->bScoExist)
\r
453 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], SCO only\n"));
\r
454 algorithm = BT_8723A_2ANT_COEX_ALGO_SCO;
\r
458 if(pStackInfo->bHidExist)
\r
460 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], HID only\n"));
\r
461 algorithm = BT_8723A_2ANT_COEX_ALGO_HID;
\r
463 else if(pStackInfo->bA2dpExist)
\r
465 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], A2DP only\n"));
\r
466 algorithm = BT_8723A_2ANT_COEX_ALGO_A2DP;
\r
468 else if(pStackInfo->bPanExist)
\r
472 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], PAN(HS) only\n"));
\r
473 algorithm = BT_8723A_2ANT_COEX_ALGO_PANHS;
\r
477 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], PAN(EDR) only\n"));
\r
478 algorithm = BT_8723A_2ANT_COEX_ALGO_PANEDR;
\r
483 else if(numOfDiffProfile == 2)
\r
485 if(pStackInfo->bScoExist)
\r
487 if(pStackInfo->bHidExist)
\r
489 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], SCO + HID\n"));
\r
490 algorithm = BT_8723A_2ANT_COEX_ALGO_HID;
\r
492 else if(pStackInfo->bA2dpExist)
\r
494 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], SCO + A2DP ==> SCO\n"));
\r
495 algorithm = BT_8723A_2ANT_COEX_ALGO_SCO;
\r
497 else if(pStackInfo->bPanExist)
\r
501 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], SCO + PAN(HS)\n"));
\r
502 algorithm = BT_8723A_2ANT_COEX_ALGO_SCO;
\r
506 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], SCO + PAN(EDR)\n"));
\r
507 algorithm = BT_8723A_2ANT_COEX_ALGO_PANEDR_HID;
\r
513 if( pStackInfo->bHidExist &&
\r
514 pStackInfo->bA2dpExist )
\r
516 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], HID + A2DP\n"));
\r
517 algorithm = BT_8723A_2ANT_COEX_ALGO_HID_A2DP;
\r
519 else if( pStackInfo->bHidExist &&
\r
520 pStackInfo->bPanExist )
\r
524 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], HID + PAN(HS)\n"));
\r
525 algorithm = BT_8723A_2ANT_COEX_ALGO_HID_A2DP;
\r
529 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], HID + PAN(EDR)\n"));
\r
530 algorithm = BT_8723A_2ANT_COEX_ALGO_PANEDR_HID;
\r
533 else if( pStackInfo->bPanExist &&
\r
534 pStackInfo->bA2dpExist )
\r
538 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], A2DP + PAN(HS)\n"));
\r
539 algorithm = BT_8723A_2ANT_COEX_ALGO_A2DP;
\r
543 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], A2DP + PAN(EDR)\n"));
\r
544 algorithm = BT_8723A_2ANT_COEX_ALGO_PANEDR_A2DP;
\r
549 else if(numOfDiffProfile == 3)
\r
551 if(pStackInfo->bScoExist)
\r
553 if( pStackInfo->bHidExist &&
\r
554 pStackInfo->bA2dpExist )
\r
556 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], SCO + HID + A2DP ==> HID\n"));
\r
557 algorithm = BT_8723A_2ANT_COEX_ALGO_HID;
\r
559 else if( pStackInfo->bHidExist &&
\r
560 pStackInfo->bPanExist )
\r
564 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], SCO + HID + PAN(HS)\n"));
\r
565 algorithm = BT_8723A_2ANT_COEX_ALGO_HID_A2DP;
\r
569 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], SCO + HID + PAN(EDR)\n"));
\r
570 algorithm = BT_8723A_2ANT_COEX_ALGO_PANEDR_HID;
\r
573 else if( pStackInfo->bPanExist &&
\r
574 pStackInfo->bA2dpExist )
\r
578 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], SCO + A2DP + PAN(HS)\n"));
\r
579 algorithm = BT_8723A_2ANT_COEX_ALGO_SCO;
\r
583 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], SCO + A2DP + PAN(EDR) ==> HID\n"));
\r
584 algorithm = BT_8723A_2ANT_COEX_ALGO_PANEDR_HID;
\r
590 if( pStackInfo->bHidExist &&
\r
591 pStackInfo->bPanExist &&
\r
592 pStackInfo->bA2dpExist )
\r
596 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], HID + A2DP + PAN(HS)\n"));
\r
597 algorithm = BT_8723A_2ANT_COEX_ALGO_HID_A2DP;
\r
601 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], HID + A2DP + PAN(EDR)\n"));
\r
602 algorithm = BT_8723A_2ANT_COEX_ALGO_HID_A2DP_PANEDR;
\r
607 else if(numOfDiffProfile >= 3)
\r
609 if(pStackInfo->bScoExist)
\r
611 if( pStackInfo->bHidExist &&
\r
612 pStackInfo->bPanExist &&
\r
613 pStackInfo->bA2dpExist )
\r
617 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Error!!! SCO + HID + A2DP + PAN(HS)\n"));
\r
622 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], SCO + HID + A2DP + PAN(EDR)==>PAN(EDR)+HID\n"));
\r
623 algorithm = BT_8723A_2ANT_COEX_ALGO_PANEDR_HID;
\r
633 halbtc8723a2ant_NeedToDecBtPwr(
\r
634 IN PBTC_COEXIST pBtCoexist
\r
637 BOOLEAN bRet=FALSE;
\r
638 BOOLEAN bBtHsOn=FALSE, bWifiConnected=FALSE;
\r
640 u1Byte btRssiState=BTC_RSSI_STATE_HIGH;
\r
642 btRssiState = halbtc8723a2ant_BtRssiState(2, 42, 0);
\r
644 if(!pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn))
\r
646 if(!pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected))
\r
648 if(!pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_S4_HS_RSSI, &btHsRssi))
\r
650 if(BTC_RSSI_LOW(btRssiState))
\r
659 RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], Need to decrease bt power for HS mode!!\n"));
\r
665 RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], Need to decrease bt power for Wifi is connected!!\n"));
\r
674 halbtc8723a2ant_SetFwDacSwingLevel(
\r
675 IN PBTC_COEXIST pBtCoexist,
\r
676 IN u1Byte dacSwingLvl
\r
679 u1Byte H2C_Parameter[1] ={0};
\r
681 // There are several type of dacswing
\r
682 // 0x18/ 0x10/ 0xc/ 0x8/ 0x4/ 0x6
\r
683 H2C_Parameter[0] = dacSwingLvl;
\r
685 RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], Set Dac Swing Level=0x%x\n", dacSwingLvl));
\r
686 RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], FW write 0x29=0x%x\n", H2C_Parameter[0]));
\r
688 pBtCoexist->fBtcFillH2c(pBtCoexist, 0x29, 1, H2C_Parameter);
\r
692 halbtc8723a2ant_SetFwDecBtPwr(
\r
693 IN PBTC_COEXIST pBtCoexist,
\r
694 IN BOOLEAN bDecBtPwr
\r
697 u1Byte H2C_Parameter[1] ={0};
\r
699 H2C_Parameter[0] = 0;
\r
703 H2C_Parameter[0] |= BIT1;
\r
706 RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], decrease Bt Power : %s, FW write 0x21=0x%x\n",
\r
707 (bDecBtPwr? "Yes!!":"No!!"), H2C_Parameter[0]));
\r
709 pBtCoexist->fBtcFillH2c(pBtCoexist, 0x21, 1, H2C_Parameter);
\r
713 halbtc8723a2ant_DecBtPwr(
\r
714 IN PBTC_COEXIST pBtCoexist,
\r
715 IN BOOLEAN bForceExec,
\r
716 IN BOOLEAN bDecBtPwr
\r
719 RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], %s Dec BT power = %s\n",
\r
720 (bForceExec? "force to":""), ((bDecBtPwr)? "ON":"OFF")));
\r
721 pCoexDm->bCurDecBtPwr = bDecBtPwr;
\r
725 if(pCoexDm->bPreDecBtPwr == pCoexDm->bCurDecBtPwr)
\r
728 halbtc8723a2ant_SetFwDecBtPwr(pBtCoexist, pCoexDm->bCurDecBtPwr);
\r
730 pCoexDm->bPreDecBtPwr = pCoexDm->bCurDecBtPwr;
\r
734 halbtc8723a2ant_FwDacSwingLvl(
\r
735 IN PBTC_COEXIST pBtCoexist,
\r
736 IN BOOLEAN bForceExec,
\r
737 IN u1Byte fwDacSwingLvl
\r
740 RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], %s set FW Dac Swing level = %d\n",
\r
741 (bForceExec? "force to":""), fwDacSwingLvl));
\r
742 pCoexDm->curFwDacSwingLvl = fwDacSwingLvl;
\r
746 if(pCoexDm->preFwDacSwingLvl == pCoexDm->curFwDacSwingLvl)
\r
750 halbtc8723a2ant_SetFwDacSwingLevel(pBtCoexist, pCoexDm->curFwDacSwingLvl);
\r
752 pCoexDm->preFwDacSwingLvl = pCoexDm->curFwDacSwingLvl;
\r
756 halbtc8723a2ant_SetSwRfRxLpfCorner(
\r
757 IN PBTC_COEXIST pBtCoexist,
\r
758 IN BOOLEAN bRxRfShrinkOn
\r
763 //Shrink RF Rx LPF corner
\r
764 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Shrink RF Rx LPF corner!!\n"));
\r
765 pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1e, 0xfffff, 0xf0ff7);
\r
769 //Resume RF Rx LPF corner
\r
770 // After initialized, we can use pCoexDm->btRf0x1eBackup
\r
771 if(pBtCoexist->bInitilized)
\r
773 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Resume RF Rx LPF corner!!\n"));
\r
774 pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1e, 0xfffff, pCoexDm->btRf0x1eBackup);
\r
780 halbtc8723a2ant_RfShrink(
\r
781 IN PBTC_COEXIST pBtCoexist,
\r
782 IN BOOLEAN bForceExec,
\r
783 IN BOOLEAN bRxRfShrinkOn
\r
786 RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], %s turn Rx RF Shrink = %s\n",
\r
787 (bForceExec? "force to":""), ((bRxRfShrinkOn)? "ON":"OFF")));
\r
788 pCoexDm->bCurRfRxLpfShrink = bRxRfShrinkOn;
\r
792 if(pCoexDm->bPreRfRxLpfShrink == pCoexDm->bCurRfRxLpfShrink)
\r
795 halbtc8723a2ant_SetSwRfRxLpfCorner(pBtCoexist, pCoexDm->bCurRfRxLpfShrink);
\r
797 pCoexDm->bPreRfRxLpfShrink = pCoexDm->bCurRfRxLpfShrink;
\r
801 halbtc8723a2ant_SetSwPenaltyTxRateAdaptive(
\r
802 IN PBTC_COEXIST pBtCoexist,
\r
803 IN BOOLEAN bLowPenaltyRa
\r
808 tmpU1 = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x4fd);
\r
812 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Tx rate adaptive, set low penalty!!\n"));
\r
817 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Tx rate adaptive, set normal!!\n"));
\r
821 pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x4fd, tmpU1);
\r
825 halbtc8723a2ant_LowPenaltyRa(
\r
826 IN PBTC_COEXIST pBtCoexist,
\r
827 IN BOOLEAN bForceExec,
\r
828 IN BOOLEAN bLowPenaltyRa
\r
832 RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], %s turn LowPenaltyRA = %s\n",
\r
833 (bForceExec? "force to":""), ((bLowPenaltyRa)? "ON":"OFF")));
\r
834 pCoexDm->bCurLowPenaltyRa = bLowPenaltyRa;
\r
838 if(pCoexDm->bPreLowPenaltyRa == pCoexDm->bCurLowPenaltyRa)
\r
841 halbtc8723a2ant_SetSwPenaltyTxRateAdaptive(pBtCoexist, pCoexDm->bCurLowPenaltyRa);
\r
843 pCoexDm->bPreLowPenaltyRa = pCoexDm->bCurLowPenaltyRa;
\r
847 halbtc8723a2ant_SetSwFullTimeDacSwing(
\r
848 IN PBTC_COEXIST pBtCoexist,
\r
849 IN BOOLEAN bSwDacSwingOn,
\r
850 IN u4Byte swDacSwingLvl
\r
855 pBtCoexist->fBtcSetBbReg(pBtCoexist, 0x880, 0xff000000, swDacSwingLvl);
\r
859 pBtCoexist->fBtcSetBbReg(pBtCoexist, 0x880, 0xff000000, 0xc0);
\r
865 halbtc8723a2ant_DacSwing(
\r
866 IN PBTC_COEXIST pBtCoexist,
\r
867 IN BOOLEAN bForceExec,
\r
868 IN BOOLEAN bDacSwingOn,
\r
869 IN u4Byte dacSwingLvl
\r
872 RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], %s turn DacSwing=%s, dacSwingLvl=0x%x\n",
\r
873 (bForceExec? "force to":""), ((bDacSwingOn)? "ON":"OFF"), dacSwingLvl));
\r
874 pCoexDm->bCurDacSwingOn = bDacSwingOn;
\r
875 pCoexDm->curDacSwingLvl = dacSwingLvl;
\r
879 if( (pCoexDm->bPreDacSwingOn == pCoexDm->bCurDacSwingOn) &&
\r
880 (pCoexDm->preDacSwingLvl == pCoexDm->curDacSwingLvl) )
\r
884 halbtc8723a2ant_SetSwFullTimeDacSwing(pBtCoexist, bDacSwingOn, dacSwingLvl);
\r
886 pCoexDm->bPreDacSwingOn = pCoexDm->bCurDacSwingOn;
\r
887 pCoexDm->preDacSwingLvl = pCoexDm->curDacSwingLvl;
\r
891 halbtc8723a2ant_SetAdcBackOff(
\r
892 IN PBTC_COEXIST pBtCoexist,
\r
893 IN BOOLEAN bAdcBackOff
\r
898 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], BB BackOff Level On!\n"));
\r
899 pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc04,0x3a07611);
\r
903 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], BB BackOff Level Off!\n"));
\r
904 pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc04,0x3a05611);
\r
909 halbtc8723a2ant_AdcBackOff(
\r
910 IN PBTC_COEXIST pBtCoexist,
\r
911 IN BOOLEAN bForceExec,
\r
912 IN BOOLEAN bAdcBackOff
\r
915 RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], %s turn AdcBackOff = %s\n",
\r
916 (bForceExec? "force to":""), ((bAdcBackOff)? "ON":"OFF")));
\r
917 pCoexDm->bCurAdcBackOff = bAdcBackOff;
\r
921 if(pCoexDm->bPreAdcBackOff == pCoexDm->bCurAdcBackOff)
\r
924 halbtc8723a2ant_SetAdcBackOff(pBtCoexist, pCoexDm->bCurAdcBackOff);
\r
926 pCoexDm->bPreAdcBackOff = pCoexDm->bCurAdcBackOff;
\r
930 halbtc8723a2ant_SetAgcTable(
\r
931 IN PBTC_COEXIST pBtCoexist,
\r
932 IN BOOLEAN bAgcTableEn
\r
935 u1Byte rssiAdjustVal=0;
\r
939 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Agc Table On!\n"));
\r
940 pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78,0x4e1c0001);
\r
941 pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78,0x4d1d0001);
\r
942 pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78,0x4c1e0001);
\r
943 pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78,0x4b1f0001);
\r
944 pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78,0x4a200001);
\r
946 pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x12, 0xfffff, 0xdc000);
\r
947 pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x12, 0xfffff, 0x90000);
\r
948 pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x12, 0xfffff, 0x51000);
\r
949 pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x12, 0xfffff, 0x12000);
\r
950 pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1a, 0xfffff, 0x00355);
\r
956 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Agc Table Off!\n"));
\r
957 pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78,0x641c0001);
\r
958 pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78,0x631d0001);
\r
959 pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78,0x621e0001);
\r
960 pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78,0x611f0001);
\r
961 pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78,0x60200001);
\r
963 pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x12, 0xfffff, 0x32000);
\r
964 pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x12, 0xfffff, 0x71000);
\r
965 pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x12, 0xfffff, 0xb0000);
\r
966 pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x12, 0xfffff, 0xfc000);
\r
967 pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1a, 0xfffff, 0x30355);
\r
970 // set rssiAdjustVal for wifi module.
\r
971 pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_U1_RSSI_ADJ_VAL_FOR_AGC_TABLE_ON, &rssiAdjustVal);
\r
976 halbtc8723a2ant_AgcTable(
\r
977 IN PBTC_COEXIST pBtCoexist,
\r
978 IN BOOLEAN bForceExec,
\r
979 IN BOOLEAN bAgcTableEn
\r
982 RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], %s %s Agc Table\n",
\r
983 (bForceExec? "force to":""), ((bAgcTableEn)? "Enable":"Disable")));
\r
984 pCoexDm->bCurAgcTableEn = bAgcTableEn;
\r
988 if(pCoexDm->bPreAgcTableEn == pCoexDm->bCurAgcTableEn)
\r
991 halbtc8723a2ant_SetAgcTable(pBtCoexist, bAgcTableEn);
\r
993 pCoexDm->bPreAgcTableEn = pCoexDm->bCurAgcTableEn;
\r
997 halbtc8723a2ant_SetCoexTable(
\r
998 IN PBTC_COEXIST pBtCoexist,
\r
999 IN u4Byte val0x6c0,
\r
1000 IN u4Byte val0x6c8,
\r
1001 IN u1Byte val0x6cc
\r
1004 RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], set coex table, set 0x6c0=0x%x\n", val0x6c0));
\r
1005 pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x6c0, val0x6c0);
\r
1007 RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], set coex table, set 0x6c8=0x%x\n", val0x6c8));
\r
1008 pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x6c8, val0x6c8);
\r
1010 RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], set coex table, set 0x6cc=0x%x\n", val0x6cc));
\r
1011 pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x6cc, val0x6cc);
\r
1015 halbtc8723a2ant_CoexTable(
\r
1016 IN PBTC_COEXIST pBtCoexist,
\r
1017 IN BOOLEAN bForceExec,
\r
1018 IN u4Byte val0x6c0,
\r
1019 IN u4Byte val0x6c8,
\r
1020 IN u1Byte val0x6cc
\r
1023 RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], %s write Coex Table 0x6c0=0x%x, 0x6c8=0x%x, 0x6cc=0x%x\n",
\r
1024 (bForceExec? "force to":""), val0x6c0, val0x6c8, val0x6cc));
\r
1025 pCoexDm->curVal0x6c0 = val0x6c0;
\r
1026 pCoexDm->curVal0x6c8 = val0x6c8;
\r
1027 pCoexDm->curVal0x6cc = val0x6cc;
\r
1031 if( (pCoexDm->preVal0x6c0 == pCoexDm->curVal0x6c0) &&
\r
1032 (pCoexDm->preVal0x6c8 == pCoexDm->curVal0x6c8) &&
\r
1033 (pCoexDm->preVal0x6cc == pCoexDm->curVal0x6cc) )
\r
1036 halbtc8723a2ant_SetCoexTable(pBtCoexist, val0x6c0, val0x6c8, val0x6cc);
\r
1038 pCoexDm->preVal0x6c0 = pCoexDm->curVal0x6c0;
\r
1039 pCoexDm->preVal0x6c8 = pCoexDm->curVal0x6c8;
\r
1040 pCoexDm->preVal0x6cc = pCoexDm->curVal0x6cc;
\r
1044 halbtc8723a2ant_SetFwIgnoreWlanAct(
\r
1045 IN PBTC_COEXIST pBtCoexist,
\r
1046 IN BOOLEAN bEnable
\r
1049 u1Byte H2C_Parameter[1] ={0};
\r
1053 H2C_Parameter[0] |= BIT0; // function enable
\r
1056 RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], set FW for BT Ignore Wlan_Act, FW write 0x25=0x%x\n",
\r
1057 H2C_Parameter[0]));
\r
1059 pBtCoexist->fBtcFillH2c(pBtCoexist, 0x25, 1, H2C_Parameter);
\r
1063 halbtc8723a2ant_IgnoreWlanAct(
\r
1064 IN PBTC_COEXIST pBtCoexist,
\r
1065 IN BOOLEAN bForceExec,
\r
1066 IN BOOLEAN bEnable
\r
1069 RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], %s turn Ignore WlanAct %s\n",
\r
1070 (bForceExec? "force to":""), (bEnable? "ON":"OFF")));
\r
1071 pCoexDm->bCurIgnoreWlanAct = bEnable;
\r
1075 if(pCoexDm->bPreIgnoreWlanAct == pCoexDm->bCurIgnoreWlanAct)
\r
1078 halbtc8723a2ant_SetFwIgnoreWlanAct(pBtCoexist, bEnable);
\r
1080 pCoexDm->bPreIgnoreWlanAct = pCoexDm->bCurIgnoreWlanAct;
\r
1084 halbtc8723a2ant_SetFwPstdma(
\r
1085 IN PBTC_COEXIST pBtCoexist,
\r
1093 u1Byte H2C_Parameter[5] ={0};
\r
1095 H2C_Parameter[0] = byte1;
\r
1096 H2C_Parameter[1] = byte2;
\r
1097 H2C_Parameter[2] = byte3;
\r
1098 H2C_Parameter[3] = byte4;
\r
1099 H2C_Parameter[4] = byte5;
\r
1101 pCoexDm->psTdmaPara[0] = byte1;
\r
1102 pCoexDm->psTdmaPara[1] = byte2;
\r
1103 pCoexDm->psTdmaPara[2] = byte3;
\r
1104 pCoexDm->psTdmaPara[3] = byte4;
\r
1105 pCoexDm->psTdmaPara[4] = byte5;
\r
1107 RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], FW write 0x3a(5bytes)=0x%x%08x\n",
\r
1108 H2C_Parameter[0],
\r
1109 H2C_Parameter[1]<<24|H2C_Parameter[2]<<16|H2C_Parameter[3]<<8|H2C_Parameter[4]));
\r
1111 pBtCoexist->fBtcFillH2c(pBtCoexist, 0x3a, 5, H2C_Parameter);
\r
1115 halbtc8723a2ant_PsTdma(
\r
1116 IN PBTC_COEXIST pBtCoexist,
\r
1117 IN BOOLEAN bForceExec,
\r
1118 IN BOOLEAN bTurnOn,
\r
1122 u4Byte btTxRxCnt=0;
\r
1124 btTxRxCnt = pCoexSta->highPriorityTx+pCoexSta->highPriorityRx+
\r
1125 pCoexSta->lowPriorityTx+pCoexSta->lowPriorityRx;
\r
1127 if(btTxRxCnt > 3000)
\r
1129 pCoexDm->bCurPsTdmaOn = TRUE;
\r
1130 pCoexDm->curPsTdma = 8;
\r
1131 RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], turn ON PS TDMA, type=%d for BT tx/rx counters=%d(>3000)\n",
\r
1132 pCoexDm->curPsTdma, btTxRxCnt));
\r
1136 RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], %s turn %s PS TDMA, type=%d\n",
\r
1137 (bForceExec? "force to":""), (bTurnOn? "ON":"OFF"), type));
\r
1138 pCoexDm->bCurPsTdmaOn = bTurnOn;
\r
1139 pCoexDm->curPsTdma = type;
\r
1144 if( (pCoexDm->bPrePsTdmaOn == pCoexDm->bCurPsTdmaOn) &&
\r
1145 (pCoexDm->prePsTdma == pCoexDm->curPsTdma) )
\r
1148 if(pCoexDm->bCurPsTdmaOn)
\r
1150 switch(pCoexDm->curPsTdma)
\r
1154 halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0xe1, 0x98);
\r
1157 halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0xe1, 0x98);
\r
1160 halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0xa, 0xa, 0xe1, 0x98);
\r
1163 halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xa3, 0x5, 0x5, 0xe1, 0x80);
\r
1166 halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0x60, 0x98);
\r
1169 halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0x60, 0x98);
\r
1172 halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0xa, 0xa, 0x60, 0x98);
\r
1175 halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xa3, 0x5, 0x5, 0x60, 0x80);
\r
1178 halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0xe1, 0x98);
\r
1181 halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0xe1, 0x98);
\r
1184 halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0xa, 0xa, 0xe1, 0x98);
\r
1187 halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x5, 0x5, 0xe1, 0x98);
\r
1190 halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0x60, 0x98);
\r
1193 halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0x60, 0x98);
\r
1196 halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0xa, 0xa, 0x60, 0x98);
\r
1199 halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x5, 0x5, 0x60, 0x98);
\r
1202 halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xa3, 0x2f, 0x2f, 0x60, 0x80);
\r
1205 halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x5, 0x5, 0xe1, 0x98);
\r
1208 halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x25, 0x25, 0xe1, 0x98);
\r
1211 halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x25, 0x25, 0x60, 0x98);
\r
1217 // disable PS tdma
\r
1218 switch(pCoexDm->curPsTdma)
\r
1221 halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0x0, 0x0, 0x0, 0x8, 0x0);
\r
1224 halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0x0, 0x0, 0x0, 0x0, 0x0);
\r
1227 halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0x0, 0x0, 0x0, 0x8, 0x0);
\r
1232 // update pre state
\r
1233 pCoexDm->bPrePsTdmaOn = pCoexDm->bCurPsTdmaOn;
\r
1234 pCoexDm->prePsTdma = pCoexDm->curPsTdma;
\r
1239 halbtc8723a2ant_CoexAllOff(
\r
1240 IN PBTC_COEXIST pBtCoexist
\r
1244 halbtc8723a2ant_IgnoreWlanAct(pBtCoexist, NORMAL_EXEC, FALSE);
\r
1245 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
\r
1246 halbtc8723a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 0x20);
\r
1247 halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
\r
1250 halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
\r
1251 halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
\r
1252 halbtc8723a2ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, FALSE);
\r
1253 halbtc8723a2ant_RfShrink(pBtCoexist, NORMAL_EXEC, FALSE);
\r
1254 halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
\r
1257 halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);
\r
1261 halbtc8723a2ant_InitCoexDm(
\r
1262 IN PBTC_COEXIST pBtCoexist
\r
1265 // force to reset coex mechanism
\r
1266 halbtc8723a2ant_CoexTable(pBtCoexist, FORCE_EXEC, 0x55555555, 0xffff, 0x3);
\r
1267 halbtc8723a2ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 0);
\r
1268 halbtc8723a2ant_FwDacSwingLvl(pBtCoexist, FORCE_EXEC, 0x20);
\r
1269 halbtc8723a2ant_DecBtPwr(pBtCoexist, FORCE_EXEC, FALSE);
\r
1270 halbtc8723a2ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, FALSE);
\r
1272 halbtc8723a2ant_AgcTable(pBtCoexist, FORCE_EXEC, FALSE);
\r
1273 halbtc8723a2ant_AdcBackOff(pBtCoexist, FORCE_EXEC, FALSE);
\r
1274 halbtc8723a2ant_LowPenaltyRa(pBtCoexist, FORCE_EXEC, FALSE);
\r
1275 halbtc8723a2ant_RfShrink(pBtCoexist, FORCE_EXEC, FALSE);
\r
1276 halbtc8723a2ant_DacSwing(pBtCoexist, FORCE_EXEC, FALSE, 0xc0);
\r
1280 halbtc8723a2ant_BtInquiryPage(
\r
1281 IN PBTC_COEXIST pBtCoexist
\r
1284 BOOLEAN bLowPwrDisable=TRUE;
\r
1286 pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable);
\r
1288 halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);
\r
1289 halbtc8723a2ant_IgnoreWlanAct(pBtCoexist, NORMAL_EXEC, FALSE);
\r
1290 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
\r
1294 halbtc8723a2ant_BtEnableAction(
\r
1295 IN PBTC_COEXIST pBtCoexist
\r
1298 BOOLEAN bWifiConnected=FALSE;
\r
1300 // Here we need to resend some wifi info to BT
\r
1301 // because bt is reset and loss of the info.
\r
1302 pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
\r
1303 if(bWifiConnected)
\r
1305 halbtc8723a2ant_IndicateWifiChnlBwInfo(pBtCoexist, BTC_MEDIA_CONNECT);
\r
1309 halbtc8723a2ant_IndicateWifiChnlBwInfo(pBtCoexist, BTC_MEDIA_DISCONNECT);
\r
1312 halbtc8723a2ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, FALSE);
\r
1316 halbtc8723a2ant_MonitorBtCtr(
\r
1317 IN PBTC_COEXIST pBtCoexist
\r
1320 u4Byte regHPTxRx, regLPTxRx, u4Tmp;
\r
1321 u4Byte regHPTx=0, regHPRx=0, regLPTx=0, regLPRx=0;
\r
1324 regHPTxRx = 0x770;
\r
1325 regLPTxRx = 0x774;
\r
1327 u4Tmp = pBtCoexist->fBtcRead4Byte(pBtCoexist, regHPTxRx);
\r
1328 regHPTx = u4Tmp & bMaskLWord;
\r
1329 regHPRx = (u4Tmp & bMaskHWord)>>16;
\r
1331 u4Tmp = pBtCoexist->fBtcRead4Byte(pBtCoexist, regLPTxRx);
\r
1332 regLPTx = u4Tmp & bMaskLWord;
\r
1333 regLPRx = (u4Tmp & bMaskHWord)>>16;
\r
1335 pCoexSta->highPriorityTx = regHPTx;
\r
1336 pCoexSta->highPriorityRx = regHPRx;
\r
1337 pCoexSta->lowPriorityTx = regLPTx;
\r
1338 pCoexSta->lowPriorityRx = regLPRx;
\r
1340 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], High Priority Tx/Rx (reg 0x%x)=0x%x(%d)/0x%x(%d)\n",
\r
1341 regHPTxRx, regHPTx, regHPTx, regHPRx, regHPRx));
\r
1342 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Low Priority Tx/Rx (reg 0x%x)=0x%x(%d)/0x%x(%d)\n",
\r
1343 regLPTxRx, regLPTx, regLPTx, regLPRx, regLPRx));
\r
1346 pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x76e, 0xc);
\r
1350 halbtc8723a2ant_MonitorBtEnableDisable(
\r
1351 IN PBTC_COEXIST pBtCoexist
\r
1354 static BOOLEAN bPreBtDisabled=FALSE;
\r
1355 static u4Byte btDisableCnt=0;
\r
1356 BOOLEAN bBtActive=TRUE, bBtDisabled=FALSE;
\r
1358 // This function check if bt is disabled
\r
1360 if( pCoexSta->highPriorityTx == 0 &&
\r
1361 pCoexSta->highPriorityRx == 0 &&
\r
1362 pCoexSta->lowPriorityTx == 0 &&
\r
1363 pCoexSta->lowPriorityRx == 0)
\r
1365 bBtActive = FALSE;
\r
1367 if( pCoexSta->highPriorityTx == 0xffff &&
\r
1368 pCoexSta->highPriorityRx == 0xffff &&
\r
1369 pCoexSta->lowPriorityTx == 0xffff &&
\r
1370 pCoexSta->lowPriorityRx == 0xffff)
\r
1372 bBtActive = FALSE;
\r
1377 bBtDisabled = FALSE;
\r
1378 pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_BT_DISABLE, &bBtDisabled);
\r
1379 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], BT is enabled !!\n"));
\r
1384 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], bt all counters=0, %d times!!\n",
\r
1386 if(btDisableCnt >= 2)
\r
1388 bBtDisabled = TRUE;
\r
1389 pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_BT_DISABLE, &bBtDisabled);
\r
1390 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], BT is disabled !!\n"));
\r
1393 if(bPreBtDisabled != bBtDisabled)
\r
1395 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], BT is from %s to %s!!\n",
\r
1396 (bPreBtDisabled ? "disabled":"enabled"),
\r
1397 (bBtDisabled ? "disabled":"enabled")));
\r
1398 bPreBtDisabled = bBtDisabled;
\r
1401 halbtc8723a2ant_BtEnableAction(pBtCoexist);
\r
1407 halbtc8723a2ant_IsCommonAction(
\r
1408 IN PBTC_COEXIST pBtCoexist
\r
1411 PBTC_STACK_INFO pStackInfo=&pBtCoexist->stackInfo;
\r
1412 BOOLEAN bCommon=FALSE, bWifiConnected=FALSE;
\r
1413 BOOLEAN bLowPwrDisable=FALSE;
\r
1415 if(!pStackInfo->bBtLinkExist)
\r
1417 bLowPwrDisable = FALSE;
\r
1418 pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable);
\r
1422 bLowPwrDisable = TRUE;
\r
1423 pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable);
\r
1426 pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
\r
1428 if(halbtc8723a2ant_IsWifiIdle(pBtCoexist) &&
\r
1429 BT_8723A_2ANT_BT_STATUS_IDLE == pCoexDm->btStatus)
\r
1431 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Wifi idle + Bt idle!!\n"));
\r
1433 halbtc8723a2ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, FALSE);
\r
1434 halbtc8723a2ant_RfShrink(pBtCoexist, NORMAL_EXEC, FALSE);
\r
1435 halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);
\r
1437 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
\r
1438 halbtc8723a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 0x20);
\r
1439 halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
\r
1441 halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
\r
1442 halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
\r
1443 halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
\r
1447 else if(!halbtc8723a2ant_IsWifiIdle(pBtCoexist) &&
\r
1448 (BT_8723A_2ANT_BT_STATUS_IDLE == pCoexDm->btStatus) )
\r
1450 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Wifi non-idle + BT idle!!\n"));
\r
1452 halbtc8723a2ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, TRUE);
\r
1453 halbtc8723a2ant_RfShrink(pBtCoexist, NORMAL_EXEC, FALSE);
\r
1454 halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);
\r
1456 halbtc8723a2ant_IgnoreWlanAct(pBtCoexist, NORMAL_EXEC, FALSE);
\r
1457 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
\r
1458 halbtc8723a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 0x20);
\r
1459 halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
\r
1461 halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
\r
1462 halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
\r
1463 halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
\r
1467 else if(halbtc8723a2ant_IsWifiIdle(pBtCoexist) &&
\r
1468 (BT_8723A_2ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus) )
\r
1470 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Wifi idle + Bt connected idle!!\n"));
\r
1472 halbtc8723a2ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, TRUE);
\r
1473 halbtc8723a2ant_RfShrink(pBtCoexist, NORMAL_EXEC, TRUE);
\r
1474 halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);
\r
1476 halbtc8723a2ant_IgnoreWlanAct(pBtCoexist, NORMAL_EXEC, FALSE);
\r
1477 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
\r
1478 halbtc8723a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 0x20);
\r
1479 halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
\r
1481 halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
\r
1482 halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
\r
1483 halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
\r
1487 else if(!halbtc8723a2ant_IsWifiIdle(pBtCoexist) &&
\r
1488 (BT_8723A_2ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus) )
\r
1490 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Wifi non-idle + Bt connected idle!!\n"));
\r
1492 halbtc8723a2ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, TRUE);
\r
1493 halbtc8723a2ant_RfShrink(pBtCoexist, NORMAL_EXEC, TRUE);
\r
1494 halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);
\r
1496 halbtc8723a2ant_IgnoreWlanAct(pBtCoexist, NORMAL_EXEC, FALSE);
\r
1497 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
\r
1498 halbtc8723a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 0x20);
\r
1499 halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
\r
1501 halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
\r
1502 halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
\r
1503 halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
\r
1507 else if(halbtc8723a2ant_IsWifiIdle(pBtCoexist) &&
\r
1508 (BT_8723A_2ANT_BT_STATUS_NON_IDLE == pCoexDm->btStatus) )
\r
1510 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Wifi idle + BT non-idle!!\n"));
\r
1512 halbtc8723a2ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, TRUE);
\r
1513 halbtc8723a2ant_RfShrink(pBtCoexist, NORMAL_EXEC, TRUE);
\r
1514 halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);
\r
1516 halbtc8723a2ant_IgnoreWlanAct(pBtCoexist, NORMAL_EXEC, FALSE);
\r
1517 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
\r
1518 halbtc8723a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 0x20);
\r
1519 halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
\r
1521 halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
\r
1522 halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
\r
1523 halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
\r
1527 else if(halbtc8723a2ant_IsWifiConnectedIdle(pBtCoexist) &&
\r
1528 (BT_8723A_2ANT_BT_STATUS_NON_IDLE == pCoexDm->btStatus) )
\r
1530 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Wifi connected-idle + BT non-idle!!\n"));
\r
1532 halbtc8723a2ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, TRUE);
\r
1533 halbtc8723a2ant_RfShrink(pBtCoexist, NORMAL_EXEC, TRUE);
\r
1534 halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);
\r
1536 halbtc8723a2ant_IgnoreWlanAct(pBtCoexist, NORMAL_EXEC, FALSE);
\r
1537 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
\r
1538 halbtc8723a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 0x20);
\r
1539 halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
\r
1541 halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
\r
1542 halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
\r
1543 halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
\r
1549 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Wifi non-idle + BT non-idle!!\n"));
\r
1550 halbtc8723a2ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, TRUE);
\r
1551 halbtc8723a2ant_RfShrink(pBtCoexist, NORMAL_EXEC, TRUE);
\r
1552 halbtc8723a2ant_IgnoreWlanAct(pBtCoexist, NORMAL_EXEC, FALSE);
\r
1553 halbtc8723a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 0x20);
\r
1561 halbtc8723a2ant_TdmaDurationAdjust(
\r
1562 IN PBTC_COEXIST pBtCoexist,
\r
1563 IN BOOLEAN bScoHid,
\r
1564 IN BOOLEAN bTxPause,
\r
1565 IN u1Byte maxInterval
\r
1568 static s4Byte up,dn,m,n,WaitCount;
\r
1569 s4Byte result; //0: no change, +1: increase WiFi duration, -1: decrease WiFi duration
\r
1570 u1Byte retryCount=0;
\r
1572 RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], TdmaDurationAdjust()\n"));
\r
1574 if(pCoexDm->bResetTdmaAdjust)
\r
1576 pCoexDm->bResetTdmaAdjust = FALSE;
\r
1577 RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], first run TdmaDurationAdjust()!!\n"));
\r
1583 if(maxInterval == 1)
\r
1585 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 13);
\r
1586 pCoexDm->psTdmaDuAdjType = 13;
\r
1588 else if(maxInterval == 2)
\r
1590 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
\r
1591 pCoexDm->psTdmaDuAdjType = 14;
\r
1593 else if(maxInterval == 3)
\r
1595 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
\r
1596 pCoexDm->psTdmaDuAdjType = 15;
\r
1600 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
\r
1601 pCoexDm->psTdmaDuAdjType = 15;
\r
1606 if(maxInterval == 1)
\r
1608 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
\r
1609 pCoexDm->psTdmaDuAdjType = 9;
\r
1611 else if(maxInterval == 2)
\r
1613 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
\r
1614 pCoexDm->psTdmaDuAdjType = 10;
\r
1616 else if(maxInterval == 3)
\r
1618 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
\r
1619 pCoexDm->psTdmaDuAdjType = 11;
\r
1623 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
\r
1624 pCoexDm->psTdmaDuAdjType = 11;
\r
1632 if(maxInterval == 1)
\r
1634 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
\r
1635 pCoexDm->psTdmaDuAdjType = 5;
\r
1637 else if(maxInterval == 2)
\r
1639 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
\r
1640 pCoexDm->psTdmaDuAdjType = 6;
\r
1642 else if(maxInterval == 3)
\r
1644 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
\r
1645 pCoexDm->psTdmaDuAdjType = 7;
\r
1649 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
\r
1650 pCoexDm->psTdmaDuAdjType = 7;
\r
1655 if(maxInterval == 1)
\r
1657 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);
\r
1658 pCoexDm->psTdmaDuAdjType = 1;
\r
1660 else if(maxInterval == 2)
\r
1662 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
\r
1663 pCoexDm->psTdmaDuAdjType = 2;
\r
1665 else if(maxInterval == 3)
\r
1667 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
\r
1668 pCoexDm->psTdmaDuAdjType = 3;
\r
1672 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
\r
1673 pCoexDm->psTdmaDuAdjType = 3;
\r
1688 //accquire the BT TRx retry count from BT_Info byte2
\r
1689 retryCount = pCoexSta->btRetryCnt;
\r
1690 RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], retryCount = %d\n", retryCount));
\r
1691 RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], up=%d, dn=%d, m=%d, n=%d, WaitCount=%d\n",
\r
1692 up, dn, m, n, WaitCount));
\r
1696 if(retryCount == 0) // no retry in the last 2-second duration
\r
1704 if(up >= n) // if ³sÄò n Ó2¬í retry count¬°0, «h½Õ¼eWiFi duration
\r
1711 RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], Increase wifi duration!!\n"));
\r
1714 else if (retryCount <= 3) // <=3 retry in the last 2-second duration
\r
1722 if (dn == 2) // if ³sÄò 2 Ó2¬í retry count< 3, «h½Õ¯¶WiFi duration
\r
1724 if (WaitCount <= 2)
\r
1725 m++; // ÁקK¤@ª½¦b¨âÓlevel¤¤¨Ó¦^
\r
1729 if ( m >= 20) //m ³Ì¤jÈ = 20 ' ³Ì¤j120¬í recheck¬O§_½Õ¾ã WiFi duration.
\r
1737 RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], Decrease wifi duration for retryCounter<3!!\n"));
\r
1740 else //retry count > 3, ¥un1¦¸ retry count > 3, «h½Õ¯¶WiFi duration
\r
1742 if (WaitCount == 1)
\r
1743 m++; // ÁקK¤@ª½¦b¨âÓlevel¤¤¨Ó¦^
\r
1747 if ( m >= 20) //m ³Ì¤jÈ = 20 ' ³Ì¤j120¬í recheck¬O§_½Õ¾ã WiFi duration.
\r
1755 RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], Decrease wifi duration for retryCounter>3!!\n"));
\r
1758 RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], max Interval = %d\n", maxInterval));
\r
1759 if(maxInterval == 1)
\r
1763 RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], TxPause = 1\n"));
\r
1765 if(pCoexDm->curPsTdma == 1)
\r
1767 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
\r
1768 pCoexDm->psTdmaDuAdjType = 5;
\r
1770 else if(pCoexDm->curPsTdma == 2)
\r
1772 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
\r
1773 pCoexDm->psTdmaDuAdjType = 6;
\r
1775 else if(pCoexDm->curPsTdma == 3)
\r
1777 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
\r
1778 pCoexDm->psTdmaDuAdjType = 7;
\r
1780 else if(pCoexDm->curPsTdma == 4)
\r
1782 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
\r
1783 pCoexDm->psTdmaDuAdjType = 8;
\r
1785 if(pCoexDm->curPsTdma == 9)
\r
1787 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 13);
\r
1788 pCoexDm->psTdmaDuAdjType = 13;
\r
1790 else if(pCoexDm->curPsTdma == 10)
\r
1792 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
\r
1793 pCoexDm->psTdmaDuAdjType = 14;
\r
1795 else if(pCoexDm->curPsTdma == 11)
\r
1797 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
\r
1798 pCoexDm->psTdmaDuAdjType = 15;
\r
1800 else if(pCoexDm->curPsTdma == 12)
\r
1802 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
\r
1803 pCoexDm->psTdmaDuAdjType = 16;
\r
1808 if(pCoexDm->curPsTdma == 5)
\r
1810 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
\r
1811 pCoexDm->psTdmaDuAdjType = 6;
\r
1813 else if(pCoexDm->curPsTdma == 6)
\r
1815 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
\r
1816 pCoexDm->psTdmaDuAdjType = 7;
\r
1818 else if(pCoexDm->curPsTdma == 7)
\r
1820 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
\r
1821 pCoexDm->psTdmaDuAdjType = 8;
\r
1823 else if(pCoexDm->curPsTdma == 13)
\r
1825 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
\r
1826 pCoexDm->psTdmaDuAdjType = 14;
\r
1828 else if(pCoexDm->curPsTdma == 14)
\r
1830 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
\r
1831 pCoexDm->psTdmaDuAdjType = 15;
\r
1833 else if(pCoexDm->curPsTdma == 15)
\r
1835 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
\r
1836 pCoexDm->psTdmaDuAdjType = 16;
\r
1839 else if (result == 1)
\r
1841 if(pCoexDm->curPsTdma == 8)
\r
1843 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
\r
1844 pCoexDm->psTdmaDuAdjType = 7;
\r
1846 else if(pCoexDm->curPsTdma == 7)
\r
1848 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
\r
1849 pCoexDm->psTdmaDuAdjType = 6;
\r
1851 else if(pCoexDm->curPsTdma == 6)
\r
1853 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);
\r
1854 pCoexDm->psTdmaDuAdjType = 5;
\r
1856 else if(pCoexDm->curPsTdma == 16)
\r
1858 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
\r
1859 pCoexDm->psTdmaDuAdjType = 15;
\r
1861 else if(pCoexDm->curPsTdma == 15)
\r
1863 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
\r
1864 pCoexDm->psTdmaDuAdjType = 14;
\r
1866 else if(pCoexDm->curPsTdma == 14)
\r
1868 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 13);
\r
1869 pCoexDm->psTdmaDuAdjType = 13;
\r
1875 RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], TxPause = 0\n"));
\r
1876 if(pCoexDm->curPsTdma == 5)
\r
1878 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);
\r
1879 pCoexDm->psTdmaDuAdjType = 1;
\r
1881 else if(pCoexDm->curPsTdma == 6)
\r
1883 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
\r
1884 pCoexDm->psTdmaDuAdjType = 2;
\r
1886 else if(pCoexDm->curPsTdma == 7)
\r
1888 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
\r
1889 pCoexDm->psTdmaDuAdjType = 3;
\r
1891 else if(pCoexDm->curPsTdma == 8)
\r
1893 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
\r
1894 pCoexDm->psTdmaDuAdjType = 4;
\r
1896 if(pCoexDm->curPsTdma == 13)
\r
1898 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
\r
1899 pCoexDm->psTdmaDuAdjType = 9;
\r
1901 else if(pCoexDm->curPsTdma == 14)
\r
1903 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
\r
1904 pCoexDm->psTdmaDuAdjType = 10;
\r
1906 else if(pCoexDm->curPsTdma == 15)
\r
1908 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
\r
1909 pCoexDm->psTdmaDuAdjType = 11;
\r
1911 else if(pCoexDm->curPsTdma == 16)
\r
1913 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
\r
1914 pCoexDm->psTdmaDuAdjType = 12;
\r
1919 if(pCoexDm->curPsTdma == 1)
\r
1921 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
\r
1922 pCoexDm->psTdmaDuAdjType = 2;
\r
1924 else if(pCoexDm->curPsTdma == 2)
\r
1926 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
\r
1927 pCoexDm->psTdmaDuAdjType = 3;
\r
1929 else if(pCoexDm->curPsTdma == 3)
\r
1931 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
\r
1932 pCoexDm->psTdmaDuAdjType = 4;
\r
1934 else if(pCoexDm->curPsTdma == 9)
\r
1936 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
\r
1937 pCoexDm->psTdmaDuAdjType = 10;
\r
1939 else if(pCoexDm->curPsTdma == 10)
\r
1941 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
\r
1942 pCoexDm->psTdmaDuAdjType = 11;
\r
1944 else if(pCoexDm->curPsTdma == 11)
\r
1946 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
\r
1947 pCoexDm->psTdmaDuAdjType = 12;
\r
1950 else if (result == 1)
\r
1952 if(pCoexDm->curPsTdma == 4)
\r
1954 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
\r
1955 pCoexDm->psTdmaDuAdjType = 3;
\r
1957 else if(pCoexDm->curPsTdma == 3)
\r
1959 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
\r
1960 pCoexDm->psTdmaDuAdjType = 2;
\r
1962 else if(pCoexDm->curPsTdma == 2)
\r
1964 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);
\r
1965 pCoexDm->psTdmaDuAdjType = 1;
\r
1967 else if(pCoexDm->curPsTdma == 12)
\r
1969 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
\r
1970 pCoexDm->psTdmaDuAdjType = 11;
\r
1972 else if(pCoexDm->curPsTdma == 11)
\r
1974 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
\r
1975 pCoexDm->psTdmaDuAdjType = 10;
\r
1977 else if(pCoexDm->curPsTdma == 10)
\r
1979 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
\r
1980 pCoexDm->psTdmaDuAdjType = 9;
\r
1985 else if(maxInterval == 2)
\r
1989 RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], TxPause = 1\n"));
\r
1990 if(pCoexDm->curPsTdma == 1)
\r
1992 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
\r
1993 pCoexDm->psTdmaDuAdjType = 6;
\r
1995 else if(pCoexDm->curPsTdma == 2)
\r
1997 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
\r
1998 pCoexDm->psTdmaDuAdjType = 6;
\r
2000 else if(pCoexDm->curPsTdma == 3)
\r
2002 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
\r
2003 pCoexDm->psTdmaDuAdjType = 7;
\r
2005 else if(pCoexDm->curPsTdma == 4)
\r
2007 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
\r
2008 pCoexDm->psTdmaDuAdjType = 8;
\r
2010 if(pCoexDm->curPsTdma == 9)
\r
2012 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
\r
2013 pCoexDm->psTdmaDuAdjType = 14;
\r
2015 else if(pCoexDm->curPsTdma == 10)
\r
2017 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
\r
2018 pCoexDm->psTdmaDuAdjType = 14;
\r
2020 else if(pCoexDm->curPsTdma == 11)
\r
2022 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
\r
2023 pCoexDm->psTdmaDuAdjType = 15;
\r
2025 else if(pCoexDm->curPsTdma == 12)
\r
2027 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
\r
2028 pCoexDm->psTdmaDuAdjType = 16;
\r
2032 if(pCoexDm->curPsTdma == 5)
\r
2034 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
\r
2035 pCoexDm->psTdmaDuAdjType = 6;
\r
2037 else if(pCoexDm->curPsTdma == 6)
\r
2039 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
\r
2040 pCoexDm->psTdmaDuAdjType = 7;
\r
2042 else if(pCoexDm->curPsTdma == 7)
\r
2044 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
\r
2045 pCoexDm->psTdmaDuAdjType = 8;
\r
2047 else if(pCoexDm->curPsTdma == 13)
\r
2049 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
\r
2050 pCoexDm->psTdmaDuAdjType = 14;
\r
2052 else if(pCoexDm->curPsTdma == 14)
\r
2054 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
\r
2055 pCoexDm->psTdmaDuAdjType = 15;
\r
2057 else if(pCoexDm->curPsTdma == 15)
\r
2059 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
\r
2060 pCoexDm->psTdmaDuAdjType = 16;
\r
2063 else if (result == 1)
\r
2065 if(pCoexDm->curPsTdma == 8)
\r
2067 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
\r
2068 pCoexDm->psTdmaDuAdjType = 7;
\r
2070 else if(pCoexDm->curPsTdma == 7)
\r
2072 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
\r
2073 pCoexDm->psTdmaDuAdjType = 6;
\r
2075 else if(pCoexDm->curPsTdma == 6)
\r
2077 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
\r
2078 pCoexDm->psTdmaDuAdjType = 6;
\r
2080 else if(pCoexDm->curPsTdma == 16)
\r
2082 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
\r
2083 pCoexDm->psTdmaDuAdjType = 15;
\r
2085 else if(pCoexDm->curPsTdma == 15)
\r
2087 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
\r
2088 pCoexDm->psTdmaDuAdjType = 14;
\r
2090 else if(pCoexDm->curPsTdma == 14)
\r
2092 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
\r
2093 pCoexDm->psTdmaDuAdjType = 14;
\r
2099 RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], TxPause = 0\n"));
\r
2100 if(pCoexDm->curPsTdma == 5)
\r
2102 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
\r
2103 pCoexDm->psTdmaDuAdjType = 2;
\r
2105 else if(pCoexDm->curPsTdma == 6)
\r
2107 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
\r
2108 pCoexDm->psTdmaDuAdjType = 2;
\r
2110 else if(pCoexDm->curPsTdma == 7)
\r
2112 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
\r
2113 pCoexDm->psTdmaDuAdjType = 3;
\r
2115 else if(pCoexDm->curPsTdma == 8)
\r
2117 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
\r
2118 pCoexDm->psTdmaDuAdjType = 4;
\r
2120 if(pCoexDm->curPsTdma == 13)
\r
2122 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
\r
2123 pCoexDm->psTdmaDuAdjType = 10;
\r
2125 else if(pCoexDm->curPsTdma == 14)
\r
2127 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
\r
2128 pCoexDm->psTdmaDuAdjType = 10;
\r
2130 else if(pCoexDm->curPsTdma == 15)
\r
2132 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
\r
2133 pCoexDm->psTdmaDuAdjType = 11;
\r
2135 else if(pCoexDm->curPsTdma == 16)
\r
2137 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
\r
2138 pCoexDm->psTdmaDuAdjType = 12;
\r
2142 if(pCoexDm->curPsTdma == 1)
\r
2144 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
\r
2145 pCoexDm->psTdmaDuAdjType = 2;
\r
2147 else if(pCoexDm->curPsTdma == 2)
\r
2149 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
\r
2150 pCoexDm->psTdmaDuAdjType = 3;
\r
2152 else if(pCoexDm->curPsTdma == 3)
\r
2154 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
\r
2155 pCoexDm->psTdmaDuAdjType = 4;
\r
2157 else if(pCoexDm->curPsTdma == 9)
\r
2159 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
\r
2160 pCoexDm->psTdmaDuAdjType = 10;
\r
2162 else if(pCoexDm->curPsTdma == 10)
\r
2164 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
\r
2165 pCoexDm->psTdmaDuAdjType = 11;
\r
2167 else if(pCoexDm->curPsTdma == 11)
\r
2169 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
\r
2170 pCoexDm->psTdmaDuAdjType = 12;
\r
2173 else if (result == 1)
\r
2175 if(pCoexDm->curPsTdma == 4)
\r
2177 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
\r
2178 pCoexDm->psTdmaDuAdjType = 3;
\r
2180 else if(pCoexDm->curPsTdma == 3)
\r
2182 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
\r
2183 pCoexDm->psTdmaDuAdjType = 2;
\r
2185 else if(pCoexDm->curPsTdma == 2)
\r
2187 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
\r
2188 pCoexDm->psTdmaDuAdjType = 2;
\r
2190 else if(pCoexDm->curPsTdma == 12)
\r
2192 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
\r
2193 pCoexDm->psTdmaDuAdjType = 11;
\r
2195 else if(pCoexDm->curPsTdma == 11)
\r
2197 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
\r
2198 pCoexDm->psTdmaDuAdjType = 10;
\r
2200 else if(pCoexDm->curPsTdma == 10)
\r
2202 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
\r
2203 pCoexDm->psTdmaDuAdjType = 10;
\r
2208 else if(maxInterval == 3)
\r
2212 RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], TxPause = 1\n"));
\r
2213 if(pCoexDm->curPsTdma == 1)
\r
2215 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
\r
2216 pCoexDm->psTdmaDuAdjType = 7;
\r
2218 else if(pCoexDm->curPsTdma == 2)
\r
2220 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
\r
2221 pCoexDm->psTdmaDuAdjType = 7;
\r
2223 else if(pCoexDm->curPsTdma == 3)
\r
2225 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
\r
2226 pCoexDm->psTdmaDuAdjType = 7;
\r
2228 else if(pCoexDm->curPsTdma == 4)
\r
2230 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
\r
2231 pCoexDm->psTdmaDuAdjType = 8;
\r
2233 if(pCoexDm->curPsTdma == 9)
\r
2235 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
\r
2236 pCoexDm->psTdmaDuAdjType = 15;
\r
2238 else if(pCoexDm->curPsTdma == 10)
\r
2240 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
\r
2241 pCoexDm->psTdmaDuAdjType = 15;
\r
2243 else if(pCoexDm->curPsTdma == 11)
\r
2245 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
\r
2246 pCoexDm->psTdmaDuAdjType = 15;
\r
2248 else if(pCoexDm->curPsTdma == 12)
\r
2250 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
\r
2251 pCoexDm->psTdmaDuAdjType = 16;
\r
2255 if(pCoexDm->curPsTdma == 5)
\r
2257 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
\r
2258 pCoexDm->psTdmaDuAdjType = 7;
\r
2260 else if(pCoexDm->curPsTdma == 6)
\r
2262 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
\r
2263 pCoexDm->psTdmaDuAdjType = 7;
\r
2265 else if(pCoexDm->curPsTdma == 7)
\r
2267 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
\r
2268 pCoexDm->psTdmaDuAdjType = 8;
\r
2270 else if(pCoexDm->curPsTdma == 13)
\r
2272 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
\r
2273 pCoexDm->psTdmaDuAdjType = 15;
\r
2275 else if(pCoexDm->curPsTdma == 14)
\r
2277 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
\r
2278 pCoexDm->psTdmaDuAdjType = 15;
\r
2280 else if(pCoexDm->curPsTdma == 15)
\r
2282 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
\r
2283 pCoexDm->psTdmaDuAdjType = 16;
\r
2286 else if (result == 1)
\r
2288 if(pCoexDm->curPsTdma == 8)
\r
2290 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
\r
2291 pCoexDm->psTdmaDuAdjType = 7;
\r
2293 else if(pCoexDm->curPsTdma == 7)
\r
2295 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
\r
2296 pCoexDm->psTdmaDuAdjType = 7;
\r
2298 else if(pCoexDm->curPsTdma == 6)
\r
2300 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);
\r
2301 pCoexDm->psTdmaDuAdjType = 7;
\r
2303 else if(pCoexDm->curPsTdma == 16)
\r
2305 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
\r
2306 pCoexDm->psTdmaDuAdjType = 15;
\r
2308 else if(pCoexDm->curPsTdma == 15)
\r
2310 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
\r
2311 pCoexDm->psTdmaDuAdjType = 15;
\r
2313 else if(pCoexDm->curPsTdma == 14)
\r
2315 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
\r
2316 pCoexDm->psTdmaDuAdjType = 15;
\r
2322 RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], TxPause = 0\n"));
\r
2323 if(pCoexDm->curPsTdma == 5)
\r
2325 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
\r
2326 pCoexDm->psTdmaDuAdjType = 3;
\r
2328 else if(pCoexDm->curPsTdma == 6)
\r
2330 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
\r
2331 pCoexDm->psTdmaDuAdjType = 3;
\r
2333 else if(pCoexDm->curPsTdma == 7)
\r
2335 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
\r
2336 pCoexDm->psTdmaDuAdjType = 3;
\r
2338 else if(pCoexDm->curPsTdma == 8)
\r
2340 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
\r
2341 pCoexDm->psTdmaDuAdjType = 4;
\r
2343 if(pCoexDm->curPsTdma == 13)
\r
2345 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
\r
2346 pCoexDm->psTdmaDuAdjType = 11;
\r
2348 else if(pCoexDm->curPsTdma == 14)
\r
2350 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
\r
2351 pCoexDm->psTdmaDuAdjType = 11;
\r
2353 else if(pCoexDm->curPsTdma == 15)
\r
2355 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
\r
2356 pCoexDm->psTdmaDuAdjType = 11;
\r
2358 else if(pCoexDm->curPsTdma == 16)
\r
2360 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
\r
2361 pCoexDm->psTdmaDuAdjType = 12;
\r
2365 if(pCoexDm->curPsTdma == 1)
\r
2367 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
\r
2368 pCoexDm->psTdmaDuAdjType = 3;
\r
2370 else if(pCoexDm->curPsTdma == 2)
\r
2372 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
\r
2373 pCoexDm->psTdmaDuAdjType = 3;
\r
2375 else if(pCoexDm->curPsTdma == 3)
\r
2377 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
\r
2378 pCoexDm->psTdmaDuAdjType = 4;
\r
2380 else if(pCoexDm->curPsTdma == 9)
\r
2382 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
\r
2383 pCoexDm->psTdmaDuAdjType = 11;
\r
2385 else if(pCoexDm->curPsTdma == 10)
\r
2387 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
\r
2388 pCoexDm->psTdmaDuAdjType = 11;
\r
2390 else if(pCoexDm->curPsTdma == 11)
\r
2392 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
\r
2393 pCoexDm->psTdmaDuAdjType = 12;
\r
2396 else if (result == 1)
\r
2398 if(pCoexDm->curPsTdma == 4)
\r
2400 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
\r
2401 pCoexDm->psTdmaDuAdjType = 3;
\r
2403 else if(pCoexDm->curPsTdma == 3)
\r
2405 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
\r
2406 pCoexDm->psTdmaDuAdjType = 3;
\r
2408 else if(pCoexDm->curPsTdma == 2)
\r
2410 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);
\r
2411 pCoexDm->psTdmaDuAdjType = 3;
\r
2413 else if(pCoexDm->curPsTdma == 12)
\r
2415 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
\r
2416 pCoexDm->psTdmaDuAdjType = 11;
\r
2418 else if(pCoexDm->curPsTdma == 11)
\r
2420 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
\r
2421 pCoexDm->psTdmaDuAdjType = 11;
\r
2423 else if(pCoexDm->curPsTdma == 10)
\r
2425 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
\r
2426 pCoexDm->psTdmaDuAdjType = 11;
\r
2433 // if current PsTdma not match with the recorded one (when scan, dhcp...),
\r
2434 // then we have to adjust it back to the previous record one.
\r
2435 if(pCoexDm->curPsTdma != pCoexDm->psTdmaDuAdjType)
\r
2437 BOOLEAN bScan=FALSE, bLink=FALSE, bRoam=FALSE;
\r
2438 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], PsTdma type dismatch!!!, curPsTdma=%d, recordPsTdma=%d\n",
\r
2439 pCoexDm->curPsTdma, pCoexDm->psTdmaDuAdjType));
\r
2441 pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_SCAN, &bScan);
\r
2442 pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_LINK, &bLink);
\r
2443 pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_ROAM, &bRoam);
\r
2445 if( !bScan && !bLink && !bRoam)
\r
2447 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, pCoexDm->psTdmaDuAdjType);
\r
2451 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], roaming/link/scan is under progress, will adjust next time!!!\n"));
\r
2456 // SCO only or SCO+PAN(HS)
\r
2458 halbtc8723a2ant_ActionSco(
\r
2459 IN PBTC_COEXIST pBtCoexist
\r
2462 u1Byte wifiRssiState, wifiRssiState1;
\r
2465 if(halbtc8723a2ant_NeedToDecBtPwr(pBtCoexist))
\r
2466 halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
\r
2468 halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
\r
2469 halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);
\r
2471 pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
\r
2472 if(BTC_WIFI_BW_HT40 == wifiBw)
\r
2474 wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 37, 0);
\r
2476 if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
\r
2477 (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
\r
2479 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
\r
2483 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
\r
2487 halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
\r
2488 halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
\r
2489 halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
\r
2493 wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 27, 0);
\r
2494 wifiRssiState1 = halbtc8723a2ant_WifiRssiState(pBtCoexist, 1, 2, 47, 0);
\r
2497 if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
\r
2498 (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
\r
2500 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);
\r
2504 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);
\r
2508 if( (wifiRssiState1 == BTC_RSSI_STATE_HIGH) ||
\r
2509 (wifiRssiState1 == BTC_RSSI_STATE_STAY_HIGH) )
\r
2511 halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);
\r
2512 halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
\r
2513 halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
\r
2517 halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
\r
2518 halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
\r
2519 halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
\r
2526 halbtc8723a2ant_ActionHid(
\r
2527 IN PBTC_COEXIST pBtCoexist
\r
2530 u1Byte wifiRssiState, wifiRssiState1;
\r
2533 if(halbtc8723a2ant_NeedToDecBtPwr(pBtCoexist))
\r
2534 halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
\r
2536 halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
\r
2537 halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);
\r
2539 pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
\r
2540 if(BTC_WIFI_BW_HT40 == wifiBw)
\r
2542 wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 37, 0);
\r
2544 if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
\r
2545 (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
\r
2547 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
\r
2551 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 13);
\r
2555 halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
\r
2556 halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
\r
2557 halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
\r
2561 wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 27, 0);
\r
2562 wifiRssiState1 = halbtc8723a2ant_WifiRssiState(pBtCoexist, 1, 2, 47, 0);
\r
2565 if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
\r
2566 (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
\r
2568 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);
\r
2572 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 13);
\r
2576 if( (wifiRssiState1 == BTC_RSSI_STATE_HIGH) ||
\r
2577 (wifiRssiState1 == BTC_RSSI_STATE_STAY_HIGH) )
\r
2579 halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);
\r
2580 halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
\r
2581 halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
\r
2585 halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
\r
2586 halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
\r
2587 halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
\r
2592 //A2DP only / PAN(EDR) only/ A2DP+PAN(HS)
\r
2594 halbtc8723a2ant_ActionA2dp(
\r
2595 IN PBTC_COEXIST pBtCoexist
\r
2598 u1Byte wifiRssiState, wifiRssiState1, btInfoExt;
\r
2601 btInfoExt = pCoexSta->btInfoExt;
\r
2603 if(halbtc8723a2ant_NeedToDecBtPwr(pBtCoexist))
\r
2604 halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
\r
2606 halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
\r
2607 halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);
\r
2609 pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
\r
2610 if(BTC_WIFI_BW_HT40 == wifiBw)
\r
2612 wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 37, 0);
\r
2615 if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
\r
2616 (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
\r
2618 if(btInfoExt&BIT0) //a2dp rate, 1:basic /0:edr
\r
2620 halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 3);
\r
2624 halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 1);
\r
2629 if(btInfoExt&BIT0) //a2dp rate, 1:basic /0:edr
\r
2631 halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 3);
\r
2635 halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 1);
\r
2640 halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
\r
2641 halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
\r
2642 halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
\r
2646 wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 27, 0);
\r
2647 wifiRssiState1 = halbtc8723a2ant_WifiRssiState(pBtCoexist, 1, 2, 47, 0);
\r
2650 if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
\r
2651 (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
\r
2653 if(btInfoExt&BIT0) //a2dp rate, 1:basic /0:edr
\r
2655 halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 3);
\r
2659 halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 1);
\r
2664 if(btInfoExt&BIT0) //a2dp rate, 1:basic /0:edr
\r
2666 halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 3);
\r
2670 halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 1);
\r
2675 if( (wifiRssiState1 == BTC_RSSI_STATE_HIGH) ||
\r
2676 (wifiRssiState1 == BTC_RSSI_STATE_STAY_HIGH) )
\r
2678 halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);
\r
2679 halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
\r
2680 halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
\r
2684 halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
\r
2685 halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
\r
2686 halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
\r
2692 halbtc8723a2ant_ActionPanEdr(
\r
2693 IN PBTC_COEXIST pBtCoexist
\r
2696 u1Byte wifiRssiState, wifiRssiState1, btInfoExt;
\r
2699 btInfoExt = pCoexSta->btInfoExt;
\r
2701 if(halbtc8723a2ant_NeedToDecBtPwr(pBtCoexist))
\r
2702 halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
\r
2704 halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
\r
2705 halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);
\r
2707 pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
\r
2708 if(BTC_WIFI_BW_HT40 == wifiBw)
\r
2710 wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 37, 0);
\r
2713 if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
\r
2714 (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
\r
2716 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
\r
2720 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
\r
2724 halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
\r
2725 halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
\r
2726 halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
\r
2730 wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 27, 0);
\r
2731 wifiRssiState1 = halbtc8723a2ant_WifiRssiState(pBtCoexist, 1, 2, 47, 0);
\r
2734 if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
\r
2735 (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
\r
2737 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
\r
2741 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
\r
2745 if( (wifiRssiState1 == BTC_RSSI_STATE_HIGH) ||
\r
2746 (wifiRssiState1 == BTC_RSSI_STATE_STAY_HIGH) )
\r
2748 halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);
\r
2749 halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
\r
2750 halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
\r
2754 halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
\r
2755 halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
\r
2756 halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
\r
2764 halbtc8723a2ant_ActionPanHs(
\r
2765 IN PBTC_COEXIST pBtCoexist
\r
2768 u1Byte wifiRssiState;
\r
2771 halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);
\r
2773 pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
\r
2774 if(BTC_WIFI_BW_HT40 == wifiBw)
\r
2776 wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 37, 0);
\r
2779 if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
\r
2780 (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
\r
2782 halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
\r
2786 halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
\r
2788 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
\r
2791 halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
\r
2792 halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
\r
2793 halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
\r
2797 wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 37, 0);
\r
2800 if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
\r
2801 (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
\r
2803 halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
\r
2804 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
\r
2808 halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
\r
2809 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);
\r
2813 if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
\r
2814 (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
\r
2816 halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);
\r
2817 halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
\r
2818 halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
\r
2822 halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
\r
2823 halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
\r
2824 halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
\r
2831 halbtc8723a2ant_ActionPanEdrA2dp(
\r
2832 IN PBTC_COEXIST pBtCoexist
\r
2835 u1Byte wifiRssiState, wifiRssiState1, btInfoExt;
\r
2838 btInfoExt = pCoexSta->btInfoExt;
\r
2840 if(halbtc8723a2ant_NeedToDecBtPwr(pBtCoexist))
\r
2841 halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
\r
2843 halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
\r
2844 halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);
\r
2846 pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
\r
2847 if(BTC_WIFI_BW_HT40 == wifiBw)
\r
2849 wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 37, 0);
\r
2852 if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
\r
2853 (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
\r
2855 if(btInfoExt&BIT0) //a2dp basic rate
\r
2857 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
\r
2859 else //a2dp edr rate
\r
2861 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
\r
2866 if(btInfoExt&BIT0) //a2dp basic rate
\r
2868 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
\r
2870 else //a2dp edr rate
\r
2872 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
\r
2877 halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
\r
2878 halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
\r
2879 halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
\r
2883 wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 27, 0);
\r
2884 wifiRssiState1 = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 47, 0);
\r
2887 if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
\r
2888 (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
\r
2890 if(btInfoExt&BIT0) //a2dp basic rate
\r
2892 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);
\r
2894 else //a2dp edr rate
\r
2896 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);
\r
2901 if(btInfoExt&BIT0) //a2dp basic rate
\r
2903 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);
\r
2905 else //a2dp edr rate
\r
2907 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);
\r
2912 if( (wifiRssiState1 == BTC_RSSI_STATE_HIGH) ||
\r
2913 (wifiRssiState1 == BTC_RSSI_STATE_STAY_HIGH) )
\r
2915 halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);
\r
2916 halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
\r
2917 halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
\r
2921 halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
\r
2922 halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
\r
2923 halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
\r
2929 halbtc8723a2ant_ActionPanEdrHid(
\r
2930 IN PBTC_COEXIST pBtCoexist
\r
2933 u1Byte wifiRssiState, wifiRssiState1;
\r
2936 if(halbtc8723a2ant_NeedToDecBtPwr(pBtCoexist))
\r
2937 halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
\r
2939 halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
\r
2940 halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);
\r
2942 pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
\r
2943 if(BTC_WIFI_BW_HT40 == wifiBw)
\r
2945 wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 37, 0);
\r
2948 if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
\r
2949 (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
\r
2951 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
\r
2955 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
\r
2959 halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
\r
2960 halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
\r
2961 halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
\r
2965 wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 27, 0);
\r
2966 wifiRssiState1 = halbtc8723a2ant_WifiRssiState(pBtCoexist, 1, 2, 47, 0);
\r
2969 if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
\r
2970 (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
\r
2972 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
\r
2976 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
\r
2980 if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
\r
2981 (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
\r
2983 halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);
\r
2984 halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
\r
2985 halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
\r
2989 halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
\r
2990 halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
\r
2991 halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
\r
2996 // HID+A2DP+PAN(EDR)
\r
2998 halbtc8723a2ant_ActionHidA2dpPanEdr(
\r
2999 IN PBTC_COEXIST pBtCoexist
\r
3002 u1Byte wifiRssiState, wifiRssiState1, btInfoExt;
\r
3005 btInfoExt = pCoexSta->btInfoExt;
\r
3007 if(halbtc8723a2ant_NeedToDecBtPwr(pBtCoexist))
\r
3008 halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
\r
3010 halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
\r
3011 halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);
\r
3013 pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
\r
3014 if(BTC_WIFI_BW_HT40 == wifiBw)
\r
3016 wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 37, 0);
\r
3019 if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
\r
3020 (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
\r
3022 if(btInfoExt&BIT0) //a2dp basic rate
\r
3024 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
\r
3026 else //a2dp edr rate
\r
3028 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
\r
3033 if(btInfoExt&BIT0) //a2dp basic rate
\r
3035 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
\r
3037 else //a2dp edr rate
\r
3039 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
\r
3044 halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
\r
3045 halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
\r
3046 halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
\r
3050 wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 27, 0);
\r
3051 wifiRssiState1 = halbtc8723a2ant_WifiRssiState(pBtCoexist, 1, 2, 47, 0);
\r
3054 if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
\r
3055 (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
\r
3057 if(btInfoExt&BIT0) //a2dp basic rate
\r
3059 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);
\r
3061 else //a2dp edr rate
\r
3063 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);
\r
3068 if(btInfoExt&BIT0) //a2dp basic rate
\r
3070 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);
\r
3072 else //a2dp edr rate
\r
3074 halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);
\r
3079 if( (wifiRssiState1 == BTC_RSSI_STATE_HIGH) ||
\r
3080 (wifiRssiState1 == BTC_RSSI_STATE_STAY_HIGH) )
\r
3082 halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);
\r
3083 halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
\r
3084 halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
\r
3088 halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
\r
3089 halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
\r
3090 halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
\r
3096 halbtc8723a2ant_ActionHidA2dp(
\r
3097 IN PBTC_COEXIST pBtCoexist
\r
3100 u1Byte wifiRssiState, wifiRssiState1, btInfoExt;
\r
3103 btInfoExt = pCoexSta->btInfoExt;
\r
3105 if(halbtc8723a2ant_NeedToDecBtPwr(pBtCoexist))
\r
3106 halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);
\r
3108 halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);
\r
3109 halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);
\r
3111 pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);
\r
3112 if(BTC_WIFI_BW_HT40 == wifiBw)
\r
3114 wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 37, 0);
\r
3117 if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
\r
3118 (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
\r
3120 if(btInfoExt&BIT0) //a2dp basic rate
\r
3122 halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, FALSE, 3);
\r
3124 else //a2dp edr rate
\r
3126 halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, FALSE, 1);
\r
3131 if(btInfoExt&BIT0) //a2dp basic rate
\r
3133 halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 3);
\r
3135 else //a2dp edr rate
\r
3137 halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 1);
\r
3142 halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
\r
3143 halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
\r
3144 halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
\r
3148 wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 27, 0);
\r
3149 wifiRssiState1 = halbtc8723a2ant_WifiRssiState(pBtCoexist, 1, 2, 47, 0);
\r
3152 if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||
\r
3153 (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )
\r
3155 if(btInfoExt&BIT0) //a2dp basic rate
\r
3157 halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, FALSE, 3);
\r
3159 else //a2dp edr rate
\r
3161 halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, FALSE, 1);
\r
3166 if(btInfoExt&BIT0) //a2dp basic rate
\r
3168 halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 3);
\r
3170 else //a2dp edr rate
\r
3172 halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 1);
\r
3177 if( (wifiRssiState1 == BTC_RSSI_STATE_HIGH) ||
\r
3178 (wifiRssiState1 == BTC_RSSI_STATE_STAY_HIGH) )
\r
3180 halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);
\r
3181 halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);
\r
3182 halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
\r
3186 halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);
\r
3187 halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);
\r
3188 halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);
\r
3194 halbtc8723a2ant_RunCoexistMechanism(
\r
3195 IN PBTC_COEXIST pBtCoexist
\r
3198 PBTC_STACK_INFO pStackInfo=&pBtCoexist->stackInfo;
\r
3199 u1Byte btInfoOriginal=0, btRetryCnt=0;
\r
3200 u1Byte algorithm=0;
\r
3202 if(pBtCoexist->bManualControl)
\r
3204 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Manual control!!!\n"));
\r
3208 if(pStackInfo->bProfileNotified)
\r
3210 if(pCoexSta->bHoldForStackOperation)
\r
3212 // if bt inquiry/page/pair, do not execute.
\r
3216 algorithm = halbtc8723a2ant_ActionAlgorithm(pBtCoexist);
\r
3217 if(pCoexSta->bHoldPeriodCnt && (BT_8723A_2ANT_COEX_ALGO_PANHS!=algorithm))
\r
3219 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex],Hold BT inquiry/page scan setting (cnt = %d)!!\n",
\r
3220 pCoexSta->bHoldPeriodCnt));
\r
3221 if(pCoexSta->bHoldPeriodCnt >= 6)
\r
3223 pCoexSta->bHoldPeriodCnt = 0;
\r
3224 // next time the coexist parameters should be reset again.
\r
3227 pCoexSta->bHoldPeriodCnt++;
\r
3231 pCoexDm->curAlgorithm = algorithm;
\r
3232 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Algorithm = %d \n", pCoexDm->curAlgorithm));
\r
3233 if(halbtc8723a2ant_IsCommonAction(pBtCoexist))
\r
3235 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Action 2-Ant common.\n"));
\r
3236 pCoexDm->bResetTdmaAdjust = TRUE;
\r
3240 if(pCoexDm->curAlgorithm != pCoexDm->preAlgorithm)
\r
3242 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], preAlgorithm=%d, curAlgorithm=%d\n",
\r
3243 pCoexDm->preAlgorithm, pCoexDm->curAlgorithm));
\r
3244 pCoexDm->bResetTdmaAdjust = TRUE;
\r
3246 switch(pCoexDm->curAlgorithm)
\r
3248 case BT_8723A_2ANT_COEX_ALGO_SCO:
\r
3249 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Action 2-Ant, algorithm = SCO.\n"));
\r
3250 halbtc8723a2ant_ActionSco(pBtCoexist);
\r
3252 case BT_8723A_2ANT_COEX_ALGO_HID:
\r
3253 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Action 2-Ant, algorithm = HID.\n"));
\r
3254 halbtc8723a2ant_ActionHid(pBtCoexist);
\r
3256 case BT_8723A_2ANT_COEX_ALGO_A2DP:
\r
3257 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Action 2-Ant, algorithm = A2DP.\n"));
\r
3258 halbtc8723a2ant_ActionA2dp(pBtCoexist);
\r
3260 case BT_8723A_2ANT_COEX_ALGO_PANEDR:
\r
3261 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Action 2-Ant, algorithm = PAN(EDR).\n"));
\r
3262 halbtc8723a2ant_ActionPanEdr(pBtCoexist);
\r
3264 case BT_8723A_2ANT_COEX_ALGO_PANHS:
\r
3265 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Action 2-Ant, algorithm = HS mode.\n"));
\r
3266 halbtc8723a2ant_ActionPanHs(pBtCoexist);
\r
3268 case BT_8723A_2ANT_COEX_ALGO_PANEDR_A2DP:
\r
3269 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Action 2-Ant, algorithm = PAN+A2DP.\n"));
\r
3270 halbtc8723a2ant_ActionPanEdrA2dp(pBtCoexist);
\r
3272 case BT_8723A_2ANT_COEX_ALGO_PANEDR_HID:
\r
3273 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Action 2-Ant, algorithm = PAN(EDR)+HID.\n"));
\r
3274 halbtc8723a2ant_ActionPanEdrHid(pBtCoexist);
\r
3276 case BT_8723A_2ANT_COEX_ALGO_HID_A2DP_PANEDR:
\r
3277 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Action 2-Ant, algorithm = HID+A2DP+PAN.\n"));
\r
3278 halbtc8723a2ant_ActionHidA2dpPanEdr(pBtCoexist);
\r
3280 case BT_8723A_2ANT_COEX_ALGO_HID_A2DP:
\r
3281 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Action 2-Ant, algorithm = HID+A2DP.\n"));
\r
3282 halbtc8723a2ant_ActionHidA2dp(pBtCoexist);
\r
3285 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Action 2-Ant, algorithm = coexist All Off!!\n"));
\r
3286 halbtc8723a2ant_CoexAllOff(pBtCoexist);
\r
3289 pCoexDm->preAlgorithm = pCoexDm->curAlgorithm;
\r
3294 //============================================================
\r
3295 // work around function start with wa_halbtc8723a2ant_
\r
3296 //============================================================
\r
3298 wa_halbtc8723a2ant_MonitorC2h(
\r
3299 IN PBTC_COEXIST pBtCoexist
\r
3303 u4Byte curC2hTotalCnt=0x0;
\r
3304 static u4Byte preC2hTotalCnt=0x0, sameCntPollingTime=0x0;
\r
3306 curC2hTotalCnt+=pCoexSta->btInfoC2hCnt[BT_INFO_SRC_8723A_2ANT_BT_RSP];
\r
3308 if(curC2hTotalCnt == preC2hTotalCnt)
\r
3310 sameCntPollingTime++;
\r
3314 preC2hTotalCnt = curC2hTotalCnt;
\r
3315 sameCntPollingTime = 0;
\r
3318 if(sameCntPollingTime >= 2)
\r
3320 tmp1b = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x1af);
\r
3323 pCoexSta->c2hHangDetectCnt++;
\r
3324 pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x1af, 0x0);
\r
3329 //============================================================
\r
3330 // extern function start with EXhalbtc8723a2ant_
\r
3331 //============================================================
\r
3333 EXhalbtc8723a2ant_PowerOnSetting(
\r
3334 IN PBTC_COEXIST pBtCoexist
\r
3340 EXhalbtc8723a2ant_InitHwConfig(
\r
3341 IN PBTC_COEXIST pBtCoexist,
\r
3342 IN BOOLEAN bWifiOnly
\r
3348 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], 2Ant Init HW Config!!\n"));
\r
3350 // backup rf 0x1e value
\r
3351 pCoexDm->btRf0x1eBackup =
\r
3352 pBtCoexist->fBtcGetRfReg(pBtCoexist, BTC_RF_A, 0x1e, 0xfffff);
\r
3354 // Enable counter statistics
\r
3355 pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x76e, 0x4);
\r
3356 pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x778, 0x3);
\r
3357 pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x40, 0x20);
\r
3361 EXhalbtc8723a2ant_InitCoexDm(
\r
3362 IN PBTC_COEXIST pBtCoexist
\r
3365 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Coex Mechanism Init!!\n"));
\r
3367 halbtc8723a2ant_InitCoexDm(pBtCoexist);
\r
3371 EXhalbtc8723a2ant_DisplayCoexInfo(
\r
3372 IN PBTC_COEXIST pBtCoexist
\r
3375 PBTC_BOARD_INFO pBoardInfo=&pBtCoexist->boardInfo;
\r
3376 PBTC_STACK_INFO pStackInfo=&pBtCoexist->stackInfo;
\r
3377 pu1Byte cliBuf=pBtCoexist->cliBuf;
\r
3378 u1Byte u1Tmp[4], i, btInfoExt, psTdmaCase=0;
\r
3381 CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n ============[BT Coexist info]============");
\r
3382 CL_PRINTF(cliBuf);
\r
3384 CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d ", "Ant PG number/ Ant mechanism:", \
\r
3385 pBoardInfo->pgAntNum, pBoardInfo->btdmAntNum);
\r
3386 CL_PRINTF(cliBuf);
\r
3388 if(pBtCoexist->bManualControl)
\r
3390 CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s", "[Action Manual control]!!");
\r
3391 CL_PRINTF(cliBuf);
\r
3394 CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %s / %d", "BT stack/ hci ext ver", \
\r
3395 ((pStackInfo->bProfileNotified)? "Yes":"No"), pStackInfo->hciVersion);
\r
3396 CL_PRINTF(cliBuf);
\r
3398 CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %02x %02x %02x ", "Wifi channel informed to BT", \
\r
3399 pCoexDm->wifiChnlInfo[0], pCoexDm->wifiChnlInfo[1],
\r
3400 pCoexDm->wifiChnlInfo[2]);
\r
3401 CL_PRINTF(cliBuf);
\r
3404 CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s", "============[Wifi Status]============");
\r
3405 CL_PRINTF(cliBuf);
\r
3406 pBtCoexist->fBtcDispDbgMsg(pBtCoexist, BTC_DBG_DISP_WIFI_STATUS);
\r
3408 CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s", "============[BT Status]============");
\r
3409 CL_PRINTF(cliBuf);
\r
3411 CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = [%s/ %d/ %d] ", "BT [status/ rssi/ retryCnt]", \
\r
3412 ((pCoexSta->bC2hBtInquiryPage)?("inquiry/page scan"):((BT_8723A_2ANT_BT_STATUS_IDLE == pCoexDm->btStatus)? "idle":( (BT_8723A_2ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus)? "connected-idle":"busy"))),
\r
3413 pCoexSta->btRssi, pCoexSta->btRetryCnt);
\r
3414 CL_PRINTF(cliBuf);
\r
3416 if(pStackInfo->bProfileNotified)
\r
3418 CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d / %d / %d / %d", "SCO/HID/PAN/A2DP", \
\r
3419 pStackInfo->bScoExist, pStackInfo->bHidExist, pStackInfo->bPanExist, pStackInfo->bA2dpExist);
\r
3420 CL_PRINTF(cliBuf);
\r
3422 pBtCoexist->fBtcDispDbgMsg(pBtCoexist, BTC_DBG_DISP_BT_LINK_INFO);
\r
3425 btInfoExt = pCoexSta->btInfoExt;
\r
3426 CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %s", "BT Info A2DP rate", \
\r
3427 (btInfoExt&BIT0)? "Basic rate":"EDR rate");
\r
3428 CL_PRINTF(cliBuf);
\r
3430 for(i=0; i<BT_INFO_SRC_8723A_2ANT_MAX; i++)
\r
3432 if(pCoexSta->btInfoC2hCnt[i])
\r
3434 CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %02x %02x %02x %02x %02x %02x %02x(%d)", GLBtInfoSrc8723a2Ant[i], \
\r
3435 pCoexSta->btInfoC2h[i][0], pCoexSta->btInfoC2h[i][1],
\r
3436 pCoexSta->btInfoC2h[i][2], pCoexSta->btInfoC2h[i][3],
\r
3437 pCoexSta->btInfoC2h[i][4], pCoexSta->btInfoC2h[i][5],
\r
3438 pCoexSta->btInfoC2h[i][6], pCoexSta->btInfoC2hCnt[i]);
\r
3439 CL_PRINTF(cliBuf);
\r
3443 CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d", "write 0x1af=0x0 num", \
\r
3444 pCoexSta->c2hHangDetectCnt);
\r
3445 CL_PRINTF(cliBuf);
\r
3448 CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s", "============[Sw mechanism]============");
\r
3449 CL_PRINTF(cliBuf);
\r
3450 CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d/ %d", "SM1[ShRf/ LpRA/ LimDig]", \
\r
3451 pCoexDm->bCurRfRxLpfShrink, pCoexDm->bCurLowPenaltyRa, pCoexDm->bLimitedDig);
\r
3452 CL_PRINTF(cliBuf);
\r
3453 CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d/ %d(0x%x) ", "SM2[AgcT/ AdcB/ SwDacSwing(lvl)]", \
\r
3454 pCoexDm->bCurAgcTableEn, pCoexDm->bCurAdcBackOff, pCoexDm->bCurDacSwingOn, pCoexDm->curDacSwingLvl);
\r
3455 CL_PRINTF(cliBuf);
\r
3458 CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s", "============[Fw mechanism]============");
\r
3459 CL_PRINTF(cliBuf);
\r
3461 if(!pBtCoexist->bManualControl)
\r
3463 psTdmaCase = pCoexDm->curPsTdma;
\r
3464 CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %02x %02x %02x %02x %02x case-%d", "PS TDMA", \
\r
3465 pCoexDm->psTdmaPara[0], pCoexDm->psTdmaPara[1],
\r
3466 pCoexDm->psTdmaPara[2], pCoexDm->psTdmaPara[3],
\r
3467 pCoexDm->psTdmaPara[4], psTdmaCase);
\r
3468 CL_PRINTF(cliBuf);
\r
3470 CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d ", "DecBtPwr/ IgnWlanAct", \
\r
3471 pCoexDm->bCurDecBtPwr, pCoexDm->bCurIgnoreWlanAct);
\r
3472 CL_PRINTF(cliBuf);
\r
3476 CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s", "============[Hw setting]============");
\r
3477 CL_PRINTF(cliBuf);
\r
3479 CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "RF-A, 0x1e initVal", \
\r
3480 pCoexDm->btRf0x1eBackup);
\r
3481 CL_PRINTF(cliBuf);
\r
3483 u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x778);
\r
3484 u1Tmp[1] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x783);
\r
3485 u1Tmp[2] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x796);
\r
3486 CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x", "0x778/ 0x783/ 0x796", \
\r
3487 u1Tmp[0], u1Tmp[1], u1Tmp[2]);
\r
3488 CL_PRINTF(cliBuf);
\r
3490 u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x880);
\r
3491 CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0x880", \
\r
3493 CL_PRINTF(cliBuf);
\r
3495 u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x40);
\r
3496 CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0x40", \
\r
3498 CL_PRINTF(cliBuf);
\r
3500 u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x550);
\r
3501 u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x522);
\r
3502 CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x", "0x550(bcn ctrl)/0x522", \
\r
3503 u4Tmp[0], u1Tmp[0]);
\r
3504 CL_PRINTF(cliBuf);
\r
3506 u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x484);
\r
3507 CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0x484(rate adaptive)", \
\r
3509 CL_PRINTF(cliBuf);
\r
3511 u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xc50);
\r
3512 CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0xc50(dig)", \
\r
3514 CL_PRINTF(cliBuf);
\r
3516 u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xda0);
\r
3517 u4Tmp[1] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xda4);
\r
3518 u4Tmp[2] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xda8);
\r
3519 u4Tmp[3] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xdac);
\r
3520 CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x/ 0x%x", "0xda0/0xda4/0xda8/0xdac(FA cnt)", \
\r
3521 u4Tmp[0], u4Tmp[1], u4Tmp[2], u4Tmp[3]);
\r
3522 CL_PRINTF(cliBuf);
\r
3524 u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x6c0);
\r
3525 u4Tmp[1] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x6c4);
\r
3526 u4Tmp[2] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x6c8);
\r
3527 u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x6cc);
\r
3528 CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x/ 0x%x", "0x6c0/0x6c4/0x6c8/0x6cc(coexTable)", \
\r
3529 u4Tmp[0], u4Tmp[1], u4Tmp[2], u1Tmp[0]);
\r
3530 CL_PRINTF(cliBuf);
\r
3532 CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d", "0x770 (hp rx[31:16]/tx[15:0])", \
\r
3533 pCoexSta->highPriorityRx, pCoexSta->highPriorityTx);
\r
3534 CL_PRINTF(cliBuf);
\r
3535 CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d", "0x774(lp rx[31:16]/tx[15:0])", \
\r
3536 pCoexSta->lowPriorityRx, pCoexSta->lowPriorityTx);
\r
3537 CL_PRINTF(cliBuf);
\r
3539 pBtCoexist->fBtcDispDbgMsg(pBtCoexist, BTC_DBG_DISP_COEX_STATISTICS);
\r
3544 EXhalbtc8723a2ant_IpsNotify(
\r
3545 IN PBTC_COEXIST pBtCoexist,
\r
3549 if(BTC_IPS_ENTER == type)
\r
3551 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], IPS ENTER notify\n"));
\r
3552 halbtc8723a2ant_CoexAllOff(pBtCoexist);
\r
3554 else if(BTC_IPS_LEAVE == type)
\r
3556 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], IPS LEAVE notify\n"));
\r
3557 //halbtc8723a2ant_InitCoexDm(pBtCoexist);
\r
3562 EXhalbtc8723a2ant_LpsNotify(
\r
3563 IN PBTC_COEXIST pBtCoexist,
\r
3567 if(BTC_LPS_ENABLE == type)
\r
3569 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], LPS ENABLE notify\n"));
\r
3571 else if(BTC_LPS_DISABLE == type)
\r
3573 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], LPS DISABLE notify\n"));
\r
3578 EXhalbtc8723a2ant_ScanNotify(
\r
3579 IN PBTC_COEXIST pBtCoexist,
\r
3583 if(BTC_SCAN_START == type)
\r
3585 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], SCAN START notify\n"));
\r
3587 else if(BTC_SCAN_FINISH == type)
\r
3589 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], SCAN FINISH notify\n"));
\r
3594 EXhalbtc8723a2ant_ConnectNotify(
\r
3595 IN PBTC_COEXIST pBtCoexist,
\r
3599 if(BTC_ASSOCIATE_START == type)
\r
3601 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], CONNECT START notify\n"));
\r
3603 else if(BTC_ASSOCIATE_FINISH == type)
\r
3605 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], CONNECT FINISH notify\n"));
\r
3610 EXhalbtc8723a2ant_MediaStatusNotify(
\r
3611 IN PBTC_COEXIST pBtCoexist,
\r
3615 if(BTC_MEDIA_CONNECT == type)
\r
3617 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], MEDIA connect notify\n"));
\r
3621 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], MEDIA disconnect notify\n"));
\r
3624 halbtc8723a2ant_IndicateWifiChnlBwInfo(pBtCoexist, type);
\r
3628 EXhalbtc8723a2ant_SpecialPacketNotify(
\r
3629 IN PBTC_COEXIST pBtCoexist,
\r
3633 if(type == BTC_PACKET_DHCP)
\r
3635 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], DHCP Packet notify\n"));
\r
3640 EXhalbtc8723a2ant_BtInfoNotify(
\r
3641 IN PBTC_COEXIST pBtCoexist,
\r
3642 IN pu1Byte tmpBuf,
\r
3647 u1Byte i, rspSource=0;
\r
3648 BOOLEAN bBtBusy=FALSE, bLimitedDig=FALSE;
\r
3649 BOOLEAN bWifiConnected=FALSE, bBtHsOn=FALSE;
\r
3651 pCoexSta->bC2hBtInfoReqSent = FALSE;
\r
3653 rspSource = BT_INFO_SRC_8723A_2ANT_BT_RSP;
\r
3654 pCoexSta->btInfoC2hCnt[rspSource]++;
\r
3656 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Bt info[%d], length=%d, hex data=[", rspSource, length));
\r
3657 for(i=0; i<length; i++)
\r
3659 pCoexSta->btInfoC2h[rspSource][i] = tmpBuf[i];
\r
3661 btInfo = tmpBuf[i];
\r
3664 RT_TRACE(COMP_COEX, DBG_LOUD, ("0x%02x]\n", tmpBuf[i]));
\r
3668 RT_TRACE(COMP_COEX, DBG_LOUD, ("0x%02x, ", tmpBuf[i]));
\r
3672 if(BT_INFO_SRC_8723A_2ANT_WIFI_FW != rspSource)
\r
3674 pCoexSta->btRetryCnt =
\r
3675 pCoexSta->btInfoC2h[rspSource][1];
\r
3677 pCoexSta->btRssi =
\r
3678 pCoexSta->btInfoC2h[rspSource][2]*2+10;
\r
3680 pCoexSta->btInfoExt =
\r
3681 pCoexSta->btInfoC2h[rspSource][3];
\r
3684 pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);
\r
3685 // check BIT2 first ==> check if bt is under inquiry or page scan
\r
3686 if(btInfo & BT_INFO_8723A_2ANT_B_INQ_PAGE)
\r
3688 pCoexSta->bC2hBtInquiryPage = TRUE;
\r
3692 pCoexSta->bC2hBtInquiryPage = FALSE;
\r
3697 EXhalbtc8723a2ant_StackOperationNotify(
\r
3698 IN PBTC_COEXIST pBtCoexist,
\r
3702 if(BTC_STACK_OP_INQ_PAGE_PAIR_START == type)
\r
3704 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], StackOP Inquiry/page/pair start notify\n"));
\r
3705 pCoexSta->bHoldForStackOperation = TRUE;
\r
3706 pCoexSta->bHoldPeriodCnt = 1;
\r
3707 halbtc8723a2ant_BtInquiryPage(pBtCoexist);
\r
3709 else if(BTC_STACK_OP_INQ_PAGE_PAIR_FINISH == type)
\r
3711 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], StackOP Inquiry/page/pair finish notify\n"));
\r
3712 pCoexSta->bHoldForStackOperation = FALSE;
\r
3717 EXhalbtc8723a2ant_HaltNotify(
\r
3718 IN PBTC_COEXIST pBtCoexist
\r
3721 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Halt notify\n"));
\r
3723 halbtc8723a2ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, TRUE);
\r
3724 EXhalbtc8723a2ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_DISCONNECT);
\r
3728 EXhalbtc8723a2ant_Periodical(
\r
3729 IN PBTC_COEXIST pBtCoexist
\r
3732 RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], 2Ant Periodical!!\n"));
\r
3734 // work around for c2h hang
\r
3735 wa_halbtc8723a2ant_MonitorC2h(pBtCoexist);
\r
3737 halbtc8723a2ant_QueryBtInfo(pBtCoexist);
\r
3738 halbtc8723a2ant_MonitorBtCtr(pBtCoexist);
\r
3739 halbtc8723a2ant_MonitorBtEnableDisable(pBtCoexist);
\r
3741 halbtc8723a2ant_RunCoexistMechanism(pBtCoexist);
\r