TWD/Ctrl/CmdQueue.c
changeset 0 10c42ec6c05f
equal deleted inserted replaced
-1:000000000000 0:10c42ec6c05f
       
     1 /*
       
     2  * CmdQueue.c
       
     3  *
       
     4  * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
       
     5  * All rights reserved.      
       
     6  * 
       
     7  * This program and the accompanying materials are made available under the 
       
     8  * terms of the Eclipse Public License v1.0 or BSD License which accompanies
       
     9  * this distribution. The Eclipse Public License is available at
       
    10  * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
       
    11  *                                                                       
       
    12  * Redistribution and use in source and binary forms, with or without    
       
    13  * modification, are permitted provided that the following conditions    
       
    14  * are met:                                                              
       
    15  *                                                                       
       
    16  *  * Redistributions of source code must retain the above copyright     
       
    17  *    notice, this list of conditions and the following disclaimer.      
       
    18  *  * Redistributions in binary form must reproduce the above copyright  
       
    19  *    notice, this list of conditions and the following disclaimer in    
       
    20  *    the documentation and/or other materials provided with the         
       
    21  *    distribution.                                                      
       
    22  *  * Neither the name Texas Instruments nor the names of its            
       
    23  *    contributors may be used to endorse or promote products derived    
       
    24  *    from this software without specific prior written permission.      
       
    25  *                                                                       
       
    26  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS   
       
    27  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT     
       
    28  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 
       
    29  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT  
       
    30  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
       
    31  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT      
       
    32  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
       
    33  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
       
    34  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT   
       
    35  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
       
    36  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
       
    37  */
       
    38 
       
    39 
       
    40 /** \file  CmdQueue.c
       
    41  *  \brief Handle the wlan command queue
       
    42  *
       
    43  *  \see CmdQueue.h, CmdQueue_api.h, CmdMBox.c
       
    44  */
       
    45 
       
    46 
       
    47 #define __FILE_ID__  FILE_ID_97
       
    48 #include "tidef.h"
       
    49 #include "osApi.h"
       
    50 #include "report.h"
       
    51 #include "TwIf.h"
       
    52 #include "public_commands.h"
       
    53 #include "CmdQueue_api.h"
       
    54 #include "CmdMBox_api.h"
       
    55 #include "CmdQueue.h"
       
    56 
       
    57 
       
    58 
       
    59 /*****************************************************************************
       
    60  **         Internal functions prototypes                                   **
       
    61  *****************************************************************************/
       
    62 
       
    63 static TI_STATUS    cmdQueue_SM (TI_HANDLE hCmdQueue, ECmdQueueSmEvents event);
       
    64 static TI_STATUS    cmdQueue_Push (TI_HANDLE  hCmdQueue, 
       
    65                                    Command_e  cmdType,
       
    66                                    TI_UINT8   *pParamsBuf, 
       
    67                                    TI_UINT32  uParamsLen,
       
    68                                    void       *fCb, 
       
    69                                    TI_HANDLE  hCb, 
       
    70                                    void       *pCb);
       
    71 #ifdef TI_DBG
       
    72 static void         cmdQueue_PrintQueue(TCmdQueue  *pCmdQueue);
       
    73 static char *       cmdQueue_GetIEString (TI_INT32 MboxCmdType, TI_UINT16 id);
       
    74 static char *       cmdQueue_GetCmdString (TI_INT32 MboxCmdType);
       
    75 #endif /* TI_DBG */
       
    76 
       
    77 
       
    78 
       
    79 
       
    80 /*
       
    81  * \brief	Create the TCmdQueue object
       
    82  * 
       
    83  * \param  hOs  - OS module object handle
       
    84  * \return Handle to the created object
       
    85  * 
       
    86  * \par Description
       
    87  * Calling this function creates a CmdQueue object
       
    88  * 
       
    89  * \sa cmdQueue_Destroy
       
    90  */
       
    91 TI_HANDLE cmdQueue_Create (TI_HANDLE hOs)
       
    92 {
       
    93     TCmdQueue  *pCmdQueue;
       
    94 
       
    95     pCmdQueue = os_memoryAlloc (hOs, sizeof(TCmdQueue),MemoryNormal);
       
    96     if (pCmdQueue == NULL)
       
    97     {
       
    98         WLAN_OS_REPORT(("FATAL ERROR: cmdQueue_Create(): Error Creating aCmdQueue - Aborting\n"));
       
    99         return NULL;
       
   100     }
       
   101 
       
   102     /* reset control module control block */
       
   103     os_memoryZero (hOs, pCmdQueue, sizeof(TCmdQueue));
       
   104     pCmdQueue->hOs = hOs;
       
   105     
       
   106     return pCmdQueue;   
       
   107 }
       
   108 
       
   109 
       
   110 /*
       
   111  * \brief	Destroys the cmdQueue object
       
   112  * 
       
   113  * \param  hCmdMbox  - The object to free
       
   114  * \return TI_OK
       
   115  * 
       
   116  * \par Description
       
   117  * Calling this function destroys the cmdQueue object
       
   118  * 
       
   119  * \sa cmdQueue_Create
       
   120  */
       
   121 TI_STATUS cmdQueue_Destroy (TI_HANDLE hCmdQueue)
       
   122 {
       
   123     TCmdQueue* pCmdQueue = (TCmdQueue*)hCmdQueue;
       
   124 
       
   125     /* Free context */
       
   126     os_memoryFree (pCmdQueue->hOs, pCmdQueue, sizeof(TCmdQueue));
       
   127 
       
   128 	return TI_OK;
       
   129 }
       
   130 
       
   131 
       
   132 /*
       
   133  * \brief	Configure the CmdQueue object
       
   134  * 
       
   135  * \param  hCmdQueue - Handle to CmdQueue
       
   136  * \param  hCmdMbox  - Handle to CmdMbox
       
   137  * \param  hReport - Handle to report module
       
   138  * \param  hTwIf  - Handle to TwIf
       
   139  * \param  hTimer  - Handle to os timer
       
   140  * \return TI_OK on success or TI_NOK on failure
       
   141  * 
       
   142  * \par Description
       
   143  * 
       
   144  * \sa
       
   145  */
       
   146 TI_STATUS cmdQueue_Init   (TI_HANDLE hCmdQueue, 
       
   147                            TI_HANDLE hCmdMbox, 
       
   148                            TI_HANDLE hReport, 
       
   149                            TI_HANDLE hTwIf,
       
   150                            TI_HANDLE hTimer)
       
   151 {
       
   152     TCmdQueue* pCmdQueue = (TCmdQueue*) hCmdQueue;
       
   153 
       
   154     pCmdQueue->head = 0;
       
   155     pCmdQueue->tail = 0;
       
   156     pCmdQueue->uNumberOfCommandInQueue = 0;
       
   157     pCmdQueue->uMaxNumberOfCommandInQueue = 0;
       
   158     pCmdQueue->state = CMDQUEUE_STATE_IDLE;
       
   159     pCmdQueue->fCmdCompleteCb = NULL;
       
   160     pCmdQueue->hCmdCompleteCb = NULL;
       
   161     pCmdQueue->fFailureCb = NULL;
       
   162     pCmdQueue->hFailureCb = NULL;
       
   163     pCmdQueue->hReport = hReport;
       
   164     pCmdQueue->hCmdMBox = hCmdMbox;
       
   165     pCmdQueue->hTwIf = hTwIf;
       
   166     pCmdQueue->bErrorFlag = TI_FALSE;
       
   167     pCmdQueue->bMboxEnabled = TI_FALSE;
       
   168     pCmdQueue->bAwake = TI_FALSE;
       
   169 
       
   170     /* Configure Command Mailbox */
       
   171     cmdMbox_Init (hCmdMbox, hReport, hTwIf,
       
   172                   hTimer, hCmdQueue,
       
   173                   cmdQueue_Error);
       
   174 
       
   175     /*
       
   176      * NOTE: don't set uNumberOfRecoveryNodes = 0; 
       
   177      *       its value is used by recovery process
       
   178      */
       
   179 
       
   180     return TI_OK;
       
   181 }
       
   182 
       
   183 
       
   184 /*
       
   185  * \brief	Configure the CmdQueue object
       
   186  * 
       
   187  * \param  hCmdQueue - Handle to CmdQueue
       
   188  * \param  eCmdQueueEvent - The event that triggered the SM
       
   189  * \return TI_OK on success or TI_NOK on failure
       
   190  * 
       
   191  * \par Description
       
   192  * Handles the CmdQueue SM.
       
   193  * 
       
   194  * \sa cmdQueue_Push, cmdQueue_ResultReceived
       
   195  */
       
   196 static TI_STATUS cmdQueue_SM (TI_HANDLE hCmdQueue, ECmdQueueSmEvents eCmdQueueEvent)
       
   197 {   
       
   198     TCmdQueue     *pCmdQueue = (TCmdQueue*)hCmdQueue;
       
   199     TI_BOOL        bBreakWhile = TI_FALSE;
       
   200     TI_STATUS      rc = TI_OK, status;
       
   201     TCmdQueueNode *pHead;
       
   202     TI_UINT32      uReadLen, uWriteLen;
       
   203 
       
   204     while(!bBreakWhile)
       
   205     {
       
   206         switch (pCmdQueue->state)
       
   207         {
       
   208             case CMDQUEUE_STATE_IDLE:
       
   209                 switch(eCmdQueueEvent)
       
   210                 {
       
   211                     case CMDQUEUE_EVENT_RUN:
       
   212                         pCmdQueue->state = CMDQUEUE_STATE_WAIT_FOR_COMPLETION;
       
   213 
       
   214                         pHead = &pCmdQueue->aCmdQueue[pCmdQueue->head];
       
   215 
       
   216                         #ifdef CMDQUEUE_DEBUG_PRINT
       
   217                         TRACE4(pCmdQueue->hReport, REPORT_SEVERITY_CONSOLE, "cmdQueue_SM: Send Cmd: CmdType = %d(%d) Len = %d, NumOfCmd = %d", pHead->cmdType, (pHead->aParamsBuf) ?  *(TI_UINT16 *)pHead->aParamsBuf:0, pHead->uParamsLen, pCmdQueue->uNumberOfCommandInQueue));
       
   218 
       
   219                         WLAN_OS_REPORT(("cmdQueue_SM: Send Cmd: CmdType = %s(%s)\n"
       
   220                                         "Len = %d, NumOfCmd = %d \n",
       
   221                                         cmdQueue_GetCmdString(pHead->cmdType),
       
   222                                         (pHead->aParamsBuf) ?  cmdQueue_GetIEString(pHead->cmdType,*(TI_UINT16 *)pHead->aParamsBuf):"",
       
   223                                         pHead->uParamsLen, pCmdQueue->uNumberOfCommandInQueue));
       
   224                         #endif
       
   225                 
       
   226                         #ifdef TI_DBG
       
   227                             pCmdQueue->uCmdSendCounter++;
       
   228                         #endif 
       
   229 
       
   230                         /* 
       
   231                          * if bAwake is true, then we reached here because there were more commands 
       
   232                          * in the queue after sending a previous command.
       
   233                          * There is no need to send another awake command to TwIf. 
       
   234                          */
       
   235                         if (pCmdQueue->bAwake == TI_FALSE)
       
   236                         {
       
   237                             /* Keep the device awake for the entire Cmd transaction */
       
   238                             twIf_Awake(pCmdQueue->hTwIf);
       
   239                             pCmdQueue->bAwake = TI_TRUE;
       
   240                         }
       
   241 
       
   242                         if (pHead->cmdType == CMD_INTERROGATE)
       
   243                         {
       
   244                             uWriteLen = CMDQUEUE_INFO_ELEM_HEADER_LEN;
       
   245                             /* Will be updated by CmdMbox to count the status response */
       
   246                             uReadLen = pHead->uParamsLen;
       
   247                         }
       
   248                         else if(pHead->cmdType == CMD_TEST)
       
   249                         {
       
   250                             /* CMD_TEST has configure & interrogate abillities together */
       
   251                             uWriteLen = pHead->uParamsLen;
       
   252                             /* Will be updated by CmdMbox to count the status response */
       
   253                             uReadLen = pHead->uParamsLen;
       
   254                         }
       
   255                         else /* CMD_CONFIGURE or others */
       
   256                         {
       
   257                             uWriteLen = pHead->uParamsLen;
       
   258                             /* Will be updated by CmdMbox to count the status response */
       
   259                             uReadLen = 0;
       
   260 
       
   261                         }
       
   262                         /* send the command to TNET */
       
   263                         rc = cmdMbox_SendCommand (pCmdQueue->hCmdMBox, 
       
   264                                               pHead->cmdType, 
       
   265                                               pHead->aParamsBuf, 
       
   266                                               uWriteLen,
       
   267                                               uReadLen);
       
   268 
       
   269                         bBreakWhile = TI_TRUE;
       
   270 
       
   271                         /* end of CMDQUEUE_EVENT_RUN */
       
   272                         break;
       
   273 
       
   274                     default:
       
   275                         TRACE1(pCmdQueue->hReport, REPORT_SEVERITY_ERROR, "cmdQueue_SM: ** ERROR **  No such event (%d) for state CMDQUEUE_STATE_IDLE\n",eCmdQueueEvent);
       
   276                         bBreakWhile = TI_TRUE;
       
   277                         rc =  TI_NOK;
       
   278 
       
   279                         break;
       
   280                 }
       
   281                 break;
       
   282             
       
   283             case CMDQUEUE_STATE_WAIT_FOR_COMPLETION:
       
   284                 switch(eCmdQueueEvent)
       
   285                 {
       
   286                     case CMDQUEUE_EVENT_RUN:
       
   287                         /* We are in the middle of other command transaction so there is nothing top be done */
       
   288                         bBreakWhile = TI_TRUE;
       
   289                         rc = TXN_STATUS_PENDING;
       
   290                         break;
       
   291 
       
   292                     case CMDQUEUE_EVENT_COMPLETE:
       
   293                         {
       
   294                             Command_e cmdType;
       
   295                             TI_UINT16        uParam;
       
   296                             void *fCb, *hCb, *pCb;
       
   297     
       
   298                             pHead = &pCmdQueue->aCmdQueue[pCmdQueue->head];
       
   299             
       
   300                             /* Keep callback parameters in temporary variables */
       
   301                             cmdType = pHead->cmdType;
       
   302                             uParam  = *(TI_UINT16 *)pHead->aParamsBuf;
       
   303                             fCb = pHead->fCb;
       
   304                             hCb = pHead->hCb;
       
   305                             pCb = pHead->pInterrogateBuf;
       
   306                             
       
   307                             /* 
       
   308                              * Delete the command from the queue before calling a callback 
       
   309                              * because there may be nested calls inside a callback
       
   310                              */
       
   311                             pCmdQueue->head ++;
       
   312                             if (pCmdQueue->head >= CMDQUEUE_QUEUE_DEPTH)
       
   313                                 pCmdQueue->head = 0;                
       
   314                             pCmdQueue->uNumberOfCommandInQueue --;                
       
   315                 
       
   316                         #ifdef TI_DBG
       
   317                             pCmdQueue->uCmdCompltCounter++;
       
   318                         #endif 
       
   319 
       
   320                             /* Read the latest command return status */
       
   321                             status = cmdMbox_GetStatus (pCmdQueue->hCmdMBox);
       
   322                             if (status != TI_OK)
       
   323                             {
       
   324                                 pCmdQueue->bErrorFlag = TI_TRUE;
       
   325                             }
       
   326                             else
       
   327                             {
       
   328                                 pCmdQueue->bErrorFlag = TI_FALSE;
       
   329                             }
       
   330 
       
   331                             /* If the command had a CB, then call it with the proper results buffer */
       
   332                             if (fCb)
       
   333                             {   
       
   334                                 if (pCb)
       
   335                                 {
       
   336                                     /* If pInterrogateBuf isn't NULL we need to copy the results */
       
   337                                     cmdMbox_GetCmdParams(pCmdQueue->hCmdMBox, pCb);
       
   338                                     /* Call the CB with the result buffer and the returned status */
       
   339                                     ((TCmdQueueInterrogateCb)fCb) (hCb, status, pCb); 
       
   340                                 }
       
   341                                 else
       
   342                                 {
       
   343                                     /* Call the CB with only the returned status */
       
   344                                     ((TCmdQueueCb)fCb) (hCb, status);
       
   345                                 }
       
   346                             }
       
   347                             else
       
   348                             {
       
   349                                 /* Call the generic callback */
       
   350                                 if (pCmdQueue->fCmdCompleteCb)
       
   351                                 {
       
   352                                     pCmdQueue->fCmdCompleteCb (pCmdQueue->hCmdCompleteCb, cmdType, uParam, status);
       
   353                                 }
       
   354                             }
       
   355 
       
   356                             /* Check if there are any more commands in queue */
       
   357                             if (pCmdQueue->uNumberOfCommandInQueue > 0)               
       
   358                             {
       
   359                                 /* If queue isn't empty, send the next command */
       
   360                                 pCmdQueue->state = CMDQUEUE_STATE_IDLE;
       
   361                                 eCmdQueueEvent = CMDQUEUE_EVENT_RUN;
       
   362                             }
       
   363                             else	
       
   364                             {   
       
   365                                 /* If queue is empty, we can permit TwIf to send sleep a command if neccesary */
       
   366                                 twIf_Sleep(pCmdQueue->hTwIf);
       
   367                                 pCmdQueue->bAwake = TI_FALSE;
       
   368                                 pCmdQueue->state = CMDQUEUE_STATE_IDLE;
       
   369 
       
   370                                 bBreakWhile = TI_TRUE;
       
   371                             }
       
   372                         /* end of CMDQUEUE_EVENT_COMPLETE */
       
   373                         }            
       
   374                         break;
       
   375 
       
   376                     default:
       
   377                         TRACE1(pCmdQueue->hReport, REPORT_SEVERITY_ERROR, "cmdQueue_SM: ** ERROR **  No such event (%d) for state CMDQUEUE_STATE_IDLE\n",eCmdQueueEvent);
       
   378                         bBreakWhile = TI_TRUE;
       
   379                         rc =  TI_NOK;
       
   380 
       
   381                         break;
       
   382 
       
   383                 /* end of switch event */
       
   384                 } 
       
   385                 break;
       
   386         /* end of switch state */
       
   387         }
       
   388     /* end of while */
       
   389     }
       
   390 
       
   391     return rc;
       
   392 }
       
   393 
       
   394 
       
   395 /*
       
   396  * \brief	Sends the command to the cmdMbox
       
   397  * 
       
   398  * \param  hCmdQueue - Handle to CmdQueue
       
   399  * \param  eMboxCmdType - The command type
       
   400  * \param  pMboxBuf - The command itself (parameters)
       
   401  * \param  uParamsLen - The command's length
       
   402  * \param  fCb - The command's Cb function
       
   403  * \param  hCb - The command's Cb handle
       
   404  * \param  pCb - Pointer to the results buffer (for interrogate commands)
       
   405  * \return TI_OK on success or TI_NOK on failure
       
   406  * 
       
   407  * \par Description
       
   408  * Pushes the command to the command queue, which triggers the 
       
   409  * CmdQueue SM.
       
   410  * 
       
   411  * \sa cmdQueue_Push
       
   412  */
       
   413 TI_STATUS cmdQueue_SendCommand (TI_HANDLE  hCmdQueue, 
       
   414                             Command_e  eMboxCmdType, 
       
   415                             void      *pMboxBuf, 
       
   416                             TI_UINT32  uParamsLen, 
       
   417                             void      *fCb, 
       
   418                             TI_HANDLE  hCb, 
       
   419                             void      *pCb)
       
   420 {
       
   421     TCmdQueue *pCmdQueue = (TCmdQueue*)hCmdQueue;
       
   422     TI_STATUS  status;
       
   423 
       
   424     if (pCmdQueue->bErrorFlag) 
       
   425         return TI_NOK;
       
   426 
       
   427     status = cmdQueue_Push (pCmdQueue, 
       
   428                             eMboxCmdType,
       
   429                             (TI_UINT8*)pMboxBuf, 
       
   430                             uParamsLen,
       
   431                             fCb, 
       
   432                             hCb, 
       
   433                             (TI_UINT8*)pCb); 
       
   434 
       
   435     return RC_CONVERT (status);
       
   436 }
       
   437 
       
   438 
       
   439 /*
       
   440  * \brief	Push the command Node to the Queue with its information element parameter
       
   441  * 
       
   442  * \param  hCmdQueue - Handle to CmdQueue
       
   443  * \param  cmdType - The command type
       
   444  * \param  pParamsBuf - The command itself (parameters)
       
   445  * \param  uParamsLen - The command's length
       
   446  * \param  fCb - The command's Cb function
       
   447  * \param  hCb - The command's Cb handle
       
   448  * \param  pCb - Pointer to the results buffer (for interrogate commands)
       
   449  * \return TI_OK on success or TI_NOK on failure
       
   450  * 
       
   451  * \par Description
       
   452  * 
       
   453  * \sa cmdQueue_SendCommand, cmdQueue_SM
       
   454  */
       
   455 static TI_STATUS cmdQueue_Push (TI_HANDLE  hCmdQueue, 
       
   456                          Command_e  cmdType,
       
   457                          TI_UINT8   *pParamsBuf, 
       
   458                          TI_UINT32  uParamsLen,
       
   459                          void       *fCb, 
       
   460                          TI_HANDLE  hCb, 
       
   461                          void       *pCb)
       
   462 {
       
   463     TCmdQueue *pCmdQueue = (TCmdQueue*)hCmdQueue;
       
   464 
       
   465     /* If command type is NOT CMD_INTERROGATE, enter Push only if Mailbox is enabled */
       
   466     if (!pCmdQueue->bMboxEnabled) 
       
   467         return TI_OK;
       
   468 
       
   469     #ifdef TI_DBG
       
   470         /*
       
   471          * Check if Queue is Full
       
   472          */
       
   473         if (pCmdQueue->uNumberOfCommandInQueue == CMDQUEUE_QUEUE_DEPTH)
       
   474         	{
       
   475         TRACE0(pCmdQueue->hReport, REPORT_SEVERITY_ERROR, "cmdQueue_Push: ** ERROR ** The Queue is full\n");
       
   476 
       
   477             	return  TI_NOK;
       
   478         	}
       
   479     #endif /* TI_DBG*/
       
   480 
       
   481     /* Initializes the last Node in the Queue with the arrgs */
       
   482     pCmdQueue->aCmdQueue[pCmdQueue->tail].cmdType   = cmdType;
       
   483     pCmdQueue->aCmdQueue[pCmdQueue->tail].uParamsLen = uParamsLen;
       
   484     pCmdQueue->aCmdQueue[pCmdQueue->tail].fCb = fCb;
       
   485     pCmdQueue->aCmdQueue[pCmdQueue->tail].hCb = hCb;   
       
   486 
       
   487     os_memoryCopy (pCmdQueue->hOs, 
       
   488                    pCmdQueue->aCmdQueue[pCmdQueue->tail].aParamsBuf, 
       
   489                    pParamsBuf, 
       
   490                    uParamsLen);
       
   491     
       
   492     pCmdQueue->aCmdQueue[pCmdQueue->tail].pInterrogateBuf = (TI_UINT8 *)pCb;
       
   493             
       
   494     /* Advance the queue tail*/
       
   495     pCmdQueue->tail++;
       
   496     if (pCmdQueue->tail == CMDQUEUE_QUEUE_DEPTH)
       
   497         pCmdQueue->tail = 0;
       
   498     
       
   499     /* Update counters */
       
   500     pCmdQueue->uNumberOfCommandInQueue++;
       
   501 
       
   502     #ifdef TI_DBG    
       
   503         if (pCmdQueue->uMaxNumberOfCommandInQueue < pCmdQueue->uNumberOfCommandInQueue)
       
   504         {
       
   505             pCmdQueue->uMaxNumberOfCommandInQueue = pCmdQueue->uNumberOfCommandInQueue;     
       
   506         }
       
   507     #endif /* TI_DBG*/
       
   508       
       
   509     #ifdef CMDQUEUE_DEBUG_PRINT    
       
   510         WLAN_OS_REPORT(("cmdQueue_Push: CmdType = %s (%s(%d))"
       
   511     			"Len = %d, NumOfCmd = %d \n",
       
   512     			cmdQueue_GetCmdString(cmdType),
       
   513     			(pParamsBuf) ?  cmdQueue_GetIEString(cmdType,*(TI_UINT16 *)pParamsBuf):"",			
       
   514     			(pParamsBuf) ?  *(TI_UINT16 *)pParamsBuf:0,			
       
   515                 uParamsLen, pCmdQueue->uNumberOfCommandInQueue));
       
   516     #endif
       
   517 
       
   518     /* If queue has only one command trigger the send command from queue */  
       
   519     if (pCmdQueue->uNumberOfCommandInQueue == 1)
       
   520 	{
       
   521         return cmdQueue_SM (pCmdQueue, CMDQUEUE_EVENT_RUN);
       
   522 	}
       
   523 	else
       
   524     {
       
   525         return TI_OK;            
       
   526     }
       
   527 }
       
   528 
       
   529 
       
   530 /*
       
   531  * \brief	Notify the CmdQueue SM on the result received.
       
   532  * 
       
   533  * \param  hCmdQueue - Handle to CmdQueue
       
   534  * \return TI_OK on success or TI_NOK on failure
       
   535  * 
       
   536  * \par Description
       
   537  * Call the CmdQueue SM with CMDQUEUE_EVENT_COMPLETE
       
   538  * 
       
   539  * \sa cmdQueue_SM
       
   540  */
       
   541 TI_STATUS  cmdQueue_ResultReceived(TI_HANDLE hCmdQueue)
       
   542 {
       
   543     TCmdQueue *pCmdQueue = (TCmdQueue*)hCmdQueue;
       
   544 
       
   545     return cmdQueue_SM (pCmdQueue, CMDQUEUE_EVENT_COMPLETE);
       
   546 }
       
   547 
       
   548 
       
   549 /*
       
   550  * \brief	Prepere the command queue for recovery.
       
   551  * 
       
   552  * \param  hCmdQueue - Handle to CmdQueue
       
   553  * \return TI_OK
       
   554  * 
       
   555  * \par Description
       
   556  * Copy the queue nodes to a recovery list, in order handle 
       
   557  * the commands CB's after recovery has finished
       
   558  * 
       
   559  * \sa cmdQueue_EndReconfig
       
   560  */
       
   561 TI_STATUS cmdQueue_Restart (TI_HANDLE hCmdQueue)
       
   562 {
       
   563     TCmdQueue* pCmdQueue = (TCmdQueue*)   hCmdQueue;
       
   564     TI_UINT32  uCurrentCmdIndex;
       
   565     TI_UINT32  first  = pCmdQueue->head;
       
   566     TCmdQueueNode *pHead;
       
   567     TCmdQueueRecoveryNode *pRecoveryNode;
       
   568     
       
   569     /* 
       
   570      * Stop the SM
       
   571     */
       
   572     pCmdQueue->state = CMDQUEUE_STATE_IDLE;
       
   573     pCmdQueue->bAwake = TI_FALSE;
       
   574 
       
   575 TRACE0(pCmdQueue->hReport, REPORT_SEVERITY_INFORMATION, "cmdQueue_Clean: Cleaning aCmdQueue Queue");
       
   576     
       
   577 	/*
       
   578      * Save The Call Back Function in the Queue in order the return them after the recovery 
       
   579      * with an error status 
       
   580 	*/ 
       
   581 
       
   582 	/* Clean The Command Call Back Counter */ 
       
   583     pCmdQueue->uNumberOfRecoveryNodes = 0;
       
   584     pRecoveryNode = &pCmdQueue->aRecoveryQueue[pCmdQueue->uNumberOfRecoveryNodes];
       
   585 
       
   586     for (uCurrentCmdIndex = 0; 
       
   587          uCurrentCmdIndex < pCmdQueue->uNumberOfCommandInQueue; 
       
   588          uCurrentCmdIndex++)
       
   589     {
       
   590         pHead  =  &pCmdQueue->aCmdQueue[first];
       
   591 
       
   592         if (pHead->fCb != NULL)
       
   593         { 
       
   594             /*Copy the interrogate CB and the interrogate data buffer pointer */
       
   595             pRecoveryNode->fCb = pHead->fCb;
       
   596             pRecoveryNode->hCb = pHead->hCb;
       
   597             pRecoveryNode->pInterrogateBuf = pHead->pInterrogateBuf;
       
   598             pCmdQueue->uNumberOfRecoveryNodes++;
       
   599             pRecoveryNode = &pCmdQueue->aRecoveryQueue[pCmdQueue->uNumberOfRecoveryNodes];
       
   600         }       
       
   601         first++;
       
   602         if (first == CMDQUEUE_QUEUE_DEPTH)
       
   603             first = 0;
       
   604     }
       
   605 
       
   606     /*
       
   607      * Init the queue
       
   608      */
       
   609     pCmdQueue->head = 0;
       
   610     pCmdQueue->tail = 0;
       
   611     pCmdQueue->uNumberOfCommandInQueue = 0;
       
   612 
       
   613     return TI_OK;
       
   614 }
       
   615 
       
   616 
       
   617 /*
       
   618  * \brief	Call the stored CB to end the recovery of the MBox queue
       
   619  * 
       
   620  * \param  hCmdQueue - Handle to CmdQueue
       
   621  * \return TI_OK
       
   622  * 
       
   623  * \par Description
       
   624  * Call the stored CB's with an error status 
       
   625  * 
       
   626  * \sa cmdQueue_Restart
       
   627  */
       
   628 TI_STATUS cmdQueue_EndReconfig (TI_HANDLE hCmdQueue)
       
   629 {
       
   630     TCmdQueue* pCmdQueue = (TCmdQueue*)   hCmdQueue;
       
   631     TI_UINT32  uCbIndex;
       
   632     TCmdQueueRecoveryNode *pHead;
       
   633 
       
   634     for (uCbIndex = 0; uCbIndex < pCmdQueue->uNumberOfRecoveryNodes; uCbIndex++)
       
   635     {
       
   636         pHead  =  &pCmdQueue->aRecoveryQueue[uCbIndex];
       
   637 
       
   638         if (pHead->pInterrogateBuf)
       
   639         {
       
   640             ((TCmdQueueInterrogateCb)pHead->fCb)(pHead->hCb, CMD_STATUS_FW_RESET, pHead->pInterrogateBuf);
       
   641         }
       
   642         else
       
   643         {
       
   644             ((TCmdQueueCb)pHead->fCb)(pHead->hCb, CMD_STATUS_FW_RESET);
       
   645         }
       
   646     }
       
   647 
       
   648     pCmdQueue->uNumberOfRecoveryNodes = 0;
       
   649 	
       
   650 	return TI_OK;
       
   651 }
       
   652 
       
   653 
       
   654 /*
       
   655  * \brief	Register for a call back to be called when Command Complete occured and the CmdMboxCB was NULL
       
   656  * 
       
   657  * \param  hCmdQueue - Handle to CmdQueue
       
   658  * \param  fCb - The command's Cb function
       
   659  * \param  hCb - The command's Cb handle
       
   660  * \return TI_OK
       
   661  * 
       
   662  * \par Description
       
   663  * 
       
   664  * \sa
       
   665  */
       
   666 TI_STATUS cmdQueue_RegisterCmdCompleteGenericCb (TI_HANDLE hCmdQueue, void *fCb, TI_HANDLE hCb)
       
   667 {
       
   668     TCmdQueue* pCmdQueue = (TCmdQueue*)hCmdQueue;
       
   669 	
       
   670     if (fCb == NULL || hCb == NULL)
       
   671 	{
       
   672 TRACE0(pCmdQueue->hReport, REPORT_SEVERITY_ERROR, "cmdQueue_RegisterCmdCompleteGenericCB: NULL parameter\n");
       
   673 		return TI_NOK;
       
   674 	}
       
   675 
       
   676     pCmdQueue->fCmdCompleteCb = (TCmdQueueGenericCb)fCb;
       
   677     pCmdQueue->hCmdCompleteCb = hCb;
       
   678 
       
   679 	return TI_OK;
       
   680 }
       
   681 
       
   682 
       
   683 /*
       
   684  * \brief	Register for a call back to be called when an Error (Timeout) occurs
       
   685  * 
       
   686  * \param  hCmdQueue - Handle to CmdQueue
       
   687  * \param  fCb - The command's Cb function
       
   688  * \param  hCb - The command's Cb handle
       
   689  * \return TI_OK
       
   690  * 
       
   691  * \par Description
       
   692  * 
       
   693  * \sa
       
   694  */
       
   695 TI_STATUS cmdQueue_RegisterForErrorCb (TI_HANDLE hCmdQueue, void *fCb, TI_HANDLE hCb)
       
   696 {
       
   697     TCmdQueue* pCmdQueue = (TCmdQueue*)hCmdQueue;
       
   698 	
       
   699     if (fCb == NULL || hCb == NULL)
       
   700 	{
       
   701 TRACE0(pCmdQueue->hReport, REPORT_SEVERITY_ERROR, "cmdQueue_RegisterForErrorCB: NULL parameters\n");
       
   702 		return TI_NOK;
       
   703 	}
       
   704 
       
   705     pCmdQueue->hFailureCb = hCb;
       
   706     pCmdQueue->fFailureCb = (TCmdQueueCb)fCb;
       
   707 
       
   708 	return TI_OK;
       
   709 }
       
   710 
       
   711 
       
   712 /*
       
   713  * \brief	Enables the CmdMbox (on exit from init mode)
       
   714  * 
       
   715  * \param  hCmdQueue - Handle to CmdQueue
       
   716  * \return TI_OK
       
   717  * 
       
   718  * \par Description
       
   719  * 
       
   720  * \sa cmdQueue_DisableMbox
       
   721  */
       
   722 TI_STATUS cmdQueue_EnableMbox (TI_HANDLE hCmdQueue)
       
   723 {
       
   724     TCmdQueue* pCmdQueue = (TCmdQueue*)hCmdQueue;
       
   725 
       
   726     pCmdQueue->bMboxEnabled = TI_TRUE;
       
   727 
       
   728     return TI_OK;
       
   729 }
       
   730 
       
   731 
       
   732 /*
       
   733  * \brief	Disables the CmdMbox (when stopping the driver)
       
   734  * 
       
   735  * \param  hCmdQueue - Handle to CmdQueue
       
   736  * \return TI_OK
       
   737  * 
       
   738  * \par Description
       
   739  * 
       
   740  * \sa cmdQueue_EnableMbox
       
   741  */
       
   742 TI_STATUS cmdQueue_DisableMbox (TI_HANDLE hCmdQueue)
       
   743 {
       
   744     TCmdQueue* pCmdQueue = (TCmdQueue*)hCmdQueue;
       
   745 
       
   746     pCmdQueue->bMboxEnabled = TI_FALSE;
       
   747 
       
   748     return TI_OK;
       
   749 }
       
   750 
       
   751 
       
   752 /*
       
   753  * \brief	Called when a command timeout occur
       
   754  * 
       
   755  * \param  hCmdQueue - Handle to CmdQueue
       
   756  * \return TI_OK
       
   757  * 
       
   758  * \par Description
       
   759  * 
       
   760  * \sa cmdQueue_Init, cmdMbox_TimeOut
       
   761  */
       
   762 TI_STATUS cmdQueue_Error (TI_HANDLE hCmdQueue, TI_UINT32 command, TI_UINT32 status, void *param)
       
   763 {
       
   764     TCmdQueue* pCmdQueue = (TCmdQueue*)hCmdQueue;     
       
   765 
       
   766     if (status == CMD_STATUS_UNKNOWN_CMD)
       
   767     {
       
   768         TRACE1(pCmdQueue->hReport, REPORT_SEVERITY_ERROR , "cmdQueue_Error: Unknown Cmd  (%d)\n", command);
       
   769     }
       
   770     else if (status == CMD_STATUS_UNKNOWN_IE)
       
   771     {
       
   772         TRACE4(pCmdQueue->hReport, REPORT_SEVERITY_CONSOLE,"cmdQueue_Error: Unknown IE, cmdType : %d (%d) IE: %d (%d)\n", command, command, (param) ? *(TI_UINT16 *) param : 0, *((TI_UINT16 *) param));
       
   773 
       
   774         WLAN_OS_REPORT(("cmdQueue_Error: Unknown IE, cmdType : %s (%d) IE: %s (%d)\n",
       
   775                         cmdQueue_GetCmdString (command),
       
   776                         command,
       
   777                         (param) ? cmdQueue_GetIEString (command, *((TI_UINT16 *) param)) : "",
       
   778                         *((TI_UINT16 *) param)));
       
   779     }
       
   780     else
       
   781     {
       
   782         TRACE1(pCmdQueue->hReport, REPORT_SEVERITY_ERROR , "cmdQueue_Error: CmdMbox status is %d\n", status);
       
   783     }
       
   784 
       
   785     if (status != CMD_STATUS_UNKNOWN_CMD && status != CMD_STATUS_UNKNOWN_IE)
       
   786     {
       
   787       #ifdef TI_DBG
       
   788 
       
   789         TCmdQueueNode* pHead = &pCmdQueue->aCmdQueue[pCmdQueue->head];  
       
   790         TI_UINT32 TimeStamp = os_timeStampMs(pCmdQueue->hOs);
       
   791 
       
   792         WLAN_OS_REPORT(("cmdQueue_Error: **ERROR**  Command Occured \n"
       
   793 						 "                                        Cmd = %s %s, Len = %d \n"
       
   794 						 "                                        NumOfCmd = %d\n"
       
   795 						 "                                        MAC TimeStamp on timeout = %d\n",
       
   796 						cmdQueue_GetCmdString(pHead->cmdType), 
       
   797 						(pHead->aParamsBuf) ? cmdQueue_GetIEString(pHead->cmdType, *(TI_UINT16 *)pHead->aParamsBuf) : "",
       
   798 						pHead->uParamsLen, 
       
   799 						pCmdQueue->uNumberOfCommandInQueue, 
       
   800 						TimeStamp));
       
   801 
       
   802         /* Print The command that was sent before the timeout occur */
       
   803         cmdQueue_PrintHistory(pCmdQueue, CMDQUEUE_HISTORY_DEPTH);
       
   804 
       
   805       #endif /* TI_DBG */
       
   806 
       
   807         /* preform Recovery */
       
   808         if (pCmdQueue->fFailureCb)
       
   809         {
       
   810             pCmdQueue->fFailureCb (pCmdQueue->hFailureCb, TI_NOK);
       
   811         }
       
   812     }
       
   813 
       
   814     return TI_OK;
       
   815 }
       
   816 
       
   817 
       
   818 /*
       
   819  * \brief	Returns maximum number of commands (ever) in TCmdQueue queue
       
   820  * 
       
   821  * \param  hCmdQueue - Handle to CmdQueue
       
   822  * \return maximum number of commands (ever) in mailbox queue
       
   823  * 
       
   824  * \par Description
       
   825  * Used for debugging purposes
       
   826  *
       
   827  * \sa cmdQueue_Error
       
   828  */
       
   829 TI_UINT32 cmdQueue_GetMaxNumberOfCommands (TI_HANDLE hCmdQueue)
       
   830 {
       
   831     TCmdQueue* pCmdQueue = (TCmdQueue*)hCmdQueue;
       
   832 
       
   833     return pCmdQueue->uMaxNumberOfCommandInQueue;
       
   834 }
       
   835 
       
   836 
       
   837 
       
   838 /********************************************************************************
       
   839 *                              DEBUG  FUNCTIONS           	          			*
       
   840 *********************************************************************************/
       
   841 
       
   842 #ifdef TI_DBG
       
   843 
       
   844 /*
       
   845  * \brief	Print the command queue & statistics
       
   846  * 
       
   847  * \param  hCmdQueue - Handle to CmdQueue
       
   848  * \return void
       
   849  * 
       
   850  * \par Description
       
   851  * Used for debugging purposes
       
   852  *
       
   853  * \sa cmdQueue_PrintQueue
       
   854  */
       
   855 void cmdQueue_Print (TI_HANDLE hCmdQueue)
       
   856 {
       
   857     TCmdQueue* pCmdQueue = (TCmdQueue*)hCmdQueue; 
       
   858 	
       
   859     WLAN_OS_REPORT(("------------- aCmdQueue Queue -------------------\n"));
       
   860     
       
   861     WLAN_OS_REPORT(("state = %d\n", pCmdQueue->state));
       
   862     WLAN_OS_REPORT(("cmdQueue_Print:The Max NumOfCmd in Queue was = %d\n",
       
   863                         pCmdQueue->uMaxNumberOfCommandInQueue));
       
   864     WLAN_OS_REPORT(("cmdQueue_Print:The Current NumOfCmd in Queue = %d\n",
       
   865                         pCmdQueue->uNumberOfCommandInQueue));
       
   866     WLAN_OS_REPORT(("cmdQueue_Print:The Total number of Cmd send from Queue= %d\n",
       
   867                         pCmdQueue->uCmdSendCounter));
       
   868     WLAN_OS_REPORT(("cmdQueue_Print:The Total number of Cmd Completed interrupt= %d\n",
       
   869                         pCmdQueue->uCmdCompltCounter));
       
   870 
       
   871     cmdQueue_PrintQueue (pCmdQueue);
       
   872 }
       
   873 
       
   874 
       
   875 /*
       
   876  * \brief	Print the command queue
       
   877  * 
       
   878  * \param  pCmdQueue - Pointer to TCmdQueue
       
   879  * \return void
       
   880  * 
       
   881  * \par Description
       
   882  * Used for debugging purposes
       
   883  *
       
   884  * \sa cmdQueue_Print, cmdQueue_GetCmdString, cmdQueue_GetIEString
       
   885  */
       
   886 static void cmdQueue_PrintQueue (TCmdQueue *pCmdQueue)
       
   887 {
       
   888     TI_UINT32 uCurrentCmdIndex;
       
   889     TI_UINT32 first = pCmdQueue->head;
       
   890     TCmdQueueNode* pHead;
       
   891     TI_UINT32 NumberOfCommand = pCmdQueue->uNumberOfCommandInQueue;
       
   892 
       
   893     for(uCurrentCmdIndex = 0 ; uCurrentCmdIndex < NumberOfCommand ; uCurrentCmdIndex++)
       
   894     {
       
   895         pHead = &pCmdQueue->aCmdQueue[first];
       
   896 
       
   897         WLAN_OS_REPORT(("Cmd index %d CmdType = %s %s, Len = %d, Place in Queue = %d \n",
       
   898                        uCurrentCmdIndex, 
       
   899                        cmdQueue_GetCmdString(pHead->cmdType),
       
   900                        cmdQueue_GetIEString(pHead->cmdType, (((pHead->cmdType == CMD_INTERROGATE)||(pHead->cmdType == CMD_CONFIGURE)) ? *(TI_UINT16 *)pHead->aParamsBuf : 0)),
       
   901                        pHead->uParamsLen, 
       
   902                        first));    
       
   903 
       
   904         first++;
       
   905         if (first == CMDQUEUE_QUEUE_DEPTH)
       
   906         {
       
   907             first = 0;
       
   908         }
       
   909     } 
       
   910 }
       
   911 
       
   912 
       
   913 /*
       
   914  * \brief	print the last uNumOfCmd commands
       
   915  * 
       
   916  * \param  hCmdQueue - Handle to CmdQueue
       
   917  * \param  uNumOfCmd - Number of commands to print
       
   918  * \return void
       
   919  * 
       
   920  * \par Description
       
   921  * Used for debugging purposes
       
   922  *
       
   923  * \sa cmdQueue_Error
       
   924  */
       
   925 void cmdQueue_PrintHistory (TI_HANDLE hCmdQueue, TI_UINT32 uNumOfCmd)
       
   926 {
       
   927     TCmdQueue* pCmdQueue = (TCmdQueue*)hCmdQueue; 
       
   928     TI_UINT32 uCurrentCmdIndex;
       
   929     TI_UINT32 first  = pCmdQueue->head;
       
   930     TCmdQueueNode* pHead;
       
   931 
       
   932     WLAN_OS_REPORT(("--------------- cmdQueue_PrintHistory of %d -------------------\n",uNumOfCmd));
       
   933     
       
   934     for (uCurrentCmdIndex = 0; uCurrentCmdIndex < uNumOfCmd; uCurrentCmdIndex++)
       
   935     {
       
   936         pHead  =  &pCmdQueue->aCmdQueue[first];
       
   937 
       
   938         WLAN_OS_REPORT(("Cmd index %d CmdType = %s %s, Len = %d, Place in Queue = %d \n",
       
   939                         uCurrentCmdIndex, 
       
   940                         cmdQueue_GetCmdString(pHead->cmdType),
       
   941                         cmdQueue_GetIEString(pHead->cmdType, (((pHead->cmdType == CMD_INTERROGATE)||(pHead->cmdType == CMD_CONFIGURE)) ? *(TI_UINT16 *)pHead->aParamsBuf : 0)),
       
   942                         pHead->uParamsLen, 
       
   943                         first));
       
   944 
       
   945         if (first == 0)
       
   946         {
       
   947             first = CMDQUEUE_QUEUE_DEPTH - 1;
       
   948         }
       
   949 		else
       
   950         {
       
   951 			first--;
       
   952         }
       
   953 	}
       
   954 
       
   955 	WLAN_OS_REPORT(("-----------------------------------------------------------------------\n"));
       
   956 }
       
   957 
       
   958 
       
   959 /*
       
   960  * \brief	Interperts the command's type to the command's name 
       
   961  * 
       
   962  * \param  MboxCmdType - The command type
       
   963  * \return The command name
       
   964  * 
       
   965  * \par Description
       
   966  * Used for debugging purposes
       
   967  *
       
   968  * \sa
       
   969  */
       
   970 static char* cmdQueue_GetCmdString (TI_INT32 MboxCmdType)
       
   971     {
       
   972     	switch (MboxCmdType)
       
   973     	{
       
   974     		case 0: return "CMD_RESET";
       
   975     		case 1: return "CMD_INTERROGATE"; 
       
   976     	 	case 2: return "CMD_CONFIGURE";
       
   977     	    	case 3: return "CMD_ENABLE_RX";
       
   978     		case 4: return "CMD_ENABLE_TX";
       
   979     		case 5: return "CMD_DISABLE_RX";
       
   980     	    	case 6: return "CMD_DISABLE_TX";	
       
   981     		case 8: return "CMD_SCAN";
       
   982     		case 9: return "CMD_STOP_SCAN";	
       
   983     	    	case 10: return "CMD_VBM";
       
   984     		case 11: return "CMD_START_JOIN";	
       
   985     		case 12: return "CMD_SET_KEYS";	
       
   986     		case 13: return "CMD_READ_MEMORY";	
       
   987     	    	case 14: return "CMD_WRITE_MEMORY";
       
   988             case 19: return "CMD_SET_TEMPLATE";
       
   989     		case 23: return "CMD_TEST";		
       
   990     		case 27: return "CMD_ENABLE_RX_PATH";
       
   991     		case 28: return "CMD_NOISE_HIST";	
       
   992     	    	case 29: return "CMD_RX_RESET";	
       
   993     		case 32: return "CMD_LNA_CONTROL";	
       
   994     		case 33: return "CMD_SET_BCN_MODE";	
       
   995     		case 34: return "CMD_MEASUREMENT";	
       
   996     		case 35: return "CMD_STOP_MEASUREMENT";
       
   997     		case 36: return "CMD_DISCONNECT";		
       
   998     		case 37: return "CMD_SET_PS_MODE";		
       
   999     		case 38: return "CMD_CHANNEL_SWITCH";	
       
  1000     		case 39: return "CMD_STOP_CHANNEL_SWICTH";
       
  1001     		case 40: return "CMD_AP_DISCOVERY";
       
  1002     		case 41: return "CMD_STOP_AP_DISCOVERY";
       
  1003     		case 42: return "CMD_SPS_SCAN";			
       
  1004     		case 43: return "CMD_STOP_SPS_SCAN";		
       
  1005             case 45: return "CMD_HEALTH_CHECK";     
       
  1006             case 48: return "CMD_CONNECTION_SCAN_CFG";
       
  1007             case 49: return "CMD_CONNECTION_SCAN_SSID_CFG";
       
  1008             case 50: return "CMD_START_PERIODIC_SCAN";
       
  1009             case 51: return "CMD_STOP_PERIODIC_SCAN";
       
  1010             case 52: return "CMD_SET_STATUS";
       
  1011     		default: return " *** Error No Such CMD **** ";
       
  1012     	}
       
  1013     }
       
  1014     
       
  1015 /*
       
  1016  * \brief	Interperts the command's IE to the command's IE name 
       
  1017  * 
       
  1018  * \param  MboxCmdType - The command IE number
       
  1019  * \return The command IE name
       
  1020  * 
       
  1021  * \par Description
       
  1022  * Used for debugging purposes
       
  1023  *
       
  1024  * \sa
       
  1025  */
       
  1026 static char * cmdQueue_GetIEString (TI_INT32 MboxCmdType, TI_UINT16 Id)
       
  1027 {
       
  1028     if( MboxCmdType== CMD_INTERROGATE || MboxCmdType == CMD_CONFIGURE)	
       
  1029     {
       
  1030         switch (Id)
       
  1031         {
       
  1032         case ACX_WAKE_UP_CONDITIONS: 		return " (ACX_WAKE_UP_CONDITIONS)";
       
  1033         case ACX_MEM_CFG: 					return " (ACX_MEM_CFG)";                 
       
  1034         case ACX_SLOT: 						return " (ACX_SLOT) ";                    
       
  1035         case ACX_AC_CFG: 					return " (ACX_AC_CFG) ";                  
       
  1036         case ACX_MEM_MAP: 					return " (ACX_MEM_MAP)";
       
  1037         case ACX_AID: 						return " (ACX_AID)";
       
  1038         case ACX_MEDIUM_USAGE: 				return " (ACX_MEDIUM_USAGE) ";                  
       
  1039         case ACX_RX_CFG: 					return " (ACX_RX_CFG) ";                  
       
  1040         case ACX_STATISTICS: 				return " (ACX_STATISTICS) ";
       
  1041         case ACX_FEATURE_CFG: 				return " (ACX_FEATURE_CFG) ";                    
       
  1042         case ACX_TID_CFG: 					return " (ACX_TID_CFG) ";                    
       
  1043         case ACX_BEACON_FILTER_OPT: 		return " (ACX_BEACON_FILTER_OPT) ";             			      											  
       
  1044         case ACX_NOISE_HIST: 				return " (ACX_NOISE_HIST)";           
       
  1045         case ACX_PD_THRESHOLD: 				return " (ACX_PD_THRESHOLD) ";                 
       
  1046         case ACX_TX_CONFIG_OPT: 			return " (ACX_TX_CONFIG_OPT) ";
       
  1047         case ACX_CCA_THRESHOLD: 			return " (ACX_CCA_THRESHOLD)";            
       
  1048         case ACX_EVENT_MBOX_MASK: 			return " (ACX_EVENT_MBOX_MASK) ";
       
  1049         case ACX_CONN_MONIT_PARAMS: 		return " (ACX_CONN_MONIT_PARAMS) ";
       
  1050         case ACX_CONS_TX_FAILURE: 			return " (ACX_CONS_TX_FAILURE) ";
       
  1051         case ACX_BCN_DTIM_OPTIONS: 			return " (ACX_BCN_DTIM_OPTIONS) ";                             
       
  1052         case ACX_SG_ENABLE: 				return " (ACX_SG_ENABLE) ";                                       
       
  1053         case ACX_SG_CFG: 					return " (ACX_SG_CFG) ";                                       
       
  1054         case ACX_FM_COEX_CFG: 				return " (ACX_FM_COEX_CFG) ";                                       
       
  1055         case ACX_BEACON_FILTER_TABLE: 		return " (ACX_BEACON_FILTER_TABLE) ";
       
  1056         case ACX_ARP_IP_FILTER: 			return " (ACX_ARP_IP_FILTER) ";
       
  1057         case ACX_ROAMING_STATISTICS_TBL:	return " (ACX_ROAMING_STATISTICS_TBL) ";  
       
  1058         case ACX_RATE_POLICY: 				return " (ACX_RATE_POLICY) ";  
       
  1059         case ACX_CTS_PROTECTION: 			return " (ACX_CTS_PROTECTION) ";  
       
  1060         case ACX_SLEEP_AUTH: 				return " (ACX_SLEEP_AUTH) ";  
       
  1061         case ACX_PREAMBLE_TYPE: 			return " (ACX_PREAMBLE_TYPE) ";  
       
  1062         case ACX_ERROR_CNT: 				return " (ACX_ERROR_CNT) ";  
       
  1063         case ACX_IBSS_FILTER: 				return " (ACX_IBSS_FILTER) ";  
       
  1064         case ACX_SERVICE_PERIOD_TIMEOUT:	return " (ACX_SERVICE_PERIOD_TIMEOUT) ";  
       
  1065         case ACX_TSF_INFO: 					return " (ACX_TSF_INFO) ";  
       
  1066         case ACX_CONFIG_PS_WMM: 			return " (ACX_CONFIG_PS_WMM) "; 
       
  1067         case ACX_ENABLE_RX_DATA_FILTER: 	return " (ACX_ENABLE_RX_DATA_FILTER) ";
       
  1068         case ACX_SET_RX_DATA_FILTER: 		return " (ACX_SET_RX_DATA_FILTER) ";
       
  1069         case ACX_GET_DATA_FILTER_STATISTICS:return " (ACX_GET_DATA_FILTER_STATISTICS) ";
       
  1070         case ACX_RX_CONFIG_OPT: 			return " (ACX_RX_CONFIG_OPT) ";
       
  1071         case ACX_FRAG_CFG: 				    return " (ACX_FRAG_CFG) ";
       
  1072         case ACX_BET_ENABLE: 				return " (ACX_BET_ENABLE) ";
       
  1073         case ACX_RSSI_SNR_TRIGGER: 			return " (ACX_RSSI_SNR_TRIGGER) ";
       
  1074         case ACX_RSSI_SNR_WEIGHTS: 			return " (ACX_RSSI_SNR_WEIGHTS) ";
       
  1075         case ACX_KEEP_ALIVE_MODE:           return " (ACX_KEEP_ALIVE_MODE) ";
       
  1076         case ACX_SET_KEEP_ALIVE_CONFIG:     return " (ACX_SET_KEEP_ALIVE_CONFIG) ";
       
  1077         case ACX_SET_DCO_ITRIM_PARAMS:      return " (ACX_SET_DCO_ITRIM_PARAMS) ";
       
  1078         case DOT11_RX_MSDU_LIFE_TIME: 		return " (DOT11_RX_MSDU_LIFE_TIME) ";
       
  1079         case DOT11_CUR_TX_PWR:   			return " (DOT11_CUR_TX_PWR) ";
       
  1080         case DOT11_RTS_THRESHOLD: 			return " (DOT11_RTS_THRESHOLD) ";
       
  1081         case DOT11_GROUP_ADDRESS_TBL: 		return " (DOT11_GROUP_ADDRESS_TBL) ";  
       
  1082                
       
  1083         default:	return " *** Error No Such IE **** ";
       
  1084         }
       
  1085     }
       
  1086     return "";
       
  1087 }
       
  1088 
       
  1089 #endif  /* TI_DBG */
       
  1090 
       
  1091