PageRenderTime 60ms CodeModel.GetById 21ms RepoModel.GetById 1ms app.codeStats 0ms

/drivers/net/wireless/tiwlan1251/common/src/TNETW_Driver/Ctrl/RecoverCtrl/recoveryCtrl.c

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