PageRenderTime 61ms CodeModel.GetById 23ms RepoModel.GetById 1ms app.codeStats 0ms

/drivers/net/wireless/tiwlan1251/common/src/TNETW_Driver/TNETWIF/ELP_Controller/ElpCtrl.c

http://github.com/CyanogenMod/cm-kernel
C | 617 lines | 270 code | 79 blank | 268 comment | 36 complexity | 2a2e9276c648ad7888309daa1cd56fb8 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: ElpCtrl.c */
  38. /* PURPOSE: ELP controller implementation module */
  39. /* */
  40. /**********************************************************************************/
  41. #include "osApi.h"
  42. #include "whalBus_Api.h"
  43. #include "fsm.h"
  44. #include "TNETWIF.h"
  45. #include "whalHwAccess.h"
  46. #include "ElpCtrl.h"
  47. /* #include <linux/timer.h> */
  48. /* Healthy timer timeout in milliseconds */
  49. #define ELPCTRL_TIMER_TIMEOUT 100
  50. typedef enum
  51. {
  52. ELPS_AWAKE,
  53. ELPS_ASLEEP,
  54. ELPS_WAKING_UP_WRITE,
  55. ELPS_WAKING_UP_READ,
  56. ELPS_WAKING_UP_MUX
  57. } elpCtrl_State_e;
  58. typedef struct _elpCtrl_t
  59. {
  60. TI_HANDLE hOs;
  61. TI_HANDLE hTNETWIF;
  62. TI_HANDLE hTNETWArb;
  63. TNETWIF_callback_t fCb;
  64. elpCtrl_Mode_e mode;
  65. elpCtrl_State_e state;
  66. UINT32 uElpRegister;
  67. BOOL bExitWakeUpSeq;
  68. BOOL bMuxBackNeeded;
  69. BOOL bSynch;
  70. TI_STATUS eReturnValue;
  71. failureEventCB_t fFail; /* upper layer failure event callback.
  72. * called when the scan command has been timer expiry */
  73. TI_HANDLE hFail; /* object parameter passed to the fFail
  74. * when it is called */
  75. TI_HANDLE hTimer;
  76. } elpCtrl_t;
  77. /****************************************************************************
  78. * elpCtrl_TimerTimeout()
  79. ****************************************************************************
  80. * DESCRIPTION:
  81. *
  82. * INPUTS: hElpCtrl - the handle to the ElpCtrl module.
  83. *
  84. * OUTPUT:
  85. *
  86. * RETURNS: OK
  87. ****************************************************************************/
  88. void elpCtrl_TimerTimeout (TI_HANDLE hElpCtrl)
  89. {
  90. elpCtrl_t *pElpCtrl = (elpCtrl_t*)hElpCtrl;
  91. /*
  92. * Error Reporting and Recovery
  93. * This Timeout means that we failed to wake up the FW
  94. * so the only way out of it is to restart the device - by recovery
  95. */
  96. /* WLAN_OS_REPORT (("elpCtrl_TimerTimeout - ELP timeout timer expired! %lu\n", jiffies)); */
  97. WLAN_OS_REPORT (("elpCtrl_TimerTimeout - ELP timeout timer expired!\n"));
  98. if (pElpCtrl->fFail)
  99. pElpCtrl->fFail (pElpCtrl->hFail, HW_AWAKE_FAILURE);
  100. }
  101. /****************************************************************************
  102. * elpCtrl_Create()
  103. ****************************************************************************
  104. * DESCRIPTION:
  105. *
  106. * INPUTS: hOs - the handle to the OS layer
  107. * hReport - the handle to the report module
  108. *
  109. *
  110. * OUTPUT: the context of the ElpCtrl module
  111. *
  112. * RETURNS: the context of the ElpCtrl module (NULL if error)
  113. ****************************************************************************/
  114. TI_HANDLE elpCtrl_Create (TI_HANDLE hOs)
  115. {
  116. elpCtrl_t *pElpCtrl;
  117. /* Create context */
  118. pElpCtrl = os_memoryAlloc (hOs, sizeof(elpCtrl_t));
  119. if (pElpCtrl == NULL)
  120. {
  121. WLAN_OS_REPORT (("%s: Error allocating object\n", __FUNCTION__));
  122. return NULL;
  123. }
  124. os_memoryZero (hOs, pElpCtrl, sizeof(elpCtrl_t));
  125. pElpCtrl->hOs = hOs;
  126. /* Create timer */
  127. pElpCtrl->hTimer = os_timerCreate (hOs, elpCtrl_TimerTimeout, pElpCtrl);
  128. if (pElpCtrl->hTimer == NULL)
  129. {
  130. WLAN_OS_REPORT (("%s: Error in creating timer\n", __FUNCTION__));
  131. elpCtrl_Destroy (pElpCtrl);
  132. return NULL;
  133. }
  134. return pElpCtrl;
  135. }
  136. /****************************************************************************
  137. * elpCtrl_Destroy()
  138. ****************************************************************************
  139. * DESCRIPTION:
  140. *
  141. * INPUTS: hElpCtrl - the handle to the ElpCtrl module.
  142. *
  143. *
  144. * OUTPUT:
  145. *
  146. * RETURNS: OK
  147. ****************************************************************************/
  148. int elpCtrl_Destroy (TI_HANDLE hElpCtrl)
  149. {
  150. elpCtrl_t *pElpCtrl = (elpCtrl_t*)hElpCtrl;
  151. if (pElpCtrl)
  152. {
  153. if (NULL != pElpCtrl->hTimer)
  154. {
  155. os_timerDestroy (pElpCtrl->hOs, pElpCtrl->hTimer);
  156. }
  157. os_memoryFree (pElpCtrl->hOs, pElpCtrl, sizeof(elpCtrl_t));
  158. }
  159. return OK;
  160. }
  161. /****************************************************************************
  162. * elpCtrl_Configure()
  163. ****************************************************************************
  164. * DESCRIPTION:
  165. *
  166. * INPUTS: hElpCtrl - the handle to the ElpCtrl module
  167. * hTNETWIF - the handle to the TNETWIF module
  168. * fCb - ELP asynchronous operation default callback
  169. *
  170. * OUTPUT:
  171. *
  172. * RETURNS: ELPCTRL_COMPLETE - if succeeded (sync.)
  173. * ELPCTRL_PENDING - if succeeded (async.)
  174. * ELPCTRL_ERROR - if failed
  175. ****************************************************************************/
  176. int elpCtrl_Configure (TI_HANDLE hElpCtrl, TI_HANDLE hTNETWIF, TNETWIF_callback_t fCb)
  177. {
  178. elpCtrl_t *pElpCtrl = (elpCtrl_t*)hElpCtrl;
  179. pElpCtrl->state = ELPS_AWAKE;
  180. pElpCtrl->mode = ELPCTRL_MODE_KEEP_AWAKE;
  181. pElpCtrl->hTNETWIF = hTNETWIF;
  182. pElpCtrl->hTNETWArb = ((TNETWIF_t *)hTNETWIF)->hTNETWArb;
  183. pElpCtrl->fCb = fCb;
  184. pElpCtrl->bMuxBackNeeded = FALSE;
  185. return ELPCTRL_COMPLETE;
  186. }
  187. /****************************************************************************
  188. * elpCtrl_wakeUpSeqSM()
  189. ****************************************************************************
  190. * DESCRIPTION: SM for handling Synch & Asynch wake up sequence.
  191. * The flow of the SM is by that order:
  192. * WRITE (wake up) -> READ (elp) -> if awake - exit. else WRITE (mux)
  193. *
  194. * OUTPUT:
  195. *
  196. * RETURNS:
  197. ****************************************************************************/
  198. static void elpCtrl_wakeUpSeqSM (TI_HANDLE hElpCtrl, UINT8 module_id, TI_STATUS status)
  199. {
  200. elpCtrl_t *pElpCtrl = (elpCtrl_t*)hElpCtrl;
  201. /* Check if Arbiter announced that interrupt occurred (i.e. no need for wake up sequence) */
  202. if (pElpCtrl->bExitWakeUpSeq)
  203. {
  204. /* Fw is up - we should imitate TXN_COMPLETE to announce that we are done */
  205. pElpCtrl->state = ELPS_AWAKE;
  206. /* set TXN_COMPLETE to ArbiterSM - Note: It could only happen in Asynch IF */
  207. pElpCtrl->fCb (pElpCtrl->hTNETWArb, DEFAULT_MODULE_ID, OK);
  208. return;
  209. }
  210. pElpCtrl->eReturnValue = OK;
  211. /*
  212. * This while loop will continue till the exit or when waiting for the CB due to
  213. * memory transfer operation pending for DMA to complete
  214. */
  215. while (TNETWIF_PENDING != pElpCtrl->eReturnValue)
  216. {
  217. switch(pElpCtrl->state)
  218. {
  219. case ELPS_ASLEEP:
  220. pElpCtrl->state = ELPS_WAKING_UP_WRITE;
  221. pElpCtrl->eReturnValue = TNETWIF_WriteELPOpt (pElpCtrl->hTNETWIF,
  222. ELPCTRL_WAKE_UP,
  223. DEFAULT_MODULE_ID,
  224. elpCtrl_wakeUpSeqSM,
  225. hElpCtrl,
  226. TRUE);
  227. break;
  228. case ELPS_WAKING_UP_WRITE:
  229. pElpCtrl->state = ELPS_WAKING_UP_READ;
  230. pElpCtrl->eReturnValue = TNETWIF_ReadELPOpt (pElpCtrl->hTNETWIF,
  231. (UINT8*)&pElpCtrl->uElpRegister,
  232. DEFAULT_MODULE_ID,
  233. elpCtrl_wakeUpSeqSM,
  234. hElpCtrl,
  235. TRUE);
  236. break;
  237. case ELPS_WAKING_UP_READ:
  238. /* Check whether Muxing is needed */
  239. if (pElpCtrl->uElpRegister & ELPCTRL_WLAN_READY)
  240. {
  241. /* Fw is up, but no WLAN_READY interrupt will occur (since we disabled the mux) */
  242. pElpCtrl->state = ELPS_AWAKE;
  243. /*
  244. * set TXN_COMPLETE to ArbiterSM only if we are not working in synchronize IF
  245. * In synch IF we set the TXN_COMPLETE at the end of this function
  246. */
  247. if ( !pElpCtrl->bSynch)
  248. {
  249. pElpCtrl->fCb (pElpCtrl->hTNETWArb, DEFAULT_MODULE_ID, OK);
  250. }
  251. }
  252. else /* Fw is asleep - Mux to WLAN_READY and let arbiter wait for interrupt */
  253. {
  254. pElpCtrl->state = ELPS_WAKING_UP_MUX;
  255. pElpCtrl->bMuxBackNeeded = TRUE;
  256. #ifdef DM_USE_WORKQUEUE
  257. /* printk("TI: %s:\t%lu - start timeout 1000 ms\n", __FUNCTION__, jiffies); */
  258. os_timerStart (pElpCtrl->hOs, pElpCtrl->hTimer, ELPCTRL_TIMER_TIMEOUT * 10, FALSE);
  259. #else
  260. os_timerStart (pElpCtrl->hOs, pElpCtrl->hTimer, ELPCTRL_TIMER_TIMEOUT, FALSE);
  261. #endif
  262. /*
  263. * Mux to WLAN_READY and let the Arbiter wait for Txn complete
  264. */
  265. pElpCtrl->eReturnValue = TNETWIF_WriteELPOpt (pElpCtrl->hTNETWIF,
  266. ELPCTRL_WAKE_UP_WLAN_READY,
  267. DEFAULT_MODULE_ID,
  268. pElpCtrl->fCb,
  269. pElpCtrl->hTNETWArb,
  270. TRUE);
  271. if(TNETWIF_PENDING == pElpCtrl->eReturnValue)
  272. {
  273. /* If we are here then we are not using Synch IF */
  274. pElpCtrl->bSynch = FALSE;
  275. }
  276. /* The previous states was async and now it sync */
  277. if((TNETWIF_COMPLETE == pElpCtrl->eReturnValue) && (pElpCtrl->bSynch == FALSE))
  278. {
  279. pElpCtrl->fCb (pElpCtrl->hTNETWArb, DEFAULT_MODULE_ID, OK);
  280. }
  281. }
  282. return;
  283. default:
  284. WLAN_OS_REPORT(("Error: %s state = %d\n", __FUNCTION__, pElpCtrl->state));
  285. }
  286. }
  287. /* If we are here then we are not using Synch IF */
  288. pElpCtrl->bSynch = FALSE;
  289. }
  290. /****************************************************************************
  291. * elpCtrl_Wake()
  292. ****************************************************************************
  293. * DESCRIPTION:
  294. *
  295. * INPUTS: hElpCtrl - the handle to the ElpCtrl module
  296. * bHwAvail - TRUE if HW is available
  297. *
  298. * OUTPUT:
  299. *
  300. * RETURNS: TNETWIF_COMPLETE | TNETWIF_PENDING
  301. ****************************************************************************/
  302. int elpCtrl_Wake (TI_HANDLE hElpCtrl, BOOL bHwAvail)
  303. {
  304. elpCtrl_t *pElpCtrl = (elpCtrl_t*)hElpCtrl;
  305. int rc = ELPCTRL_AWAKE;
  306. if (pElpCtrl->state == ELPS_ASLEEP)
  307. {
  308. if (bHwAvail == FALSE)
  309. {
  310. /*
  311. * Wake up the FW without mux. The mux will be done only if the FW is asleep. This is done due to a race
  312. * condition in the Fw, which causes 2 interrupts in the driver - one of them is not needed
  313. */
  314. pElpCtrl->bExitWakeUpSeq = FALSE;
  315. pElpCtrl->bSynch = TRUE;
  316. elpCtrl_wakeUpSeqSM (hElpCtrl, DEFAULT_MODULE_ID, OK);
  317. /*
  318. * In Synch IF we send won't send TXN_COMPLETE from elpCtrl so we should
  319. * indicate the arbiter to roll forward its SM.
  320. */
  321. rc = ((pElpCtrl->bSynch) ? ELPCTRL_WLAN_RDY_COMPLETE : ELPCTRL_COMPLETE);
  322. }
  323. else
  324. {
  325. pElpCtrl->state = ELPS_AWAKE;
  326. if (TNETWIF_WriteELPOpt (pElpCtrl->hTNETWIF,
  327. ELPCTRL_WAKE_UP,
  328. DEFAULT_MODULE_ID,
  329. pElpCtrl->fCb,
  330. pElpCtrl->hTNETWArb,
  331. TRUE) == TNETWIF_COMPLETE)
  332. {
  333. rc = ELPCTRL_WLAN_RDY_COMPLETE;
  334. }
  335. else
  336. {
  337. rc = ELPCTRL_WLAN_RDY;
  338. }
  339. }
  340. }
  341. return rc;
  342. }
  343. /****************************************************************************
  344. * elpCtrl_Sleep()
  345. ****************************************************************************
  346. * DESCRIPTION:
  347. *
  348. * INPUTS: hElpCtrl - the handle to the ElpCtrl module.
  349. *
  350. * OUTPUT:
  351. *
  352. * RETURNS: TNETWIF_PENDING | TNETWIF_COMPLETE
  353. ****************************************************************************/
  354. int elpCtrl_Sleep (TI_HANDLE hElpCtrl)
  355. {
  356. elpCtrl_t *pElpCtrl = (elpCtrl_t*)hElpCtrl;
  357. int rc = TNETWIF_COMPLETE;
  358. if (pElpCtrl->state == ELPS_AWAKE && pElpCtrl->mode == ELPCTRL_MODE_NORMAL)
  359. {
  360. pElpCtrl->state = ELPS_ASLEEP;
  361. /* IRQ_SRC(0) WLAN_WUP(0) - 'more' flag is FALSE since the HW is going to sleep */
  362. rc = TNETWIF_WriteELPOpt (pElpCtrl->hTNETWIF,
  363. ELPCTRL_SLEEP,
  364. DEFAULT_MODULE_ID,
  365. pElpCtrl->fCb,
  366. pElpCtrl->hTNETWArb,
  367. FALSE);
  368. }
  369. return rc;
  370. }
  371. /****************************************************************************
  372. * elpCtrl_Unmux()
  373. ****************************************************************************
  374. * DESCRIPTION:
  375. *
  376. * INPUTS: hElpCtrl - the handle to the ElpCtrl module.
  377. *
  378. * OUTPUT:
  379. *
  380. * RETURNS: TNETWIF_PENDING | TNETWIF_COMPLETE
  381. ****************************************************************************/
  382. int elpCtrl_UnMux (TI_HANDLE hElpCtrl)
  383. {
  384. elpCtrl_t *pElpCtrl = (elpCtrl_t*)hElpCtrl;
  385. int rc = (pElpCtrl->bMuxBackNeeded ? OK : NOK);
  386. pElpCtrl->bMuxBackNeeded = FALSE;
  387. return rc;
  388. }
  389. /****************************************************************************
  390. * elpCtrl_ReceivedIRQ()
  391. ****************************************************************************
  392. * DESCRIPTION:
  393. *
  394. * INPUTS: hElpCtrl - the handle to the ElpCtrl module.
  395. *
  396. * OUTPUT:
  397. *
  398. * RETURNS: TNETWIF_PENDING | TNETWIF_COMPLETE
  399. ****************************************************************************/
  400. void elpCtrl_ReceivedIRQ (TI_HANDLE hElpCtrl)
  401. {
  402. elpCtrl_t *pElpCtrl = (elpCtrl_t*)hElpCtrl;
  403. if (pElpCtrl->state == ELPS_WAKING_UP_MUX)
  404. {
  405. pElpCtrl->state = ELPS_AWAKE;
  406. /* printk("TI: %s:\t%lu - stop timeout\n", __FUNCTION__, jiffies); */
  407. os_timerStop (pElpCtrl->hOs, pElpCtrl->hTimer);
  408. }
  409. return;
  410. }
  411. /****************************************************************************
  412. * elpCtrl_Mode()
  413. ****************************************************************************
  414. * DESCRIPTION:
  415. *
  416. * INPUTS: hElpCtrl - the handle to the ElpCtrl module.
  417. *
  418. *
  419. * OUTPUT:
  420. *
  421. * RETURNS: ELPCTRL_COMPLETE
  422. ****************************************************************************/
  423. int elpCtrl_Mode (TI_HANDLE hElpCtrl, elpCtrl_Mode_e mode)
  424. {
  425. elpCtrl_t *pElpCtrl = (elpCtrl_t*)hElpCtrl;
  426. pElpCtrl->mode = mode;
  427. return ELPCTRL_COMPLETE;
  428. }
  429. /****************************************************************************
  430. * elpCtrl_isIRQComing()
  431. ****************************************************************************
  432. * DESCRIPTION: Check if IRQ is about to come from Fw - depending on the ELP state
  433. *
  434. * INPUTS: hElpCtrl - the handle to the ElpCtrl module.
  435. *
  436. *
  437. * OUTPUT:
  438. *
  439. * RETURNS: TRUE - IRQ will arrive from WLAN_READY. FALSE - Otherwise
  440. ****************************************************************************/
  441. BOOL elpCtrl_isIRQComing (TI_HANDLE hElpCtrl)
  442. {
  443. elpCtrl_t *pElpCtrl = (elpCtrl_t*)hElpCtrl;
  444. return (pElpCtrl->state == ELPS_WAKING_UP_MUX ? TRUE : FALSE);
  445. }
  446. /****************************************************************************
  447. * elpCtrl_exitWakeUpSeq()
  448. ****************************************************************************
  449. * DESCRIPTION: Mark that exit from wake up sequence is needed and return if
  450. * wake up is already over.
  451. *
  452. * INPUTS: hElpCtrl - the handle to the ElpCtrl module.
  453. *
  454. *
  455. * OUTPUT: bExitWakeUpSeq = TRUE
  456. *
  457. * RETURNS: TRUE - IRQ will arrive from WLAN_READY. FALSE - Otherwise
  458. ****************************************************************************/
  459. elpCtrl_e elpCtrl_exitWakeUpSeq (TI_HANDLE hElpCtrl)
  460. {
  461. elpCtrl_t *pElpCtrl = (elpCtrl_t*)hElpCtrl;
  462. if (pElpCtrl->state == ELPS_AWAKE)
  463. { /* We are already awake */
  464. return ELPCTRL_AWAKE;
  465. }
  466. else /* Still in wake up sequence */
  467. {
  468. pElpCtrl->bExitWakeUpSeq = TRUE;
  469. return ELPCTRL_ASLEEP;
  470. }
  471. }
  472. /****************************************************************************************
  473. * elpCtrl_RegisterFailureEventCB *
  474. ****************************************************************************************
  475. DESCRIPTION: Registers a failure event callback for Hw available
  476. INPUT: - hElpCtrl - handle to the Elp Ctrl object.
  477. - fCb - the failure event callback function.\n
  478. - hCb - handle to the object passed to the failure event callback function.
  479. OUTPUT:
  480. RETURN: void.
  481. ****************************************************************************************/
  482. void elpCtrl_RegisterFailureEventCB (TI_HANDLE hElpCtrl, void *fCb, TI_HANDLE hCb)
  483. {
  484. elpCtrl_t *pElpCtrl = (elpCtrl_t*)hElpCtrl;
  485. pElpCtrl->fFail = (failureEventCB_t)fCb;
  486. pElpCtrl->hFail = hCb;
  487. }
  488. /****************************************************************************
  489. * elpCtrl_Stop()
  490. ****************************************************************************
  491. * DESCRIPTION: Stop ElpCtrl module before Recovery.
  492. * Move to "open": MODE_KEEP_AWAKE + STATE_ON
  493. *
  494. * INPUTS: hElpCtrl - the handle to the ElpCtrl module.
  495. *
  496. * OUTPUT:
  497. *
  498. * RETURNS: OK
  499. ****************************************************************************/
  500. int elpCtrl_Stop(TI_HANDLE hElpCtrl)
  501. {
  502. elpCtrl_t *pElpCtrl = (elpCtrl_t*)hElpCtrl;
  503. /* set the init state */
  504. pElpCtrl->mode = ELPCTRL_MODE_KEEP_AWAKE;
  505. pElpCtrl->state = ELPS_AWAKE;
  506. /* printk("TI: %s:\t%lu - stop timeout\n", __FUNCTION__, jiffies); */
  507. os_timerStop (pElpCtrl->hOs, pElpCtrl->hTimer);
  508. return OK;
  509. }
  510. /****************************************************************************
  511. * elpCtrl_Start()
  512. ****************************************************************************
  513. * DESCRIPTION: Stop ElpCtrl module before Recovery.
  514. * Move to "open": MODE_KEEP_AWAKE + STATE_ON
  515. *
  516. * INPUTS: hElpCtrl - the handle to the ElpCtrl module.
  517. *
  518. * OUTPUT:
  519. *
  520. * RETURNS: OK
  521. ****************************************************************************/
  522. int elpCtrl_Start(TI_HANDLE hElpCtrl)
  523. {
  524. elpCtrl_t *pElpCtrl = (elpCtrl_t*)hElpCtrl;
  525. /* Set: SCR = 1 and WUP = 1. The pattern is 101 */
  526. /* NOTE: no callback needed */
  527. /* IRQ_SRC(1) WLAN_WUP(1)*/
  528. TNETWIF_WriteELPOpt (pElpCtrl->hTNETWIF,
  529. ELPCTRL_WAKE_UP,
  530. DEFAULT_MODULE_ID,
  531. NULL,
  532. NULL,
  533. TRUE);
  534. return OK;
  535. }