1 /* 2 * SoftGemini.c 3 * 4 * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 11 * * Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * * Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in 15 * the documentation and/or other materials provided with the 16 * distribution. 17 * * Neither the name Texas Instruments nor the names of its 18 * contributors may be used to endorse or promote products derived 19 * from this software without specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 */ 33 34 /** \file softGemini.c 35 * \brief BlueTooth-Wlan coexistence module interface 36 * 37 * \see softGemini.h 38 */ 39 40 /**************************************************************************************************** 41 * * 42 * MODULE: softGemini.c * 43 * PURPOSE: BlueTooth-Wlan coexistence module interface. * 44 * This module handles all data base (and Fw setting accordingly) * 45 * for Bluetooth-Wlan coexistence implementation. * 46 * * 47 ****************************************************************************************************/ 48 49 #define __FILE_ID__ FILE_ID_5 50 #include "report.h" 51 #include "osApi.h" 52 #include "SoftGemini.h" 53 #include "DataCtrl_Api.h" 54 #include "scrApi.h" 55 #include "PowerMgr_API.h" 56 #include "ScanCncn.h" 57 #include "currBss.h" 58 #include "CmdDispatcher.h" 59 #include "TWDriver.h" 60 #include "DrvMainModules.h" 61 #include "bssTypes.h" 62 #include "sme.h" 63 64 65 #define SENSE_MODE_ENABLE 0x01 66 #define SENSE_MODE_DISABLE 0x00 67 #define PROTECTIVE_MODE_ON 0x01 68 #define PROTECTIVE_MODE_OFF 0x00 69 70 /********************************************************************************/ 71 /* Internal functions prototypes. */ 72 /********************************************************************************/ 73 74 static TI_STATUS SoftGemini_setEnableParam(TI_HANDLE hSoftGemini, ESoftGeminiEnableModes SoftGeminiEnable, TI_BOOL recovery); 75 static TI_STATUS SoftGemini_setParamsToFW(TI_HANDLE hSoftGemini, TSoftGeminiParams *SoftGeminiParam); 76 static TI_STATUS SoftGemini_EnableDriver(TI_HANDLE hSoftGemini); 77 static TI_STATUS SoftGemini_DisableDriver(TI_HANDLE hSoftGemini); 78 static TI_STATUS SoftGemini_SetPS(SoftGemini_t *pSoftGemini); 79 static TI_STATUS SoftGemini_unSetPS(SoftGemini_t *pSoftGemini); 80 static void SoftGemini_RemoveProtectiveModeParameters(TI_HANDLE hSoftGemini); 81 static void SoftGemini_setConfigParam(TI_HANDLE hSoftGemini, TI_UINT32 *param); 82 static void SoftGemini_EnableProtectiveMode(TI_HANDLE hSoftGemini); 83 static void SoftGemini_DisableProtectiveMode(TI_HANDLE hSoftGemini); 84 #ifdef REPORT_LOG 85 static char* SoftGemini_ConvertModeToString(ESoftGeminiEnableModes SoftGeminiEnable); 86 #endif 87 88 /********************************************************************************/ 89 /* Interface functions Implementation. */ 90 /********************************************************************************/ 91 /************************************************************************ 92 * SoftGemini_SetPSmode * 93 ************************************************************************ 94 DESCRIPTION: SoftGemini module, called by the conn_Infra on connection 95 performs the following: 96 - Enables SG if needed 97 - Enables the SG power mode 98 INPUT: hSoftGemini - Handle to SoftGemini 99 100 OUTPUT: 101 102 RETURN: 103 104 ************************************************************************/ 105 void SoftGemini_SetPSmode(TI_HANDLE hSoftGemini) 106 { 107 SoftGemini_t *pSoftGemini = (SoftGemini_t *)hSoftGemini; 108 109 if (pSoftGemini) 110 { 111 if (pSoftGemini->bDriverEnabled) 112 { 113 /* Check if coexAutoPsMode is enabled to enter/exit P.S */ 114 if ( pSoftGemini->SoftGeminiParam.coexParams[SOFT_GEMINI_AUTO_PS_MODE]) 115 { 116 SoftGemini_SetPS(pSoftGemini); 117 } 118 } 119 if (pSoftGemini->bProtectiveMode) 120 { 121 SoftGemini_EnableProtectiveMode(hSoftGemini); 122 } 123 } 124 else 125 { 126 TRACE0(pSoftGemini->hReport, REPORT_SEVERITY_ERROR, " SoftGemini_SetPSmode() - Error hSoftGemini= NULL \n"); 127 } 128 } 129 130 /************************************************************************ 131 * SoftGemini_unSetPSmode * 132 ************************************************************************ 133 DESCRIPTION: SoftGemini module, called by the conn_Infra after disconnecting 134 performs the following: 135 - Disables the SG 136 - Disables the SG power mode 137 INPUT: hSoftGemini - Handle to SoftGemini 138 139 OUTPUT: 140 141 RETURN: 142 143 ************************************************************************/ 144 void SoftGemini_unSetPSmode(TI_HANDLE hSoftGemini) 145 { 146 SoftGemini_t *pSoftGemini = (SoftGemini_t *)hSoftGemini; 147 148 if (pSoftGemini) 149 { 150 if (pSoftGemini->bDriverEnabled) 151 { 152 /* Check if coexAutoPsMode is enabled to enter/exit P.S */ 153 if ( pSoftGemini->SoftGeminiParam.coexParams[SOFT_GEMINI_AUTO_PS_MODE]) 154 { 155 SoftGemini_unSetPS(pSoftGemini); 156 } 157 } 158 if (pSoftGemini->bProtectiveMode) 159 { 160 SoftGemini_RemoveProtectiveModeParameters(hSoftGemini); 161 } 162 } 163 else 164 { 165 TRACE0(pSoftGemini->hReport, REPORT_SEVERITY_ERROR, " SoftGemini_unSetPSmode() - Error hSoftGemini= NULL \n"); 166 } 167 } 168 169 /************************************************************************ 170 * SoftGemini_create * 171 ************************************************************************ 172 DESCRIPTION: SoftGemini module creation function, called by the config mgr in creation phase 173 performs the following: 174 - Allocate the SoftGemini handle 175 176 INPUT: hOs - Handle to OS 177 178 179 OUTPUT: 180 181 RETURN: Handle to the SoftGemini module on success, NULL otherwise 182 183 ************************************************************************/ 184 TI_HANDLE SoftGemini_create(TI_HANDLE hOs) 185 { 186 SoftGemini_t *pSoftGemini = NULL; 187 188 /* allocating the SoftGemini object */ 189 pSoftGemini = os_memoryAlloc(hOs,sizeof(SoftGemini_t)); 190 191 if (pSoftGemini == NULL) 192 return NULL; 193 194 pSoftGemini->hOs = hOs; 195 196 return pSoftGemini; 197 } 198 199 /************************************************************************ 200 * SoftGemini_config * 201 ************************************************************************ 202 DESCRIPTION: SoftGemini module init function, called by the rvMain in init phase 203 performs the following: 204 - Init local variables 205 - Init the handles to be used by the module 206 207 INPUT: pStadHandles - The driver modules handles 208 209 OUTPUT: 210 211 RETURN: void 212 ************************************************************************/ 213 void SoftGemini_init (TStadHandlesList *pStadHandles) 214 { 215 SoftGemini_t *pSoftGemini = (SoftGemini_t *)(pStadHandles->hSoftGemini); 216 217 pSoftGemini->hCtrlData = pStadHandles->hCtrlData; 218 pSoftGemini->hTWD = pStadHandles->hTWD; 219 pSoftGemini->hReport = pStadHandles->hReport; 220 pSoftGemini->hSCR = pStadHandles->hSCR; 221 pSoftGemini->hPowerMgr = pStadHandles->hPowerMgr; 222 pSoftGemini->hCmdDispatch = pStadHandles->hCmdDispatch; 223 pSoftGemini->hScanCncn = pStadHandles->hScanCncn; 224 pSoftGemini->hCurrBss = pStadHandles->hCurrBss; 225 pSoftGemini->hSme = pStadHandles->hSme; 226 } 227 228 229 TI_STATUS SoftGemini_SetDefaults (TI_HANDLE hSoftGemini, SoftGeminiInitParams_t *pSoftGeminiInitParams) 230 { 231 SoftGemini_t *pSoftGemini = (SoftGemini_t *)hSoftGemini; 232 TI_UINT8 i =0; 233 TI_STATUS status; 234 /*************************************/ 235 /* Getting SoftGemini init Params */ 236 /***********************************/ 237 238 pSoftGemini->SoftGeminiEnable = pSoftGeminiInitParams->SoftGeminiEnable; 239 240 for (i =0; i< SOFT_GEMINI_PARAMS_MAX ; i++) 241 { 242 pSoftGemini->SoftGeminiParam.coexParams[i] = pSoftGeminiInitParams->coexParams[i]; 243 } 244 245 pSoftGemini->SoftGeminiParam.paramIdx = 0xFF; /* signals to FW to config all the paramters */ 246 247 248 /* Send the configuration to the FW */ 249 status = SoftGemini_setParamsToFW(hSoftGemini, &pSoftGemini->SoftGeminiParam); 250 251 /*******************************/ 252 /* register Indication interrupts */ 253 /*****************************/ 254 255 TWD_RegisterEvent (pSoftGemini->hTWD, 256 TWD_OWN_EVENT_SOFT_GEMINI_SENSE, 257 (void *)SoftGemini_SenseIndicationCB, 258 hSoftGemini); 259 TWD_RegisterEvent (pSoftGemini->hTWD, 260 TWD_OWN_EVENT_SOFT_GEMINI_PREDIC, 261 (void *)SoftGemini_ProtectiveIndicationCB, 262 hSoftGemini); 263 264 TWD_EnableEvent (pSoftGemini->hTWD, TWD_OWN_EVENT_SOFT_GEMINI_SENSE); 265 TWD_EnableEvent (pSoftGemini->hTWD, TWD_OWN_EVENT_SOFT_GEMINI_PREDIC); 266 267 /* On system initialization SG is disabled but later calls to SoftGemini_setEnableParam() */ 268 pSoftGemini->bProtectiveMode = TI_FALSE; 269 pSoftGemini->SoftGeminiEnable = SG_DISABLE; 270 pSoftGemini->bDriverEnabled = TI_FALSE; 271 pSoftGemini->bPsPollFailureActive = TI_FALSE; 272 273 if ((TI_OK == status) && (pSoftGeminiInitParams->SoftGeminiEnable != SG_DISABLE)) 274 { /* called only if different than SG_DISABLE */ 275 status = SoftGemini_setEnableParam(hSoftGemini, pSoftGeminiInitParams->SoftGeminiEnable, TI_FALSE); 276 } 277 278 if (status == TI_OK) 279 { 280 TRACE0(pSoftGemini->hReport, REPORT_SEVERITY_INIT, " SoftGemini_config() - configured successfully\n"); 281 } 282 else 283 { 284 TRACE0(pSoftGemini->hReport, REPORT_SEVERITY_ERROR, " SoftGemini_config() - Error configuring module \n"); 285 } 286 287 return status; 288 } 289 290 /************************************************************************ 291 * SoftGemini_destroy * 292 ************************************************************************ 293 DESCRIPTION: SoftGemini module destroy function, called by the config mgr in the destroy phase 294 performs the following: 295 - Free all memory aloocated by the module 296 297 INPUT: hSoftGemini - SoftGemini handle. 298 299 300 OUTPUT: 301 302 RETURN: TI_OK on success, TI_NOK otherwise 303 304 ************************************************************************/ 305 TI_STATUS SoftGemini_destroy(TI_HANDLE hSoftGemini) 306 { 307 SoftGemini_t *pSoftGemini = (SoftGemini_t *)hSoftGemini; 308 309 if (pSoftGemini != NULL) 310 { 311 os_memoryFree( pSoftGemini->hOs, (TI_HANDLE)pSoftGemini , sizeof(SoftGemini_t)); 312 } 313 314 return TI_OK; 315 } 316 317 318 /*********************************************************************** 319 * SoftGemini_setParam 320 *********************************************************************** 321 DESCRIPTION: SoftGemini set param function, called by the following: 322 - config mgr in order to set a parameter receiving from the OS abstraction layer. 323 - From inside the driver 324 325 INPUT: hSoftGemini - SoftGemini handle. 326 pParam - Pointer to the parameter 327 328 OUTPUT: 329 330 RETURN: TI_OK on success, TI_NOK otherwise 331 332 ************************************************************************/ 333 TI_STATUS SoftGemini_setParam(TI_HANDLE hSoftGemini, 334 paramInfo_t *pParam) 335 { 336 SoftGemini_t *pSoftGemini = (SoftGemini_t *)hSoftGemini; 337 TI_STATUS return_value = TI_OK; 338 339 TRACE1(pSoftGemini->hReport, REPORT_SEVERITY_INFORMATION, " SoftGemini_setParam() (0x%x)\n", pParam->paramType); 340 341 switch(pParam->paramType) 342 { 343 344 case SOFT_GEMINI_SET_ENABLE: 345 346 return_value = SoftGemini_setEnableParam(hSoftGemini,pParam->content.SoftGeminiEnable, TI_FALSE); 347 break; 348 349 case SOFT_GEMINI_SET_CONFIG: 350 351 /* copy new params to SoftGemini module */ 352 SoftGemini_setConfigParam(hSoftGemini,pParam->content.SoftGeminiParamArray); 353 354 /* set new params to FW */ 355 return_value = SoftGemini_setParamsToFW(hSoftGemini, &(pSoftGemini->SoftGeminiParam)); 356 357 if (pSoftGemini->bProtectiveMode == TI_TRUE) 358 { 359 /* set new configurations of scan to scancncn */ 360 scanCncn_SGconfigureScanParams(pSoftGemini->hScanCncn,TI_TRUE, 361 (TI_UINT8)pSoftGemini->SoftGeminiParam.coexParams[SOFT_GEMINI_AUTO_SCAN_PROBE_REQ], 362 pSoftGemini->SoftGeminiParam.coexParams[SOFT_GEMINI_HV3_MAX_OVERRIDE], 363 pSoftGemini->SoftGeminiParam.coexParams[SOFT_GEMINI_ACTIVE_SCAN_DURATION_FACTOR_HV3]); 364 } 365 break; 366 367 default: 368 TRACE1(pSoftGemini->hReport, REPORT_SEVERITY_ERROR, " SoftGemini_setParam(), Params is not supported, %d\n\n", pParam->paramType); 369 return PARAM_NOT_SUPPORTED; 370 } 371 372 return return_value; 373 } 374 375 /*********************************************************************** 376 * SoftGemini_getParam 377 *********************************************************************** 378 DESCRIPTION: SoftGemini get param function, called by the following: 379 - config mgr in order to get a parameter from the OS abstraction layer. 380 - From inside the dirver 381 382 INPUT: hSoftGemini - SoftGemini handle. 383 384 385 OUTPUT: pParam - Pointer to the parameter 386 387 RETURN: TI_OK on success, TI_NOK otherwise 388 389 ************************************************************************/ 390 TI_STATUS SoftGemini_getParam(TI_HANDLE hSoftGemini, 391 paramInfo_t *pParam) 392 { 393 switch (pParam->paramType) 394 { 395 case SOFT_GEMINI_GET_CONFIG: 396 SoftGemini_printParams(hSoftGemini); 397 break; 398 } 399 400 return TI_OK; 401 } 402 403 404 405 /*************************************************************************** 406 * SoftGemini_setEnableParam * 407 **************************************************************************** 408 * DESCRIPTION: The function sets the appropriate Enable value, 409 * configures SCR , POWER MGR , DATA CTRL , FW. 410 * 411 * INPUTS: pSoftGemini - the object 412 ***************************************************************************/ 413 static TI_STATUS SoftGemini_setEnableParam(TI_HANDLE hSoftGemini, ESoftGeminiEnableModes SoftGeminiEnable, TI_BOOL recovery) 414 { 415 SoftGemini_t *pSoftGemini = (SoftGemini_t *)hSoftGemini; 416 TTwdParamInfo param; 417 TI_STATUS return_value = TI_OK; 418 419 TRACE0(pSoftGemini->hReport, REPORT_SEVERITY_INFORMATION, " setSoftGeminiEnableParam() - Old value = , New value = \n"); 420 421 422 /* 423 * PsPoll work around is active. Just save the value and configure it later 424 */ 425 if ( pSoftGemini->bPsPollFailureActive ) 426 { 427 TRACE0(pSoftGemini->hReport, REPORT_SEVERITY_INFORMATION, " setSoftGeminiEnableParam() - while PsPollFailure is active\n"); 428 429 pSoftGemini->PsPollFailureLastEnableValue = SoftGeminiEnable; 430 return TI_OK; 431 } 432 433 /**********************************/ 434 /* Sanity check on enable values */ 435 /********************************/ 436 437 /* Old Value New Value */ 438 /* | | */ 439 /* \|/ \|/ */ 440 441 if ((pSoftGemini->SoftGeminiEnable == SoftGeminiEnable) && !recovery) 442 { 443 TRACE0(pSoftGemini->hReport, REPORT_SEVERITY_ERROR, " - setting same value \n"); 444 return TI_NOK; 445 } 446 447 /*******************************/ 448 /* Make the necessary actions */ 449 /*****************************/ 450 451 switch (SoftGeminiEnable) 452 { 453 case SG_PROTECTIVE: 454 case SG_OPPORTUNISTIC: 455 456 /* set FW with SG_ENABLE */ 457 param.paramType = TWD_SG_ENABLE_PARAM_ID; 458 param.content.SoftGeminiEnable = SoftGeminiEnable; 459 return_value = TWD_SetParam (pSoftGemini->hTWD, ¶m); 460 461 break; 462 463 case SG_DISABLE: 464 465 /* set FW with SG_DISABLE */ 466 param.paramType = TWD_SG_ENABLE_PARAM_ID; 467 param.content.SoftGeminiEnable = SG_DISABLE; 468 return_value = TWD_SetParam (pSoftGemini->hTWD, ¶m); 469 470 if (pSoftGemini->bDriverEnabled) 471 { 472 SoftGemini_DisableDriver(hSoftGemini); 473 } 474 475 break; 476 477 default: 478 TRACE1(pSoftGemini->hReport, REPORT_SEVERITY_ERROR, " defualt :%d\n",SoftGeminiEnable); 479 return TI_NOK; 480 } 481 482 /* Pass to the new enable state */ 483 pSoftGemini->SoftGeminiEnable = SoftGeminiEnable; 484 485 if (TI_OK != return_value) 486 { 487 TRACE0(pSoftGemini->hReport, REPORT_SEVERITY_ERROR, " can't configure enable param to FW :\n"); 488 } 489 490 return return_value; 491 } 492 493 /*************************************************************************** 494 * SoftGemini_setConfigParam * 495 **************************************************************************** 496 * DESCRIPTION: The function sets params 497 * 498 * INPUTS: pSoftGemini - the object 499 * param - params to be configured 500 ***************************************************************************/ 501 static void SoftGemini_setConfigParam(TI_HANDLE hSoftGemini, TI_UINT32 *param) 502 { 503 SoftGemini_t *pSoftGemini = (SoftGemini_t *)hSoftGemini; 504 505 /* param[0] - SG parameter index, param[1] - SG parameter value */ 506 pSoftGemini->SoftGeminiParam.coexParams[(TI_UINT8)param[0]] = (TI_UINT32)param[1]; 507 pSoftGemini->SoftGeminiParam.paramIdx = (TI_UINT8)param[0]; 508 } 509 510 /*************************************************************************** 511 * SoftGemini_printParams * 512 **************************************************************************** 513 * DESCRIPTION: Print SG Parameters. 514 * 515 * INPUTS: pSoftGemini - the object 516 ***************************************************************************/ 517 void SoftGemini_printParams(TI_HANDLE hSoftGemini) 518 { 519 #ifdef REPORT_LOG 520 521 SoftGemini_t *pSoftGemini = (SoftGemini_t *)hSoftGemini; 522 TSoftGeminiParams *SoftGeminiParam = &pSoftGemini->SoftGeminiParam; 523 524 WLAN_OS_REPORT(("[0]: coexBtPerThreshold = %d\n", SoftGeminiParam->coexParams[SOFT_GEMINI_BT_PER_THRESHOLD])); 525 WLAN_OS_REPORT(("[1]: coexHv3MaxOverride = %d \n", SoftGeminiParam->coexParams[SOFT_GEMINI_HV3_MAX_OVERRIDE])); 526 WLAN_OS_REPORT(("[2]: coexBtNfsSampleInterval = %d (msec)\n", SoftGeminiParam->coexParams[SOFT_GEMINI_BT_NFS_SAMPLE_INTERVAL])); 527 WLAN_OS_REPORT(("[3]: coexBtLoadRatio = %d (%)\n", SoftGeminiParam->coexParams[SOFT_GEMINI_BT_LOAD_RATIO])); 528 WLAN_OS_REPORT(("[4]: coexAutoPsMode = %s \n", (SoftGeminiParam->coexParams[SOFT_GEMINI_AUTO_PS_MODE]?"Enabled":"Disabled"))); 529 WLAN_OS_REPORT(("[5]: coexAutoScanEnlargedNumOfProbeReqPercent = %d (%)\n", SoftGeminiParam->coexParams[SOFT_GEMINI_AUTO_SCAN_PROBE_REQ])); 530 WLAN_OS_REPORT(("[6]: coexHv3AutoScanEnlargedScanWinodowPercent = %d (%)\n", SoftGeminiParam->coexParams[SOFT_GEMINI_ACTIVE_SCAN_DURATION_FACTOR_HV3])); 531 WLAN_OS_REPORT(("[7]: coexAntennaConfiguration = %s (0 = Single, 1 = Dual) \n", (SoftGeminiParam->coexParams[SOFT_GEMINI_ANTENNA_CONFIGURATION]?"Dual":"Single"))); 532 WLAN_OS_REPORT(("[8]: coexMaxConsecutiveBeaconMissPrecent = %d (%)\n", SoftGeminiParam->coexParams[SOFT_GEMINI_BEACON_MISS_PERCENT])); 533 WLAN_OS_REPORT(("[9]: coexAPRateAdapationThr = %d\n", SoftGeminiParam->coexParams[SOFT_GEMINI_RATE_ADAPT_THRESH])); 534 WLAN_OS_REPORT(("[10]: coexAPRateAdapationSnr = %d\n", SoftGeminiParam->coexParams[SOFT_GEMINI_RATE_ADAPT_SNR])); 535 WLAN_OS_REPORT(("[11]: coexWlanPsBtAclMasterMinBR = %d (msec)\n", SoftGeminiParam->coexParams[SOFT_GEMINI_WLAN_PS_BT_ACL_MASTER_MIN_BR])); 536 WLAN_OS_REPORT(("[12]: coexWlanPsBtAclMasterMaxBR = %d (msec)\n", SoftGeminiParam->coexParams[SOFT_GEMINI_WLAN_PS_BT_ACL_MASTER_MAX_BR])); 537 WLAN_OS_REPORT(("[13]: coexWlanPsMaxBtAclMasterBR = %d (msec)\n", SoftGeminiParam->coexParams[SOFT_GEMINI_WLAN_PS_MAX_BT_ACL_MASTER_BR])); 538 WLAN_OS_REPORT(("[14]: coexWlanPsBtAclSlaveMinBR = %d (msec)\n", SoftGeminiParam->coexParams[SOFT_GEMINI_WLAN_PS_BT_ACL_SLAVE_MIN_BR])); 539 WLAN_OS_REPORT(("[15]: coexWlanPsBtAclSlaveMaxBR = %d (msec)\n", SoftGeminiParam->coexParams[SOFT_GEMINI_WLAN_PS_BT_ACL_SLAVE_MAX_BR])); 540 WLAN_OS_REPORT(("[16]: coexWlanPsMaxBtAclSlaveBR = %d (msec)\n", SoftGeminiParam->coexParams[SOFT_GEMINI_WLAN_PS_MAX_BT_ACL_SLAVE_BR])); 541 WLAN_OS_REPORT(("[17]: coexWlanPsBtAclMasterMinEDR = %d (msec)\n", SoftGeminiParam->coexParams[SOFT_GEMINI_WLAN_PS_BT_ACL_MASTER_MIN_EDR])); 542 WLAN_OS_REPORT(("[18]: coexWlanPsBtAclMasterMaxEDR = %d (msec)\n", SoftGeminiParam->coexParams[SOFT_GEMINI_WLAN_PS_BT_ACL_MASTER_MAX_EDR])); 543 WLAN_OS_REPORT(("[19]: coexWlanPsMaxBtAclMasterEDR = %d (msec)\n", SoftGeminiParam->coexParams[SOFT_GEMINI_WLAN_PS_MAX_BT_ACL_MASTER_EDR])); 544 WLAN_OS_REPORT(("[20]: coexWlanPsBtAclSlaveMinEDR = %d (msec)\n", SoftGeminiParam->coexParams[SOFT_GEMINI_WLAN_PS_BT_ACL_SLAVE_MIN_EDR])); 545 WLAN_OS_REPORT(("[21]: coexWlanPsBtAclSlaveMaxEDR = %d (msec)\n", SoftGeminiParam->coexParams[SOFT_GEMINI_WLAN_PS_BT_ACL_SLAVE_MAX_EDR])); 546 WLAN_OS_REPORT(("[22]: coexWlanPsMaxBtAclSlaveEDR = %d (msec)\n", SoftGeminiParam->coexParams[SOFT_GEMINI_WLAN_PS_MAX_BT_ACL_SLAVE_EDR])); 547 WLAN_OS_REPORT(("[23]: coexRxt = %d (usec)\n", SoftGeminiParam->coexParams[SOFT_GEMINI_RXT])); 548 WLAN_OS_REPORT(("[24]: coexTxt = %d (usec)\n", SoftGeminiParam->coexParams[SOFT_GEMINI_TXT])); 549 WLAN_OS_REPORT(("[25]: coexAdaptiveRxtTxt = %s \n", (SoftGeminiParam->coexParams[SOFT_GEMINI_ADAPTIVE_RXT_TXT]?"Enabled":"Disabled"))); 550 WLAN_OS_REPORT(("[26]: coexPsPollTimeout = %d (msec)\n", SoftGeminiParam->coexParams[SOFT_GEMINI_PS_POLL_TIMEOUT])); 551 WLAN_OS_REPORT(("[27]: coexUpsdTimeout = %d (msec) \n", SoftGeminiParam->coexParams[SOFT_GEMINI_UPSD_TIMEOUT])); 552 WLAN_OS_REPORT(("[28]: coexWlanActiveBtAclMasterMinEDR = %d (msec)\n", SoftGeminiParam->coexParams[SOFT_GEMINI_WLAN_ACTIVE_BT_ACL_MASTER_MIN_EDR])); 553 WLAN_OS_REPORT(("[29]: coexWlanActiveBtAclMasterMaxEDR = %d (msec)\n", SoftGeminiParam->coexParams[SOFT_GEMINI_WLAN_ACTIVE_BT_ACL_MASTER_MAX_EDR])); 554 WLAN_OS_REPORT(("[30]: coexWlanActiveMaxBtAclMasterEDR = %d (msec)\n", SoftGeminiParam->coexParams[SOFT_GEMINI_WLAN_ACTIVE_MAX_BT_ACL_MASTER_EDR])); 555 WLAN_OS_REPORT(("[31]: coexWlanActiveBtAclSlaveMinEDR = %d (msec)\n", SoftGeminiParam->coexParams[SOFT_GEMINI_WLAN_ACTIVE_BT_ACL_SLAVE_MIN_EDR])); 556 WLAN_OS_REPORT(("[32]: coexWlanActiveBtAclSlaveMaxEDR = %d (msec)\n", SoftGeminiParam->coexParams[SOFT_GEMINI_WLAN_ACTIVE_BT_ACL_SLAVE_MAX_EDR])); 557 WLAN_OS_REPORT(("[33]: coexWlanActiveMaxBtAclSlaveEDR = %d (msec)\n", SoftGeminiParam->coexParams[SOFT_GEMINI_WLAN_ACTIVE_MAX_BT_ACL_SLAVE_EDR])); 558 WLAN_OS_REPORT(("[34]: coexWlanActiveBtAclMinBR = %d (msec)\n", SoftGeminiParam->coexParams[SOFT_GEMINI_WLAN_ACTIVE_BT_ACL_MIN_BR])); 559 WLAN_OS_REPORT(("[35]: coexWlanActiveBtAclMinBr = %d (msec)\n", SoftGeminiParam->coexParams[SOFT_GEMINI_WLAN_ACTIVE_BT_ACL_MAX_BR])); 560 WLAN_OS_REPORT(("[36]: coexWlanActiveMaxBtAclBr = %d (msec)\n", SoftGeminiParam->coexParams[SOFT_GEMINI_WLAN_ACTIVE_MAX_BT_ACL_BR])); 561 WLAN_OS_REPORT(("[37]: coexHv3AutoEnlargePassiveScanWindowPercent = %d (%)\n", SoftGeminiParam->coexParams[SOFT_GEMINI_PASSIVE_SCAN_DURATION_FACTOR_HV3])); 562 WLAN_OS_REPORT(("[38]: coexA2DPAutoEnlargePassiveScanWindowPercent = %d (%) \n", SoftGeminiParam->coexParams[SOFT_GEMINI_PASSIVE_SCAN_DURATION_FACTOR_A2DP])); 563 WLAN_OS_REPORT(("[39]: coexPassiveScanA2dpBtTime = %d (msec)\n", SoftGeminiParam->coexParams[SOFT_GEMINI_PASSIVE_SCAN_A2DP_BT_TIME])); 564 WLAN_OS_REPORT(("[40]: coexPassiveScanA2dpWlanTime = %d (msec)\n", SoftGeminiParam->coexParams[SOFT_GEMINI_PASSIVE_SCAN_A2DP_WLAN_TIME])); 565 WLAN_OS_REPORT(("[41]: CoexHv3MaxServed = %d \n", SoftGeminiParam->coexParams[SOFT_GEMINI_HV3_MAX_SERVED])); 566 WLAN_OS_REPORT(("[42]: coexDhcpTime = %d (msec)\n", SoftGeminiParam->coexParams[SOFT_GEMINI_DHCP_TIME])); 567 WLAN_OS_REPORT(("[43]: coexA2dpAutoScanEnlargedScanWinodowPercent = %d (%)\n", SoftGeminiParam->coexParams[SOFT_GEMINI_ACTIVE_SCAN_DURATION_FACTOR_A2DP])); 568 WLAN_OS_REPORT(("[44]: coexTempParam1 = %d \n", SoftGeminiParam->coexParams[SOFT_GEMINI_TEMP_PARAM_1])); 569 WLAN_OS_REPORT(("[45]: coexTempParam2 = %d \n", SoftGeminiParam->coexParams[SOFT_GEMINI_TEMP_PARAM_2])); 570 WLAN_OS_REPORT(("[46]: coexTempParam3 = %d \n", SoftGeminiParam->coexParams[SOFT_GEMINI_TEMP_PARAM_3])); 571 WLAN_OS_REPORT(("[47]: coexTempParam4 = %d \n", SoftGeminiParam->coexParams[SOFT_GEMINI_TEMP_PARAM_4])); 572 WLAN_OS_REPORT(("[48]: coexTempParam5 = %d \n", SoftGeminiParam->coexParams[SOFT_GEMINI_TEMP_PARAM_5])); 573 WLAN_OS_REPORT(("Enable mode : %s\n", SoftGemini_ConvertModeToString(pSoftGemini->SoftGeminiEnable))); 574 WLAN_OS_REPORT(("Driver Enabled : %s\n",(pSoftGemini->bDriverEnabled ? "YES" : "NO"))); 575 WLAN_OS_REPORT(("Protective mode : %s\n", (pSoftGemini->bProtectiveMode ? "ON" : "OFF"))); 576 WLAN_OS_REPORT(("PsPoll failure active : %s\n", (pSoftGemini->bPsPollFailureActive ? "YES" : "NO"))); 577 578 #endif 579 } 580 581 /*************************************************************************** 582 * SoftGemini_setParamsToFW * 583 **************************************************************************** 584 * DESCRIPTION: The function sets the FW with the appropriate parameters set. 585 * 586 * INPUTS: pSoftGemini - the object 587 * 588 * 589 * OUTPUT: 590 * 591 * RETURNS: 592 ***************************************************************************/ 593 static TI_STATUS SoftGemini_setParamsToFW(TI_HANDLE hSoftGemini, TSoftGeminiParams *softGeminiParams) 594 { 595 SoftGemini_t *pSoftGemini = (SoftGemini_t *)hSoftGemini; 596 TTwdParamInfo param; 597 598 os_memoryCopy(pSoftGemini->hOs,¶m.content.SoftGeminiParam, softGeminiParams, sizeof(TSoftGeminiParams)); 599 param.paramType = TWD_SG_CONFIG_PARAM_ID; 600 return TWD_SetParam (pSoftGemini->hTWD, ¶m); 601 } 602 603 604 /*************************************************************************** 605 * SoftGemini_EnableDriver * 606 **************************************************************************** 607 * DESCRIPTION: Activated when SG is enabled (after CLI or FW command) 608 * 609 * INPUTS: pSoftGemini - the object 610 * 611 ***************************************************************************/ 612 static TI_STATUS SoftGemini_EnableDriver(TI_HANDLE hSoftGemini) 613 { 614 SoftGemini_t *pSoftGemini = (SoftGemini_t *)hSoftGemini; 615 TI_STATUS return_value = TI_OK; 616 617 TRACE0(pSoftGemini->hReport, REPORT_SEVERITY_INFORMATION, "\n"); 618 619 pSoftGemini->bDriverEnabled = TI_TRUE; 620 621 /* Check if coexAutoPsMode - Co-ex is enabled to enter/exit P.S */ 622 if ( pSoftGemini->SoftGeminiParam.coexParams[SOFT_GEMINI_AUTO_PS_MODE]) 623 { 624 SoftGemini_SetPS(pSoftGemini); 625 } 626 627 scr_setMode(pSoftGemini->hSCR, SCR_MID_SG); 628 629 return return_value; 630 } 631 632 /*************************************************************************** 633 * SoftGemini_DisableDriver * 634 **************************************************************************** 635 * DESCRIPTION: Activated when SG is disabled (after CLI or FW command) 636 * 637 * INPUTS: pSoftGemini - the object 638 * 639 ***************************************************************************/ 640 static TI_STATUS SoftGemini_DisableDriver(TI_HANDLE hSoftGemini) 641 { 642 SoftGemini_t *pSoftGemini = (SoftGemini_t *)hSoftGemini; 643 TI_STATUS return_value = TI_OK; 644 645 TRACE0(pSoftGemini->hReport, REPORT_SEVERITY_INFORMATION, "\n"); 646 647 pSoftGemini->bDriverEnabled = TI_FALSE; 648 649 scr_setMode(pSoftGemini->hSCR, SCR_MID_NORMAL); 650 651 652 /* Check if coexAutoPsMode - Co-ex is enabled to enter/exit P.S */ 653 if ( pSoftGemini->SoftGeminiParam.coexParams[SOFT_GEMINI_AUTO_PS_MODE]) 654 { 655 SoftGemini_unSetPS(pSoftGemini); 656 } 657 658 /* Undo the changes that were made when Protective mode was on */ 659 if (pSoftGemini->bProtectiveMode) 660 { 661 SoftGemini_DisableProtectiveMode(hSoftGemini); 662 } 663 664 return return_value; 665 } 666 667 /*************************************************************************** 668 * SoftGemini_SetPS * 669 **************************************************************************** 670 * DESCRIPTION: Set Always PS to PowerMgr 671 * 672 * INPUTS: pSoftGemini - the object 673 * 674 ***************************************************************************/ 675 static TI_STATUS SoftGemini_SetPS(SoftGemini_t *pSoftGemini) 676 { 677 paramInfo_t param; 678 bssEntry_t *pBssInfo=NULL; 679 680 if (pSoftGemini->hCurrBss) 681 { 682 pBssInfo = currBSS_getBssInfo(pSoftGemini->hCurrBss); 683 } 684 else 685 { 686 TRACE0(pSoftGemini->hReport, REPORT_SEVERITY_ERROR, "SoftGemini_SetPS: hCurrBss = NULL!!!\n"); 687 } 688 689 TRACE0(pSoftGemini->hReport, REPORT_SEVERITY_INFORMATION, "\n"); 690 691 if (pBssInfo) 692 { 693 if ((pBssInfo->band == RADIO_BAND_2_4_GHZ)) 694 { 695 TRACE0(pSoftGemini->hReport, REPORT_SEVERITY_INFORMATION, " SG-setPS: band == RADIO_BAND_2_4_GHZ"); 696 697 /* Set Params to Power Mgr for SG priority */ 698 param.paramType = POWER_MGR_POWER_MODE; 699 param.content.powerMngPowerMode.PowerMode = POWER_MODE_PS_ONLY; 700 param.content.powerMngPowerMode.PowerMngPriority = POWER_MANAGER_SG_PRIORITY; 701 powerMgr_setParam(pSoftGemini->hPowerMgr,¶m); 702 703 /* enable SG priority for Power Mgr */ 704 param.paramType = POWER_MGR_ENABLE_PRIORITY; 705 param.content.powerMngPriority = POWER_MANAGER_SG_PRIORITY; 706 return powerMgr_setParam(pSoftGemini->hPowerMgr,¶m); 707 } 708 else 709 { 710 TRACE0(pSoftGemini->hReport, REPORT_SEVERITY_INFORMATION, " SG-setPS: band == RADIO_BAND_5_GHZ"); 711 } 712 } 713 return TI_OK; 714 } 715 716 /*************************************************************************** 717 * SoftGemini_unSetPS * 718 **************************************************************************** 719 * DESCRIPTION: unSet Always PS to PowerMgr 720 * 721 * INPUTS: pSoftGemini - the object 722 * 723 ***************************************************************************/ 724 static TI_STATUS SoftGemini_unSetPS(SoftGemini_t *pSoftGemini) 725 { 726 paramInfo_t param; 727 728 TRACE0(pSoftGemini->hReport, REPORT_SEVERITY_INFORMATION, ", SG-unSetPS \n"); 729 730 /* disable SG priority for Power Mgr*/ 731 param.paramType = POWER_MGR_DISABLE_PRIORITY; 732 param.content.powerMngPriority = POWER_MANAGER_SG_PRIORITY; 733 return powerMgr_setParam(pSoftGemini->hPowerMgr,¶m); 734 735 } 736 737 /*************************************************************************** 738 * SoftGemini_EnableProtectiveMode * 739 **************************************************************************** 740 * DESCRIPTION: Activated when FW inform us that protective mode is ON 741 * 742 * 743 * INPUTS: pSoftGemini - the object 744 * 745 ***************************************************************************/ 746 void SoftGemini_EnableProtectiveMode(TI_HANDLE hSoftGemini) 747 { 748 SoftGemini_t *pSoftGemini = (SoftGemini_t *)hSoftGemini; 749 paramInfo_t param; 750 751 pSoftGemini->bProtectiveMode = TI_TRUE; 752 753 /* set new configurations of SG roaming parameters */ 754 755 /* This code should be removed on SG stage 2 integration 756 currBSS_SGconfigureBSSLoss(pSoftGemini->hCurrBss,pSoftGemini->BSSLossCompensationPercent,TI_TRUE); */ 757 758 /* set new configurations of scan to scancncn */ 759 scanCncn_SGconfigureScanParams(pSoftGemini->hScanCncn,TI_TRUE, 760 (TI_UINT8)pSoftGemini->SoftGeminiParam.coexParams[SOFT_GEMINI_AUTO_SCAN_PROBE_REQ], 761 pSoftGemini->SoftGeminiParam.coexParams[SOFT_GEMINI_HV3_MAX_OVERRIDE], 762 pSoftGemini->SoftGeminiParam.coexParams[SOFT_GEMINI_ACTIVE_SCAN_DURATION_FACTOR_HV3]); 763 764 /* Call the power manager to enter short doze */ 765 TRACE0(pSoftGemini->hReport, REPORT_SEVERITY_INFORMATION, " SoftGemini_EnableProtectiveMode set SD"); 766 767 /* Set Params to Power Mgr for SG priority */ 768 param.paramType = POWER_MGR_POWER_MODE; 769 param.content.powerMngPowerMode.PowerMode = POWER_MODE_SHORT_DOZE; 770 param.content.powerMngPowerMode.PowerMngPriority = POWER_MANAGER_SG_PRIORITY; 771 powerMgr_setParam(pSoftGemini->hPowerMgr,¶m); 772 } 773 774 /*************************************************************************** 775 * SoftGemini_DisableProtectiveMode * 776 **************************************************************************** 777 * DESCRIPTION: Activated when FW inform us that protective mode is OFF or SG is disabled 778 * 779 * INPUTS: pSoftGemini - the object 780 * 781 ***************************************************************************/ 782 void SoftGemini_DisableProtectiveMode(TI_HANDLE hSoftGemini) 783 { 784 SoftGemini_t *pSoftGemini = (SoftGemini_t *)hSoftGemini; 785 786 TRACE0(pSoftGemini->hReport, REPORT_SEVERITY_INFORMATION, "\n"); 787 788 pSoftGemini->bProtectiveMode = TI_FALSE; 789 790 SoftGemini_RemoveProtectiveModeParameters(hSoftGemini); 791 } 792 793 /*************************************************************************** 794 * SoftGemini_DisableProtectiveMode * 795 **************************************************************************** 796 * DESCRIPTION: Called from SoftGemini_DisableProtectiveMode() when FW inform 797 * us that protective mode is OFF or SG is disabled, or from 798 * SoftGemini_unSetPSmode() when driver disconnects from AP. 799 * 800 * INPUTS: pSoftGemini - the object 801 * 802 ***************************************************************************/ 803 804 void SoftGemini_RemoveProtectiveModeParameters(TI_HANDLE hSoftGemini) 805 { 806 SoftGemini_t *pSoftGemini = (SoftGemini_t *)hSoftGemini; 807 paramInfo_t param; 808 809 TRACE0(pSoftGemini->hReport, REPORT_SEVERITY_INFORMATION, "\n"); 810 811 /* don't use the SG roaming parameters */ 812 currBSS_SGconfigureBSSLoss(pSoftGemini->hCurrBss,0,TI_FALSE); 813 814 /* don't use the SG scan parameters */ 815 scanCncn_SGconfigureScanParams(pSoftGemini->hScanCncn,TI_FALSE,0,0,0); 816 817 /* Call the power manager to exit short doze */ 818 /* Set Params to Power Mgr for SG priority */ 819 param.paramType = POWER_MGR_POWER_MODE; 820 param.content.powerMngPowerMode.PowerMode = POWER_MODE_PS_ONLY; 821 param.content.powerMngPowerMode.PowerMngPriority = POWER_MANAGER_SG_PRIORITY; 822 powerMgr_setParam(pSoftGemini->hPowerMgr,¶m); 823 } 824 825 /*************************************************************************** 826 * SoftGemini_SenseIndicationCB * 827 **************************************************************************** 828 * DESCRIPTION: This is the the function which is called for sense mode indication from FW 829 * (i.e. we are in SENSE mode and FW detects BT activity ) 830 * SENSE_MODE_ENABLE - Indicates that FW detected BT activity 831 * SENSE_MODE_DISABLE - Indicates that FW doesn't detect BT activity for a period of time 832 * 833 * INPUTS: pSoftGemini - the object 834 * NOTE This function is located in the API for debug purposes 835 ***************************************************************************/ 836 837 void SoftGemini_SenseIndicationCB( TI_HANDLE hSoftGemini, char* str, TI_UINT32 strLen ) 838 { 839 SoftGemini_t *pSoftGemini = (SoftGemini_t *)hSoftGemini; 840 841 if (pSoftGemini->SoftGeminiEnable == SG_DISABLE) { 842 TRACE0(pSoftGemini->hReport, REPORT_SEVERITY_WARNING, ": SG is disabled, existing"); 843 return; 844 } 845 846 if ( (SENSE_MODE_ENABLE == *str) && (!pSoftGemini->bDriverEnabled) ) 847 { 848 SoftGemini_EnableDriver(hSoftGemini); 849 } 850 else if ( (SENSE_MODE_DISABLE == *str) && (pSoftGemini->bDriverEnabled) ) 851 { 852 SoftGemini_DisableDriver(hSoftGemini); 853 } 854 } 855 856 /*************************************************************************** 857 * SoftGemini_ProtectiveIndicationCB * 858 **************************************************************************** 859 * DESCRIPTION: This is the the function which is called when FW starts Protective mode (i.e BT voice) 860 * 861 * PROTECTIVE_MODE_ON - FW is activated on protective mode (BT voice is running) 862 * PROTECTIVE_MODE_OFF - FW is not activated on protective mode 863 * 864 * INPUTS: pSoftGemini - the object 865 * NOTE This function is located in the API for debug purposes 866 ***************************************************************************/ 867 868 void SoftGemini_ProtectiveIndicationCB( TI_HANDLE hSoftGemini, char* str, TI_UINT32 strLen ) 869 { 870 SoftGemini_t *pSoftGemini = (SoftGemini_t *)hSoftGemini; 871 872 TRACE1(pSoftGemini->hReport, REPORT_SEVERITY_INFORMATION, " with 0x%x\n",*str); 873 874 if (SG_DISABLE != pSoftGemini->SoftGeminiEnable) 875 { 876 if ((!pSoftGemini->bProtectiveMode) && (PROTECTIVE_MODE_ON == *str)) 877 { 878 SoftGemini_EnableProtectiveMode(hSoftGemini); 879 } 880 else if ((pSoftGemini->bProtectiveMode) && (PROTECTIVE_MODE_OFF == *str)) 881 { 882 SoftGemini_DisableProtectiveMode(hSoftGemini); 883 } 884 else 885 { 886 TRACE0(pSoftGemini->hReport, REPORT_SEVERITY_INFORMATION, " : Protective mode called when Protective mode is \n"); 887 } 888 } 889 else 890 { 891 TRACE0(pSoftGemini->hReport, REPORT_SEVERITY_WARNING, " : Protective mode called when SG mode is ? \n"); 892 } 893 } 894 895 /*************************************************************************** 896 * SoftGemini_ConvertModeToString * 897 ****************************************************************************/ 898 #ifdef REPORT_LOG 899 900 char* SoftGemini_ConvertModeToString(ESoftGeminiEnableModes SoftGeminiEnable) 901 { 902 switch(SoftGeminiEnable) 903 { 904 case SG_PROTECTIVE: return "SG_PROTECTIVE"; 905 case SG_DISABLE: return "SG_DISABLE"; 906 case SG_OPPORTUNISTIC: return "SG_OPPORTUNISTIC"; 907 default: 908 return "ERROR"; 909 } 910 } 911 912 #endif 913 914 /*************************************************************************** 915 * SoftGemini_getSGMode * 916 ****************************************************************************/ 917 ESoftGeminiEnableModes SoftGemini_getSGMode(TI_HANDLE hSoftGemini) 918 { 919 SoftGemini_t *pSoftGemini = (SoftGemini_t *)hSoftGemini; 920 return pSoftGemini->SoftGeminiEnable; 921 } 922 923 /*************************************************************************** 924 * SoftGemini_handleRecovery * 925 **************************************************************************** 926 * DESCRIPTION: The function reconfigures WHAL with the SG parameters. 927 * 928 * INPUTS: pSoftGemini - the object 929 ***************************************************************************/ 930 TI_STATUS SoftGemini_handleRecovery(TI_HANDLE hSoftGemini) 931 { 932 SoftGemini_t *pSoftGemini = (SoftGemini_t *)hSoftGemini; 933 ESoftGeminiEnableModes realSoftGeminiEnableMode; 934 935 realSoftGeminiEnableMode = pSoftGemini->SoftGeminiEnable; 936 /* Disable the SG */ 937 SoftGemini_setEnableParam(hSoftGemini, SG_DISABLE, TI_TRUE); 938 TRACE0(pSoftGemini->hReport, REPORT_SEVERITY_INFORMATION, "Disable SG \n"); 939 940 pSoftGemini->SoftGeminiEnable = realSoftGeminiEnableMode; 941 /* Set enable param */ 942 943 SoftGemini_setEnableParam(hSoftGemini, pSoftGemini->SoftGeminiEnable, TI_TRUE); 944 TRACE1(pSoftGemini->hReport, REPORT_SEVERITY_INFORMATION, "Set SG to-%d\n", pSoftGemini->SoftGeminiEnable); 945 946 /* Config the params to FW */ 947 948 SoftGemini_setParamsToFW(hSoftGemini, &pSoftGemini->SoftGeminiParam); 949 /*SoftGemini_printParams(hSoftGemini);*/ 950 return TI_OK; 951 } 952 /*************************************************************************** 953 * SoftGemini_startPsPollFailure * 954 **************************************************************************** 955 * DESCRIPTION: After Ps-Poll failure we disable the SG 956 * 957 * INPUTS: pSoftGemini - the object 958 ***************************************************************************/ 959 void SoftGemini_startPsPollFailure(TI_HANDLE hSoftGemini) 960 { 961 SoftGemini_t *pSoftGemini = (SoftGemini_t *)hSoftGemini; 962 963 TRACE0(pSoftGemini->hReport, REPORT_SEVERITY_INFORMATION, "\n"); 964 965 if ( (!pSoftGemini->bPsPollFailureActive) && (pSoftGemini->SoftGeminiParam.coexParams[SOFT_GEMINI_AUTO_PS_MODE] == TI_TRUE) ) 966 { 967 pSoftGemini->PsPollFailureLastEnableValue = pSoftGemini->SoftGeminiEnable; 968 969 /* Disable SG if needed */ 970 if ( pSoftGemini->SoftGeminiEnable != SG_DISABLE ) 971 { 972 SoftGemini_setEnableParam(hSoftGemini, SG_DISABLE, TI_FALSE); 973 } 974 975 pSoftGemini->bPsPollFailureActive = TI_TRUE; 976 } 977 else /* Calling SoftGemini_startPsPollFailure twice ? */ 978 { 979 TRACE0(pSoftGemini->hReport, REPORT_SEVERITY_WARNING, "Calling SoftGemini_startPsPollFailure while bPsPollFailureActive is TRUE\n"); 980 } 981 } 982 983 /*************************************************************************** 984 * SoftGemini_endPsPollFailure * 985 **************************************************************************** 986 * DESCRIPTION: Return to normal behavior after the PsPoll failure 987 * 988 * INPUTS: pSoftGemini - the object 989 ***************************************************************************/ 990 void SoftGemini_endPsPollFailure(TI_HANDLE hSoftGemini) 991 { 992 SoftGemini_t *pSoftGemini = (SoftGemini_t *)hSoftGemini; 993 994 TRACE0(pSoftGemini->hReport, REPORT_SEVERITY_INFORMATION, "\n"); 995 996 if ( pSoftGemini->bPsPollFailureActive ) 997 { 998 pSoftGemini->bPsPollFailureActive = TI_FALSE; 999 1000 /* return to previous value */ 1001 if ( pSoftGemini->PsPollFailureLastEnableValue != SG_DISABLE ) 1002 { 1003 SoftGemini_setEnableParam(hSoftGemini, pSoftGemini->PsPollFailureLastEnableValue, TI_FALSE); 1004 } 1005 } 1006 else /* Calling SoftGemini_endPsPollFailure twice ? */ 1007 { 1008 TRACE0(pSoftGemini->hReport, REPORT_SEVERITY_WARNING, "Calling SoftGemini_endPsPollFailure while bPsPollFailureActive is FALSE\n"); 1009 } 1010 } 1011 1012 1013