Greg Kroah-Hartman | 3c05bed | 2014-01-21 11:20:45 -0800 | [diff] [blame] | 1 | //============================================================ |
| 2 | // Description: |
| 3 | // |
| 4 | // This file is for RTL8723A Co-exist mechanism |
| 5 | // |
| 6 | // History |
| 7 | // 2012/08/22 Cosa first check in. |
| 8 | // 2012/11/14 Cosa Revise for 8723A 2Ant out sourcing. |
| 9 | // |
| 10 | //============================================================ |
| 11 | |
| 12 | //============================================================ |
| 13 | // include files |
| 14 | //============================================================ |
| 15 | #include "Mp_Precomp.h" |
| 16 | #if(BT_30_SUPPORT == 1) |
| 17 | //============================================================ |
| 18 | // Global variables, these are static variables |
| 19 | //============================================================ |
| 20 | static COEX_DM_8723A_2ANT GLCoexDm8723a2Ant; |
| 21 | static PCOEX_DM_8723A_2ANT pCoexDm=&GLCoexDm8723a2Ant; |
| 22 | static COEX_STA_8723A_2ANT GLCoexSta8723a2Ant; |
| 23 | static PCOEX_STA_8723A_2ANT pCoexSta=&GLCoexSta8723a2Ant; |
| 24 | |
| 25 | const char *const GLBtInfoSrc8723a2Ant[]={ |
| 26 | "BT Info[wifi fw]", |
| 27 | "BT Info[bt rsp]", |
| 28 | "BT Info[bt auto report]", |
| 29 | }; |
| 30 | |
| 31 | //============================================================ |
| 32 | // local function proto type if needed |
| 33 | //============================================================ |
| 34 | //============================================================ |
| 35 | // local function start with halbtc8723a2ant_ |
| 36 | //============================================================ |
| 37 | BOOLEAN |
| 38 | halbtc8723a2ant_IsWifiIdle( |
| 39 | IN PBTC_COEXIST pBtCoexist |
| 40 | ) |
| 41 | { |
| 42 | BOOLEAN bWifiConnected=FALSE, bScan=FALSE, bLink=FALSE, bRoam=FALSE; |
| 43 | |
| 44 | pBtCoexist->btc_get(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected); |
| 45 | pBtCoexist->btc_get(pBtCoexist, BTC_GET_BL_WIFI_SCAN, &bScan); |
| 46 | pBtCoexist->btc_get(pBtCoexist, BTC_GET_BL_WIFI_LINK, &bLink); |
| 47 | pBtCoexist->btc_get(pBtCoexist, BTC_GET_BL_WIFI_ROAM, &bRoam); |
| 48 | |
| 49 | if(bWifiConnected) |
| 50 | return FALSE; |
| 51 | if(bScan) |
| 52 | return FALSE; |
| 53 | if(bLink) |
| 54 | return FALSE; |
| 55 | if(bRoam) |
| 56 | return FALSE; |
| 57 | |
| 58 | return true; |
| 59 | } |
| 60 | |
| 61 | u1Byte |
| 62 | halbtc8723a2ant_BtRssiState( |
| 63 | u1Byte levelNum, |
| 64 | u1Byte rssiThresh, |
| 65 | u1Byte rssiThresh1 |
| 66 | ) |
| 67 | { |
| 68 | s4Byte btRssi=0; |
| 69 | u1Byte btRssiState=pCoexSta->preBtRssiState; |
| 70 | |
| 71 | btRssi = pCoexSta->btRssi; |
| 72 | |
| 73 | if(levelNum == 2) |
| 74 | { |
| 75 | if( (pCoexSta->preBtRssiState == BTC_RSSI_STATE_LOW) || |
| 76 | (pCoexSta->preBtRssiState == BTC_RSSI_STATE_STAY_LOW)) |
| 77 | { |
| 78 | if(btRssi >= (rssiThresh+BTC_RSSI_COEX_THRESH_TOL_8723A_2ANT)) |
| 79 | { |
| 80 | btRssiState = BTC_RSSI_STATE_HIGH; |
| 81 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi state switch to High\n")); |
| 82 | } |
| 83 | else |
| 84 | { |
| 85 | btRssiState = BTC_RSSI_STATE_STAY_LOW; |
| 86 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi state stay at Low\n")); |
| 87 | } |
| 88 | } |
| 89 | else |
| 90 | { |
| 91 | if(btRssi < rssiThresh) |
| 92 | { |
| 93 | btRssiState = BTC_RSSI_STATE_LOW; |
| 94 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi state switch to Low\n")); |
| 95 | } |
| 96 | else |
| 97 | { |
| 98 | btRssiState = BTC_RSSI_STATE_STAY_HIGH; |
| 99 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi state stay at High\n")); |
| 100 | } |
| 101 | } |
| 102 | } |
| 103 | else if(levelNum == 3) |
| 104 | { |
| 105 | if(rssiThresh > rssiThresh1) |
| 106 | { |
| 107 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi thresh error!!\n")); |
| 108 | return pCoexSta->preBtRssiState; |
| 109 | } |
| 110 | |
| 111 | if( (pCoexSta->preBtRssiState == BTC_RSSI_STATE_LOW) || |
| 112 | (pCoexSta->preBtRssiState == BTC_RSSI_STATE_STAY_LOW)) |
| 113 | { |
| 114 | if(btRssi >= (rssiThresh+BTC_RSSI_COEX_THRESH_TOL_8723A_2ANT)) |
| 115 | { |
| 116 | btRssiState = BTC_RSSI_STATE_MEDIUM; |
| 117 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi state switch to Medium\n")); |
| 118 | } |
| 119 | else |
| 120 | { |
| 121 | btRssiState = BTC_RSSI_STATE_STAY_LOW; |
| 122 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi state stay at Low\n")); |
| 123 | } |
| 124 | } |
| 125 | else if( (pCoexSta->preBtRssiState == BTC_RSSI_STATE_MEDIUM) || |
| 126 | (pCoexSta->preBtRssiState == BTC_RSSI_STATE_STAY_MEDIUM)) |
| 127 | { |
| 128 | if(btRssi >= (rssiThresh1+BTC_RSSI_COEX_THRESH_TOL_8723A_2ANT)) |
| 129 | { |
| 130 | btRssiState = BTC_RSSI_STATE_HIGH; |
| 131 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi state switch to High\n")); |
| 132 | } |
| 133 | else if(btRssi < rssiThresh) |
| 134 | { |
| 135 | btRssiState = BTC_RSSI_STATE_LOW; |
| 136 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi state switch to Low\n")); |
| 137 | } |
| 138 | else |
| 139 | { |
| 140 | btRssiState = BTC_RSSI_STATE_STAY_MEDIUM; |
| 141 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi state stay at Medium\n")); |
| 142 | } |
| 143 | } |
| 144 | else |
| 145 | { |
| 146 | if(btRssi < rssiThresh1) |
| 147 | { |
| 148 | btRssiState = BTC_RSSI_STATE_MEDIUM; |
| 149 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi state switch to Medium\n")); |
| 150 | } |
| 151 | else |
| 152 | { |
| 153 | btRssiState = BTC_RSSI_STATE_STAY_HIGH; |
| 154 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi state stay at High\n")); |
| 155 | } |
| 156 | } |
| 157 | } |
| 158 | |
| 159 | pCoexSta->preBtRssiState = btRssiState; |
| 160 | |
| 161 | return btRssiState; |
| 162 | } |
| 163 | |
| 164 | u1Byte |
| 165 | halbtc8723a2ant_WifiRssiState( |
| 166 | IN PBTC_COEXIST pBtCoexist, |
| 167 | IN u1Byte index, |
| 168 | IN u1Byte levelNum, |
| 169 | IN u1Byte rssiThresh, |
| 170 | IN u1Byte rssiThresh1 |
| 171 | ) |
| 172 | { |
| 173 | s4Byte wifiRssi=0; |
| 174 | u1Byte wifiRssiState=pCoexSta->preWifiRssiState[index]; |
| 175 | |
| 176 | pBtCoexist->btc_get(pBtCoexist, BTC_GET_S4_WIFI_RSSI, &wifiRssi); |
| 177 | |
| 178 | if(levelNum == 2) |
| 179 | { |
| 180 | if( (pCoexSta->preWifiRssiState[index] == BTC_RSSI_STATE_LOW) || |
| 181 | (pCoexSta->preWifiRssiState[index] == BTC_RSSI_STATE_STAY_LOW)) |
| 182 | { |
| 183 | if(wifiRssi >= (rssiThresh+BTC_RSSI_COEX_THRESH_TOL_8723A_2ANT)) |
| 184 | { |
| 185 | wifiRssiState = BTC_RSSI_STATE_HIGH; |
| 186 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_WIFI_RSSI_STATE, ("[BTCoex], wifi RSSI state switch to High\n")); |
| 187 | } |
| 188 | else |
| 189 | { |
| 190 | wifiRssiState = BTC_RSSI_STATE_STAY_LOW; |
| 191 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_WIFI_RSSI_STATE, ("[BTCoex], wifi RSSI state stay at Low\n")); |
| 192 | } |
| 193 | } |
| 194 | else |
| 195 | { |
| 196 | if(wifiRssi < rssiThresh) |
| 197 | { |
| 198 | wifiRssiState = BTC_RSSI_STATE_LOW; |
| 199 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_WIFI_RSSI_STATE, ("[BTCoex], wifi RSSI state switch to Low\n")); |
| 200 | } |
| 201 | else |
| 202 | { |
| 203 | wifiRssiState = BTC_RSSI_STATE_STAY_HIGH; |
| 204 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_WIFI_RSSI_STATE, ("[BTCoex], wifi RSSI state stay at High\n")); |
| 205 | } |
| 206 | } |
| 207 | } |
| 208 | else if(levelNum == 3) |
| 209 | { |
| 210 | if(rssiThresh > rssiThresh1) |
| 211 | { |
| 212 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_WIFI_RSSI_STATE, ("[BTCoex], wifi RSSI thresh error!!\n")); |
| 213 | return pCoexSta->preWifiRssiState[index]; |
| 214 | } |
| 215 | |
| 216 | if( (pCoexSta->preWifiRssiState[index] == BTC_RSSI_STATE_LOW) || |
| 217 | (pCoexSta->preWifiRssiState[index] == BTC_RSSI_STATE_STAY_LOW)) |
| 218 | { |
| 219 | if(wifiRssi >= (rssiThresh+BTC_RSSI_COEX_THRESH_TOL_8723A_2ANT)) |
| 220 | { |
| 221 | wifiRssiState = BTC_RSSI_STATE_MEDIUM; |
| 222 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_WIFI_RSSI_STATE, ("[BTCoex], wifi RSSI state switch to Medium\n")); |
| 223 | } |
| 224 | else |
| 225 | { |
| 226 | wifiRssiState = BTC_RSSI_STATE_STAY_LOW; |
| 227 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_WIFI_RSSI_STATE, ("[BTCoex], wifi RSSI state stay at Low\n")); |
| 228 | } |
| 229 | } |
| 230 | else if( (pCoexSta->preWifiRssiState[index] == BTC_RSSI_STATE_MEDIUM) || |
| 231 | (pCoexSta->preWifiRssiState[index] == BTC_RSSI_STATE_STAY_MEDIUM)) |
| 232 | { |
| 233 | if(wifiRssi >= (rssiThresh1+BTC_RSSI_COEX_THRESH_TOL_8723A_2ANT)) |
| 234 | { |
| 235 | wifiRssiState = BTC_RSSI_STATE_HIGH; |
| 236 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_WIFI_RSSI_STATE, ("[BTCoex], wifi RSSI state switch to High\n")); |
| 237 | } |
| 238 | else if(wifiRssi < rssiThresh) |
| 239 | { |
| 240 | wifiRssiState = BTC_RSSI_STATE_LOW; |
| 241 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_WIFI_RSSI_STATE, ("[BTCoex], wifi RSSI state switch to Low\n")); |
| 242 | } |
| 243 | else |
| 244 | { |
| 245 | wifiRssiState = BTC_RSSI_STATE_STAY_MEDIUM; |
| 246 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_WIFI_RSSI_STATE, ("[BTCoex], wifi RSSI state stay at Medium\n")); |
| 247 | } |
| 248 | } |
| 249 | else |
| 250 | { |
| 251 | if(wifiRssi < rssiThresh1) |
| 252 | { |
| 253 | wifiRssiState = BTC_RSSI_STATE_MEDIUM; |
| 254 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_WIFI_RSSI_STATE, ("[BTCoex], wifi RSSI state switch to Medium\n")); |
| 255 | } |
| 256 | else |
| 257 | { |
| 258 | wifiRssiState = BTC_RSSI_STATE_STAY_HIGH; |
| 259 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_WIFI_RSSI_STATE, ("[BTCoex], wifi RSSI state stay at High\n")); |
| 260 | } |
| 261 | } |
| 262 | } |
| 263 | |
| 264 | pCoexSta->preWifiRssiState[index] = wifiRssiState; |
| 265 | |
| 266 | return wifiRssiState; |
| 267 | } |
| 268 | |
| 269 | VOID |
| 270 | halbtc8723a2ant_IndicateWifiChnlBwInfo( |
| 271 | IN PBTC_COEXIST pBtCoexist, |
| 272 | IN u1Byte type |
| 273 | ) |
| 274 | { |
| 275 | u1Byte H2C_Parameter[3] ={0}; |
| 276 | u4Byte wifiBw; |
| 277 | u1Byte wifiCentralChnl; |
| 278 | |
| 279 | // only 2.4G we need to inform bt the chnl mask |
| 280 | pBtCoexist->btc_get(pBtCoexist, BTC_GET_U1_WIFI_CENTRAL_CHNL, &wifiCentralChnl); |
| 281 | if( (BTC_MEDIA_CONNECT == type) && |
| 282 | (wifiCentralChnl <= 14) ) |
| 283 | { |
| 284 | H2C_Parameter[0] = 0x1; |
| 285 | H2C_Parameter[1] = wifiCentralChnl; |
| 286 | pBtCoexist->btc_get(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw); |
| 287 | if(BTC_WIFI_BW_HT40 == wifiBw) |
| 288 | H2C_Parameter[2] = 0x30; |
| 289 | else |
| 290 | H2C_Parameter[2] = 0x20; |
| 291 | } |
| 292 | |
| 293 | pCoexDm->wifiChnlInfo[0] = H2C_Parameter[0]; |
| 294 | pCoexDm->wifiChnlInfo[1] = H2C_Parameter[1]; |
| 295 | pCoexDm->wifiChnlInfo[2] = H2C_Parameter[2]; |
| 296 | |
| 297 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], FW write 0x19=0x%x\n", |
| 298 | H2C_Parameter[0]<<16|H2C_Parameter[1]<<8|H2C_Parameter[2])); |
| 299 | |
| 300 | pBtCoexist->btc_fill_h2c(pBtCoexist, 0x19, 3, H2C_Parameter); |
| 301 | } |
| 302 | |
| 303 | VOID |
| 304 | halbtc8723a2ant_QueryBtInfo( |
| 305 | IN PBTC_COEXIST pBtCoexist |
| 306 | ) |
| 307 | { |
| 308 | u1Byte H2C_Parameter[1] ={0}; |
| 309 | |
| 310 | pCoexSta->bC2hBtInfoReqSent = true; |
| 311 | |
| 312 | H2C_Parameter[0] |= BIT0; // trigger |
| 313 | |
| 314 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], Query Bt Info, FW write 0x38=0x%x\n", |
| 315 | H2C_Parameter[0])); |
| 316 | |
| 317 | pBtCoexist->btc_fill_h2c(pBtCoexist, 0x38, 1, H2C_Parameter); |
| 318 | } |
| 319 | u1Byte |
| 320 | halbtc8723a2ant_ActionAlgorithm( |
| 321 | IN PBTC_COEXIST pBtCoexist |
| 322 | ) |
| 323 | { |
| 324 | PBTC_STACK_INFO pStackInfo=&pBtCoexist->stack_info; |
| 325 | BOOLEAN bBtHsOn=FALSE, bBtBusy=FALSE, limited_dig=FALSE; |
| 326 | u1Byte algorithm=BT_8723A_2ANT_COEX_ALGO_UNDEFINED; |
| 327 | u1Byte numOfDiffProfile=0; |
| 328 | |
| 329 | pBtCoexist->btc_get(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn); |
| 330 | |
| 331 | //====================== |
| 332 | // here we get BT status first |
| 333 | //====================== |
| 334 | pCoexDm->btStatus = BT_8723A_2ANT_BT_STATUS_IDLE; |
| 335 | |
| 336 | if((pStackInfo->bScoExist) ||(bBtHsOn) ||(pStackInfo->bHidExist)) |
| 337 | { |
| 338 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO or HID or HS exists, set BT non-idle !!!\n")); |
| 339 | pCoexDm->btStatus = BT_8723A_2ANT_BT_STATUS_NON_IDLE; |
| 340 | } |
| 341 | else |
| 342 | { |
| 343 | // A2dp profile |
| 344 | if( (pBtCoexist->stack_info.numOfLink == 1) && |
| 345 | (pStackInfo->bA2dpExist) ) |
| 346 | { |
| 347 | if( (pCoexSta->lowPriorityTx+ pCoexSta->lowPriorityRx) < 100) |
| 348 | { |
| 349 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2DP, low priority tx+rx < 100, set BT connected-idle!!!\n")); |
| 350 | pCoexDm->btStatus = BT_8723A_2ANT_BT_STATUS_CONNECTED_IDLE; |
| 351 | } |
| 352 | else |
| 353 | { |
| 354 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2DP, low priority tx+rx >= 100, set BT non-idle!!!\n")); |
| 355 | pCoexDm->btStatus = BT_8723A_2ANT_BT_STATUS_NON_IDLE; |
| 356 | } |
| 357 | } |
| 358 | // Pan profile |
| 359 | if( (pBtCoexist->stack_info.numOfLink == 1) && |
| 360 | (pStackInfo->bPanExist) ) |
| 361 | { |
| 362 | if((pCoexSta->lowPriorityTx+ pCoexSta->lowPriorityRx) < 600) |
| 363 | { |
| 364 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], PAN, low priority tx+rx < 600, set BT connected-idle!!!\n")); |
| 365 | pCoexDm->btStatus = BT_8723A_2ANT_BT_STATUS_CONNECTED_IDLE; |
| 366 | } |
| 367 | else |
| 368 | { |
| 369 | if(pCoexSta->lowPriorityTx) |
| 370 | { |
| 371 | if((pCoexSta->lowPriorityRx /pCoexSta->lowPriorityTx)>9 ) |
| 372 | { |
| 373 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], PAN, low priority rx/tx > 9, set BT connected-idle!!!\n")); |
| 374 | pCoexDm->btStatus = BT_8723A_2ANT_BT_STATUS_CONNECTED_IDLE; |
| 375 | } |
| 376 | } |
| 377 | } |
| 378 | if(BT_8723A_2ANT_BT_STATUS_CONNECTED_IDLE != pCoexDm->btStatus) |
| 379 | { |
| 380 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], PAN, set BT non-idle!!!\n")); |
| 381 | pCoexDm->btStatus = BT_8723A_2ANT_BT_STATUS_NON_IDLE; |
| 382 | } |
| 383 | } |
| 384 | // Pan+A2dp profile |
| 385 | if( (pBtCoexist->stack_info.numOfLink == 2) && |
| 386 | (pStackInfo->bA2dpExist) && |
| 387 | (pStackInfo->bPanExist) ) |
| 388 | { |
| 389 | if((pCoexSta->lowPriorityTx+ pCoexSta->lowPriorityRx) < 600) |
| 390 | { |
| 391 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], PAN+A2DP, low priority tx+rx < 600, set BT connected-idle!!!\n")); |
| 392 | pCoexDm->btStatus = BT_8723A_2ANT_BT_STATUS_CONNECTED_IDLE; |
| 393 | } |
| 394 | else |
| 395 | { |
| 396 | if(pCoexSta->lowPriorityTx) |
| 397 | { |
| 398 | if((pCoexSta->lowPriorityRx /pCoexSta->lowPriorityTx)>9 ) |
| 399 | { |
| 400 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], PAN+A2DP, low priority rx/tx > 9, set BT connected-idle!!!\n")); |
| 401 | pCoexDm->btStatus = BT_8723A_2ANT_BT_STATUS_CONNECTED_IDLE; |
| 402 | } |
| 403 | } |
| 404 | } |
| 405 | if(BT_8723A_2ANT_BT_STATUS_CONNECTED_IDLE != pCoexDm->btStatus) |
| 406 | { |
| 407 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], PAN+A2DP, set BT non-idle!!!\n")); |
| 408 | pCoexDm->btStatus = BT_8723A_2ANT_BT_STATUS_NON_IDLE; |
| 409 | } |
| 410 | } |
| 411 | } |
| 412 | if(BT_8723A_2ANT_BT_STATUS_IDLE != pCoexDm->btStatus) |
| 413 | { |
| 414 | bBtBusy = true; |
| 415 | limited_dig = true; |
| 416 | } |
| 417 | else |
| 418 | { |
| 419 | bBtBusy = FALSE; |
| 420 | limited_dig = FALSE; |
| 421 | } |
| 422 | pBtCoexist->btc_set(pBtCoexist, BTC_SET_BL_BT_TRAFFIC_BUSY, &bBtBusy); |
| 423 | pBtCoexist->btc_set(pBtCoexist, BTC_SET_BL_BT_LIMITED_DIG, &limited_dig); |
| 424 | //====================== |
| 425 | |
| 426 | if(!pStackInfo->bBtLinkExist) |
| 427 | { |
| 428 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], No profile exists!!!\n")); |
| 429 | return algorithm; |
| 430 | } |
| 431 | |
| 432 | if(pStackInfo->bScoExist) |
| 433 | numOfDiffProfile++; |
| 434 | if(pStackInfo->bHidExist) |
| 435 | numOfDiffProfile++; |
| 436 | if(pStackInfo->bPanExist) |
| 437 | numOfDiffProfile++; |
| 438 | if(pStackInfo->bA2dpExist) |
| 439 | numOfDiffProfile++; |
| 440 | |
| 441 | if(numOfDiffProfile == 1) |
| 442 | { |
| 443 | if(pStackInfo->bScoExist) |
| 444 | { |
| 445 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO only\n")); |
| 446 | algorithm = BT_8723A_2ANT_COEX_ALGO_SCO; |
| 447 | } |
| 448 | else |
| 449 | { |
| 450 | if(pStackInfo->bHidExist) |
| 451 | { |
| 452 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID only\n")); |
| 453 | algorithm = BT_8723A_2ANT_COEX_ALGO_HID; |
| 454 | } |
| 455 | else if(pStackInfo->bA2dpExist) |
| 456 | { |
| 457 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2DP only\n")); |
| 458 | algorithm = BT_8723A_2ANT_COEX_ALGO_A2DP; |
| 459 | } |
| 460 | else if(pStackInfo->bPanExist) |
| 461 | { |
| 462 | if(bBtHsOn) |
| 463 | { |
| 464 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], PAN(HS) only\n")); |
| 465 | algorithm = BT_8723A_2ANT_COEX_ALGO_PANHS; |
| 466 | } |
| 467 | else |
| 468 | { |
| 469 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], PAN(EDR) only\n")); |
| 470 | algorithm = BT_8723A_2ANT_COEX_ALGO_PANEDR; |
| 471 | } |
| 472 | } |
| 473 | } |
| 474 | } |
| 475 | else if(numOfDiffProfile == 2) |
| 476 | { |
| 477 | if(pStackInfo->bScoExist) |
| 478 | { |
| 479 | if(pStackInfo->bHidExist) |
| 480 | { |
| 481 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID\n")); |
| 482 | algorithm = BT_8723A_2ANT_COEX_ALGO_HID; |
| 483 | } |
| 484 | else if(pStackInfo->bA2dpExist) |
| 485 | { |
| 486 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + A2DP ==> SCO\n")); |
| 487 | algorithm = BT_8723A_2ANT_COEX_ALGO_SCO; |
| 488 | } |
| 489 | else if(pStackInfo->bPanExist) |
| 490 | { |
| 491 | if(bBtHsOn) |
| 492 | { |
| 493 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + PAN(HS)\n")); |
| 494 | algorithm = BT_8723A_2ANT_COEX_ALGO_SCO; |
| 495 | } |
| 496 | else |
| 497 | { |
| 498 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + PAN(EDR)\n")); |
| 499 | algorithm = BT_8723A_2ANT_COEX_ALGO_PANEDR_HID; |
| 500 | } |
| 501 | } |
| 502 | } |
| 503 | else |
| 504 | { |
| 505 | if( pStackInfo->bHidExist && |
| 506 | pStackInfo->bA2dpExist ) |
| 507 | { |
| 508 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + A2DP\n")); |
| 509 | algorithm = BT_8723A_2ANT_COEX_ALGO_HID_A2DP; |
| 510 | } |
| 511 | else if( pStackInfo->bHidExist && |
| 512 | pStackInfo->bPanExist ) |
| 513 | { |
| 514 | if(bBtHsOn) |
| 515 | { |
| 516 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + PAN(HS)\n")); |
| 517 | algorithm = BT_8723A_2ANT_COEX_ALGO_HID_A2DP; |
| 518 | } |
| 519 | else |
| 520 | { |
| 521 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + PAN(EDR)\n")); |
| 522 | algorithm = BT_8723A_2ANT_COEX_ALGO_PANEDR_HID; |
| 523 | } |
| 524 | } |
| 525 | else if( pStackInfo->bPanExist && |
| 526 | pStackInfo->bA2dpExist ) |
| 527 | { |
| 528 | if(bBtHsOn) |
| 529 | { |
| 530 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2DP + PAN(HS)\n")); |
| 531 | algorithm = BT_8723A_2ANT_COEX_ALGO_A2DP; |
| 532 | } |
| 533 | else |
| 534 | { |
| 535 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2DP + PAN(EDR)\n")); |
| 536 | algorithm = BT_8723A_2ANT_COEX_ALGO_PANEDR_A2DP; |
| 537 | } |
| 538 | } |
| 539 | } |
| 540 | } |
| 541 | else if(numOfDiffProfile == 3) |
| 542 | { |
| 543 | if(pStackInfo->bScoExist) |
| 544 | { |
| 545 | if( pStackInfo->bHidExist && |
| 546 | pStackInfo->bA2dpExist ) |
| 547 | { |
| 548 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID + A2DP ==> HID\n")); |
| 549 | algorithm = BT_8723A_2ANT_COEX_ALGO_HID; |
| 550 | } |
| 551 | else if( pStackInfo->bHidExist && |
| 552 | pStackInfo->bPanExist ) |
| 553 | { |
| 554 | if(bBtHsOn) |
| 555 | { |
| 556 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID + PAN(HS)\n")); |
| 557 | algorithm = BT_8723A_2ANT_COEX_ALGO_HID_A2DP; |
| 558 | } |
| 559 | else |
| 560 | { |
| 561 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID + PAN(EDR)\n")); |
| 562 | algorithm = BT_8723A_2ANT_COEX_ALGO_PANEDR_HID; |
| 563 | } |
| 564 | } |
| 565 | else if( pStackInfo->bPanExist && |
| 566 | pStackInfo->bA2dpExist ) |
| 567 | { |
| 568 | if(bBtHsOn) |
| 569 | { |
| 570 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + A2DP + PAN(HS)\n")); |
| 571 | algorithm = BT_8723A_2ANT_COEX_ALGO_SCO; |
| 572 | } |
| 573 | else |
| 574 | { |
| 575 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + A2DP + PAN(EDR) ==> HID\n")); |
| 576 | algorithm = BT_8723A_2ANT_COEX_ALGO_PANEDR_HID; |
| 577 | } |
| 578 | } |
| 579 | } |
| 580 | else |
| 581 | { |
| 582 | if( pStackInfo->bHidExist && |
| 583 | pStackInfo->bPanExist && |
| 584 | pStackInfo->bA2dpExist ) |
| 585 | { |
| 586 | if(bBtHsOn) |
| 587 | { |
| 588 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + A2DP + PAN(HS)\n")); |
| 589 | algorithm = BT_8723A_2ANT_COEX_ALGO_HID_A2DP; |
| 590 | } |
| 591 | else |
| 592 | { |
| 593 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + A2DP + PAN(EDR)\n")); |
| 594 | algorithm = BT_8723A_2ANT_COEX_ALGO_HID_A2DP_PANEDR; |
| 595 | } |
| 596 | } |
| 597 | } |
| 598 | } |
| 599 | else if(numOfDiffProfile >= 3) |
| 600 | { |
| 601 | if(pStackInfo->bScoExist) |
| 602 | { |
| 603 | if( pStackInfo->bHidExist && |
| 604 | pStackInfo->bPanExist && |
| 605 | pStackInfo->bA2dpExist ) |
| 606 | { |
| 607 | if(bBtHsOn) |
| 608 | { |
| 609 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Error!!! SCO + HID + A2DP + PAN(HS)\n")); |
| 610 | |
| 611 | } |
| 612 | else |
| 613 | { |
| 614 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID + A2DP + PAN(EDR)==>PAN(EDR)+HID\n")); |
| 615 | algorithm = BT_8723A_2ANT_COEX_ALGO_PANEDR_HID; |
| 616 | } |
| 617 | } |
| 618 | } |
| 619 | } |
| 620 | |
| 621 | return algorithm; |
| 622 | } |
| 623 | |
| 624 | BOOLEAN |
| 625 | halbtc8723a2ant_NeedToDecBtPwr( |
| 626 | IN PBTC_COEXIST pBtCoexist |
| 627 | ) |
| 628 | { |
| 629 | BOOLEAN bRet=FALSE; |
| 630 | BOOLEAN bBtHsOn=FALSE, bWifiConnected=FALSE; |
| 631 | s4Byte btHsRssi=0; |
| 632 | |
| 633 | if(!pBtCoexist->btc_get(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn)) |
| 634 | return FALSE; |
| 635 | if(!pBtCoexist->btc_get(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected)) |
| 636 | return FALSE; |
| 637 | if(!pBtCoexist->btc_get(pBtCoexist, BTC_GET_S4_HS_RSSI, &btHsRssi)) |
| 638 | return FALSE; |
| 639 | |
| 640 | if(bWifiConnected) |
| 641 | { |
| 642 | if(bBtHsOn) |
| 643 | { |
| 644 | if(btHsRssi > 37) |
| 645 | { |
| 646 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], Need to decrease bt power for HS mode!!\n")); |
| 647 | bRet = true; |
| 648 | } |
| 649 | } |
| 650 | else |
| 651 | { |
| 652 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], Need to decrease bt power for Wifi is connected!!\n")); |
| 653 | bRet = true; |
| 654 | } |
| 655 | } |
| 656 | |
| 657 | return bRet; |
| 658 | } |
| 659 | |
| 660 | VOID |
| 661 | halbtc8723a2ant_SetFwDacSwingLevel( |
| 662 | IN PBTC_COEXIST pBtCoexist, |
| 663 | IN u1Byte dacSwingLvl |
| 664 | ) |
| 665 | { |
| 666 | u1Byte H2C_Parameter[1] ={0}; |
| 667 | |
| 668 | // There are several type of dacswing |
| 669 | // 0x18/ 0x10/ 0xc/ 0x8/ 0x4/ 0x6 |
| 670 | H2C_Parameter[0] = dacSwingLvl; |
| 671 | |
| 672 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], Set Dac Swing Level=0x%x\n", dacSwingLvl)); |
| 673 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], FW write 0x29=0x%x\n", H2C_Parameter[0])); |
| 674 | |
| 675 | pBtCoexist->btc_fill_h2c(pBtCoexist, 0x29, 1, H2C_Parameter); |
| 676 | } |
| 677 | |
| 678 | VOID |
| 679 | halbtc8723a2ant_SetFwDecBtPwr( |
| 680 | IN PBTC_COEXIST pBtCoexist, |
| 681 | IN BOOLEAN bDecBtPwr |
| 682 | ) |
| 683 | { |
| 684 | u1Byte H2C_Parameter[1] ={0}; |
| 685 | |
| 686 | H2C_Parameter[0] = 0; |
| 687 | |
| 688 | if(bDecBtPwr) |
| 689 | { |
| 690 | H2C_Parameter[0] |= BIT1; |
| 691 | } |
| 692 | |
| 693 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], decrease Bt Power : %s, FW write 0x21=0x%x\n", |
| 694 | (bDecBtPwr? "Yes!!":"No!!"), H2C_Parameter[0])); |
| 695 | |
| 696 | pBtCoexist->btc_fill_h2c(pBtCoexist, 0x21, 1, H2C_Parameter); |
| 697 | } |
| 698 | |
| 699 | VOID |
| 700 | halbtc8723a2ant_DecBtPwr( |
| 701 | IN PBTC_COEXIST pBtCoexist, |
| 702 | IN BOOLEAN bForceExec, |
| 703 | IN BOOLEAN bDecBtPwr |
| 704 | ) |
| 705 | { |
| 706 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], %s Dec BT power = %s\n", |
| 707 | (bForceExec? "force to":""), ((bDecBtPwr)? "ON":"OFF"))); |
| 708 | pCoexDm->bCurDecBtPwr = bDecBtPwr; |
| 709 | |
| 710 | if(!bForceExec) |
| 711 | { |
| 712 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], bPreDecBtPwr=%d, bCurDecBtPwr=%d\n", |
| 713 | pCoexDm->bPreDecBtPwr, pCoexDm->bCurDecBtPwr)); |
| 714 | |
| 715 | if(pCoexDm->bPreDecBtPwr == pCoexDm->bCurDecBtPwr) |
| 716 | return; |
| 717 | } |
| 718 | halbtc8723a2ant_SetFwDecBtPwr(pBtCoexist, pCoexDm->bCurDecBtPwr); |
| 719 | |
| 720 | pCoexDm->bPreDecBtPwr = pCoexDm->bCurDecBtPwr; |
| 721 | } |
| 722 | |
| 723 | VOID |
| 724 | halbtc8723a2ant_FwDacSwingLvl( |
| 725 | IN PBTC_COEXIST pBtCoexist, |
| 726 | IN BOOLEAN bForceExec, |
| 727 | IN u1Byte fwDacSwingLvl |
| 728 | ) |
| 729 | { |
| 730 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], %s set FW Dac Swing level = %d\n", |
| 731 | (bForceExec? "force to":""), fwDacSwingLvl)); |
| 732 | pCoexDm->curFwDacSwingLvl = fwDacSwingLvl; |
| 733 | |
| 734 | if(!bForceExec) |
| 735 | { |
| 736 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], preFwDacSwingLvl=%d, curFwDacSwingLvl=%d\n", |
| 737 | pCoexDm->preFwDacSwingLvl, pCoexDm->curFwDacSwingLvl)); |
| 738 | |
| 739 | if(pCoexDm->preFwDacSwingLvl == pCoexDm->curFwDacSwingLvl) |
| 740 | return; |
| 741 | } |
| 742 | |
| 743 | halbtc8723a2ant_SetFwDacSwingLevel(pBtCoexist, pCoexDm->curFwDacSwingLvl); |
| 744 | |
| 745 | pCoexDm->preFwDacSwingLvl = pCoexDm->curFwDacSwingLvl; |
| 746 | } |
| 747 | |
| 748 | VOID |
| 749 | halbtc8723a2ant_SetSwRfRxLpfCorner( |
| 750 | IN PBTC_COEXIST pBtCoexist, |
| 751 | IN BOOLEAN bRxRfShrinkOn |
| 752 | ) |
| 753 | { |
| 754 | if(bRxRfShrinkOn) |
| 755 | { |
| 756 | //Shrink RF Rx LPF corner |
| 757 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Shrink RF Rx LPF corner!!\n")); |
| 758 | pBtCoexist->btc_set_rf_reg(pBtCoexist, BTC_RF_A, 0x1e, 0xfffff, 0xf0ff7); |
| 759 | } |
| 760 | else |
| 761 | { |
| 762 | //Resume RF Rx LPF corner |
| 763 | // After initialized, we can use pCoexDm->btRf0x1eBackup |
| 764 | if(pBtCoexist->initilized) |
| 765 | { |
| 766 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Resume RF Rx LPF corner!!\n")); |
| 767 | pBtCoexist->btc_set_rf_reg(pBtCoexist, BTC_RF_A, 0x1e, 0xfffff, pCoexDm->btRf0x1eBackup); |
| 768 | } |
| 769 | } |
| 770 | } |
| 771 | |
| 772 | VOID |
| 773 | halbtc8723a2ant_RfShrink( |
| 774 | IN PBTC_COEXIST pBtCoexist, |
| 775 | IN BOOLEAN bForceExec, |
| 776 | IN BOOLEAN bRxRfShrinkOn |
| 777 | ) |
| 778 | { |
| 779 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW, ("[BTCoex], %s turn Rx RF Shrink = %s\n", |
| 780 | (bForceExec? "force to":""), ((bRxRfShrinkOn)? "ON":"OFF"))); |
| 781 | pCoexDm->bCurRfRxLpfShrink = bRxRfShrinkOn; |
| 782 | |
| 783 | if(!bForceExec) |
| 784 | { |
| 785 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_DETAIL, ("[BTCoex], bPreRfRxLpfShrink=%d, bCurRfRxLpfShrink=%d\n", |
| 786 | pCoexDm->bPreRfRxLpfShrink, pCoexDm->bCurRfRxLpfShrink)); |
| 787 | |
| 788 | if(pCoexDm->bPreRfRxLpfShrink == pCoexDm->bCurRfRxLpfShrink) |
| 789 | return; |
| 790 | } |
| 791 | halbtc8723a2ant_SetSwRfRxLpfCorner(pBtCoexist, pCoexDm->bCurRfRxLpfShrink); |
| 792 | |
| 793 | pCoexDm->bPreRfRxLpfShrink = pCoexDm->bCurRfRxLpfShrink; |
| 794 | } |
| 795 | |
| 796 | VOID |
| 797 | halbtc8723a2ant_SetSwPenaltyTxRateAdaptive( |
| 798 | IN PBTC_COEXIST pBtCoexist, |
| 799 | IN BOOLEAN bLowPenaltyRa |
| 800 | ) |
| 801 | { |
| 802 | u1Byte tmpU1; |
| 803 | |
| 804 | tmpU1 = pBtCoexist->btc_read_1byte(pBtCoexist, 0x4fd); |
| 805 | tmpU1 |= BIT0; |
| 806 | if(bLowPenaltyRa) |
| 807 | { |
| 808 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Tx rate adaptive, set low penalty!!\n")); |
| 809 | tmpU1 &= ~BIT2; |
| 810 | } |
| 811 | else |
| 812 | { |
| 813 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Tx rate adaptive, set normal!!\n")); |
| 814 | tmpU1 |= BIT2; |
| 815 | } |
| 816 | |
| 817 | pBtCoexist->btc_write_1byte(pBtCoexist, 0x4fd, tmpU1); |
| 818 | } |
| 819 | |
| 820 | VOID |
| 821 | halbtc8723a2ant_LowPenaltyRa( |
| 822 | IN PBTC_COEXIST pBtCoexist, |
| 823 | IN BOOLEAN bForceExec, |
| 824 | IN BOOLEAN bLowPenaltyRa |
| 825 | ) |
| 826 | { |
| 827 | return; |
| 828 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW, ("[BTCoex], %s turn LowPenaltyRA = %s\n", |
| 829 | (bForceExec? "force to":""), ((bLowPenaltyRa)? "ON":"OFF"))); |
| 830 | pCoexDm->bCurLowPenaltyRa = bLowPenaltyRa; |
| 831 | |
| 832 | if(!bForceExec) |
| 833 | { |
| 834 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_DETAIL, ("[BTCoex], bPreLowPenaltyRa=%d, bCurLowPenaltyRa=%d\n", |
| 835 | pCoexDm->bPreLowPenaltyRa, pCoexDm->bCurLowPenaltyRa)); |
| 836 | |
| 837 | if(pCoexDm->bPreLowPenaltyRa == pCoexDm->bCurLowPenaltyRa) |
| 838 | return; |
| 839 | } |
| 840 | halbtc8723a2ant_SetSwPenaltyTxRateAdaptive(pBtCoexist, pCoexDm->bCurLowPenaltyRa); |
| 841 | |
| 842 | pCoexDm->bPreLowPenaltyRa = pCoexDm->bCurLowPenaltyRa; |
| 843 | } |
| 844 | |
| 845 | VOID |
| 846 | halbtc8723a2ant_SetSwFullTimeDacSwing( |
| 847 | IN PBTC_COEXIST pBtCoexist, |
| 848 | IN BOOLEAN bSwDacSwingOn, |
| 849 | IN u4Byte swDacSwingLvl |
| 850 | ) |
| 851 | { |
| 852 | if(bSwDacSwingOn) |
| 853 | { |
| 854 | pBtCoexist->btc_setBbReg(pBtCoexist, 0x880, 0xff000000, swDacSwingLvl); |
| 855 | } |
| 856 | else |
| 857 | { |
| 858 | pBtCoexist->btc_setBbReg(pBtCoexist, 0x880, 0xff000000, 0xc0); |
| 859 | } |
| 860 | } |
| 861 | |
| 862 | |
| 863 | VOID |
| 864 | halbtc8723a2ant_DacSwing( |
| 865 | IN PBTC_COEXIST pBtCoexist, |
| 866 | IN BOOLEAN bForceExec, |
| 867 | IN BOOLEAN bDacSwingOn, |
| 868 | IN u4Byte dacSwingLvl |
| 869 | ) |
| 870 | { |
| 871 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW, ("[BTCoex], %s turn DacSwing=%s, dacSwingLvl=0x%x\n", |
| 872 | (bForceExec? "force to":""), ((bDacSwingOn)? "ON":"OFF"), dacSwingLvl)); |
| 873 | pCoexDm->bCurDacSwingOn = bDacSwingOn; |
| 874 | pCoexDm->curDacSwingLvl = dacSwingLvl; |
| 875 | |
| 876 | if(!bForceExec) |
| 877 | { |
| 878 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_DETAIL, ("[BTCoex], bPreDacSwingOn=%d, preDacSwingLvl=0x%x, bCurDacSwingOn=%d, curDacSwingLvl=0x%x\n", |
| 879 | pCoexDm->bPreDacSwingOn, pCoexDm->preDacSwingLvl, |
| 880 | pCoexDm->bCurDacSwingOn, pCoexDm->curDacSwingLvl)); |
| 881 | |
| 882 | if( (pCoexDm->bPreDacSwingOn == pCoexDm->bCurDacSwingOn) && |
| 883 | (pCoexDm->preDacSwingLvl == pCoexDm->curDacSwingLvl) ) |
| 884 | return; |
| 885 | } |
| 886 | mdelay(30); |
| 887 | halbtc8723a2ant_SetSwFullTimeDacSwing(pBtCoexist, bDacSwingOn, dacSwingLvl); |
| 888 | |
| 889 | pCoexDm->bPreDacSwingOn = pCoexDm->bCurDacSwingOn; |
| 890 | pCoexDm->preDacSwingLvl = pCoexDm->curDacSwingLvl; |
| 891 | } |
| 892 | |
| 893 | VOID |
| 894 | halbtc8723a2ant_SetAdcBackOff( |
| 895 | IN PBTC_COEXIST pBtCoexist, |
| 896 | IN BOOLEAN bAdcBackOff |
| 897 | ) |
| 898 | { |
| 899 | if(bAdcBackOff) |
| 900 | { |
| 901 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], BB BackOff Level On!\n")); |
| 902 | pBtCoexist->btc_write_4byte(pBtCoexist, 0xc04,0x3a07611); |
| 903 | } |
| 904 | else |
| 905 | { |
| 906 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], BB BackOff Level Off!\n")); |
| 907 | pBtCoexist->btc_write_4byte(pBtCoexist, 0xc04,0x3a05611); |
| 908 | } |
| 909 | } |
| 910 | |
| 911 | VOID |
| 912 | halbtc8723a2ant_AdcBackOff( |
| 913 | IN PBTC_COEXIST pBtCoexist, |
| 914 | IN BOOLEAN bForceExec, |
| 915 | IN BOOLEAN bAdcBackOff |
| 916 | ) |
| 917 | { |
| 918 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW, ("[BTCoex], %s turn AdcBackOff = %s\n", |
| 919 | (bForceExec? "force to":""), ((bAdcBackOff)? "ON":"OFF"))); |
| 920 | pCoexDm->bCurAdcBackOff = bAdcBackOff; |
| 921 | |
| 922 | if(!bForceExec) |
| 923 | { |
| 924 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_DETAIL, ("[BTCoex], bPreAdcBackOff=%d, bCurAdcBackOff=%d\n", |
| 925 | pCoexDm->bPreAdcBackOff, pCoexDm->bCurAdcBackOff)); |
| 926 | |
| 927 | if(pCoexDm->bPreAdcBackOff == pCoexDm->bCurAdcBackOff) |
| 928 | return; |
| 929 | } |
| 930 | halbtc8723a2ant_SetAdcBackOff(pBtCoexist, pCoexDm->bCurAdcBackOff); |
| 931 | |
| 932 | pCoexDm->bPreAdcBackOff = pCoexDm->bCurAdcBackOff; |
| 933 | } |
| 934 | |
| 935 | VOID |
| 936 | halbtc8723a2ant_SetAgcTable( |
| 937 | IN PBTC_COEXIST pBtCoexist, |
| 938 | IN BOOLEAN bAgcTableEn |
| 939 | ) |
| 940 | { |
| 941 | u1Byte rssiAdjustVal=0; |
| 942 | |
| 943 | if(bAgcTableEn) |
| 944 | { |
| 945 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Agc Table On!\n")); |
| 946 | pBtCoexist->btc_write_4byte(pBtCoexist, 0xc78,0x4e1c0001); |
| 947 | pBtCoexist->btc_write_4byte(pBtCoexist, 0xc78,0x4d1d0001); |
| 948 | pBtCoexist->btc_write_4byte(pBtCoexist, 0xc78,0x4c1e0001); |
| 949 | pBtCoexist->btc_write_4byte(pBtCoexist, 0xc78,0x4b1f0001); |
| 950 | pBtCoexist->btc_write_4byte(pBtCoexist, 0xc78,0x4a200001); |
| 951 | |
| 952 | pBtCoexist->btc_set_rf_reg(pBtCoexist, BTC_RF_A, 0x12, 0xfffff, 0xdc000); |
| 953 | pBtCoexist->btc_set_rf_reg(pBtCoexist, BTC_RF_A, 0x12, 0xfffff, 0x90000); |
| 954 | pBtCoexist->btc_set_rf_reg(pBtCoexist, BTC_RF_A, 0x12, 0xfffff, 0x51000); |
| 955 | pBtCoexist->btc_set_rf_reg(pBtCoexist, BTC_RF_A, 0x12, 0xfffff, 0x12000); |
| 956 | pBtCoexist->btc_set_rf_reg(pBtCoexist, BTC_RF_A, 0x1a, 0xfffff, 0x00355); |
| 957 | |
| 958 | rssiAdjustVal = 6; |
| 959 | } |
| 960 | else |
| 961 | { |
| 962 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Agc Table Off!\n")); |
| 963 | pBtCoexist->btc_write_4byte(pBtCoexist, 0xc78,0x641c0001); |
| 964 | pBtCoexist->btc_write_4byte(pBtCoexist, 0xc78,0x631d0001); |
| 965 | pBtCoexist->btc_write_4byte(pBtCoexist, 0xc78,0x621e0001); |
| 966 | pBtCoexist->btc_write_4byte(pBtCoexist, 0xc78,0x611f0001); |
| 967 | pBtCoexist->btc_write_4byte(pBtCoexist, 0xc78,0x60200001); |
| 968 | |
| 969 | pBtCoexist->btc_set_rf_reg(pBtCoexist, BTC_RF_A, 0x12, 0xfffff, 0x32000); |
| 970 | pBtCoexist->btc_set_rf_reg(pBtCoexist, BTC_RF_A, 0x12, 0xfffff, 0x71000); |
| 971 | pBtCoexist->btc_set_rf_reg(pBtCoexist, BTC_RF_A, 0x12, 0xfffff, 0xb0000); |
| 972 | pBtCoexist->btc_set_rf_reg(pBtCoexist, BTC_RF_A, 0x12, 0xfffff, 0xfc000); |
| 973 | pBtCoexist->btc_set_rf_reg(pBtCoexist, BTC_RF_A, 0x1a, 0xfffff, 0x30355); |
| 974 | } |
| 975 | |
| 976 | // set rssiAdjustVal for wifi module. |
| 977 | pBtCoexist->btc_set(pBtCoexist, BTC_SET_U1_RSSI_ADJ_VAL_FOR_AGC_TABLE_ON, &rssiAdjustVal); |
| 978 | } |
| 979 | |
| 980 | |
| 981 | VOID |
| 982 | halbtc8723a2ant_AgcTable( |
| 983 | IN PBTC_COEXIST pBtCoexist, |
| 984 | IN BOOLEAN bForceExec, |
| 985 | IN BOOLEAN bAgcTableEn |
| 986 | ) |
| 987 | { |
| 988 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW, ("[BTCoex], %s %s Agc Table\n", |
| 989 | (bForceExec? "force to":""), ((bAgcTableEn)? "Enable":"Disable"))); |
| 990 | pCoexDm->bCurAgcTableEn = bAgcTableEn; |
| 991 | |
| 992 | if(!bForceExec) |
| 993 | { |
| 994 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_DETAIL, ("[BTCoex], bPreAgcTableEn=%d, bCurAgcTableEn=%d\n", |
| 995 | pCoexDm->bPreAgcTableEn, pCoexDm->bCurAgcTableEn)); |
| 996 | |
| 997 | if(pCoexDm->bPreAgcTableEn == pCoexDm->bCurAgcTableEn) |
| 998 | return; |
| 999 | } |
| 1000 | halbtc8723a2ant_SetAgcTable(pBtCoexist, bAgcTableEn); |
| 1001 | |
| 1002 | pCoexDm->bPreAgcTableEn = pCoexDm->bCurAgcTableEn; |
| 1003 | } |
| 1004 | |
| 1005 | VOID |
| 1006 | halbtc8723a2ant_SetCoexTable( |
| 1007 | IN PBTC_COEXIST pBtCoexist, |
| 1008 | IN u4Byte val0x6c0, |
| 1009 | IN u4Byte val0x6c8, |
| 1010 | IN u1Byte val0x6cc |
| 1011 | ) |
| 1012 | { |
| 1013 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], set coex table, set 0x6c0=0x%x\n", val0x6c0)); |
| 1014 | pBtCoexist->btc_write_4byte(pBtCoexist, 0x6c0, val0x6c0); |
| 1015 | |
| 1016 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], set coex table, set 0x6c8=0x%x\n", val0x6c8)); |
| 1017 | pBtCoexist->btc_write_4byte(pBtCoexist, 0x6c8, val0x6c8); |
| 1018 | |
| 1019 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], set coex table, set 0x6cc=0x%x\n", val0x6cc)); |
| 1020 | pBtCoexist->btc_write_1byte(pBtCoexist, 0x6cc, val0x6cc); |
| 1021 | } |
| 1022 | |
| 1023 | VOID |
| 1024 | halbtc8723a2ant_CoexTable( |
| 1025 | IN PBTC_COEXIST pBtCoexist, |
| 1026 | IN BOOLEAN bForceExec, |
| 1027 | IN u4Byte val0x6c0, |
| 1028 | IN u4Byte val0x6c8, |
| 1029 | IN u1Byte val0x6cc |
| 1030 | ) |
| 1031 | { |
| 1032 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW, ("[BTCoex], %s write Coex Table 0x6c0=0x%x, 0x6c8=0x%x, 0x6cc=0x%x\n", |
| 1033 | (bForceExec? "force to":""), val0x6c0, val0x6c8, val0x6cc)); |
| 1034 | pCoexDm->curVal0x6c0 = val0x6c0; |
| 1035 | pCoexDm->curVal0x6c8 = val0x6c8; |
| 1036 | pCoexDm->curVal0x6cc = val0x6cc; |
| 1037 | |
| 1038 | if(!bForceExec) |
| 1039 | { |
| 1040 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_DETAIL, ("[BTCoex], preVal0x6c0=0x%x, preVal0x6c8=0x%x, preVal0x6cc=0x%x !!\n", |
| 1041 | pCoexDm->preVal0x6c0, pCoexDm->preVal0x6c8, pCoexDm->preVal0x6cc)); |
| 1042 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_DETAIL, ("[BTCoex], curVal0x6c0=0x%x, curVal0x6c8=0x%x, curVal0x6cc=0x%x !!\n", |
| 1043 | pCoexDm->curVal0x6c0, pCoexDm->curVal0x6c8, pCoexDm->curVal0x6cc)); |
| 1044 | |
| 1045 | if( (pCoexDm->preVal0x6c0 == pCoexDm->curVal0x6c0) && |
| 1046 | (pCoexDm->preVal0x6c8 == pCoexDm->curVal0x6c8) && |
| 1047 | (pCoexDm->preVal0x6cc == pCoexDm->curVal0x6cc) ) |
| 1048 | return; |
| 1049 | } |
| 1050 | halbtc8723a2ant_SetCoexTable(pBtCoexist, val0x6c0, val0x6c8, val0x6cc); |
| 1051 | |
| 1052 | pCoexDm->preVal0x6c0 = pCoexDm->curVal0x6c0; |
| 1053 | pCoexDm->preVal0x6c8 = pCoexDm->curVal0x6c8; |
| 1054 | pCoexDm->preVal0x6cc = pCoexDm->curVal0x6cc; |
| 1055 | } |
| 1056 | |
| 1057 | VOID |
| 1058 | halbtc8723a2ant_SetFwIgnoreWlanAct( |
| 1059 | IN PBTC_COEXIST pBtCoexist, |
| 1060 | IN BOOLEAN bEnable |
| 1061 | ) |
| 1062 | { |
| 1063 | u1Byte H2C_Parameter[1] ={0}; |
| 1064 | |
| 1065 | if(bEnable) |
| 1066 | { |
| 1067 | H2C_Parameter[0] |= BIT0; // function enable |
| 1068 | } |
| 1069 | |
| 1070 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], set FW for BT Ignore Wlan_Act, FW write 0x25=0x%x\n", |
| 1071 | H2C_Parameter[0])); |
| 1072 | |
| 1073 | pBtCoexist->btc_fill_h2c(pBtCoexist, 0x25, 1, H2C_Parameter); |
| 1074 | } |
| 1075 | |
| 1076 | VOID |
| 1077 | halbtc8723a2ant_IgnoreWlanAct( |
| 1078 | IN PBTC_COEXIST pBtCoexist, |
| 1079 | IN BOOLEAN bForceExec, |
| 1080 | IN BOOLEAN bEnable |
| 1081 | ) |
| 1082 | { |
| 1083 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], %s turn Ignore WlanAct %s\n", |
| 1084 | (bForceExec? "force to":""), (bEnable? "ON":"OFF"))); |
| 1085 | pCoexDm->bCurIgnoreWlanAct = bEnable; |
| 1086 | |
| 1087 | if(!bForceExec) |
| 1088 | { |
| 1089 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], bPreIgnoreWlanAct = %d, bCurIgnoreWlanAct = %d!!\n", |
| 1090 | pCoexDm->bPreIgnoreWlanAct, pCoexDm->bCurIgnoreWlanAct)); |
| 1091 | |
| 1092 | if(pCoexDm->bPreIgnoreWlanAct == pCoexDm->bCurIgnoreWlanAct) |
| 1093 | return; |
| 1094 | } |
| 1095 | halbtc8723a2ant_SetFwIgnoreWlanAct(pBtCoexist, bEnable); |
| 1096 | |
| 1097 | pCoexDm->bPreIgnoreWlanAct = pCoexDm->bCurIgnoreWlanAct; |
| 1098 | } |
| 1099 | |
| 1100 | VOID |
| 1101 | halbtc8723a2ant_SetFwPstdma( |
| 1102 | IN PBTC_COEXIST pBtCoexist, |
| 1103 | IN u1Byte byte1, |
| 1104 | IN u1Byte byte2, |
| 1105 | IN u1Byte byte3, |
| 1106 | IN u1Byte byte4, |
| 1107 | IN u1Byte byte5 |
| 1108 | ) |
| 1109 | { |
| 1110 | u1Byte H2C_Parameter[5] ={0}; |
| 1111 | |
| 1112 | H2C_Parameter[0] = byte1; |
| 1113 | H2C_Parameter[1] = byte2; |
| 1114 | H2C_Parameter[2] = byte3; |
| 1115 | H2C_Parameter[3] = byte4; |
| 1116 | H2C_Parameter[4] = byte5; |
| 1117 | |
| 1118 | pCoexDm->psTdmaPara[0] = byte1; |
| 1119 | pCoexDm->psTdmaPara[1] = byte2; |
| 1120 | pCoexDm->psTdmaPara[2] = byte3; |
| 1121 | pCoexDm->psTdmaPara[3] = byte4; |
| 1122 | pCoexDm->psTdmaPara[4] = byte5; |
| 1123 | |
| 1124 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], FW write 0x3a(5bytes)=0x%x%08x\n", |
| 1125 | H2C_Parameter[0], |
| 1126 | H2C_Parameter[1]<<24|H2C_Parameter[2]<<16|H2C_Parameter[3]<<8|H2C_Parameter[4])); |
| 1127 | |
| 1128 | pBtCoexist->btc_fill_h2c(pBtCoexist, 0x3a, 5, H2C_Parameter); |
| 1129 | } |
| 1130 | |
| 1131 | VOID |
| 1132 | halbtc8723a2ant_PsTdma( |
| 1133 | IN PBTC_COEXIST pBtCoexist, |
| 1134 | IN BOOLEAN bForceExec, |
| 1135 | IN BOOLEAN bTurnOn, |
| 1136 | IN u1Byte type |
| 1137 | ) |
| 1138 | { |
| 1139 | u4Byte btTxRxCnt=0; |
| 1140 | |
| 1141 | btTxRxCnt = pCoexSta->highPriorityTx+pCoexSta->highPriorityRx+ |
| 1142 | pCoexSta->lowPriorityTx+pCoexSta->lowPriorityRx; |
| 1143 | |
| 1144 | if(btTxRxCnt > 3000) |
| 1145 | { |
| 1146 | pCoexDm->bCurPsTdmaOn = true; |
| 1147 | pCoexDm->curPsTdma = 8; |
| 1148 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], turn ON PS TDMA, type=%d for BT tx/rx counters=%d(>3000)\n", |
| 1149 | pCoexDm->curPsTdma, btTxRxCnt)); |
| 1150 | } |
| 1151 | else |
| 1152 | { |
| 1153 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], %s turn %s PS TDMA, type=%d\n", |
| 1154 | (bForceExec? "force to":""), (bTurnOn? "ON":"OFF"), type)); |
| 1155 | pCoexDm->bCurPsTdmaOn = bTurnOn; |
| 1156 | pCoexDm->curPsTdma = type; |
| 1157 | } |
| 1158 | |
| 1159 | if(!bForceExec) |
| 1160 | { |
| 1161 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], bPrePsTdmaOn = %d, bCurPsTdmaOn = %d!!\n", |
| 1162 | pCoexDm->bPrePsTdmaOn, pCoexDm->bCurPsTdmaOn)); |
| 1163 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], prePsTdma = %d, curPsTdma = %d!!\n", |
| 1164 | pCoexDm->prePsTdma, pCoexDm->curPsTdma)); |
| 1165 | |
| 1166 | if( (pCoexDm->bPrePsTdmaOn == pCoexDm->bCurPsTdmaOn) && |
| 1167 | (pCoexDm->prePsTdma == pCoexDm->curPsTdma) ) |
| 1168 | return; |
| 1169 | } |
| 1170 | if(pCoexDm->bCurPsTdmaOn) |
| 1171 | { |
| 1172 | switch(pCoexDm->curPsTdma) |
| 1173 | { |
| 1174 | case 1: |
| 1175 | default: |
| 1176 | halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0xe1, 0x98); |
| 1177 | break; |
| 1178 | case 2: |
| 1179 | halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0xe1, 0x98); |
| 1180 | break; |
| 1181 | case 3: |
| 1182 | halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0xa, 0xa, 0xe1, 0x98); |
| 1183 | break; |
| 1184 | case 4: |
| 1185 | halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xa3, 0x5, 0x5, 0xe1, 0x80); |
| 1186 | break; |
| 1187 | case 5: |
| 1188 | halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0x60, 0x98); |
| 1189 | break; |
| 1190 | case 6: |
| 1191 | halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0x60, 0x98); |
| 1192 | break; |
| 1193 | case 7: |
| 1194 | halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0xa, 0xa, 0x60, 0x98); |
| 1195 | break; |
| 1196 | case 8: |
| 1197 | halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xa3, 0x5, 0x5, 0x60, 0x80); |
| 1198 | break; |
| 1199 | case 9: |
| 1200 | halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0xe1, 0x98); |
| 1201 | break; |
| 1202 | case 10: |
| 1203 | halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0xe1, 0x98); |
| 1204 | break; |
| 1205 | case 11: |
| 1206 | halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0xa, 0xa, 0xe1, 0x98); |
| 1207 | break; |
| 1208 | case 12: |
| 1209 | halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x5, 0x5, 0xe1, 0x98); |
| 1210 | break; |
| 1211 | case 13: |
| 1212 | halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0x60, 0x98); |
| 1213 | break; |
| 1214 | case 14: |
| 1215 | halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0x60, 0x98); |
| 1216 | break; |
| 1217 | case 15: |
| 1218 | halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0xa, 0xa, 0x60, 0x98); |
| 1219 | break; |
| 1220 | case 16: |
| 1221 | halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x5, 0x5, 0x60, 0x98); |
| 1222 | break; |
| 1223 | case 17: |
| 1224 | halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xa3, 0x2f, 0x2f, 0x60, 0x80); |
| 1225 | break; |
| 1226 | case 18: |
| 1227 | halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x5, 0x5, 0xe1, 0x98); |
| 1228 | break; |
| 1229 | case 19: |
| 1230 | halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x25, 0x25, 0xe1, 0x98); |
| 1231 | break; |
| 1232 | case 20: |
| 1233 | halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x25, 0x25, 0x60, 0x98); |
| 1234 | break; |
| 1235 | } |
| 1236 | } |
| 1237 | else |
| 1238 | { |
| 1239 | // disable PS tdma |
| 1240 | switch(pCoexDm->curPsTdma) |
| 1241 | { |
| 1242 | case 0: |
| 1243 | halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0x0, 0x0, 0x0, 0x8, 0x0); |
| 1244 | break; |
| 1245 | case 1: |
| 1246 | halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0x0, 0x0, 0x0, 0x0, 0x0); |
| 1247 | break; |
| 1248 | default: |
| 1249 | halbtc8723a2ant_SetFwPstdma(pBtCoexist, 0x0, 0x0, 0x0, 0x8, 0x0); |
| 1250 | break; |
| 1251 | } |
| 1252 | } |
| 1253 | |
| 1254 | // update pre state |
| 1255 | pCoexDm->bPrePsTdmaOn = pCoexDm->bCurPsTdmaOn; |
| 1256 | pCoexDm->prePsTdma = pCoexDm->curPsTdma; |
| 1257 | } |
| 1258 | |
| 1259 | |
| 1260 | VOID |
| 1261 | halbtc8723a2ant_CoexAllOff( |
| 1262 | IN PBTC_COEXIST pBtCoexist |
| 1263 | ) |
| 1264 | { |
| 1265 | // fw all off |
| 1266 | halbtc8723a2ant_IgnoreWlanAct(pBtCoexist, NORMAL_EXEC, FALSE); |
| 1267 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0); |
| 1268 | halbtc8723a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 0x20); |
| 1269 | halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE); |
| 1270 | |
| 1271 | // sw all off |
| 1272 | halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE); |
| 1273 | halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE); |
| 1274 | halbtc8723a2ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, FALSE); |
| 1275 | halbtc8723a2ant_RfShrink(pBtCoexist, NORMAL_EXEC, FALSE); |
| 1276 | halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0); |
| 1277 | |
| 1278 | // hw all off |
| 1279 | halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3); |
| 1280 | } |
| 1281 | |
| 1282 | VOID |
| 1283 | halbtc8723a2ant_InitCoexDm( |
| 1284 | IN PBTC_COEXIST pBtCoexist |
| 1285 | ) |
| 1286 | { |
| 1287 | // force to reset coex mechanism |
| 1288 | halbtc8723a2ant_CoexTable(pBtCoexist, FORCE_EXEC, 0x55555555, 0xffff, 0x3); |
| 1289 | halbtc8723a2ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 0); |
| 1290 | halbtc8723a2ant_FwDacSwingLvl(pBtCoexist, FORCE_EXEC, 0x20); |
| 1291 | halbtc8723a2ant_DecBtPwr(pBtCoexist, FORCE_EXEC, FALSE); |
| 1292 | halbtc8723a2ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, FALSE); |
| 1293 | |
| 1294 | halbtc8723a2ant_AgcTable(pBtCoexist, FORCE_EXEC, FALSE); |
| 1295 | halbtc8723a2ant_AdcBackOff(pBtCoexist, FORCE_EXEC, FALSE); |
| 1296 | halbtc8723a2ant_LowPenaltyRa(pBtCoexist, FORCE_EXEC, FALSE); |
| 1297 | halbtc8723a2ant_RfShrink(pBtCoexist, FORCE_EXEC, FALSE); |
| 1298 | halbtc8723a2ant_DacSwing(pBtCoexist, FORCE_EXEC, FALSE, 0xc0); |
| 1299 | } |
| 1300 | |
| 1301 | VOID |
| 1302 | halbtc8723a2ant_BtInquiryPage( |
| 1303 | IN PBTC_COEXIST pBtCoexist |
| 1304 | ) |
| 1305 | { |
| 1306 | BOOLEAN bLowPwrDisable=true; |
| 1307 | |
| 1308 | pBtCoexist->btc_set(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable); |
| 1309 | |
| 1310 | halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3); |
| 1311 | halbtc8723a2ant_IgnoreWlanAct(pBtCoexist, NORMAL_EXEC, FALSE); |
| 1312 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 8); |
| 1313 | } |
| 1314 | |
| 1315 | VOID |
| 1316 | halbtc8723a2ant_BtEnableAction( |
| 1317 | IN PBTC_COEXIST pBtCoexist |
| 1318 | ) |
| 1319 | { |
| 1320 | BOOLEAN bWifiConnected=FALSE; |
| 1321 | |
| 1322 | // Here we need to resend some wifi info to BT |
| 1323 | // because bt is reset and loss of the info. |
| 1324 | pBtCoexist->btc_get(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected); |
| 1325 | if(bWifiConnected) |
| 1326 | { |
| 1327 | halbtc8723a2ant_IndicateWifiChnlBwInfo(pBtCoexist, BTC_MEDIA_CONNECT); |
| 1328 | } |
| 1329 | else |
| 1330 | { |
| 1331 | halbtc8723a2ant_IndicateWifiChnlBwInfo(pBtCoexist, BTC_MEDIA_DISCONNECT); |
| 1332 | } |
| 1333 | |
| 1334 | halbtc8723a2ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, FALSE); |
| 1335 | } |
| 1336 | |
| 1337 | VOID |
| 1338 | halbtc8723a2ant_MonitorBtCtr( |
| 1339 | IN PBTC_COEXIST pBtCoexist |
| 1340 | ) |
| 1341 | { |
| 1342 | u4Byte regHPTxRx, regLPTxRx, u4Tmp; |
| 1343 | u4Byte regHPTx=0, regHPRx=0, regLPTx=0, regLPRx=0; |
| 1344 | u1Byte u1Tmp; |
| 1345 | |
| 1346 | regHPTxRx = 0x770; |
| 1347 | regLPTxRx = 0x774; |
| 1348 | |
| 1349 | u4Tmp = pBtCoexist->btc_read_4byte(pBtCoexist, regHPTxRx); |
| 1350 | regHPTx = u4Tmp & MASKLWORD; |
| 1351 | regHPRx = (u4Tmp & MASKHWORD)>>16; |
| 1352 | |
| 1353 | u4Tmp = pBtCoexist->btc_read_4byte(pBtCoexist, regLPTxRx); |
| 1354 | regLPTx = u4Tmp & MASKLWORD; |
| 1355 | regLPRx = (u4Tmp & MASKHWORD)>>16; |
| 1356 | |
| 1357 | pCoexSta->highPriorityTx = regHPTx; |
| 1358 | pCoexSta->highPriorityRx = regHPRx; |
| 1359 | pCoexSta->lowPriorityTx = regLPTx; |
| 1360 | pCoexSta->lowPriorityRx = regLPRx; |
| 1361 | |
| 1362 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_MONITOR, ("[BTCoex], High Priority Tx/Rx (reg 0x%x)=0x%x(%d)/0x%x(%d)\n", |
| 1363 | regHPTxRx, regHPTx, regHPTx, regHPRx, regHPRx)); |
| 1364 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_MONITOR, ("[BTCoex], Low Priority Tx/Rx (reg 0x%x)=0x%x(%d)/0x%x(%d)\n", |
| 1365 | regLPTxRx, regLPTx, regLPTx, regLPRx, regLPRx)); |
| 1366 | |
| 1367 | // reset counter |
| 1368 | pBtCoexist->btc_write_1byte(pBtCoexist, 0x76e, 0xc); |
| 1369 | } |
| 1370 | |
| 1371 | VOID |
| 1372 | halbtc8723a2ant_MonitorBtEnableDisable( |
| 1373 | IN PBTC_COEXIST pBtCoexist |
| 1374 | ) |
| 1375 | { |
| 1376 | static BOOLEAN bPreBtDisabled=FALSE; |
| 1377 | static u4Byte btDisableCnt=0; |
| 1378 | BOOLEAN bBtActive=true, bBtDisabled=FALSE; |
| 1379 | |
| 1380 | // This function check if bt is disabled |
| 1381 | |
| 1382 | if( pCoexSta->highPriorityTx == 0 && |
| 1383 | pCoexSta->highPriorityRx == 0 && |
| 1384 | pCoexSta->lowPriorityTx == 0 && |
| 1385 | pCoexSta->lowPriorityRx == 0) |
| 1386 | { |
| 1387 | bBtActive = FALSE; |
| 1388 | } |
| 1389 | if( pCoexSta->highPriorityTx == 0xffff && |
| 1390 | pCoexSta->highPriorityRx == 0xffff && |
| 1391 | pCoexSta->lowPriorityTx == 0xffff && |
| 1392 | pCoexSta->lowPriorityRx == 0xffff) |
| 1393 | { |
| 1394 | bBtActive = FALSE; |
| 1395 | } |
| 1396 | if(bBtActive) |
| 1397 | { |
| 1398 | btDisableCnt = 0; |
| 1399 | bBtDisabled = FALSE; |
| 1400 | pBtCoexist->btc_set(pBtCoexist, BTC_SET_BL_BT_DISABLE, &bBtDisabled); |
| 1401 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_MONITOR, ("[BTCoex], BT is enabled !!\n")); |
| 1402 | } |
| 1403 | else |
| 1404 | { |
| 1405 | btDisableCnt++; |
| 1406 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_MONITOR, ("[BTCoex], bt all counters=0, %d times!!\n", |
| 1407 | btDisableCnt)); |
| 1408 | if(btDisableCnt >= 2) |
| 1409 | { |
| 1410 | bBtDisabled = true; |
| 1411 | pBtCoexist->btc_set(pBtCoexist, BTC_SET_BL_BT_DISABLE, &bBtDisabled); |
| 1412 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_MONITOR, ("[BTCoex], BT is disabled !!\n")); |
| 1413 | } |
| 1414 | } |
| 1415 | if(bPreBtDisabled != bBtDisabled) |
| 1416 | { |
| 1417 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_MONITOR, ("[BTCoex], BT is from %s to %s!!\n", |
| 1418 | (bPreBtDisabled ? "disabled":"enabled"), |
| 1419 | (bBtDisabled ? "disabled":"enabled"))); |
| 1420 | bPreBtDisabled = bBtDisabled; |
| 1421 | if(!bBtDisabled) |
| 1422 | { |
| 1423 | halbtc8723a2ant_BtEnableAction(pBtCoexist); |
| 1424 | } |
| 1425 | } |
| 1426 | } |
| 1427 | |
| 1428 | BOOLEAN |
| 1429 | halbtc8723a2ant_IsCommonAction( |
| 1430 | IN PBTC_COEXIST pBtCoexist |
| 1431 | ) |
| 1432 | { |
| 1433 | PBTC_STACK_INFO pStackInfo=&pBtCoexist->stack_info; |
| 1434 | BOOLEAN bCommon=FALSE, bWifiConnected=FALSE; |
| 1435 | BOOLEAN bLowPwrDisable=FALSE; |
| 1436 | |
| 1437 | if(!pStackInfo->bBtLinkExist) |
| 1438 | { |
| 1439 | bLowPwrDisable = FALSE; |
| 1440 | pBtCoexist->btc_set(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable); |
| 1441 | } |
| 1442 | else |
| 1443 | { |
| 1444 | bLowPwrDisable = true; |
| 1445 | pBtCoexist->btc_set(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable); |
| 1446 | } |
| 1447 | |
| 1448 | pBtCoexist->btc_get(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected); |
| 1449 | |
| 1450 | if(halbtc8723a2ant_IsWifiIdle(pBtCoexist) && |
| 1451 | BT_8723A_2ANT_BT_STATUS_IDLE == pCoexDm->btStatus) |
| 1452 | { |
| 1453 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi idle + Bt idle!!\n")); |
| 1454 | |
| 1455 | halbtc8723a2ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, FALSE); |
| 1456 | halbtc8723a2ant_RfShrink(pBtCoexist, NORMAL_EXEC, FALSE); |
| 1457 | halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3); |
| 1458 | |
| 1459 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0); |
| 1460 | halbtc8723a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 0x20); |
| 1461 | halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE); |
| 1462 | |
| 1463 | halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE); |
| 1464 | halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE); |
| 1465 | halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0); |
| 1466 | |
| 1467 | bCommon = true; |
| 1468 | } |
| 1469 | else if(!halbtc8723a2ant_IsWifiIdle(pBtCoexist) && |
| 1470 | (BT_8723A_2ANT_BT_STATUS_IDLE == pCoexDm->btStatus) ) |
| 1471 | { |
| 1472 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi non-idle + BT idle!!\n")); |
| 1473 | |
| 1474 | halbtc8723a2ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, true); |
| 1475 | halbtc8723a2ant_RfShrink(pBtCoexist, NORMAL_EXEC, FALSE); |
| 1476 | halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3); |
| 1477 | |
| 1478 | halbtc8723a2ant_IgnoreWlanAct(pBtCoexist, NORMAL_EXEC, FALSE); |
| 1479 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0); |
| 1480 | halbtc8723a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 0x20); |
| 1481 | halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, true); |
| 1482 | |
| 1483 | halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE); |
| 1484 | halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE); |
| 1485 | halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0); |
| 1486 | |
| 1487 | bCommon = true; |
| 1488 | } |
| 1489 | else if(halbtc8723a2ant_IsWifiIdle(pBtCoexist) && |
| 1490 | (BT_8723A_2ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus) ) |
| 1491 | { |
| 1492 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi idle + Bt connected idle!!\n")); |
| 1493 | |
| 1494 | halbtc8723a2ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, true); |
| 1495 | halbtc8723a2ant_RfShrink(pBtCoexist, NORMAL_EXEC, true); |
| 1496 | halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3); |
| 1497 | |
| 1498 | halbtc8723a2ant_IgnoreWlanAct(pBtCoexist, NORMAL_EXEC, FALSE); |
| 1499 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0); |
| 1500 | halbtc8723a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 0x20); |
| 1501 | halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE); |
| 1502 | |
| 1503 | halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE); |
| 1504 | halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE); |
| 1505 | halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0); |
| 1506 | |
| 1507 | bCommon = true; |
| 1508 | } |
| 1509 | else if(!halbtc8723a2ant_IsWifiIdle(pBtCoexist) && |
| 1510 | (BT_8723A_2ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus) ) |
| 1511 | { |
| 1512 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi non-idle + Bt connected idle!!\n")); |
| 1513 | |
| 1514 | halbtc8723a2ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, true); |
| 1515 | halbtc8723a2ant_RfShrink(pBtCoexist, NORMAL_EXEC, true); |
| 1516 | halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3); |
| 1517 | |
| 1518 | halbtc8723a2ant_IgnoreWlanAct(pBtCoexist, NORMAL_EXEC, FALSE); |
| 1519 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0); |
| 1520 | halbtc8723a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 0x20); |
| 1521 | halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE); |
| 1522 | |
| 1523 | halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE); |
| 1524 | halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE); |
| 1525 | halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0); |
| 1526 | |
| 1527 | bCommon = true; |
| 1528 | } |
| 1529 | else if(halbtc8723a2ant_IsWifiIdle(pBtCoexist) && |
| 1530 | (BT_8723A_2ANT_BT_STATUS_NON_IDLE == pCoexDm->btStatus) ) |
| 1531 | { |
| 1532 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi idle + BT non-idle!!\n")); |
| 1533 | |
| 1534 | halbtc8723a2ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, true); |
| 1535 | halbtc8723a2ant_RfShrink(pBtCoexist, NORMAL_EXEC, true); |
| 1536 | halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3); |
| 1537 | |
| 1538 | halbtc8723a2ant_IgnoreWlanAct(pBtCoexist, NORMAL_EXEC, FALSE); |
| 1539 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0); |
| 1540 | halbtc8723a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 0x20); |
| 1541 | halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE); |
| 1542 | |
| 1543 | halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE); |
| 1544 | halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE); |
| 1545 | halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0); |
| 1546 | |
| 1547 | bCommon = true; |
| 1548 | } |
| 1549 | else |
| 1550 | { |
| 1551 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi non-idle + BT non-idle!!\n")); |
| 1552 | halbtc8723a2ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, true); |
| 1553 | halbtc8723a2ant_RfShrink(pBtCoexist, NORMAL_EXEC, true); |
| 1554 | halbtc8723a2ant_IgnoreWlanAct(pBtCoexist, NORMAL_EXEC, FALSE); |
| 1555 | halbtc8723a2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 0x20); |
| 1556 | |
| 1557 | bCommon = FALSE; |
| 1558 | } |
| 1559 | |
| 1560 | return bCommon; |
| 1561 | } |
| 1562 | VOID |
| 1563 | halbtc8723a2ant_TdmaDurationAdjust( |
| 1564 | IN PBTC_COEXIST pBtCoexist, |
| 1565 | IN BOOLEAN bScoHid, |
| 1566 | IN BOOLEAN bTxPause, |
| 1567 | IN u1Byte maxInterval |
| 1568 | ) |
| 1569 | { |
| 1570 | static s4Byte up,dn,m,n,WaitCount; |
| 1571 | s4Byte result; //0: no change, +1: increase WiFi duration, -1: decrease WiFi duration |
| 1572 | u1Byte retryCount=0; |
| 1573 | |
| 1574 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], TdmaDurationAdjust()\n")); |
| 1575 | |
| 1576 | if(pCoexDm->bResetTdmaAdjust) |
| 1577 | { |
| 1578 | pCoexDm->bResetTdmaAdjust = FALSE; |
| 1579 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], first run TdmaDurationAdjust()!!\n")); |
| 1580 | { |
| 1581 | if(bScoHid) |
| 1582 | { |
| 1583 | if(bTxPause) |
| 1584 | { |
| 1585 | if(maxInterval == 1) |
| 1586 | { |
| 1587 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 13); |
| 1588 | pCoexDm->psTdmaDuAdjType = 13; |
| 1589 | } |
| 1590 | else if(maxInterval == 2) |
| 1591 | { |
| 1592 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 14); |
| 1593 | pCoexDm->psTdmaDuAdjType = 14; |
| 1594 | } |
| 1595 | else if(maxInterval == 3) |
| 1596 | { |
| 1597 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 15); |
| 1598 | pCoexDm->psTdmaDuAdjType = 15; |
| 1599 | } |
| 1600 | else |
| 1601 | { |
| 1602 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 15); |
| 1603 | pCoexDm->psTdmaDuAdjType = 15; |
| 1604 | } |
| 1605 | } |
| 1606 | else |
| 1607 | { |
| 1608 | if(maxInterval == 1) |
| 1609 | { |
| 1610 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 9); |
| 1611 | pCoexDm->psTdmaDuAdjType = 9; |
| 1612 | } |
| 1613 | else if(maxInterval == 2) |
| 1614 | { |
| 1615 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 10); |
| 1616 | pCoexDm->psTdmaDuAdjType = 10; |
| 1617 | } |
| 1618 | else if(maxInterval == 3) |
| 1619 | { |
| 1620 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 11); |
| 1621 | pCoexDm->psTdmaDuAdjType = 11; |
| 1622 | } |
| 1623 | else |
| 1624 | { |
| 1625 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 11); |
| 1626 | pCoexDm->psTdmaDuAdjType = 11; |
| 1627 | } |
| 1628 | } |
| 1629 | } |
| 1630 | else |
| 1631 | { |
| 1632 | if(bTxPause) |
| 1633 | { |
| 1634 | if(maxInterval == 1) |
| 1635 | { |
| 1636 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 5); |
| 1637 | pCoexDm->psTdmaDuAdjType = 5; |
| 1638 | } |
| 1639 | else if(maxInterval == 2) |
| 1640 | { |
| 1641 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 6); |
| 1642 | pCoexDm->psTdmaDuAdjType = 6; |
| 1643 | } |
| 1644 | else if(maxInterval == 3) |
| 1645 | { |
| 1646 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 7); |
| 1647 | pCoexDm->psTdmaDuAdjType = 7; |
| 1648 | } |
| 1649 | else |
| 1650 | { |
| 1651 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 7); |
| 1652 | pCoexDm->psTdmaDuAdjType = 7; |
| 1653 | } |
| 1654 | } |
| 1655 | else |
| 1656 | { |
| 1657 | if(maxInterval == 1) |
| 1658 | { |
| 1659 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 1); |
| 1660 | pCoexDm->psTdmaDuAdjType = 1; |
| 1661 | } |
| 1662 | else if(maxInterval == 2) |
| 1663 | { |
| 1664 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 2); |
| 1665 | pCoexDm->psTdmaDuAdjType = 2; |
| 1666 | } |
| 1667 | else if(maxInterval == 3) |
| 1668 | { |
| 1669 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 3); |
| 1670 | pCoexDm->psTdmaDuAdjType = 3; |
| 1671 | } |
| 1672 | else |
| 1673 | { |
| 1674 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 3); |
| 1675 | pCoexDm->psTdmaDuAdjType = 3; |
| 1676 | } |
| 1677 | } |
| 1678 | } |
| 1679 | } |
| 1680 | //============ |
| 1681 | up = 0; |
| 1682 | dn = 0; |
| 1683 | m = 1; |
| 1684 | n= 3; |
| 1685 | result = 0; |
| 1686 | WaitCount = 0; |
| 1687 | } |
| 1688 | else |
| 1689 | { |
Masanari Iida | fc4d82c | 2014-02-25 23:54:41 +0900 | [diff] [blame] | 1690 | //acquire the BT TRx retry count from BT_Info byte2 |
Greg Kroah-Hartman | 3c05bed | 2014-01-21 11:20:45 -0800 | [diff] [blame] | 1691 | retryCount = pCoexSta->btRetryCnt; |
| 1692 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], retryCount = %d\n", retryCount)); |
| 1693 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], up=%d, dn=%d, m=%d, n=%d, WaitCount=%d\n", |
| 1694 | up, dn, m, n, WaitCount)); |
| 1695 | result = 0; |
| 1696 | WaitCount++; |
| 1697 | |
| 1698 | if(retryCount == 0) // no retry in the last 2-second duration |
| 1699 | { |
| 1700 | up++; |
| 1701 | dn--; |
| 1702 | |
| 1703 | if (dn <= 0) |
| 1704 | dn = 0; |
| 1705 | |
| 1706 | if(up >= n) // if ³sÄò n Ó2¬í retry count¬°0, «h½Õ¼eWiFi duration |
| 1707 | { |
| 1708 | WaitCount = 0; |
| 1709 | n = 3; |
| 1710 | up = 0; |
| 1711 | dn = 0; |
| 1712 | result = 1; |
| 1713 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], Increase wifi duration!!\n")); |
| 1714 | } |
| 1715 | } |
| 1716 | else if (retryCount <= 3) // <=3 retry in the last 2-second duration |
| 1717 | { |
| 1718 | up--; |
| 1719 | dn++; |
| 1720 | |
| 1721 | if (up <= 0) |
| 1722 | up = 0; |
| 1723 | |
| 1724 | if (dn == 2) // if ³sÄò 2 Ó2¬í retry count< 3, «h½Õ¯¶WiFi duration |
| 1725 | { |
| 1726 | if (WaitCount <= 2) |
| 1727 | m++; // ÁקK¤@ª½¦b¨âÓlevel¤¤¨Ó¦^ |
| 1728 | else |
| 1729 | m = 1; |
| 1730 | |
| 1731 | if ( m >= 20) //m ³Ì¤jÈ = 20 ' ³Ì¤j120¬í recheck¬O§_½Õ¾ã WiFi duration. |
| 1732 | m = 20; |
| 1733 | |
| 1734 | n = 3*m; |
| 1735 | up = 0; |
| 1736 | dn = 0; |
| 1737 | WaitCount = 0; |
| 1738 | result = -1; |
| 1739 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], Decrease wifi duration for retryCounter<3!!\n")); |
| 1740 | } |
| 1741 | } |
| 1742 | else //retry count > 3, ¥un1¦¸ retry count > 3, «h½Õ¯¶WiFi duration |
| 1743 | { |
| 1744 | if (WaitCount == 1) |
| 1745 | m++; // ÁקK¤@ª½¦b¨âÓlevel¤¤¨Ó¦^ |
| 1746 | else |
| 1747 | m = 1; |
| 1748 | |
| 1749 | if ( m >= 20) //m ³Ì¤jÈ = 20 ' ³Ì¤j120¬í recheck¬O§_½Õ¾ã WiFi duration. |
| 1750 | m = 20; |
| 1751 | |
| 1752 | n = 3*m; |
| 1753 | up = 0; |
| 1754 | dn = 0; |
| 1755 | WaitCount = 0; |
| 1756 | result = -1; |
| 1757 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], Decrease wifi duration for retryCounter>3!!\n")); |
| 1758 | } |
| 1759 | |
| 1760 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], max Interval = %d\n", maxInterval)); |
| 1761 | if(maxInterval == 1) |
| 1762 | { |
| 1763 | if(bTxPause) |
| 1764 | { |
| 1765 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], TxPause = 1\n")); |
| 1766 | |
| 1767 | if(pCoexDm->curPsTdma == 1) |
| 1768 | { |
| 1769 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 5); |
| 1770 | pCoexDm->psTdmaDuAdjType = 5; |
| 1771 | } |
| 1772 | else if(pCoexDm->curPsTdma == 2) |
| 1773 | { |
| 1774 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 6); |
| 1775 | pCoexDm->psTdmaDuAdjType = 6; |
| 1776 | } |
| 1777 | else if(pCoexDm->curPsTdma == 3) |
| 1778 | { |
| 1779 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 7); |
| 1780 | pCoexDm->psTdmaDuAdjType = 7; |
| 1781 | } |
| 1782 | else if(pCoexDm->curPsTdma == 4) |
| 1783 | { |
| 1784 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 8); |
| 1785 | pCoexDm->psTdmaDuAdjType = 8; |
| 1786 | } |
| 1787 | if(pCoexDm->curPsTdma == 9) |
| 1788 | { |
| 1789 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 13); |
| 1790 | pCoexDm->psTdmaDuAdjType = 13; |
| 1791 | } |
| 1792 | else if(pCoexDm->curPsTdma == 10) |
| 1793 | { |
| 1794 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 14); |
| 1795 | pCoexDm->psTdmaDuAdjType = 14; |
| 1796 | } |
| 1797 | else if(pCoexDm->curPsTdma == 11) |
| 1798 | { |
| 1799 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 15); |
| 1800 | pCoexDm->psTdmaDuAdjType = 15; |
| 1801 | } |
| 1802 | else if(pCoexDm->curPsTdma == 12) |
| 1803 | { |
| 1804 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 16); |
| 1805 | pCoexDm->psTdmaDuAdjType = 16; |
| 1806 | } |
| 1807 | |
| 1808 | if(result == -1) |
| 1809 | { |
| 1810 | if(pCoexDm->curPsTdma == 5) |
| 1811 | { |
| 1812 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 6); |
| 1813 | pCoexDm->psTdmaDuAdjType = 6; |
| 1814 | } |
| 1815 | else if(pCoexDm->curPsTdma == 6) |
| 1816 | { |
| 1817 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 7); |
| 1818 | pCoexDm->psTdmaDuAdjType = 7; |
| 1819 | } |
| 1820 | else if(pCoexDm->curPsTdma == 7) |
| 1821 | { |
| 1822 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 8); |
| 1823 | pCoexDm->psTdmaDuAdjType = 8; |
| 1824 | } |
| 1825 | else if(pCoexDm->curPsTdma == 13) |
| 1826 | { |
| 1827 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 14); |
| 1828 | pCoexDm->psTdmaDuAdjType = 14; |
| 1829 | } |
| 1830 | else if(pCoexDm->curPsTdma == 14) |
| 1831 | { |
| 1832 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 15); |
| 1833 | pCoexDm->psTdmaDuAdjType = 15; |
| 1834 | } |
| 1835 | else if(pCoexDm->curPsTdma == 15) |
| 1836 | { |
| 1837 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 16); |
| 1838 | pCoexDm->psTdmaDuAdjType = 16; |
| 1839 | } |
| 1840 | } |
| 1841 | else if (result == 1) |
| 1842 | { |
| 1843 | if(pCoexDm->curPsTdma == 8) |
| 1844 | { |
| 1845 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 7); |
| 1846 | pCoexDm->psTdmaDuAdjType = 7; |
| 1847 | } |
| 1848 | else if(pCoexDm->curPsTdma == 7) |
| 1849 | { |
| 1850 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 6); |
| 1851 | pCoexDm->psTdmaDuAdjType = 6; |
| 1852 | } |
| 1853 | else if(pCoexDm->curPsTdma == 6) |
| 1854 | { |
| 1855 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 5); |
| 1856 | pCoexDm->psTdmaDuAdjType = 5; |
| 1857 | } |
| 1858 | else if(pCoexDm->curPsTdma == 16) |
| 1859 | { |
| 1860 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 15); |
| 1861 | pCoexDm->psTdmaDuAdjType = 15; |
| 1862 | } |
| 1863 | else if(pCoexDm->curPsTdma == 15) |
| 1864 | { |
| 1865 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 14); |
| 1866 | pCoexDm->psTdmaDuAdjType = 14; |
| 1867 | } |
| 1868 | else if(pCoexDm->curPsTdma == 14) |
| 1869 | { |
| 1870 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 13); |
| 1871 | pCoexDm->psTdmaDuAdjType = 13; |
| 1872 | } |
| 1873 | } |
| 1874 | } |
| 1875 | else |
| 1876 | { |
| 1877 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], TxPause = 0\n")); |
| 1878 | if(pCoexDm->curPsTdma == 5) |
| 1879 | { |
| 1880 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 1); |
| 1881 | pCoexDm->psTdmaDuAdjType = 1; |
| 1882 | } |
| 1883 | else if(pCoexDm->curPsTdma == 6) |
| 1884 | { |
| 1885 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 2); |
| 1886 | pCoexDm->psTdmaDuAdjType = 2; |
| 1887 | } |
| 1888 | else if(pCoexDm->curPsTdma == 7) |
| 1889 | { |
| 1890 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 3); |
| 1891 | pCoexDm->psTdmaDuAdjType = 3; |
| 1892 | } |
| 1893 | else if(pCoexDm->curPsTdma == 8) |
| 1894 | { |
| 1895 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 4); |
| 1896 | pCoexDm->psTdmaDuAdjType = 4; |
| 1897 | } |
| 1898 | if(pCoexDm->curPsTdma == 13) |
| 1899 | { |
| 1900 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 9); |
| 1901 | pCoexDm->psTdmaDuAdjType = 9; |
| 1902 | } |
| 1903 | else if(pCoexDm->curPsTdma == 14) |
| 1904 | { |
| 1905 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 10); |
| 1906 | pCoexDm->psTdmaDuAdjType = 10; |
| 1907 | } |
| 1908 | else if(pCoexDm->curPsTdma == 15) |
| 1909 | { |
| 1910 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 11); |
| 1911 | pCoexDm->psTdmaDuAdjType = 11; |
| 1912 | } |
| 1913 | else if(pCoexDm->curPsTdma == 16) |
| 1914 | { |
| 1915 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 12); |
| 1916 | pCoexDm->psTdmaDuAdjType = 12; |
| 1917 | } |
| 1918 | |
| 1919 | if(result == -1) |
| 1920 | { |
| 1921 | if(pCoexDm->curPsTdma == 1) |
| 1922 | { |
| 1923 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 2); |
| 1924 | pCoexDm->psTdmaDuAdjType = 2; |
| 1925 | } |
| 1926 | else if(pCoexDm->curPsTdma == 2) |
| 1927 | { |
| 1928 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 3); |
| 1929 | pCoexDm->psTdmaDuAdjType = 3; |
| 1930 | } |
| 1931 | else if(pCoexDm->curPsTdma == 3) |
| 1932 | { |
| 1933 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 4); |
| 1934 | pCoexDm->psTdmaDuAdjType = 4; |
| 1935 | } |
| 1936 | else if(pCoexDm->curPsTdma == 9) |
| 1937 | { |
| 1938 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 10); |
| 1939 | pCoexDm->psTdmaDuAdjType = 10; |
| 1940 | } |
| 1941 | else if(pCoexDm->curPsTdma == 10) |
| 1942 | { |
| 1943 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 11); |
| 1944 | pCoexDm->psTdmaDuAdjType = 11; |
| 1945 | } |
| 1946 | else if(pCoexDm->curPsTdma == 11) |
| 1947 | { |
| 1948 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 12); |
| 1949 | pCoexDm->psTdmaDuAdjType = 12; |
| 1950 | } |
| 1951 | } |
| 1952 | else if (result == 1) |
| 1953 | { |
| 1954 | if(pCoexDm->curPsTdma == 4) |
| 1955 | { |
| 1956 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 3); |
| 1957 | pCoexDm->psTdmaDuAdjType = 3; |
| 1958 | } |
| 1959 | else if(pCoexDm->curPsTdma == 3) |
| 1960 | { |
| 1961 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 2); |
| 1962 | pCoexDm->psTdmaDuAdjType = 2; |
| 1963 | } |
| 1964 | else if(pCoexDm->curPsTdma == 2) |
| 1965 | { |
| 1966 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 1); |
| 1967 | pCoexDm->psTdmaDuAdjType = 1; |
| 1968 | } |
| 1969 | else if(pCoexDm->curPsTdma == 12) |
| 1970 | { |
| 1971 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 11); |
| 1972 | pCoexDm->psTdmaDuAdjType = 11; |
| 1973 | } |
| 1974 | else if(pCoexDm->curPsTdma == 11) |
| 1975 | { |
| 1976 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 10); |
| 1977 | pCoexDm->psTdmaDuAdjType = 10; |
| 1978 | } |
| 1979 | else if(pCoexDm->curPsTdma == 10) |
| 1980 | { |
| 1981 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 9); |
| 1982 | pCoexDm->psTdmaDuAdjType = 9; |
| 1983 | } |
| 1984 | } |
| 1985 | } |
| 1986 | } |
| 1987 | else if(maxInterval == 2) |
| 1988 | { |
| 1989 | if(bTxPause) |
| 1990 | { |
| 1991 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], TxPause = 1\n")); |
| 1992 | if(pCoexDm->curPsTdma == 1) |
| 1993 | { |
| 1994 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 6); |
| 1995 | pCoexDm->psTdmaDuAdjType = 6; |
| 1996 | } |
| 1997 | else if(pCoexDm->curPsTdma == 2) |
| 1998 | { |
| 1999 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 6); |
| 2000 | pCoexDm->psTdmaDuAdjType = 6; |
| 2001 | } |
| 2002 | else if(pCoexDm->curPsTdma == 3) |
| 2003 | { |
| 2004 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 7); |
| 2005 | pCoexDm->psTdmaDuAdjType = 7; |
| 2006 | } |
| 2007 | else if(pCoexDm->curPsTdma == 4) |
| 2008 | { |
| 2009 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 8); |
| 2010 | pCoexDm->psTdmaDuAdjType = 8; |
| 2011 | } |
| 2012 | if(pCoexDm->curPsTdma == 9) |
| 2013 | { |
| 2014 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 14); |
| 2015 | pCoexDm->psTdmaDuAdjType = 14; |
| 2016 | } |
| 2017 | else if(pCoexDm->curPsTdma == 10) |
| 2018 | { |
| 2019 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 14); |
| 2020 | pCoexDm->psTdmaDuAdjType = 14; |
| 2021 | } |
| 2022 | else if(pCoexDm->curPsTdma == 11) |
| 2023 | { |
| 2024 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 15); |
| 2025 | pCoexDm->psTdmaDuAdjType = 15; |
| 2026 | } |
| 2027 | else if(pCoexDm->curPsTdma == 12) |
| 2028 | { |
| 2029 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 16); |
| 2030 | pCoexDm->psTdmaDuAdjType = 16; |
| 2031 | } |
| 2032 | if(result == -1) |
| 2033 | { |
| 2034 | if(pCoexDm->curPsTdma == 5) |
| 2035 | { |
| 2036 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 6); |
| 2037 | pCoexDm->psTdmaDuAdjType = 6; |
| 2038 | } |
| 2039 | else if(pCoexDm->curPsTdma == 6) |
| 2040 | { |
| 2041 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 7); |
| 2042 | pCoexDm->psTdmaDuAdjType = 7; |
| 2043 | } |
| 2044 | else if(pCoexDm->curPsTdma == 7) |
| 2045 | { |
| 2046 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 8); |
| 2047 | pCoexDm->psTdmaDuAdjType = 8; |
| 2048 | } |
| 2049 | else if(pCoexDm->curPsTdma == 13) |
| 2050 | { |
| 2051 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 14); |
| 2052 | pCoexDm->psTdmaDuAdjType = 14; |
| 2053 | } |
| 2054 | else if(pCoexDm->curPsTdma == 14) |
| 2055 | { |
| 2056 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 15); |
| 2057 | pCoexDm->psTdmaDuAdjType = 15; |
| 2058 | } |
| 2059 | else if(pCoexDm->curPsTdma == 15) |
| 2060 | { |
| 2061 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 16); |
| 2062 | pCoexDm->psTdmaDuAdjType = 16; |
| 2063 | } |
| 2064 | } |
| 2065 | else if (result == 1) |
| 2066 | { |
| 2067 | if(pCoexDm->curPsTdma == 8) |
| 2068 | { |
| 2069 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 7); |
| 2070 | pCoexDm->psTdmaDuAdjType = 7; |
| 2071 | } |
| 2072 | else if(pCoexDm->curPsTdma == 7) |
| 2073 | { |
| 2074 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 6); |
| 2075 | pCoexDm->psTdmaDuAdjType = 6; |
| 2076 | } |
| 2077 | else if(pCoexDm->curPsTdma == 6) |
| 2078 | { |
| 2079 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 6); |
| 2080 | pCoexDm->psTdmaDuAdjType = 6; |
| 2081 | } |
| 2082 | else if(pCoexDm->curPsTdma == 16) |
| 2083 | { |
| 2084 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 15); |
| 2085 | pCoexDm->psTdmaDuAdjType = 15; |
| 2086 | } |
| 2087 | else if(pCoexDm->curPsTdma == 15) |
| 2088 | { |
| 2089 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 14); |
| 2090 | pCoexDm->psTdmaDuAdjType = 14; |
| 2091 | } |
| 2092 | else if(pCoexDm->curPsTdma == 14) |
| 2093 | { |
| 2094 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 14); |
| 2095 | pCoexDm->psTdmaDuAdjType = 14; |
| 2096 | } |
| 2097 | } |
| 2098 | } |
| 2099 | else |
| 2100 | { |
| 2101 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], TxPause = 0\n")); |
| 2102 | if(pCoexDm->curPsTdma == 5) |
| 2103 | { |
| 2104 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 2); |
| 2105 | pCoexDm->psTdmaDuAdjType = 2; |
| 2106 | } |
| 2107 | else if(pCoexDm->curPsTdma == 6) |
| 2108 | { |
| 2109 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 2); |
| 2110 | pCoexDm->psTdmaDuAdjType = 2; |
| 2111 | } |
| 2112 | else if(pCoexDm->curPsTdma == 7) |
| 2113 | { |
| 2114 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 3); |
| 2115 | pCoexDm->psTdmaDuAdjType = 3; |
| 2116 | } |
| 2117 | else if(pCoexDm->curPsTdma == 8) |
| 2118 | { |
| 2119 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 4); |
| 2120 | pCoexDm->psTdmaDuAdjType = 4; |
| 2121 | } |
| 2122 | if(pCoexDm->curPsTdma == 13) |
| 2123 | { |
| 2124 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 10); |
| 2125 | pCoexDm->psTdmaDuAdjType = 10; |
| 2126 | } |
| 2127 | else if(pCoexDm->curPsTdma == 14) |
| 2128 | { |
| 2129 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 10); |
| 2130 | pCoexDm->psTdmaDuAdjType = 10; |
| 2131 | } |
| 2132 | else if(pCoexDm->curPsTdma == 15) |
| 2133 | { |
| 2134 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 11); |
| 2135 | pCoexDm->psTdmaDuAdjType = 11; |
| 2136 | } |
| 2137 | else if(pCoexDm->curPsTdma == 16) |
| 2138 | { |
| 2139 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 12); |
| 2140 | pCoexDm->psTdmaDuAdjType = 12; |
| 2141 | } |
| 2142 | if(result == -1) |
| 2143 | { |
| 2144 | if(pCoexDm->curPsTdma == 1) |
| 2145 | { |
| 2146 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 2); |
| 2147 | pCoexDm->psTdmaDuAdjType = 2; |
| 2148 | } |
| 2149 | else if(pCoexDm->curPsTdma == 2) |
| 2150 | { |
| 2151 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 3); |
| 2152 | pCoexDm->psTdmaDuAdjType = 3; |
| 2153 | } |
| 2154 | else if(pCoexDm->curPsTdma == 3) |
| 2155 | { |
| 2156 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 4); |
| 2157 | pCoexDm->psTdmaDuAdjType = 4; |
| 2158 | } |
| 2159 | else if(pCoexDm->curPsTdma == 9) |
| 2160 | { |
| 2161 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 10); |
| 2162 | pCoexDm->psTdmaDuAdjType = 10; |
| 2163 | } |
| 2164 | else if(pCoexDm->curPsTdma == 10) |
| 2165 | { |
| 2166 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 11); |
| 2167 | pCoexDm->psTdmaDuAdjType = 11; |
| 2168 | } |
| 2169 | else if(pCoexDm->curPsTdma == 11) |
| 2170 | { |
| 2171 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 12); |
| 2172 | pCoexDm->psTdmaDuAdjType = 12; |
| 2173 | } |
| 2174 | } |
| 2175 | else if (result == 1) |
| 2176 | { |
| 2177 | if(pCoexDm->curPsTdma == 4) |
| 2178 | { |
| 2179 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 3); |
| 2180 | pCoexDm->psTdmaDuAdjType = 3; |
| 2181 | } |
| 2182 | else if(pCoexDm->curPsTdma == 3) |
| 2183 | { |
| 2184 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 2); |
| 2185 | pCoexDm->psTdmaDuAdjType = 2; |
| 2186 | } |
| 2187 | else if(pCoexDm->curPsTdma == 2) |
| 2188 | { |
| 2189 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 2); |
| 2190 | pCoexDm->psTdmaDuAdjType = 2; |
| 2191 | } |
| 2192 | else if(pCoexDm->curPsTdma == 12) |
| 2193 | { |
| 2194 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 11); |
| 2195 | pCoexDm->psTdmaDuAdjType = 11; |
| 2196 | } |
| 2197 | else if(pCoexDm->curPsTdma == 11) |
| 2198 | { |
| 2199 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 10); |
| 2200 | pCoexDm->psTdmaDuAdjType = 10; |
| 2201 | } |
| 2202 | else if(pCoexDm->curPsTdma == 10) |
| 2203 | { |
| 2204 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 10); |
| 2205 | pCoexDm->psTdmaDuAdjType = 10; |
| 2206 | } |
| 2207 | } |
| 2208 | } |
| 2209 | } |
| 2210 | else if(maxInterval == 3) |
| 2211 | { |
| 2212 | if(bTxPause) |
| 2213 | { |
| 2214 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], TxPause = 1\n")); |
| 2215 | if(pCoexDm->curPsTdma == 1) |
| 2216 | { |
| 2217 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 7); |
| 2218 | pCoexDm->psTdmaDuAdjType = 7; |
| 2219 | } |
| 2220 | else if(pCoexDm->curPsTdma == 2) |
| 2221 | { |
| 2222 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 7); |
| 2223 | pCoexDm->psTdmaDuAdjType = 7; |
| 2224 | } |
| 2225 | else if(pCoexDm->curPsTdma == 3) |
| 2226 | { |
| 2227 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 7); |
| 2228 | pCoexDm->psTdmaDuAdjType = 7; |
| 2229 | } |
| 2230 | else if(pCoexDm->curPsTdma == 4) |
| 2231 | { |
| 2232 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 8); |
| 2233 | pCoexDm->psTdmaDuAdjType = 8; |
| 2234 | } |
| 2235 | if(pCoexDm->curPsTdma == 9) |
| 2236 | { |
| 2237 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 15); |
| 2238 | pCoexDm->psTdmaDuAdjType = 15; |
| 2239 | } |
| 2240 | else if(pCoexDm->curPsTdma == 10) |
| 2241 | { |
| 2242 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 15); |
| 2243 | pCoexDm->psTdmaDuAdjType = 15; |
| 2244 | } |
| 2245 | else if(pCoexDm->curPsTdma == 11) |
| 2246 | { |
| 2247 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 15); |
| 2248 | pCoexDm->psTdmaDuAdjType = 15; |
| 2249 | } |
| 2250 | else if(pCoexDm->curPsTdma == 12) |
| 2251 | { |
| 2252 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 16); |
| 2253 | pCoexDm->psTdmaDuAdjType = 16; |
| 2254 | } |
| 2255 | if(result == -1) |
| 2256 | { |
| 2257 | if(pCoexDm->curPsTdma == 5) |
| 2258 | { |
| 2259 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 7); |
| 2260 | pCoexDm->psTdmaDuAdjType = 7; |
| 2261 | } |
| 2262 | else if(pCoexDm->curPsTdma == 6) |
| 2263 | { |
| 2264 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 7); |
| 2265 | pCoexDm->psTdmaDuAdjType = 7; |
| 2266 | } |
| 2267 | else if(pCoexDm->curPsTdma == 7) |
| 2268 | { |
| 2269 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 8); |
| 2270 | pCoexDm->psTdmaDuAdjType = 8; |
| 2271 | } |
| 2272 | else if(pCoexDm->curPsTdma == 13) |
| 2273 | { |
| 2274 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 15); |
| 2275 | pCoexDm->psTdmaDuAdjType = 15; |
| 2276 | } |
| 2277 | else if(pCoexDm->curPsTdma == 14) |
| 2278 | { |
| 2279 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 15); |
| 2280 | pCoexDm->psTdmaDuAdjType = 15; |
| 2281 | } |
| 2282 | else if(pCoexDm->curPsTdma == 15) |
| 2283 | { |
| 2284 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 16); |
| 2285 | pCoexDm->psTdmaDuAdjType = 16; |
| 2286 | } |
| 2287 | } |
| 2288 | else if (result == 1) |
| 2289 | { |
| 2290 | if(pCoexDm->curPsTdma == 8) |
| 2291 | { |
| 2292 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 7); |
| 2293 | pCoexDm->psTdmaDuAdjType = 7; |
| 2294 | } |
| 2295 | else if(pCoexDm->curPsTdma == 7) |
| 2296 | { |
| 2297 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 7); |
| 2298 | pCoexDm->psTdmaDuAdjType = 7; |
| 2299 | } |
| 2300 | else if(pCoexDm->curPsTdma == 6) |
| 2301 | { |
| 2302 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 7); |
| 2303 | pCoexDm->psTdmaDuAdjType = 7; |
| 2304 | } |
| 2305 | else if(pCoexDm->curPsTdma == 16) |
| 2306 | { |
| 2307 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 15); |
| 2308 | pCoexDm->psTdmaDuAdjType = 15; |
| 2309 | } |
| 2310 | else if(pCoexDm->curPsTdma == 15) |
| 2311 | { |
| 2312 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 15); |
| 2313 | pCoexDm->psTdmaDuAdjType = 15; |
| 2314 | } |
| 2315 | else if(pCoexDm->curPsTdma == 14) |
| 2316 | { |
| 2317 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 15); |
| 2318 | pCoexDm->psTdmaDuAdjType = 15; |
| 2319 | } |
| 2320 | } |
| 2321 | } |
| 2322 | else |
| 2323 | { |
| 2324 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], TxPause = 0\n")); |
| 2325 | if(pCoexDm->curPsTdma == 5) |
| 2326 | { |
| 2327 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 3); |
| 2328 | pCoexDm->psTdmaDuAdjType = 3; |
| 2329 | } |
| 2330 | else if(pCoexDm->curPsTdma == 6) |
| 2331 | { |
| 2332 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 3); |
| 2333 | pCoexDm->psTdmaDuAdjType = 3; |
| 2334 | } |
| 2335 | else if(pCoexDm->curPsTdma == 7) |
| 2336 | { |
| 2337 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 3); |
| 2338 | pCoexDm->psTdmaDuAdjType = 3; |
| 2339 | } |
| 2340 | else if(pCoexDm->curPsTdma == 8) |
| 2341 | { |
| 2342 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 4); |
| 2343 | pCoexDm->psTdmaDuAdjType = 4; |
| 2344 | } |
| 2345 | if(pCoexDm->curPsTdma == 13) |
| 2346 | { |
| 2347 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 11); |
| 2348 | pCoexDm->psTdmaDuAdjType = 11; |
| 2349 | } |
| 2350 | else if(pCoexDm->curPsTdma == 14) |
| 2351 | { |
| 2352 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 11); |
| 2353 | pCoexDm->psTdmaDuAdjType = 11; |
| 2354 | } |
| 2355 | else if(pCoexDm->curPsTdma == 15) |
| 2356 | { |
| 2357 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 11); |
| 2358 | pCoexDm->psTdmaDuAdjType = 11; |
| 2359 | } |
| 2360 | else if(pCoexDm->curPsTdma == 16) |
| 2361 | { |
| 2362 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 12); |
| 2363 | pCoexDm->psTdmaDuAdjType = 12; |
| 2364 | } |
| 2365 | if(result == -1) |
| 2366 | { |
| 2367 | if(pCoexDm->curPsTdma == 1) |
| 2368 | { |
| 2369 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 3); |
| 2370 | pCoexDm->psTdmaDuAdjType = 3; |
| 2371 | } |
| 2372 | else if(pCoexDm->curPsTdma == 2) |
| 2373 | { |
| 2374 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 3); |
| 2375 | pCoexDm->psTdmaDuAdjType = 3; |
| 2376 | } |
| 2377 | else if(pCoexDm->curPsTdma == 3) |
| 2378 | { |
| 2379 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 4); |
| 2380 | pCoexDm->psTdmaDuAdjType = 4; |
| 2381 | } |
| 2382 | else if(pCoexDm->curPsTdma == 9) |
| 2383 | { |
| 2384 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 11); |
| 2385 | pCoexDm->psTdmaDuAdjType = 11; |
| 2386 | } |
| 2387 | else if(pCoexDm->curPsTdma == 10) |
| 2388 | { |
| 2389 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 11); |
| 2390 | pCoexDm->psTdmaDuAdjType = 11; |
| 2391 | } |
| 2392 | else if(pCoexDm->curPsTdma == 11) |
| 2393 | { |
| 2394 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 12); |
| 2395 | pCoexDm->psTdmaDuAdjType = 12; |
| 2396 | } |
| 2397 | } |
| 2398 | else if (result == 1) |
| 2399 | { |
| 2400 | if(pCoexDm->curPsTdma == 4) |
| 2401 | { |
| 2402 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 3); |
| 2403 | pCoexDm->psTdmaDuAdjType = 3; |
| 2404 | } |
| 2405 | else if(pCoexDm->curPsTdma == 3) |
| 2406 | { |
| 2407 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 3); |
| 2408 | pCoexDm->psTdmaDuAdjType = 3; |
| 2409 | } |
| 2410 | else if(pCoexDm->curPsTdma == 2) |
| 2411 | { |
| 2412 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 3); |
| 2413 | pCoexDm->psTdmaDuAdjType = 3; |
| 2414 | } |
| 2415 | else if(pCoexDm->curPsTdma == 12) |
| 2416 | { |
| 2417 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 11); |
| 2418 | pCoexDm->psTdmaDuAdjType = 11; |
| 2419 | } |
| 2420 | else if(pCoexDm->curPsTdma == 11) |
| 2421 | { |
| 2422 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 11); |
| 2423 | pCoexDm->psTdmaDuAdjType = 11; |
| 2424 | } |
| 2425 | else if(pCoexDm->curPsTdma == 10) |
| 2426 | { |
| 2427 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 11); |
| 2428 | pCoexDm->psTdmaDuAdjType = 11; |
| 2429 | } |
| 2430 | } |
| 2431 | } |
| 2432 | } |
| 2433 | } |
| 2434 | |
| 2435 | // if current PsTdma not match with the recorded one (when scan, dhcp...), |
| 2436 | // then we have to adjust it back to the previous record one. |
| 2437 | if(pCoexDm->curPsTdma != pCoexDm->psTdmaDuAdjType) |
| 2438 | { |
| 2439 | BOOLEAN bScan=FALSE, bLink=FALSE, bRoam=FALSE; |
| 2440 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], PsTdma type dismatch!!!, curPsTdma=%d, recordPsTdma=%d\n", |
| 2441 | pCoexDm->curPsTdma, pCoexDm->psTdmaDuAdjType)); |
| 2442 | |
| 2443 | pBtCoexist->btc_get(pBtCoexist, BTC_GET_BL_WIFI_SCAN, &bScan); |
| 2444 | pBtCoexist->btc_get(pBtCoexist, BTC_GET_BL_WIFI_LINK, &bLink); |
| 2445 | pBtCoexist->btc_get(pBtCoexist, BTC_GET_BL_WIFI_ROAM, &bRoam); |
| 2446 | |
| 2447 | if( !bScan && !bLink && !bRoam) |
| 2448 | { |
| 2449 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, pCoexDm->psTdmaDuAdjType); |
| 2450 | } |
| 2451 | else |
| 2452 | { |
| 2453 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], roaming/link/scan is under progress, will adjust next time!!!\n")); |
| 2454 | } |
| 2455 | } |
| 2456 | } |
| 2457 | |
| 2458 | // SCO only or SCO+PAN(HS) |
| 2459 | VOID |
| 2460 | halbtc8723a2ant_ActionSco( |
| 2461 | IN PBTC_COEXIST pBtCoexist |
| 2462 | ) |
| 2463 | { |
| 2464 | u1Byte wifiRssiState, wifiRssiState1; |
| 2465 | u4Byte wifiBw; |
| 2466 | |
| 2467 | if(halbtc8723a2ant_NeedToDecBtPwr(pBtCoexist)) |
| 2468 | halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, true); |
| 2469 | else |
| 2470 | halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE); |
| 2471 | halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3); |
| 2472 | |
| 2473 | pBtCoexist->btc_get(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw); |
| 2474 | if(BTC_WIFI_BW_HT40 == wifiBw) |
| 2475 | { |
| 2476 | wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 37, 0); |
| 2477 | // fw mechanism |
| 2478 | if( (wifiRssiState == BTC_RSSI_STATE_HIGH) || |
| 2479 | (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ) |
| 2480 | { |
| 2481 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 11); |
| 2482 | } |
| 2483 | else |
| 2484 | { |
| 2485 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 15); |
| 2486 | } |
| 2487 | |
| 2488 | // sw mechanism |
| 2489 | halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE); |
| 2490 | halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, true); |
| 2491 | halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0); |
| 2492 | } |
| 2493 | else |
| 2494 | { |
| 2495 | wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 27, 0); |
| 2496 | wifiRssiState1 = halbtc8723a2ant_WifiRssiState(pBtCoexist, 1, 2, 47, 0); |
| 2497 | |
| 2498 | // fw mechanism |
| 2499 | if( (wifiRssiState == BTC_RSSI_STATE_HIGH) || |
| 2500 | (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ) |
| 2501 | { |
| 2502 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 11); |
| 2503 | } |
| 2504 | else |
| 2505 | { |
| 2506 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 15); |
| 2507 | } |
| 2508 | |
| 2509 | // sw mechanism |
| 2510 | if( (wifiRssiState1 == BTC_RSSI_STATE_HIGH) || |
| 2511 | (wifiRssiState1 == BTC_RSSI_STATE_STAY_HIGH) ) |
| 2512 | { |
| 2513 | halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, true); |
| 2514 | halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, true); |
| 2515 | halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0); |
| 2516 | } |
| 2517 | else |
| 2518 | { |
| 2519 | halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE); |
| 2520 | halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE); |
| 2521 | halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0); |
| 2522 | } |
| 2523 | } |
| 2524 | } |
| 2525 | |
| 2526 | |
| 2527 | VOID |
| 2528 | halbtc8723a2ant_ActionHid( |
| 2529 | IN PBTC_COEXIST pBtCoexist |
| 2530 | ) |
| 2531 | { |
| 2532 | u1Byte wifiRssiState, wifiRssiState1; |
| 2533 | u4Byte wifiBw; |
| 2534 | |
| 2535 | if(halbtc8723a2ant_NeedToDecBtPwr(pBtCoexist)) |
| 2536 | halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, true); |
| 2537 | else |
| 2538 | halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE); |
| 2539 | halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3); |
| 2540 | |
| 2541 | pBtCoexist->btc_get(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw); |
| 2542 | if(BTC_WIFI_BW_HT40 == wifiBw) |
| 2543 | { |
| 2544 | wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 37, 0); |
| 2545 | // fw mechanism |
| 2546 | if( (wifiRssiState == BTC_RSSI_STATE_HIGH) || |
| 2547 | (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ) |
| 2548 | { |
| 2549 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 9); |
| 2550 | } |
| 2551 | else |
| 2552 | { |
| 2553 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 13); |
| 2554 | } |
| 2555 | |
| 2556 | // sw mechanism |
| 2557 | halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE); |
| 2558 | halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE); |
| 2559 | halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0); |
| 2560 | } |
| 2561 | else |
| 2562 | { |
| 2563 | wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 27, 0); |
| 2564 | wifiRssiState1 = halbtc8723a2ant_WifiRssiState(pBtCoexist, 1, 2, 47, 0); |
| 2565 | |
| 2566 | // fw mechanism |
| 2567 | if( (wifiRssiState == BTC_RSSI_STATE_HIGH) || |
| 2568 | (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ) |
| 2569 | { |
| 2570 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 9); |
| 2571 | } |
| 2572 | else |
| 2573 | { |
| 2574 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 13); |
| 2575 | } |
| 2576 | |
| 2577 | // sw mechanism |
| 2578 | if( (wifiRssiState1 == BTC_RSSI_STATE_HIGH) || |
| 2579 | (wifiRssiState1 == BTC_RSSI_STATE_STAY_HIGH) ) |
| 2580 | { |
| 2581 | halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, true); |
| 2582 | halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, true); |
| 2583 | halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0); |
| 2584 | } |
| 2585 | else |
| 2586 | { |
| 2587 | halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE); |
| 2588 | halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE); |
| 2589 | halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0); |
| 2590 | } |
| 2591 | } |
| 2592 | } |
| 2593 | |
| 2594 | //A2DP only / PAN(EDR) only/ A2DP+PAN(HS) |
| 2595 | VOID |
| 2596 | halbtc8723a2ant_ActionA2dp( |
| 2597 | IN PBTC_COEXIST pBtCoexist |
| 2598 | ) |
| 2599 | { |
| 2600 | u1Byte wifiRssiState, wifiRssiState1, btInfoExt; |
| 2601 | u4Byte wifiBw; |
| 2602 | |
| 2603 | btInfoExt = pCoexSta->btInfoExt; |
| 2604 | |
| 2605 | if(halbtc8723a2ant_NeedToDecBtPwr(pBtCoexist)) |
| 2606 | halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, true); |
| 2607 | else |
| 2608 | halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE); |
| 2609 | halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3); |
| 2610 | |
| 2611 | pBtCoexist->btc_get(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw); |
| 2612 | if(BTC_WIFI_BW_HT40 == wifiBw) |
| 2613 | { |
| 2614 | wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 37, 0); |
| 2615 | |
| 2616 | // fw mechanism |
| 2617 | if( (wifiRssiState == BTC_RSSI_STATE_HIGH) || |
| 2618 | (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ) |
| 2619 | { |
| 2620 | if(btInfoExt&BIT0) //a2dp rate, 1:basic /0:edr |
| 2621 | { |
| 2622 | halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 3); |
| 2623 | } |
| 2624 | else |
| 2625 | { |
| 2626 | halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 1); |
| 2627 | } |
| 2628 | } |
| 2629 | else |
| 2630 | { |
| 2631 | if(btInfoExt&BIT0) //a2dp rate, 1:basic /0:edr |
| 2632 | { |
| 2633 | halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, true, 3); |
| 2634 | } |
| 2635 | else |
| 2636 | { |
| 2637 | halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, true, 1); |
| 2638 | } |
| 2639 | } |
| 2640 | |
| 2641 | // sw mechanism |
| 2642 | halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE); |
| 2643 | halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, true); |
| 2644 | halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0); |
| 2645 | } |
| 2646 | else |
| 2647 | { |
| 2648 | wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 27, 0); |
| 2649 | wifiRssiState1 = halbtc8723a2ant_WifiRssiState(pBtCoexist, 1, 2, 47, 0); |
| 2650 | |
| 2651 | // fw mechanism |
| 2652 | if( (wifiRssiState == BTC_RSSI_STATE_HIGH) || |
| 2653 | (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ) |
| 2654 | { |
| 2655 | if(btInfoExt&BIT0) //a2dp rate, 1:basic /0:edr |
| 2656 | { |
| 2657 | halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 3); |
| 2658 | } |
| 2659 | else |
| 2660 | { |
| 2661 | halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 1); |
| 2662 | } |
| 2663 | } |
| 2664 | else |
| 2665 | { |
| 2666 | if(btInfoExt&BIT0) //a2dp rate, 1:basic /0:edr |
| 2667 | { |
| 2668 | halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, true, 3); |
| 2669 | } |
| 2670 | else |
| 2671 | { |
| 2672 | halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, FALSE, true, 1); |
| 2673 | } |
| 2674 | } |
| 2675 | |
| 2676 | // sw mechanism |
| 2677 | if( (wifiRssiState1 == BTC_RSSI_STATE_HIGH) || |
| 2678 | (wifiRssiState1 == BTC_RSSI_STATE_STAY_HIGH) ) |
| 2679 | { |
| 2680 | halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, true); |
| 2681 | halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, true); |
| 2682 | halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0); |
| 2683 | } |
| 2684 | else |
| 2685 | { |
| 2686 | halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE); |
| 2687 | halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE); |
| 2688 | halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0); |
| 2689 | } |
| 2690 | } |
| 2691 | } |
| 2692 | |
| 2693 | VOID |
| 2694 | halbtc8723a2ant_ActionPanEdr( |
| 2695 | IN PBTC_COEXIST pBtCoexist |
| 2696 | ) |
| 2697 | { |
| 2698 | u1Byte wifiRssiState, wifiRssiState1, btInfoExt; |
| 2699 | u4Byte wifiBw; |
| 2700 | |
| 2701 | btInfoExt = pCoexSta->btInfoExt; |
| 2702 | |
| 2703 | if(halbtc8723a2ant_NeedToDecBtPwr(pBtCoexist)) |
| 2704 | halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, true); |
| 2705 | else |
| 2706 | halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE); |
| 2707 | halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3); |
| 2708 | |
| 2709 | pBtCoexist->btc_get(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw); |
| 2710 | if(BTC_WIFI_BW_HT40 == wifiBw) |
| 2711 | { |
| 2712 | wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 37, 0); |
| 2713 | |
| 2714 | // fw mechanism |
| 2715 | if( (wifiRssiState == BTC_RSSI_STATE_HIGH) || |
| 2716 | (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ) |
| 2717 | { |
| 2718 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 2); |
| 2719 | } |
| 2720 | else |
| 2721 | { |
| 2722 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 6); |
| 2723 | } |
| 2724 | |
| 2725 | // sw mechanism |
| 2726 | halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE); |
| 2727 | halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, true); |
| 2728 | halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0); |
| 2729 | } |
| 2730 | else |
| 2731 | { |
| 2732 | wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 27, 0); |
| 2733 | wifiRssiState1 = halbtc8723a2ant_WifiRssiState(pBtCoexist, 1, 2, 47, 0); |
| 2734 | |
| 2735 | // fw mechanism |
| 2736 | if( (wifiRssiState == BTC_RSSI_STATE_HIGH) || |
| 2737 | (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ) |
| 2738 | { |
| 2739 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 2); |
| 2740 | } |
| 2741 | else |
| 2742 | { |
| 2743 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 6); |
| 2744 | } |
| 2745 | |
| 2746 | // sw mechanism |
| 2747 | if( (wifiRssiState1 == BTC_RSSI_STATE_HIGH) || |
| 2748 | (wifiRssiState1 == BTC_RSSI_STATE_STAY_HIGH) ) |
| 2749 | { |
| 2750 | halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, true); |
| 2751 | halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, true); |
| 2752 | halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0); |
| 2753 | } |
| 2754 | else |
| 2755 | { |
| 2756 | halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE); |
| 2757 | halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE); |
| 2758 | halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0); |
| 2759 | } |
| 2760 | } |
| 2761 | } |
| 2762 | |
| 2763 | |
| 2764 | //PAN(HS) only |
| 2765 | VOID |
| 2766 | halbtc8723a2ant_ActionPanHs( |
| 2767 | IN PBTC_COEXIST pBtCoexist |
| 2768 | ) |
| 2769 | { |
| 2770 | u1Byte wifiRssiState; |
| 2771 | u4Byte wifiBw; |
| 2772 | |
| 2773 | halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3); |
| 2774 | |
| 2775 | pBtCoexist->btc_get(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw); |
| 2776 | if(BTC_WIFI_BW_HT40 == wifiBw) |
| 2777 | { |
| 2778 | wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 37, 0); |
| 2779 | |
| 2780 | // fw mechanism |
| 2781 | if( (wifiRssiState == BTC_RSSI_STATE_HIGH) || |
| 2782 | (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ) |
| 2783 | { |
| 2784 | halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, true); |
| 2785 | } |
| 2786 | else |
| 2787 | { |
| 2788 | halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE); |
| 2789 | } |
| 2790 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0); |
| 2791 | |
| 2792 | // sw mechanism |
| 2793 | halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE); |
| 2794 | halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, true); |
| 2795 | halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0); |
| 2796 | } |
| 2797 | else |
| 2798 | { |
| 2799 | wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 37, 0); |
| 2800 | |
| 2801 | // fw mechanism |
| 2802 | if( (wifiRssiState == BTC_RSSI_STATE_HIGH) || |
| 2803 | (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ) |
| 2804 | { |
| 2805 | halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, true); |
| 2806 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0); |
| 2807 | } |
| 2808 | else |
| 2809 | { |
| 2810 | halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE); |
| 2811 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0); |
| 2812 | } |
| 2813 | |
| 2814 | // sw mechanism |
| 2815 | if( (wifiRssiState == BTC_RSSI_STATE_HIGH) || |
| 2816 | (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ) |
| 2817 | { |
| 2818 | halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, true); |
| 2819 | halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, true); |
| 2820 | halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0); |
| 2821 | } |
| 2822 | else |
| 2823 | { |
| 2824 | halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE); |
| 2825 | halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE); |
| 2826 | halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0); |
| 2827 | } |
| 2828 | } |
| 2829 | } |
| 2830 | |
| 2831 | //PAN(EDR)+A2DP |
| 2832 | VOID |
| 2833 | halbtc8723a2ant_ActionPanEdrA2dp( |
| 2834 | IN PBTC_COEXIST pBtCoexist |
| 2835 | ) |
| 2836 | { |
| 2837 | u1Byte wifiRssiState, wifiRssiState1, btInfoExt; |
| 2838 | u4Byte wifiBw; |
| 2839 | |
| 2840 | btInfoExt = pCoexSta->btInfoExt; |
| 2841 | |
| 2842 | if(halbtc8723a2ant_NeedToDecBtPwr(pBtCoexist)) |
| 2843 | halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, true); |
| 2844 | else |
| 2845 | halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE); |
| 2846 | halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3); |
| 2847 | |
| 2848 | pBtCoexist->btc_get(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw); |
| 2849 | if(BTC_WIFI_BW_HT40 == wifiBw) |
| 2850 | { |
| 2851 | wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 37, 0); |
| 2852 | |
| 2853 | // fw mechanism |
| 2854 | if( (wifiRssiState == BTC_RSSI_STATE_HIGH) || |
| 2855 | (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ) |
| 2856 | { |
| 2857 | if(btInfoExt&BIT0) //a2dp basic rate |
| 2858 | { |
| 2859 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 4); |
| 2860 | } |
| 2861 | else //a2dp edr rate |
| 2862 | { |
| 2863 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 2); |
| 2864 | } |
| 2865 | } |
| 2866 | else |
| 2867 | { |
| 2868 | if(btInfoExt&BIT0) //a2dp basic rate |
| 2869 | { |
| 2870 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 8); |
| 2871 | } |
| 2872 | else //a2dp edr rate |
| 2873 | { |
| 2874 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 6); |
| 2875 | } |
| 2876 | } |
| 2877 | |
| 2878 | // sw mechanism |
| 2879 | halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE); |
| 2880 | halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, true); |
| 2881 | halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0); |
| 2882 | } |
| 2883 | else |
| 2884 | { |
| 2885 | wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 27, 0); |
| 2886 | wifiRssiState1 = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 47, 0); |
| 2887 | |
| 2888 | // fw mechanism |
| 2889 | if( (wifiRssiState == BTC_RSSI_STATE_HIGH) || |
| 2890 | (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ) |
| 2891 | { |
| 2892 | if(btInfoExt&BIT0) //a2dp basic rate |
| 2893 | { |
| 2894 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 4); |
| 2895 | } |
| 2896 | else //a2dp edr rate |
| 2897 | { |
| 2898 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 2); |
| 2899 | } |
| 2900 | } |
| 2901 | else |
| 2902 | { |
| 2903 | if(btInfoExt&BIT0) //a2dp basic rate |
| 2904 | { |
| 2905 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 8); |
| 2906 | } |
| 2907 | else //a2dp edr rate |
| 2908 | { |
| 2909 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 6); |
| 2910 | } |
| 2911 | } |
| 2912 | |
| 2913 | // sw mechanism |
| 2914 | if( (wifiRssiState1 == BTC_RSSI_STATE_HIGH) || |
| 2915 | (wifiRssiState1 == BTC_RSSI_STATE_STAY_HIGH) ) |
| 2916 | { |
| 2917 | halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, true); |
| 2918 | halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, true); |
| 2919 | halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0); |
| 2920 | } |
| 2921 | else |
| 2922 | { |
| 2923 | halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE); |
| 2924 | halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE); |
| 2925 | halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0); |
| 2926 | } |
| 2927 | } |
| 2928 | } |
| 2929 | |
| 2930 | VOID |
| 2931 | halbtc8723a2ant_ActionPanEdrHid( |
| 2932 | IN PBTC_COEXIST pBtCoexist |
| 2933 | ) |
| 2934 | { |
| 2935 | u1Byte wifiRssiState, wifiRssiState1; |
| 2936 | u4Byte wifiBw; |
| 2937 | |
| 2938 | if(halbtc8723a2ant_NeedToDecBtPwr(pBtCoexist)) |
| 2939 | halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, true); |
| 2940 | else |
| 2941 | halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE); |
| 2942 | halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3); |
| 2943 | |
| 2944 | pBtCoexist->btc_get(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw); |
| 2945 | if(BTC_WIFI_BW_HT40 == wifiBw) |
| 2946 | { |
| 2947 | wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 37, 0); |
| 2948 | |
| 2949 | // fw mechanism |
| 2950 | if( (wifiRssiState == BTC_RSSI_STATE_HIGH) || |
| 2951 | (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ) |
| 2952 | { |
| 2953 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 10); |
| 2954 | } |
| 2955 | else |
| 2956 | { |
| 2957 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 14); |
| 2958 | } |
| 2959 | |
| 2960 | // sw mechanism |
| 2961 | halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE); |
| 2962 | halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, true); |
| 2963 | halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0); |
| 2964 | } |
| 2965 | else |
| 2966 | { |
| 2967 | wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 27, 0); |
| 2968 | wifiRssiState1 = halbtc8723a2ant_WifiRssiState(pBtCoexist, 1, 2, 47, 0); |
| 2969 | |
| 2970 | // fw mechanism |
| 2971 | if( (wifiRssiState == BTC_RSSI_STATE_HIGH) || |
| 2972 | (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ) |
| 2973 | { |
| 2974 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 10); |
| 2975 | } |
| 2976 | else |
| 2977 | { |
| 2978 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 14); |
| 2979 | } |
| 2980 | |
| 2981 | // sw mechanism |
| 2982 | if( (wifiRssiState == BTC_RSSI_STATE_HIGH) || |
| 2983 | (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ) |
| 2984 | { |
| 2985 | halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, true); |
| 2986 | halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, true); |
| 2987 | halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0); |
| 2988 | } |
| 2989 | else |
| 2990 | { |
| 2991 | halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE); |
| 2992 | halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE); |
| 2993 | halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0); |
| 2994 | } |
| 2995 | } |
| 2996 | } |
| 2997 | |
| 2998 | // HID+A2DP+PAN(EDR) |
| 2999 | VOID |
| 3000 | halbtc8723a2ant_ActionHidA2dpPanEdr( |
| 3001 | IN PBTC_COEXIST pBtCoexist |
| 3002 | ) |
| 3003 | { |
| 3004 | u1Byte wifiRssiState, wifiRssiState1, btInfoExt; |
| 3005 | u4Byte wifiBw; |
| 3006 | |
| 3007 | btInfoExt = pCoexSta->btInfoExt; |
| 3008 | |
| 3009 | if(halbtc8723a2ant_NeedToDecBtPwr(pBtCoexist)) |
| 3010 | halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, true); |
| 3011 | else |
| 3012 | halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE); |
| 3013 | halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3); |
| 3014 | |
| 3015 | pBtCoexist->btc_get(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw); |
| 3016 | if(BTC_WIFI_BW_HT40 == wifiBw) |
| 3017 | { |
| 3018 | wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 37, 0); |
| 3019 | |
| 3020 | // fw mechanism |
| 3021 | if( (wifiRssiState == BTC_RSSI_STATE_HIGH) || |
| 3022 | (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ) |
| 3023 | { |
| 3024 | if(btInfoExt&BIT0) //a2dp basic rate |
| 3025 | { |
| 3026 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 12); |
| 3027 | } |
| 3028 | else //a2dp edr rate |
| 3029 | { |
| 3030 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 10); |
| 3031 | } |
| 3032 | } |
| 3033 | else |
| 3034 | { |
| 3035 | if(btInfoExt&BIT0) //a2dp basic rate |
| 3036 | { |
| 3037 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 16); |
| 3038 | } |
| 3039 | else //a2dp edr rate |
| 3040 | { |
| 3041 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 14); |
| 3042 | } |
| 3043 | } |
| 3044 | |
| 3045 | // sw mechanism |
| 3046 | halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE); |
| 3047 | halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, true); |
| 3048 | halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0); |
| 3049 | } |
| 3050 | else |
| 3051 | { |
| 3052 | wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 27, 0); |
| 3053 | wifiRssiState1 = halbtc8723a2ant_WifiRssiState(pBtCoexist, 1, 2, 47, 0); |
| 3054 | |
| 3055 | // fw mechanism |
| 3056 | if( (wifiRssiState == BTC_RSSI_STATE_HIGH) || |
| 3057 | (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ) |
| 3058 | { |
| 3059 | if(btInfoExt&BIT0) //a2dp basic rate |
| 3060 | { |
| 3061 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 12); |
| 3062 | } |
| 3063 | else //a2dp edr rate |
| 3064 | { |
| 3065 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 10); |
| 3066 | } |
| 3067 | } |
| 3068 | else |
| 3069 | { |
| 3070 | if(btInfoExt&BIT0) //a2dp basic rate |
| 3071 | { |
| 3072 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 16); |
| 3073 | } |
| 3074 | else //a2dp edr rate |
| 3075 | { |
| 3076 | halbtc8723a2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 14); |
| 3077 | } |
| 3078 | } |
| 3079 | |
| 3080 | // sw mechanism |
| 3081 | if( (wifiRssiState1 == BTC_RSSI_STATE_HIGH) || |
| 3082 | (wifiRssiState1 == BTC_RSSI_STATE_STAY_HIGH) ) |
| 3083 | { |
| 3084 | halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, true); |
| 3085 | halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, true); |
| 3086 | halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0); |
| 3087 | } |
| 3088 | else |
| 3089 | { |
| 3090 | halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE); |
| 3091 | halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE); |
| 3092 | halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0); |
| 3093 | } |
| 3094 | } |
| 3095 | } |
| 3096 | |
| 3097 | VOID |
| 3098 | halbtc8723a2ant_ActionHidA2dp( |
| 3099 | IN PBTC_COEXIST pBtCoexist |
| 3100 | ) |
| 3101 | { |
| 3102 | u1Byte wifiRssiState, wifiRssiState1, btInfoExt; |
| 3103 | u4Byte wifiBw; |
| 3104 | |
| 3105 | btInfoExt = pCoexSta->btInfoExt; |
| 3106 | |
| 3107 | if(halbtc8723a2ant_NeedToDecBtPwr(pBtCoexist)) |
| 3108 | halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, true); |
| 3109 | else |
| 3110 | halbtc8723a2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE); |
| 3111 | halbtc8723a2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0xffff, 0x3); |
| 3112 | |
| 3113 | pBtCoexist->btc_get(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw); |
| 3114 | if(BTC_WIFI_BW_HT40 == wifiBw) |
| 3115 | { |
| 3116 | wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 37, 0); |
| 3117 | |
| 3118 | // fw mechanism |
| 3119 | if( (wifiRssiState == BTC_RSSI_STATE_HIGH) || |
| 3120 | (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ) |
| 3121 | { |
| 3122 | if(btInfoExt&BIT0) //a2dp basic rate |
| 3123 | { |
| 3124 | halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, true, FALSE, 3); |
| 3125 | } |
| 3126 | else //a2dp edr rate |
| 3127 | { |
| 3128 | halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, true, FALSE, 1); |
| 3129 | } |
| 3130 | } |
| 3131 | else |
| 3132 | { |
| 3133 | if(btInfoExt&BIT0) //a2dp basic rate |
| 3134 | { |
| 3135 | halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, true, true, 3); |
| 3136 | } |
| 3137 | else //a2dp edr rate |
| 3138 | { |
| 3139 | halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, true, true, 1); |
| 3140 | } |
| 3141 | } |
| 3142 | |
| 3143 | // sw mechanism |
| 3144 | halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE); |
| 3145 | halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, true); |
| 3146 | halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0); |
| 3147 | } |
| 3148 | else |
| 3149 | { |
| 3150 | wifiRssiState = halbtc8723a2ant_WifiRssiState(pBtCoexist, 0, 2, 27, 0); |
| 3151 | wifiRssiState1 = halbtc8723a2ant_WifiRssiState(pBtCoexist, 1, 2, 47, 0); |
| 3152 | |
| 3153 | // fw mechanism |
| 3154 | if( (wifiRssiState == BTC_RSSI_STATE_HIGH) || |
| 3155 | (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ) |
| 3156 | { |
| 3157 | if(btInfoExt&BIT0) //a2dp basic rate |
| 3158 | { |
| 3159 | halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, true, FALSE, 3); |
| 3160 | } |
| 3161 | else //a2dp edr rate |
| 3162 | { |
| 3163 | halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, true, FALSE, 1); |
| 3164 | } |
| 3165 | } |
| 3166 | else |
| 3167 | { |
| 3168 | if(btInfoExt&BIT0) //a2dp basic rate |
| 3169 | { |
| 3170 | halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, true, true, 3); |
| 3171 | } |
| 3172 | else //a2dp edr rate |
| 3173 | { |
| 3174 | halbtc8723a2ant_TdmaDurationAdjust(pBtCoexist, true, true, 1); |
| 3175 | } |
| 3176 | } |
| 3177 | |
| 3178 | // sw mechanism |
| 3179 | if( (wifiRssiState1 == BTC_RSSI_STATE_HIGH) || |
| 3180 | (wifiRssiState1 == BTC_RSSI_STATE_STAY_HIGH) ) |
| 3181 | { |
| 3182 | halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, true); |
| 3183 | halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, true); |
| 3184 | halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0); |
| 3185 | } |
| 3186 | else |
| 3187 | { |
| 3188 | halbtc8723a2ant_AgcTable(pBtCoexist, NORMAL_EXEC, FALSE); |
| 3189 | halbtc8723a2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, FALSE); |
| 3190 | halbtc8723a2ant_DacSwing(pBtCoexist, NORMAL_EXEC, FALSE, 0xc0); |
| 3191 | } |
| 3192 | } |
| 3193 | } |
| 3194 | |
| 3195 | VOID |
| 3196 | halbtc8723a2ant_RunCoexistMechanism( |
| 3197 | IN PBTC_COEXIST pBtCoexist |
| 3198 | ) |
| 3199 | { |
| 3200 | PBTC_STACK_INFO pStackInfo=&pBtCoexist->stack_info; |
| 3201 | u1Byte btInfoOriginal=0, btRetryCnt=0; |
| 3202 | u1Byte algorithm=0; |
| 3203 | |
| 3204 | if(pBtCoexist->manual_control) |
| 3205 | { |
| 3206 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Manual control!!!\n")); |
| 3207 | return; |
| 3208 | } |
| 3209 | |
| 3210 | if(pStackInfo->bProfileNotified) |
| 3211 | { |
| 3212 | if(pCoexSta->bHoldForStackOperation) |
| 3213 | { |
| 3214 | // if bt inquiry/page/pair, do not execute. |
| 3215 | return; |
| 3216 | } |
| 3217 | |
| 3218 | algorithm = halbtc8723a2ant_ActionAlgorithm(pBtCoexist); |
| 3219 | if(pCoexSta->bHoldPeriodCnt && (BT_8723A_2ANT_COEX_ALGO_PANHS!=algorithm)) |
| 3220 | { |
| 3221 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex],Hold BT inquiry/page scan setting (cnt = %d)!!\n", |
| 3222 | pCoexSta->bHoldPeriodCnt)); |
| 3223 | if(pCoexSta->bHoldPeriodCnt >= 6) |
| 3224 | { |
| 3225 | pCoexSta->bHoldPeriodCnt = 0; |
| 3226 | // next time the coexist parameters should be reset again. |
| 3227 | } |
| 3228 | else |
| 3229 | pCoexSta->bHoldPeriodCnt++; |
| 3230 | return; |
| 3231 | } |
| 3232 | |
| 3233 | pCoexDm->curAlgorithm = algorithm; |
| 3234 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Algorithm = %d \n", pCoexDm->curAlgorithm)); |
| 3235 | if(halbtc8723a2ant_IsCommonAction(pBtCoexist)) |
| 3236 | { |
| 3237 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant common.\n")); |
| 3238 | pCoexDm->bResetTdmaAdjust = true; |
| 3239 | } |
| 3240 | else |
| 3241 | { |
| 3242 | if(pCoexDm->curAlgorithm != pCoexDm->preAlgorithm) |
| 3243 | { |
| 3244 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], preAlgorithm=%d, curAlgorithm=%d\n", |
| 3245 | pCoexDm->preAlgorithm, pCoexDm->curAlgorithm)); |
| 3246 | pCoexDm->bResetTdmaAdjust = true; |
| 3247 | } |
| 3248 | switch(pCoexDm->curAlgorithm) |
| 3249 | { |
| 3250 | case BT_8723A_2ANT_COEX_ALGO_SCO: |
| 3251 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = SCO.\n")); |
| 3252 | halbtc8723a2ant_ActionSco(pBtCoexist); |
| 3253 | break; |
| 3254 | case BT_8723A_2ANT_COEX_ALGO_HID: |
| 3255 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HID.\n")); |
| 3256 | halbtc8723a2ant_ActionHid(pBtCoexist); |
| 3257 | break; |
| 3258 | case BT_8723A_2ANT_COEX_ALGO_A2DP: |
| 3259 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = A2DP.\n")); |
| 3260 | halbtc8723a2ant_ActionA2dp(pBtCoexist); |
| 3261 | break; |
| 3262 | case BT_8723A_2ANT_COEX_ALGO_PANEDR: |
| 3263 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = PAN(EDR).\n")); |
| 3264 | halbtc8723a2ant_ActionPanEdr(pBtCoexist); |
| 3265 | break; |
| 3266 | case BT_8723A_2ANT_COEX_ALGO_PANHS: |
| 3267 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HS mode.\n")); |
| 3268 | halbtc8723a2ant_ActionPanHs(pBtCoexist); |
| 3269 | break; |
| 3270 | case BT_8723A_2ANT_COEX_ALGO_PANEDR_A2DP: |
| 3271 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = PAN+A2DP.\n")); |
| 3272 | halbtc8723a2ant_ActionPanEdrA2dp(pBtCoexist); |
| 3273 | break; |
| 3274 | case BT_8723A_2ANT_COEX_ALGO_PANEDR_HID: |
| 3275 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = PAN(EDR)+HID.\n")); |
| 3276 | halbtc8723a2ant_ActionPanEdrHid(pBtCoexist); |
| 3277 | break; |
| 3278 | case BT_8723A_2ANT_COEX_ALGO_HID_A2DP_PANEDR: |
| 3279 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HID+A2DP+PAN.\n")); |
| 3280 | halbtc8723a2ant_ActionHidA2dpPanEdr(pBtCoexist); |
| 3281 | break; |
| 3282 | case BT_8723A_2ANT_COEX_ALGO_HID_A2DP: |
| 3283 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HID+A2DP.\n")); |
| 3284 | halbtc8723a2ant_ActionHidA2dp(pBtCoexist); |
| 3285 | break; |
| 3286 | default: |
| 3287 | BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = coexist All Off!!\n")); |
| 3288 | halbtc8723a2ant_CoexAllOff(pBtCoexist); |
| 3289 | break; |
| 3290 | } |
| 3291 | pCoexDm->preAlgorithm = pCoexDm->curAlgorithm; |
| 3292 | } |
| 3293 | } |
| 3294 | } |
| 3295 | |
| 3296 | //============================================================ |
| 3297 | // work around function start with wa_halbtc8723a2ant_ |
| 3298 | //============================================================ |
| 3299 | VOID |
| 3300 | wa_halbtc8723a2ant_MonitorC2h( |
| 3301 | IN PBTC_COEXIST pBtCoexist |
| 3302 | ) |
| 3303 | { |
| 3304 | u1Byte tmp1b=0x0; |
| 3305 | u4Byte curC2hTotalCnt=0x0; |
| 3306 | static u4Byte preC2hTotalCnt=0x0, sameCntPollingTime=0x0; |
| 3307 | |
| 3308 | curC2hTotalCnt+=pCoexSta->btInfoC2hCnt[BT_INFO_SRC_8723A_2ANT_BT_RSP]; |
| 3309 | |
| 3310 | if(curC2hTotalCnt == preC2hTotalCnt) |
| 3311 | { |
| 3312 | sameCntPollingTime++; |
| 3313 | } |
| 3314 | else |
| 3315 | { |
| 3316 | preC2hTotalCnt = curC2hTotalCnt; |
| 3317 | sameCntPollingTime = 0; |
| 3318 | } |
| 3319 | |
| 3320 | if(sameCntPollingTime >= 2) |
| 3321 | { |
| 3322 | tmp1b = pBtCoexist->btc_read_1byte(pBtCoexist, 0x1af); |
| 3323 | if(tmp1b != 0x0) |
| 3324 | { |
| 3325 | pCoexSta->c2hHangDetectCnt++; |
| 3326 | pBtCoexist->btc_write_1byte(pBtCoexist, 0x1af, 0x0); |
| 3327 | } |
| 3328 | } |
| 3329 | } |
| 3330 | |
| 3331 | //============================================================ |
| 3332 | // extern function start with EXhalbtc8723a2ant_ |
| 3333 | //============================================================ |
| 3334 | VOID |
| 3335 | EXhalbtc8723a2ant_InitHwConfig( |
| 3336 | IN PBTC_COEXIST pBtCoexist |
| 3337 | ) |
| 3338 | { |
| 3339 | u4Byte u4Tmp=0; |
| 3340 | u1Byte u1Tmp=0; |
| 3341 | |
| 3342 | BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], 2Ant Init HW Config!!\n")); |
| 3343 | |
| 3344 | // backup rf 0x1e value |
| 3345 | pCoexDm->btRf0x1eBackup = |
| 3346 | pBtCoexist->btc_get_rf_reg(pBtCoexist, BTC_RF_A, 0x1e, 0xfffff); |
| 3347 | |
| 3348 | // Enable counter statistics |
| 3349 | pBtCoexist->btc_write_1byte(pBtCoexist, 0x76e, 0x4); |
| 3350 | pBtCoexist->btc_write_1byte(pBtCoexist, 0x778, 0x3); |
| 3351 | pBtCoexist->btc_write_1byte(pBtCoexist, 0x40, 0x20); |
| 3352 | } |
| 3353 | |
| 3354 | VOID |
| 3355 | EXhalbtc8723a2ant_InitCoexDm( |
| 3356 | IN PBTC_COEXIST pBtCoexist |
| 3357 | ) |
| 3358 | { |
| 3359 | BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], Coex Mechanism Init!!\n")); |
| 3360 | |
| 3361 | halbtc8723a2ant_InitCoexDm(pBtCoexist); |
| 3362 | } |
| 3363 | |
| 3364 | VOID |
| 3365 | EXhalbtc8723a2ant_DisplayCoexInfo( |
| 3366 | IN PBTC_COEXIST pBtCoexist |
| 3367 | ) |
| 3368 | { |
| 3369 | struct btc_board_info * pBoardInfo=&pBtCoexist->board_info; |
| 3370 | PBTC_STACK_INFO pStackInfo=&pBtCoexist->stack_info; |
| 3371 | pu1Byte cliBuf=pBtCoexist->cli_buf; |
| 3372 | u1Byte u1Tmp[4], i, btInfoExt, psTdmaCase=0; |
| 3373 | u4Byte u4Tmp[4]; |
| 3374 | BOOLEAN bRoam=FALSE, bScan=FALSE, bLink=FALSE, bWifiUnder5G=FALSE; |
| 3375 | BOOLEAN bBtHsOn=FALSE, bWifiBusy=FALSE; |
| 3376 | s4Byte wifiRssi=0, btHsRssi=0; |
| 3377 | u4Byte wifiBw, wifiTrafficDir; |
| 3378 | u1Byte wifiDot11Chnl, wifiHsChnl; |
| 3379 | |
| 3380 | CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n ============[BT Coexist info]============"); |
| 3381 | CL_PRINTF(cliBuf); |
| 3382 | |
| 3383 | if(!pBoardInfo->bt_exist) |
| 3384 | { |
| 3385 | CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n BT not exists !!!"); |
| 3386 | CL_PRINTF(cliBuf); |
| 3387 | return; |
| 3388 | } |
| 3389 | |
| 3390 | CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d ", "Ant PG number/ Ant mechanism:", \ |
| 3391 | pBoardInfo->pg_ant_num, pBoardInfo->btdm_ant_num); |
| 3392 | CL_PRINTF(cliBuf); |
| 3393 | |
| 3394 | if(pBtCoexist->manual_control) |
| 3395 | { |
| 3396 | CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s", "[Action Manual control]!!"); |
| 3397 | CL_PRINTF(cliBuf); |
| 3398 | } |
| 3399 | |
| 3400 | CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %s / %d", "BT stack/ hci ext ver", \ |
| 3401 | ((pStackInfo->bProfileNotified)? "Yes":"No"), pStackInfo->hciVersion); |
| 3402 | CL_PRINTF(cliBuf); |
| 3403 | |
| 3404 | pBtCoexist->btc_get(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn); |
| 3405 | pBtCoexist->btc_get(pBtCoexist, BTC_GET_U1_WIFI_DOT11_CHNL, &wifiDot11Chnl); |
| 3406 | pBtCoexist->btc_get(pBtCoexist, BTC_GET_U1_WIFI_HS_CHNL, &wifiHsChnl); |
| 3407 | CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d / %d(%d)", "Dot11 channel / HsChnl(HsMode)", \ |
| 3408 | wifiDot11Chnl, wifiHsChnl, bBtHsOn); |
| 3409 | CL_PRINTF(cliBuf); |
| 3410 | |
| 3411 | CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %02x %02x %02x ", "H2C Wifi inform bt chnl Info", \ |
| 3412 | pCoexDm->wifiChnlInfo[0], pCoexDm->wifiChnlInfo[1], |
| 3413 | pCoexDm->wifiChnlInfo[2]); |
| 3414 | CL_PRINTF(cliBuf); |
| 3415 | |
| 3416 | pBtCoexist->btc_get(pBtCoexist, BTC_GET_S4_WIFI_RSSI, &wifiRssi); |
| 3417 | pBtCoexist->btc_get(pBtCoexist, BTC_GET_S4_HS_RSSI, &btHsRssi); |
| 3418 | CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d", "Wifi rssi/ HS rssi", \ |
| 3419 | wifiRssi, btHsRssi); |
| 3420 | CL_PRINTF(cliBuf); |
| 3421 | |
| 3422 | pBtCoexist->btc_get(pBtCoexist, BTC_GET_BL_WIFI_SCAN, &bScan); |
| 3423 | pBtCoexist->btc_get(pBtCoexist, BTC_GET_BL_WIFI_LINK, &bLink); |
| 3424 | pBtCoexist->btc_get(pBtCoexist, BTC_GET_BL_WIFI_ROAM, &bRoam); |
| 3425 | CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d/ %d ", "Wifi bLink/ bRoam/ bScan", \ |
| 3426 | bLink, bRoam, bScan); |
| 3427 | CL_PRINTF(cliBuf); |
| 3428 | |
| 3429 | pBtCoexist->btc_get(pBtCoexist, BTC_GET_BL_WIFI_UNDER_5G, &bWifiUnder5G); |
| 3430 | pBtCoexist->btc_get(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw); |
| 3431 | pBtCoexist->btc_get(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy); |
| 3432 | pBtCoexist->btc_get(pBtCoexist, BTC_GET_U4_WIFI_TRAFFIC_DIRECTION, &wifiTrafficDir); |
| 3433 | CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %s / %s/ %s ", "Wifi status", \ |
| 3434 | (bWifiUnder5G? "5G":"2.4G"), |
| 3435 | ((BTC_WIFI_BW_LEGACY==wifiBw)? "Legacy": (((BTC_WIFI_BW_HT40==wifiBw)? "HT40":"HT20"))), |
| 3436 | ((!bWifiBusy)? "idle": ((BTC_WIFI_TRAFFIC_TX==wifiTrafficDir)? "uplink":"downlink"))); |
| 3437 | CL_PRINTF(cliBuf); |
| 3438 | |
| 3439 | CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = [%s/ %d/ %d] ", "BT [status/ rssi/ retryCnt]", \ |
| 3440 | ((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"))), |
| 3441 | pCoexSta->btRssi, pCoexSta->btRetryCnt); |
| 3442 | CL_PRINTF(cliBuf); |
| 3443 | |
| 3444 | if(pStackInfo->bProfileNotified) |
| 3445 | { |
| 3446 | CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d / %d / %d / %d", "SCO/HID/PAN/A2DP", \ |
| 3447 | pStackInfo->bScoExist, pStackInfo->bHidExist, pStackInfo->bPanExist, pStackInfo->bA2dpExist); |
| 3448 | CL_PRINTF(cliBuf); |
| 3449 | |
| 3450 | pBtCoexist->btc_disp_dbg_msg(pBtCoexist, BTC_DBG_DISP_BT_LINK_INFO); |
| 3451 | } |
| 3452 | |
| 3453 | btInfoExt = pCoexSta->btInfoExt; |
| 3454 | CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %s", "BT Info A2DP rate", \ |
| 3455 | (btInfoExt&BIT0)? "Basic rate":"EDR rate"); |
| 3456 | CL_PRINTF(cliBuf); |
| 3457 | |
| 3458 | for(i=0; i<BT_INFO_SRC_8723A_2ANT_MAX; i++) |
| 3459 | { |
| 3460 | if(pCoexSta->btInfoC2hCnt[i]) |
| 3461 | { |
| 3462 | CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %02x %02x %02x %02x %02x %02x %02x(%d)", GLBtInfoSrc8723a2Ant[i], \ |
| 3463 | pCoexSta->btInfoC2h[i][0], pCoexSta->btInfoC2h[i][1], |
| 3464 | pCoexSta->btInfoC2h[i][2], pCoexSta->btInfoC2h[i][3], |
| 3465 | pCoexSta->btInfoC2h[i][4], pCoexSta->btInfoC2h[i][5], |
| 3466 | pCoexSta->btInfoC2h[i][6], pCoexSta->btInfoC2hCnt[i]); |
| 3467 | CL_PRINTF(cliBuf); |
| 3468 | } |
| 3469 | } |
| 3470 | |
| 3471 | CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d", "write 0x1af=0x0 num", \ |
| 3472 | pCoexSta->c2hHangDetectCnt); |
| 3473 | CL_PRINTF(cliBuf); |
| 3474 | |
| 3475 | // Sw mechanism |
| 3476 | CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s", "============[Sw mechanism]============"); |
| 3477 | CL_PRINTF(cliBuf); |
| 3478 | CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d/ %d", "SM1[ShRf/ LpRA/ LimDig]", \ |
| 3479 | pCoexDm->bCurRfRxLpfShrink, pCoexDm->bCurLowPenaltyRa, pCoexDm->limited_dig); |
| 3480 | CL_PRINTF(cliBuf); |
| 3481 | CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d/ %d(0x%x) ", "SM2[AgcT/ AdcB/ SwDacSwing(lvl)]", \ |
| 3482 | pCoexDm->bCurAgcTableEn, pCoexDm->bCurAdcBackOff, pCoexDm->bCurDacSwingOn, pCoexDm->curDacSwingLvl); |
| 3483 | CL_PRINTF(cliBuf); |
| 3484 | |
| 3485 | // Fw mechanism |
| 3486 | CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s", "============[Fw mechanism]============"); |
| 3487 | CL_PRINTF(cliBuf); |
| 3488 | |
| 3489 | if(!pBtCoexist->manual_control) |
| 3490 | { |
| 3491 | psTdmaCase = pCoexDm->curPsTdma; |
| 3492 | CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %02x %02x %02x %02x %02x case-%d", "PS TDMA", \ |
| 3493 | pCoexDm->psTdmaPara[0], pCoexDm->psTdmaPara[1], |
| 3494 | pCoexDm->psTdmaPara[2], pCoexDm->psTdmaPara[3], |
| 3495 | pCoexDm->psTdmaPara[4], psTdmaCase); |
| 3496 | CL_PRINTF(cliBuf); |
| 3497 | |
| 3498 | CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d ", "DecBtPwr/ IgnWlanAct", \ |
| 3499 | pCoexDm->bCurDecBtPwr, pCoexDm->bCurIgnoreWlanAct); |
| 3500 | CL_PRINTF(cliBuf); |
| 3501 | } |
| 3502 | |
| 3503 | // Hw setting |
| 3504 | CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s", "============[Hw setting]============"); |
| 3505 | CL_PRINTF(cliBuf); |
| 3506 | |
| 3507 | CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "RF-A, 0x1e initVal", \ |
| 3508 | pCoexDm->btRf0x1eBackup); |
| 3509 | CL_PRINTF(cliBuf); |
| 3510 | |
| 3511 | u1Tmp[0] = pBtCoexist->btc_read_1byte(pBtCoexist, 0x778); |
| 3512 | u1Tmp[1] = pBtCoexist->btc_read_1byte(pBtCoexist, 0x783); |
| 3513 | u1Tmp[2] = pBtCoexist->btc_read_1byte(pBtCoexist, 0x796); |
| 3514 | CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x", "0x778/ 0x783/ 0x796", \ |
| 3515 | u1Tmp[0], u1Tmp[1], u1Tmp[2]); |
| 3516 | CL_PRINTF(cliBuf); |
| 3517 | |
| 3518 | u4Tmp[0] = pBtCoexist->btc_read_4byte(pBtCoexist, 0x880); |
| 3519 | CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0x880", \ |
| 3520 | u4Tmp[0]); |
| 3521 | CL_PRINTF(cliBuf); |
| 3522 | |
| 3523 | u1Tmp[0] = pBtCoexist->btc_read_1byte(pBtCoexist, 0x40); |
| 3524 | CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0x40", \ |
| 3525 | u1Tmp[0]); |
| 3526 | CL_PRINTF(cliBuf); |
| 3527 | |
| 3528 | u4Tmp[0] = pBtCoexist->btc_read_4byte(pBtCoexist, 0x550); |
| 3529 | u1Tmp[0] = pBtCoexist->btc_read_1byte(pBtCoexist, 0x522); |
| 3530 | CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x", "0x550(bcn ctrl)/0x522", \ |
| 3531 | u4Tmp[0], u1Tmp[0]); |
| 3532 | CL_PRINTF(cliBuf); |
| 3533 | |
| 3534 | u4Tmp[0] = pBtCoexist->btc_read_4byte(pBtCoexist, 0x484); |
| 3535 | CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0x484(rate adaptive)", \ |
| 3536 | u4Tmp[0]); |
| 3537 | CL_PRINTF(cliBuf); |
| 3538 | |
| 3539 | u4Tmp[0] = pBtCoexist->btc_read_4byte(pBtCoexist, 0xc50); |
| 3540 | CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0xc50(dig)", \ |
| 3541 | u4Tmp[0]); |
| 3542 | CL_PRINTF(cliBuf); |
| 3543 | |
| 3544 | u4Tmp[0] = pBtCoexist->btc_read_4byte(pBtCoexist, 0xda0); |
| 3545 | u4Tmp[1] = pBtCoexist->btc_read_4byte(pBtCoexist, 0xda4); |
| 3546 | u4Tmp[2] = pBtCoexist->btc_read_4byte(pBtCoexist, 0xda8); |
| 3547 | u4Tmp[3] = pBtCoexist->btc_read_4byte(pBtCoexist, 0xdac); |
| 3548 | CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x/ 0x%x", "0xda0/0xda4/0xda8/0xdac(FA cnt)", \ |
| 3549 | u4Tmp[0], u4Tmp[1], u4Tmp[2], u4Tmp[3]); |
| 3550 | CL_PRINTF(cliBuf); |
| 3551 | |
| 3552 | u4Tmp[0] = pBtCoexist->btc_read_4byte(pBtCoexist, 0x6c0); |
| 3553 | u4Tmp[1] = pBtCoexist->btc_read_4byte(pBtCoexist, 0x6c4); |
| 3554 | u4Tmp[2] = pBtCoexist->btc_read_4byte(pBtCoexist, 0x6c8); |
| 3555 | u1Tmp[0] = pBtCoexist->btc_read_1byte(pBtCoexist, 0x6cc); |
| 3556 | CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x/ 0x%x", "0x6c0/0x6c4/0x6c8/0x6cc(coexTable)", \ |
| 3557 | u4Tmp[0], u4Tmp[1], u4Tmp[2], u1Tmp[0]); |
| 3558 | CL_PRINTF(cliBuf); |
| 3559 | |
| 3560 | CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d", "0x770 (hp rx[31:16]/tx[15:0])", \ |
| 3561 | pCoexSta->highPriorityRx, pCoexSta->highPriorityTx); |
| 3562 | CL_PRINTF(cliBuf); |
| 3563 | CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d", "0x774(lp rx[31:16]/tx[15:0])", \ |
| 3564 | pCoexSta->lowPriorityRx, pCoexSta->lowPriorityTx); |
| 3565 | CL_PRINTF(cliBuf); |
| 3566 | |
| 3567 | // Tx mgnt queue hang or not, 0x41b should = 0xf, ex: 0xd ==>hang |
| 3568 | u1Tmp[0] = pBtCoexist->btc_read_1byte(pBtCoexist, 0x41b); |
| 3569 | CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0x41b (mgntQ hang chk == 0xf)", \ |
| 3570 | u1Tmp[0]); |
| 3571 | CL_PRINTF(cliBuf); |
| 3572 | |
| 3573 | pBtCoexist->btc_disp_dbg_msg(pBtCoexist, BTC_DBG_DISP_COEX_STATISTICS); |
| 3574 | } |
| 3575 | |
| 3576 | |
| 3577 | VOID |
| 3578 | EXhalbtc8723a2ant_IpsNotify( |
| 3579 | IN PBTC_COEXIST pBtCoexist, |
| 3580 | IN u1Byte type |
| 3581 | ) |
| 3582 | { |
| 3583 | if(BTC_IPS_ENTER == type) |
| 3584 | { |
| 3585 | BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], IPS ENTER notify\n")); |
| 3586 | halbtc8723a2ant_CoexAllOff(pBtCoexist); |
| 3587 | } |
| 3588 | else if(BTC_IPS_LEAVE == type) |
| 3589 | { |
| 3590 | BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], IPS LEAVE notify\n")); |
| 3591 | //halbtc8723a2ant_InitCoexDm(pBtCoexist); |
| 3592 | } |
| 3593 | } |
| 3594 | |
| 3595 | VOID |
| 3596 | EXhalbtc8723a2ant_LpsNotify( |
| 3597 | IN PBTC_COEXIST pBtCoexist, |
| 3598 | IN u1Byte type |
| 3599 | ) |
| 3600 | { |
| 3601 | if(BTC_LPS_ENABLE == type) |
| 3602 | { |
| 3603 | BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], LPS ENABLE notify\n")); |
| 3604 | } |
| 3605 | else if(BTC_LPS_DISABLE == type) |
| 3606 | { |
| 3607 | BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], LPS DISABLE notify\n")); |
| 3608 | } |
| 3609 | } |
| 3610 | |
| 3611 | VOID |
| 3612 | EXhalbtc8723a2ant_ScanNotify( |
| 3613 | IN PBTC_COEXIST pBtCoexist, |
| 3614 | IN u1Byte type |
| 3615 | ) |
| 3616 | { |
| 3617 | if(BTC_SCAN_START == type) |
| 3618 | { |
| 3619 | BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], SCAN START notify\n")); |
| 3620 | } |
| 3621 | else if(BTC_SCAN_FINISH == type) |
| 3622 | { |
| 3623 | BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], SCAN FINISH notify\n")); |
| 3624 | } |
| 3625 | } |
| 3626 | |
| 3627 | VOID |
| 3628 | EXhalbtc8723a2ant_ConnectNotify( |
| 3629 | IN PBTC_COEXIST pBtCoexist, |
| 3630 | IN u1Byte type |
| 3631 | ) |
| 3632 | { |
| 3633 | if(BTC_ASSOCIATE_START == type) |
| 3634 | { |
| 3635 | BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], CONNECT START notify\n")); |
| 3636 | } |
| 3637 | else if(BTC_ASSOCIATE_FINISH == type) |
| 3638 | { |
| 3639 | BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], CONNECT FINISH notify\n")); |
| 3640 | } |
| 3641 | } |
| 3642 | |
| 3643 | VOID |
| 3644 | EXhalbtc8723a2ant_MediaStatusNotify( |
| 3645 | IN PBTC_COEXIST pBtCoexist, |
| 3646 | IN u1Byte type |
| 3647 | ) |
| 3648 | { |
| 3649 | if(BTC_MEDIA_CONNECT == type) |
| 3650 | { |
| 3651 | BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], MEDIA connect notify\n")); |
| 3652 | } |
| 3653 | else |
| 3654 | { |
| 3655 | BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], MEDIA disconnect notify\n")); |
| 3656 | } |
| 3657 | |
| 3658 | halbtc8723a2ant_IndicateWifiChnlBwInfo(pBtCoexist, type); |
| 3659 | } |
| 3660 | |
| 3661 | VOID |
| 3662 | EXhalbtc8723a2ant_SpecialPacketNotify( |
| 3663 | IN PBTC_COEXIST pBtCoexist, |
| 3664 | IN u1Byte type |
| 3665 | ) |
| 3666 | { |
| 3667 | if(type == BTC_PACKET_DHCP) |
| 3668 | { |
| 3669 | BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], DHCP Packet notify\n")); |
| 3670 | } |
| 3671 | } |
| 3672 | |
| 3673 | VOID |
| 3674 | EXhalbtc8723a2ant_BtInfoNotify( |
| 3675 | IN PBTC_COEXIST pBtCoexist, |
| 3676 | IN pu1Byte tmpBuf, |
| 3677 | IN u1Byte length |
| 3678 | ) |
| 3679 | { |
| 3680 | u1Byte btInfo=0; |
| 3681 | u1Byte i, rspSource=0; |
| 3682 | BOOLEAN bBtBusy=FALSE, limited_dig=FALSE; |
| 3683 | BOOLEAN bWifiConnected=FALSE, bBtHsOn=FALSE; |
| 3684 | |
| 3685 | pCoexSta->bC2hBtInfoReqSent = FALSE; |
| 3686 | |
| 3687 | rspSource = BT_INFO_SRC_8723A_2ANT_BT_RSP; |
| 3688 | pCoexSta->btInfoC2hCnt[rspSource]++; |
| 3689 | |
| 3690 | BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], Bt info[%d], length=%d, hex data=[", rspSource, length)); |
| 3691 | for(i=0; i<length; i++) |
| 3692 | { |
| 3693 | pCoexSta->btInfoC2h[rspSource][i] = tmpBuf[i]; |
| 3694 | if(i == 0) |
| 3695 | btInfo = tmpBuf[i]; |
| 3696 | if(i == length-1) |
| 3697 | { |
| 3698 | BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("0x%02x]\n", tmpBuf[i])); |
| 3699 | } |
| 3700 | else |
| 3701 | { |
| 3702 | BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("0x%02x, ", tmpBuf[i])); |
| 3703 | } |
| 3704 | } |
| 3705 | |
| 3706 | if(BT_INFO_SRC_8723A_2ANT_WIFI_FW != rspSource) |
| 3707 | { |
| 3708 | pCoexSta->btRetryCnt = |
| 3709 | pCoexSta->btInfoC2h[rspSource][1]; |
| 3710 | |
| 3711 | pCoexSta->btRssi = |
| 3712 | pCoexSta->btInfoC2h[rspSource][2]*2+10; |
| 3713 | |
| 3714 | pCoexSta->btInfoExt = |
| 3715 | pCoexSta->btInfoC2h[rspSource][3]; |
| 3716 | } |
| 3717 | |
| 3718 | pBtCoexist->btc_get(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn); |
| 3719 | // check BIT2 first ==> check if bt is under inquiry or page scan |
| 3720 | if(btInfo & BT_INFO_8723A_2ANT_B_INQ_PAGE) |
| 3721 | { |
| 3722 | pCoexSta->bC2hBtInquiryPage = true; |
| 3723 | } |
| 3724 | else |
| 3725 | { |
| 3726 | pCoexSta->bC2hBtInquiryPage = FALSE; |
| 3727 | } |
| 3728 | } |
| 3729 | |
| 3730 | VOID |
| 3731 | EXhalbtc8723a2ant_StackOperationNotify( |
| 3732 | IN PBTC_COEXIST pBtCoexist, |
| 3733 | IN u1Byte type |
| 3734 | ) |
| 3735 | { |
| 3736 | if(BTC_STACK_OP_INQ_PAGE_PAIR_START == type) |
| 3737 | { |
| 3738 | BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], StackOP Inquiry/page/pair start notify\n")); |
| 3739 | pCoexSta->bHoldForStackOperation = true; |
| 3740 | pCoexSta->bHoldPeriodCnt = 1; |
| 3741 | halbtc8723a2ant_BtInquiryPage(pBtCoexist); |
| 3742 | } |
| 3743 | else if(BTC_STACK_OP_INQ_PAGE_PAIR_FINISH == type) |
| 3744 | { |
| 3745 | BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], StackOP Inquiry/page/pair finish notify\n")); |
| 3746 | pCoexSta->bHoldForStackOperation = FALSE; |
| 3747 | } |
| 3748 | } |
| 3749 | |
| 3750 | VOID |
| 3751 | EXhalbtc8723a2ant_HaltNotify( |
| 3752 | IN PBTC_COEXIST pBtCoexist |
| 3753 | ) |
| 3754 | { |
| 3755 | BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], Halt notify\n")); |
| 3756 | |
| 3757 | halbtc8723a2ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, true); |
| 3758 | EXhalbtc8723a2ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_DISCONNECT); |
| 3759 | } |
| 3760 | |
| 3761 | VOID |
| 3762 | EXhalbtc8723a2ant_Periodical( |
| 3763 | IN PBTC_COEXIST pBtCoexist |
| 3764 | ) |
| 3765 | { |
| 3766 | BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], 2Ant Periodical!!\n")); |
| 3767 | |
| 3768 | // work around for c2h hang |
| 3769 | wa_halbtc8723a2ant_MonitorC2h(pBtCoexist); |
| 3770 | |
| 3771 | halbtc8723a2ant_QueryBtInfo(pBtCoexist); |
| 3772 | halbtc8723a2ant_MonitorBtCtr(pBtCoexist); |
| 3773 | halbtc8723a2ant_MonitorBtEnableDisable(pBtCoexist); |
| 3774 | |
| 3775 | halbtc8723a2ant_RunCoexistMechanism(pBtCoexist); |
| 3776 | } |
| 3777 | |
| 3778 | |
| 3779 | #endif |
| 3780 | |