PageRenderTime 67ms CodeModel.GetById 12ms RepoModel.GetById 0ms app.codeStats 0ms

/drivers/net/wireless/tiwlan1251/common/src/TNETW_Driver/Ctrl/Cmd_Queue/CmdQueue.c

http://github.com/CyanogenMod/cm-kernel
C | 1243 lines | 722 code | 148 blank | 373 comment | 81 complexity | 0f568a358ccd8d80d1e5e3f03b25811a 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. #include "osTIType.h"
  36. #include "whalCommon.h"
  37. #include "whalHwDefs.h"
  38. #include "whalBus_Api.h"
  39. #include "CmdMBox_api.h"
  40. #include "CmdQueue_api.h"
  41. #include "CmdQueue.h"
  42. #ifdef TI_DBG
  43. static char *StateString[CMDQUEUE_STATE_NUM] = {
  44. "CMDQUEUE_STATE_IDLE", /* 0 */
  45. "CMDQUEUE_STATE_SEND_CMD_v", /* 1 */
  46. "CMDQUEUE_STATE_WAIT_SEND_CMPLT", /* 2 */
  47. "CMDQUEUE_STATE_INTERROGATE_v", /* 3 */
  48. "CMDQUEUE_STATE_WAIT_RESULT", /* 4 */
  49. "CMDQUEUE_STATE_FINISH_v", /* 5 */
  50. };
  51. static char *EventString[CMDQUEUE_EVENT_NUM] = {
  52. "CMDQUEUE_EVENT_RUN", /* 1 */
  53. "CMDQUEUE_EVENT_SEND_CMPLT", /* 2 */
  54. "CMDQUEUE_EVENT_RESULT_RECEIVED", /* 3 */
  55. };
  56. #endif /* TI_DBG */
  57. /****************************************************************************
  58. * CmdQueue_Create()
  59. ****************************************************************************
  60. * DESCRIPTION: Create the CmdQueue object
  61. *
  62. * INPUTS: TI_HANDLE *hOs
  63. *
  64. * OUTPUT: None
  65. *
  66. * RETURNS: The Created object
  67. *****************************************************************************/
  68. TI_HANDLE CmdQueue_Create(TI_HANDLE hOs)
  69. {
  70. CmdQueue_T *pObj;
  71. pObj = os_memoryAlloc(hOs, sizeof(CmdQueue_T));
  72. if (pObj == NULL)
  73. {
  74. WLAN_OS_REPORT(("FATAL ERROR: CmdQueue_Create(): Error Creating CmdQueue - Aborting\n"));
  75. return NULL;
  76. }
  77. /* reset control module control block */
  78. os_memoryZero(hOs, pObj, sizeof(CmdQueue_T));
  79. pObj->hOs = hOs;
  80. return(pObj);
  81. }
  82. /****************************************************************************
  83. * CmdQueue_Destroy()
  84. ****************************************************************************
  85. * DESCRIPTION: Destroy the object
  86. *
  87. * INPUTS: hCmdQueue The object to free
  88. *
  89. * OUTPUT: None
  90. *
  91. * RETURNS: OK or NOK
  92. ****************************************************************************/
  93. int CmdQueue_Destroy(TI_HANDLE hCmdQueue)
  94. {
  95. CmdQueue_T* pCmdQueue = (CmdQueue_T*) hCmdQueue;
  96. /* free context */
  97. os_memoryFree(pCmdQueue->hOs, pCmdQueue, sizeof(CmdQueue_T));
  98. return OK;
  99. }
  100. /****************************************************************************
  101. * CmdQueue_Config()
  102. ****************************************************************************
  103. * DESCRIPTION: Config the CmdQueue object
  104. *
  105. * INPUTS:
  106. *
  107. * OUTPUT: None
  108. *
  109. * RETURNS: OK or NOK
  110. ****************************************************************************/
  111. int CmdQueue_Config (TI_HANDLE hCmdQueue, TI_HANDLE hCmdMBox, TI_HANDLE hReport)
  112. {
  113. CmdQueue_T* pCmdQueue = (CmdQueue_T*) hCmdQueue;
  114. pCmdQueue->Head = 0;
  115. pCmdQueue->Tail = 0;
  116. pCmdQueue->NumberOfCommandInQueue = 0;
  117. pCmdQueue->MaxNumberOfCommandInQueue = 0;
  118. pCmdQueue->State = CMDQUEUE_STATE_IDLE;
  119. pCmdQueue->CmdCompleteGenericCB_Func = NULL;
  120. pCmdQueue->CmdCompleteGenericCB_Arg = NULL;
  121. pCmdQueue->FailureCB = NULL;
  122. pCmdQueue->FailureCbHandle = NULL;
  123. pCmdQueue->SM_RC = 0;
  124. pCmdQueue->hReport = hReport;
  125. pCmdQueue->hCmdMBox = hCmdMBox;
  126. pCmdQueue->ErrorFlag = FALSE;
  127. /*
  128. * NOTE: don't set NumberOfRecoveryNodes = 0;
  129. * its value is used by recovery process
  130. */
  131. return OK;
  132. }
  133. /****************************************************************************
  134. * CmdQueue_StartReconfig()
  135. ****************************************************************************
  136. * DESCRIPTION: Restart the module for recovery. Clean the queue but save al the CB in the queue.
  137. *
  138. * INPUTS:
  139. *
  140. * OUTPUT:
  141. *
  142. * RETURNS: OK or NOK
  143. ****************************************************************************/
  144. int CmdQueue_StartReconfig(TI_HANDLE hCmdQueue)
  145. {
  146. CmdQueue_T* pCmdQueue = (CmdQueue_T*) hCmdQueue;
  147. int CurrentCmdindex;
  148. int first = pCmdQueue->Head;
  149. CmdQueue_CmdNode_T* pHead ;
  150. CmdQueue_RecoveryNode_T* pRecoveryNode;
  151. /*
  152. stop the SM
  153. */
  154. pCmdQueue->State = CMDQUEUE_STATE_IDLE;
  155. WLAN_REPORT_INFORMATION(pCmdQueue->hReport, CMD_MBOX_MODULE_LOG,
  156. ("CmdQueue_Clean: Cleaning CmdQueue Queue"));
  157. /*
  158. Save The Call Back Function in the Queue in order the return them after the recovery
  159. with on error status
  160. */
  161. /* Clean The Command Call Back Counter */
  162. pCmdQueue->NumberOfRecoveryNodes = 0;
  163. pRecoveryNode = &pCmdQueue->RecoveryQueue[pCmdQueue->NumberOfRecoveryNodes];
  164. for(CurrentCmdindex = 0 ; CurrentCmdindex < pCmdQueue->NumberOfCommandInQueue ; CurrentCmdindex++)
  165. {
  166. pHead = &pCmdQueue->CmdQueue[first];
  167. if(pHead->CB_Func != NULL)
  168. { /*Copy the interrogate CB and the interrogate data buffer pointer */
  169. pRecoveryNode->CB_Func = pHead->CB_Func;
  170. pRecoveryNode->CB_Arg = pHead->CB_Arg;
  171. pRecoveryNode->interrogateParamsBuf = pHead->interrogateParamsBuf;
  172. pCmdQueue->NumberOfRecoveryNodes++;
  173. pRecoveryNode = &pCmdQueue->RecoveryQueue[pCmdQueue->NumberOfRecoveryNodes];
  174. }
  175. first++;
  176. if(first == CMDQUEUE_QUEUE_DEPTH)
  177. first = 0;
  178. }
  179. /*
  180. init the queue
  181. */
  182. pCmdQueue->Head = 0;
  183. pCmdQueue->Tail = 0;
  184. pCmdQueue->NumberOfCommandInQueue = 0;
  185. return OK;
  186. }
  187. /****************************************************************************
  188. * CmdQueue_EndReconfig()
  189. ****************************************************************************
  190. * DESCRIPTION: Call the stored CB to end the recovery of the MBox queue
  191. *
  192. * INPUTS:
  193. *
  194. * OUTPUT:
  195. *
  196. * RETURNS: OK or NOK
  197. ****************************************************************************/
  198. int CmdQueue_EndReconfig(TI_HANDLE hCmdQueue)
  199. {
  200. CmdQueue_T* pCmdQueue = (CmdQueue_T*) hCmdQueue;
  201. int Cbindex;
  202. CmdQueue_RecoveryNode_T *pHead;
  203. for(Cbindex = 0; Cbindex < pCmdQueue->NumberOfRecoveryNodes; Cbindex++)
  204. {
  205. pHead = &pCmdQueue->RecoveryQueue[Cbindex];
  206. if(pHead->interrogateParamsBuf)
  207. {
  208. ((CmdQueue_InterrogateCB_t)pHead->CB_Func)(pHead->CB_Arg, CMD_STATUS_FW_RESET,pHead->interrogateParamsBuf);
  209. }
  210. else
  211. {
  212. ((CmdQueue_CB_t)pHead->CB_Func)(pHead->CB_Arg, CMD_STATUS_FW_RESET);
  213. }
  214. }
  215. pCmdQueue->NumberOfRecoveryNodes = 0;
  216. return OK;
  217. }
  218. /****************************************************************************
  219. * CmdQueue_RegisterCmdCompleteGenericCB()
  220. ****************************************************************************
  221. * DESCRIPTION: Register for a call back to be called when Command Complete
  222. * Occur and the CmdMboxCB was NULL
  223. *
  224. * RETURNS:None
  225. ****************************************************************************/
  226. int CmdQueue_RegisterCmdCompleteGenericCB(TI_HANDLE hCmdQueue, void *CB_Func, TI_HANDLE CB_handle)
  227. {
  228. CmdQueue_T* pCmdQueue = (CmdQueue_T*) hCmdQueue;
  229. if ((CB_Func == NULL) || (CB_handle == NULL))
  230. {
  231. WLAN_REPORT_ERROR(pCmdQueue->hReport, HAL_CTRL_MODULE_LOG, ("CmdQueue_RegisterCmdCompleteGenericCB: NULL parameter\n"));
  232. return NOK;
  233. }
  234. pCmdQueue->CmdCompleteGenericCB_Func = (CmdQueue_GenericCB_t)CB_Func;
  235. pCmdQueue->CmdCompleteGenericCB_Arg = CB_handle;
  236. return OK;
  237. }
  238. /****************************************************************************
  239. * CmdQueue_RegisterForErrorCB()
  240. ****************************************************************************
  241. * DESCRIPTION: Register for a call back to be called when an Error (Timeout)
  242. * Occur
  243. *
  244. * RETURNS:None
  245. ****************************************************************************/
  246. int CmdQueue_RegisterForErrorCB(TI_HANDLE hCmdQueue, void *CB_Func, TI_HANDLE CB_handle)
  247. {
  248. CmdQueue_T* pCmdQueue = (CmdQueue_T*) hCmdQueue;
  249. if ((CB_Func == NULL) || (CB_handle == NULL))
  250. {
  251. WLAN_REPORT_ERROR(pCmdQueue->hReport, HAL_CTRL_MODULE_LOG, ("CmdQueue_RegisterForErrorCB: NULL parameters\n"));
  252. return NOK;
  253. }
  254. pCmdQueue->FailureCbHandle = CB_handle;
  255. pCmdQueue->FailureCB = (CmdQueue_CB_t)CB_Func;
  256. return OK;
  257. }
  258. /****************************************************************************
  259. * CmdQueue_CmdConfigure()
  260. ****************************************************************************
  261. * DESCRIPTION: Send configure command with its information element parameter
  262. *
  263. * INPUTS:
  264. *
  265. * OUTPUT: None
  266. *
  267. * RETURNS: OK or NOK
  268. ****************************************************************************/
  269. int CmdQueue_CmdConfigure(TI_HANDLE hCmdQueue, void *MboxBuf,UINT32 ParamsLen)
  270. {
  271. int status;
  272. CmdQueue_T* pCmdQueue = (CmdQueue_T*) hCmdQueue;
  273. CHECK_ERROR_FLAG(pCmdQueue->ErrorFlag);
  274. status = CmdQueue_Push(pCmdQueue, CMD_CONFIGURE,
  275. (UINT8*)MboxBuf, ParamsLen,
  276. NULL, NULL, NULL);
  277. CMDQUEUE_CONVERT_RC(status);
  278. }
  279. /****************************************************************************
  280. * CmdQueue_CmdConfigureWithCb()
  281. ****************************************************************************
  282. * DESCRIPTION: Send configure command with its information element parameter
  283. *
  284. * INPUTS:
  285. *
  286. * OUTPUT: None
  287. *
  288. * RETURNS: OK or NOK
  289. ****************************************************************************/
  290. int CmdQueue_CmdConfigureWithCb(TI_HANDLE hCmdQueue, void *MboxBuf, UINT32 ParamsLen,
  291. void *CB_Func, TI_HANDLE CB_handle)
  292. {
  293. int status;
  294. CmdQueue_T* pCmdQueue = (CmdQueue_T*) hCmdQueue;
  295. CHECK_ERROR_FLAG(pCmdQueue->ErrorFlag);
  296. status = CmdQueue_Push(pCmdQueue, CMD_CONFIGURE,
  297. (UINT8*)MboxBuf, ParamsLen,
  298. CB_Func, CB_handle, NULL);
  299. CMDQUEUE_CONVERT_RC(status);
  300. }
  301. #if 0
  302. /*
  303. * NOTE: The following function may NOT be used in fully asynchronous mode.
  304. * Its source code remained only for easier backword rollback
  305. */
  306. /****************************************************************************
  307. * CmdQueue_CmdInterrogate()
  308. ****************************************************************************
  309. * DESCRIPTION: Send interrogate command with its information element parameter
  310. *
  311. * INPUTS:
  312. *
  313. * OUTPUT: None
  314. *
  315. * RETURNS: OK or NOK
  316. ****************************************************************************/
  317. int CmdQueue_CmdInterrogate(TI_HANDLE hCmdQueue, void *MboxBuf, UINT32 ParamsLen)
  318. {
  319. CmdQueue_T* pCmdQueue = (CmdQueue_T*) hCmdQueue;
  320. int status = OK;
  321. CHECK_ERROR_FLAG(pCmdQueue->ErrorFlag);
  322. status = CmdQueue_Push(pCmdQueue, CMD_INTERROGATE,
  323. (UINT8*)MboxBuf, ParamsLen,
  324. NULL, NULL, (UINT8*)MboxBuf);
  325. /*
  326. cause we called an interrogate cmd without a CB function then the Cmd needs to be finished
  327. in this context
  328. */
  329. if (status == TNETWIF_PENDING)
  330. {
  331. WLAN_REPORT_ERROR(pCmdQueue->hReport, CMD_MBOX_MODULE_LOG,
  332. ("CmdQueue_CmdInterrogate:Cmd INTERROGATE ,MboxBuf = 0x%x, Len = %d \n"
  333. , MboxBuf, ParamsLen));
  334. }
  335. CMDQUEUE_CONVERT_RC(status);
  336. }
  337. #endif
  338. /****************************************************************************
  339. * CmdQueue_CmdInterrogateWithCb()
  340. ****************************************************************************
  341. * DESCRIPTION: Send interrogate command with its information element parameter
  342. *
  343. * INPUTS:
  344. *
  345. * OUTPUT: None
  346. *
  347. * RETURNS: OK or NOK
  348. ****************************************************************************/
  349. int CmdQueue_CmdInterrogateWithCb(TI_HANDLE hCmdQueue, void *MboxBuf, UINT32 ParamsLen,
  350. void *CB_Func, TI_HANDLE CB_handle, void *CB_Buf)
  351. {
  352. CmdQueue_T* pCmdQueue = (CmdQueue_T*) hCmdQueue;
  353. int status;
  354. CHECK_ERROR_FLAG(pCmdQueue->ErrorFlag);
  355. if((CB_Func == NULL) || (CB_handle == NULL) || (CB_Buf == NULL))
  356. {
  357. WLAN_REPORT_ERROR(pCmdQueue->hReport, HAL_CTRL_MODULE_LOG,
  358. ("CmdQueue_CommandWithCb: NULL parameters\n"));
  359. return NOK;
  360. }
  361. status = CmdQueue_Push(pCmdQueue, CMD_INTERROGATE,
  362. (UINT8*)MboxBuf, ParamsLen,
  363. CB_Func, CB_handle, (UINT8*)CB_Buf);
  364. CMDQUEUE_CONVERT_RC(status);
  365. }
  366. /***************************************************************************
  367. * CmdQueue_Command()
  368. ****************************************************************************
  369. * DESCRIPTION: Send command to the wlan hardware command mailbox
  370. *
  371. * INPUTS:
  372. *
  373. * OUTPUT: None
  374. *
  375. * RETURNS: OK or NOK
  376. ****************************************************************************/
  377. int CmdQueue_Command(TI_HANDLE hCmdQueue, Command_e MboxCmdType, char *MboxBuf, UINT32 ParamsLen)
  378. {
  379. CmdQueue_T* pCmdQueue = (CmdQueue_T*) hCmdQueue;
  380. int status;
  381. CHECK_ERROR_FLAG(pCmdQueue->ErrorFlag);
  382. status = CmdQueue_Push(pCmdQueue, MboxCmdType,
  383. (UINT8*)MboxBuf, ParamsLen,
  384. NULL, NULL, NULL);
  385. CMDQUEUE_CONVERT_RC(status);
  386. }
  387. /****************************************************************************
  388. * CmdQueue_CommandWithCb()
  389. ****************************************************************************
  390. * DESCRIPTION: Send command with CB to the wlan hardware command mailbox
  391. *
  392. * INPUTS:
  393. *
  394. * OUTPUT: None
  395. *
  396. * RETURNS: OK or NOK
  397. ****************************************************************************/
  398. int CmdQueue_CommandWithCb(TI_HANDLE hCmdQueue, Command_e MboxCmdType, void *MboxBuf, UINT32 ParamsLen,
  399. void *CB_Func, TI_HANDLE CB_handle, void* CB_Buf)
  400. {
  401. CmdQueue_T* pCmdQueue = (CmdQueue_T*)hCmdQueue;
  402. int status;
  403. CHECK_ERROR_FLAG(pCmdQueue->ErrorFlag);
  404. if(((CB_Func != NULL) && (CB_handle == NULL)) || ((CB_Func == NULL) && (CB_handle != NULL)))
  405. {
  406. WLAN_REPORT_ERROR(pCmdQueue->hReport, HAL_CTRL_MODULE_LOG,
  407. ("CmdQueue_CommandWithCb: NULL Object with none NULL CB\n"));
  408. return NOK;
  409. }
  410. status = CmdQueue_Push(pCmdQueue, MboxCmdType,
  411. (UINT8*)MboxBuf, ParamsLen,
  412. CB_Func, CB_handle, (UINT8*)CB_Buf);
  413. CMDQUEUE_CONVERT_RC(status);
  414. }
  415. /****************************************************************************
  416. * CmdQueue_Push()
  417. ****************************************************************************
  418. * DESCRIPTION: Push the command Node to the Queue with its information element parameter
  419. *
  420. * INPUTS:
  421. *
  422. * OUTPUT: None
  423. *
  424. * RETURNS: NOK OK
  425. ****************************************************************************/
  426. int CmdQueue_Push(CmdQueue_T *pCmdQueue, Command_e cmdType,
  427. UINT8* pParamsBuf, UINT32 paramsLen,
  428. void *CB_Func, TI_HANDLE CB_Arg, UINT8* pCB_Buf)
  429. {
  430. #ifdef TI_DBG
  431. /*
  432. check if Queue is Full
  433. */
  434. if(pCmdQueue->NumberOfCommandInQueue == CMDQUEUE_QUEUE_DEPTH)
  435. {
  436. WLAN_REPORT_ERROR(pCmdQueue->hReport, CMD_MBOX_MODULE_LOG,
  437. ("CmdQueue_Push: ** ERROR ** The Queue is full\n"
  438. "CmdType = %s %s , Len = %d InfoElemId = 0x%x\n",
  439. CmdQueue_GetCmdString(cmdType),
  440. CmdQueue_GetIEString( cmdType,*(UINT16 *)pParamsBuf), paramsLen, *(UINT16 *)pParamsBuf));
  441. return NOK;
  442. }
  443. #endif /* TI_DBG*/
  444. /* initializes the last Node in the Queue with the arrgs */
  445. pCmdQueue->CmdQueue[pCmdQueue->Tail].cmdType = cmdType;
  446. pCmdQueue->CmdQueue[pCmdQueue->Tail].paramsLen = paramsLen;
  447. pCmdQueue->CmdQueue[pCmdQueue->Tail].CB_Func = CB_Func;
  448. pCmdQueue->CmdQueue[pCmdQueue->Tail].CB_Arg = CB_Arg;
  449. if(cmdType == CMD_INTERROGATE)
  450. {
  451. os_memoryCopy(pCmdQueue->hOs, pCmdQueue->CmdQueue[pCmdQueue->Tail].paramsBuf, pParamsBuf, CMDQUEUE_INFO_ELEM_HEADER_LEN);
  452. }
  453. else
  454. os_memoryCopy(pCmdQueue->hOs, pCmdQueue->CmdQueue[pCmdQueue->Tail].paramsBuf, pParamsBuf, paramsLen);
  455. pCmdQueue->CmdQueue[pCmdQueue->Tail].interrogateParamsBuf = pCB_Buf;
  456. /*advance the Queue tail*/
  457. pCmdQueue->Tail++;
  458. if(pCmdQueue->Tail == CMDQUEUE_QUEUE_DEPTH)
  459. pCmdQueue->Tail = 0;
  460. /* update counters */
  461. pCmdQueue->NumberOfCommandInQueue++;
  462. #ifdef TI_DBG
  463. if(pCmdQueue->MaxNumberOfCommandInQueue < pCmdQueue->NumberOfCommandInQueue)
  464. pCmdQueue->MaxNumberOfCommandInQueue = pCmdQueue->NumberOfCommandInQueue;
  465. #endif /* TI_DBG*/
  466. WLAN_REPORT_INFORMATION(pCmdQueue->hReport, CMDQUEUE_MODULE_LOG,
  467. ("CmdQueue_Push: CmdType = %s (%s(%d))\n"
  468. "Len = %d, NumOfCmd = %d \n",
  469. CmdQueue_GetCmdString(cmdType),
  470. (pParamsBuf) ? CmdQueue_GetIEString(cmdType,*(UINT16 *)pParamsBuf):"",
  471. (pParamsBuf) ? *(UINT16 *)pParamsBuf:0,
  472. paramsLen, pCmdQueue->NumberOfCommandInQueue));
  473. /*if Queue has only one command trigger the send command form Queue */
  474. if (pCmdQueue->NumberOfCommandInQueue == 1)
  475. {
  476. return (CmdQueue_SM(pCmdQueue,CMDQUEUE_EVENT_RUN));
  477. }
  478. else
  479. return (OK);
  480. }
  481. /****************************************************************************
  482. * CmdQueue_SM()
  483. ****************************************************************************
  484. * DESCRIPTION: inplement the CmdQueue SM
  485. *
  486. * INPUTS:
  487. *
  488. * OUTPUT: None
  489. *
  490. * RETURNS: OK or NOK
  491. ****************************************************************************/
  492. int CmdQueue_SM(CmdQueue_T* pCmdQueue,CmdQueue_SMEvents_e event)
  493. {
  494. int rc = OK;
  495. int breakWhile = FALSE;
  496. CmdQueue_CmdNode_T* pHead;
  497. TI_STATUS status;
  498. while(!breakWhile)
  499. {
  500. WLAN_REPORT_INFORMATION(pCmdQueue->hReport, CMDQUEUE_MODULE_LOG,
  501. ("CmdQueue_SM: state = %s (%d) event = %s(%d), rc = %d\n",
  502. StateString[pCmdQueue->State],
  503. pCmdQueue->State,
  504. EventString[event],
  505. event,rc));
  506. switch(pCmdQueue->State)
  507. {
  508. /***************************************
  509. CMDQUEUE_STATE_IDLE
  510. ***************************************/
  511. case CMDQUEUE_STATE_IDLE:
  512. switch(event)
  513. {
  514. case CMDQUEUE_EVENT_RUN:
  515. pCmdQueue->State = CMDQUEUE_STATE_SEND_CMD_v;
  516. break;
  517. default:
  518. WLAN_REPORT_ERROR(pCmdQueue->hReport, CMD_MBOX_MODULE_LOG,
  519. ("CmdQueue_SM: ** ERROR ** No such event (%d) for state CMDQUEUE_STATE_IDLE\n",event));
  520. return NOK;
  521. }
  522. break;
  523. /***************************************
  524. CMDQUEUE_STATE_SEND_CMD_v
  525. ***************************************/
  526. case CMDQUEUE_STATE_SEND_CMD_v:
  527. pHead = &pCmdQueue->CmdQueue[pCmdQueue->Head];
  528. WLAN_REPORT_INFORMATION(pCmdQueue->hReport, CMDQUEUE_MODULE_LOG,
  529. ("CmdQueue_SM: Send Cmd: CmdType = %s(%s)\n"
  530. "Len = %d, NumOfCmd = %d \n",
  531. CmdQueue_GetCmdString(pHead->cmdType),
  532. (pHead->paramsBuf) ? CmdQueue_GetIEString(pHead->cmdType,*(UINT16 *)pHead->paramsBuf):"",
  533. pHead->paramsLen, pCmdQueue->NumberOfCommandInQueue));
  534. #ifdef TI_DBG
  535. pCmdQueue->CmdSendCounter++;
  536. #endif /* TI_DBG */
  537. pCmdQueue->State = CMDQUEUE_STATE_INTERROGATE_v;
  538. /* send the command to TNET */
  539. if(pHead->cmdType == CMD_INTERROGATE)
  540. rc = CmdMBox_SendCmd(pCmdQueue->hCmdMBox,
  541. pHead->cmdType,
  542. pHead->paramsBuf,
  543. CMDQUEUE_INFO_ELEM_HEADER_LEN);
  544. else
  545. rc = CmdMBox_SendCmd(pCmdQueue->hCmdMBox,
  546. pHead->cmdType,
  547. pHead->paramsBuf,
  548. pHead->paramsLen);
  549. if(rc == TNETWIF_PENDING)
  550. {
  551. if(pCmdQueue->SM_RC)
  552. {
  553. rc = pCmdQueue->SM_RC;
  554. }
  555. pCmdQueue->State = CMDQUEUE_STATE_WAIT_SEND_CMPLT;
  556. breakWhile = TRUE;
  557. }
  558. else
  559. {
  560. breakWhile = TRUE;
  561. }
  562. break;
  563. /***************************************
  564. CMDQUEUE_STATE_WAIT_SEND_CMPLT
  565. ***************************************/
  566. case CMDQUEUE_STATE_WAIT_SEND_CMPLT:
  567. switch(event)
  568. {
  569. case CMDQUEUE_EVENT_SEND_CMPLT:
  570. #ifdef TI_DBG
  571. pCmdQueue->CmdCompltCounter++;
  572. #endif /* TI_DBG */
  573. pCmdQueue->State = CMDQUEUE_STATE_INTERROGATE_v;
  574. break;
  575. default:
  576. WLAN_REPORT_ERROR(pCmdQueue->hReport, CMD_MBOX_MODULE_LOG,
  577. ("CmdQueue_SM: ** ERROR ** No such event (%d) for state CMDQUEUE_STATE_WAIT_SEND_CMPLT\n",event));
  578. return NOK;
  579. }
  580. break;
  581. /***************************************
  582. CMDQUEUE_STATE_INTERROGATE_v
  583. ***************************************/
  584. case CMDQUEUE_STATE_INTERROGATE_v:
  585. pHead = &pCmdQueue->CmdQueue[pCmdQueue->Head];
  586. rc = CmdMBox_GetResult(pCmdQueue->hCmdMBox,
  587. pHead->interrogateParamsBuf, pHead->paramsLen, (UINT32*)&status);
  588. if(rc == TNETWIF_PENDING)
  589. {
  590. pCmdQueue->State = CMDQUEUE_STATE_WAIT_RESULT;
  591. breakWhile = TRUE;
  592. }
  593. else
  594. {
  595. if(status != OK)
  596. {
  597. pCmdQueue->ErrorFlag = TRUE;
  598. return OK;
  599. }
  600. pCmdQueue->State = CMDQUEUE_STATE_FINISH_v;
  601. }
  602. break;
  603. /***************************************
  604. CMDQUEUE_STATE_WAIT_RESULT
  605. ***************************************/
  606. case CMDQUEUE_STATE_WAIT_RESULT:
  607. switch(event)
  608. {
  609. case CMDQUEUE_EVENT_RESULT_RECEIVED:
  610. rc = TNETWIF_COMPLETE;
  611. pCmdQueue->State = CMDQUEUE_STATE_FINISH_v;
  612. break;
  613. default:
  614. WLAN_REPORT_ERROR(pCmdQueue->hReport, CMD_MBOX_MODULE_LOG,
  615. ("CmdQueue_SM: ** ERROR ** No such event (%d) for state CMDQUEUE_STATE_WAIT_RESULT\n",event));
  616. return NOK;
  617. }
  618. break;
  619. /***************************************
  620. CMDQUEUE_STATE_FINISH_v
  621. ***************************************/
  622. case CMDQUEUE_STATE_FINISH_v:
  623. {
  624. Command_e cmdType;
  625. UINT16 uParam;
  626. void *fCb, *hCb, *pCb;
  627. pHead = &pCmdQueue->CmdQueue[pCmdQueue->Head];
  628. /* Keep callback parameters in temporary variables */
  629. cmdType = pHead->cmdType;
  630. uParam = *(UINT16 *)pHead->paramsBuf;
  631. fCb = pHead->CB_Func;
  632. hCb = pHead->CB_Arg;
  633. pCb = pHead->interrogateParamsBuf;
  634. /*
  635. * Delete the command from the queue before calling a callback
  636. * because there may be nested calls inside a callback
  637. */
  638. pCmdQueue->Head ++;
  639. if (pCmdQueue->Head >= CMDQUEUE_QUEUE_DEPTH)
  640. pCmdQueue->Head = 0;
  641. pCmdQueue->NumberOfCommandInQueue --;
  642. /* Check if queue is empty to send the next command */
  643. if (pCmdQueue->NumberOfCommandInQueue > 0)
  644. {
  645. pCmdQueue->SM_RC = rc;
  646. pCmdQueue->State = CMDQUEUE_STATE_SEND_CMD_v;
  647. }
  648. else
  649. {
  650. pCmdQueue->SM_RC = 0;
  651. pCmdQueue->State = CMDQUEUE_STATE_IDLE;
  652. breakWhile = TRUE;
  653. }
  654. /*
  655. * Call the user callback after deleting the command from the queue
  656. * because there may be nested calls inside a callback
  657. */
  658. status = CmdMBox_GetStatus(pCmdQueue->hCmdMBox);
  659. if (fCb)
  660. {
  661. if(pCb)
  662. {
  663. ((CmdQueue_InterrogateCB_t)fCb) (hCb, status, pCb);
  664. }
  665. else
  666. {
  667. ((CmdQueue_CB_t)fCb) (hCb, status);
  668. }
  669. }
  670. else
  671. {
  672. /* Call the generic callback */
  673. if (pCmdQueue->CmdCompleteGenericCB_Func)
  674. {
  675. pCmdQueue->CmdCompleteGenericCB_Func (pCmdQueue->CmdCompleteGenericCB_Arg,
  676. cmdType,
  677. uParam,
  678. status);
  679. }
  680. }
  681. }
  682. break;
  683. default:
  684. WLAN_REPORT_ERROR(pCmdQueue->hReport, CMD_MBOX_MODULE_LOG,
  685. ("CmdQueue_SM: ** ERROR ** No such state (%d)\n",pCmdQueue->State));
  686. return NOK;
  687. }
  688. }
  689. WLAN_REPORT_INFORMATION(pCmdQueue->hReport, CMDQUEUE_MODULE_LOG,
  690. ("CmdQueue_SM: rc = %d\n",rc));
  691. return rc;
  692. }
  693. /*******************************************************************************************************
  694. * CmdQueue_SendCmplt()
  695. ******************************************************************************************************
  696. * DESCRIPTION: This function is the CB from the CmdMBox that will issue the "SendCmplt" event to
  697. * the CmdQueue SM. Indicates that the Cmd was transferred to the FW.
  698. *
  699. * RETURNS: OK
  700. *************************************************************************************************/
  701. int CmdQueue_SendCmplt(TI_HANDLE hCmdQueue)
  702. {
  703. CmdQueue_T* pCmdQueue = (CmdQueue_T*)hCmdQueue;
  704. /* call the SM for further execution */
  705. return CmdQueue_SM(pCmdQueue,CMDQUEUE_EVENT_SEND_CMPLT);
  706. }
  707. /*******************************************************************************************************
  708. * CmdQueue_ResultReceived()
  709. ******************************************************************************************************
  710. * DESCRIPTION: This function is the CB from the CmdMBox that will issue the "ResultReceived"
  711. * event to the CmdQueue SM. Indicates that the Cmd's results were read from
  712. * the FW.
  713. *
  714. * RETURNS: OK
  715. *************************************************************************************************/
  716. int CmdQueue_ResultReceived(TI_HANDLE hCmdQueue, UINT32 status)
  717. {
  718. CmdQueue_T* pCmdQueue = (CmdQueue_T*)hCmdQueue;
  719. /* call the SM for further execution */
  720. return CmdQueue_SM(pCmdQueue,CMDQUEUE_EVENT_RESULT_RECEIVED);
  721. }
  722. /****************************************************************************
  723. * CmdQueue_TimeOut()
  724. ****************************************************************************
  725. * DESCRIPTION: Called when a command timeout occur
  726. *
  727. * OUTPUT: None
  728. *
  729. * RETURNS: OK or NOK
  730. ******************************************************************************/
  731. int CmdQueue_Error(TI_HANDLE hCmdQueue)
  732. {
  733. CmdQueue_T* pCmdQueue = (CmdQueue_T*)hCmdQueue;
  734. #ifdef TI_DBG
  735. CmdQueue_CmdNode_T* pHead = &pCmdQueue->CmdQueue[pCmdQueue->Head];
  736. UINT32 TimeStamp = os_timeStampMs(pCmdQueue->hOs);
  737. WLAN_REPORT_ERROR(pCmdQueue->hReport, CMD_MBOX_MODULE_LOG,
  738. ("CmdQueue_Error: **ERROR** Command Occured \n"
  739. " Cmd = %s %s , Len = %d \n "
  740. " NumOfCmd = %d \n"
  741. " MAC TimeStamp on timeout = %d\n ",
  742. CmdQueue_GetCmdString(pHead->cmdType),
  743. CmdQueue_GetIEString(pHead->cmdType, *(UINT16 *)pHead->paramsBuf),
  744. pHead->paramsLen,
  745. pCmdQueue->NumberOfCommandInQueue,
  746. TimeStamp));
  747. #endif
  748. /* Print The command that was sent before the timeout occur */
  749. CmdQueue_PrintHistory(pCmdQueue, CMDQUEUE_HISTORY_DEPTH);
  750. /* preform Recovery */
  751. #ifdef TI_DBG
  752. if(pCmdQueue->FailureCB)
  753. #endif
  754. pCmdQueue->FailureCB(pCmdQueue->FailureCbHandle,NOK);
  755. return OK;
  756. }
  757. /****************************************************************************
  758. * CmdQueue_Print()
  759. ****************************************************************************
  760. * DESCRIPTION:
  761. *
  762. * INPUTS:
  763. *
  764. * OUTPUT: None
  765. *
  766. * RETURNS:
  767. ****************************************************************************/
  768. void CmdQueue_Print(TI_HANDLE hCmdQueue)
  769. {
  770. CmdQueue_T* pCmdQueue = (CmdQueue_T*)hCmdQueue;
  771. WLAN_REPORT_REPLY(pCmdQueue->hReport, CMD_MBOX_MODULE_LOG,
  772. ("------------- CmdQueue Queue -------------------\n"));
  773. WLAN_REPORT_REPLY(pCmdQueue->hReport, CMD_MBOX_MODULE_LOG,
  774. ("CmdQueue_Print:The Max NumOfCmd in Queue was = %d\n",
  775. pCmdQueue->MaxNumberOfCommandInQueue));
  776. WLAN_REPORT_REPLY(pCmdQueue->hReport, CMD_MBOX_MODULE_LOG,
  777. ("CmdQueue_Print:The Current NumOfCmd in Queue = %d\n",
  778. pCmdQueue->NumberOfCommandInQueue));
  779. #ifdef TI_DBG
  780. WLAN_REPORT_REPLY(pCmdQueue->hReport, CMD_MBOX_MODULE_LOG,
  781. ("CmdQueue_Print:The Total number of Cmd send from Queue= %d\n",
  782. pCmdQueue->CmdSendCounter));
  783. WLAN_REPORT_REPLY(pCmdQueue->hReport, CMD_MBOX_MODULE_LOG,
  784. ("CmdQueue_Print:The Total number of Cmd Completed interrupt= %d\n",
  785. pCmdQueue->CmdCompltCounter));
  786. #endif
  787. CmdQueue_PrintQueue(pCmdQueue);
  788. }
  789. /****************************************************************************
  790. * CmdQueue_PrintQueue()
  791. ****************************************************************************
  792. * DESCRIPTION:
  793. *
  794. * INPUTS:
  795. *
  796. * OUTPUT: None
  797. *
  798. * RETURNS:
  799. ****************************************************************************/
  800. void CmdQueue_PrintQueue(CmdQueue_T *pCmdQueue)
  801. {
  802. int CurrentCmdindex;
  803. int first = pCmdQueue->Head;
  804. CmdQueue_CmdNode_T* pHead;
  805. int NumberOfCommand = pCmdQueue->NumberOfCommandInQueue;
  806. WLAN_OS_REPORT(("CmdQueue_PrintQueue \n"));
  807. for(CurrentCmdindex = 0 ; CurrentCmdindex < NumberOfCommand ; CurrentCmdindex++)
  808. {
  809. pHead = &pCmdQueue->CmdQueue[first];
  810. #ifdef TI_DBG
  811. WLAN_OS_REPORT(("Cmd index %d CmdType = %s %s, Len = %d, Place in Queue = %d \n",
  812. CurrentCmdindex,
  813. CmdQueue_GetCmdString(pHead->cmdType),
  814. CmdQueue_GetIEString(pHead->cmdType, (((pHead->cmdType == CMD_INTERROGATE)||(pHead->cmdType == CMD_CONFIGURE)) ? *(UINT16 *)pHead->paramsBuf : 0)),
  815. pHead->paramsLen,
  816. first));
  817. #else
  818. WLAN_OS_REPORT(("Cmd index %d CmdType = %d %d, Len = %d, Place in Queue = %d \n",
  819. CurrentCmdindex,
  820. pHead->cmdType,
  821. (((pHead->cmdType == CMD_INTERROGATE)||(pHead->cmdType == CMD_CONFIGURE)||
  822. (pHead->cmdType == CMD_READ_MEMORY)||(pHead->cmdType == CMD_WRITE_MEMORY)) ? *(UINT16 *)pHead->paramsBuf : 0),
  823. pHead->paramsLen,
  824. first));
  825. #endif
  826. first++;
  827. if(first == CMDQUEUE_QUEUE_DEPTH)
  828. first = 0;
  829. }
  830. }
  831. /****************************************************************************
  832. * CmdQueue_PrintHistory()
  833. ****************************************************************************
  834. * DESCRIPTION: print the last command according to a value
  835. *
  836. * INPUTS: NunOfCmd : the number of the last command to print
  837. *
  838. ****************************************************************************/
  839. void CmdQueue_PrintHistory(TI_HANDLE hCmdQueue, int NunOfCmd)
  840. {
  841. CmdQueue_T* pCmdQueue = (CmdQueue_T*)hCmdQueue;
  842. int CurrentCmdindex;
  843. int first = pCmdQueue->Head;
  844. CmdQueue_CmdNode_T* pHead ;
  845. WLAN_OS_REPORT(("--------------- CmdQueue_PrintHistory of %d -------------------\n",NunOfCmd));
  846. for(CurrentCmdindex = 0 ; CurrentCmdindex < NunOfCmd ; CurrentCmdindex++)
  847. {
  848. pHead = &pCmdQueue->CmdQueue[first];
  849. #ifdef TI_DBG
  850. WLAN_OS_REPORT(("Cmd index %d CmdType = %s %s, Len = %d, Place in Queue = %d \n",
  851. CurrentCmdindex,
  852. CmdQueue_GetCmdString(pHead->cmdType),
  853. CmdQueue_GetIEString(pHead->cmdType, (((pHead->cmdType == CMD_INTERROGATE)||(pHead->cmdType == CMD_CONFIGURE)) ? *(UINT16 *)pHead->paramsBuf : 0)),
  854. pHead->paramsLen,
  855. first));
  856. #else
  857. WLAN_OS_REPORT(("Cmd index %d CmdType = %d %d, Len = %d, Place in Queue = %d \n",
  858. CurrentCmdindex,
  859. pHead->cmdType,
  860. (((pHead->cmdType == CMD_INTERROGATE)||(pHead->cmdType == CMD_CONFIGURE)||
  861. (pHead->cmdType == CMD_READ_MEMORY)||(pHead->cmdType == CMD_WRITE_MEMORY)) ? *(UINT16 *)pHead->paramsBuf : 0),
  862. pHead->paramsLen,
  863. first));
  864. #endif
  865. if(first == 0)
  866. first = CMDQUEUE_QUEUE_DEPTH-1;
  867. else
  868. first--;
  869. }
  870. WLAN_OS_REPORT(("-----------------------------------------------------------------------\n"));
  871. }
  872. /****************************************************************************
  873. * CmdQueue_GetMaxNumberOfCommands()
  874. ****************************************************************************
  875. * DESCRIPTION: returns maximum number of commands (ever) in CmdQueue queue
  876. *
  877. * INPUTS:
  878. *
  879. * OUTPUT: None
  880. *
  881. * RETURNS: maximum number of commands (ever) in mailbox queue
  882. ****************************************************************************/
  883. int CmdQueue_GetMaxNumberOfCommands (TI_HANDLE hCmdQueue)
  884. {
  885. CmdQueue_T* pCmdQueue = (CmdQueue_T*)hCmdQueue;
  886. return (pCmdQueue->MaxNumberOfCommandInQueue);
  887. }
  888. #ifdef REPORT_LOG
  889. /****************************************************************************
  890. * CmdQueue_GetCmdString()
  891. ****************************************************************************
  892. * DESCRIPTION:
  893. *
  894. * INPUTS:
  895. *
  896. * OUTPUT: None
  897. *
  898. * RETURNS:
  899. ****************************************************************************/
  900. char* CmdQueue_GetCmdString(int MboxCmdType)
  901. {
  902. switch (MboxCmdType)
  903. {
  904. case 0: return "CMD_RESET";
  905. case 1: return "CMD_INTERROGATE";
  906. case 2: return "CMD_CONFIGURE";
  907. case 3: return "CMD_ENABLE_RX";
  908. case 4: return "CMD_ENABLE_TX";
  909. case 5: return "CMD_DISABLE_RX";
  910. case 6: return "CMD_DISABLE_TX";
  911. case 8: return "CMD_SCAN";
  912. case 9: return "CMD_STOP_SCAN";
  913. case 10: return "CMD_VBM";
  914. case 11: return "CMD_START_JOIN";
  915. case 12: return "CMD_SET_KEYS";
  916. case 13: return "CMD_READ_MEMORY";
  917. case 14: return "CMD_WRITE_MEMORY";
  918. case 19: return "CMD_BEACON";
  919. case 20: return "CMD_PROBE_RESP";
  920. case 21: return "CMD_NULL_DATA";
  921. case 22: return "CMD_PROBE_REQ";
  922. case 23: return "CMD_TEST";
  923. case 27: return "CMD_ENABLE_RX_PATH";
  924. case 28: return "CMD_NOISE_HIST";
  925. case 29: return "CMD_RX_RESET";
  926. case 30: return "CMD_PS_POLL";
  927. case 31: return "CMD_QOS_NULL_DATA";
  928. case 32: return "CMD_LNA_CONTROL";
  929. case 33: return "CMD_SET_BCN_MODE";
  930. case 34: return "CMD_MEASUREMENT";
  931. case 35: return "CMD_STOP_MEASUREMENT";
  932. case 36: return "CMD_DISCONNECT";
  933. case 37: return "CMD_SET_PS_MODE";
  934. case 38: return "CMD_CHANNEL_SWITCH";
  935. case 39: return "CMD_STOP_CHANNEL_SWICTH";
  936. case 40: return "CMD_AP_DISCOVERY";
  937. case 41: return "CMD_STOP_AP_DISCOVERY";
  938. case 42: return "CMD_SPS_SCAN";
  939. case 43: return "CMD_STOP_SPS_SCAN";
  940. case 45: return "CMD_HEALTH_CHECK";
  941. default: return " *** Error No Such CMD **** ";
  942. }
  943. };
  944. /****************************************************************************
  945. * CmdQueue_GetErrorString()
  946. ****************************************************************************
  947. * DESCRIPTION:
  948. *
  949. * INPUTS:
  950. *
  951. * OUTPUT: None
  952. *
  953. * RETURNS:
  954. ****************************************************************************/
  955. char* CmdQueue_GetErrorString(CommandStatus_e MboxError)
  956. {
  957. switch (MboxError)
  958. {
  959. case CMD_MAILBOX_IDLE:
  960. return "CMD_MAILBOX_IDLE";
  961. /* break; to avoid compilation warning */
  962. case CMD_STATUS_SUCCESS:
  963. return "CMD_STATUS_SUCCESS";
  964. /* break; to avoid compilation warning */
  965. case CMD_STATUS_UNKNOWN_CMD:
  966. return "CMD_STATUS_UNKNOWN_CMD";
  967. /* break; to avoid compilation warning */
  968. case CMD_STATUS_UNKNOWN_IE:
  969. return "CMD_STATUS_UNKNOWN_IE";
  970. /* break; to avoid compilation warning */
  971. case CMD_STATUS_RX_BUSY:
  972. return "CMD_STATUS_RX_BUSY";
  973. /* break; to avoid compilation warning */
  974. case CMD_STATUS_INVALID_PARAM:
  975. return "CMD_STATUS_INVALID_PARAM";
  976. /* break; to avoid compilation warning */
  977. case CMD_STATUS_TEMPLATE_TOO_LARGE:
  978. return "CMD_STATUS_TEMPLATE_TOO_LARGE";
  979. /* break; to avoid compilation warning */
  980. case CMD_STATUS_OUT_OF_MEMORY:
  981. return "CMD_STATUS_OUT_OF_MEMORY";
  982. /* break; to avoid compilation warning */
  983. case CMD_STATUS_STA_TABLE_FULL:
  984. return "CMD_STATUS_STA_TABLE_FULL";
  985. /* break; to avoid compilation warning */
  986. case CMD_STATUS_RADIO_ERROR:
  987. return "CMD_STATUS_RADIO_ERROR";
  988. /* break; to avoid compilation warning */
  989. case CMD_STATUS_WRONG_NESTING:
  990. return "CMD_STATUS_WRONG_NESTING";
  991. /* break; to avoid compilation warning */
  992. case CMD_STATUS_TIMEOUT:
  993. return "CMD_STATUS_TIMEOUT";
  994. /* break; to avoid compilation warning */
  995. case CMD_STATUS_FW_RESET:
  996. return "CMD_STATUS_FW_RESET";
  997. /* break; to avoid compilation warning */
  998. default:
  999. return "Unrecognized error code";
  1000. /* break; to avoid compilation warning */
  1001. }
  1002. }
  1003. /****************************************************************************
  1004. * CmdQueue_GetIEString()
  1005. ****************************************************************************
  1006. * DESCRIPTION:
  1007. *
  1008. * INPUTS:
  1009. *
  1010. * OUTPUT: None
  1011. *
  1012. * RETURNS:
  1013. ****************************************************************************/
  1014. char* CmdQueue_GetIEString(int MboxCmdType, UINT16 Id)
  1015. {
  1016. if( MboxCmdType== CMD_INTERROGATE || MboxCmdType == CMD_CONFIGURE)
  1017. {
  1018. switch (Id)
  1019. {
  1020. case ACX_WAKE_UP_CONDITIONS: return " (ACX_WAKE_UP_CONDITIONS)";
  1021. case ACX_MEM_CFG: return " (ACX_MEM_CFG)";
  1022. case ACX_SLOT: return " (ACX_SLOT) ";
  1023. case ACX_QUEUE_HEAD: return " (ACX_QUEUE_HEAD)";
  1024. case ACX_AC_CFG: return " (ACX_AC_CFG) ";
  1025. case ACX_MEM_MAP: return " (ACX_MEM_MAP)";
  1026. case ACX_AID: return " (ACX_AID)";
  1027. case ACX_RADIO_PARAM: return " (ACX_RADIO_PARAM)";
  1028. case ACX_CFG: return " (ACX_CFG) ";
  1029. case ACX_FW_REV: return " (ACX_FW_REV) ";
  1030. case ACX_FCS_ERROR_CNT: return " (ACX_FCS_ERROR_CNT) ";
  1031. case ACX_MEDIUM_USAGE: return " (ACX_MEDIUM_USAGE) ";
  1032. case ACX_RX_CFG: return " (ACX_RX_CFG) ";
  1033. case ACX_TX_QUEUE_CFG: return " (ACX_TX_QUEUE_CFG) ";
  1034. case ACX_BSS_IN_PS: return " (ACX_BSS_IN_PS) ";
  1035. case ACX_STATISTICS: return " (ACX_STATISTICS) ";
  1036. case ACX_FEATURE_CFG: return " (ACX_FEATURE_CFG) ";
  1037. case ACX_MISC_CFG: return " (ACX_MISC_CFG) ";
  1038. case ACX_TID_CFG: return " (ACX_TID_CFG) ";
  1039. case ACX_CAL_ASSESSMENT: return " (ACX_CAL_ASSESSMENT) ";
  1040. case ACX_BEACON_FILTER_OPT: return " (ACX_BEACON_FILTER_OPT) ";
  1041. case ACX_LOW_RSSI: return " (ACX_LOW_RSSI)";
  1042. case ACX_NOISE_HIST: return " (ACX_NOISE_HIST)";
  1043. case ACX_HDK_VERSION: return " (ACX_HDK_VERSION)";
  1044. case ACX_PD_THRESHOLD: return " (ACX_PD_THRESHOLD) ";
  1045. case ACX_DATA_PATH_PARAMS: return " (ACX_DATA_PATH_PARAMS) ";
  1046. case ACX_CCA_THRESHOLD: return " (ACX_CCA_THRESHOLD)";
  1047. case ACX_EVENT_MBOX_MASK: return " (ACX_EVENT_MBOX_MASK) ";
  1048. #ifdef FW_RUNNING_AS_AP
  1049. case ACX_DTIM_PERIOD: return " (ACX_DTIM_PERIOD) ";
  1050. #else
  1051. case ACX_WR_TBTT_AND_DTIM: return " (ACX_WR_TBTT_AND_DTIM) ";
  1052. #endif
  1053. case ACX_ACI_OPTION_CFG: return " (ACX_ACI_OPTION_CFG) ";
  1054. case ACX_GPIO_CFG: return " (ACX_GPIO_CFG) ";
  1055. case ACX_GPIO_SET: return " (ACX_GPIO_SET) ";
  1056. case ACX_PM_CFG: return " (ACX_PM_CFG) ";
  1057. case ACX_CONN_MONIT_PARAMS: return " (ACX_CONN_MONIT_PARAMS) ";
  1058. case ACX_AVERAGE_RSSI: return " (ACX_AVERAGE_RSSI) ";
  1059. case ACX_CONS_TX_FAILURE: return " (ACX_CONS_TX_FAILURE) ";
  1060. case ACX_BCN_DTIM_OPTIONS: return " (ACX_BCN_DTIM_OPTIONS) ";
  1061. case ACX_SG_ENABLE: return " (ACX_SG_ENABLE) ";
  1062. case ACX_SG_CFG: return " (ACX_SG_CFG) ";
  1063. case ACX_ANTENNA_DIVERSITY_CFG: return " (ACX_ANTENNA_DIVERSITY_CFG) ";
  1064. case ACX_LOW_SNR: return " (ACX_LOW_SNR) ";
  1065. case ACX_BEACON_FILTER_TABLE: return " (ACX_BEACON_FILTER_TABLE) ";
  1066. case ACX_ARP_IP_FILTER: return " (ACX_ARP_IP_FILTER) ";
  1067. case ACX_ROAMING_STATISTICS_TBL: return " (ACX_ROAMING_STATISTICS_TBL) ";
  1068. case ACX_RATE_POLICY: return " (ACX_RATE_POLICY) ";
  1069. case ACX_CTS_PROTECTION: return " (ACX_CTS_PROTECTION) ";
  1070. case ACX_SLEEP_AUTH: return " (ACX_SLEEP_AUTH) ";
  1071. case ACX_PREAMBLE_TYPE: return " (ACX_PREAMBLE_TYPE) ";
  1072. case ACX_ERROR_CNT: return " (ACX_ERROR_CNT) ";
  1073. case ACX_FW_GEN_FRAME_RATES: return " (ACX_FW_GEN_FRAME_RATES) ";
  1074. case ACX_IBSS_FILTER: return " (ACX_IBSS_FILTER) ";
  1075. case ACX_SERVICE_PERIOD_TIMEOUT: return " (ACX_SERVICE_PERIOD_TIMEOUT) ";
  1076. case ACX_TSF_INFO: return " (ACX_TSF_INFO) ";
  1077. case ACX_CONFIG_PS_WMM: return " (ACX_CONFIG_PS_WMM) ";
  1078. case ACX_ENABLE_RX_DATA_FILTER: return " (ACX_ENABLE_RX_DATA_FILTER) ";
  1079. case ACX_SET_RX_DATA_FILTER: return " (ACX_SET_RX_DATA_FILTER) ";
  1080. case ACX_GET_DATA_FILTER_STATISTICS:return " (ACX_GET_DATA_FILTER_STATISTICS) ";
  1081. case ACX_POWER_LEVEL_TABLE: return " (ACX_POWER_LEVEL_TABLE) ";
  1082. case ACX_BET_ENABLE: return " (ACX_BET_ENABLE) ";
  1083. case DOT11_STATION_ID: return " (DOT11_STATION_ID) ";
  1084. case DOT11_RX_MSDU_LIFE_TIME: return " (DOT11_RX_MSDU_LIFE_TIME) ";
  1085. case DOT11_CUR_TX_PWR: return " (DOT11_CUR_TX_PWR) ";
  1086. case DOT11_DEFAULT_KEY: return " (DOT11_DEFAULT_KEY) ";
  1087. case DOT11_RX_DOT11_MODE: return " (DOT11_RX_DOT11_MODE) ";
  1088. case DOT11_RTS_THRESHOLD: return " (DOT11_RTS_THRESHOLD) ";
  1089. case DOT11_GROUP_ADDRESS_TBL: return " (DOT11_GROUP_ADDRESS_TBL) ";
  1090. default: return " *** Error No Such IE **** ";
  1091. }
  1092. }
  1093. return "";
  1094. }
  1095. #endif /* REPORT_LOG */