1 /**************************************************************************** 2 **+-----------------------------------------------------------------------+** 3 **| |** 4 **| Copyright(c) 1998 - 2008 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 ****************************************************************************/ 35 36 37 /*******************************************************************************/ 38 /* */ 39 /* MODULE: recoveryCtrl.c */ 40 /* PURPOSE: The responsibility of RecoveryCtrl module is to provide main API */ 41 /* to HelthMonitor that invokes the recovery process if failure is */ 42 /* detected. It performs disable/enable inputs from outside, calls */ 43 /* restart of TWD and informs STAD modules that recovery has been */ 44 /* performed. */ 45 /* */ 46 /*******************************************************************************/ 47 48 #include "paramOut.h" 49 #include "osApi.h" 50 #include "report.h" 51 #include "recoveryCtrl.h" 52 #include "recoveryCtrl_API.h" 53 54 #include "TNETWIF.h" 55 #include "PowerAuthorization.h" 56 #include "ScanSrv.h" 57 #include "MeasurementSrv.h" 58 #include "PowerSrv_API.h" 59 #include "FwEvent_api.h" 60 #include "rxXfer_api.h" 61 #include "MacServices.h" 62 #include "txHwQueue_api.h" 63 #include "txXfer_api.h" 64 #include "txResult_api.h" 65 #include "CmdMBox_api.h" 66 #include "CmdQueue_api.h" 67 #include "whalParams.h" 68 #include "whalCtrl.h" 69 #include "whalSecurity.h" 70 71 #include "TNETWArb.h" 72 #include "ElpCtrl.h" 73 #include "HwInit_api.h" 74 75 /* static function */ 76 #ifdef USE_RECOVERY 77 static void recoveryCtrl_SM(TI_HANDLE hRecoveryCtrl); 78 static int recoveryCtrl_ReConfig (TI_HANDLE hRecoveryCtrl); 79 static int recoveryCtrl_ReJoinBss(TI_HANDLE hRecoveryCtrl); 80 #endif /* USE_RECOVERY */ 81 82 /******************************************************************************* 83 * PUBLIC FUNCTIONS IMPLEMENTATION * 84 ********************************************************************************/ 85 86 87 /************************************************************************* 88 * recoveryCtrl_create * 89 ************************************************************************** 90 * DESCRIPTION: This function initializes the RecoveryCtrl module. 91 * 92 * INPUT: hOs - handle to Os Abstraction Layer 93 * 94 * RETURN: Handle to the allocated RecoveryCtrl module 95 *************************************************************************/ 96 TI_HANDLE recoveryCtrl_create(TI_HANDLE hOs) 97 { 98 #ifdef USE_RECOVERY 99 recoveryCtrl_t *hRecoveryCtrl; 100 101 /* allocate RecoverCtrl module */ 102 hRecoveryCtrl = os_memoryAlloc(hOs, (sizeof(recoveryCtrl_t))); 103 104 if(!hRecoveryCtrl) 105 { 106 WLAN_OS_REPORT(("Error allocating the RecoverCtrl Module\n")); 107 return NULL; 108 } 109 110 /* Reset RecoverCtrl module */ 111 os_memoryZero(hOs, hRecoveryCtrl, (sizeof(recoveryCtrl_t))); 112 113 hRecoveryCtrl->hOs = hOs; 114 115 return(hRecoveryCtrl); 116 #else 117 return NULL; 118 #endif /* USE_RECOVERY */ 119 } /* recoveryCtrl_create */ 120 121 122 /*************************************************************************** 123 * recoveryCtrl_config * 124 **************************************************************************** 125 * DESCRIPTION: This function configures the recoveryCtrl module 126 * 127 * RETURNS: OK - Configuration successful 128 * NOK - Configuration unsuccessful 129 ***************************************************************************/ 130 TI_STATUS recoveryCtrl_config(TI_HANDLE hRecoveryCtrl, 131 TI_HANDLE hReport, 132 TI_HANDLE hTNETWIF, 133 TI_HANDLE hTxXfer, 134 TI_HANDLE hRxXfer, 135 TI_HANDLE hTxResult, 136 TI_HANDLE hMacServices, 137 TI_HANDLE hTxCtrlBlk, 138 TI_HANDLE hTxHwQueue, 139 TI_HANDLE hHalCtrl, 140 TI_HANDLE hHwIntr, 141 TI_HANDLE hWhalParams, 142 TI_HANDLE hCmdQueue, 143 TI_HANDLE hFwEvent, 144 TI_HANDLE hCmdMBox, 145 TI_HANDLE hHwInit) 146 { 147 #ifdef USE_RECOVERY 148 recoveryCtrl_t *pRecoveryCtrl = (recoveryCtrl_t *)hRecoveryCtrl; 149 TNETWIF_t *pTNETWIF = (TNETWIF_t *)hTNETWIF; 150 MacServices_t *pMacServices = (MacServices_t*)hMacServices; 151 152 /* configure modules handles */ 153 pRecoveryCtrl->hReport = hReport; 154 pRecoveryCtrl->hTNETWIF = hTNETWIF; 155 pRecoveryCtrl->hTxXfer = hTxXfer; 156 pRecoveryCtrl->hRxXfer = hRxXfer; 157 pRecoveryCtrl->hTxResult = hTxResult; 158 pRecoveryCtrl->hMacServices = hMacServices; 159 pRecoveryCtrl->hTxCtrlBlk = hTxCtrlBlk; 160 pRecoveryCtrl->hTxHwQueue = hTxHwQueue; 161 pRecoveryCtrl->hHalCtrl = hHalCtrl; 162 pRecoveryCtrl->hHwIntr = hHwIntr; 163 pRecoveryCtrl->hWhalParams = hWhalParams; 164 pRecoveryCtrl->hCmdQueue = hCmdQueue; 165 pRecoveryCtrl->hFwEvent = hFwEvent; 166 pRecoveryCtrl->hCmdMBox = hCmdMBox; 167 pRecoveryCtrl->hHwInit = hHwInit; 168 pRecoveryCtrl->hTNETWArb = pTNETWIF->hTNETWArb; 169 170 pRecoveryCtrl->hELPCtrl = pTNETWIF->hELPCtrl; 171 pRecoveryCtrl->hScanSRV = pMacServices->hScanSRV; 172 pRecoveryCtrl->hMeasurementSRV = pMacServices->hMeasurementSRV; 173 pRecoveryCtrl->hPowerSrv = pMacServices->hPowerSrv; 174 pRecoveryCtrl->hPowerAutho = pMacServices->hPowerAutho; 175 176 /* pRecoveryCtrl->hRecoveryMgr will be initialized while calling to recoveryCtrl_restartTWD() */ 177 178 pRecoveryCtrl->smState = REC_CTRL_STATE_IDLE; 179 180 WLAN_REPORT_INIT(pRecoveryCtrl->hReport, RECOVERY_CTRL_MODULE_LOG, 181 ("RecoveryCtrl configured successfully\n")); 182 #endif /* USE_RECOVERY */ 183 return OK; 184 } /* recoveryCtrl_config */ 185 186 187 /*************************************************************************** 188 * recoveryCtrl_destroy * 189 **************************************************************************** 190 * DESCRIPTION: This function unload the RecoverCtrl module. 191 * 192 * INPUTS: hRecoveryCtrl - the object 193 * 194 * OUTPUT: 195 * 196 * RETURNS: OK - Unload succesfull 197 * NOK - Unload unsuccesfull 198 ***************************************************************************/ 199 TI_STATUS recoveryCtrl_destroy(TI_HANDLE hRecoveryCtrl) 200 { 201 #ifdef USE_RECOVERY 202 recoveryCtrl_t *pRecoveryCtrl = (recoveryCtrl_t *)hRecoveryCtrl; 203 204 /* free RecoverCtrl Module */ 205 os_memoryFree(pRecoveryCtrl->hOs, pRecoveryCtrl, sizeof(recoveryCtrl_t)); 206 #endif /* USE_RECOVERY */ 207 return OK; 208 } 209 210 /********************************************************************************************** 211 * recoveryCtrl_SM() 212 ********************************************************************************************** 213 * DESCRIPTION: 214 ============ 215 This is the recoveryCtrl state machine. 216 The inceptive event for RecoveryCtrl SM is invoking the restart of TWD by RecoveryMgr; 217 Perform ASYNC restart of BusTxn (if not idle then wait until end of current txn and 218 Invoke CB upon TxnComplete) and FW Download; 219 HwInit module performs HW Init process; 220 Call RecoverMgr CB endOfRecovery() at the end of TWD restart 221 222 The SM supports both Sync and Async accesses to the HW. 223 It loops and progresses from state to state as long as the HW is accessed synchronously. 224 Once the access is Asynchronous (TNETWIF_PENDING), it exits and is called later 225 by the TNETWIF when the HW is ready. 226 That's why it uses unspecified-mode accesses (e.g. TNETWIF_ReadMemOpt) which 227 selects either Sync or Async automatically according to the platform and length. 228 Yet, the short transactions (EOB and Interrupt-Request 32 bit writes) are done using Sync 229 access to simplify the SM 230 NOTE: MCS projects may require full Sync/Async support, so the Sync accesses may need to be modified. 231 232 NOTE: The recoveryCtrl-SM detailed description is provided in "CE-2.0 Recovery LLD.doc". 233 234 **********************************************************************************************/ 235 #ifdef USE_RECOVERY 236 static void recoveryCtrl_SM(TI_HANDLE hRecoveryCtrl) 237 { 238 recoveryCtrl_t *pRecoveryCtrl = (recoveryCtrl_t *)hRecoveryCtrl; 239 TI_STATUS tnetwifStatus = TNETWIF_ERROR; /* Last HW operation status: Complete (Sync) or Pending (Async). */ 240 WHAL_CTRL *pWhalCtrl = (WHAL_CTRL *)pRecoveryCtrl->hHalCtrl; 241 242 #ifdef TI_DBG 243 if (hRecoveryCtrl == NULL) 244 { 245 WLAN_REPORT_ERROR(pRecoveryCtrl->hReport, RECOVERY_CTRL_MODULE_LOG, 246 ("recoveryCtrl_SM(): **** Called with NULL handle!! ****\n")); 247 return; 248 } 249 #endif 250 251 /* 252 * Loop through the states sequence as long as the process is synchronous. 253 * Exit when finished or if an Asynchronous process is required. In this case 254 * the SM process will be resumed later (called back by TNETWIF). 255 */ 256 while (1) 257 { 258 switch (pRecoveryCtrl->smState) 259 { 260 case REC_CTRL_STATE_IDLE: 261 FwEvent_Stop(pRecoveryCtrl->hFwEvent); 262 263 tnetwifStatus = TNETWIF_COMPLETE; 264 265 pRecoveryCtrl->smState = REC_CTRL_STATE_WAIT_END_CURR_TXN; 266 break; 267 268 case REC_CTRL_STATE_WAIT_END_CURR_TXN: 269 TNETWArb_Recovery(pRecoveryCtrl->hTNETWArb, pRecoveryCtrl->hELPCtrl); 270 271 elpCtrl_Stop(pRecoveryCtrl->hELPCtrl); 272 CmdMBox_Restart(pRecoveryCtrl->hCmdMBox); 273 CmdQueue_StartReconfig(pRecoveryCtrl->hCmdQueue); 274 275 pRecoveryCtrl->smState = REC_CTRL_STATE_INIT_CMPLT; 276 tnetwifStatus = hwInit_recovery(pRecoveryCtrl->hHwInit, (TI_HANDLE)(pWhalCtrl->pHwCtrl), (void*)recoveryCtrl_SM, hRecoveryCtrl); 277 return; 278 279 case REC_CTRL_STATE_INIT_CMPLT: 280 elpCtrl_Start(pRecoveryCtrl->hELPCtrl); 281 282 /* reconfig FW */ 283 recoveryCtrl_ReConfig(hRecoveryCtrl); 284 285 pRecoveryCtrl->smState = REC_CTRL_STATE_END_RECONFIG; 286 whal_hwInfoElemMiscTableGet (pWhalCtrl->pHwCtrl->pHwMboxConfig, 287 &pWhalCtrl->misc, 288 (void *)recoveryCtrl_SM, 289 hRecoveryCtrl); 290 return; 291 292 case REC_CTRL_STATE_END_RECONFIG: 293 powerAutho_Restart(pRecoveryCtrl->hMacServices); 294 RxXfer_ReStart(pRecoveryCtrl->hRxXfer); 295 scanSRV_restart(pRecoveryCtrl->hScanSRV); 296 measurementSRV_restart(pRecoveryCtrl->hMeasurementSRV); 297 powerSrv_restart(pRecoveryCtrl->hPowerSrv); 298 299 /*Change the State of the mboxQueue and the interrupt Module */ 300 /* moved later whalCtrl_exitFromInitMode(pRecoveryCtrl->hHalCtrl);*/ /* call inside CmdMBox_SetModeNormal */ 301 302 /* 303 Indicates the MboxQueue that Reconfig Ended in Order To Call the CallBacks 304 That Was saved before the recovery process started 305 */ 306 CmdQueue_EndReconfig(pRecoveryCtrl->hCmdQueue); 307 308 pRecoveryCtrl->smState = REC_CTRL_STATE_IDLE; 309 310 /* call End Of Recovery CB */ 311 pRecoveryCtrl->endOfRecoveryCB(pRecoveryCtrl->hRecoveryMgr); 312 313 return; /* recovery process ended */ 314 315 default: 316 WLAN_REPORT_ERROR(pRecoveryCtrl->hReport, RECOVERY_CTRL_MODULE_LOG, 317 ("recoveryCtrl_SM(): Unexpected state, smState=%d\n", pRecoveryCtrl->smState)); 318 return; 319 320 } /* switch (pRecoveryCtrl->smState) */ 321 322 WLAN_REPORT_INFORMATION(pRecoveryCtrl->hReport, RECOVERY_CTRL_MODULE_LOG, 323 ("recoveryCtrl_SM(): smState=%d\n", pRecoveryCtrl->smState)); 324 325 /* 326 * If the last HW access request was pended, exit the SM (Asynchronous process). 327 * The SM will be called back when the HW access is done. 328 * Also reset the Sync flag to notify that the Xfer wasn't completed in the SendPacket context. 329 */ 330 if (tnetwifStatus == TNETWIF_PENDING) 331 { 332 return; /********** Exit State Machine (to be called back by TNETWIF) **********/ 333 } 334 335 #ifdef TI_DBG 336 else if (tnetwifStatus == TNETWIF_ERROR) 337 { 338 WLAN_REPORT_ERROR(pRecoveryCtrl->hReport, RECOVERY_CTRL_MODULE_LOG, 339 ("recoveryCtrl_SM(): Unexpected state, smState=%d\n", pRecoveryCtrl->smState)); 340 return; 341 } 342 #endif /* TI_DBG */ 343 } /* while (1) */ 344 } /* recoveryCtrl_SM */ 345 #endif /* USE_RECOVERY */ 346 347 /*************************************************************************** 348 * recoveryCtrl_restartTWD * 349 **************************************************************************** 350 * DESCRIPTION: Start TWD recovery. Restart TWD from bottom up. 351 * Init HW: (using HW init module in FW Transfer component). 352 * Reconfigure FW. 353 * 354 * INPUTS: hRecoveryCtrl - the object 355 * 356 * OUTPUT: 357 * 358 * RETURNS: OK - succesfull 359 * NOK - unsuccesfull 360 ***************************************************************************/ 361 TI_STATUS recoveryCtrl_restartTWD(TI_HANDLE hRecoveryCtrl,void *endOfRecoveryCB, TI_HANDLE hRecoveryMgr) 362 { 363 #ifdef USE_RECOVERY 364 recoveryCtrl_t *pRecoveryCtrl = (recoveryCtrl_t *)hRecoveryCtrl; 365 366 /* register RecoveryMgr handle and endOfRecoveryCB*/ 367 pRecoveryCtrl->hRecoveryMgr = hRecoveryMgr; 368 pRecoveryCtrl->endOfRecoveryCB = (EndOfRecoveryCB_t)endOfRecoveryCB; 369 370 recoveryCtrl_SM(hRecoveryCtrl); 371 #endif /* USE_RECOVERY */ 372 return OK; 373 } 374 375 #ifdef USE_RECOVERY 376 int recoveryCtrl_ReConfig (TI_HANDLE hRecoveryCtrl) 377 { 378 recoveryCtrl_t *pRecoveryCtrl = (recoveryCtrl_t *)hRecoveryCtrl; 379 WHAL_CTRL *pWhalCtrl = (WHAL_CTRL *)pRecoveryCtrl->hHalCtrl; 380 WlanParams_T *pWlanParams = whal_ParamsGetWlanParams(pWhalCtrl->pWhalParams); 381 whalParamInfo_t param; 382 DmaParams_T *pDmaParams = whal_ParamsGetDmaParams(pWhalCtrl->pWhalParams); 383 384 int index = 0; 385 int Stt; 386 387 if(!pWlanParams->RecoveryEnable) 388 { 389 WLAN_OS_REPORT(("whalCtrl_ReConfig: Recovery is disabled in registry, abort recovery process\n")); 390 return OK; 391 } 392 393 FwEvent_SetHwInfo (pWhalCtrl->hFwEvent, &(pWhalCtrl->pHwCtrl->DataPathParams)); 394 txXfer_restart(pWhalCtrl->hTxXfer); 395 txResult_restart(pWhalCtrl->hTxResult); 396 397 txXfer_setHwInfo (pWhalCtrl->hTxXfer, &(pWhalCtrl->pHwCtrl->DataPathParams)); 398 399 txResult_setHwInfo (pWhalCtrl->hTxResult, &(pWhalCtrl->pHwCtrl->DataPathParams)); 400 401 rxXfer_SetDoubleBufferAddr (pWhalCtrl->hRxXfer, &(pWhalCtrl->pHwCtrl->DataPathParams)); 402 403 /* Provide number of HW Tx-blocks and descriptors to Tx-HW-Queue module */ 404 txHwQueue_setHwInfo (pWhalCtrl->hTxHwQueue, pDmaParams); 405 406 whalSecur_HwEncDecrEnable (pWhalCtrl->pWhalSecurity, 1); 407 408 /*send the table regardless to the state */ 409 whal_hwCtrl_SetBeaconFilterIETable(pWhalCtrl->pHwCtrl, 410 &pWhalCtrl->pWhalParams->WlanParams.beaconFilterIETable.numberOfIEs, 411 pWhalCtrl->pWhalParams->WlanParams.beaconFilterIETable.IETable, 412 &pWhalCtrl->pWhalParams->WlanParams.beaconFilterIETable.IETableSize ); 413 414 /* 415 * ReConfig the wlan hardware Queues according to the required Quality Of Service. 416 */ 417 /* Reconfig Roaming thresholds */ 418 /* SNR */ 419 whalCtrl_SetSNRParamsCmd (pWhalCtrl, &pWhalCtrl->pWhalParams->WlanParams.roamTriggers); 420 421 /* RSSI */ 422 WLAN_REPORT_INFORMATION (pWhalCtrl->hReport, RECOVERY_CTRL_MODULE_LOG, 423 ("\n SetRSSIParamsCmd :\n \ 424 RSSIthreshold = %d\n \ 425 RSSIFilterWeight = %d\n \ 426 RSSIFilterDepth = %d \n ", 427 pWhalCtrl->pWhalParams->WlanParams.roamTriggers.rssiThreshold, 428 pWhalCtrl->pWhalParams->WlanParams.roamTriggers.rssiFilterWeight, 429 pWhalCtrl->pWhalParams->WlanParams.roamTriggers.rssiFilterDepth)); 430 whalCtrl_SetRSSIParamsCmd(pWhalCtrl, &pWhalCtrl->pWhalParams->WlanParams.roamTriggers); 431 432 /* Max consecutive NACK */ 433 WLAN_REPORT_INFORMATION (pWhalCtrl->hReport, RECOVERY_CTRL_MODULE_LOG, 434 ("\n SetMaxTxRetryParamsCmdCmd :\n \ 435 maxTxRetry = %d \n ", 436 pWhalCtrl->pWhalParams->WlanParams.roamTriggers.maxTxRetry)); 437 whalCtrl_SetMaxTxRetryParamsCmd(pWhalCtrl, &pWhalCtrl->pWhalParams->WlanParams.roamTriggers); 438 /* Out of sync */ 439 WLAN_REPORT_INFORMATION (pWhalCtrl->hReport, RECOVERY_CTRL_MODULE_LOG, 440 ("\n whalCtrl_SetBssLossTsfThresholdParamsCmd :\n \ 441 BssLossTimeout = %d\n \ 442 TsfMissThreshold = %d \n ", 443 pWhalCtrl->pWhalParams->WlanParams.roamTriggers.BssLossTimeout, 444 pWhalCtrl->pWhalParams->WlanParams.roamTriggers.TsfMissThreshold)); 445 whalCtrl_SetBssLossTsfThresholdParamsCmd(pWhalCtrl, &pWhalCtrl->pWhalParams->WlanParams.roamTriggers); 446 447 whalCtrl_setBetParams(pWhalCtrl, 448 pWhalCtrl->pWhalParams->WlanParams.BetEnable, 449 pWhalCtrl->pWhalParams->WlanParams.MaximumConsecutiveET); 450 451 whalCtrl_setRxDataFiltersParams(pWhalCtrl, 452 pWhalCtrl->pWhalParams->WlanParams.rxFilterDefaultEnable, 453 pWhalCtrl->pWhalParams->WlanParams.rxFilterDefaultAction); 454 455 for (index = 0; index < MAX_DATA_FILTERS; index++) 456 { 457 if (pWhalCtrl->pWhalParams->WlanParams.rxFilterCgf[index].rxFilterCommand == ADD_FILTER) 458 { 459 whalCtrl_setRxDataFilter(pWhalCtrl, 460 index, 461 pWhalCtrl->pWhalParams->WlanParams.rxFilterCgf[index].rxFilterCommand, 462 pWhalCtrl->pWhalParams->WlanParams.rxFilterCgf[index].rxFilterAction, 463 pWhalCtrl->pWhalParams->WlanParams.rxFilterCgf[index].rxFilterNumFieldPatterns, 464 pWhalCtrl->pWhalParams->WlanParams.rxFilterCgf[index].rxFilterLenFieldPatterns, 465 pWhalCtrl->pWhalParams->WlanParams.rxFilterCgf[index].rxFilterFieldPatterns); 466 } 467 } 468 469 #ifdef BTH_COEXISTENCE /* it's solution for collision of BTH and WLAN (by Gemini protocol), we don't need it */ 470 /* Soft Gemini Section */ 471 /* ReConfig the BTH enable */ 472 param.paramType = HAL_CTRL_SG_ENABLE_PARAM; 473 param.content.SoftGeminiEnable = pWhalCtrl->pWhalParams->WlanParams.SoftGeminiEnable; 474 whalCtrl_SetParam(pRecoveryCtrl->hHalCtrl, ¶m); 475 476 /* ReConfig the BTH config */ 477 param.paramType = HAL_CTRL_SG_CONFIG_PARAM; 478 os_memoryCopy(pWhalCtrl->hOs, ¶m.content.SoftGeminiParam, &pWhalCtrl->pWhalParams->WlanParams.SoftGeminiParams, sizeof(SoftGeminiParam_t)); 479 whalCtrl_SetParam(pRecoveryCtrl->hHalCtrl, ¶m); 480 #endif 481 482 483 #ifdef DO_CALIBRATION_IN_DRIVER 484 /* Perform single calibration for APP scan usage. */ 485 whalCtrl_sendRadioAction(pWhalCtrl ,MANUAL_CALIB); 486 #endif/* O_CALIBRATION_IN_DRIVER */ 487 /* 488 * JOIN (use the local parameters), otherwize the CORE will reconnect 489 */ 490 if (pWlanParams->bJoin) 491 { 492 /* set TxRatePolicy */ 493 param.paramType = HAL_CTRL_TX_RATE_CLASS_PARAMS; 494 param.content.pTxRatePlicy = &pWhalCtrl->pWhalParams->BssInfoParams.TxRateClassParams; 495 496 whalCtrl_SetParam(pRecoveryCtrl->hHalCtrl,¶m); 497 498 Stt = recoveryCtrl_ReJoinBss(hRecoveryCtrl); 499 if (Stt != OK) 500 { 501 WLAN_REPORT_INFORMATION (pWhalCtrl->hReport, RECOVERY_CTRL_MODULE_LOG, 502 ("whalCtrl_ReConfig: recoveryCtrl_ReJoinBss failed\n")); 503 return NOK; 504 } 505 whal_hwCtrl_AidSet (pWhalCtrl->pHwCtrl, pWhalCtrl->pWhalParams->WlanParams.Aid); 506 507 508 /* Slot time must be setting after doing join */ 509 whal_hwCtrl_SetSlotTime(pWhalCtrl->pHwCtrl, (slotTime_e)pWhalCtrl->pWhalParams->WlanParams.SlotTime); 510 511 /* Reconfig security keys, default key Id and encryption/decryption control to the FW*/ 512 if (whalSecur_KeysReconfig (pWhalCtrl->pWhalSecurity) != OK) 513 { 514 WLAN_REPORT_INFORMATION (pWhalCtrl->hReport, RECOVERY_CTRL_MODULE_LOG, 515 ("whalCtrl_ReConfig: ## whalSecur_KeysReconfig failed\n")); 516 return NOK; 517 } 518 } 519 520 return (OK); 521 } 522 523 524 /* 525 * ---------------------------------------------------------------------------- 526 * Function : recoveryCtrl_ReJoinBss 527 * 528 * Input : 529 * Output : 530 * Process : 531 * Note(s) : Done 532 * ----------------------------------------------------------------------------- 533 */ 534 535 int recoveryCtrl_ReJoinBss (TI_HANDLE hRecoveryCtrl) 536 { 537 recoveryCtrl_t *pRecoveryCtrl = (recoveryCtrl_t *)hRecoveryCtrl; 538 WHAL_CTRL *pWhalCtrl = (WHAL_CTRL *)pRecoveryCtrl->hHalCtrl; 539 BssInfoParams_T *pBssInfoParams = &pWhalCtrl->pWhalParams->BssInfoParams; 540 TemplateListParams_T *pWhalTemplates = &pWhalCtrl->pWhalParams->TemplateList; 541 HwMboxCmd_T *pHwCmd = whal_hwCtrl_GetMboxCmd(pWhalCtrl->pHwCtrl); 542 543 /* 544 * set the templates 545 */ 546 547 if (pWhalTemplates->Beacon.Size != 0) 548 whal_hwMboxCmd_ConfigureTemplateFrame (pHwCmd, 549 pWhalTemplates->Beacon.Buffer, 550 (UINT16)pWhalTemplates->Beacon.Size, 551 CMD_BEACON, 552 NULL, 553 NULL); 554 555 if (pWhalTemplates->ProbeResp.Size != 0) 556 whal_hwMboxCmd_ConfigureTemplateFrame (pHwCmd, 557 pWhalTemplates->ProbeResp.Buffer, 558 (UINT16)pWhalTemplates->ProbeResp.Size, 559 CMD_PROBE_RESP, 560 NULL, 561 NULL); 562 563 if (pWhalTemplates->ProbeReq.Size != 0) 564 whal_hwMboxCmd_ConfigureTemplateFrame (pHwCmd, 565 pWhalTemplates->ProbeReq.Buffer, 566 (UINT16)pWhalTemplates->ProbeReq.Size, 567 CMD_PROBE_REQ, 568 NULL, 569 NULL); 570 571 if (pWhalTemplates->NullData.Size != 0) 572 whal_hwMboxCmd_ConfigureTemplateFrame (pHwCmd, 573 pWhalTemplates->NullData.Buffer, 574 (UINT16)pWhalTemplates->NullData.Size, 575 CMD_NULL_DATA, 576 NULL, 577 NULL); 578 579 if (pWhalTemplates->PsPoll.Size != 0) 580 whal_hwMboxCmd_ConfigureTemplateFrame (pHwCmd, 581 pWhalTemplates->PsPoll.Buffer, 582 (UINT16)pWhalTemplates->PsPoll.Size, 583 CMD_PS_POLL, 584 NULL, 585 NULL); 586 587 if (pWhalTemplates->QosNullData.Size != 0) 588 whal_hwMboxCmd_ConfigureTemplateFrame (pHwCmd, 589 pWhalTemplates->QosNullData.Buffer, 590 (UINT16)pWhalTemplates->QosNullData.Size, 591 CMD_QOS_NULL_DATA, 592 NULL, 593 NULL); 594 595 596 /* 597 * call the hardware to start/join the bss 598 */ 599 return whal_hwCtrl_StartJoin(pWhalCtrl->pHwCtrl, (bssType_e)pBssInfoParams->ReqBssType, NULL, NULL); 600 601 } 602 #endif 603 604