--- /dev/null
+//============================================================\r
+// Description:\r
+//\r
+// This file is for RTL8723A Co-exist mechanism\r
+//\r
+// History\r
+// 2012/08/22 Cosa first check in.\r
+// 2012/11/14 Cosa Revise for 8723A 2Ant out sourcing.\r
+//\r
+//============================================================\r
+\r
+//============================================================\r
+// include files\r
+//============================================================\r
+#include "Mp_Precomp.h"\r
+\r
+#if WPP_SOFTWARE_TRACE\r
+#include "HalBtc8723a2Ant.tmh"\r
+#endif\r
+\r
+#if(BT_30_SUPPORT == 1)\r
+//============================================================\r
+// Global variables, these are static variables\r
+//============================================================\r
+static COEX_DM_8723A_2ANT GLCoexDm8723a2Ant;\r
+static PCOEX_DM_8723A_2ANT pCoexDm=&GLCoexDm8723a2Ant;\r
+static COEX_STA_8723A_2ANT GLCoexSta8723a2Ant;\r
+static PCOEX_STA_8723A_2ANT pCoexSta=&GLCoexSta8723a2Ant;\r
+\r
+const char *const GLBtInfoSrc8723a2Ant[]={\r
+ "BT Info[wifi fw]",\r
+ "BT Info[bt rsp]",\r
+ "BT Info[bt auto report]",\r
+};\r
+\r
+//============================================================\r
+// local function proto type if needed\r
+//============================================================\r
+//============================================================\r
+// local function start with halbtc8723a2ant_\r
+//============================================================\r
+BOOLEAN\r
+halbtc8723a2ant_IsWifiIdle(\r
+ IN PBTC_COEXIST pBtCoexist\r
+ )\r
+{\r
+ BOOLEAN bWifiConnected=FALSE, bScan=FALSE, bLink=FALSE, bRoam=FALSE;\r
+\r
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);\r
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_SCAN, &bScan);\r
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_LINK, &bLink);\r
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_ROAM, &bRoam);\r
+\r
+ if(bWifiConnected)\r
+ return FALSE;\r
+ if(bScan)\r
+ return FALSE;\r
+ if(bLink)\r
+ return FALSE;\r
+ if(bRoam)\r
+ return FALSE;\r
+\r
+ return TRUE;\r
+}\r
+\r
+BOOLEAN\r
+halbtc8723a2ant_IsWifiConnectedIdle(\r
+ IN PBTC_COEXIST pBtCoexist\r
+ )\r
+{\r
+ BOOLEAN bWifiConnected=FALSE, bScan=FALSE, bLink=FALSE, bRoam=FALSE, bWifiBusy=FALSE;\r
+\r
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);\r
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_SCAN, &bScan);\r
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_LINK, &bLink);\r
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_ROAM, &bRoam);\r
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy);\r
+\r
+ if(bScan)\r
+ return FALSE;\r
+ if(bLink)\r
+ return FALSE;\r
+ if(bRoam)\r
+ return FALSE;\r
+ if(bWifiConnected && !bWifiBusy)\r
+ return TRUE;\r
+ else \r
+ return FALSE;\r
+}\r
+\r
+u1Byte\r
+halbtc8723a2ant_BtRssiState(\r
+ u1Byte levelNum,\r
+ u1Byte rssiThresh,\r
+ u1Byte rssiThresh1\r
+ )\r
+{\r
+ s4Byte btRssi=0;\r
+ u1Byte btRssiState=pCoexSta->preBtRssiState;\r
+\r
+ btRssi = pCoexSta->btRssi;\r
+\r
+ if(levelNum == 2)\r
+ { \r
+ if( (pCoexSta->preBtRssiState == BTC_RSSI_STATE_LOW) ||\r
+ (pCoexSta->preBtRssiState == BTC_RSSI_STATE_STAY_LOW))\r
+ {\r
+ if(btRssi >= (rssiThresh+BTC_RSSI_COEX_THRESH_TOL_8723A_2ANT))\r
+ {\r
+ btRssiState = BTC_RSSI_STATE_HIGH;\r
+ }\r
+ else\r
+ {\r
+ btRssiState = BTC_RSSI_STATE_STAY_LOW;\r
+ }\r
+ }\r
+ else\r
+ {\r
+ if(btRssi < rssiThresh)\r
+ {\r
+ btRssiState = BTC_RSSI_STATE_LOW;\r
+ }\r
+ else\r
+ {\r
+ btRssiState = BTC_RSSI_STATE_STAY_HIGH;\r
+ }\r
+ }\r
+ }\r
+ else if(levelNum == 3)\r
+ {\r
+ if(rssiThresh > rssiThresh1)\r
+ {\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
+ if(btRssi >= (rssiThresh+BTC_RSSI_COEX_THRESH_TOL_8723A_2ANT))\r
+ {\r
+ btRssiState = BTC_RSSI_STATE_MEDIUM;\r
+ }\r
+ else\r
+ {\r
+ btRssiState = BTC_RSSI_STATE_STAY_LOW;\r
+ }\r
+ }\r
+ else if( (pCoexSta->preBtRssiState == BTC_RSSI_STATE_MEDIUM) ||\r
+ (pCoexSta->preBtRssiState == BTC_RSSI_STATE_STAY_MEDIUM))\r
+ {\r
+ if(btRssi >= (rssiThresh1+BTC_RSSI_COEX_THRESH_TOL_8723A_2ANT))\r
+ {\r
+ btRssiState = BTC_RSSI_STATE_HIGH;\r
+ }\r
+ else if(btRssi < rssiThresh)\r
+ {\r
+ btRssiState = BTC_RSSI_STATE_LOW;\r
+ }\r
+ else\r
+ {\r
+ btRssiState = BTC_RSSI_STATE_STAY_MEDIUM;\r
+ }\r
+ }\r
+ else\r
+ {\r
+ if(btRssi < rssiThresh1)\r
+ {\r
+ btRssiState = BTC_RSSI_STATE_MEDIUM;\r
+ }\r
+ else\r
+ {\r
+ btRssiState = BTC_RSSI_STATE_STAY_HIGH;\r
+ }\r
+ }\r
+ }\r
+ \r
+ pCoexSta->preBtRssiState = btRssiState;\r
+\r
+ return btRssiState;\r
+}\r
+\r
+u1Byte\r
+halbtc8723a2ant_WifiRssiState(\r
+ IN PBTC_COEXIST pBtCoexist,\r
+ IN u1Byte index,\r
+ IN u1Byte levelNum,\r
+ IN u1Byte rssiThresh,\r
+ IN u1Byte rssiThresh1\r
+ )\r
+{\r
+ s4Byte wifiRssi=0;\r
+ u1Byte wifiRssiState=pCoexSta->preWifiRssiState[index];\r
+\r
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_S4_WIFI_RSSI, &wifiRssi);\r
+ \r
+ if(levelNum == 2)\r
+ {\r
+ if( (pCoexSta->preWifiRssiState[index] == BTC_RSSI_STATE_LOW) ||\r
+ (pCoexSta->preWifiRssiState[index] == BTC_RSSI_STATE_STAY_LOW))\r
+ {\r
+ if(wifiRssi >= (rssiThresh+BTC_RSSI_COEX_THRESH_TOL_8723A_2ANT))\r
+ {\r
+ wifiRssiState = BTC_RSSI_STATE_HIGH;\r
+ }\r
+ else\r
+ {\r
+ wifiRssiState = BTC_RSSI_STATE_STAY_LOW;\r
+ }\r
+ }\r
+ else\r
+ {\r
+ if(wifiRssi < rssiThresh)\r
+ {\r
+ wifiRssiState = BTC_RSSI_STATE_LOW;\r
+ }\r
+ else\r
+ {\r
+ wifiRssiState = BTC_RSSI_STATE_STAY_HIGH;\r
+ }\r
+ }\r
+ }\r
+ else if(levelNum == 3)\r
+ {\r
+ if(rssiThresh > rssiThresh1)\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], wifi RSSI thresh error!!\n"));\r
+ return pCoexSta->preWifiRssiState[index];\r
+ }\r
+ \r
+ if( (pCoexSta->preWifiRssiState[index] == BTC_RSSI_STATE_LOW) ||\r
+ (pCoexSta->preWifiRssiState[index] == BTC_RSSI_STATE_STAY_LOW))\r
+ {\r
+ if(wifiRssi >= (rssiThresh+BTC_RSSI_COEX_THRESH_TOL_8723A_2ANT))\r
+ {\r
+ wifiRssiState = BTC_RSSI_STATE_MEDIUM;\r
+ }\r
+ else\r
+ {\r
+ wifiRssiState = BTC_RSSI_STATE_STAY_LOW;\r
+ }\r
+ }\r
+ else if( (pCoexSta->preWifiRssiState[index] == BTC_RSSI_STATE_MEDIUM) ||\r
+ (pCoexSta->preWifiRssiState[index] == BTC_RSSI_STATE_STAY_MEDIUM))\r
+ {\r
+ if(wifiRssi >= (rssiThresh1+BTC_RSSI_COEX_THRESH_TOL_8723A_2ANT))\r
+ {\r
+ wifiRssiState = BTC_RSSI_STATE_HIGH;\r
+ }\r
+ else if(wifiRssi < rssiThresh)\r
+ {\r
+ wifiRssiState = BTC_RSSI_STATE_LOW;\r
+ }\r
+ else\r
+ {\r
+ wifiRssiState = BTC_RSSI_STATE_STAY_MEDIUM;\r
+ }\r
+ }\r
+ else\r
+ {\r
+ if(wifiRssi < rssiThresh1)\r
+ {\r
+ wifiRssiState = BTC_RSSI_STATE_MEDIUM;\r
+ }\r
+ else\r
+ {\r
+ wifiRssiState = BTC_RSSI_STATE_STAY_HIGH;\r
+ }\r
+ }\r
+ }\r
+ \r
+ pCoexSta->preWifiRssiState[index] = wifiRssiState;\r
+\r
+ return wifiRssiState;\r
+}\r
+\r
+VOID\r
+halbtc8723a2ant_IndicateWifiChnlBwInfo(\r
+ IN PBTC_COEXIST pBtCoexist,\r
+ IN u1Byte type\r
+ )\r
+{\r
+ u1Byte H2C_Parameter[3] ={0};\r
+ u4Byte wifiBw;\r
+ u1Byte wifiCentralChnl;\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
+ (wifiCentralChnl <= 14) )\r
+ {\r
+ H2C_Parameter[0] = 0x1;\r
+ H2C_Parameter[1] = wifiCentralChnl;\r
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);\r
+ if(BTC_WIFI_BW_HT40 == wifiBw)\r
+ H2C_Parameter[2] = 0x30;\r
+ else\r
+ H2C_Parameter[2] = 0x20;\r
+ }\r
+ \r
+ pCoexDm->wifiChnlInfo[0] = H2C_Parameter[0];\r
+ pCoexDm->wifiChnlInfo[1] = H2C_Parameter[1];\r
+ pCoexDm->wifiChnlInfo[2] = H2C_Parameter[2];\r
+ \r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], FW write 0x19=0x%x\n", \r
+ H2C_Parameter[0]<<16|H2C_Parameter[1]<<8|H2C_Parameter[2]));\r
+\r
+ pBtCoexist->fBtcFillH2c(pBtCoexist, 0x19, 3, H2C_Parameter);\r
+}\r
+\r
+VOID\r
+halbtc8723a2ant_QueryBtInfo(\r
+ IN PBTC_COEXIST pBtCoexist\r
+ )\r
+{\r
+ u1Byte H2C_Parameter[1] ={0};\r
+\r
+ pCoexSta->bC2hBtInfoReqSent = TRUE;\r
+\r
+ H2C_Parameter[0] |= BIT0; // trigger\r
+\r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], Query Bt Info, FW write 0x38=0x%x\n", \r
+ H2C_Parameter[0]));\r
+\r
+ pBtCoexist->fBtcFillH2c(pBtCoexist, 0x38, 1, H2C_Parameter);\r
+}\r
+u1Byte\r
+halbtc8723a2ant_ActionAlgorithm(\r
+ IN PBTC_COEXIST pBtCoexist\r
+ )\r
+{\r
+ PBTC_STACK_INFO pStackInfo=&pBtCoexist->stackInfo;\r
+ BOOLEAN bBtHsOn=FALSE, bBtBusy=FALSE, bLimitedDig=FALSE;\r
+ u1Byte algorithm=BT_8723A_2ANT_COEX_ALGO_UNDEFINED;\r
+ u1Byte numOfDiffProfile=0;\r
+\r
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);\r
+\r
+ //======================\r
+ // here we get BT status first\r
+ //======================\r
+ pCoexDm->btStatus = BT_8723A_2ANT_BT_STATUS_IDLE;\r
+ \r
+ if((pStackInfo->bScoExist) ||(bBtHsOn) ||(pStackInfo->bHidExist))\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], SCO or HID or HS exists, set BT non-idle !!!\n"));\r
+ pCoexDm->btStatus = BT_8723A_2ANT_BT_STATUS_NON_IDLE;\r
+ }\r
+ else\r
+ {\r
+ // A2dp profile\r
+ if( (pBtCoexist->stackInfo.numOfLink == 1) &&\r
+ (pStackInfo->bA2dpExist) )\r
+ { \r
+ if( (pCoexSta->lowPriorityTx+ pCoexSta->lowPriorityRx) < 100)\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], A2DP, low priority tx+rx < 100, set BT connected-idle!!!\n"));\r
+ pCoexDm->btStatus = BT_8723A_2ANT_BT_STATUS_CONNECTED_IDLE;\r
+ }\r
+ else\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], A2DP, low priority tx+rx >= 100, set BT non-idle!!!\n"));\r
+ pCoexDm->btStatus = BT_8723A_2ANT_BT_STATUS_NON_IDLE;\r
+ }\r
+ }\r
+ // Pan profile\r
+ if( (pBtCoexist->stackInfo.numOfLink == 1) &&\r
+ (pStackInfo->bPanExist) )\r
+ { \r
+ if((pCoexSta->lowPriorityTx+ pCoexSta->lowPriorityRx) < 600)\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], PAN, low priority tx+rx < 600, set BT connected-idle!!!\n"));\r
+ pCoexDm->btStatus = BT_8723A_2ANT_BT_STATUS_CONNECTED_IDLE;\r
+ }\r
+ else\r
+ {\r
+ if(pCoexSta->lowPriorityTx)\r
+ {\r
+ if((pCoexSta->lowPriorityRx /pCoexSta->lowPriorityTx)>9 )\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], PAN, low priority rx/tx > 9, set BT connected-idle!!!\n"));\r
+ pCoexDm->btStatus = BT_8723A_2ANT_BT_STATUS_CONNECTED_IDLE;\r
+ }\r
+ }\r
+ }\r
+ if(BT_8723A_2ANT_BT_STATUS_CONNECTED_IDLE != pCoexDm->btStatus)\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], PAN, set BT non-idle!!!\n"));\r
+ pCoexDm->btStatus = BT_8723A_2ANT_BT_STATUS_NON_IDLE;\r
+ }\r
+ }\r
+ // Pan+A2dp profile\r
+ if( (pBtCoexist->stackInfo.numOfLink == 2) &&\r
+ (pStackInfo->bA2dpExist) &&\r
+ (pStackInfo->bPanExist) )\r
+ {\r
+ if((pCoexSta->lowPriorityTx+ pCoexSta->lowPriorityRx) < 600)\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], PAN+A2DP, low priority tx+rx < 600, set BT connected-idle!!!\n"));\r
+ pCoexDm->btStatus = BT_8723A_2ANT_BT_STATUS_CONNECTED_IDLE;\r
+ }\r
+ else\r
+ {\r
+ if(pCoexSta->lowPriorityTx)\r
+ {\r
+ if((pCoexSta->lowPriorityRx /pCoexSta->lowPriorityTx)>9 )\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], PAN+A2DP, low priority rx/tx > 9, set BT connected-idle!!!\n"));\r
+ pCoexDm->btStatus = BT_8723A_2ANT_BT_STATUS_CONNECTED_IDLE;\r
+ }\r
+ }\r
+ }\r
+ if(BT_8723A_2ANT_BT_STATUS_CONNECTED_IDLE != pCoexDm->btStatus)\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], PAN+A2DP, set BT non-idle!!!\n"));\r
+ pCoexDm->btStatus = BT_8723A_2ANT_BT_STATUS_NON_IDLE;\r
+ }\r
+ }\r
+ }\r
+ if(BT_8723A_2ANT_BT_STATUS_IDLE != pCoexDm->btStatus)\r
+ {\r
+ bBtBusy = TRUE;\r
+ bLimitedDig = TRUE;\r
+ }\r
+ else\r
+ {\r
+ bBtBusy = FALSE;\r
+ bLimitedDig = FALSE;\r
+ }\r
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_BT_TRAFFIC_BUSY, &bBtBusy);\r
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_BT_LIMITED_DIG, &bLimitedDig);\r
+ //======================\r
+\r
+ if(!pStackInfo->bBtLinkExist)\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], No profile exists!!!\n"));\r
+ return algorithm;\r
+ }\r
+\r
+ if(pStackInfo->bScoExist)\r
+ numOfDiffProfile++;\r
+ if(pStackInfo->bHidExist)\r
+ numOfDiffProfile++;\r
+ if(pStackInfo->bPanExist)\r
+ numOfDiffProfile++;\r
+ if(pStackInfo->bA2dpExist)\r
+ numOfDiffProfile++;\r
+ \r
+ if(numOfDiffProfile == 1)\r
+ {\r
+ if(pStackInfo->bScoExist)\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], SCO only\n"));\r
+ algorithm = BT_8723A_2ANT_COEX_ALGO_SCO;\r
+ }\r
+ else\r
+ {\r
+ if(pStackInfo->bHidExist)\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], HID only\n"));\r
+ algorithm = BT_8723A_2ANT_COEX_ALGO_HID;\r
+ }\r
+ else if(pStackInfo->bA2dpExist)\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], A2DP only\n"));\r
+ algorithm = BT_8723A_2ANT_COEX_ALGO_A2DP;\r
+ }\r
+ else if(pStackInfo->bPanExist)\r
+ {\r
+ if(bBtHsOn)\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], PAN(HS) only\n"));\r
+ algorithm = BT_8723A_2ANT_COEX_ALGO_PANHS;\r
+ }\r
+ else\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], PAN(EDR) only\n"));\r
+ algorithm = BT_8723A_2ANT_COEX_ALGO_PANEDR;\r
+ }\r
+ }\r
+ }\r
+ }\r
+ else if(numOfDiffProfile == 2)\r
+ {\r
+ if(pStackInfo->bScoExist)\r
+ {\r
+ if(pStackInfo->bHidExist)\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], SCO + HID\n"));\r
+ algorithm = BT_8723A_2ANT_COEX_ALGO_HID;\r
+ }\r
+ else if(pStackInfo->bA2dpExist)\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], SCO + A2DP ==> SCO\n"));\r
+ algorithm = BT_8723A_2ANT_COEX_ALGO_SCO;\r
+ }\r
+ else if(pStackInfo->bPanExist)\r
+ {\r
+ if(bBtHsOn)\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], SCO + PAN(HS)\n"));\r
+ algorithm = BT_8723A_2ANT_COEX_ALGO_SCO;\r
+ }\r
+ else\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], SCO + PAN(EDR)\n"));\r
+ algorithm = BT_8723A_2ANT_COEX_ALGO_PANEDR_HID;\r
+ }\r
+ }\r
+ }\r
+ else\r
+ {\r
+ if( pStackInfo->bHidExist &&\r
+ pStackInfo->bA2dpExist )\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], HID + A2DP\n"));\r
+ algorithm = BT_8723A_2ANT_COEX_ALGO_HID_A2DP;\r
+ }\r
+ else if( pStackInfo->bHidExist &&\r
+ pStackInfo->bPanExist )\r
+ {\r
+ if(bBtHsOn)\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], HID + PAN(HS)\n"));\r
+ algorithm = BT_8723A_2ANT_COEX_ALGO_HID_A2DP;\r
+ }\r
+ else\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], HID + PAN(EDR)\n"));\r
+ algorithm = BT_8723A_2ANT_COEX_ALGO_PANEDR_HID;\r
+ }\r
+ }\r
+ else if( pStackInfo->bPanExist &&\r
+ pStackInfo->bA2dpExist )\r
+ {\r
+ if(bBtHsOn)\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], A2DP + PAN(HS)\n"));\r
+ algorithm = BT_8723A_2ANT_COEX_ALGO_A2DP;\r
+ }\r
+ else\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], A2DP + PAN(EDR)\n"));\r
+ algorithm = BT_8723A_2ANT_COEX_ALGO_PANEDR_A2DP;\r
+ }\r
+ }\r
+ }\r
+ }\r
+ else if(numOfDiffProfile == 3)\r
+ {\r
+ if(pStackInfo->bScoExist)\r
+ {\r
+ if( pStackInfo->bHidExist &&\r
+ pStackInfo->bA2dpExist )\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], SCO + HID + A2DP ==> HID\n"));\r
+ algorithm = BT_8723A_2ANT_COEX_ALGO_HID;\r
+ }\r
+ else if( pStackInfo->bHidExist &&\r
+ pStackInfo->bPanExist )\r
+ {\r
+ if(bBtHsOn)\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], SCO + HID + PAN(HS)\n"));\r
+ algorithm = BT_8723A_2ANT_COEX_ALGO_HID_A2DP;\r
+ }\r
+ else\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], SCO + HID + PAN(EDR)\n"));\r
+ algorithm = BT_8723A_2ANT_COEX_ALGO_PANEDR_HID;\r
+ }\r
+ }\r
+ else if( pStackInfo->bPanExist &&\r
+ pStackInfo->bA2dpExist )\r
+ {\r
+ if(bBtHsOn)\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], SCO + A2DP + PAN(HS)\n"));\r
+ algorithm = BT_8723A_2ANT_COEX_ALGO_SCO;\r
+ }\r
+ else\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], SCO + A2DP + PAN(EDR) ==> HID\n"));\r
+ algorithm = BT_8723A_2ANT_COEX_ALGO_PANEDR_HID;\r
+ }\r
+ }\r
+ }\r
+ else\r
+ {\r
+ if( pStackInfo->bHidExist &&\r
+ pStackInfo->bPanExist &&\r
+ pStackInfo->bA2dpExist )\r
+ {\r
+ if(bBtHsOn)\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], HID + A2DP + PAN(HS)\n"));\r
+ algorithm = BT_8723A_2ANT_COEX_ALGO_HID_A2DP;\r
+ }\r
+ else\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], HID + A2DP + PAN(EDR)\n"));\r
+ algorithm = BT_8723A_2ANT_COEX_ALGO_HID_A2DP_PANEDR;\r
+ }\r
+ }\r
+ }\r
+ }\r
+ else if(numOfDiffProfile >= 3)\r
+ {\r
+ if(pStackInfo->bScoExist)\r
+ {\r
+ if( pStackInfo->bHidExist &&\r
+ pStackInfo->bPanExist &&\r
+ pStackInfo->bA2dpExist )\r
+ {\r
+ if(bBtHsOn)\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Error!!! SCO + HID + A2DP + PAN(HS)\n"));\r
+\r
+ }\r
+ else\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], SCO + HID + A2DP + PAN(EDR)==>PAN(EDR)+HID\n"));\r
+ algorithm = BT_8723A_2ANT_COEX_ALGO_PANEDR_HID;\r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
+ return algorithm;\r
+}\r
+\r
+BOOLEAN\r
+halbtc8723a2ant_NeedToDecBtPwr(\r
+ IN PBTC_COEXIST pBtCoexist\r
+ )\r
+{\r
+ BOOLEAN bRet=FALSE;\r
+ BOOLEAN bBtHsOn=FALSE, bWifiConnected=FALSE;\r
+ s4Byte btHsRssi=0;\r
+ u1Byte btRssiState=BTC_RSSI_STATE_HIGH;\r
+\r
+ btRssiState = halbtc8723a2ant_BtRssiState(2, 42, 0);\r
+\r
+ if(!pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn))\r
+ return FALSE;\r
+ if(!pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected))\r
+ return FALSE;\r
+ if(!pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_S4_HS_RSSI, &btHsRssi))\r
+ return FALSE;\r
+ if(BTC_RSSI_LOW(btRssiState))\r
+ return FALSE;\r
+\r
+ if(bWifiConnected)\r
+ {\r
+ if(bBtHsOn)\r
+ {\r
+ if(btHsRssi > 37)\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], Need to decrease bt power for HS mode!!\n"));\r
+ bRet = TRUE;\r
+ }\r
+ }\r
+ else\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], Need to decrease bt power for Wifi is connected!!\n"));\r
+ bRet = TRUE;\r
+ }\r
+ }\r
+ \r
+ return bRet;\r
+}\r
+\r
+VOID\r
+halbtc8723a2ant_SetFwDacSwingLevel(\r
+ IN PBTC_COEXIST pBtCoexist,\r
+ IN u1Byte dacSwingLvl\r
+ )\r
+{\r
+ u1Byte H2C_Parameter[1] ={0};\r
+\r
+ // There are several type of dacswing\r
+ // 0x18/ 0x10/ 0xc/ 0x8/ 0x4/ 0x6\r
+ H2C_Parameter[0] = dacSwingLvl;\r
+\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 0x29=0x%x\n", H2C_Parameter[0]));\r
+\r
+ pBtCoexist->fBtcFillH2c(pBtCoexist, 0x29, 1, H2C_Parameter);\r
+}\r
+\r
+VOID\r
+halbtc8723a2ant_SetFwDecBtPwr(\r
+ IN PBTC_COEXIST pBtCoexist,\r
+ IN BOOLEAN bDecBtPwr\r
+ )\r
+{\r
+ u1Byte H2C_Parameter[1] ={0};\r
+ \r
+ H2C_Parameter[0] = 0;\r
+\r
+ if(bDecBtPwr)\r
+ {\r
+ H2C_Parameter[0] |= BIT1;\r
+ }\r
+\r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], decrease Bt Power : %s, FW write 0x21=0x%x\n", \r
+ (bDecBtPwr? "Yes!!":"No!!"), H2C_Parameter[0]));\r
+\r
+ pBtCoexist->fBtcFillH2c(pBtCoexist, 0x21, 1, H2C_Parameter); \r
+}\r
+\r
+VOID\r
+halbtc8723a2ant_DecBtPwr(\r
+ IN PBTC_COEXIST pBtCoexist,\r
+ IN BOOLEAN bForceExec,\r
+ IN BOOLEAN bDecBtPwr\r
+ )\r
+{\r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], %s Dec BT power = %s\n", \r
+ (bForceExec? "force to":""), ((bDecBtPwr)? "ON":"OFF")));\r
+ pCoexDm->bCurDecBtPwr = bDecBtPwr;\r
+\r
+ if(!bForceExec)\r
+ {\r
+ if(pCoexDm->bPreDecBtPwr == pCoexDm->bCurDecBtPwr) \r
+ return;\r
+ }\r
+ halbtc8723a2ant_SetFwDecBtPwr(pBtCoexist, pCoexDm->bCurDecBtPwr);\r
+\r
+ pCoexDm->bPreDecBtPwr = pCoexDm->bCurDecBtPwr;\r
+}\r
+\r
+VOID\r
+halbtc8723a2ant_FwDacSwingLvl(\r
+ IN PBTC_COEXIST pBtCoexist,\r
+ IN BOOLEAN bForceExec,\r
+ IN u1Byte fwDacSwingLvl\r
+ )\r
+{\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
+ if(pCoexDm->preFwDacSwingLvl == pCoexDm->curFwDacSwingLvl) \r
+ return;\r
+ }\r
+\r
+ halbtc8723a2ant_SetFwDacSwingLevel(pBtCoexist, pCoexDm->curFwDacSwingLvl);\r
+\r
+ pCoexDm->preFwDacSwingLvl = pCoexDm->curFwDacSwingLvl;\r
+}\r
+\r
+VOID\r
+halbtc8723a2ant_SetSwRfRxLpfCorner(\r
+ IN PBTC_COEXIST pBtCoexist,\r
+ IN BOOLEAN bRxRfShrinkOn\r
+ )\r
+{\r
+ if(bRxRfShrinkOn)\r
+ {\r
+ //Shrink RF Rx LPF corner\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Shrink RF Rx LPF corner!!\n"));\r
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1e, 0xfffff, 0xf0ff7);\r
+ }\r
+ else\r
+ {\r
+ //Resume RF Rx LPF corner\r
+ // After initialized, we can use pCoexDm->btRf0x1eBackup\r
+ if(pBtCoexist->bInitilized)\r
+ {\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
+}\r
+\r
+VOID\r
+halbtc8723a2ant_RfShrink(\r
+ IN PBTC_COEXIST pBtCoexist,\r
+ IN BOOLEAN bForceExec,\r
+ IN BOOLEAN bRxRfShrinkOn\r
+ )\r
+{\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
+ if(pCoexDm->bPreRfRxLpfShrink == pCoexDm->bCurRfRxLpfShrink) \r
+ return;\r
+ }\r
+ halbtc8723a2ant_SetSwRfRxLpfCorner(pBtCoexist, pCoexDm->bCurRfRxLpfShrink);\r
+\r
+ pCoexDm->bPreRfRxLpfShrink = pCoexDm->bCurRfRxLpfShrink;\r
+}\r
+\r
+VOID\r
+halbtc8723a2ant_SetSwPenaltyTxRateAdaptive(\r
+ IN PBTC_COEXIST pBtCoexist,\r
+ IN BOOLEAN bLowPenaltyRa\r
+ )\r
+{\r
+ u1Byte tmpU1;\r
+\r
+ tmpU1 = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x4fd);\r
+ tmpU1 |= BIT0;\r
+ if(bLowPenaltyRa)\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Tx rate adaptive, set low penalty!!\n"));\r
+ tmpU1 &= ~BIT2;\r
+ }\r
+ else\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Tx rate adaptive, set normal!!\n"));\r
+ tmpU1 |= BIT2;\r
+ }\r
+\r
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x4fd, tmpU1);\r
+}\r
+\r
+VOID\r
+halbtc8723a2ant_LowPenaltyRa(\r
+ IN PBTC_COEXIST pBtCoexist,\r
+ IN BOOLEAN bForceExec,\r
+ IN BOOLEAN bLowPenaltyRa\r
+ )\r
+{\r
+ return;\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
+ if(pCoexDm->bPreLowPenaltyRa == pCoexDm->bCurLowPenaltyRa) \r
+ return;\r
+ }\r
+ halbtc8723a2ant_SetSwPenaltyTxRateAdaptive(pBtCoexist, pCoexDm->bCurLowPenaltyRa);\r
+\r
+ pCoexDm->bPreLowPenaltyRa = pCoexDm->bCurLowPenaltyRa;\r
+}\r
+\r
+VOID\r
+halbtc8723a2ant_SetSwFullTimeDacSwing(\r
+ IN PBTC_COEXIST pBtCoexist,\r
+ IN BOOLEAN bSwDacSwingOn,\r
+ IN u4Byte swDacSwingLvl\r
+ )\r
+{\r
+ if(bSwDacSwingOn)\r
+ {\r
+ pBtCoexist->fBtcSetBbReg(pBtCoexist, 0x880, 0xff000000, swDacSwingLvl);\r
+ }\r
+ else\r
+ {\r
+ pBtCoexist->fBtcSetBbReg(pBtCoexist, 0x880, 0xff000000, 0xc0);\r
+ }\r
+}\r
+\r
+\r
+VOID\r
+halbtc8723a2ant_DacSwing(\r
+ IN PBTC_COEXIST pBtCoexist,\r
+ IN BOOLEAN bForceExec,\r
+ IN BOOLEAN bDacSwingOn,\r
+ IN u4Byte dacSwingLvl\r
+ )\r
+{\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
+ if( (pCoexDm->bPreDacSwingOn == pCoexDm->bCurDacSwingOn) &&\r
+ (pCoexDm->preDacSwingLvl == pCoexDm->curDacSwingLvl) )\r
+ return;\r
+ }\r
+ delay_ms(30);\r
+ halbtc8723a2ant_SetSwFullTimeDacSwing(pBtCoexist, bDacSwingOn, dacSwingLvl);\r
+\r
+ pCoexDm->bPreDacSwingOn = pCoexDm->bCurDacSwingOn;\r
+ pCoexDm->preDacSwingLvl = pCoexDm->curDacSwingLvl;\r
+}\r
+\r
+VOID\r
+halbtc8723a2ant_SetAdcBackOff(\r
+ IN PBTC_COEXIST pBtCoexist,\r
+ IN BOOLEAN bAdcBackOff\r
+ )\r
+{\r
+ if(bAdcBackOff)\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], BB BackOff Level On!\n"));\r
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc04,0x3a07611);\r
+ }\r
+ else\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], BB BackOff Level Off!\n")); \r
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc04,0x3a05611);\r
+ }\r
+}\r
+\r
+VOID\r
+halbtc8723a2ant_AdcBackOff(\r
+ IN PBTC_COEXIST pBtCoexist,\r
+ IN BOOLEAN bForceExec,\r
+ IN BOOLEAN bAdcBackOff\r
+ )\r
+{\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
+ if(pCoexDm->bPreAdcBackOff == pCoexDm->bCurAdcBackOff) \r
+ return;\r
+ }\r
+ halbtc8723a2ant_SetAdcBackOff(pBtCoexist, pCoexDm->bCurAdcBackOff);\r
+\r
+ pCoexDm->bPreAdcBackOff = pCoexDm->bCurAdcBackOff;\r
+}\r
+\r
+VOID\r
+halbtc8723a2ant_SetAgcTable(\r
+ IN PBTC_COEXIST pBtCoexist,\r
+ IN BOOLEAN bAgcTableEn\r
+ )\r
+{\r
+ u1Byte rssiAdjustVal=0;\r
+\r
+ if(bAgcTableEn)\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Agc Table On!\n"));\r
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78,0x4e1c0001);\r
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78,0x4d1d0001);\r
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78,0x4c1e0001);\r
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78,0x4b1f0001);\r
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78,0x4a200001);\r
+ \r
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x12, 0xfffff, 0xdc000);\r
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x12, 0xfffff, 0x90000);\r
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x12, 0xfffff, 0x51000);\r
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x12, 0xfffff, 0x12000);\r
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1a, 0xfffff, 0x00355);\r
+ \r
+ rssiAdjustVal = 6;\r
+ }\r
+ else\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Agc Table Off!\n"));\r
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78,0x641c0001);\r
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78,0x631d0001);\r
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78,0x621e0001);\r
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78,0x611f0001);\r
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78,0x60200001);\r
+\r
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x12, 0xfffff, 0x32000);\r
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x12, 0xfffff, 0x71000);\r
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x12, 0xfffff, 0xb0000);\r
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x12, 0xfffff, 0xfc000);\r
+ pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1a, 0xfffff, 0x30355);\r
+ }\r
+\r
+ // set rssiAdjustVal for wifi module.\r
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_U1_RSSI_ADJ_VAL_FOR_AGC_TABLE_ON, &rssiAdjustVal);\r
+}\r
+\r
+\r
+VOID\r
+halbtc8723a2ant_AgcTable(\r
+ IN PBTC_COEXIST pBtCoexist,\r
+ IN BOOLEAN bForceExec,\r
+ IN BOOLEAN bAgcTableEn\r
+ )\r
+{\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
+ if(pCoexDm->bPreAgcTableEn == pCoexDm->bCurAgcTableEn) \r
+ return;\r
+ }\r
+ halbtc8723a2ant_SetAgcTable(pBtCoexist, bAgcTableEn);\r
+\r
+ pCoexDm->bPreAgcTableEn = pCoexDm->bCurAgcTableEn;\r
+}\r
+\r
+VOID\r
+halbtc8723a2ant_SetCoexTable(\r
+ IN PBTC_COEXIST pBtCoexist,\r
+ IN u4Byte val0x6c0,\r
+ IN u4Byte val0x6c8,\r
+ IN u1Byte val0x6cc\r
+ )\r
+{\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
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], set coex table, set 0x6c8=0x%x\n", val0x6c8));\r
+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x6c8, val0x6c8);\r
+\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
+VOID\r
+halbtc8723a2ant_CoexTable(\r
+ IN PBTC_COEXIST pBtCoexist,\r
+ IN BOOLEAN bForceExec,\r
+ IN u4Byte val0x6c0,\r
+ IN u4Byte val0x6c8,\r
+ IN u1Byte val0x6cc\r
+ )\r
+{\r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], %s write Coex Table 0x6c0=0x%x, 0x6c8=0x%x, 0x6cc=0x%x\n", \r
+ (bForceExec? "force to":""), val0x6c0, val0x6c8, val0x6cc));\r
+ pCoexDm->curVal0x6c0 = val0x6c0;\r
+ pCoexDm->curVal0x6c8 = val0x6c8;\r
+ pCoexDm->curVal0x6cc = val0x6cc;\r
+\r
+ if(!bForceExec)\r
+ { \r
+ if( (pCoexDm->preVal0x6c0 == pCoexDm->curVal0x6c0) &&\r
+ (pCoexDm->preVal0x6c8 == pCoexDm->curVal0x6c8) &&\r
+ (pCoexDm->preVal0x6cc == pCoexDm->curVal0x6cc) )\r
+ return;\r
+ }\r
+ halbtc8723a2ant_SetCoexTable(pBtCoexist, val0x6c0, val0x6c8, val0x6cc);\r
+\r
+ pCoexDm->preVal0x6c0 = pCoexDm->curVal0x6c0;\r
+ pCoexDm->preVal0x6c8 = pCoexDm->curVal0x6c8;\r
+ pCoexDm->preVal0x6cc = pCoexDm->curVal0x6cc;\r
+}\r
+\r
+VOID\r
+halbtc8723a2ant_SetFwIgnoreWlanAct(\r
+ IN PBTC_COEXIST pBtCoexist,\r
+ IN BOOLEAN bEnable\r
+ )\r
+{\r
+ u1Byte H2C_Parameter[1] ={0};\r
+ \r
+ if(bEnable)\r
+ {\r
+ H2C_Parameter[0] |= BIT0; // function enable\r
+ }\r
+ \r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], set FW for BT Ignore Wlan_Act, FW write 0x25=0x%x\n", \r
+ H2C_Parameter[0]));\r
+\r
+ pBtCoexist->fBtcFillH2c(pBtCoexist, 0x25, 1, H2C_Parameter); \r
+}\r
+\r
+VOID\r
+halbtc8723a2ant_IgnoreWlanAct(\r
+ IN PBTC_COEXIST pBtCoexist,\r
+ IN BOOLEAN bForceExec,\r
+ IN BOOLEAN bEnable\r
+ )\r
+{\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
+ if(pCoexDm->bPreIgnoreWlanAct == pCoexDm->bCurIgnoreWlanAct)\r
+ return;\r
+ }\r
+ halbtc8723a2ant_SetFwIgnoreWlanAct(pBtCoexist, bEnable);\r
+\r
+ pCoexDm->bPreIgnoreWlanAct = pCoexDm->bCurIgnoreWlanAct;\r
+}\r
+\r
+VOID\r
+halbtc8723a2ant_SetFwPstdma(\r
+ IN PBTC_COEXIST pBtCoexist,\r
+ IN u1Byte byte1,\r
+ IN u1Byte byte2,\r
+ IN u1Byte byte3,\r
+ IN u1Byte byte4,\r
+ IN u1Byte byte5\r
+ )\r
+{\r
+ u1Byte H2C_Parameter[5] ={0};\r
+\r
+ H2C_Parameter[0] = byte1; \r
+ H2C_Parameter[1] = byte2; \r
+ H2C_Parameter[2] = byte3;\r
+ H2C_Parameter[3] = byte4;\r
+ H2C_Parameter[4] = byte5;\r
+\r
+ pCoexDm->psTdmaPara[0] = byte1;\r
+ pCoexDm->psTdmaPara[1] = byte2;\r
+ pCoexDm->psTdmaPara[2] = byte3;\r
+ pCoexDm->psTdmaPara[3] = byte4;\r
+ pCoexDm->psTdmaPara[4] = byte5;\r
+ \r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], FW write 0x3a(5bytes)=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, 0x3a, 5, H2C_Parameter);\r
+}\r
+\r
+VOID\r
+halbtc8723a2ant_PsTdma(\r
+ IN PBTC_COEXIST pBtCoexist,\r
+ IN BOOLEAN bForceExec,\r
+ IN BOOLEAN bTurnOn,\r
+ IN u1Byte type\r
+ )\r
+{\r
+ u4Byte btTxRxCnt=0;\r
+\r
+ btTxRxCnt = pCoexSta->highPriorityTx+pCoexSta->highPriorityRx+\r
+ pCoexSta->lowPriorityTx+pCoexSta->lowPriorityRx;\r
+\r
+ if(btTxRxCnt > 3000)\r
+ { \r
+ pCoexDm->bCurPsTdmaOn = TRUE;\r
+ pCoexDm->curPsTdma = 8;\r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], turn ON PS TDMA, type=%d for BT tx/rx counters=%d(>3000)\n", \r
+ pCoexDm->curPsTdma, btTxRxCnt));\r
+ }\r
+ else\r
+ {\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
+\r
+ if(!bForceExec)\r
+ {\r
+ if( (pCoexDm->bPrePsTdmaOn == pCoexDm->bCurPsTdmaOn) &&\r
+ (pCoexDm->prePsTdma == pCoexDm->curPsTdma) )\r
+ return;\r
+ } \r
+ if(pCoexDm->bCurPsTdmaOn)\r
+ {\r
+ switch(pCoexDm->curPsTdma)\r
+ {\r
+ case 1:\r
+ default:\r
+ halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0xe1, 0x98);\r
+ break;\r
+ case 2:\r
+ halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0xe1, 0x98);\r
+ break;\r
+ case 3:\r
+ halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0xa, 0xa, 0xe1, 0x98);\r
+ break;\r
+ case 4:\r
+ halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xa3, 0x5, 0x5, 0xe1, 0x80);\r
+ break;\r
+ case 5:\r
+ halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0x60, 0x98);\r
+ break;\r
+ case 6:\r
+ halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0x60, 0x98);\r
+ break;\r
+ case 7:\r
+ halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0xa, 0xa, 0x60, 0x98);\r
+ break;\r
+ case 8: \r
+ halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xa3, 0x5, 0x5, 0x60, 0x80);\r
+ break;\r
+ case 9: \r
+ halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0xe1, 0x98);\r
+ break;\r
+ case 10: \r
+ halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0xe1, 0x98);\r
+ break;\r
+ case 11: \r
+ halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0xa, 0xa, 0xe1, 0x98);\r
+ break;\r
+ case 12:\r
+ halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x5, 0x5, 0xe1, 0x98);\r
+ break;\r
+ case 13:\r
+ halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0x60, 0x98);\r
+ break;\r
+ case 14:\r
+ halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0x60, 0x98);\r
+ break;\r
+ case 15:\r
+ halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0xa, 0xa, 0x60, 0x98);\r
+ break;\r
+ case 16:\r
+ halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x5, 0x5, 0x60, 0x98);\r
+ break;\r
+ case 17:\r
+ halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xa3, 0x2f, 0x2f, 0x60, 0x80);\r
+ break;\r
+ case 18:\r
+ halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x5, 0x5, 0xe1, 0x98);\r
+ break; \r
+ case 19:\r
+ halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x25, 0x25, 0xe1, 0x98);\r
+ break;\r
+ case 20:\r
+ halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x25, 0x25, 0x60, 0x98);\r
+ break;\r
+ }\r
+ }\r
+ else\r
+ {\r
+ // disable PS tdma\r
+ switch(pCoexDm->curPsTdma)\r
+ {\r
+ case 0:\r
+ halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0x0, 0x0, 0x0, 0x8, 0x0);\r
+ break;\r
+ case 1:\r
+ halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0x0, 0x0, 0x0, 0x0, 0x0);\r
+ break;\r
+ default:\r
+ halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0x0, 0x0, 0x0, 0x8, 0x0);\r
+ break;\r
+ }\r
+ }\r
+\r
+ // update pre state\r
+ pCoexDm->bPrePsTdmaOn = pCoexDm->bCurPsTdmaOn;\r
+ pCoexDm->prePsTdma = pCoexDm->curPsTdma;\r
+}\r
+\r
+\r
+VOID\r
+halbtc8723a2ant_CoexAllOff(\r
+ IN PBTC_COEXIST pBtCoexist\r
+ )\r
+{\r
+ // fw all off\r
+ halbtc8723a2ant_IgnoreWlanAct(pBtCoexist, NORMAL_EXEC, FALSE);\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);\r
+ halbtc8723a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 0x20);\r
+ halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);\r
+\r
+ // sw all off\r
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);\r
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);\r
+ halbtc8723a2ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, FALSE);\r
+ halbtc8723a2ant_RfShrink(pBtCoexist, NORMAL_EXEC, FALSE);\r
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);\r
+\r
+ // hw all off\r
+ halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);\r
+}\r
+\r
+VOID\r
+halbtc8723a2ant_InitCoexDm(\r
+ IN PBTC_COEXIST pBtCoexist\r
+ )\r
+{\r
+ // force to reset coex mechanism\r
+ halbtc8723a2ant_CoexTable(pBtCoexist, FORCE_EXEC, 0x55555555, 0xffff, 0x3);\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 0);\r
+ halbtc8723a2ant_FwDacSwingLvl(pBtCoexist, FORCE_EXEC, 0x20);\r
+ halbtc8723a2ant_DecBtPwr(pBtCoexist, FORCE_EXEC, FALSE);\r
+ halbtc8723a2ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, FALSE);\r
+\r
+ halbtc8723a2ant_AgcTable(pBtCoexist, FORCE_EXEC, FALSE);\r
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, FORCE_EXEC, FALSE);\r
+ halbtc8723a2ant_LowPenaltyRa(pBtCoexist, FORCE_EXEC, FALSE);\r
+ halbtc8723a2ant_RfShrink(pBtCoexist, FORCE_EXEC, FALSE);\r
+ halbtc8723a2ant_DacSwing(pBtCoexist, FORCE_EXEC, FALSE, 0xc0);\r
+}\r
+\r
+VOID\r
+halbtc8723a2ant_BtInquiryPage(\r
+ IN PBTC_COEXIST pBtCoexist\r
+ )\r
+{\r
+ BOOLEAN bLowPwrDisable=TRUE;\r
+ \r
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable);\r
+\r
+ halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);\r
+ halbtc8723a2ant_IgnoreWlanAct(pBtCoexist, NORMAL_EXEC, FALSE);\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);\r
+}\r
+\r
+VOID\r
+halbtc8723a2ant_BtEnableAction(\r
+ IN PBTC_COEXIST pBtCoexist\r
+ )\r
+{\r
+ BOOLEAN bWifiConnected=FALSE;\r
+ \r
+ // Here we need to resend some wifi info to BT\r
+ // because bt is reset and loss of the info. \r
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);\r
+ if(bWifiConnected)\r
+ {\r
+ halbtc8723a2ant_IndicateWifiChnlBwInfo(pBtCoexist, BTC_MEDIA_CONNECT);\r
+ }\r
+ else\r
+ {\r
+ halbtc8723a2ant_IndicateWifiChnlBwInfo(pBtCoexist, BTC_MEDIA_DISCONNECT);\r
+ }\r
+\r
+ halbtc8723a2ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, FALSE);\r
+}\r
+\r
+VOID\r
+halbtc8723a2ant_MonitorBtCtr(\r
+ IN PBTC_COEXIST pBtCoexist\r
+ )\r
+{\r
+ u4Byte regHPTxRx, regLPTxRx, u4Tmp;\r
+ u4Byte regHPTx=0, regHPRx=0, regLPTx=0, regLPRx=0;\r
+ u1Byte u1Tmp;\r
+ \r
+ regHPTxRx = 0x770;\r
+ regLPTxRx = 0x774;\r
+\r
+ u4Tmp = pBtCoexist->fBtcRead4Byte(pBtCoexist, regHPTxRx);\r
+ regHPTx = u4Tmp & bMaskLWord;\r
+ regHPRx = (u4Tmp & bMaskHWord)>>16;\r
+\r
+ u4Tmp = pBtCoexist->fBtcRead4Byte(pBtCoexist, regLPTxRx);\r
+ regLPTx = u4Tmp & bMaskLWord;\r
+ regLPRx = (u4Tmp & bMaskHWord)>>16;\r
+ \r
+ pCoexSta->highPriorityTx = regHPTx;\r
+ pCoexSta->highPriorityRx = regHPRx;\r
+ pCoexSta->lowPriorityTx = regLPTx;\r
+ pCoexSta->lowPriorityRx = regLPRx;\r
+\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
+ 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
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x76e, 0xc);\r
+}\r
+\r
+VOID\r
+halbtc8723a2ant_MonitorBtEnableDisable(\r
+ IN PBTC_COEXIST pBtCoexist\r
+ )\r
+{\r
+ static BOOLEAN bPreBtDisabled=FALSE;\r
+ static u4Byte btDisableCnt=0;\r
+ BOOLEAN bBtActive=TRUE, bBtDisabled=FALSE;\r
+\r
+ // This function check if bt is disabled\r
+\r
+ if( pCoexSta->highPriorityTx == 0 &&\r
+ pCoexSta->highPriorityRx == 0 &&\r
+ pCoexSta->lowPriorityTx == 0 &&\r
+ pCoexSta->lowPriorityRx == 0)\r
+ {\r
+ bBtActive = FALSE;\r
+ }\r
+ if( pCoexSta->highPriorityTx == 0xffff &&\r
+ pCoexSta->highPriorityRx == 0xffff &&\r
+ pCoexSta->lowPriorityTx == 0xffff &&\r
+ pCoexSta->lowPriorityRx == 0xffff)\r
+ {\r
+ bBtActive = FALSE;\r
+ }\r
+ if(bBtActive)\r
+ {\r
+ btDisableCnt = 0;\r
+ bBtDisabled = FALSE;\r
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_BT_DISABLE, &bBtDisabled);\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], BT is enabled !!\n"));\r
+ }\r
+ else\r
+ {\r
+ btDisableCnt++;\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
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], BT is disabled !!\n"));\r
+ }\r
+ }\r
+ if(bPreBtDisabled != bBtDisabled)\r
+ {\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
+ if(!bBtDisabled)\r
+ {\r
+ halbtc8723a2ant_BtEnableAction(pBtCoexist);\r
+ }\r
+ }\r
+}\r
+\r
+BOOLEAN\r
+halbtc8723a2ant_IsCommonAction(\r
+ IN PBTC_COEXIST pBtCoexist\r
+ )\r
+{\r
+ PBTC_STACK_INFO pStackInfo=&pBtCoexist->stackInfo;\r
+ BOOLEAN bCommon=FALSE, bWifiConnected=FALSE;\r
+ BOOLEAN bLowPwrDisable=FALSE;\r
+\r
+ if(!pStackInfo->bBtLinkExist)\r
+ {\r
+ bLowPwrDisable = FALSE;\r
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable);\r
+ }\r
+ else\r
+ {\r
+ bLowPwrDisable = TRUE;\r
+ pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable);\r
+ }\r
+\r
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);\r
+\r
+ if(halbtc8723a2ant_IsWifiIdle(pBtCoexist) && \r
+ BT_8723A_2ANT_BT_STATUS_IDLE == pCoexDm->btStatus)\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Wifi idle + Bt idle!!\n"));\r
+ \r
+ halbtc8723a2ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, FALSE);\r
+ halbtc8723a2ant_RfShrink(pBtCoexist, NORMAL_EXEC, FALSE);\r
+ halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);\r
+\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);\r
+ halbtc8723a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 0x20);\r
+ halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);\r
+\r
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);\r
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);\r
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);\r
+\r
+ bCommon = TRUE;\r
+ }\r
+ else if(!halbtc8723a2ant_IsWifiIdle(pBtCoexist) && \r
+ (BT_8723A_2ANT_BT_STATUS_IDLE == pCoexDm->btStatus) )\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Wifi non-idle + BT idle!!\n"));\r
+\r
+ halbtc8723a2ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, TRUE);\r
+ halbtc8723a2ant_RfShrink(pBtCoexist, NORMAL_EXEC, FALSE);\r
+ halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);\r
+\r
+ halbtc8723a2ant_IgnoreWlanAct(pBtCoexist, NORMAL_EXEC, FALSE);\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);\r
+ halbtc8723a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 0x20);\r
+ halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);\r
+\r
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);\r
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);\r
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);\r
+\r
+ bCommon = TRUE;\r
+ }\r
+ else if(halbtc8723a2ant_IsWifiIdle(pBtCoexist) && \r
+ (BT_8723A_2ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus) )\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Wifi idle + Bt connected idle!!\n"));\r
+ \r
+ halbtc8723a2ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, TRUE);\r
+ halbtc8723a2ant_RfShrink(pBtCoexist, NORMAL_EXEC, TRUE);\r
+ halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);\r
+\r
+ halbtc8723a2ant_IgnoreWlanAct(pBtCoexist, NORMAL_EXEC, FALSE);\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);\r
+ halbtc8723a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 0x20);\r
+ halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);\r
+\r
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);\r
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);\r
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);\r
+\r
+ bCommon = TRUE;\r
+ }\r
+ else if(!halbtc8723a2ant_IsWifiIdle(pBtCoexist) && \r
+ (BT_8723A_2ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus) )\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Wifi non-idle + Bt connected idle!!\n"));\r
+\r
+ halbtc8723a2ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, TRUE);\r
+ halbtc8723a2ant_RfShrink(pBtCoexist, NORMAL_EXEC, TRUE);\r
+ halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);\r
+\r
+ halbtc8723a2ant_IgnoreWlanAct(pBtCoexist, NORMAL_EXEC, FALSE);\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);\r
+ halbtc8723a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 0x20);\r
+ halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);\r
+\r
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);\r
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);\r
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);\r
+\r
+ bCommon = TRUE;\r
+ }\r
+ else if(halbtc8723a2ant_IsWifiIdle(pBtCoexist) && \r
+ (BT_8723A_2ANT_BT_STATUS_NON_IDLE == pCoexDm->btStatus) )\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Wifi idle + BT non-idle!!\n"));\r
+ \r
+ halbtc8723a2ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, TRUE);\r
+ halbtc8723a2ant_RfShrink(pBtCoexist, NORMAL_EXEC, TRUE);\r
+ halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);\r
+\r
+ halbtc8723a2ant_IgnoreWlanAct(pBtCoexist, NORMAL_EXEC, FALSE);\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);\r
+ halbtc8723a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 0x20);\r
+ halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);\r
+\r
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);\r
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);\r
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);\r
+ \r
+ bCommon = TRUE;\r
+ }\r
+ else if(halbtc8723a2ant_IsWifiConnectedIdle(pBtCoexist) && \r
+ (BT_8723A_2ANT_BT_STATUS_NON_IDLE == pCoexDm->btStatus) )\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Wifi connected-idle + BT non-idle!!\n"));\r
+\r
+ halbtc8723a2ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, TRUE);\r
+ halbtc8723a2ant_RfShrink(pBtCoexist, NORMAL_EXEC, TRUE);\r
+ halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);\r
+\r
+ halbtc8723a2ant_IgnoreWlanAct(pBtCoexist, NORMAL_EXEC, FALSE);\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);\r
+ halbtc8723a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 0x20);\r
+ halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);\r
+\r
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);\r
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);\r
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);\r
+ \r
+ bCommon = TRUE;\r
+ }\r
+ else\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Wifi non-idle + BT non-idle!!\n"));\r
+ halbtc8723a2ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, TRUE);\r
+ halbtc8723a2ant_RfShrink(pBtCoexist, NORMAL_EXEC, TRUE);\r
+ halbtc8723a2ant_IgnoreWlanAct(pBtCoexist, NORMAL_EXEC, FALSE);\r
+ halbtc8723a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 0x20);\r
+ \r
+ bCommon = FALSE;\r
+ }\r
+ \r
+ return bCommon;\r
+}\r
+VOID\r
+halbtc8723a2ant_TdmaDurationAdjust(\r
+ IN PBTC_COEXIST pBtCoexist,\r
+ IN BOOLEAN bScoHid,\r
+ IN BOOLEAN bTxPause,\r
+ IN u1Byte maxInterval\r
+ )\r
+{\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;\r
+\r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], TdmaDurationAdjust()\n"));\r
+\r
+ if(pCoexDm->bResetTdmaAdjust)\r
+ {\r
+ pCoexDm->bResetTdmaAdjust = FALSE;\r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], first run TdmaDurationAdjust()!!\n"));\r
+ {\r
+ if(bScoHid)\r
+ {\r
+ if(bTxPause)\r
+ {\r
+ if(maxInterval == 1)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 13);\r
+ pCoexDm->psTdmaDuAdjType = 13; \r
+ }\r
+ else if(maxInterval == 2)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);\r
+ pCoexDm->psTdmaDuAdjType = 14; \r
+ }\r
+ else if(maxInterval == 3)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);\r
+ pCoexDm->psTdmaDuAdjType = 15; \r
+ }\r
+ else\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);\r
+ pCoexDm->psTdmaDuAdjType = 15;\r
+ }\r
+ }\r
+ else\r
+ {\r
+ if(maxInterval == 1)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);\r
+ pCoexDm->psTdmaDuAdjType = 9; \r
+ }\r
+ else if(maxInterval == 2)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);\r
+ pCoexDm->psTdmaDuAdjType = 10; \r
+ }\r
+ else if(maxInterval == 3)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);\r
+ pCoexDm->psTdmaDuAdjType = 11;\r
+ }\r
+ else\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);\r
+ pCoexDm->psTdmaDuAdjType = 11;\r
+ }\r
+ }\r
+ }\r
+ else\r
+ {\r
+ if(bTxPause)\r
+ {\r
+ if(maxInterval == 1)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);\r
+ pCoexDm->psTdmaDuAdjType = 5; \r
+ }\r
+ else if(maxInterval == 2)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);\r
+ pCoexDm->psTdmaDuAdjType = 6; \r
+ }\r
+ else if(maxInterval == 3)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);\r
+ pCoexDm->psTdmaDuAdjType = 7;\r
+ }\r
+ else\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);\r
+ pCoexDm->psTdmaDuAdjType = 7;\r
+ }\r
+ }\r
+ else\r
+ {\r
+ if(maxInterval == 1)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);\r
+ pCoexDm->psTdmaDuAdjType = 1; \r
+ }\r
+ else if(maxInterval == 2)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);\r
+ pCoexDm->psTdmaDuAdjType = 2; \r
+ }\r
+ else if(maxInterval == 3)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);\r
+ pCoexDm->psTdmaDuAdjType = 3;\r
+ }\r
+ else\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);\r
+ pCoexDm->psTdmaDuAdjType = 3;\r
+ }\r
+ }\r
+ }\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
+ //accquire the BT TRx retry count from BT_Info byte2\r
+ retryCount = pCoexSta->btRetryCnt;\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(retryCount == 0) // no retry in the last 2-second duration\r
+ {\r
+ up++;\r
+ dn--;\r
+\r
+ if (dn <= 0)\r
+ dn = 0; \r
+\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
+ if (up <= 0)\r
+ up = 0;\r
+\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
+ 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
+ }\r
+ else //retry count > 3, ¥un1¦¸ retry count > 3, «h½Õ¯¶WiFi duration\r
+ {\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
+\r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], max Interval = %d\n", maxInterval));\r
+ if(maxInterval == 1)\r
+ {\r
+ if(bTxPause)\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], TxPause = 1\n"));\r
+\r
+ if(pCoexDm->curPsTdma == 1)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);\r
+ pCoexDm->psTdmaDuAdjType = 5;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 2)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);\r
+ pCoexDm->psTdmaDuAdjType = 6;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 3)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);\r
+ pCoexDm->psTdmaDuAdjType = 7;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 4)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);\r
+ pCoexDm->psTdmaDuAdjType = 8;\r
+ }\r
+ if(pCoexDm->curPsTdma == 9)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 13);\r
+ pCoexDm->psTdmaDuAdjType = 13;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 10)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);\r
+ pCoexDm->psTdmaDuAdjType = 14;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 11)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);\r
+ pCoexDm->psTdmaDuAdjType = 15;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 12)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);\r
+ pCoexDm->psTdmaDuAdjType = 16;\r
+ }\r
+ \r
+ if(result == -1)\r
+ { \r
+ if(pCoexDm->curPsTdma == 5)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);\r
+ pCoexDm->psTdmaDuAdjType = 6;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 6)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);\r
+ pCoexDm->psTdmaDuAdjType = 7;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 7)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);\r
+ pCoexDm->psTdmaDuAdjType = 8;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 13)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);\r
+ pCoexDm->psTdmaDuAdjType = 14;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 14)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);\r
+ pCoexDm->psTdmaDuAdjType = 15;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 15)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);\r
+ pCoexDm->psTdmaDuAdjType = 16;\r
+ }\r
+ } \r
+ else if (result == 1)\r
+ {\r
+ if(pCoexDm->curPsTdma == 8)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);\r
+ pCoexDm->psTdmaDuAdjType = 7;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 7)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);\r
+ pCoexDm->psTdmaDuAdjType = 6;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 6)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5);\r
+ pCoexDm->psTdmaDuAdjType = 5;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 16)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);\r
+ pCoexDm->psTdmaDuAdjType = 15;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 15)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);\r
+ pCoexDm->psTdmaDuAdjType = 14;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 14)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 13);\r
+ pCoexDm->psTdmaDuAdjType = 13;\r
+ }\r
+ }\r
+ }\r
+ else\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], TxPause = 0\n"));\r
+ if(pCoexDm->curPsTdma == 5)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);\r
+ pCoexDm->psTdmaDuAdjType = 1;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 6)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);\r
+ pCoexDm->psTdmaDuAdjType = 2;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 7)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);\r
+ pCoexDm->psTdmaDuAdjType = 3;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 8)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);\r
+ pCoexDm->psTdmaDuAdjType = 4;\r
+ }\r
+ if(pCoexDm->curPsTdma == 13)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);\r
+ pCoexDm->psTdmaDuAdjType = 9;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 14)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);\r
+ pCoexDm->psTdmaDuAdjType = 10;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 15)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);\r
+ pCoexDm->psTdmaDuAdjType = 11;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 16)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);\r
+ pCoexDm->psTdmaDuAdjType = 12;\r
+ }\r
+ \r
+ if(result == -1)\r
+ {\r
+ if(pCoexDm->curPsTdma == 1)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);\r
+ pCoexDm->psTdmaDuAdjType = 2;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 2)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);\r
+ pCoexDm->psTdmaDuAdjType = 3;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 3)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);\r
+ pCoexDm->psTdmaDuAdjType = 4;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 9)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);\r
+ pCoexDm->psTdmaDuAdjType = 10;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 10)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);\r
+ pCoexDm->psTdmaDuAdjType = 11;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 11)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);\r
+ pCoexDm->psTdmaDuAdjType = 12;\r
+ }\r
+ } \r
+ else if (result == 1)\r
+ {\r
+ if(pCoexDm->curPsTdma == 4)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);\r
+ pCoexDm->psTdmaDuAdjType = 3;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 3)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);\r
+ pCoexDm->psTdmaDuAdjType = 2;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 2)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1);\r
+ pCoexDm->psTdmaDuAdjType = 1;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 12)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);\r
+ pCoexDm->psTdmaDuAdjType = 11;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 11)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);\r
+ pCoexDm->psTdmaDuAdjType = 10;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 10)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);\r
+ pCoexDm->psTdmaDuAdjType = 9;\r
+ }\r
+ }\r
+ }\r
+ }\r
+ else if(maxInterval == 2)\r
+ {\r
+ if(bTxPause)\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], TxPause = 1\n"));\r
+ if(pCoexDm->curPsTdma == 1)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);\r
+ pCoexDm->psTdmaDuAdjType = 6;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 2)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);\r
+ pCoexDm->psTdmaDuAdjType = 6;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 3)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);\r
+ pCoexDm->psTdmaDuAdjType = 7;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 4)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);\r
+ pCoexDm->psTdmaDuAdjType = 8;\r
+ }\r
+ if(pCoexDm->curPsTdma == 9)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);\r
+ pCoexDm->psTdmaDuAdjType = 14;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 10)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);\r
+ pCoexDm->psTdmaDuAdjType = 14;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 11)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);\r
+ pCoexDm->psTdmaDuAdjType = 15;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 12)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);\r
+ pCoexDm->psTdmaDuAdjType = 16;\r
+ }\r
+ if(result == -1)\r
+ {\r
+ if(pCoexDm->curPsTdma == 5) \r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);\r
+ pCoexDm->psTdmaDuAdjType = 6;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 6)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);\r
+ pCoexDm->psTdmaDuAdjType = 7;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 7)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);\r
+ pCoexDm->psTdmaDuAdjType = 8;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 13)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);\r
+ pCoexDm->psTdmaDuAdjType = 14;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 14)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);\r
+ pCoexDm->psTdmaDuAdjType = 15;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 15)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);\r
+ pCoexDm->psTdmaDuAdjType = 16;\r
+ }\r
+ } \r
+ else if (result == 1)\r
+ {\r
+ if(pCoexDm->curPsTdma == 8)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);\r
+ pCoexDm->psTdmaDuAdjType = 7;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 7)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);\r
+ pCoexDm->psTdmaDuAdjType = 6;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 6)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);\r
+ pCoexDm->psTdmaDuAdjType = 6;\r
+ } \r
+ else if(pCoexDm->curPsTdma == 16)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);\r
+ pCoexDm->psTdmaDuAdjType = 15;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 15)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);\r
+ pCoexDm->psTdmaDuAdjType = 14;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 14)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);\r
+ pCoexDm->psTdmaDuAdjType = 14;\r
+ }\r
+ }\r
+ }\r
+ else\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], TxPause = 0\n"));\r
+ if(pCoexDm->curPsTdma == 5)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);\r
+ pCoexDm->psTdmaDuAdjType = 2;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 6)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);\r
+ pCoexDm->psTdmaDuAdjType = 2;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 7)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);\r
+ pCoexDm->psTdmaDuAdjType = 3;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 8)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);\r
+ pCoexDm->psTdmaDuAdjType = 4;\r
+ }\r
+ if(pCoexDm->curPsTdma == 13)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);\r
+ pCoexDm->psTdmaDuAdjType = 10;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 14)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);\r
+ pCoexDm->psTdmaDuAdjType = 10;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 15)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);\r
+ pCoexDm->psTdmaDuAdjType = 11;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 16)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);\r
+ pCoexDm->psTdmaDuAdjType = 12;\r
+ }\r
+ if(result == -1)\r
+ {\r
+ if(pCoexDm->curPsTdma == 1)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);\r
+ pCoexDm->psTdmaDuAdjType = 2;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 2)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);\r
+ pCoexDm->psTdmaDuAdjType = 3;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 3)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);\r
+ pCoexDm->psTdmaDuAdjType = 4;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 9)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);\r
+ pCoexDm->psTdmaDuAdjType = 10;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 10)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);\r
+ pCoexDm->psTdmaDuAdjType = 11;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 11)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);\r
+ pCoexDm->psTdmaDuAdjType = 12;\r
+ }\r
+ } \r
+ else if (result == 1)\r
+ {\r
+ if(pCoexDm->curPsTdma == 4)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);\r
+ pCoexDm->psTdmaDuAdjType = 3;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 3)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);\r
+ pCoexDm->psTdmaDuAdjType = 2;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 2)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);\r
+ pCoexDm->psTdmaDuAdjType = 2;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 12)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);\r
+ pCoexDm->psTdmaDuAdjType = 11;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 11)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);\r
+ pCoexDm->psTdmaDuAdjType = 10;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 10)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);\r
+ pCoexDm->psTdmaDuAdjType = 10;\r
+ }\r
+ }\r
+ }\r
+ }\r
+ else if(maxInterval == 3)\r
+ {\r
+ if(bTxPause)\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], TxPause = 1\n"));\r
+ if(pCoexDm->curPsTdma == 1)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);\r
+ pCoexDm->psTdmaDuAdjType = 7;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 2)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);\r
+ pCoexDm->psTdmaDuAdjType = 7;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 3)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);\r
+ pCoexDm->psTdmaDuAdjType = 7;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 4)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);\r
+ pCoexDm->psTdmaDuAdjType = 8;\r
+ }\r
+ if(pCoexDm->curPsTdma == 9)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);\r
+ pCoexDm->psTdmaDuAdjType = 15;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 10)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);\r
+ pCoexDm->psTdmaDuAdjType = 15;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 11)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);\r
+ pCoexDm->psTdmaDuAdjType = 15;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 12)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);\r
+ pCoexDm->psTdmaDuAdjType = 16;\r
+ }\r
+ if(result == -1)\r
+ {\r
+ if(pCoexDm->curPsTdma == 5) \r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);\r
+ pCoexDm->psTdmaDuAdjType = 7;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 6)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);\r
+ pCoexDm->psTdmaDuAdjType = 7;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 7)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);\r
+ pCoexDm->psTdmaDuAdjType = 8;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 13)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);\r
+ pCoexDm->psTdmaDuAdjType = 15;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 14)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);\r
+ pCoexDm->psTdmaDuAdjType = 15;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 15)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);\r
+ pCoexDm->psTdmaDuAdjType = 16;\r
+ }\r
+ } \r
+ else if (result == 1)\r
+ {\r
+ if(pCoexDm->curPsTdma == 8)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);\r
+ pCoexDm->psTdmaDuAdjType = 7;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 7)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);\r
+ pCoexDm->psTdmaDuAdjType = 7;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 6)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7);\r
+ pCoexDm->psTdmaDuAdjType = 7;\r
+ } \r
+ else if(pCoexDm->curPsTdma == 16)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);\r
+ pCoexDm->psTdmaDuAdjType = 15;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 15)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);\r
+ pCoexDm->psTdmaDuAdjType = 15;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 14)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);\r
+ pCoexDm->psTdmaDuAdjType = 15;\r
+ }\r
+ }\r
+ }\r
+ else\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_TRACE, ("[BTCoex], TxPause = 0\n"));\r
+ if(pCoexDm->curPsTdma == 5)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);\r
+ pCoexDm->psTdmaDuAdjType = 3;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 6)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);\r
+ pCoexDm->psTdmaDuAdjType = 3;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 7)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);\r
+ pCoexDm->psTdmaDuAdjType = 3;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 8)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);\r
+ pCoexDm->psTdmaDuAdjType = 4;\r
+ }\r
+ if(pCoexDm->curPsTdma == 13)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);\r
+ pCoexDm->psTdmaDuAdjType = 11;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 14)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);\r
+ pCoexDm->psTdmaDuAdjType = 11;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 15)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);\r
+ pCoexDm->psTdmaDuAdjType = 11;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 16)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);\r
+ pCoexDm->psTdmaDuAdjType = 12;\r
+ }\r
+ if(result == -1)\r
+ {\r
+ if(pCoexDm->curPsTdma == 1)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);\r
+ pCoexDm->psTdmaDuAdjType = 3;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 2)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);\r
+ pCoexDm->psTdmaDuAdjType = 3;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 3)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);\r
+ pCoexDm->psTdmaDuAdjType = 4;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 9)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);\r
+ pCoexDm->psTdmaDuAdjType = 11;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 10)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);\r
+ pCoexDm->psTdmaDuAdjType = 11;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 11)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);\r
+ pCoexDm->psTdmaDuAdjType = 12;\r
+ }\r
+ } \r
+ else if (result == 1)\r
+ {\r
+ if(pCoexDm->curPsTdma == 4)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);\r
+ pCoexDm->psTdmaDuAdjType = 3;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 3)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);\r
+ pCoexDm->psTdmaDuAdjType = 3;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 2)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3);\r
+ pCoexDm->psTdmaDuAdjType = 3;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 12)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);\r
+ pCoexDm->psTdmaDuAdjType = 11;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 11)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);\r
+ pCoexDm->psTdmaDuAdjType = 11;\r
+ }\r
+ else if(pCoexDm->curPsTdma == 10)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);\r
+ pCoexDm->psTdmaDuAdjType = 11;\r
+ }\r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
+ // if current PsTdma not match with the recorded one (when scan, dhcp...), \r
+ // then we have to adjust it back to the previous record one.\r
+ if(pCoexDm->curPsTdma != pCoexDm->psTdmaDuAdjType)\r
+ {\r
+ BOOLEAN bScan=FALSE, bLink=FALSE, bRoam=FALSE;\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
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_LINK, &bLink);\r
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_ROAM, &bRoam);\r
+ \r
+ if( !bScan && !bLink && !bRoam)\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, pCoexDm->psTdmaDuAdjType);\r
+ }\r
+ else\r
+ {\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
+halbtc8723a2ant_ActionSco(\r
+ IN PBTC_COEXIST pBtCoexist\r
+ )\r
+{\r
+ u1Byte wifiRssiState, wifiRssiState1;\r
+ u4Byte wifiBw;\r
+\r
+ if(halbtc8723a2ant_NeedToDecBtPwr(pBtCoexist))\r
+ halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);\r
+ else \r
+ halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);\r
+ halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);\r
+ \r
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);\r
+ if(BTC_WIFI_BW_HT40 == wifiBw)\r
+ {\r
+ wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 37, 0);\r
+ // fw mechanism\r
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||\r
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);\r
+ }\r
+ else\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);\r
+ }\r
+\r
+ // sw mechanism \r
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);\r
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);\r
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);\r
+ }\r
+ else\r
+ {\r
+ wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 27, 0);\r
+ wifiRssiState1 = halbtc8723a2ant_WifiRssiState(pBtCoexist, 1, 2, 47, 0);\r
+ \r
+ // fw mechanism\r
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||\r
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11);\r
+ }\r
+ else\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15);\r
+ }\r
+ \r
+ // sw mechanism\r
+ if( (wifiRssiState1 == BTC_RSSI_STATE_HIGH) ||\r
+ (wifiRssiState1 == BTC_RSSI_STATE_STAY_HIGH) )\r
+ {\r
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);\r
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);\r
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);\r
+ }\r
+ else\r
+ {\r
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);\r
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);\r
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);\r
+ } \r
+ }\r
+}\r
+\r
+\r
+VOID\r
+halbtc8723a2ant_ActionHid(\r
+ IN PBTC_COEXIST pBtCoexist\r
+ )\r
+{\r
+ u1Byte wifiRssiState, wifiRssiState1;\r
+ u4Byte wifiBw;\r
+\r
+ if(halbtc8723a2ant_NeedToDecBtPwr(pBtCoexist))\r
+ halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);\r
+ else \r
+ halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);\r
+ halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);\r
+\r
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);\r
+ if(BTC_WIFI_BW_HT40 == wifiBw)\r
+ {\r
+ wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 37, 0);\r
+ // fw mechanism\r
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||\r
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);\r
+ }\r
+ else\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 13);\r
+ }\r
+\r
+ // sw mechanism\r
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);\r
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);\r
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);\r
+ }\r
+ else\r
+ {\r
+ wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 27, 0);\r
+ wifiRssiState1 = halbtc8723a2ant_WifiRssiState(pBtCoexist, 1, 2, 47, 0);\r
+\r
+ // fw mechanism\r
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||\r
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9);\r
+ }\r
+ else\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 13);\r
+ }\r
+\r
+ // sw mechanism\r
+ if( (wifiRssiState1 == BTC_RSSI_STATE_HIGH) ||\r
+ (wifiRssiState1 == BTC_RSSI_STATE_STAY_HIGH) )\r
+ {\r
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);\r
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);\r
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);\r
+ }\r
+ else\r
+ {\r
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);\r
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);\r
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);\r
+ } \r
+ }\r
+}\r
+\r
+//A2DP only / PAN(EDR) only/ A2DP+PAN(HS)\r
+VOID\r
+halbtc8723a2ant_ActionA2dp(\r
+ IN PBTC_COEXIST pBtCoexist\r
+ )\r
+{\r
+ u1Byte wifiRssiState, wifiRssiState1, btInfoExt;\r
+ u4Byte wifiBw;\r
+\r
+ btInfoExt = pCoexSta->btInfoExt;\r
+\r
+ if(halbtc8723a2ant_NeedToDecBtPwr(pBtCoexist))\r
+ halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);\r
+ else \r
+ halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);\r
+ halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);\r
+ \r
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);\r
+ if(BTC_WIFI_BW_HT40 == wifiBw)\r
+ {\r
+ wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 37, 0);\r
+\r
+ // fw mechanism\r
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||\r
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )\r
+ {\r
+ if(btInfoExt&BIT0) //a2dp rate, 1:basic /0:edr\r
+ {\r
+ halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 3);\r
+ }\r
+ else\r
+ {\r
+ halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 1);\r
+ }\r
+ }\r
+ else\r
+ {\r
+ if(btInfoExt&BIT0) //a2dp rate, 1:basic /0:edr\r
+ {\r
+ halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 3);\r
+ }\r
+ else\r
+ {\r
+ halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 1);\r
+ }\r
+ }\r
+\r
+ // sw mechanism \r
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);\r
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);\r
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);\r
+ }\r
+ else\r
+ {\r
+ wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 27, 0);\r
+ wifiRssiState1 = halbtc8723a2ant_WifiRssiState(pBtCoexist, 1, 2, 47, 0);\r
+ \r
+ // fw mechanism\r
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||\r
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )\r
+ {\r
+ if(btInfoExt&BIT0) //a2dp rate, 1:basic /0:edr\r
+ {\r
+ halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 3);\r
+ }\r
+ else\r
+ {\r
+ halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 1);\r
+ }\r
+ }\r
+ else\r
+ {\r
+ if(btInfoExt&BIT0) //a2dp rate, 1:basic /0:edr\r
+ {\r
+ halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 3);\r
+ }\r
+ else\r
+ {\r
+ halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 1);\r
+ }\r
+ }\r
+ \r
+ // sw mechanism\r
+ if( (wifiRssiState1 == BTC_RSSI_STATE_HIGH) ||\r
+ (wifiRssiState1 == BTC_RSSI_STATE_STAY_HIGH) )\r
+ {\r
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);\r
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);\r
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);\r
+ }\r
+ else\r
+ {\r
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);\r
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);\r
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);\r
+ } \r
+ }\r
+}\r
+\r
+VOID\r
+halbtc8723a2ant_ActionPanEdr(\r
+ IN PBTC_COEXIST pBtCoexist\r
+ )\r
+{\r
+ u1Byte wifiRssiState, wifiRssiState1, btInfoExt;\r
+ u4Byte wifiBw;\r
+ \r
+ btInfoExt = pCoexSta->btInfoExt;\r
+\r
+ if(halbtc8723a2ant_NeedToDecBtPwr(pBtCoexist))\r
+ halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);\r
+ else \r
+ halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);\r
+ halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);\r
+\r
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);\r
+ if(BTC_WIFI_BW_HT40 == wifiBw)\r
+ {\r
+ wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 37, 0);\r
+ \r
+ // fw mechanism\r
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||\r
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);\r
+ }\r
+ else\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);\r
+ }\r
+\r
+ // sw mechanism\r
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);\r
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);\r
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);\r
+ }\r
+ else\r
+ {\r
+ wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 27, 0);\r
+ wifiRssiState1 = halbtc8723a2ant_WifiRssiState(pBtCoexist, 1, 2, 47, 0);\r
+ \r
+ // fw mechanism\r
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||\r
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);\r
+ }\r
+ else\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);\r
+ }\r
+\r
+ // sw mechanism\r
+ if( (wifiRssiState1 == BTC_RSSI_STATE_HIGH) ||\r
+ (wifiRssiState1 == BTC_RSSI_STATE_STAY_HIGH) )\r
+ {\r
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);\r
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);\r
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);\r
+ }\r
+ else\r
+ {\r
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);\r
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);\r
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);\r
+ }\r
+ }\r
+}\r
+\r
+\r
+//PAN(HS) only\r
+VOID\r
+halbtc8723a2ant_ActionPanHs(\r
+ IN PBTC_COEXIST pBtCoexist\r
+ )\r
+{\r
+ u1Byte wifiRssiState;\r
+ u4Byte wifiBw;\r
+\r
+ halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);\r
+\r
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);\r
+ if(BTC_WIFI_BW_HT40 == wifiBw)\r
+ {\r
+ wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 37, 0);\r
+\r
+ // fw mechanism\r
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||\r
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )\r
+ {\r
+ halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);\r
+ }\r
+ else\r
+ {\r
+ halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);\r
+ }\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);\r
+\r
+ // sw mechanism \r
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);\r
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);\r
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);\r
+ }\r
+ else\r
+ {\r
+ wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 37, 0);\r
+\r
+ // fw mechanism\r
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||\r
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )\r
+ {\r
+ halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);\r
+ }\r
+ else\r
+ {\r
+ halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0);\r
+ }\r
+\r
+ // sw mechanism\r
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||\r
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )\r
+ {\r
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);\r
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);\r
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);\r
+ }\r
+ else\r
+ {\r
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);\r
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);\r
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);\r
+ }\r
+ }\r
+}\r
+\r
+//PAN(EDR)+A2DP\r
+VOID\r
+halbtc8723a2ant_ActionPanEdrA2dp(\r
+ IN PBTC_COEXIST pBtCoexist\r
+ )\r
+{\r
+ u1Byte wifiRssiState, wifiRssiState1, btInfoExt;\r
+ u4Byte wifiBw;\r
+\r
+ btInfoExt = pCoexSta->btInfoExt;\r
+\r
+ if(halbtc8723a2ant_NeedToDecBtPwr(pBtCoexist))\r
+ halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);\r
+ else \r
+ halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);\r
+ halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);\r
+\r
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);\r
+ if(BTC_WIFI_BW_HT40 == wifiBw)\r
+ {\r
+ wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 37, 0);\r
+\r
+ // fw mechanism\r
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||\r
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )\r
+ {\r
+ if(btInfoExt&BIT0) //a2dp basic rate\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);\r
+ }\r
+ else //a2dp edr rate\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);\r
+ }\r
+ }\r
+ else\r
+ {\r
+ if(btInfoExt&BIT0) //a2dp basic rate\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);\r
+ }\r
+ else //a2dp edr rate\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);\r
+ }\r
+ }\r
+\r
+ // sw mechanism\r
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);\r
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);\r
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);\r
+ }\r
+ else\r
+ {\r
+ wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 27, 0);\r
+ wifiRssiState1 = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 47, 0);\r
+ \r
+ // fw mechanism\r
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||\r
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )\r
+ {\r
+ if(btInfoExt&BIT0) //a2dp basic rate\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4);\r
+ }\r
+ else //a2dp edr rate\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2);\r
+ }\r
+ }\r
+ else\r
+ {\r
+ if(btInfoExt&BIT0) //a2dp basic rate\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8);\r
+ }\r
+ else //a2dp edr rate\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6);\r
+ }\r
+ }\r
+\r
+ // sw mechanism\r
+ if( (wifiRssiState1 == BTC_RSSI_STATE_HIGH) ||\r
+ (wifiRssiState1 == BTC_RSSI_STATE_STAY_HIGH) )\r
+ {\r
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);\r
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);\r
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);\r
+ }\r
+ else\r
+ {\r
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);\r
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);\r
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);\r
+ }\r
+ }\r
+}\r
+\r
+VOID\r
+halbtc8723a2ant_ActionPanEdrHid(\r
+ IN PBTC_COEXIST pBtCoexist\r
+ )\r
+{\r
+ u1Byte wifiRssiState, wifiRssiState1;\r
+ u4Byte wifiBw;\r
+\r
+ if(halbtc8723a2ant_NeedToDecBtPwr(pBtCoexist))\r
+ halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);\r
+ else \r
+ halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);\r
+ halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);\r
+\r
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);\r
+ if(BTC_WIFI_BW_HT40 == wifiBw)\r
+ {\r
+ wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 37, 0);\r
+\r
+ // fw mechanism\r
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||\r
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10); \r
+ }\r
+ else\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14); \r
+ }\r
+\r
+ // sw mechanism\r
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);\r
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);\r
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);\r
+ }\r
+ else\r
+ {\r
+ wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 27, 0);\r
+ wifiRssiState1 = halbtc8723a2ant_WifiRssiState(pBtCoexist, 1, 2, 47, 0);\r
+ \r
+ // fw mechanism\r
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||\r
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);\r
+ }\r
+ else\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);\r
+ }\r
+ \r
+ // sw mechanism\r
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||\r
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )\r
+ {\r
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);\r
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);\r
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);\r
+ }\r
+ else\r
+ {\r
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);\r
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);\r
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);\r
+ }\r
+ }\r
+}\r
+\r
+// HID+A2DP+PAN(EDR)\r
+VOID\r
+halbtc8723a2ant_ActionHidA2dpPanEdr(\r
+ IN PBTC_COEXIST pBtCoexist\r
+ )\r
+{\r
+ u1Byte wifiRssiState, wifiRssiState1, btInfoExt;\r
+ u4Byte wifiBw;\r
+\r
+ btInfoExt = pCoexSta->btInfoExt;\r
+\r
+ if(halbtc8723a2ant_NeedToDecBtPwr(pBtCoexist))\r
+ halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);\r
+ else \r
+ halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);\r
+ halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);\r
+\r
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);\r
+ if(BTC_WIFI_BW_HT40 == wifiBw)\r
+ {\r
+ wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 37, 0);\r
+ \r
+ // fw mechanism\r
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||\r
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )\r
+ {\r
+ if(btInfoExt&BIT0) //a2dp basic rate\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);\r
+ }\r
+ else //a2dp edr rate\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);\r
+ }\r
+ }\r
+ else\r
+ {\r
+ if(btInfoExt&BIT0) //a2dp basic rate\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);\r
+ }\r
+ else //a2dp edr rate\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);\r
+ }\r
+ }\r
+ \r
+ // sw mechanism\r
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);\r
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);\r
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);\r
+ }\r
+ else\r
+ {\r
+ wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 27, 0);\r
+ wifiRssiState1 = halbtc8723a2ant_WifiRssiState(pBtCoexist, 1, 2, 47, 0);\r
+ \r
+ // fw mechanism\r
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||\r
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )\r
+ {\r
+ if(btInfoExt&BIT0) //a2dp basic rate\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12);\r
+ }\r
+ else //a2dp edr rate\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10);\r
+ }\r
+ }\r
+ else\r
+ {\r
+ if(btInfoExt&BIT0) //a2dp basic rate\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16);\r
+ }\r
+ else //a2dp edr rate\r
+ {\r
+ halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14);\r
+ }\r
+ }\r
+\r
+ // sw mechanism\r
+ if( (wifiRssiState1 == BTC_RSSI_STATE_HIGH) ||\r
+ (wifiRssiState1 == BTC_RSSI_STATE_STAY_HIGH) )\r
+ {\r
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);\r
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);\r
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);\r
+ }\r
+ else\r
+ {\r
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);\r
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);\r
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);\r
+ }\r
+ }\r
+}\r
+\r
+VOID\r
+halbtc8723a2ant_ActionHidA2dp(\r
+ IN PBTC_COEXIST pBtCoexist\r
+ )\r
+{\r
+ u1Byte wifiRssiState, wifiRssiState1, btInfoExt;\r
+ u4Byte wifiBw;\r
+\r
+ btInfoExt = pCoexSta->btInfoExt;\r
+\r
+ if(halbtc8723a2ant_NeedToDecBtPwr(pBtCoexist))\r
+ halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE);\r
+ else \r
+ halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE);\r
+ halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3);\r
+\r
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);\r
+ if(BTC_WIFI_BW_HT40 == wifiBw)\r
+ {\r
+ wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 37, 0);\r
+ \r
+ // fw mechanism\r
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||\r
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )\r
+ {\r
+ if(btInfoExt&BIT0) //a2dp basic rate\r
+ {\r
+ halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, FALSE, 3);\r
+ }\r
+ else //a2dp edr rate\r
+ {\r
+ halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, FALSE, 1);\r
+ }\r
+ }\r
+ else\r
+ {\r
+ if(btInfoExt&BIT0) //a2dp basic rate\r
+ {\r
+ halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 3);\r
+ }\r
+ else //a2dp edr rate\r
+ {\r
+ halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 1);\r
+ }\r
+ }\r
+ \r
+ // sw mechanism\r
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);\r
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);\r
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);\r
+ }\r
+ else\r
+ {\r
+ wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 27, 0);\r
+ wifiRssiState1 = halbtc8723a2ant_WifiRssiState(pBtCoexist, 1, 2, 47, 0);\r
+ \r
+ // fw mechanism\r
+ if( (wifiRssiState == BTC_RSSI_STATE_HIGH) ||\r
+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) )\r
+ {\r
+ if(btInfoExt&BIT0) //a2dp basic rate\r
+ {\r
+ halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, FALSE, 3);\r
+ }\r
+ else //a2dp edr rate\r
+ {\r
+ halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, FALSE, 1);\r
+ }\r
+ }\r
+ else\r
+ {\r
+ if(btInfoExt&BIT0) //a2dp basic rate\r
+ {\r
+ halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 3);\r
+ }\r
+ else //a2dp edr rate\r
+ {\r
+ halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 1);\r
+ }\r
+ }\r
+\r
+ // sw mechanism\r
+ if( (wifiRssiState1 == BTC_RSSI_STATE_HIGH) ||\r
+ (wifiRssiState1 == BTC_RSSI_STATE_STAY_HIGH) )\r
+ {\r
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, TRUE);\r
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, TRUE);\r
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);\r
+ }\r
+ else\r
+ {\r
+ halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE);\r
+ halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE);\r
+ halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0);\r
+ }\r
+ }\r
+}\r
+\r
+VOID\r
+halbtc8723a2ant_RunCoexistMechanism(\r
+ IN PBTC_COEXIST pBtCoexist\r
+ )\r
+{\r
+ PBTC_STACK_INFO pStackInfo=&pBtCoexist->stackInfo;\r
+ u1Byte btInfoOriginal=0, btRetryCnt=0;\r
+ u1Byte algorithm=0;\r
+\r
+ if(pBtCoexist->bManualControl)\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Manual control!!!\n"));\r
+ return;\r
+ }\r
+\r
+ if(pStackInfo->bProfileNotified)\r
+ {\r
+ if(pCoexSta->bHoldForStackOperation)\r
+ {\r
+ // if bt inquiry/page/pair, do not execute.\r
+ return;\r
+ }\r
+ \r
+ algorithm = halbtc8723a2ant_ActionAlgorithm(pBtCoexist);\r
+ if(pCoexSta->bHoldPeriodCnt && (BT_8723A_2ANT_COEX_ALGO_PANHS!=algorithm))\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex],Hold BT inquiry/page scan setting (cnt = %d)!!\n", \r
+ pCoexSta->bHoldPeriodCnt));\r
+ if(pCoexSta->bHoldPeriodCnt >= 6)\r
+ {\r
+ pCoexSta->bHoldPeriodCnt = 0;\r
+ // next time the coexist parameters should be reset again.\r
+ }\r
+ else\r
+ pCoexSta->bHoldPeriodCnt++;\r
+ return;\r
+ }\r
+\r
+ pCoexDm->curAlgorithm = algorithm;\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Algorithm = %d \n", pCoexDm->curAlgorithm));\r
+ if(halbtc8723a2ant_IsCommonAction(pBtCoexist))\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Action 2-Ant common.\n"));\r
+ pCoexDm->bResetTdmaAdjust = TRUE;\r
+ }\r
+ else\r
+ {\r
+ if(pCoexDm->curAlgorithm != pCoexDm->preAlgorithm)\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], preAlgorithm=%d, curAlgorithm=%d\n", \r
+ pCoexDm->preAlgorithm, pCoexDm->curAlgorithm));\r
+ pCoexDm->bResetTdmaAdjust = TRUE;\r
+ }\r
+ switch(pCoexDm->curAlgorithm)\r
+ {\r
+ case BT_8723A_2ANT_COEX_ALGO_SCO:\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Action 2-Ant, algorithm = SCO.\n"));\r
+ halbtc8723a2ant_ActionSco(pBtCoexist);\r
+ break;\r
+ case BT_8723A_2ANT_COEX_ALGO_HID:\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Action 2-Ant, algorithm = HID.\n"));\r
+ halbtc8723a2ant_ActionHid(pBtCoexist);\r
+ break;\r
+ case BT_8723A_2ANT_COEX_ALGO_A2DP:\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Action 2-Ant, algorithm = A2DP.\n"));\r
+ halbtc8723a2ant_ActionA2dp(pBtCoexist);\r
+ break;\r
+ case BT_8723A_2ANT_COEX_ALGO_PANEDR:\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Action 2-Ant, algorithm = PAN(EDR).\n"));\r
+ halbtc8723a2ant_ActionPanEdr(pBtCoexist);\r
+ break;\r
+ case BT_8723A_2ANT_COEX_ALGO_PANHS:\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Action 2-Ant, algorithm = HS mode.\n"));\r
+ halbtc8723a2ant_ActionPanHs(pBtCoexist);\r
+ break;\r
+ case BT_8723A_2ANT_COEX_ALGO_PANEDR_A2DP:\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Action 2-Ant, algorithm = PAN+A2DP.\n"));\r
+ halbtc8723a2ant_ActionPanEdrA2dp(pBtCoexist);\r
+ break;\r
+ case BT_8723A_2ANT_COEX_ALGO_PANEDR_HID:\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Action 2-Ant, algorithm = PAN(EDR)+HID.\n"));\r
+ halbtc8723a2ant_ActionPanEdrHid(pBtCoexist);\r
+ break;\r
+ case BT_8723A_2ANT_COEX_ALGO_HID_A2DP_PANEDR:\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Action 2-Ant, algorithm = HID+A2DP+PAN.\n"));\r
+ halbtc8723a2ant_ActionHidA2dpPanEdr(pBtCoexist);\r
+ break;\r
+ case BT_8723A_2ANT_COEX_ALGO_HID_A2DP:\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Action 2-Ant, algorithm = HID+A2DP.\n"));\r
+ halbtc8723a2ant_ActionHidA2dp(pBtCoexist);\r
+ break;\r
+ default:\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Action 2-Ant, algorithm = coexist All Off!!\n"));\r
+ halbtc8723a2ant_CoexAllOff(pBtCoexist);\r
+ break;\r
+ }\r
+ pCoexDm->preAlgorithm = pCoexDm->curAlgorithm;\r
+ }\r
+ }\r
+}\r
+\r
+//============================================================\r
+// work around function start with wa_halbtc8723a2ant_\r
+//============================================================\r
+VOID\r
+wa_halbtc8723a2ant_MonitorC2h(\r
+ IN PBTC_COEXIST pBtCoexist\r
+ )\r
+{\r
+ u1Byte tmp1b=0x0;\r
+ u4Byte curC2hTotalCnt=0x0;\r
+ static u4Byte preC2hTotalCnt=0x0, sameCntPollingTime=0x0;\r
+\r
+ curC2hTotalCnt+=pCoexSta->btInfoC2hCnt[BT_INFO_SRC_8723A_2ANT_BT_RSP];\r
+\r
+ if(curC2hTotalCnt == preC2hTotalCnt)\r
+ {\r
+ sameCntPollingTime++;\r
+ }\r
+ else\r
+ {\r
+ preC2hTotalCnt = curC2hTotalCnt;\r
+ sameCntPollingTime = 0;\r
+ }\r
+\r
+ if(sameCntPollingTime >= 2)\r
+ {\r
+ tmp1b = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x1af);\r
+ if(tmp1b != 0x0)\r
+ {\r
+ pCoexSta->c2hHangDetectCnt++;\r
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x1af, 0x0);\r
+ }\r
+ }\r
+}\r
+\r
+//============================================================\r
+// extern function start with EXhalbtc8723a2ant_\r
+//============================================================\r
+VOID\r
+EXhalbtc8723a2ant_PowerOnSetting(\r
+ IN PBTC_COEXIST pBtCoexist\r
+ )\r
+{\r
+}\r
+\r
+VOID\r
+EXhalbtc8723a2ant_InitHwConfig(\r
+ IN PBTC_COEXIST pBtCoexist,\r
+ IN BOOLEAN bWifiOnly\r
+ )\r
+{\r
+ u4Byte u4Tmp=0;\r
+ u1Byte u1Tmp=0;\r
+\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], 2Ant Init HW Config!!\n"));\r
+\r
+ // backup rf 0x1e value\r
+ pCoexDm->btRf0x1eBackup = \r
+ pBtCoexist->fBtcGetRfReg(pBtCoexist, BTC_RF_A, 0x1e, 0xfffff);\r
+\r
+ // Enable counter statistics\r
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x76e, 0x4);\r
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x778, 0x3);\r
+ pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x40, 0x20);\r
+}\r
+\r
+VOID\r
+EXhalbtc8723a2ant_InitCoexDm(\r
+ IN PBTC_COEXIST pBtCoexist\r
+ )\r
+{\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Coex Mechanism Init!!\n"));\r
+ \r
+ halbtc8723a2ant_InitCoexDm(pBtCoexist);\r
+}\r
+\r
+VOID\r
+EXhalbtc8723a2ant_DisplayCoexInfo(\r
+ IN PBTC_COEXIST pBtCoexist\r
+ )\r
+{\r
+ PBTC_BOARD_INFO pBoardInfo=&pBtCoexist->boardInfo;\r
+ PBTC_STACK_INFO pStackInfo=&pBtCoexist->stackInfo;\r
+ pu1Byte cliBuf=pBtCoexist->cliBuf;\r
+ u1Byte u1Tmp[4], i, btInfoExt, psTdmaCase=0;\r
+ u4Byte u4Tmp[4];\r
+\r
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n ============[BT Coexist info]============");\r
+ CL_PRINTF(cliBuf);\r
+\r
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d ", "Ant PG number/ Ant mechanism:", \\r
+ pBoardInfo->pgAntNum, pBoardInfo->btdmAntNum);\r
+ CL_PRINTF(cliBuf); \r
+ \r
+ if(pBtCoexist->bManualControl)\r
+ {\r
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s", "[Action Manual control]!!");\r
+ CL_PRINTF(cliBuf);\r
+ }\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
+\r
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %02x %02x %02x ", "Wifi channel informed to BT", \\r
+ pCoexDm->wifiChnlInfo[0], pCoexDm->wifiChnlInfo[1],\r
+ pCoexDm->wifiChnlInfo[2]);\r
+ CL_PRINTF(cliBuf);\r
+ \r
+ // wifi status\r
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s", "============[Wifi Status]============");\r
+ CL_PRINTF(cliBuf);\r
+ pBtCoexist->fBtcDispDbgMsg(pBtCoexist, BTC_DBG_DISP_WIFI_STATUS);\r
+\r
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s", "============[BT Status]============");\r
+ CL_PRINTF(cliBuf);\r
+\r
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = [%s/ %d/ %d] ", "BT [status/ rssi/ retryCnt]", \\r
+ ((pCoexSta->bC2hBtInquiryPage)?("inquiry/page scan"):((BT_8723A_2ANT_BT_STATUS_IDLE == pCoexDm->btStatus)? "idle":( (BT_8723A_2ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus)? "connected-idle":"busy"))),\r
+ pCoexSta->btRssi, pCoexSta->btRetryCnt);\r
+ CL_PRINTF(cliBuf);\r
+ \r
+ if(pStackInfo->bProfileNotified)\r
+ { \r
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d / %d / %d / %d", "SCO/HID/PAN/A2DP", \\r
+ pStackInfo->bScoExist, pStackInfo->bHidExist, pStackInfo->bPanExist, pStackInfo->bA2dpExist);\r
+ CL_PRINTF(cliBuf); \r
+\r
+ pBtCoexist->fBtcDispDbgMsg(pBtCoexist, BTC_DBG_DISP_BT_LINK_INFO);\r
+ }\r
+\r
+ btInfoExt = pCoexSta->btInfoExt;\r
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %s", "BT Info A2DP rate", \\r
+ (btInfoExt&BIT0)? "Basic rate":"EDR rate");\r
+ CL_PRINTF(cliBuf); \r
+\r
+ for(i=0; i<BT_INFO_SRC_8723A_2ANT_MAX; i++)\r
+ {\r
+ if(pCoexSta->btInfoC2hCnt[i])\r
+ { \r
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %02x %02x %02x %02x %02x %02x %02x(%d)", GLBtInfoSrc8723a2Ant[i], \\r
+ pCoexSta->btInfoC2h[i][0], pCoexSta->btInfoC2h[i][1],\r
+ pCoexSta->btInfoC2h[i][2], pCoexSta->btInfoC2h[i][3],\r
+ pCoexSta->btInfoC2h[i][4], pCoexSta->btInfoC2h[i][5],\r
+ pCoexSta->btInfoC2h[i][6], pCoexSta->btInfoC2hCnt[i]);\r
+ CL_PRINTF(cliBuf);\r
+ }\r
+ }\r
+\r
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d", "write 0x1af=0x0 num", \\r
+ pCoexSta->c2hHangDetectCnt);\r
+ CL_PRINTF(cliBuf);\r
+ \r
+ // Sw mechanism \r
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s", "============[Sw mechanism]============");\r
+ CL_PRINTF(cliBuf);\r
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d/ %d", "SM1[ShRf/ LpRA/ LimDig]", \\r
+ pCoexDm->bCurRfRxLpfShrink, pCoexDm->bCurLowPenaltyRa, pCoexDm->bLimitedDig);\r
+ CL_PRINTF(cliBuf);\r
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d/ %d(0x%x) ", "SM2[AgcT/ AdcB/ SwDacSwing(lvl)]", \\r
+ pCoexDm->bCurAgcTableEn, pCoexDm->bCurAdcBackOff, pCoexDm->bCurDacSwingOn, pCoexDm->curDacSwingLvl);\r
+ CL_PRINTF(cliBuf);\r
+\r
+ // Fw mechanism \r
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s", "============[Fw mechanism]============");\r
+ CL_PRINTF(cliBuf); \r
+ \r
+ if(!pBtCoexist->bManualControl)\r
+ {\r
+ psTdmaCase = pCoexDm->curPsTdma;\r
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %02x %02x %02x %02x %02x case-%d", "PS TDMA", \\r
+ pCoexDm->psTdmaPara[0], pCoexDm->psTdmaPara[1],\r
+ pCoexDm->psTdmaPara[2], pCoexDm->psTdmaPara[3],\r
+ pCoexDm->psTdmaPara[4], psTdmaCase);\r
+ CL_PRINTF(cliBuf);\r
+ \r
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d ", "DecBtPwr/ IgnWlanAct", \\r
+ pCoexDm->bCurDecBtPwr, pCoexDm->bCurIgnoreWlanAct);\r
+ CL_PRINTF(cliBuf);\r
+ }\r
+\r
+ // Hw setting \r
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s", "============[Hw setting]============");\r
+ CL_PRINTF(cliBuf); \r
+\r
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "RF-A, 0x1e initVal", \\r
+ pCoexDm->btRf0x1eBackup);\r
+ CL_PRINTF(cliBuf);\r
+\r
+ u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x778);\r
+ u1Tmp[1] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x783);\r
+ u1Tmp[2] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x796);\r
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x", "0x778/ 0x783/ 0x796", \\r
+ u1Tmp[0], u1Tmp[1], u1Tmp[2]);\r
+ CL_PRINTF(cliBuf);\r
+\r
+ u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x880);\r
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0x880", \\r
+ u4Tmp[0]);\r
+ CL_PRINTF(cliBuf);\r
+\r
+ u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x40);\r
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0x40", \\r
+ u1Tmp[0]);\r
+ CL_PRINTF(cliBuf);\r
+\r
+ u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x550);\r
+ u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x522);\r
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x", "0x550(bcn ctrl)/0x522", \\r
+ u4Tmp[0], u1Tmp[0]);\r
+ CL_PRINTF(cliBuf);\r
+\r
+ u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x484);\r
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0x484(rate adaptive)", \\r
+ u4Tmp[0]);\r
+ CL_PRINTF(cliBuf);\r
+\r
+ u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xc50);\r
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0xc50(dig)", \\r
+ u4Tmp[0]);\r
+ CL_PRINTF(cliBuf);\r
+\r
+ u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xda0);\r
+ u4Tmp[1] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xda4);\r
+ u4Tmp[2] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xda8);\r
+ u4Tmp[3] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xdac);\r
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x/ 0x%x", "0xda0/0xda4/0xda8/0xdac(FA cnt)", \\r
+ u4Tmp[0], u4Tmp[1], u4Tmp[2], u4Tmp[3]);\r
+ CL_PRINTF(cliBuf);\r
+\r
+ u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x6c0);\r
+ u4Tmp[1] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x6c4);\r
+ u4Tmp[2] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x6c8);\r
+ u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x6cc);\r
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x/ 0x%x", "0x6c0/0x6c4/0x6c8/0x6cc(coexTable)", \\r
+ u4Tmp[0], u4Tmp[1], u4Tmp[2], u1Tmp[0]);\r
+ CL_PRINTF(cliBuf);\r
+\r
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d", "0x770 (hp rx[31:16]/tx[15:0])", \\r
+ pCoexSta->highPriorityRx, pCoexSta->highPriorityTx);\r
+ CL_PRINTF(cliBuf);\r
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d", "0x774(lp rx[31:16]/tx[15:0])", \\r
+ pCoexSta->lowPriorityRx, pCoexSta->lowPriorityTx);\r
+ CL_PRINTF(cliBuf);\r
+\r
+ pBtCoexist->fBtcDispDbgMsg(pBtCoexist, BTC_DBG_DISP_COEX_STATISTICS);\r
+}\r
+\r
+\r
+VOID\r
+EXhalbtc8723a2ant_IpsNotify(\r
+ IN PBTC_COEXIST pBtCoexist,\r
+ IN u1Byte type\r
+ )\r
+{\r
+ if(BTC_IPS_ENTER == type)\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], IPS ENTER notify\n"));\r
+ halbtc8723a2ant_CoexAllOff(pBtCoexist);\r
+ }\r
+ else if(BTC_IPS_LEAVE == type)\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], IPS LEAVE notify\n"));\r
+ //halbtc8723a2ant_InitCoexDm(pBtCoexist);\r
+ }\r
+}\r
+\r
+VOID\r
+EXhalbtc8723a2ant_LpsNotify(\r
+ IN PBTC_COEXIST pBtCoexist,\r
+ IN u1Byte type\r
+ )\r
+{\r
+ if(BTC_LPS_ENABLE == type)\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], LPS ENABLE notify\n"));\r
+ }\r
+ else if(BTC_LPS_DISABLE == type)\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], LPS DISABLE notify\n"));\r
+ }\r
+}\r
+\r
+VOID\r
+EXhalbtc8723a2ant_ScanNotify(\r
+ IN PBTC_COEXIST pBtCoexist,\r
+ IN u1Byte type\r
+ )\r
+{\r
+ if(BTC_SCAN_START == type)\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], SCAN START notify\n"));\r
+ }\r
+ else if(BTC_SCAN_FINISH == type)\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], SCAN FINISH notify\n"));\r
+ }\r
+}\r
+\r
+VOID\r
+EXhalbtc8723a2ant_ConnectNotify(\r
+ IN PBTC_COEXIST pBtCoexist,\r
+ IN u1Byte type\r
+ )\r
+{\r
+ if(BTC_ASSOCIATE_START == type)\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], CONNECT START notify\n"));\r
+ }\r
+ else if(BTC_ASSOCIATE_FINISH == type)\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], CONNECT FINISH notify\n"));\r
+ }\r
+}\r
+\r
+VOID\r
+EXhalbtc8723a2ant_MediaStatusNotify(\r
+ IN PBTC_COEXIST pBtCoexist,\r
+ IN u1Byte type\r
+ )\r
+{\r
+ if(BTC_MEDIA_CONNECT == type)\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], MEDIA connect notify\n"));\r
+ }\r
+ else\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], MEDIA disconnect notify\n"));\r
+ }\r
+\r
+ halbtc8723a2ant_IndicateWifiChnlBwInfo(pBtCoexist, type);\r
+}\r
+\r
+VOID\r
+EXhalbtc8723a2ant_SpecialPacketNotify(\r
+ IN PBTC_COEXIST pBtCoexist,\r
+ IN u1Byte type\r
+ )\r
+{\r
+ if(type == BTC_PACKET_DHCP)\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], DHCP Packet notify\n"));\r
+ }\r
+}\r
+\r
+VOID\r
+EXhalbtc8723a2ant_BtInfoNotify(\r
+ IN PBTC_COEXIST pBtCoexist,\r
+ IN pu1Byte tmpBuf,\r
+ IN u1Byte length\r
+ )\r
+{\r
+ u1Byte btInfo=0;\r
+ u1Byte i, rspSource=0;\r
+ BOOLEAN bBtBusy=FALSE, bLimitedDig=FALSE;\r
+ BOOLEAN bWifiConnected=FALSE, bBtHsOn=FALSE;\r
+\r
+ pCoexSta->bC2hBtInfoReqSent = FALSE;\r
+ \r
+ rspSource = BT_INFO_SRC_8723A_2ANT_BT_RSP;\r
+ pCoexSta->btInfoC2hCnt[rspSource]++;\r
+\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
+ if(i == 0)\r
+ btInfo = tmpBuf[i];\r
+ if(i == length-1)\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("0x%02x]\n", tmpBuf[i]));\r
+ }\r
+ else\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("0x%02x, ", tmpBuf[i]));\r
+ }\r
+ }\r
+\r
+ if(BT_INFO_SRC_8723A_2ANT_WIFI_FW != rspSource)\r
+ {\r
+ pCoexSta->btRetryCnt =\r
+ pCoexSta->btInfoC2h[rspSource][1];\r
+\r
+ pCoexSta->btRssi =\r
+ pCoexSta->btInfoC2h[rspSource][2]*2+10;\r
+\r
+ pCoexSta->btInfoExt = \r
+ pCoexSta->btInfoC2h[rspSource][3];\r
+ }\r
+ \r
+ pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn);\r
+ // check BIT2 first ==> check if bt is under inquiry or page scan\r
+ if(btInfo & BT_INFO_8723A_2ANT_B_INQ_PAGE)\r
+ {\r
+ pCoexSta->bC2hBtInquiryPage = TRUE;\r
+ }\r
+ else\r
+ {\r
+ pCoexSta->bC2hBtInquiryPage = FALSE;\r
+ }\r
+}\r
+\r
+VOID\r
+EXhalbtc8723a2ant_StackOperationNotify(\r
+ IN PBTC_COEXIST pBtCoexist,\r
+ IN u1Byte type\r
+ )\r
+{\r
+ if(BTC_STACK_OP_INQ_PAGE_PAIR_START == type)\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], StackOP Inquiry/page/pair start notify\n"));\r
+ pCoexSta->bHoldForStackOperation = TRUE;\r
+ pCoexSta->bHoldPeriodCnt = 1;\r
+ halbtc8723a2ant_BtInquiryPage(pBtCoexist);\r
+ }\r
+ else if(BTC_STACK_OP_INQ_PAGE_PAIR_FINISH == type)\r
+ {\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], StackOP Inquiry/page/pair finish notify\n"));\r
+ pCoexSta->bHoldForStackOperation = FALSE;\r
+ }\r
+}\r
+\r
+VOID\r
+EXhalbtc8723a2ant_HaltNotify(\r
+ IN PBTC_COEXIST pBtCoexist\r
+ )\r
+{\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], Halt notify\n"));\r
+\r
+ halbtc8723a2ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, TRUE);\r
+ EXhalbtc8723a2ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_DISCONNECT);\r
+}\r
+\r
+VOID\r
+EXhalbtc8723a2ant_Periodical(\r
+ IN PBTC_COEXIST pBtCoexist\r
+ )\r
+{\r
+ RT_TRACE(COMP_COEX, DBG_LOUD, ("[BTCoex], 2Ant Periodical!!\n"));\r
+\r
+ // work around for c2h hang\r
+ wa_halbtc8723a2ant_MonitorC2h(pBtCoexist);\r
+ \r
+ halbtc8723a2ant_QueryBtInfo(pBtCoexist);\r
+ halbtc8723a2ant_MonitorBtCtr(pBtCoexist);\r
+ halbtc8723a2ant_MonitorBtEnableDisable(pBtCoexist);\r
+\r
+ halbtc8723a2ant_RunCoexistMechanism(pBtCoexist);\r
+}\r
+\r
+\r
+#endif\r
+\r