"BT Info[bt auto report]",\r
};\r
\r
-u4Byte GLCoexVerDate8192e2Ant=20130912;\r
-u4Byte GLCoexVer8192e2Ant=0x35;\r
+u4Byte GLCoexVerDate8192e2Ant=20150105;\r
+u4Byte GLCoexVer8192e2Ant=0x40;\r
\r
//============================================================\r
// local function proto type if needed\r
if( (pCoexSta->preBtRssiState == BTC_RSSI_STATE_LOW) ||\r
(pCoexSta->preBtRssiState == BTC_RSSI_STATE_STAY_LOW))\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi pre state=LOW\n"));\r
if(btRssi >= (rssiThresh+BTC_RSSI_COEX_THRESH_TOL_8192E_2ANT))\r
{\r
btRssiState = BTC_RSSI_STATE_HIGH;\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi state switch to High\n"));\r
}\r
else\r
{\r
btRssiState = BTC_RSSI_STATE_STAY_LOW;\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi state stay at Low\n"));\r
}\r
}\r
else\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi pre state=HIGH\n"));\r
if(btRssi < rssiThresh)\r
{\r
btRssiState = BTC_RSSI_STATE_LOW;\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi state switch to Low\n"));\r
}\r
else\r
{\r
btRssiState = BTC_RSSI_STATE_STAY_HIGH;\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi state stay at High\n"));\r
}\r
}\r
}\r
{\r
if(rssiThresh > rssiThresh1)\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi thresh error!!\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], BT Rssi thresh error!!\n"));\r
return pCoexSta->preBtRssiState;\r
}\r
\r
if( (pCoexSta->preBtRssiState == BTC_RSSI_STATE_LOW) ||\r
(pCoexSta->preBtRssiState == BTC_RSSI_STATE_STAY_LOW))\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi pre state=LOW\n"));\r
if(btRssi >= (rssiThresh+BTC_RSSI_COEX_THRESH_TOL_8192E_2ANT))\r
{\r
btRssiState = BTC_RSSI_STATE_MEDIUM;\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi state switch to Medium\n"));\r
}\r
else\r
{\r
btRssiState = BTC_RSSI_STATE_STAY_LOW;\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi state stay at Low\n"));\r
}\r
}\r
else if( (pCoexSta->preBtRssiState == BTC_RSSI_STATE_MEDIUM) ||\r
(pCoexSta->preBtRssiState == BTC_RSSI_STATE_STAY_MEDIUM))\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi pre state=MEDIUM\n"));\r
if(btRssi >= (rssiThresh1+BTC_RSSI_COEX_THRESH_TOL_8192E_2ANT))\r
{\r
btRssiState = BTC_RSSI_STATE_HIGH;\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi state switch to High\n"));\r
}\r
else if(btRssi < rssiThresh)\r
{\r
btRssiState = BTC_RSSI_STATE_LOW;\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi state switch to Low\n"));\r
}\r
else\r
{\r
btRssiState = BTC_RSSI_STATE_STAY_MEDIUM;\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi state stay at Medium\n"));\r
}\r
}\r
else\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi pre state=HIGH\n"));\r
if(btRssi < rssiThresh1)\r
{\r
btRssiState = BTC_RSSI_STATE_MEDIUM;\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi state switch to Medium\n"));\r
}\r
else\r
{\r
btRssiState = BTC_RSSI_STATE_STAY_HIGH;\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi state stay at High\n"));\r
}\r
}\r
}\r
if(wifiRssi >= (rssiThresh+BTC_RSSI_COEX_THRESH_TOL_8192E_2ANT))\r
{\r
wifiRssiState = BTC_RSSI_STATE_HIGH;\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_WIFI_RSSI_STATE, ("[BTCoex], wifi RSSI state switch to High\n"));\r
}\r
else\r
{\r
wifiRssiState = BTC_RSSI_STATE_STAY_LOW;\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_WIFI_RSSI_STATE, ("[BTCoex], wifi RSSI state stay at Low\n"));\r
}\r
}\r
else\r
if(wifiRssi < rssiThresh)\r
{\r
wifiRssiState = BTC_RSSI_STATE_LOW;\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_WIFI_RSSI_STATE, ("[BTCoex], wifi RSSI state switch to Low\n"));\r
}\r
else\r
{\r
- wifiRssiState = BTC_RSSI_STATE_STAY_HIGH;\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_WIFI_RSSI_STATE, ("[BTCoex], wifi RSSI state stay at High\n"));\r
+ wifiRssiState = BTC_RSSI_STATE_STAY_HIGH; \r
}\r
}\r
}\r
{\r
if(rssiThresh > rssiThresh1)\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_WIFI_RSSI_STATE, ("[BTCoex], wifi RSSI thresh error!!\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], wifi RSSI thresh error!!\n"));\r
return pCoexSta->preWifiRssiState[index];\r
}\r
\r
if(wifiRssi >= (rssiThresh+BTC_RSSI_COEX_THRESH_TOL_8192E_2ANT))\r
{\r
wifiRssiState = BTC_RSSI_STATE_MEDIUM;\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_WIFI_RSSI_STATE, ("[BTCoex], wifi RSSI state switch to Medium\n"));\r
}\r
else\r
{\r
wifiRssiState = BTC_RSSI_STATE_STAY_LOW;\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_WIFI_RSSI_STATE, ("[BTCoex], wifi RSSI state stay at Low\n"));\r
}\r
}\r
else if( (pCoexSta->preWifiRssiState[index] == BTC_RSSI_STATE_MEDIUM) ||\r
if(wifiRssi >= (rssiThresh1+BTC_RSSI_COEX_THRESH_TOL_8192E_2ANT))\r
{\r
wifiRssiState = BTC_RSSI_STATE_HIGH;\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_WIFI_RSSI_STATE, ("[BTCoex], wifi RSSI state switch to High\n"));\r
}\r
else if(wifiRssi < rssiThresh)\r
{\r
wifiRssiState = BTC_RSSI_STATE_LOW;\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_WIFI_RSSI_STATE, ("[BTCoex], wifi RSSI state switch to Low\n"));\r
}\r
else\r
{\r
wifiRssiState = BTC_RSSI_STATE_STAY_MEDIUM;\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_WIFI_RSSI_STATE, ("[BTCoex], wifi RSSI state stay at Medium\n"));\r
}\r
}\r
else\r
if(wifiRssi < rssiThresh1)\r
{\r
wifiRssiState = BTC_RSSI_STATE_MEDIUM;\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_WIFI_RSSI_STATE, ("[BTCoex], wifi RSSI state switch to Medium\n"));\r
}\r
else\r
{\r
wifiRssiState = BTC_RSSI_STATE_STAY_HIGH;\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_WIFI_RSSI_STATE, ("[BTCoex], wifi RSSI state stay at High\n"));\r
}\r
}\r
}\r
btDisableCnt = 0;\r
bBtDisabled = FALSE;\r
pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_BT_DISABLE, &bBtDisabled);\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_MONITOR, ("[BTCoex], BT is enabled !!\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], BT is enabled !!\n"));\r
}\r
else\r
{\r
btDisableCnt++;\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_MONITOR, ("[BTCoex], bt all counters=0, %d times!!\n", \r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], bt all counters=0, %d times!!\n", \r
btDisableCnt));\r
if(btDisableCnt >= 2)\r
{\r
bBtDisabled = TRUE;\r
pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_BT_DISABLE, &bBtDisabled);\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_MONITOR, ("[BTCoex], BT is disabled !!\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], BT is disabled !!\n"));\r
}\r
}\r
if(bPreBtDisabled != bBtDisabled)\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_MONITOR, ("[BTCoex], BT is from %s to %s!!\n", \r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], BT is from %s to %s!!\n", \r
(bPreBtDisabled ? "disabled":"enabled"), \r
(bBtDisabled ? "disabled":"enabled")));\r
bPreBtDisabled = bBtDisabled;\r
pCoexSta->lowPriorityTx = regLPTx;\r
pCoexSta->lowPriorityRx = regLPRx;\r
\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_MONITOR, ("[BTCoex], High Priority Tx/Rx (reg 0x%x)=0x%x(%d)/0x%x(%d)\n", \r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], High Priority Tx/Rx (reg 0x%x)=0x%x(%d)/0x%x(%d)\n", \r
regHPTxRx, regHPTx, regHPTx, regHPRx, regHPRx));\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_MONITOR, ("[BTCoex], Low Priority Tx/Rx (reg 0x%x)=0x%x(%d)/0x%x(%d)\n", \r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Low Priority Tx/Rx (reg 0x%x)=0x%x(%d)/0x%x(%d)\n", \r
regLPTxRx, regLPTx, regLPTx, regLPRx, regLPRx));\r
\r
// reset counter\r
\r
H2C_Parameter[0] |= BIT0; // trigger\r
\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], Query Bt Info, FW write 0x61=0x%x\n", \r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], Query Bt Info, FW write 0x61=0x%x\n", \r
H2C_Parameter[0]));\r
\r
pBtCoexist->fBtcFillH2c(pBtCoexist, 0x61, 1, H2C_Parameter);\r
static BOOLEAN bPreWifiBusy=FALSE, bPreUnder4way=FALSE, bPreBtHsOn=FALSE;\r
BOOLEAN bWifiBusy=FALSE, bUnder4way=FALSE, bBtHsOn=FALSE;\r
BOOLEAN bWifiConnected=FALSE;\r
+ u1Byte wifiRssiState=BTC_RSSI_STATE_HIGH;\r
+ \r
\r
pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);\r
pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy);\r
bPreBtHsOn = bBtHsOn;\r
return TRUE;\r
}\r
+\r
+\r
+ wifiRssiState = halbtc8192e2ant_WifiRssiState(pBtCoexist,3, 2, BT_8723B_2ANT_WIFI_RSSI_COEXSWITCH_THRES, 0); \r
+\r
+ if ( (BTC_RSSI_STATE_HIGH ==wifiRssiState ) || (BTC_RSSI_STATE_LOW ==wifiRssiState ))\r
+ {\r
+ return TRUE;\r
+ }\r
+ \r
}\r
\r
return FALSE;\r
\r
if(!pBtLinkInfo->bBtLinkExist)\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], No BT link exists!!!\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], No BT link exists!!!\n"));\r
return algorithm;\r
}\r
\r
numOfDiffProfile++;\r
if(pBtLinkInfo->bA2dpExist)\r
numOfDiffProfile++;\r
- \r
+\r
+\r
if(numOfDiffProfile == 1)\r
{\r
if(pBtLinkInfo->bScoExist)\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO only\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], SCO only\n"));\r
algorithm = BT_8192E_2ANT_COEX_ALGO_SCO;\r
}\r
else\r
{\r
if(pBtLinkInfo->bHidExist)\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID only\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], HID only\n"));\r
algorithm = BT_8192E_2ANT_COEX_ALGO_HID;\r
}\r
else if(pBtLinkInfo->bA2dpExist)\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2DP only\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], A2DP only\n"));\r
algorithm = BT_8192E_2ANT_COEX_ALGO_A2DP;\r
}\r
else if(pBtLinkInfo->bPanExist)\r
{\r
if(bBtHsOn)\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], PAN(HS) only\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], PAN(HS) only\n"));\r
algorithm = BT_8192E_2ANT_COEX_ALGO_PANHS;\r
}\r
else\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], PAN(EDR) only\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], PAN(EDR) only\n"));\r
algorithm = BT_8192E_2ANT_COEX_ALGO_PANEDR;\r
}\r
}\r
{\r
if(pBtLinkInfo->bHidExist)\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], SCO + HID\n"));\r
algorithm = BT_8192E_2ANT_COEX_ALGO_SCO;\r
}\r
else if(pBtLinkInfo->bA2dpExist)\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + A2DP ==> SCO\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], SCO + A2DP ==> SCO\n"));\r
algorithm = BT_8192E_2ANT_COEX_ALGO_PANEDR_HID;\r
}\r
else if(pBtLinkInfo->bPanExist)\r
{\r
if(bBtHsOn)\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + PAN(HS)\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], SCO + PAN(HS)\n"));\r
algorithm = BT_8192E_2ANT_COEX_ALGO_SCO;\r
}\r
else\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + PAN(EDR)\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], SCO + PAN(EDR)\n"));\r
algorithm = BT_8192E_2ANT_COEX_ALGO_SCO_PAN;\r
}\r
}\r
{\r
if(pStackInfo->numOfHid >= 2)\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID*2 + A2DP\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], HID*2 + A2DP\n"));\r
algorithm = BT_8192E_2ANT_COEX_ALGO_HID_A2DP_PANEDR;\r
}\r
else\r
{ \r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + A2DP\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], HID + A2DP\n"));\r
algorithm = BT_8192E_2ANT_COEX_ALGO_HID_A2DP;\r
}\r
}\r
{\r
if(bBtHsOn)\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + PAN(HS)\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], HID + PAN(HS)\n"));\r
algorithm = BT_8192E_2ANT_COEX_ALGO_HID;\r
}\r
else\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + PAN(EDR)\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], HID + PAN(EDR)\n"));\r
algorithm = BT_8192E_2ANT_COEX_ALGO_PANEDR_HID;\r
}\r
}\r
{\r
if(bBtHsOn)\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2DP + PAN(HS)\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], A2DP + PAN(HS)\n"));\r
algorithm = BT_8192E_2ANT_COEX_ALGO_A2DP_PANHS;\r
}\r
else\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2DP + PAN(EDR)\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], A2DP + PAN(EDR)\n"));\r
algorithm = BT_8192E_2ANT_COEX_ALGO_PANEDR_A2DP;\r
}\r
}\r
if( pBtLinkInfo->bHidExist &&\r
pBtLinkInfo->bA2dpExist )\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID + A2DP ==> HID\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], SCO + HID + A2DP ==> HID\n"));\r
algorithm = BT_8192E_2ANT_COEX_ALGO_PANEDR_HID;\r
}\r
else if( pBtLinkInfo->bHidExist &&\r
{\r
if(bBtHsOn)\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID + PAN(HS)\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], SCO + HID + PAN(HS)\n"));\r
algorithm = BT_8192E_2ANT_COEX_ALGO_SCO;\r
}\r
else\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID + PAN(EDR)\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], SCO + HID + PAN(EDR)\n"));\r
algorithm = BT_8192E_2ANT_COEX_ALGO_SCO_PAN;\r
}\r
}\r
{\r
if(bBtHsOn)\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + A2DP + PAN(HS)\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], SCO + A2DP + PAN(HS)\n"));\r
algorithm = BT_8192E_2ANT_COEX_ALGO_SCO;\r
}\r
else\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + A2DP + PAN(EDR) ==> HID\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], SCO + A2DP + PAN(EDR) ==> HID\n"));\r
algorithm = BT_8192E_2ANT_COEX_ALGO_PANEDR_HID;\r
}\r
}\r
{\r
if(bBtHsOn)\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + A2DP + PAN(HS)\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], HID + A2DP + PAN(HS)\n"));\r
algorithm = BT_8192E_2ANT_COEX_ALGO_HID_A2DP;\r
}\r
else\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + A2DP + PAN(EDR)\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], HID + A2DP + PAN(EDR)\n"));\r
algorithm = BT_8192E_2ANT_COEX_ALGO_HID_A2DP_PANEDR;\r
}\r
}\r
{\r
if(bBtHsOn)\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Error!!! SCO + HID + A2DP + PAN(HS)\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Error!!! SCO + HID + A2DP + PAN(HS)\n"));\r
\r
}\r
else\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID + A2DP + PAN(EDR)==>PAN(EDR)+HID\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], SCO + HID + A2DP + PAN(EDR)==>PAN(EDR)+HID\n"));\r
algorithm = BT_8192E_2ANT_COEX_ALGO_PANEDR_HID;\r
}\r
}\r
// 0x18/ 0x10/ 0xc/ 0x8/ 0x4/ 0x6\r
H2C_Parameter[0] = dacSwingLvl;\r
\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], Set Dac Swing Level=0x%x\n", dacSwingLvl));\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], FW write 0x64=0x%x\n", H2C_Parameter[0]));\r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], Set Dac Swing Level=0x%x\n", dacSwingLvl));\r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], FW write 0x64=0x%x\n", H2C_Parameter[0]));\r
\r
pBtCoexist->fBtcFillH2c(pBtCoexist, 0x64, 1, H2C_Parameter);\r
}\r
\r
H2C_Parameter[0] = decBtPwrLvl;\r
\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], decrease Bt Power level = %d, FW write 0x62=0x%x\n", \r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], decrease Bt Power level = %d, FW write 0x62=0x%x\n", \r
decBtPwrLvl, H2C_Parameter[0]));\r
\r
pBtCoexist->fBtcFillH2c(pBtCoexist, 0x62, 1, H2C_Parameter); \r
IN u1Byte decBtPwrLvl\r
)\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], %s Dec BT power level = %d\n", \r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], %s Dec BT power level = %d\n", \r
(bForceExec? "force to":""), decBtPwrLvl));\r
pCoexDm->curBtDecPwrLvl = decBtPwrLvl;\r
\r
if(!bForceExec)\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], preBtDecPwrLvl=%d, curBtDecPwrLvl=%d\n", \r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], preBtDecPwrLvl=%d, curBtDecPwrLvl=%d\n", \r
pCoexDm->preBtDecPwrLvl, pCoexDm->curBtDecPwrLvl));\r
#if 0 // work around, avoid h2c command fail.\r
if(pCoexDm->preBtDecPwrLvl == pCoexDm->curBtDecPwrLvl) \r
H2C_Parameter[0] |= BIT0;\r
}\r
\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], BT FW auto report : %s, FW write 0x68=0x%x\n", \r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], BT FW auto report : %s, FW write 0x68=0x%x\n", \r
(bEnableAutoReport? "Enabled!!":"Disabled!!"), H2C_Parameter[0]));\r
\r
pBtCoexist->fBtcFillH2c(pBtCoexist, 0x68, 1, H2C_Parameter); \r
IN BOOLEAN bEnableAutoReport\r
)\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], %s BT Auto report = %s\n", \r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], %s BT Auto report = %s\n", \r
(bForceExec? "force to":""), ((bEnableAutoReport)? "Enabled":"Disabled")));\r
pCoexDm->bCurBtAutoReport = bEnableAutoReport;\r
\r
if(!bForceExec)\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], bPreBtAutoReport=%d, bCurBtAutoReport=%d\n", \r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], bPreBtAutoReport=%d, bCurBtAutoReport=%d\n", \r
pCoexDm->bPreBtAutoReport, pCoexDm->bCurBtAutoReport));\r
\r
if(pCoexDm->bPreBtAutoReport == pCoexDm->bCurBtAutoReport) \r
IN u1Byte fwDacSwingLvl\r
)\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], %s set FW Dac Swing level = %d\n", \r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], %s set FW Dac Swing level = %d\n", \r
(bForceExec? "force to":""), fwDacSwingLvl));\r
pCoexDm->curFwDacSwingLvl = fwDacSwingLvl;\r
\r
if(!bForceExec)\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], preFwDacSwingLvl=%d, curFwDacSwingLvl=%d\n", \r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], preFwDacSwingLvl=%d, curFwDacSwingLvl=%d\n", \r
pCoexDm->preFwDacSwingLvl, pCoexDm->curFwDacSwingLvl));\r
\r
if(pCoexDm->preFwDacSwingLvl == pCoexDm->curFwDacSwingLvl) \r
if(bRxRfShrinkOn)\r
{\r
//Shrink RF Rx LPF corner\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Shrink RF Rx LPF corner!!\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Shrink RF Rx LPF corner!!\n"));\r
pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1e, 0xfffff, 0xffffc);\r
}\r
else\r
// After initialized, we can use pCoexDm->btRf0x1eBackup\r
if(pBtCoexist->bInitilized)\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Resume RF Rx LPF corner!!\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Resume RF Rx LPF corner!!\n"));\r
pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1e, 0xfffff, pCoexDm->btRf0x1eBackup);\r
}\r
}\r
IN BOOLEAN bRxRfShrinkOn\r
)\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW, ("[BTCoex], %s turn Rx RF Shrink = %s\n", \r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], %s turn Rx RF Shrink = %s\n", \r
(bForceExec? "force to":""), ((bRxRfShrinkOn)? "ON":"OFF")));\r
pCoexDm->bCurRfRxLpfShrink = bRxRfShrinkOn;\r
\r
if(!bForceExec)\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_DETAIL, ("[BTCoex], bPreRfRxLpfShrink=%d, bCurRfRxLpfShrink=%d\n", \r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], bPreRfRxLpfShrink=%d, bCurRfRxLpfShrink=%d\n", \r
pCoexDm->bPreRfRxLpfShrink, pCoexDm->bCurRfRxLpfShrink));\r
\r
if(pCoexDm->bPreRfRxLpfShrink == pCoexDm->bCurRfRxLpfShrink) \r
H2C_Parameter[5] = 0xf9; //MCS5 or OFDM36 \r
}\r
\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], set WiFi Low-Penalty Retry: %s", \r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], set WiFi Low-Penalty Retry: %s", \r
(bLowPenaltyRa? "ON!!":"OFF!!")) );\r
\r
pBtCoexist->fBtcFillH2c(pBtCoexist, 0x69, 6, H2C_Parameter);\r
)\r
{\r
//return;\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW, ("[BTCoex], %s turn LowPenaltyRA = %s\n", \r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], %s turn LowPenaltyRA = %s\n", \r
(bForceExec? "force to":""), ((bLowPenaltyRa)? "ON":"OFF")));\r
pCoexDm->bCurLowPenaltyRa = bLowPenaltyRa;\r
\r
if(!bForceExec)\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_DETAIL, ("[BTCoex], bPreLowPenaltyRa=%d, bCurLowPenaltyRa=%d\n", \r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], bPreLowPenaltyRa=%d, bCurLowPenaltyRa=%d\n", \r
pCoexDm->bPreLowPenaltyRa, pCoexDm->bCurLowPenaltyRa));\r
\r
if(pCoexDm->bPreLowPenaltyRa == pCoexDm->bCurLowPenaltyRa) \r
{\r
u1Byte val=(u1Byte)level;\r
\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Write SwDacSwing = 0x%x\n", level));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Write SwDacSwing = 0x%x\n", level));\r
pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x883, 0x3e, val);\r
}\r
\r
IN u4Byte dacSwingLvl\r
)\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW, ("[BTCoex], %s turn DacSwing=%s, dacSwingLvl=0x%x\n", \r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], %s turn DacSwing=%s, dacSwingLvl=0x%x\n", \r
(bForceExec? "force to":""), ((bDacSwingOn)? "ON":"OFF"), dacSwingLvl));\r
pCoexDm->bCurDacSwingOn = bDacSwingOn;\r
pCoexDm->curDacSwingLvl = dacSwingLvl;\r
\r
if(!bForceExec)\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_DETAIL, ("[BTCoex], bPreDacSwingOn=%d, preDacSwingLvl=0x%x, bCurDacSwingOn=%d, curDacSwingLvl=0x%x\n", \r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], bPreDacSwingOn=%d, preDacSwingLvl=0x%x, bCurDacSwingOn=%d, curDacSwingLvl=0x%x\n", \r
pCoexDm->bPreDacSwingOn, pCoexDm->preDacSwingLvl,\r
pCoexDm->bCurDacSwingOn, pCoexDm->curDacSwingLvl));\r
\r
{\r
if(bAdcBackOff)\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], BB BackOff Level On!\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], BB BackOff Level On!\n"));\r
pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0xc05, 0x30, 0x3);\r
}\r
else\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], BB BackOff Level Off!\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], BB BackOff Level Off!\n"));\r
pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0xc05, 0x30, 0x1);\r
}\r
}\r
IN BOOLEAN bAdcBackOff\r
)\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW, ("[BTCoex], %s turn AdcBackOff = %s\n", \r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], %s turn AdcBackOff = %s\n", \r
(bForceExec? "force to":""), ((bAdcBackOff)? "ON":"OFF")));\r
pCoexDm->bCurAdcBackOff = bAdcBackOff;\r
\r
if(!bForceExec)\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_DETAIL, ("[BTCoex], bPreAdcBackOff=%d, bCurAdcBackOff=%d\n", \r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], bPreAdcBackOff=%d, bCurAdcBackOff=%d\n", \r
pCoexDm->bPreAdcBackOff, pCoexDm->bCurAdcBackOff));\r
\r
if(pCoexDm->bPreAdcBackOff == pCoexDm->bCurAdcBackOff) \r
//=================BB AGC Gain Table\r
if(bAgcTableEn)\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], BB Agc Table On!\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], BB Agc Table On!\n"));\r
pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x0a1A0001);\r
pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x091B0001);\r
pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x081C0001);\r
}\r
else\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], BB Agc Table Off!\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], BB Agc Table Off!\n"));\r
pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0xaa1A0001);\r
pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0xa91B0001);\r
pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0xa81C0001);\r
pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0xef, 0xfffff, 0x02000);\r
if(bAgcTableEn)\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Agc Table On!\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Agc Table On!\n"));\r
pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x3b, 0xfffff, 0x38fff);\r
pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x3b, 0xfffff, 0x38ffe);\r
}\r
else\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Agc Table Off!\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Agc Table Off!\n"));\r
pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x3b, 0xfffff, 0x380c3);\r
pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x3b, 0xfffff, 0x28ce6);\r
}\r
pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0xed, 0xfffff, 0x1);\r
if(bAgcTableEn)\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Agc Table On!\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Agc Table On!\n"));\r
pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x40, 0xfffff, 0x38fff);\r
pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x40, 0xfffff, 0x38ffe);\r
}\r
else\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Agc Table Off!\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Agc Table Off!\n"));\r
pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x40, 0xfffff, 0x380c3);\r
pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x40, 0xfffff, 0x28ce6);\r
}\r
IN BOOLEAN bAgcTableEn\r
)\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW, ("[BTCoex], %s %s Agc Table\n", \r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], %s %s Agc Table\n", \r
(bForceExec? "force to":""), ((bAgcTableEn)? "Enable":"Disable")));\r
pCoexDm->bCurAgcTableEn = bAgcTableEn;\r
\r
if(!bForceExec)\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_DETAIL, ("[BTCoex], bPreAgcTableEn=%d, bCurAgcTableEn=%d\n", \r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], bPreAgcTableEn=%d, bCurAgcTableEn=%d\n", \r
pCoexDm->bPreAgcTableEn, pCoexDm->bCurAgcTableEn));\r
\r
if(pCoexDm->bPreAgcTableEn == pCoexDm->bCurAgcTableEn) \r
IN u1Byte val0x6cc\r
)\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], set coex table, set 0x6c0=0x%x\n", val0x6c0));\r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], set coex table, set 0x6c0=0x%x\n", val0x6c0));\r
pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x6c0, val0x6c0);\r
\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], set coex table, set 0x6c4=0x%x\n", val0x6c4));\r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], set coex table, set 0x6c4=0x%x\n", val0x6c4));\r
pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x6c4, val0x6c4);\r
\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], set coex table, set 0x6c8=0x%x\n", val0x6c8));\r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], set coex table, set 0x6c8=0x%x\n", val0x6c8));\r
pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x6c8, val0x6c8);\r
\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], set coex table, set 0x6cc=0x%x\n", val0x6cc));\r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], set coex table, set 0x6cc=0x%x\n", val0x6cc));\r
pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x6cc, val0x6cc);\r
}\r
\r
IN u1Byte val0x6cc\r
)\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW, ("[BTCoex], %s write Coex Table 0x6c0=0x%x, 0x6c4=0x%x, 0x6c8=0x%x, 0x6cc=0x%x\n", \r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], %s write Coex Table 0x6c0=0x%x, 0x6c4=0x%x, 0x6c8=0x%x, 0x6cc=0x%x\n", \r
(bForceExec? "force to":""), val0x6c0, val0x6c4, val0x6c8, val0x6cc));\r
pCoexDm->curVal0x6c0 = val0x6c0;\r
pCoexDm->curVal0x6c4 = val0x6c4;\r
\r
if(!bForceExec)\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_DETAIL, ("[BTCoex], preVal0x6c0=0x%x, preVal0x6c4=0x%x, preVal0x6c8=0x%x, preVal0x6cc=0x%x !!\n", \r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], preVal0x6c0=0x%x, preVal0x6c4=0x%x, preVal0x6c8=0x%x, preVal0x6cc=0x%x !!\n", \r
pCoexDm->preVal0x6c0, pCoexDm->preVal0x6c4, pCoexDm->preVal0x6c8, pCoexDm->preVal0x6cc));\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_DETAIL, ("[BTCoex], curVal0x6c0=0x%x, curVal0x6c4=0x%x, curVal0x6c8=0x%x, curVal0x6cc=0x%x !!\n", \r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], curVal0x6c0=0x%x, curVal0x6c4=0x%x, curVal0x6c8=0x%x, curVal0x6cc=0x%x !!\n", \r
pCoexDm->curVal0x6c0, pCoexDm->curVal0x6c4, pCoexDm->curVal0x6c8, pCoexDm->curVal0x6cc));\r
\r
if( (pCoexDm->preVal0x6c0 == pCoexDm->curVal0x6c0) &&\r
IN u1Byte type\r
)\r
{\r
+ pCoexSta->nCoexTableType = type;\r
+ \r
switch(type)\r
{\r
case 0:\r
case 4:\r
halbtc8192e2ant_CoexTable(pBtCoexist, bForceExec, 0xdfffdfff, 0x5ffb5ffb, 0xffffff, 0x3);\r
break;\r
-\r
+ case 5:\r
+ halbtc8192e2ant_CoexTable(pBtCoexist, bForceExec, 0x5ddd5ddd, 0x5fdb5fdb, 0xffffff, 0x3);\r
+ break;\r
+ case 6:\r
+ halbtc8192e2ant_CoexTable(pBtCoexist, bForceExec, 0x5fff5fff, 0x5a5a5a5a, 0xffffff, 0x3);\r
+ break;\r
+ case 7:\r
+ if(pCoexSta->nScanAPNum <= NOISY_AP_NUM_THRESH)\r
+ halbtc8192e2ant_CoexTable(pBtCoexist, bForceExec, 0xffffffff, 0xfafafafa, 0xffffff, 0x3);\r
+ else\r
+ halbtc8192e2ant_CoexTable(pBtCoexist, bForceExec, 0xffffffff, 0x5a5a5a5a, 0xffffff, 0x3);\r
+ break;\r
+ case 8:\r
+ halbtc8192e2ant_CoexTable(pBtCoexist, bForceExec, 0x5f5f5f5f, 0x5a5a5a5a, 0xffffff, 0x3);\r
+ break;\r
default:\r
break;\r
}\r
H2C_Parameter[0] |= BIT0; // function enable\r
}\r
\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], set FW for BT Ignore Wlan_Act, FW write 0x63=0x%x\n", \r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], set FW for BT Ignore Wlan_Act, FW write 0x63=0x%x\n", \r
H2C_Parameter[0]));\r
\r
pBtCoexist->fBtcFillH2c(pBtCoexist, 0x63, 1, H2C_Parameter);\r
}\r
\r
+\r
VOID\r
halbtc8192e2ant_IgnoreWlanAct(\r
IN PBTC_COEXIST pBtCoexist,\r
IN BOOLEAN bEnable\r
)\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], %s turn Ignore WlanAct %s\n", \r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], %s turn Ignore WlanAct %s\n", \r
(bForceExec? "force to":""), (bEnable? "ON":"OFF")));\r
pCoexDm->bCurIgnoreWlanAct = bEnable;\r
\r
if(!bForceExec)\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], bPreIgnoreWlanAct = %d, bCurIgnoreWlanAct = %d!!\n", \r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], bPreIgnoreWlanAct = %d, bCurIgnoreWlanAct = %d!!\n", \r
pCoexDm->bPreIgnoreWlanAct, pCoexDm->bCurIgnoreWlanAct));\r
\r
if(pCoexDm->bPreIgnoreWlanAct == pCoexDm->bCurIgnoreWlanAct)\r
pCoexDm->bPreIgnoreWlanAct = pCoexDm->bCurIgnoreWlanAct;\r
}\r
\r
+\r
+VOID\r
+halbtc8192e2ant_SetLpsRpwm(\r
+ IN PBTC_COEXIST pBtCoexist,\r
+ IN u1Byte lpsVal,\r
+ IN u1Byte rpwmVal\r
+ )\r
+{\r
+ u1Byte lps=lpsVal;\r
+ u1Byte rpwm=rpwmVal;\r
+ \r
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_U1_LPS_VAL, &lps);\r
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_U1_RPWM_VAL, &rpwm);\r
+}\r
+\r
+\r
+VOID\r
+halbtc8192e2ant_LpsRpwm(\r
+ IN PBTC_COEXIST pBtCoexist,\r
+ IN BOOLEAN bForceExec,\r
+ IN u1Byte lpsVal,\r
+ IN u1Byte rpwmVal\r
+ )\r
+{\r
+ BOOLEAN bForceExecPwrCmd=FALSE;\r
+ \r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], %s set lps/rpwm=0x%x/0x%x \n", \r
+ (bForceExec? "force to":""), lpsVal, rpwmVal));\r
+ pCoexDm->curLps = lpsVal;\r
+ pCoexDm->curRpwm = rpwmVal;\r
+\r
+ if(!bForceExec)\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], preLps/curLps=0x%x/0x%x, preRpwm/curRpwm=0x%x/0x%x!!\n", \r
+ pCoexDm->preLps, pCoexDm->curLps, pCoexDm->preRpwm, pCoexDm->curRpwm));\r
+\r
+ if( (pCoexDm->preLps == pCoexDm->curLps) &&\r
+ (pCoexDm->preRpwm == pCoexDm->curRpwm) )\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], LPS-RPWM_Last=0x%x , LPS-RPWM_Now=0x%x!!\n", \r
+ pCoexDm->preRpwm, pCoexDm->curRpwm));\r
+\r
+ return;\r
+ }\r
+ }\r
+ halbtc8192e2ant_SetLpsRpwm(pBtCoexist, lpsVal, rpwmVal);\r
+\r
+ pCoexDm->preLps = pCoexDm->curLps;\r
+ pCoexDm->preRpwm = pCoexDm->curRpwm;\r
+}\r
+\r
+\r
+\r
VOID\r
halbtc8192e2ant_SetFwPstdma(\r
IN PBTC_COEXIST pBtCoexist,\r
)\r
{\r
u1Byte H2C_Parameter[5] ={0};\r
+ u1Byte realByte1=byte1, realByte5=byte5;\r
+ BOOLEAN bApEnable=FALSE;\r
+\r
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_AP_MODE_ENABLE, &bApEnable);\r
+\r
+ if(bApEnable)\r
+ {\r
+ if(byte1&BIT4 && !(byte1&BIT5))\r
+ { \r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], FW for 1Ant AP mode\n"));\r
+ realByte1 &= ~BIT4;\r
+ realByte1 |= BIT5;\r
+\r
+ realByte5 |= BIT5;\r
+ realByte5 &= ~BIT6;\r
+ }\r
+ }\r
\r
- H2C_Parameter[0] = byte1; \r
+ H2C_Parameter[0] = realByte1; \r
H2C_Parameter[1] = byte2; \r
H2C_Parameter[2] = byte3;\r
H2C_Parameter[3] = byte4;\r
- H2C_Parameter[4] = byte5;\r
+ H2C_Parameter[4] = realByte5;\r
\r
- pCoexDm->psTdmaPara[0] = byte1;\r
+ pCoexDm->psTdmaPara[0] = realByte1;\r
pCoexDm->psTdmaPara[1] = byte2;\r
pCoexDm->psTdmaPara[2] = byte3;\r
pCoexDm->psTdmaPara[3] = byte4;\r
- pCoexDm->psTdmaPara[4] = byte5;\r
+ pCoexDm->psTdmaPara[4] = realByte5;\r
\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], FW write 0x60(5bytes)=0x%x%08x\n", \r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], PS-TDMA H2C cmd =0x%x%08x\n", \r
H2C_Parameter[0], \r
H2C_Parameter[1]<<24|H2C_Parameter[2]<<16|H2C_Parameter[3]<<8|H2C_Parameter[4]));\r
\r
pBtCoexist->fBtcFillH2c(pBtCoexist, 0x60, 5, H2C_Parameter);\r
}\r
\r
+\r
VOID\r
halbtc8192e2ant_SwMechanism1(\r
IN PBTC_COEXIST pBtCoexist, \r
{\r
BOOLEAN bTurnOnByCnt=FALSE;\r
u1Byte psTdmaTypeByCnt=0;\r
+ s1Byte nWiFiDurationAdjust = 0x0;\r
\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], %s turn %s PS TDMA, type=%d\n", \r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], %s turn %s PS TDMA, type=%d\n", \r
(bForceExec? "force to":""), (bTurnOn? "ON":"OFF"), type));\r
pCoexDm->bCurPsTdmaOn = bTurnOn;\r
pCoexDm->curPsTdma = type;\r
\r
if(!bForceExec)\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], bPrePsTdmaOn = %d, bCurPsTdmaOn = %d!!\n", \r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], bPrePsTdmaOn = %d, bCurPsTdmaOn = %d!!\n", \r
pCoexDm->bPrePsTdmaOn, pCoexDm->bCurPsTdmaOn));\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], prePsTdma = %d, curPsTdma = %d!!\n", \r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], prePsTdma = %d, curPsTdma = %d!!\n", \r
pCoexDm->prePsTdma, pCoexDm->curPsTdma));\r
\r
if( (pCoexDm->bPrePsTdmaOn == pCoexDm->bCurPsTdmaOn) &&\r
(pCoexDm->prePsTdma == pCoexDm->curPsTdma) )\r
return;\r
} \r
+\r
+ if (pCoexSta->nScanAPNum >= 40)\r
+ nWiFiDurationAdjust = -15; \r
+ else if (pCoexSta->nScanAPNum >= 20)\r
+ nWiFiDurationAdjust = -10; \r
+\r
+/* \r
+ if (!pCoexSta->bForceLpsOn) //only for A2DP-only case 1/2/9/11 while wifi noisy threshold > 30\r
+ {\r
+ psTdmaByte0Val = 0x61; //no null-pkt\r
+ psTdmaByte3Val = 0x11; // no tx-pause at BT-slot\r
+ psTdmaByte4Val = 0x10; // 0x778 = d/1 toggle\r
+ }\r
+\r
+ \r
+ if ( (type == 3) || (type == 13) || (type == 14) )\r
+ {\r
+ psTdmaByte4Val = psTdmaByte4Val & 0xbf; //no dynamic slot for multi-profile\r
+ \r
+ if (!bWifiBusy)\r
+ psTdmaByte4Val = psTdmaByte4Val | 0x1; //0x778 = 0x1 at wifi slot (no blocking BT Low-Pri pkts)\r
+ }\r
+ \r
+ if (pBtLinkInfo->bSlaveRole == TRUE)\r
+ psTdmaByte4Val = psTdmaByte4Val | 0x1; //0x778 = 0x1 at wifi slot (no blocking BT Low-Pri pkts)\r
+ \r
+*/\r
if(bTurnOn)\r
{\r
switch(type)\r
{\r
case 1:\r
- default:\r
- halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0xe1, 0x90);\r
+ default: //d1,wb\r
+ halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x3c, 0x03, 0x11, 0x10);\r
break;\r
case 2:\r
- halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0xe1, 0x90);\r
+ halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x32, 0x03, 0x11, 0x10);\r
break;\r
case 3:\r
- halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1c, 0x3, 0xf1, 0x90);\r
+ halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x28, 0x03, 0x11, 0x10);\r
break;\r
case 4:\r
- halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x10, 0x3, 0xf1, 0x90);\r
+ halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1e, 0x03, 0x11, 0x10);\r
break;\r
- case 5:\r
- halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0x60, 0x90);\r
+ case 5: //d1,pb,TXpause\r
+ halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0x63, 0x3c, 0x03, 0x90, 0x10);\r
break;\r
case 6:\r
- halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0x60, 0x90);\r
+ halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0x63, 0x32, 0x03, 0x90, 0x10);\r
break;\r
case 7:\r
- halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1c, 0x3, 0x70, 0x90);\r
+ halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0x63, 0x28, 0x03, 0x90, 0x10);\r
break;\r
- case 8: \r
- halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xa3, 0x10, 0x3, 0x70, 0x90);\r
+ case 8: \r
+ halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0x63, 0x1e, 0x03, 0x90, 0x10);\r
break;\r
- case 9: \r
- halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0xe1, 0x10);\r
+ case 9: //d1,bb\r
+ halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x3c, 0x03, 0x31, 0x10);\r
break;\r
case 10: \r
- halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0xe1, 0x10);\r
+ halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x32, 0x03, 0x31, 0x10);\r
break;\r
case 11: \r
- halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1c, 0x3, 0xf1, 0x10);\r
+ halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x28, 0x03, 0x31, 0x10);\r
break;\r
case 12:\r
- halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x10, 0x3, 0xf1, 0x10);\r
+ halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1e, 0x03, 0x31, 0x10);\r
break;\r
- case 13:\r
- halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0xe0, 0x10);\r
+ case 13: //d1,bb,TXpause\r
+ halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x3c, 0x03, 0x30, 0x10);\r
break;\r
case 14:\r
- halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0xe0, 0x10);\r
+ halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x32, 0x03, 0x30, 0x10);\r
break;\r
case 15:\r
- halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1c, 0x3, 0xf0, 0x10);\r
+ halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x28, 0x03, 0x30, 0x10);\r
break;\r
case 16:\r
- halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x3, 0xf0, 0x10);\r
+ halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1e, 0x03, 0x30, 0x10);\r
break;\r
case 17:\r
halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0x61, 0x20, 0x03, 0x10, 0x10);\r
halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x25, 0x25, 0x60, 0x90);\r
break;\r
case 21:\r
- halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x15, 0x03, 0x70, 0x90);\r
+ halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0x61, 0x35, 0x03, 0x11, 0x11);\r
break; \r
case 71:\r
halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0xe1, 0x90);\r
break;\r
+\r
+ // following cases is for wifi rssi low // bad antenna isolation, started from 81\r
+ case 80:\r
+ halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0x53, 0x3c, 0x3, 0x90, 0x50);\r
+ break;\r
+ case 81:\r
+ halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0x53, 0x3a+nWiFiDurationAdjust, 0x3, 0x90, 0x50);\r
+ break;\r
+ case 82:\r
+ halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0x53, 0x30+nWiFiDurationAdjust, 0x03, 0x90, 0x50);\r
+ break;\r
+ case 83:\r
+ halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0x53, 0x21, 0x03, 0x90, 0x50);\r
+ break;\r
+ case 84:\r
+ halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0x53, 0x15, 0x3, 0x90, 0x50);\r
+ break;\r
+ case 85:\r
+ halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0x53, 0x1d, 0x1d, 0x80, 0x50);\r
+ break;\r
+ case 86:\r
+ halbtc8192e2ant_SetFwPstdma(pBtCoexist, 0x53, 0x15, 0x15, 0x80, 0x50);\r
+ break;\r
+\r
}\r
}\r
else\r
u1Byte mimoPs=BTC_MIMO_PS_DYNAMIC;\r
u4Byte disRaMask=0x0;\r
\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], REAL set SS Type = %d\n", ssType));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], REAL set SS Type = %d\n", ssType));\r
\r
disRaMask = halbtc8192e2ant_DecideRaMask(pBtCoexist, ssType, pCoexDm->curRaMaskType);\r
halbtc8192e2ant_UpdateRaMask(pBtCoexist, FORCE_EXEC, disRaMask);\r
pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0xd04, 0x1);\r
pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x90c, 0x81111111);\r
// switch cck patch\r
- //Jenyu suggest to remove 0xe77 this line for tx issue\r
//pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0xe77, 0x4, 0x1);\r
//pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0xa07, 0x81);\r
mimoPs=BTC_MIMO_PS_STATIC;\r
pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0xc04, 0x33);\r
pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0xd04, 0x3);\r
pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x90c, 0x81121313);\r
- //Jenyu suggest to remove 0xe77 this line for tx issue\r
+ // remove, if 0xe77[2]=0x0 then CCK will fail, advised by Jenyu\r
//pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0xe77, 0x4, 0x0);\r
//pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0xa07, 0x41);\r
mimoPs=BTC_MIMO_PS_DYNAMIC;\r
IN u1Byte newSsType\r
)\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], %s Switch SS Type = %d\n", \r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], %s Switch SS Type = %d\n", \r
(bForceExec? "force to":""), newSsType));\r
pCoexDm->curSsType = newSsType;\r
\r
pCoexDm->preSsType = pCoexDm->curSsType;\r
}\r
\r
+VOID\r
+halbtc8192e2ant_PsTdmaCheckForPowerSaveState(\r
+ IN PBTC_COEXIST pBtCoexist,\r
+ IN BOOLEAN bNewPsState\r
+ )\r
+{\r
+ u1Byte lpsMode=0x0;\r
+\r
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U1_LPS_MODE, &lpsMode);\r
+ \r
+ if(lpsMode) // already under LPS state\r
+ {\r
+ if(bNewPsState) \r
+ {\r
+ // keep state under LPS, do nothing.\r
+ }\r
+ else\r
+ {\r
+ // will leave LPS state, turn off psTdma first\r
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);\r
+ }\r
+ }\r
+ else // NO PS state\r
+ {\r
+ if(bNewPsState)\r
+ {\r
+ // will enter LPS state, turn off psTdma first\r
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);\r
+ }\r
+ else\r
+ {\r
+ // keep state under NO PS state, do nothing.\r
+ }\r
+ }\r
+}\r
+\r
+VOID\r
+halbtc8192e2ant_PowerSaveState(\r
+ IN PBTC_COEXIST pBtCoexist,\r
+ IN u1Byte psType,\r
+ IN u1Byte lpsVal,\r
+ IN u1Byte rpwmVal\r
+ )\r
+{\r
+ BOOLEAN bLowPwrDisable=FALSE;\r
+ \r
+ switch(psType)\r
+ {\r
+ case BTC_PS_WIFI_NATIVE:\r
+ // recover to original 32k low power setting\r
+ bLowPwrDisable = TRUE;\r
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable);\r
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_NORMAL_LPS, NULL);\r
+ pCoexSta->bForceLpsOn = FALSE;\r
+ break;\r
+ case BTC_PS_LPS_ON:\r
+ halbtc8192e2ant_PsTdmaCheckForPowerSaveState(pBtCoexist, TRUE);\r
+ halbtc8192e2ant_LpsRpwm(pBtCoexist, NORMAL_EXEC, lpsVal, rpwmVal); \r
+ // when coex force to enter LPS, do not enter 32k low power.\r
+ bLowPwrDisable = TRUE;\r
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable);\r
+ // power save must executed before psTdma.\r
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_ENTER_LPS, NULL);\r
+ pCoexSta->bForceLpsOn = TRUE;\r
+ break;\r
+ case BTC_PS_LPS_OFF:\r
+ halbtc8192e2ant_PsTdmaCheckForPowerSaveState(pBtCoexist, FALSE);\r
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_LEAVE_LPS, NULL);\r
+ pCoexSta->bForceLpsOn = FALSE;\r
+ break;\r
+ default:\r
+ break;\r
+ }\r
+}\r
+\r
+\r
VOID\r
halbtc8192e2ant_CoexAllOff(\r
IN PBTC_COEXIST pBtCoexist\r
)\r
{\r
// fw all off\r
+ halbtc8192e2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);\r
halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 1);\r
halbtc8192e2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);\r
halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);\r
{ \r
// force to reset coex mechanism\r
\r
+ halbtc8192e2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0); \r
halbtc8192e2ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 1);\r
halbtc8192e2ant_FwDacSwingLvl(pBtCoexist, FORCE_EXEC, 6);\r
halbtc8192e2ant_DecBtPwr(pBtCoexist, FORCE_EXEC, 0);\r
IN PBTC_COEXIST pBtCoexist\r
)\r
{\r
- BOOLEAN bLowPwrDisable=TRUE;\r
+// BOOLEAN bLowPwrDisable=TRUE;\r
\r
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable);\r
+// pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable);\r
\r
- halbtc8192e2ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 1);\r
+// halbtc8192e2ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 1);\r
\r
- halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);\r
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);\r
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);\r
+ halbtc8192e2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);\r
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 21);\r
halbtc8192e2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);\r
halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);\r
\r
halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);\r
}\r
\r
+VOID\r
+halbtc8192e2ant_ActionWiFiLinkProcess(\r
+ IN PBTC_COEXIST pBtCoexist\r
+ )\r
+{\r
+\r
+}\r
+\r
BOOLEAN\r
halbtc8192e2ant_IsCommonAction(\r
IN PBTC_COEXIST pBtCoexist\r
\r
if(!bWifiConnected)\r
{\r
- bLowPwrDisable = FALSE;\r
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable);\r
- \r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi non-connected idle!!\n"));\r
+// bLowPwrDisable = FALSE;\r
+// pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable);\r
+\r
+ halbtc8192e2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);\r
+ \r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Wifi non-connected idle!!\n"));\r
\r
if( (BT_8192E_2ANT_BT_STATUS_NON_CONNECTED_IDLE == pCoexDm->btStatus) ||\r
(BT_8192E_2ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus) )\r
{\r
- halbtc8192e2ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 2);\r
+// halbtc8192e2ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 2);\r
halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1);\r
halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);\r
}\r
else\r
{ \r
- halbtc8192e2ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 1);\r
+// halbtc8192e2ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 1);\r
halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);\r
halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 1);\r
}\r
{\r
if(BT_8192E_2ANT_BT_STATUS_NON_CONNECTED_IDLE == pCoexDm->btStatus)\r
{\r
- bLowPwrDisable = FALSE;\r
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable);\r
+// bLowPwrDisable = FALSE;\r
+// pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable);\r
\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi connected + BT non connected-idle!!\n"));\r
-\r
- halbtc8192e2ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 2);\r
- halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1);\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Wifi connected + BT non connected-idle!!\n"));\r
+ halbtc8192e2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);\r
+// halbtc8192e2ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 2);\r
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);\r
halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0); \r
halbtc8192e2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);\r
halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);\r
}\r
else if(BT_8192E_2ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus)\r
{\r
- bLowPwrDisable = TRUE;\r
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable);\r
+// bLowPwrDisable = TRUE;\r
+// pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable);\r
\r
if(bBtHsOn)\r
return FALSE;\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi connected + BT connected-idle!!\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Wifi connected + BT connected-idle!!\n"));\r
\r
- halbtc8192e2ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 2);\r
- halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1);\r
+ halbtc8192e2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);\r
+// halbtc8192e2ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 2);\r
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);\r
halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);\r
halbtc8192e2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);\r
halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);\r
}\r
else\r
{\r
- bLowPwrDisable = TRUE;\r
- pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable);\r
+// bLowPwrDisable = TRUE;\r
+// pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable);\r
\r
if(bWifiBusy)\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi Connected-Busy + BT Busy!!\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Wifi Connected-Busy + BT Busy!!\n"));\r
bCommon = FALSE;\r
}\r
else\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi Connected-Idle + BT Busy!!\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Wifi Connected-Idle + BT Busy!!\n"));\r
\r
- halbtc8192e2ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 1);\r
- halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);\r
+ halbtc8192e2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);\r
+// halbtc8192e2ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 1);\r
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);\r
halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 21);\r
halbtc8192e2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6); \r
halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);\r
\r
return bCommon;\r
}\r
+\r
+\r
VOID\r
halbtc8192e2ant_TdmaDurationAdjust(\r
IN PBTC_COEXIST pBtCoexist,\r
s4Byte result; //0: no change, +1: increase WiFi duration, -1: decrease WiFi duration\r
u1Byte retryCount=0;\r
\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], TdmaDurationAdjust()\n"));\r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], TdmaDurationAdjust()\n"));\r
\r
if(!pCoexDm->bAutoTdmaAdjust)\r
{\r
pCoexDm->bAutoTdmaAdjust = TRUE;\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], first run TdmaDurationAdjust()!!\n"));\r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], first run TdmaDurationAdjust()!!\n"));\r
{\r
if(bScoHid)\r
{\r
{\r
//accquire the BT TRx retry count from BT_Info byte2\r
retryCount = pCoexSta->btRetryCnt;\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], retryCount = %d\n", retryCount));\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], up=%d, dn=%d, m=%d, n=%d, WaitCount=%d\n", \r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], retryCount = %d\n", retryCount));\r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], up=%d, dn=%d, m=%d, n=%d, WaitCount=%d\n", \r
up, dn, m, n, WaitCount));\r
result = 0;\r
WaitCount++; \r
up = 0;\r
dn = 0;\r
result = 1; \r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], Increase wifi duration!!\n"));\r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], Increase wifi duration!!\n"));\r
}\r
}\r
else if (retryCount <= 3) // <=3 retry in the last 2-second duration\r
dn = 0;\r
WaitCount = 0;\r
result = -1; \r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], Decrease wifi duration for retryCounter<3!!\n"));\r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], Decrease wifi duration for retryCounter<3!!\n"));\r
}\r
}\r
else //retry count > 3, ¥un1¦¸ retry count > 3, «h½Õ¯¶WiFi duration\r
dn = 0;\r
WaitCount = 0; \r
result = -1;\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], Decrease wifi duration for retryCounter>3!!\n"));\r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], Decrease wifi duration for retryCounter>3!!\n"));\r
}\r
\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], max Interval = %d\n", maxInterval));\r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], max Interval = %d\n", maxInterval));\r
if(maxInterval == 1)\r
{\r
if(bTxPause)\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], TxPause = 1\n"));\r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], TxPause = 1\n"));\r
\r
- if(pCoexDm->curPsTdma == 71)\r
- {\r
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);\r
- pCoexDm->psTdmaDuAdjType = 5;\r
- }\r
- else if(pCoexDm->curPsTdma == 1)\r
+ if(pCoexDm->curPsTdma == 1)\r
{\r
halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);\r
pCoexDm->psTdmaDuAdjType = 5;\r
}\r
else\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], TxPause = 0\n"));\r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], TxPause = 0\n"));\r
if(pCoexDm->curPsTdma == 5)\r
{\r
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 71);\r
- pCoexDm->psTdmaDuAdjType = 71;\r
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);\r
+ pCoexDm->psTdmaDuAdjType = 1;\r
}\r
else if(pCoexDm->curPsTdma == 6)\r
{\r
\r
if(result == -1)\r
{\r
- if(pCoexDm->curPsTdma == 71)\r
- {\r
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);\r
- pCoexDm->psTdmaDuAdjType = 1;\r
- }\r
- else if(pCoexDm->curPsTdma == 1)\r
+ if(pCoexDm->curPsTdma == 1)\r
{\r
halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);\r
pCoexDm->psTdmaDuAdjType = 2;\r
halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);\r
pCoexDm->psTdmaDuAdjType = 1;\r
}\r
- else if(pCoexDm->curPsTdma == 1)\r
- {\r
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 71);\r
- pCoexDm->psTdmaDuAdjType = 71;\r
- }\r
else if(pCoexDm->curPsTdma == 12)\r
{\r
halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);\r
{\r
if(bTxPause)\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], TxPause = 1\n"));\r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], TxPause = 1\n"));\r
if(pCoexDm->curPsTdma == 1)\r
{\r
halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);\r
}\r
else\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], TxPause = 0\n"));\r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], TxPause = 0\n"));\r
if(pCoexDm->curPsTdma == 5)\r
{\r
halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);\r
{\r
if(bTxPause)\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], TxPause = 1\n"));\r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], TxPause = 1\n"));\r
if(pCoexDm->curPsTdma == 1)\r
{\r
halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);\r
}\r
else\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], TxPause = 0\n"));\r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], TxPause = 0\n"));\r
if(pCoexDm->curPsTdma == 5)\r
{\r
halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);\r
if(pCoexDm->curPsTdma != pCoexDm->psTdmaDuAdjType)\r
{\r
BOOLEAN bScan=FALSE, bLink=FALSE, bRoam=FALSE;\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], PsTdma type dismatch!!!, curPsTdma=%d, recordPsTdma=%d\n", \r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], PsTdma type dismatch!!!, curPsTdma=%d, recordPsTdma=%d\n", \r
pCoexDm->curPsTdma, pCoexDm->psTdmaDuAdjType));\r
\r
pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_SCAN, &bScan);\r
}\r
else\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], roaming/link/scan is under progress, will adjust next time!!!\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], roaming/link/scan is under progress, will adjust next time!!!\n"));\r
}\r
}\r
}\r
\r
-// SCO only or SCO+PAN(HS)\r
VOID\r
-halbtc8192e2ant_ActionSco(\r
- IN PBTC_COEXIST pBtCoexist\r
+halbtc8192e2ant_TdmaDurationAdjustForWifiRssiLow(\r
+ IN PBTC_COEXIST pBtCoexist//,\r
+ //IN u1Byte wifiStatus\r
)\r
{\r
- u1Byte wifiRssiState, btRssiState=BTC_RSSI_STATE_STAY_LOW;\r
- u4Byte wifiBw;\r
-\r
- wifiRssiState = halbtc8192e2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);\r
-\r
- halbtc8192e2ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 1);\r
- halbtc8192e2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);\r
-\r
- halbtc8192e2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);\r
+ static s4Byte up,dn,m,n,WaitCount;\r
+ s4Byte result; //0: no change, +1: increase WiFi duration, -1: decrease WiFi duration\r
+ u1Byte retryCount=0, btInfoExt;\r
+\r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], halbtc8192e2ant_TdmaDurationAdjustForWifiRssiLow()\n"));\r
+#if 0\r
+ if( (BT_8192E_2ANT_WIFI_STATUS_NON_CONNECTED_ASSO_AUTH_SCAN == wifiStatus) ||\r
+ (BT_8192E_2ANT_WIFI_STATUS_CONNECTED_SCAN == wifiStatus) ||\r
+ (BT_8192E_2ANT_WIFI_STATUS_CONNECTED_SPECIAL_PKT == wifiStatus) )\r
+ {\r
+ if( pCoexDm->curPsTdma != 81 &&\r
+ pCoexDm->curPsTdma != 82 &&\r
+ pCoexDm->curPsTdma != 83 &&\r
+ pCoexDm->curPsTdma != 84 )\r
+ {\r
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 82);\r
+ pCoexDm->psTdmaDuAdjType = 82;\r
\r
- halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 4);\r
+ up = 0;\r
+ dn = 0;\r
+ m = 1;\r
+ n= 3;\r
+ result = 0;\r
+ WaitCount = 0;\r
+ } \r
+ return;\r
+ }\r
+#endif\r
+ pCoexDm->bAutoTdmaAdjust = FALSE;\r
\r
- btRssiState = halbtc8192e2ant_BtRssiState(3, 34, 42);\r
+ retryCount = pCoexSta->btRetryCnt;\r
+ btInfoExt = pCoexSta->btInfoExt;\r
\r
- if( (btRssiState == BTC_RSSI_STATE_LOW) ||\r
- (btRssiState == BTC_RSSI_STATE_STAY_LOW) )\r
+ if(!pCoexDm->bAutoTdmaAdjustLowRssi)\r
{\r
- halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);\r
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 13);\r
- }\r
- else if( (btRssiState == BTC_RSSI_STATE_MEDIUM) ||\r
- (btRssiState == BTC_RSSI_STATE_STAY_MEDIUM) )\r
- {\r
- halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2);\r
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);\r
- }\r
- else if( (btRssiState == BTC_RSSI_STATE_HIGH) ||\r
- (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )\r
- {\r
- halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 4);\r
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);\r
- }\r
- \r
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);\r
+ pCoexDm->bAutoTdmaAdjustLowRssi = TRUE;\r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], first run TdmaDurationAdjustForWifiRssiLow()!!\n"));\r
\r
- // sw mechanism\r
- if(BTC_WIFI_BW_HT40 == wifiBw)\r
- {\r
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||\r
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )\r
+/*\r
+ if(BT_INFO_8192E_2ANT_A2DP_BASIC_RATE(btInfoExt))\r
{\r
- halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);\r
- halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x6); \r
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 83);\r
+ pCoexDm->psTdmaDuAdjType = 83;\r
}\r
else\r
+*/\r
{\r
- halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);\r
- halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x6); \r
- } \r
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 81);\r
+ pCoexDm->psTdmaDuAdjType = 81;\r
+ }\r
+ //============\r
+ up = 0;\r
+ dn = 0;\r
+ m = 1;\r
+ n= 3;\r
+ result = 0;\r
+ WaitCount = 0;\r
}\r
else\r
{\r
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||\r
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )\r
- {\r
- halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);\r
- halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x6);\r
- }\r
- else\r
+ //accquire the BT TRx retry count from BT_Info byte2\r
+// retryCount = pCoexSta->btRetryCnt;\r
+// btInfoExt = pCoexSta->btInfoExt;\r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], retryCount = %d\n", retryCount));\r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], up=%d, dn=%d, m=%d, n=%d, WaitCount=%d\n", \r
+ up, dn, m, n, WaitCount));\r
+ result = 0;\r
+ WaitCount++; \r
+ \r
+ if ( (pCoexSta->lowPriorityTx) > 1050 || (pCoexSta->lowPriorityRx) > 1250 )\r
+ retryCount++; \r
+ \r
+ if(retryCount == 0) // no retry in the last 2-second duration\r
{\r
- halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);\r
- halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x6);\r
- } \r
- }\r
-}\r
-\r
-VOID\r
-halbtc8192e2ant_ActionScoPan(\r
- IN PBTC_COEXIST pBtCoexist\r
- )\r
-{\r
- u1Byte wifiRssiState, btRssiState=BTC_RSSI_STATE_STAY_LOW;\r
- u4Byte wifiBw;\r
+ up++;\r
+ dn--;\r
\r
- wifiRssiState = halbtc8192e2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);\r
+ if (dn <= 0)\r
+ dn = 0; \r
\r
- halbtc8192e2ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 1);\r
- halbtc8192e2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);\r
+ if(up >= n) // if ³sÄò n Ó2¬í retry count¬°0, «h½Õ¼eWiFi duration\r
+ {\r
+ WaitCount = 0; \r
+ n = 3;\r
+ up = 0;\r
+ dn = 0;\r
+ result = 1; \r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], Increase wifi duration!!\n"));\r
+ }\r
+ }\r
+ else if (retryCount <= 3) // <=3 retry in the last 2-second duration\r
+ {\r
+ up--; \r
+ dn++;\r
\r
- halbtc8192e2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);\r
+ if (up <= 0)\r
+ up = 0;\r
\r
- halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 4);\r
+ if (dn == 2) // if ³sÄò 2 Ó2¬í retry count< 3, «h½Õ¯¶WiFi duration\r
+ {\r
+ if (WaitCount <= 2)\r
+ m++; // ÁקK¤@ª½¦b¨âÓlevel¤¤¨Ó¦^\r
+ else\r
+ m = 1;\r
\r
- btRssiState = halbtc8192e2ant_BtRssiState(3, 34, 42);\r
+ if ( m >= 20) //m ³Ì¤jÈ = 20 ' ³Ì¤j120¬í recheck¬O§_½Õ¾ã WiFi duration.\r
+ m = 20;\r
\r
- if( (btRssiState == BTC_RSSI_STATE_LOW) ||\r
- (btRssiState == BTC_RSSI_STATE_STAY_LOW) )\r
- {\r
- halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);\r
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);\r
- }\r
- else if( (btRssiState == BTC_RSSI_STATE_MEDIUM) ||\r
- (btRssiState == BTC_RSSI_STATE_STAY_MEDIUM) )\r
- {\r
- halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2);\r
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);\r
- }\r
- else if( (btRssiState == BTC_RSSI_STATE_HIGH) ||\r
- (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )\r
- {\r
- halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 4);\r
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);\r
- }\r
- \r
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);\r
-\r
- // sw mechanism\r
- if(BTC_WIFI_BW_HT40 == wifiBw)\r
- {\r
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||\r
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )\r
+ n = 3*m;\r
+ up = 0;\r
+ dn = 0;\r
+ WaitCount = 0;\r
+ result = -1; \r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], Decrease wifi duration for retryCounter<3!!\n"));\r
+ }\r
+ }\r
+ else //retry count > 3, ¥un1¦¸ retry count > 3, «h½Õ¯¶WiFi duration\r
{\r
- halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);\r
- halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x6); \r
+ if (WaitCount == 1)\r
+ m++; // ÁקK¤@ª½¦b¨âÓlevel¤¤¨Ó¦^\r
+ else\r
+ m = 1;\r
+\r
+ if ( m >= 20) //m ³Ì¤jÈ = 20 ' ³Ì¤j120¬í recheck¬O§_½Õ¾ã WiFi duration.\r
+ m = 20;\r
+\r
+ n = 3*m;\r
+ up = 0;\r
+ dn = 0;\r
+ WaitCount = 0; \r
+ result = -1;\r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], Decrease wifi duration for retryCounter>3!!\n"));\r
}\r
- else\r
+\r
+ if(result == -1)\r
{\r
- halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);\r
- halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x6); \r
- } \r
- }\r
- else\r
- {\r
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||\r
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )\r
+/*\r
+ if( (BT_INFO_8192E_2ANT_A2DP_BASIC_RATE(btInfoExt)) &&\r
+ ((pCoexDm->curPsTdma == 81) ||(pCoexDm->curPsTdma == 82)) )\r
+ if( (BT_INFO_8192E_2ANT_A2DP_BASIC_RATE(btInfoExt)) &&\r
+ ((pCoexDm->curPsTdma == 81) ||(pCoexDm->curPsTdma == 82)) )\r
+\r
+ {\r
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 84);\r
+ pCoexDm->psTdmaDuAdjType = 84;\r
+ }\r
+*/\r
+ if(pCoexDm->curPsTdma == 80)\r
+ {\r
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 81);\r
+ pCoexDm->psTdmaDuAdjType = 81;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 81)\r
+ {\r
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 82);\r
+ pCoexDm->psTdmaDuAdjType = 82;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 82)\r
+ {\r
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 83);\r
+ pCoexDm->psTdmaDuAdjType = 83;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 83)\r
+ {\r
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 84);\r
+ pCoexDm->psTdmaDuAdjType = 84;\r
+ }\r
+ }\r
+ else if(result == 1)\r
{\r
- halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);\r
- halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x6);\r
+/*\r
+ if( (BT_INFO_8192E_2ANT_A2DP_BASIC_RATE(btInfoExt)) &&\r
+ ((pCoexDm->curPsTdma == 81) ||(pCoexDm->curPsTdma == 82)) )\r
+ {\r
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 83);\r
+ pCoexDm->psTdmaDuAdjType = 83;\r
+ }\r
+*/\r
+ if(pCoexDm->curPsTdma == 84)\r
+ {\r
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 83);\r
+ pCoexDm->psTdmaDuAdjType = 83;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 83)\r
+ {\r
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 82);\r
+ pCoexDm->psTdmaDuAdjType = 82;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 82)\r
+ {\r
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 81);\r
+ pCoexDm->psTdmaDuAdjType = 81;\r
+ }\r
+ else if((pCoexDm->curPsTdma == 81)&&((pCoexSta->nScanAPNum <= NOISY_AP_NUM_THRESH)))\r
+ {\r
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 80);\r
+ pCoexDm->psTdmaDuAdjType = 80;\r
+ }\r
+\r
}\r
- else\r
+\r
+ if( pCoexDm->curPsTdma != 80 &&\r
+ pCoexDm->curPsTdma != 81 &&\r
+ pCoexDm->curPsTdma != 82 &&\r
+ pCoexDm->curPsTdma != 83 &&\r
+ pCoexDm->curPsTdma != 84 )\r
{\r
- halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);\r
- halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x6);\r
- } \r
+ // recover to previous adjust type\r
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, pCoexDm->psTdmaDuAdjType);\r
+ }\r
}\r
}\r
\r
VOID\r
-halbtc8192e2ant_ActionHid(\r
- IN PBTC_COEXIST pBtCoexist\r
+halbtc8192e2ant_GetBtRssiThreshold(\r
+ IN PBTC_COEXIST pBtCoexist,\r
+ IN pu1Byte pThres0,\r
+ IN pu1Byte pThres1\r
)\r
{\r
- u1Byte wifiRssiState, btRssiState=BTC_RSSI_STATE_HIGH; \r
- u4Byte wifiBw;\r
+ u1Byte antType, btThreshold=0;\r
+ \r
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U1_ANT_TYPE, &antType);\r
\r
- wifiRssiState = halbtc8192e2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);\r
- btRssiState = halbtc8192e2ant_BtRssiState(3, 34, 42);\r
+ switch(antType)\r
+ {\r
+ case BTC_ANT_TYPE_0: // 92E with SPDT\r
+ *pThres0 = 100;\r
+ *pThres1 = 100;\r
+ break;\r
+ case BTC_ANT_TYPE_1: //92E without SPDT, poor antenna isolation\r
+ *pThres0 = 34;\r
+ *pThres1 = 42;\r
+ break;\r
+ case BTC_ANT_TYPE_2: //92E without SPDT, normal antenna isolation\r
+ *pThres0 = 34; //92E with coupler, goodl antenna isolation\r
+ *pThres1 = 42;\r
+ break;\r
+ case BTC_ANT_TYPE_3:\r
+ *pThres0 = 34;\r
+ *pThres1 = 42;\r
+ break;\r
+ case BTC_ANT_TYPE_4:\r
+ *pThres0 = 34;\r
+ *pThres1 = 42;\r
+ break;\r
+ default:\r
+ break;\r
+ }\r
+}\r
+\r
+\r
+//undefined\r
+VOID\r
+halbtc8192e2ant_ActionUndefined(\r
+ IN PBTC_COEXIST pBtCoexist\r
+ )\r
+{\r
+ // power save state\r
+ halbtc8192e2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);\r
+ \r
+ // coex table\r
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);\r
+ \r
+ // pstdma\r
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);\r
+ \r
+ // decrease BT power\r
+ halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);\r
\r
- halbtc8192e2ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 1);\r
+ // limited Rx\r
halbtc8192e2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);\r
\r
+ // fw dac swing level\r
halbtc8192e2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);\r
\r
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);\r
+ // sw mechanism\r
+ halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);\r
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);\r
+}\r
\r
- halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 3);\r
\r
- if( (btRssiState == BTC_RSSI_STATE_LOW) ||\r
- (btRssiState == BTC_RSSI_STATE_STAY_LOW) )\r
- {\r
+// SCO only or SCO+PAN(HS)\r
+VOID\r
+halbtc8192e2ant_ActionSco(\r
+ IN PBTC_COEXIST pBtCoexist\r
+ )\r
+{\r
+ u1Byte wifiRssiState=BTC_RSSI_STATE_HIGH, btRssiState=BTC_RSSI_STATE_HIGH;\r
+ u4Byte wifiBw;\r
+ u1Byte btThresh0=0, btThresh1=0;\r
+ BOOLEAN bApEnable=FALSE;\r
+ \r
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_AP_MODE_ENABLE, &bApEnable);\r
+ \r
+ halbtc8192e2ant_GetBtRssiThreshold(pBtCoexist, &btThresh0, &btThresh1);\r
+ btRssiState = halbtc8192e2ant_BtRssiState(3, btThresh0, btThresh1);\r
+ \r
+ wifiRssiState = halbtc8192e2ant_WifiRssiState(pBtCoexist, 0, 2, 34, 0);\r
+ // btRssiState = halbtc8192e2ant_BtRssiState(3, 34, 42);\r
+ \r
+ // power save state\r
+ if((bApEnable == TRUE) || (BTC_RSSI_HIGH(wifiRssiState) && (!BTC_RSSI_LOW(btRssiState))))\r
+ halbtc8192e2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);\r
+ else\r
+ halbtc8192e2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);\r
+ // halbtc8192e2ant_PowerSaveState(pBtCoexist, BTC_PS_LPS_ON, TRUE, 0x50, 0x4);\r
+ \r
+ // coex table\r
+ if(BTC_RSSI_HIGH(wifiRssiState) && (!BTC_RSSI_LOW(btRssiState)))\r
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);\r
+ else\r
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);\r
+ \r
+ // pstdma\r
+ if(BTC_RSSI_HIGH(wifiRssiState) && (!BTC_RSSI_LOW(btRssiState)))\r
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);\r
+ else\r
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);\r
+ \r
+ // decrease BT power\r
halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);\r
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 13);\r
- }\r
- else if( (btRssiState == BTC_RSSI_STATE_MEDIUM) ||\r
- (btRssiState == BTC_RSSI_STATE_STAY_MEDIUM) )\r
- {\r
- halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2);\r
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);\r
- }\r
- else if( (btRssiState == BTC_RSSI_STATE_HIGH) ||\r
- (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )\r
- {\r
- halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 4);\r
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);\r
- }\r
+\r
+ // limited Rx\r
+ halbtc8192e2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);\r
+\r
+ // fw dac swing level\r
+ halbtc8192e2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);\r
\r
// sw mechanism\r
- if(BTC_WIFI_BW_HT40 == wifiBw)\r
- {\r
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||\r
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )\r
- {\r
- halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);\r
- halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);\r
- }\r
- else\r
- {\r
- halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);\r
- halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);\r
- } \r
- }\r
- else\r
- {\r
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||\r
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )\r
- {\r
- halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);\r
- halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);\r
- }\r
- else\r
- {\r
- halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);\r
- halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);\r
- } \r
- }\r
+ halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);\r
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);\r
}\r
\r
-//A2DP only / PAN(EDR) only/ A2DP+PAN(HS)\r
VOID\r
-halbtc8192e2ant_ActionA2dp(\r
+halbtc8192e2ant_ActionScoPan(\r
IN PBTC_COEXIST pBtCoexist\r
)\r
{\r
- u1Byte wifiRssiState, btRssiState=BTC_RSSI_STATE_HIGH;\r
+ u1Byte wifiRssiState=BTC_RSSI_STATE_HIGH, btRssiState=BTC_RSSI_STATE_HIGH;\r
u4Byte wifiBw;\r
- BOOLEAN bLongDist=FALSE;\r
+ u1Byte btThresh0=0, btThresh1=0;\r
+ BOOLEAN bApEnable=FALSE;\r
\r
- wifiRssiState = halbtc8192e2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);\r
- btRssiState = halbtc8192e2ant_BtRssiState(3, 34, 42);\r
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_AP_MODE_ENABLE, &bApEnable);\r
\r
- if( (btRssiState == BTC_RSSI_STATE_LOW||btRssiState == BTC_RSSI_STATE_STAY_LOW) &&\r
- (wifiRssiState == BTC_RSSI_STATE_LOW||wifiRssiState == BTC_RSSI_STATE_STAY_LOW) )\r
- {\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2dp, wifi/bt rssi both LOW!!\n"));\r
- bLongDist = TRUE;\r
- }\r
- if(bLongDist)\r
- {\r
- halbtc8192e2ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 2);\r
- halbtc8192e2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, TRUE, 0x4);\r
- }\r
+ halbtc8192e2ant_GetBtRssiThreshold(pBtCoexist, &btThresh0, &btThresh1);\r
+ btRssiState = halbtc8192e2ant_BtRssiState(3, btThresh0, btThresh1);\r
+\r
+ wifiRssiState = halbtc8192e2ant_WifiRssiState(pBtCoexist, 0, 2, 34, 0);\r
+ // btRssiState = halbtc8192e2ant_BtRssiState(3, 34, 42);\r
+\r
+ // power save state\r
+ if((bApEnable == TRUE) || (BTC_RSSI_HIGH(wifiRssiState) && (!BTC_RSSI_LOW(btRssiState))))\r
+ halbtc8192e2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);\r
else\r
- {\r
- halbtc8192e2ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 1);\r
- halbtc8192e2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);\r
- }\r
+ halbtc8192e2ant_PowerSaveState(pBtCoexist, BTC_PS_LPS_ON, 0x50, 0x4);\r
+\r
+ // coex table\r
+ if(BTC_RSSI_HIGH(wifiRssiState) && (!BTC_RSSI_LOW(btRssiState)))\r
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 4);\r
+ else\r
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);\r
\r
+\r
+ // pstdm\r
+ if(BTC_RSSI_HIGH(wifiRssiState) && (!BTC_RSSI_LOW(btRssiState)) && (pCoexSta->nScanAPNum < NOISY_AP_NUM_THRESH))\r
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10); //shielding room\r
+ else if (BTC_RSSI_HIGH(wifiRssiState) && (!BTC_RSSI_LOW(btRssiState)) && (pCoexSta->nScanAPNum > NOISY_AP_NUM_THRESH))\r
+ halbtc8192e2ant_PsTdma(pBtCoexist, FORCE_EXEC, TRUE, 10); //open space //antenna at BT\r
+ else //low RSSI\r
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 86);\r
+\r
+\r
+ \r
+ // decrease BT power\r
+ if(BTC_RSSI_LOW(btRssiState))\r
+ halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);\r
+ else if(BTC_RSSI_MEDIUM(btRssiState)) \r
+ halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2);\r
+ else if (pCoexSta->nScanAPNum < NOISY_AP_NUM_THRESH) // BT HIGH RSSI & shielding room\r
+ halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 4);\r
+ \r
+ // limited Rx\r
+ halbtc8192e2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);\r
+ \r
+ // fw dac swing level\r
halbtc8192e2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);\r
\r
- if(bLongDist)\r
- halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);\r
- else\r
- halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);\r
+ // sw mechanism\r
+ halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);\r
+ if(BTC_RSSI_HIGH(wifiRssiState) && (!BTC_RSSI_LOW(btRssiState)) && (pCoexSta->nScanAPNum < NOISY_AP_NUM_THRESH))\r
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18); //shielding room\r
+ else if(BTC_RSSI_HIGH(wifiRssiState) && (!BTC_RSSI_LOW(btRssiState)) && (pCoexSta->nScanAPNum > NOISY_AP_NUM_THRESH))\r
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18); //open space \r
+ else //low RSSI\r
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);\r
+}\r
+\r
+VOID\r
+halbtc8192e2ant_ActionHid(\r
+ IN PBTC_COEXIST pBtCoexist\r
+ )\r
+{\r
+ u1Byte wifiRssiState=BTC_RSSI_STATE_HIGH, btRssiState=BTC_RSSI_STATE_HIGH;\r
+ u4Byte wifiBw;\r
+ u1Byte anttype=0;\r
+ BOOLEAN bApEnable=FALSE;\r
+\r
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_AP_MODE_ENABLE, &bApEnable);\r
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U1_ANT_TYPE, &anttype);\r
\r
+// halbtc8192e2ant_GetBtRssiThreshold(pBtCoexist, &btThresh0, &btThresh1);\r
+// btRssiState = halbtc8192e2ant_BtRssiState(3, btThresh0, btThresh1);\r
\r
- if(bLongDist)\r
+ wifiRssiState = halbtc8192e2ant_WifiRssiState(pBtCoexist, 0, 2, 34, 0);\r
+ btRssiState = halbtc8192e2ant_BtRssiState(3, 34, 42);\r
+\r
+ if(anttype == 0)//ANTTYPE = 0 92E 2ant with SPDT\r
{\r
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 17);\r
- pCoexDm->bAutoTdmaAdjust = FALSE;\r
- halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);\r
+ // power save state & pstdma & coex table\r
+ pCoexDm->bAutoTdmaAdjust = FALSE;\r
+ pCoexDm->bAutoTdmaAdjustLowRssi = FALSE; \r
+ halbtc8192e2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);\r
+ halbtc8192e2ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 0);\r
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);\r
}\r
- else\r
- {\r
- if( (btRssiState == BTC_RSSI_STATE_LOW) ||\r
- (btRssiState == BTC_RSSI_STATE_STAY_LOW) )\r
- {\r
- halbtc8192e2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 1);\r
- halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);\r
- }\r
- else if( (btRssiState == BTC_RSSI_STATE_MEDIUM) ||\r
- (btRssiState == BTC_RSSI_STATE_STAY_MEDIUM) )\r
- {\r
- halbtc8192e2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 1);\r
- halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2);\r
+ else if(anttype == 1) //92E 2ant with coupler and bad ant. isolation, 92E 3ant with bad ant. isolation\r
+ { \r
+ // power save state & pstdma & coex table\r
+ pCoexDm->bAutoTdmaAdjust = FALSE;\r
+ pCoexDm->bAutoTdmaAdjustLowRssi = FALSE; \r
+ halbtc8192e2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);\r
+ halbtc8192e2ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 0);\r
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);\r
+ }\r
+ else if(anttype == 2)//ANTTYPE = 2, 92E 2ant with coupler and normal/good ant. isolation, 92E 3ant with normal ant. isolation\r
+ { \r
+ // power save state & pstdma & coex table\r
+ if(BTC_RSSI_HIGH(wifiRssiState) && (!BTC_RSSI_LOW(btRssiState)) && (pCoexSta->nScanAPNum < NOISY_AP_NUM_THRESH))\r
+ { //WIFI RSSI = high & BT RSSI = high & shielding room\r
+ halbtc8192e2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);\r
+ halbtc8192e2ant_PsTdma(pBtCoexist, FORCE_EXEC, TRUE, 9);\r
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 3); \r
}\r
- else if( (btRssiState == BTC_RSSI_STATE_HIGH) ||\r
- (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )\r
+ else if (BTC_RSSI_HIGH(wifiRssiState)&&(!BTC_RSSI_LOW(btRssiState)) && (pCoexSta->nScanAPNum > NOISY_AP_NUM_THRESH))\r
+ { //WIFI RSSI = high & BT RSSI = high & noisy enviroment\r
+ halbtc8192e2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);\r
+ halbtc8192e2ant_PsTdma(pBtCoexist, FORCE_EXEC, TRUE, 9);\r
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 3);\r
+ }\r
+ else //WIFI RSSI || BT RSSI == low\r
{\r
- halbtc8192e2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 1);\r
- halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 4);\r
+ halbtc8192e2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);\r
+ halbtc8192e2ant_PsTdma(pBtCoexist, FORCE_EXEC, TRUE, 9);\r
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 3);\r
}\r
}\r
- \r
- // sw mechanism\r
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);\r
- if(BTC_WIFI_BW_HT40 == wifiBw)\r
- {\r
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||\r
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )\r
- {\r
- halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);\r
- halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);\r
+ else if(anttype == 3) //ANTTYPE = 3, 92E 3ant with good ant. isolation\r
+ { \r
+ // power save state & pstdma & coex table\r
+ if(BTC_RSSI_HIGH(wifiRssiState) && (!BTC_RSSI_LOW(btRssiState)) && (pCoexSta->nScanAPNum < NOISY_AP_NUM_THRESH))\r
+ { //WIFI RSSI = high & BT RSSI = high & shielding room\r
+ pCoexDm->bAutoTdmaAdjust = FALSE;\r
+ pCoexDm->bAutoTdmaAdjustLowRssi = FALSE; \r
+ halbtc8192e2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);\r
+ halbtc8192e2ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 1);\r
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);\r
+\r
}\r
- else\r
+ else if (BTC_RSSI_HIGH(wifiRssiState)&&(!BTC_RSSI_LOW(btRssiState)) && (pCoexSta->nScanAPNum > NOISY_AP_NUM_THRESH))\r
+ { //WIFI RSSI = high & BT RSSI = high & noisy enviroment\r
+ pCoexDm->bAutoTdmaAdjust = FALSE;\r
+ pCoexDm->bAutoTdmaAdjustLowRssi = FALSE; \r
+ halbtc8192e2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);\r
+ halbtc8192e2ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 1);\r
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);\r
+\r
+ }\r
+ else //WIFI RSSI || BT RSSI == low\r
{\r
- halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);\r
- halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);\r
+ pCoexDm->bAutoTdmaAdjust = FALSE;\r
+ pCoexDm->bAutoTdmaAdjustLowRssi = FALSE; \r
+ halbtc8192e2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);\r
+ halbtc8192e2ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 1);\r
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);\r
}\r
}\r
- else\r
- {\r
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||\r
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )\r
- {\r
- halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);\r
- halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);\r
+ else //ANTTYPE = 4 for test\r
+ { \r
+ // power save state & pstdma & coex table\r
+ if(BTC_RSSI_HIGH(wifiRssiState) && (!BTC_RSSI_LOW(btRssiState)) && (pCoexSta->nScanAPNum < NOISY_AP_NUM_THRESH))\r
+ { //WIFI RSSI = high & BT RSSI = high & shielding room\r
+ halbtc8192e2ant_PowerSaveState(pBtCoexist, BTC_PS_LPS_ON, 0x50, 0x4);\r
+ halbtc8192e2ant_TdmaDurationAdjustForWifiRssiLow(pBtCoexist);\r
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 7);\r
}\r
- else\r
+ else if (BTC_RSSI_HIGH(wifiRssiState)&&(!BTC_RSSI_LOW(btRssiState)) && (pCoexSta->nScanAPNum > NOISY_AP_NUM_THRESH))\r
+ { //WIFI RSSI = high & BT RSSI = high & noisy enviroment\r
+ halbtc8192e2ant_PowerSaveState(pBtCoexist, BTC_PS_LPS_ON, 0x50, 0x4);\r
+ halbtc8192e2ant_TdmaDurationAdjustForWifiRssiLow(pBtCoexist);\r
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 7);\r
+ }\r
+ else //WIFI RSSI || BT RSSI == low\r
{\r
- halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);\r
- halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);\r
- } \r
+ halbtc8192e2ant_PowerSaveState(pBtCoexist, BTC_PS_LPS_ON, 0x50, 0x4);\r
+ halbtc8192e2ant_TdmaDurationAdjustForWifiRssiLow(pBtCoexist);\r
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 7);\r
+ }\r
}\r
+\r
+ // power save state\r
+ halbtc8192e2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);\r
+\r
+ // coex table\r
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);\r
+\r
+ // pstdma\r
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);\r
+\r
+ // decrease BT power\r
+ halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);\r
+ \r
+ // limited Rx\r
+ halbtc8192e2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);\r
+ \r
+ // fw dac swing level\r
+ halbtc8192e2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);\r
+ \r
+ // sw mechanism\r
+ halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);\r
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);\r
}\r
\r
+//A2DP only / PAN(EDR) only/ A2DP+PAN(HS)\r
VOID\r
-halbtc8192e2ant_ActionA2dpPanHs(\r
+halbtc8192e2ant_ActionA2dp(\r
IN PBTC_COEXIST pBtCoexist\r
)\r
{\r
- u1Byte wifiRssiState, btRssiState=BTC_RSSI_STATE_HIGH;\r
+ u1Byte wifiRssiState=BTC_RSSI_STATE_HIGH, btRssiState=BTC_RSSI_STATE_HIGH;\r
u4Byte wifiBw;\r
+ u1Byte anttype=0;\r
+ BOOLEAN bApEnable=FALSE;\r
\r
- wifiRssiState = halbtc8192e2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);\r
- btRssiState = halbtc8192e2ant_BtRssiState(3, 34, 42);\r
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_AP_MODE_ENABLE, &bApEnable);\r
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U1_ANT_TYPE, &anttype);\r
\r
- halbtc8192e2ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 1);\r
- halbtc8192e2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);\r
+// halbtc8192e2ant_GetBtRssiThreshold(pBtCoexist, &btThresh0, &btThresh1);\r
+// btRssiState = halbtc8192e2ant_BtRssiState(3, btThresh0, btThresh1);\r
\r
- halbtc8192e2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);\r
- halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);\r
+ wifiRssiState = halbtc8192e2ant_WifiRssiState(pBtCoexist, 0, 2, 34, 0);\r
+ btRssiState = halbtc8192e2ant_BtRssiState(3, 34, 42);\r
\r
- if( (btRssiState == BTC_RSSI_STATE_LOW) ||\r
- (btRssiState == BTC_RSSI_STATE_STAY_LOW) )\r
+// anttype = 4;\r
+\r
+ if(anttype == 0)//ANTTYPE = 0 92E 2ant with SPDT\r
{\r
- halbtc8192e2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 2);\r
- halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);\r
+ // power save state & pstdma & coex table\r
+ if(BTC_RSSI_HIGH(wifiRssiState) && (!BTC_RSSI_LOW(btRssiState)) && (pCoexSta->nScanAPNum < NOISY_AP_NUM_THRESH))\r
+ { //WIFI RSSI = high & BT RSSI = high & shielding room\r
+ halbtc8192e2ant_PowerSaveState(pBtCoexist, BTC_PS_LPS_ON, 0x50, 0x4);\r
+ halbtc8192e2ant_TdmaDurationAdjustForWifiRssiLow(pBtCoexist);\r
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 7);\r
+ }\r
+ else if (BTC_RSSI_HIGH(wifiRssiState)&&(!BTC_RSSI_LOW(btRssiState)) && (pCoexSta->nScanAPNum > NOISY_AP_NUM_THRESH))\r
+ { //WIFI RSSI = high & BT RSSI = high & noisy enviroment\r
+ pCoexDm->bAutoTdmaAdjust = FALSE;\r
+ pCoexDm->bAutoTdmaAdjustLowRssi = FALSE; \r
+ halbtc8192e2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);\r
+ halbtc8192e2ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 0);\r
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);\r
+ }\r
+ else //WIFI RSSI || BT RSSI == low\r
+ {\r
+ halbtc8192e2ant_PowerSaveState(pBtCoexist, BTC_PS_LPS_ON, 0x50, 0x4);\r
+ halbtc8192e2ant_TdmaDurationAdjustForWifiRssiLow(pBtCoexist);\r
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 7);\r
+ }\r
}\r
- else if( (btRssiState == BTC_RSSI_STATE_MEDIUM) ||\r
- (btRssiState == BTC_RSSI_STATE_STAY_MEDIUM) )\r
- {\r
- halbtc8192e2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 2);\r
- halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2);\r
+ else if(anttype == 1) //92E 2ant with coupler and bad ant. isolation, 92E 3ant with bad ant. isolation\r
+ { \r
+ // power save state & pstdma & coex table\r
+ if(BTC_RSSI_HIGH(wifiRssiState) && (!BTC_RSSI_LOW(btRssiState)) && (pCoexSta->nScanAPNum < NOISY_AP_NUM_THRESH))\r
+ { //WIFI RSSI = high & BT RSSI = high & shielding room\r
+ halbtc8192e2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);\r
+ halbtc8192e2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 1); //shielding room\r
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 7);\r
+ }\r
+ else if (BTC_RSSI_HIGH(wifiRssiState)&&(!BTC_RSSI_LOW(btRssiState)) && (pCoexSta->nScanAPNum > NOISY_AP_NUM_THRESH))\r
+ { //WIFI RSSI = high & BT RSSI = high & noisy enviroment\r
+ pCoexDm->bAutoTdmaAdjust = FALSE;\r
+ pCoexDm->bAutoTdmaAdjustLowRssi = FALSE; \r
+ halbtc8192e2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);\r
+ halbtc8192e2ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 1);\r
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);\r
+ }\r
+ else //WIFI RSSI || BT RSSI == low\r
+ {\r
+ halbtc8192e2ant_PowerSaveState(pBtCoexist, BTC_PS_LPS_ON, 0x50, 0x4);\r
+ halbtc8192e2ant_TdmaDurationAdjustForWifiRssiLow(pBtCoexist);\r
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 7);\r
+ }\r
+\r
}\r
- else if( (btRssiState == BTC_RSSI_STATE_HIGH) ||\r
- (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )\r
- {\r
- halbtc8192e2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 2);\r
- halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 4);\r
+ else if(anttype == 2)//ANTTYPE = 2, 92E 2ant with coupler and normal/good ant. isolation, 92E 3ant with normal ant. isolation\r
+ { \r
+ // power save state & pstdma & coex table\r
+ if(BTC_RSSI_HIGH(wifiRssiState) && (!BTC_RSSI_LOW(btRssiState)) && (pCoexSta->nScanAPNum < NOISY_AP_NUM_THRESH))\r
+ { //WIFI RSSI = high & BT RSSI = high & shielding room\r
+ halbtc8192e2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);\r
+ halbtc8192e2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 1);\r
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 5); \r
+ }\r
+ else if (BTC_RSSI_HIGH(wifiRssiState)&&(!BTC_RSSI_LOW(btRssiState)) && (pCoexSta->nScanAPNum > NOISY_AP_NUM_THRESH))\r
+ { //WIFI RSSI = high & BT RSSI = high & noisy enviroment\r
+ pCoexDm->bAutoTdmaAdjust = FALSE;\r
+ pCoexDm->bAutoTdmaAdjustLowRssi = FALSE; \r
+ halbtc8192e2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);\r
+ halbtc8192e2ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 1);\r
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);\r
+ }\r
+ else //WIFI RSSI || BT RSSI == low\r
+ {\r
+ halbtc8192e2ant_PowerSaveState(pBtCoexist, BTC_PS_LPS_ON, 0x50, 0x4);\r
+ halbtc8192e2ant_TdmaDurationAdjustForWifiRssiLow(pBtCoexist);\r
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 7);\r
+ }\r
}\r
+ else if(anttype == 3) //ANTTYPE = 3, 92E 3ant with good ant. isolation\r
+ { \r
+ // power save state & pstdma & coex table\r
+ if(BTC_RSSI_HIGH(wifiRssiState) && (!BTC_RSSI_LOW(btRssiState)) && (pCoexSta->nScanAPNum < NOISY_AP_NUM_THRESH))\r
+ { //WIFI RSSI = high & BT RSSI = high & shielding room\r
+ pCoexDm->bAutoTdmaAdjust = FALSE;\r
+ pCoexDm->bAutoTdmaAdjustLowRssi = FALSE; \r
+ halbtc8192e2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);\r
+ halbtc8192e2ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 1);\r
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);\r
\r
- // sw mechanism\r
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);\r
- if(BTC_WIFI_BW_HT40 == wifiBw)\r
- {\r
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||\r
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )\r
- {\r
- halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);\r
- halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,TRUE,0x6);\r
}\r
- else\r
+ else if (BTC_RSSI_HIGH(wifiRssiState)&&(!BTC_RSSI_LOW(btRssiState)) && (pCoexSta->nScanAPNum > NOISY_AP_NUM_THRESH))\r
+ { //WIFI RSSI = high & BT RSSI = high & noisy enviroment\r
+ pCoexDm->bAutoTdmaAdjust = FALSE;\r
+ pCoexDm->bAutoTdmaAdjustLowRssi = FALSE; \r
+ halbtc8192e2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);\r
+ halbtc8192e2ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 1);\r
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);\r
+\r
+ }\r
+ else //WIFI RSSI || BT RSSI == low\r
{\r
- halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);\r
- halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,TRUE,0x6);\r
+ pCoexDm->bAutoTdmaAdjust = FALSE;\r
+ pCoexDm->bAutoTdmaAdjustLowRssi = FALSE; \r
+ halbtc8192e2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);\r
+ halbtc8192e2ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 1);\r
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);\r
}\r
}\r
- else\r
- {\r
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||\r
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )\r
- {\r
- halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);\r
- halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,TRUE,0x6);\r
+ else //ANTTYPE = 4 for test\r
+ { \r
+ // power save state & pstdma & coex table\r
+ if(BTC_RSSI_HIGH(wifiRssiState) && (!BTC_RSSI_LOW(btRssiState)) && (pCoexSta->nScanAPNum < NOISY_AP_NUM_THRESH))\r
+ { //WIFI RSSI = high & BT RSSI = high & shielding room\r
+ halbtc8192e2ant_PowerSaveState(pBtCoexist, BTC_PS_LPS_ON, 0x50, 0x4);\r
+ halbtc8192e2ant_TdmaDurationAdjustForWifiRssiLow(pBtCoexist);\r
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 7);\r
}\r
- else\r
+ else if (BTC_RSSI_HIGH(wifiRssiState)&&(!BTC_RSSI_LOW(btRssiState)) && (pCoexSta->nScanAPNum > NOISY_AP_NUM_THRESH))\r
+ { //WIFI RSSI = high & BT RSSI = high & noisy enviroment\r
+ halbtc8192e2ant_PowerSaveState(pBtCoexist, BTC_PS_LPS_ON, 0x50, 0x4);\r
+ halbtc8192e2ant_TdmaDurationAdjustForWifiRssiLow(pBtCoexist);\r
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 7);\r
+ }\r
+ else //WIFI RSSI || BT RSSI == low\r
{\r
- halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);\r
- halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,TRUE,0x6);\r
- } \r
+ halbtc8192e2ant_PowerSaveState(pBtCoexist, BTC_PS_LPS_ON, 0x50, 0x4);\r
+ halbtc8192e2ant_TdmaDurationAdjustForWifiRssiLow(pBtCoexist);\r
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 7);\r
+ }\r
}\r
+\r
+ // decrease BT power\r
+ if(BTC_RSSI_LOW(btRssiState))\r
+ halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);\r
+ else if(BTC_RSSI_MEDIUM(btRssiState)) \r
+ halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2);\r
+ else if (pCoexSta->nScanAPNum < NOISY_AP_NUM_THRESH) // BT HIGH RSSI & shielding room\r
+ halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 4);\r
+\r
+ // limited Rx\r
+ halbtc8192e2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);\r
+ \r
+ // fw dac swing level\r
+ halbtc8192e2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);\r
+ \r
+ // sw mechanism\r
+ halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);\r
+ if(BTC_RSSI_HIGH(wifiRssiState) && (!BTC_RSSI_LOW(btRssiState)) && (pCoexSta->nScanAPNum < NOISY_AP_NUM_THRESH))\r
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18); //shielding room\r
+ else if(BTC_RSSI_HIGH(wifiRssiState) && (!BTC_RSSI_LOW(btRssiState)) && (pCoexSta->nScanAPNum > NOISY_AP_NUM_THRESH))\r
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,TRUE,0x06); //open space \r
+ else //low RSSI\r
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);\r
}\r
\r
VOID\r
-halbtc8192e2ant_ActionPanEdr(\r
+halbtc8192e2ant_ActionA2dpPanHs(\r
IN PBTC_COEXIST pBtCoexist\r
)\r
{\r
wifiRssiState = halbtc8192e2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);\r
btRssiState = halbtc8192e2ant_BtRssiState(3, 34, 42);\r
\r
- halbtc8192e2ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 1);\r
+// halbtc8192e2ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 1);\r
halbtc8192e2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);\r
\r
halbtc8192e2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);\r
-\r
halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);\r
\r
if( (btRssiState == BTC_RSSI_STATE_LOW) ||\r
(btRssiState == BTC_RSSI_STATE_STAY_LOW) )\r
{\r
+ halbtc8192e2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 2);\r
halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);\r
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);\r
}\r
else if( (btRssiState == BTC_RSSI_STATE_MEDIUM) ||\r
(btRssiState == BTC_RSSI_STATE_STAY_MEDIUM) )\r
{\r
+ halbtc8192e2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 2);\r
halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2);\r
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);\r
}\r
else if( (btRssiState == BTC_RSSI_STATE_HIGH) ||\r
(btRssiState == BTC_RSSI_STATE_STAY_HIGH) )\r
{\r
+ halbtc8192e2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 2);\r
halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 4);\r
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);\r
}\r
- \r
+\r
// sw mechanism\r
pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);\r
- if(BTC_WIFI_BW_HT40 == wifiBw)\r
- {\r
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||\r
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )\r
- {\r
- halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);\r
- halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);\r
- }\r
- else\r
- {\r
- halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);\r
- halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);\r
- }\r
- }\r
- else\r
- {\r
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||\r
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )\r
- {\r
- halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);\r
- halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);\r
- }\r
- else\r
- {\r
- halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);\r
- halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);\r
- }\r
- }\r
+ halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);\r
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);\r
}\r
\r
-//PAN(HS) only\r
VOID\r
-halbtc8192e2ant_ActionPanHs(\r
+halbtc8192e2ant_ActionPanEdr(\r
IN PBTC_COEXIST pBtCoexist\r
)\r
{\r
- u1Byte wifiRssiState, btRssiState=BTC_RSSI_STATE_HIGH;\r
+ u1Byte wifiRssiState=BTC_RSSI_STATE_HIGH, btRssiState=BTC_RSSI_STATE_HIGH;\r
u4Byte wifiBw;\r
+ u1Byte btThresh0=0, btThresh1=0;\r
+ BOOLEAN bApEnable=FALSE;\r
\r
- wifiRssiState = halbtc8192e2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);\r
- btRssiState = halbtc8192e2ant_BtRssiState(3, 34, 42);\r
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_AP_MODE_ENABLE, &bApEnable);\r
\r
- halbtc8192e2ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 1);\r
- halbtc8192e2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);\r
+ halbtc8192e2ant_GetBtRssiThreshold(pBtCoexist, &btThresh0, &btThresh1);\r
+ btRssiState = halbtc8192e2ant_BtRssiState(3, btThresh0, btThresh1);\r
\r
- halbtc8192e2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);\r
+ wifiRssiState = halbtc8192e2ant_WifiRssiState(pBtCoexist, 0, 2, 34, 0);\r
+ // btRssiState = halbtc8192e2ant_BtRssiState(3, 34, 42);\r
\r
- halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);\r
+ // power save state\r
+ if((bApEnable == TRUE) || (BTC_RSSI_HIGH(wifiRssiState) && (!BTC_RSSI_LOW(btRssiState))))\r
+ halbtc8192e2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);\r
+ else\r
+ halbtc8192e2ant_PowerSaveState(pBtCoexist, BTC_PS_LPS_ON, 0x50, 0x4);\r
\r
- if( (btRssiState == BTC_RSSI_STATE_LOW) ||\r
- (btRssiState == BTC_RSSI_STATE_STAY_LOW) )\r
- {\r
+ // coex table\r
+ if(BTC_RSSI_HIGH(wifiRssiState) && (!BTC_RSSI_LOW(btRssiState)))\r
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);\r
+ else\r
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);\r
+\r
+ // pstdma\r
+ if(BTC_RSSI_HIGH(wifiRssiState) && (!BTC_RSSI_LOW(btRssiState)) && (pCoexSta->nScanAPNum < NOISY_AP_NUM_THRESH))\r
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1); //shielding room\r
+ else if (BTC_RSSI_HIGH(wifiRssiState) && (!BTC_RSSI_LOW(btRssiState)) && (pCoexSta->nScanAPNum > NOISY_AP_NUM_THRESH))\r
+ halbtc8192e2ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 1); //open space //antenna at BT\r
+ else //low RSSI\r
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 85);\r
+\r
+ \r
+ // decrease BT power\r
+ if(BTC_RSSI_LOW(btRssiState))\r
halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);\r
- }\r
- else if( (btRssiState == BTC_RSSI_STATE_MEDIUM) ||\r
- (btRssiState == BTC_RSSI_STATE_STAY_MEDIUM) )\r
- {\r
+ else if(BTC_RSSI_MEDIUM(btRssiState)) \r
halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2);\r
- }\r
- else if( (btRssiState == BTC_RSSI_STATE_HIGH) ||\r
- (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )\r
- {\r
+ else if (pCoexSta->nScanAPNum < NOISY_AP_NUM_THRESH) // BT HIGH RSSI & shielding room\r
halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 4);\r
- }\r
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 1);\r
\r
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);\r
- if(BTC_WIFI_BW_HT40 == wifiBw)\r
- {\r
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||\r
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )\r
- {\r
- halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);\r
- halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);\r
- }\r
- else\r
- {\r
- halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);\r
- halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);\r
- }\r
- }\r
- else\r
- {\r
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||\r
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )\r
- {\r
- halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);\r
- halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);\r
- }\r
- else\r
- {\r
- halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);\r
- halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);\r
- }\r
- }\r
+ \r
+ // limited Rx\r
+ halbtc8192e2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);\r
+ \r
+ // fw dac swing level\r
+ halbtc8192e2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);\r
+ \r
+ // sw mechanism\r
+ halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);\r
+ if(BTC_RSSI_HIGH(wifiRssiState) && (!BTC_RSSI_LOW(btRssiState)) && (pCoexSta->nScanAPNum < NOISY_AP_NUM_THRESH))\r
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18); //shielding room\r
+ else if(BTC_RSSI_HIGH(wifiRssiState) && (!BTC_RSSI_LOW(btRssiState)) && (pCoexSta->nScanAPNum > NOISY_AP_NUM_THRESH))\r
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18); //open space \r
+ else //low RSSI\r
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);\r
}\r
\r
-//PAN(EDR)+A2DP\r
+//PAN(HS) only\r
VOID\r
-halbtc8192e2ant_ActionPanEdrA2dp(\r
+halbtc8192e2ant_ActionPanHs(\r
IN PBTC_COEXIST pBtCoexist\r
)\r
{\r
wifiRssiState = halbtc8192e2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);\r
btRssiState = halbtc8192e2ant_BtRssiState(3, 34, 42);\r
\r
- halbtc8192e2ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 1);\r
+// halbtc8192e2ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 1);\r
halbtc8192e2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);\r
-\r
+ halbtc8192e2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);\r
halbtc8192e2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);\r
-\r
halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);\r
\r
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);\r
-\r
if( (btRssiState == BTC_RSSI_STATE_LOW) ||\r
(btRssiState == BTC_RSSI_STATE_STAY_LOW) )\r
{\r
halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);\r
- halbtc8192e2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 3);\r
}\r
else if( (btRssiState == BTC_RSSI_STATE_MEDIUM) ||\r
(btRssiState == BTC_RSSI_STATE_STAY_MEDIUM) )\r
{\r
halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2);\r
- halbtc8192e2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 3);\r
}\r
else if( (btRssiState == BTC_RSSI_STATE_HIGH) ||\r
(btRssiState == BTC_RSSI_STATE_STAY_HIGH) )\r
{\r
halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 4);\r
- halbtc8192e2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 3);\r
- }\r
- \r
- // sw mechanism \r
- if(BTC_WIFI_BW_HT40 == wifiBw)\r
- {\r
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||\r
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )\r
- {\r
- halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);\r
- halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);\r
- }\r
- else\r
- {\r
- halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE);\r
- halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);\r
- }\r
- }\r
- else\r
- {\r
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||\r
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )\r
- {\r
- halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);\r
- halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);\r
- }\r
- else\r
- {\r
- halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);\r
- halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);\r
- }\r
}\r
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 1);\r
+\r
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);\r
+ halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);\r
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);\r
}\r
\r
+//PAN(EDR)+A2DP\r
VOID\r
-halbtc8192e2ant_ActionPanEdrHid(\r
+halbtc8192e2ant_ActionPanEdrA2dp(\r
IN PBTC_COEXIST pBtCoexist\r
)\r
{\r
- u1Byte wifiRssiState, btRssiState=BTC_RSSI_STATE_HIGH;\r
+ u1Byte wifiRssiState=BTC_RSSI_STATE_HIGH, btRssiState=BTC_RSSI_STATE_HIGH;\r
u4Byte wifiBw;\r
+ u1Byte btThresh0=0, btThresh1=0;\r
+ BOOLEAN bApEnable=FALSE;\r
\r
- wifiRssiState = halbtc8192e2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);\r
- btRssiState = halbtc8192e2ant_BtRssiState(3, 34, 42);\r
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_AP_MODE_ENABLE, &bApEnable);\r
\r
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);\r
+ halbtc8192e2ant_GetBtRssiThreshold(pBtCoexist, &btThresh0, &btThresh1);\r
+ btRssiState = halbtc8192e2ant_BtRssiState(3, btThresh0, btThresh1);\r
\r
- halbtc8192e2ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 1);\r
- halbtc8192e2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);\r
+ wifiRssiState = halbtc8192e2ant_WifiRssiState(pBtCoexist, 0, 2, 34, 0);\r
+ // btRssiState = halbtc8192e2ant_BtRssiState(3, 34, 42);\r
\r
- halbtc8192e2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);\r
+ // power save state\r
+ if((bApEnable == TRUE) || (BTC_RSSI_HIGH(wifiRssiState) && (!BTC_RSSI_LOW(btRssiState))))\r
+ halbtc8192e2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);\r
+ else\r
+ halbtc8192e2ant_PowerSaveState(pBtCoexist, BTC_PS_LPS_ON, 0x50, 0x4);\r
\r
- halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 3);\r
+ // coex table\r
+ if(BTC_RSSI_HIGH(wifiRssiState) && (!BTC_RSSI_LOW(btRssiState)))\r
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);\r
+ else\r
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);\r
\r
- if( (btRssiState == BTC_RSSI_STATE_LOW) ||\r
- (btRssiState == BTC_RSSI_STATE_STAY_LOW) )\r
- {\r
+ // pstdma\r
+ if(BTC_RSSI_HIGH(wifiRssiState) && (!BTC_RSSI_LOW(btRssiState)) && (pCoexSta->nScanAPNum < NOISY_AP_NUM_THRESH))\r
+ halbtc8192e2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 3); //shielding room\r
+ else if (BTC_RSSI_HIGH(wifiRssiState) && (!BTC_RSSI_LOW(btRssiState)) && (pCoexSta->nScanAPNum > NOISY_AP_NUM_THRESH))\r
+ halbtc8192e2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 3); //open space //antenna at BT\r
+ else //low RSSI\r
+{\r
+ pCoexDm->bAutoTdmaAdjust = FALSE; \r
+ pCoexDm->bAutoTdmaAdjustLowRssi = FALSE;\r
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 86);\r
+}\r
+ \r
+ // decrease BT power\r
+ if(BTC_RSSI_LOW(btRssiState))\r
halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);\r
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);\r
- }\r
- else if( (btRssiState == BTC_RSSI_STATE_MEDIUM) ||\r
- (btRssiState == BTC_RSSI_STATE_STAY_MEDIUM) )\r
- {\r
+ else if(BTC_RSSI_MEDIUM(btRssiState)) \r
halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2);\r
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);\r
- }\r
- else if( (btRssiState == BTC_RSSI_STATE_HIGH) ||\r
- (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )\r
- {\r
+ else if (pCoexSta->nScanAPNum < NOISY_AP_NUM_THRESH) // BT HIGH RSSI & shielding room\r
halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 4);\r
- halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);\r
- }\r
+\r
+ \r
+ // limited Rx\r
+ halbtc8192e2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);\r
+ \r
+ // fw dac swing level\r
+ halbtc8192e2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);\r
\r
// sw mechanism\r
- if(BTC_WIFI_BW_HT40 == wifiBw)\r
- {\r
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||\r
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )\r
- {\r
- halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);\r
- halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);\r
- }\r
- else\r
- {\r
- halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);\r
- halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);\r
- }\r
- }\r
- else\r
- {\r
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||\r
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )\r
- {\r
- halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);\r
- halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);\r
- }\r
- else\r
- {\r
- halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);\r
- halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);\r
- }\r
- }\r
+ halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);\r
+ if(BTC_RSSI_HIGH(wifiRssiState) && (!BTC_RSSI_LOW(btRssiState)) && (pCoexSta->nScanAPNum < NOISY_AP_NUM_THRESH))\r
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18); //shielding room\r
+ else if(BTC_RSSI_HIGH(wifiRssiState) && (!BTC_RSSI_LOW(btRssiState)) && (pCoexSta->nScanAPNum > NOISY_AP_NUM_THRESH))\r
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18); //open space \r
+ else //low RSSI\r
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);\r
}\r
\r
-// HID+A2DP+PAN(EDR)\r
VOID\r
-halbtc8192e2ant_ActionHidA2dpPanEdr(\r
+halbtc8192e2ant_ActionPanEdrHid(\r
IN PBTC_COEXIST pBtCoexist\r
)\r
{\r
- u1Byte wifiRssiState, btRssiState=BTC_RSSI_STATE_HIGH;\r
+ u1Byte wifiRssiState=BTC_RSSI_STATE_HIGH, btRssiState=BTC_RSSI_STATE_HIGH;\r
u4Byte wifiBw;\r
+ u1Byte btThresh0=0, btThresh1=0;\r
+ BOOLEAN bApEnable=FALSE;\r
\r
- wifiRssiState = halbtc8192e2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);\r
- btRssiState = halbtc8192e2ant_BtRssiState(3, 34, 42);\r
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_AP_MODE_ENABLE, &bApEnable);\r
\r
- halbtc8192e2ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 1);\r
- halbtc8192e2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);\r
+ halbtc8192e2ant_GetBtRssiThreshold(pBtCoexist, &btThresh0, &btThresh1);\r
+ btRssiState = halbtc8192e2ant_BtRssiState(3, btThresh0, btThresh1);\r
\r
- halbtc8192e2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);\r
+ wifiRssiState = halbtc8192e2ant_WifiRssiState(pBtCoexist, 0, 2, 34, 0);\r
+ // btRssiState = halbtc8192e2ant_BtRssiState(3, 34, 42);\r
\r
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);\r
+ // power save state\r
+ if((bApEnable == TRUE) || (BTC_RSSI_HIGH(wifiRssiState) && (!BTC_RSSI_LOW(btRssiState))))\r
+ halbtc8192e2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);\r
+ else\r
+ halbtc8192e2ant_PowerSaveState(pBtCoexist, BTC_PS_LPS_ON, 0x50, 0x4);\r
\r
- halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 3);\r
+ // coex table\r
+ if(BTC_RSSI_HIGH(wifiRssiState) && (!BTC_RSSI_LOW(btRssiState)))\r
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 3);\r
+ else\r
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);\r
\r
- if( (btRssiState == BTC_RSSI_STATE_LOW) ||\r
- (btRssiState == BTC_RSSI_STATE_STAY_LOW) )\r
- {\r
+ // pstdm\r
+ if(BTC_RSSI_HIGH(wifiRssiState) && (!BTC_RSSI_LOW(btRssiState)) && (pCoexSta->nScanAPNum < NOISY_AP_NUM_THRESH))\r
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10); //shielding room\r
+ else if (BTC_RSSI_HIGH(wifiRssiState) && (!BTC_RSSI_LOW(btRssiState)) && (pCoexSta->nScanAPNum > NOISY_AP_NUM_THRESH))\r
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10); //open space //antenna at BT\r
+ else //low RSSI\r
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 86);\r
+\r
+ \r
+ // decrease BT power\r
+ if(BTC_RSSI_LOW(btRssiState))\r
halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);\r
- halbtc8192e2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 3);\r
- }\r
- else if( (btRssiState == BTC_RSSI_STATE_MEDIUM) ||\r
- (btRssiState == BTC_RSSI_STATE_STAY_MEDIUM) )\r
- {\r
+ else if(BTC_RSSI_MEDIUM(btRssiState)) \r
halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2);\r
- halbtc8192e2ant_TdmaDurationAdjust(pBtCoexist, TRUE, FALSE, 3);\r
- }\r
- else if( (btRssiState == BTC_RSSI_STATE_HIGH) ||\r
- (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )\r
- {\r
+ else if (pCoexSta->nScanAPNum < NOISY_AP_NUM_THRESH) // BT HIGH RSSI & shielding room\r
halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 4);\r
- halbtc8192e2ant_TdmaDurationAdjust(pBtCoexist, TRUE, FALSE, 3);\r
- }\r
\r
+ \r
+ // limited Rx\r
+ halbtc8192e2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);\r
+ \r
+ // fw dac swing level\r
+ halbtc8192e2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);\r
+ \r
// sw mechanism\r
- if(BTC_WIFI_BW_HT40 == wifiBw)\r
- {\r
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||\r
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )\r
- {\r
- halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);\r
- halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);\r
- }\r
- else\r
- {\r
- halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);\r
- halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);\r
- }\r
- }\r
- else\r
- {\r
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||\r
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )\r
- {\r
- halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);\r
- halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);\r
- }\r
- else\r
- {\r
- halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);\r
- halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);\r
- }\r
- }\r
+ halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);\r
+ if(BTC_RSSI_HIGH(wifiRssiState) && (!BTC_RSSI_LOW(btRssiState)) && (pCoexSta->nScanAPNum < NOISY_AP_NUM_THRESH))\r
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18); //shielding room\r
+ else if(BTC_RSSI_HIGH(wifiRssiState) && (!BTC_RSSI_LOW(btRssiState)) && (pCoexSta->nScanAPNum > NOISY_AP_NUM_THRESH))\r
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18); //open space \r
+ else //low RSSI\r
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);\r
}\r
\r
+// HID+A2DP+PAN(EDR)\r
VOID\r
-halbtc8192e2ant_ActionHidA2dp(\r
+halbtc8192e2ant_ActionHidA2dpPanEdr(\r
IN PBTC_COEXIST pBtCoexist\r
)\r
{\r
- u1Byte wifiRssiState, btRssiState=BTC_RSSI_STATE_HIGH;\r
+ u1Byte wifiRssiState=BTC_RSSI_STATE_HIGH, btRssiState=BTC_RSSI_STATE_HIGH;\r
u4Byte wifiBw;\r
+ u1Byte btThresh0=0, btThresh1=0;\r
+ BOOLEAN bApEnable=FALSE;\r
\r
- wifiRssiState = halbtc8192e2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0);\r
- btRssiState = halbtc8192e2ant_BtRssiState(3, 34, 42);\r
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_AP_MODE_ENABLE, &bApEnable);\r
\r
- halbtc8192e2ant_SwitchSsType(pBtCoexist, NORMAL_EXEC, 1);\r
- halbtc8192e2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);\r
+ halbtc8192e2ant_GetBtRssiThreshold(pBtCoexist, &btThresh0, &btThresh1);\r
+ btRssiState = halbtc8192e2ant_BtRssiState(3, btThresh0, btThresh1);\r
\r
- pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);\r
+ wifiRssiState = halbtc8192e2ant_WifiRssiState(pBtCoexist, 0, 2, 34, 0);\r
+ // btRssiState = halbtc8192e2ant_BtRssiState(3, 34, 42);\r
\r
- halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 3);\r
+ // power save state\r
+ if((bApEnable == TRUE) || (BTC_RSSI_HIGH(wifiRssiState) && (!BTC_RSSI_LOW(btRssiState))))\r
+ halbtc8192e2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);\r
+ else\r
+ halbtc8192e2ant_PowerSaveState(pBtCoexist, BTC_PS_LPS_ON, 0x50, 0x4);\r
+\r
+ // coex table\r
+ if(BTC_RSSI_HIGH(wifiRssiState) && (!BTC_RSSI_LOW(btRssiState)))\r
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 3);\r
+ else\r
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0); //6\r
+\r
+ // pstdma\r
+ if(BTC_RSSI_HIGH(wifiRssiState) && (!BTC_RSSI_LOW(btRssiState)) && (pCoexSta->nScanAPNum < NOISY_AP_NUM_THRESH))\r
+ halbtc8192e2ant_TdmaDurationAdjust(pBtCoexist, TRUE, FALSE, 3); //shielding room\r
+ else if (BTC_RSSI_HIGH(wifiRssiState) && (!BTC_RSSI_LOW(btRssiState)) && (pCoexSta->nScanAPNum > NOISY_AP_NUM_THRESH))\r
+ halbtc8192e2ant_TdmaDurationAdjust(pBtCoexist, TRUE, FALSE, 3); //open space //antenna at BT\r
+ else //low RSSI\r
+ {\r
+ pCoexDm->bAutoTdmaAdjust = FALSE; \r
+ pCoexDm->bAutoTdmaAdjustLowRssi = FALSE;\r
+ halbtc8192e2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 86);\r
+ }\r
\r
- if( (btRssiState == BTC_RSSI_STATE_LOW) ||\r
- (btRssiState == BTC_RSSI_STATE_STAY_LOW) )\r
- {\r
+ // decrease BT power\r
+ if(BTC_RSSI_LOW(btRssiState))\r
halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);\r
- halbtc8192e2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 2);\r
- }\r
- else if( (btRssiState == BTC_RSSI_STATE_MEDIUM) ||\r
- (btRssiState == BTC_RSSI_STATE_STAY_MEDIUM) )\r
- {\r
+ else if(BTC_RSSI_MEDIUM(btRssiState)) \r
halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2);\r
- halbtc8192e2ant_TdmaDurationAdjust(pBtCoexist, TRUE, FALSE, 2);\r
- }\r
- else if( (btRssiState == BTC_RSSI_STATE_HIGH) ||\r
- (btRssiState == BTC_RSSI_STATE_STAY_HIGH) )\r
- {\r
+ else if (pCoexSta->nScanAPNum < NOISY_AP_NUM_THRESH) // BT HIGH RSSI & shielding room\r
halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 4);\r
- halbtc8192e2ant_TdmaDurationAdjust(pBtCoexist, TRUE, FALSE, 2);\r
- } \r
+ \r
+ // limited Rx\r
+ halbtc8192e2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);\r
+ \r
+ // fw dac swing level\r
+ halbtc8192e2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);\r
\r
// sw mechanism\r
- if(BTC_WIFI_BW_HT40 == wifiBw)\r
+ halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);\r
+ if(BTC_RSSI_HIGH(wifiRssiState) && (!BTC_RSSI_LOW(btRssiState)) && (pCoexSta->nScanAPNum < NOISY_AP_NUM_THRESH))\r
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18); //shielding room\r
+ else if(BTC_RSSI_HIGH(wifiRssiState) && (!BTC_RSSI_LOW(btRssiState)) && (pCoexSta->nScanAPNum > NOISY_AP_NUM_THRESH))\r
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18); //open space \r
+ else //low RSSI\r
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);\r
+}\r
+\r
+VOID\r
+halbtc8192e2ant_ActionHidA2dp(\r
+ IN PBTC_COEXIST pBtCoexist\r
+ )\r
+{\r
+ u1Byte wifiRssiState=BTC_RSSI_STATE_HIGH, btRssiState=BTC_RSSI_STATE_HIGH;\r
+ u4Byte wifiBw;\r
+ u1Byte btThresh0=0, btThresh1=0, anttype=0;\r
+ BOOLEAN bApEnable=FALSE;\r
+ \r
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_AP_MODE_ENABLE, &bApEnable);\r
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U1_ANT_TYPE, &anttype);\r
+ \r
+ // halbtc8192e2ant_GetBtRssiThreshold(pBtCoexist, &btThresh0, &btThresh1);\r
+ // btRssiState = halbtc8192e2ant_BtRssiState(3, btThresh0, btThresh1);\r
+ \r
+ wifiRssiState = halbtc8192e2ant_WifiRssiState(pBtCoexist, 0, 2, 34, 0);\r
+ btRssiState = halbtc8192e2ant_BtRssiState(3, 34, 42);\r
+ \r
+ if(anttype == 0)//ANTTYPE = 0 92E 2ant with SPDT\r
{\r
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||\r
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )\r
+ // power save state & pstdma & coex table\r
+ if(BTC_RSSI_HIGH(wifiRssiState) && (!BTC_RSSI_LOW(btRssiState)) && (pCoexSta->nScanAPNum < NOISY_AP_NUM_THRESH))\r
+ {\r
+ halbtc8192e2ant_PowerSaveState(pBtCoexist, BTC_PS_LPS_ON, 0x50, 0x4);\r
+ halbtc8192e2ant_PsTdma(pBtCoexist, FORCE_EXEC, TRUE, 83);\r
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 8);\r
+\r
+ }\r
+ else if (BTC_RSSI_HIGH(wifiRssiState)&&(!BTC_RSSI_LOW(btRssiState)) && (pCoexSta->nScanAPNum > NOISY_AP_NUM_THRESH))\r
{\r
- halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);\r
- halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);\r
+ pCoexDm->bAutoTdmaAdjust = FALSE;\r
+ pCoexDm->bAutoTdmaAdjustLowRssi = FALSE; \r
+ halbtc8192e2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);\r
+ halbtc8192e2ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 0);\r
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);\r
}\r
else\r
{\r
- halbtc8192e2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE);\r
- halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);\r
+ halbtc8192e2ant_PowerSaveState(pBtCoexist, BTC_PS_LPS_ON, 0x50, 0x4);\r
+ halbtc8192e2ant_PsTdma(pBtCoexist, FORCE_EXEC, TRUE, 83);\r
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 8);\r
}\r
}\r
- else\r
- {\r
- if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||\r
- (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )\r
+ else if(anttype == 1) //92E 2ant with coupler and bad ant. isolation, 92E 3ant with bad ant. isolation\r
+ { \r
+ // power save state & pstdma & coex table\r
+ if(BTC_RSSI_HIGH(wifiRssiState) && (!BTC_RSSI_LOW(btRssiState)) && (pCoexSta->nScanAPNum < NOISY_AP_NUM_THRESH))\r
+ {\r
+ halbtc8192e2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);\r
+ halbtc8192e2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 2);\r
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 8);\r
+ }\r
+ else if (BTC_RSSI_HIGH(wifiRssiState)&&(!BTC_RSSI_LOW(btRssiState)) && (pCoexSta->nScanAPNum > NOISY_AP_NUM_THRESH))\r
{\r
- halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);\r
- halbtc8192e2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18);\r
+ pCoexDm->bAutoTdmaAdjust = FALSE;\r
+ pCoexDm->bAutoTdmaAdjustLowRssi = FALSE; \r
+ halbtc8192e2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);\r
+ halbtc8192e2ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 0);\r
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);\r
}\r
else\r
{\r
- halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE);\r
- halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);\r
+ halbtc8192e2ant_PowerSaveState(pBtCoexist, BTC_PS_LPS_ON, 0x50, 0x4);\r
+ halbtc8192e2ant_PsTdma(pBtCoexist, FORCE_EXEC, TRUE, 83);\r
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 8);\r
+ }\r
+ }\r
+ else if(anttype == 2)//ANTTYPE = 2, 92E 2ant with coupler and normal/good ant. isolation, 92E 3ant with normal ant. isolation\r
+ { \r
+ // power save state & pstdma & coex table\r
+ if(BTC_RSSI_HIGH(wifiRssiState) && (!BTC_RSSI_LOW(btRssiState)) && (pCoexSta->nScanAPNum < NOISY_AP_NUM_THRESH))\r
+ { //WIFI RSSI = high & BT RSSI = high & shielding room\r
+ halbtc8192e2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);\r
+ halbtc8192e2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 2);\r
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 8); \r
+ }\r
+ else if (BTC_RSSI_HIGH(wifiRssiState)&&(!BTC_RSSI_LOW(btRssiState)) && (pCoexSta->nScanAPNum > NOISY_AP_NUM_THRESH))\r
+ { //WIFI RSSI = high & BT RSSI = high & noisy enviroment\r
+ pCoexDm->bAutoTdmaAdjust = FALSE;\r
+ pCoexDm->bAutoTdmaAdjustLowRssi = FALSE; \r
+ halbtc8192e2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);\r
+ halbtc8192e2ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 0);\r
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 8);\r
+ }\r
+ else //WIFI RSSI || BT RSSI == low\r
+ {\r
+ halbtc8192e2ant_PowerSaveState(pBtCoexist, BTC_PS_LPS_ON, 0x50, 0x4);\r
+ halbtc8192e2ant_PsTdma(pBtCoexist, FORCE_EXEC, TRUE, 83);\r
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 8);\r
+ }\r
+ }\r
+ else if(anttype == 3) //ANTTYPE = 3, 92E 3ant with good ant. isolation\r
+ { \r
+ // power save state & pstdma & coex table\r
+ if(BTC_RSSI_HIGH(wifiRssiState) && (!BTC_RSSI_LOW(btRssiState)) && (pCoexSta->nScanAPNum < NOISY_AP_NUM_THRESH))\r
+ { //WIFI RSSI = high & BT RSSI = high & shielding room\r
+ pCoexDm->bAutoTdmaAdjust = FALSE;\r
+ pCoexDm->bAutoTdmaAdjustLowRssi = FALSE; \r
+ halbtc8192e2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);\r
+ halbtc8192e2ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 1);\r
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);\r
+\r
+ }\r
+ else if (BTC_RSSI_HIGH(wifiRssiState)&&(!BTC_RSSI_LOW(btRssiState)) && (pCoexSta->nScanAPNum > NOISY_AP_NUM_THRESH))\r
+ { //WIFI RSSI = high & BT RSSI = high & noisy enviroment\r
+ pCoexDm->bAutoTdmaAdjust = FALSE;\r
+ pCoexDm->bAutoTdmaAdjustLowRssi = FALSE; \r
+ halbtc8192e2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);\r
+ halbtc8192e2ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 1);\r
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);\r
+\r
+ }\r
+ else //WIFI RSSI || BT RSSI == low\r
+ {\r
+ pCoexDm->bAutoTdmaAdjust = FALSE;\r
+ pCoexDm->bAutoTdmaAdjustLowRssi = FALSE; \r
+ halbtc8192e2ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);\r
+ halbtc8192e2ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 1);\r
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);\r
}\r
}\r
+ else //ANTTYPE = 4 for test\r
+ { \r
+ // power save state & pstdma & coex table\r
+ if(BTC_RSSI_HIGH(wifiRssiState) && (!BTC_RSSI_LOW(btRssiState)) && (pCoexSta->nScanAPNum < NOISY_AP_NUM_THRESH))\r
+ { //WIFI RSSI = high & BT RSSI = high & shielding room\r
+ halbtc8192e2ant_PowerSaveState(pBtCoexist, BTC_PS_LPS_ON, 0x50, 0x4);\r
+ halbtc8192e2ant_TdmaDurationAdjustForWifiRssiLow(pBtCoexist);\r
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 7);\r
+ }\r
+ else if (BTC_RSSI_HIGH(wifiRssiState)&&(!BTC_RSSI_LOW(btRssiState)) && (pCoexSta->nScanAPNum > NOISY_AP_NUM_THRESH))\r
+ { //WIFI RSSI = high & BT RSSI = high & noisy enviroment\r
+ halbtc8192e2ant_PowerSaveState(pBtCoexist, BTC_PS_LPS_ON, 0x50, 0x4);\r
+ halbtc8192e2ant_TdmaDurationAdjustForWifiRssiLow(pBtCoexist);\r
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 7);\r
+ }\r
+ else //WIFI RSSI || BT RSSI == low\r
+ {\r
+ halbtc8192e2ant_PowerSaveState(pBtCoexist, BTC_PS_LPS_ON, 0x50, 0x4);\r
+ halbtc8192e2ant_TdmaDurationAdjustForWifiRssiLow(pBtCoexist);\r
+ halbtc8192e2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 7);\r
+ }\r
+ }\r
+\r
+ // decrease BT power\r
+ if(BTC_RSSI_LOW(btRssiState))\r
+ halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0);\r
+ else if(BTC_RSSI_MEDIUM(btRssiState)) \r
+ halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2);\r
+ else if (pCoexSta->nScanAPNum < NOISY_AP_NUM_THRESH) // BT HIGH RSSI & shielding room\r
+ halbtc8192e2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 4);\r
+\r
+ \r
+ // limited Rx\r
+ halbtc8192e2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x8);\r
+ \r
+ // fw dac swing level\r
+ halbtc8192e2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6);\r
+ \r
+ // sw mechanism\r
+ halbtc8192e2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE);\r
+ if(BTC_RSSI_HIGH(wifiRssiState) && (!BTC_RSSI_LOW(btRssiState)) && (pCoexSta->nScanAPNum < NOISY_AP_NUM_THRESH))\r
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18); //shielding room\r
+ else if(BTC_RSSI_HIGH(wifiRssiState) && (!BTC_RSSI_LOW(btRssiState)) && (pCoexSta->nScanAPNum > NOISY_AP_NUM_THRESH))\r
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,TRUE,0x06); //open space \r
+ else //low RSSI\r
+ halbtc8192e2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18);\r
+}\r
+\r
+VOID\r
+halbtc8192e2ant_ActionBtWhckTest(\r
+ IN PBTC_COEXIST pBtCoexist\r
+ )\r
+{\r
+\r
+}\r
+\r
+VOID\r
+halbtc8192e2ant_ActionWifiMultiPort(\r
+ IN PBTC_COEXIST pBtCoexist\r
+ )\r
+{ \r
+\r
}\r
\r
VOID\r
u1Byte btInfoOriginal=0, btRetryCnt=0;\r
u1Byte algorithm=0;\r
\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], RunCoexistMechanism()===>\n"));\r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], RunCoexistMechanism()===>\n"));\r
\r
if(pBtCoexist->bManualControl)\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], RunCoexistMechanism(), return for Manual CTRL <===\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], RunCoexistMechanism(), return for Manual CTRL <===\n"));\r
return;\r
}\r
\r
if(pCoexSta->bUnderIps)\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], wifi is under IPS !!!\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], wifi is under IPS !!!\n"));\r
return;\r
}\r
\r
algorithm = halbtc8192e2ant_ActionAlgorithm(pBtCoexist);\r
if(pCoexSta->bC2hBtInquiryPage && (BT_8192E_2ANT_COEX_ALGO_PANHS!=algorithm))\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT is under inquiry/page scan !!\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], BT is under inquiry/page scan !!\n"));\r
halbtc8192e2ant_ActionBtInquiry(pBtCoexist);\r
return;\r
}\r
\r
pCoexDm->curAlgorithm = algorithm;\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Algorithm = %d \n", pCoexDm->curAlgorithm));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Algorithm = %d \n", pCoexDm->curAlgorithm));\r
\r
if(halbtc8192e2ant_IsCommonAction(pBtCoexist))\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant common.\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Action 2-Ant common.\n"));\r
pCoexDm->bAutoTdmaAdjust = FALSE;\r
+ pCoexDm->bAutoTdmaAdjustLowRssi = FALSE;\r
}\r
else\r
{\r
if(pCoexDm->curAlgorithm != pCoexDm->preAlgorithm)\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], preAlgorithm=%d, curAlgorithm=%d\n", \r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], preAlgorithm=%d, curAlgorithm=%d\n", \r
pCoexDm->preAlgorithm, pCoexDm->curAlgorithm));\r
pCoexDm->bAutoTdmaAdjust = FALSE;\r
+ pCoexDm->bAutoTdmaAdjustLowRssi = FALSE;\r
}\r
switch(pCoexDm->curAlgorithm)\r
{\r
case BT_8192E_2ANT_COEX_ALGO_SCO:\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = SCO.\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Action 2-Ant, algorithm = SCO.\n"));\r
halbtc8192e2ant_ActionSco(pBtCoexist);\r
break;\r
case BT_8192E_2ANT_COEX_ALGO_SCO_PAN:\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = SCO+PAN(EDR).\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Action 2-Ant, algorithm = SCO+PAN(EDR).\n"));\r
halbtc8192e2ant_ActionScoPan(pBtCoexist);\r
break;\r
case BT_8192E_2ANT_COEX_ALGO_HID:\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HID.\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Action 2-Ant, algorithm = HID.\n"));\r
halbtc8192e2ant_ActionHid(pBtCoexist);\r
break;\r
case BT_8192E_2ANT_COEX_ALGO_A2DP:\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = A2DP.\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Action 2-Ant, algorithm = A2DP.\n"));\r
halbtc8192e2ant_ActionA2dp(pBtCoexist);\r
break;\r
case BT_8192E_2ANT_COEX_ALGO_A2DP_PANHS:\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = A2DP+PAN(HS).\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Action 2-Ant, algorithm = A2DP+PAN(HS).\n"));\r
halbtc8192e2ant_ActionA2dpPanHs(pBtCoexist);\r
break;\r
case BT_8192E_2ANT_COEX_ALGO_PANEDR:\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = PAN(EDR).\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Action 2-Ant, algorithm = PAN(EDR).\n"));\r
halbtc8192e2ant_ActionPanEdr(pBtCoexist);\r
break;\r
case BT_8192E_2ANT_COEX_ALGO_PANHS:\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HS mode.\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Action 2-Ant, algorithm = HS mode.\n"));\r
halbtc8192e2ant_ActionPanHs(pBtCoexist);\r
break;\r
case BT_8192E_2ANT_COEX_ALGO_PANEDR_A2DP:\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = PAN+A2DP.\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Action 2-Ant, algorithm = PAN+A2DP.\n"));\r
halbtc8192e2ant_ActionPanEdrA2dp(pBtCoexist);\r
break;\r
case BT_8192E_2ANT_COEX_ALGO_PANEDR_HID:\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = PAN(EDR)+HID.\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Action 2-Ant, algorithm = PAN(EDR)+HID.\n"));\r
halbtc8192e2ant_ActionPanEdrHid(pBtCoexist);\r
break;\r
case BT_8192E_2ANT_COEX_ALGO_HID_A2DP_PANEDR:\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HID+A2DP+PAN.\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Action 2-Ant, algorithm = HID+A2DP+PAN.\n"));\r
halbtc8192e2ant_ActionHidA2dpPanEdr(pBtCoexist);\r
break;\r
case BT_8192E_2ANT_COEX_ALGO_HID_A2DP:\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HID+A2DP.\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Action 2-Ant, algorithm = HID+A2DP.\n"));\r
halbtc8192e2ant_ActionHidA2dp(pBtCoexist);\r
break;\r
default:\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = unknown!!\n"));\r
- //halbtc8192e2ant_CoexAllOff(pBtCoexist);\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Action 2-Ant, algorithm = undefined!!\n"));\r
+ halbtc8192e2ant_ActionUndefined(pBtCoexist);\r
break;\r
}\r
pCoexDm->preAlgorithm = pCoexDm->curAlgorithm;\r
u2Byte u2Tmp=0;\r
u1Byte u1Tmp=0;\r
\r
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], 2Ant Init HW Config!!\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], 2Ant Init HW Config!!\n"));\r
\r
if(bBackUp)\r
{\r
IN PBTC_COEXIST pBtCoexist\r
)\r
{\r
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], Coex Mechanism Init!!\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Coex Mechanism Init!!\n"));\r
\r
halbtc8192e2ant_InitCoexDm(pBtCoexist);\r
}\r
pBoardInfo->pgAntNum, pBoardInfo->btdmAntNum);\r
CL_PRINTF(cliBuf);\r
\r
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d", "Antenna type:", \\r
+ pBoardInfo->antType);\r
+ CL_PRINTF(cliBuf);\r
+ \r
CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %s / %d", "BT stack/ hci ext ver", \\r
((pStackInfo->bProfileNotified)? "Yes":"No"), pStackInfo->hciVersion);\r
CL_PRINTF(cliBuf);\r
pCoexDm->wifiChnlInfo[0], pCoexDm->wifiChnlInfo[1],\r
pCoexDm->wifiChnlInfo[2]);\r
CL_PRINTF(cliBuf);\r
-\r
+ \r
// wifi status\r
CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s", "============[Wifi Status]============");\r
CL_PRINTF(cliBuf);\r
CL_PRINTF(cliBuf);\r
}\r
}\r
-\r
+/*\r
CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x ", "SS Type", \\r
pCoexDm->curSsType);\r
CL_PRINTF(cliBuf);\r
-\r
+*/\r
// Sw mechanism \r
CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s", "============[Sw mechanism]============");\r
CL_PRINTF(cliBuf);\r
{\r
if(BTC_IPS_ENTER == type)\r
{\r
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], IPS ENTER notify\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], IPS ENTER notify\n"));\r
pCoexSta->bUnderIps = TRUE;\r
halbtc8192e2ant_CoexAllOff(pBtCoexist);\r
halbtc8192e2ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_BT, FALSE, TRUE);\r
}\r
else if(BTC_IPS_LEAVE == type)\r
{\r
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], IPS LEAVE notify\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], IPS LEAVE notify\n"));\r
pCoexSta->bUnderIps = FALSE;\r
}\r
}\r
{\r
if(BTC_LPS_ENABLE == type)\r
{\r
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], LPS ENABLE notify\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], LPS ENABLE notify\n"));\r
pCoexSta->bUnderLps = TRUE;\r
}\r
else if(BTC_LPS_DISABLE == type)\r
{\r
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], LPS DISABLE notify\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], LPS DISABLE notify\n"));\r
pCoexSta->bUnderLps = FALSE;\r
}\r
}\r
{\r
if(BTC_SCAN_START == type)\r
{\r
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], SCAN START notify\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], SCAN START notify\n"));\r
}\r
else if(BTC_SCAN_FINISH == type)\r
{\r
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], SCAN FINISH notify\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], SCAN FINISH notify\n"));\r
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U1_AP_NUM, &pCoexSta->nScanAPNum);\r
+\r
}\r
}\r
\r
{\r
if(BTC_ASSOCIATE_START == type)\r
{\r
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], CONNECT START notify\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], CONNECT START notify\n"));\r
}\r
else if(BTC_ASSOCIATE_FINISH == type)\r
{\r
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], CONNECT FINISH notify\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], CONNECT FINISH notify\n"));\r
}\r
}\r
\r
\r
if(BTC_MEDIA_CONNECT == type)\r
{\r
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], MEDIA connect notify\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], MEDIA connect notify\n"));\r
}\r
else\r
{\r
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], MEDIA disconnect notify\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], MEDIA disconnect notify\n"));\r
}\r
\r
+ \r
// only 2.4G we need to inform bt the chnl mask\r
pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U1_WIFI_CENTRAL_CHNL, &wifiCentralChnl);\r
if( (BTC_MEDIA_CONNECT == type) &&\r
pCoexDm->wifiChnlInfo[1] = H2C_Parameter[1];\r
pCoexDm->wifiChnlInfo[2] = H2C_Parameter[2];\r
\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], FW write 0x66=0x%x\n", \r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], FW write 0x66=0x%x\n", \r
H2C_Parameter[0]<<16|H2C_Parameter[1]<<8|H2C_Parameter[2]));\r
\r
pBtCoexist->fBtcFillH2c(pBtCoexist, 0x66, 3, H2C_Parameter); \r
{\r
if(type == BTC_PACKET_DHCP)\r
{\r
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], DHCP Packet notify\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], DHCP Packet notify\n"));\r
}\r
}\r
\r
rspSource = BT_INFO_SRC_8192E_2ANT_WIFI_FW;\r
pCoexSta->btInfoC2hCnt[rspSource]++;\r
\r
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], Bt info[%d], length=%d, hex data=[", rspSource, length));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Bt info[%d], length=%d, hex data=[", rspSource, length));\r
for(i=0; i<length; i++)\r
{\r
pCoexSta->btInfoC2h[rspSource][i] = tmpBuf[i];\r
btInfo = tmpBuf[i];\r
if(i == length-1)\r
{\r
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("0x%02x]\n", tmpBuf[i]));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("0x%02x]\n", tmpBuf[i]));\r
}\r
else\r
{\r
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("0x%02x, ", tmpBuf[i]));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("0x%02x, ", tmpBuf[i]));\r
}\r
}\r
\r
// because bt is reset and loss of the info.\r
if( (pCoexSta->btInfoExt & BIT1) )\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT ext info bit1 check, send wifi BW&Chnl to BT!!\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], BT ext info bit1 check, send wifi BW&Chnl to BT!!\n"));\r
pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);\r
if(bWifiConnected)\r
{\r
{\r
if(!pBtCoexist->bManualControl && !pBtCoexist->bStopCoexDm)\r
{\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT ext info bit3 check, set BT NOT to ignore Wlan active!!\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], BT ext info bit3 check, set BT NOT to ignore Wlan active!!\n"));\r
halbtc8192e2ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, FALSE);\r
}\r
}\r
if(!(btInfo&BT_INFO_8192E_2ANT_B_CONNECTION))\r
{\r
pCoexDm->btStatus = BT_8192E_2ANT_BT_STATUS_NON_CONNECTED_IDLE;\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), BT Non-Connected idle!!!\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], BtInfoNotify(), BT Non-Connected idle!!!\n"));\r
}\r
else if(btInfo == BT_INFO_8192E_2ANT_B_CONNECTION) // connection exists but no busy\r
{\r
pCoexDm->btStatus = BT_8192E_2ANT_BT_STATUS_CONNECTED_IDLE;\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), BT Connected-idle!!!\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], BtInfoNotify(), BT Connected-idle!!!\n"));\r
}\r
else if((btInfo&BT_INFO_8192E_2ANT_B_SCO_ESCO) ||\r
(btInfo&BT_INFO_8192E_2ANT_B_SCO_BUSY))\r
{\r
pCoexDm->btStatus = BT_8192E_2ANT_BT_STATUS_SCO_BUSY;\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), BT SCO busy!!!\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], BtInfoNotify(), BT SCO busy!!!\n"));\r
}\r
else if(btInfo&BT_INFO_8192E_2ANT_B_ACL_BUSY)\r
{\r
pCoexDm->btStatus = BT_8192E_2ANT_BT_STATUS_ACL_BUSY;\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), BT ACL busy!!!\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], BtInfoNotify(), BT ACL busy!!!\n"));\r
}\r
else\r
{\r
pCoexDm->btStatus = BT_8192E_2ANT_BT_STATUS_MAX;\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), BT Non-Defined state!!!\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], BtInfoNotify(), BT Non-Defined state!!!\n"));\r
}\r
\r
if( (BT_8192E_2ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus) ||\r
IN PBTC_COEXIST pBtCoexist\r
)\r
{\r
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], Halt notify\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Halt notify\n"));\r
\r
halbtc8192e2ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_BT, FALSE, TRUE);\r
halbtc8192e2ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, TRUE);\r
PBTC_BOARD_INFO pBoardInfo=&pBtCoexist->boardInfo;\r
PBTC_STACK_INFO pStackInfo=&pBtCoexist->stackInfo;\r
\r
- BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], ==========================Periodical===========================\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], ==========================Periodical===========================\n"));\r
\r
if(disVerInfoCnt <= 5)\r
{\r
disVerInfoCnt += 1;\r
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], ****************************************************************\n"));\r
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], Ant PG Num/ Ant Mech/ Ant Pos = %d/ %d/ %d\n", \\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], ****************************************************************\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Ant PG Num/ Ant Mech/ Ant Pos = %d/ %d/ %d\n", \r
pBoardInfo->pgAntNum, pBoardInfo->btdmAntNum, pBoardInfo->btdmAntPos));\r
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], BT stack/ hci ext ver = %s / %d\n", \\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], BT stack/ hci ext ver = %s / %d\n", \r
((pStackInfo->bProfileNotified)? "Yes":"No"), pStackInfo->hciVersion));\r
pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_BT_PATCH_VER, &btPatchVer);\r
pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_FW_VER, &fwVer);\r
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], CoexVer/ FwVer/ PatchVer = %d_%x/ 0x%x/ 0x%x(%d)\n", \\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], CoexVer/ FwVer/ PatchVer = %d_%x/ 0x%x/ 0x%x(%d)\n", \r
GLCoexVerDate8192e2Ant, GLCoexVer8192e2Ant, fwVer, btPatchVer, btPatchVer));\r
- BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], ****************************************************************\n"));\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], ****************************************************************\n"));\r
}\r
\r
#if(BT_AUTO_REPORT_ONLY_8192E_2ANT == 0)\r