Home | History | Annotate | Download | only in hw_ctrl
      1 /****************************************************************************
      2 **+-----------------------------------------------------------------------+**
      3 **|                                                                       |**
      4 **| Copyright(c) 1998 - 2008 Texas Instruments. All rights reserved.      |**
      5 **| All rights reserved.                                                  |**
      6 **|                                                                       |**
      7 **| Redistribution and use in source and binary forms, with or without    |**
      8 **| modification, are permitted provided that the following conditions    |**
      9 **| are met:                                                              |**
     10 **|                                                                       |**
     11 **|  * Redistributions of source code must retain the above copyright     |**
     12 **|    notice, this list of conditions and the following disclaimer.      |**
     13 **|  * Redistributions in binary form must reproduce the above copyright  |**
     14 **|    notice, this list of conditions and the following disclaimer in    |**
     15 **|    the documentation and/or other materials provided with the         |**
     16 **|    distribution.                                                      |**
     17 **|  * Neither the name Texas Instruments nor the names of its            |**
     18 **|    contributors may be used to endorse or promote products derived    |**
     19 **|    from this software without specific prior written permission.      |**
     20 **|                                                                       |**
     21 **| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS   |**
     22 **| "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT     |**
     23 **| LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |**
     24 **| A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT  |**
     25 **| OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |**
     26 **| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT      |**
     27 **| LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |**
     28 **| DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |**
     29 **| THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT   |**
     30 **| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |**
     31 **| OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  |**
     32 **|                                                                       |**
     33 **+-----------------------------------------------------------------------+**
     34 ****************************************************************************/
     35 
     36 /****************************************************************************
     37  *
     38  *   MODULE:  whalHwMboxConfig.c
     39  *   PURPOSE: Handle the wlan hardware information elements:
     40  *
     41  ****************************************************************************/
     42 
     43 #include "whalCommon.h"
     44 #include "whalHwDefs.h"
     45 #include "public_infoele.h"
     46 #include "CmdQueue_api.h"
     47 #include "whalHwMboxConfig.h"
     48 
     49 /****************************************************************************
     50  *                      whal_hwMboxConfig_Create()
     51  ****************************************************************************
     52  * DESCRIPTION: Create the mailbox configuration commands object
     53  *
     54  * INPUTS:
     55  *
     56  * OUTPUT:  None
     57  *
     58  * RETURNS: The Created object
     59  ****************************************************************************/
     60 HwMboxConfig_T* whal_hwMboxConfig_Create (TI_HANDLE hOs)
     61 {
     62     HwMboxConfig_T* pObj;
     63 
     64     pObj = os_memoryAlloc (hOs, sizeof(HwMboxConfig_T));
     65     if (pObj == NULL)
     66         return NULL;
     67 
     68     os_memoryZero (hOs, (void *)pObj, sizeof(HwMboxConfig_T));
     69 
     70     pObj->hOs = hOs;
     71 
     72     return(pObj);
     73 }
     74 
     75 /****************************************************************************
     76  *                      whal_hwMboxConfig_Destroy()
     77  ****************************************************************************
     78  * DESCRIPTION: Destroy the object
     79  *
     80  * INPUTS:
     81  *      pHwMboxConfig       The object to free
     82  *
     83  * OUTPUT:  None
     84  *
     85  * RETURNS: OK or NOK
     86  ****************************************************************************/
     87 int whal_hwMboxConfig_Destroy (HwMboxConfig_T* pHwMboxConfig)
     88 {
     89     if (pHwMboxConfig)
     90         os_memoryFree(pHwMboxConfig->hOs, pHwMboxConfig, sizeof(HwMboxConfig_T));
     91 
     92     return (OK);
     93 }
     94 
     95 /****************************************************************************
     96  *                      whal_hwMboxConfig_Config()
     97  ****************************************************************************
     98  * DESCRIPTION: Configure the object
     99  *
    100  * INPUTS:
    101  *
    102  * OUTPUT:  None
    103  *
    104  * RETURNS: OK or NOK
    105  ****************************************************************************/
    106 int whal_hwMboxConfig_Config (HwMboxConfig_T* pHwMboxConfig,TI_HANDLE hCmdMboxQueue, TI_HANDLE hReport)
    107 {
    108     pHwMboxConfig->hReport = hReport;
    109     pHwMboxConfig->hCmdMboxQueue = hCmdMboxQueue;
    110 
    111     return (OK);
    112 }
    113 
    114 
    115 
    116 /****************************************************************************
    117  *                      whal_hwInfoElemConfigMemorySet()
    118  ****************************************************************************
    119  * DESCRIPTION: Configure wlan hardware memory
    120  *
    121  * INPUTS:
    122  *
    123  * OUTPUT:  None
    124  *
    125  * RETURNS: OK or NOK
    126  ****************************************************************************/
    127 int whal_hwInfoElemConfigMemorySet (HwMboxConfig_T* pHwMboxConfig, DmaParams_T *pDmaParams)
    128 {
    129     ACXConfigMemoryStruct_t AcxElm_ConfigMemory;
    130     ACXConfigMemoryStruct_t *pCfg = &AcxElm_ConfigMemory;
    131     int Qid;
    132 
    133     os_memoryZero(pHwMboxConfig->hOs, (void *)pCfg, sizeof(*pCfg));
    134     /*
    135      * Set information element header
    136      */
    137     pCfg->memConfig.EleHdr.id = ACX_MEM_CFG;
    138     pCfg->memConfig.EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
    139 
    140     /*
    141      * Set configuration fields
    142      */
    143     pCfg->memConfig.numStations      = ENDIAN_HANDLE_WORD(pDmaParams->NumStations); /*(1)*/
    144     pCfg->memConfig.rxMemblockNumber = pDmaParams->rxMemBlkNumber;  /*(60)*/
    145     pCfg->memConfig.txMinimumMemblockNumber = pDmaParams->txMinMemBlkNumber; /*(60)*/
    146     pCfg->memConfig.numTxQueues      = pDmaParams->NumTxQueues; /*(4)*/
    147     pCfg->memConfig.hostifOptions    = 3; /*(3 - HOST_IF_PKT_RING)*/
    148     pCfg->memConfig.numSsidProfiles = 1;
    149     pCfg->memConfig.debugBufferSize  = ENDIAN_HANDLE_WORD(pDmaParams->TraceBufferSize/4); /*(4)*/
    150 
    151         /*
    152      * Rx queue config
    153      */
    154     pCfg->RxQueueConfig.dmaAddress  = 0;
    155     pCfg->RxQueueConfig.numDescs    = (UINT8)pDmaParams->RxNumDesc;
    156     pCfg->RxQueueConfig.Priority    = (UINT8)pDmaParams->RxQPriority;
    157     pCfg->RxQueueConfig.Type        = pDmaParams->RxQueue_Type;
    158 
    159     /*
    160      * Tx queue config
    161      */
    162     for (Qid=0; Qid<pDmaParams->NumTxQueues; Qid++)
    163     {
    164         pCfg->TxQueueConfig[Qid].numDescs      = pDmaParams->TxNumDesc[Qid];
    165         pCfg->TxQueueConfig[Qid].attributes    = pDmaParams->TxQPriority[Qid];
    166     }
    167 
    168     /* The structure contain array of TxQueueConfig_T
    169      * The size of the array is QUEUE_CONFIG_MAX_TX_QUEUES buf the actual number of
    170      * Queues are pCfg->NumTxQueues so the structure length must be fixed */
    171     pCfg->memConfig.EleHdr.len -= (NUM_ACCESS_CATEGORIES_QUEUES - pDmaParams->NumTxQueues) * sizeof(ACXtxQueueConfig);
    172 
    173     /*
    174      * Send the configuration command
    175      */
    176     return CmdQueue_CmdConfigure (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(*pCfg));
    177 }
    178 
    179 
    180 /****************************************************************************
    181  *                      whal_hwInfoElemDataPathParamsSet()
    182  ****************************************************************************
    183  * DESCRIPTION: configure Data path and TX complete parameters
    184  *
    185  * INPUTS:
    186  *
    187  * OUTPUT:  None
    188  *
    189  * RETURNS: OK or NOK
    190  ****************************************************************************/
    191 int  whal_hwInfoElemDataPathParamsSet (HwMboxConfig_T* pHwMboxConfig,UINT16 rxPacketRingChunkSize,
    192                                        UINT16 txPacketRingChunkSize, UINT8 rxPacketRingChunkNum,
    193                                        UINT8 txPacketRingChunkNum, UINT8 txCompleteThreshold,
    194                                        UINT8  txCompleteRingDepth,   UINT32 txCompleteTimeOut)
    195 {
    196     ACXDataPathParams_t DataPathParams;
    197     ACXDataPathParams_t*  pCfg = &DataPathParams;
    198 
    199     /*
    200      * Set information element header
    201      */
    202     pCfg->EleHdr.id = ACX_DATA_PATH_PARAMS;
    203     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
    204 
    205      /*
    206      * Set configuration fields
    207      */
    208     pCfg->rxPacketRingChunkSize = ENDIAN_HANDLE_WORD(rxPacketRingChunkSize);
    209     pCfg->txPacketRingChunkSize = ENDIAN_HANDLE_WORD(txPacketRingChunkSize );
    210     pCfg->rxPacketRingChunkNum  = rxPacketRingChunkNum;
    211     pCfg->txPacketRingChunkNum  = txPacketRingChunkNum;
    212     pCfg->txCompleteThreshold   = txCompleteThreshold;
    213     pCfg->txCompleteRingDepth   = txCompleteRingDepth;
    214     pCfg->txCompleteTimeOut     = txCompleteTimeOut;
    215 
    216     /* Send the configuration command*/
    217     return CmdQueue_CmdConfigure (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(*pCfg));
    218 }
    219 
    220 
    221 /****************************************************************************
    222  *                      whal_hwInfoElemDataPathParamsGet()
    223  ****************************************************************************
    224  * DESCRIPTION: Get data path specific parameters
    225  *
    226  * INPUTS:
    227  *
    228  * OUTPUT:  None
    229  *
    230  * RETURNS: OK or NOK
    231  ****************************************************************************/
    232 int  whal_hwInfoElemDataPathParamsGet (HwMboxConfig_T* pHwMboxConfig, ACXDataPathParamsResp_t* pCfg, void *fCb, TI_HANDLE hCb)
    233 {
    234     int rc;
    235 
    236     /* Set information element header */
    237     pCfg->EleHdr.id = ACX_DATA_PATH_PARAMS;
    238     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
    239 
    240     /* Send the interrogation command*/
    241     if ((rc = CmdQueue_CmdInterrogateWithCb (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(*pCfg), fCb, hCb, pCfg)) == OK)
    242     {
    243     }
    244 
    245     return rc;
    246 }
    247 
    248 
    249 /****************************************************************************
    250  *                      whal_hwInfoElemQueueHeadGet()
    251  ****************************************************************************
    252  * DESCRIPTION: Read the Queue addresses after memory init
    253  *
    254  * INPUTS:
    255  *
    256  * OUTPUT:  None
    257  *
    258  * RETURNS: OK or NOK
    259  ****************************************************************************/
    260 int whal_hwInfoElemQueueHeadGet (HwMboxConfig_T* pHwMboxConfig, int NumTxQueues, int pElem, void *fCb, TI_HANDLE hCb)
    261 {
    262 #if 0 /*Benzy: should be fixed after the firmware/driver integration*/
    263     int Qid;
    264     int Stt;
    265 
    266     /* only interrogate is enabled to this info element */
    267     if (aAction != INTERROGATE_ACTION)
    268         return (NOK);
    269 
    270     /*
    271      * Set information element header
    272      */
    273     pElem->EleHdr.id  = ACX_QUEUE_HEAD;
    274     pElem->EleHdr.len = sizeof(*pElem) - sizeof(EleHdrStruct);
    275 
    276     /*
    277      * Send the interrogation command, and fill the structure
    278      */
    279     if ((Stt=CmdQueue_CmdInterrogateWithCb (pHwMboxConfig->hCmdMboxQueue, pElem, sizeof(*pElem), fCb, hCb, pElem)) != OK)
    280         return (Stt);
    281 
    282     /*
    283      * Solve endian problem
    284      */
    285     pElem->rxMemBlkQ  = (UINT32 *)ENDIAN_HANDLE_LONG((UINT32)(pElem->rxMemBlkQ));
    286     pElem->txMemBlkQ  = (UINT32 *)ENDIAN_HANDLE_LONG((UINT32)(pElem->txMemBlkQ));
    287     pElem->rxQueueHead.addr = ENDIAN_HANDLE_LONG(pElem->rxQueueHead.addr);
    288 
    289     for (Qid=0; Qid<NumTxQueues; Qid++)
    290     {
    291         pElem->txQueueHead[Qid].addr = ENDIAN_HANDLE_LONG(pElem->txQueueHead[Qid].addr);
    292     }
    293 #endif
    294     WLAN_OS_REPORT(("Command Disabled: whal_hwInfoElemQueueHeadGet\n"));
    295     return OK;
    296 }
    297 
    298 
    299 /****************************************************************************
    300  *                      whal_hwInfoElemSlotTimeSet()
    301  ****************************************************************************
    302  * DESCRIPTION: Configure/Interrogate the Slot Time
    303  *
    304  * INPUTS:  None
    305  *
    306  * OUTPUT:  None
    307  *
    308  * RETURNS: OK or NOK
    309  ****************************************************************************/
    310 int whal_hwInfoElemSlotTimeSet (HwMboxConfig_T* pHwMboxConfig, UINT8* apSlotTime)
    311 {
    312     int rc;
    313     ACXSlot_t   AcxElm_SlotTime;
    314     ACXSlot_t   *pCfg = &AcxElm_SlotTime;
    315 
    316     /* Set information element header */
    317     pCfg->EleHdr.id = ACX_SLOT;
    318     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
    319 
    320     /* Set configuration fields */
    321     /* woneIndex is not relevant to station implementation */
    322     pCfg->woneIndex = STATION_WONE_INDEX;
    323     pCfg->slotTime = *apSlotTime;
    324 
    325 
    326     WLAN_REPORT_INFORMATION(pHwMboxConfig->hReport, HAL_HW_CTRL_MODULE_LOG,
    327         ("%s: Sending info elem to firmware, Slot Time = %d\n", __FUNCTION__, (UINT8)pCfg->slotTime));
    328 
    329     /* Send the configuration command */
    330     rc = CmdQueue_CmdConfigure (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(*pCfg));
    331 
    332     return rc;
    333 }
    334 
    335 
    336 /****************************************************************************
    337  *                      whal_hwInfoElemPreambleSet()
    338  ****************************************************************************
    339  * DESCRIPTION: Configure/Interrogate the Preamble
    340  *
    341  * INPUTS:  None
    342  *
    343  * OUTPUT:  None
    344  *
    345  * RETURNS: OK or NOK
    346  ****************************************************************************/
    347 int whal_hwInfoElemPreambleSet (HwMboxConfig_T* pHwMboxConfig, UINT8* apPreamble)
    348 {
    349     int rc;
    350     ACXPreamble_t   AcxElm_Preamble;
    351     ACXPreamble_t   *pCfg = &AcxElm_Preamble;
    352 
    353     /* Set information element header */
    354     pCfg->EleHdr.id = ACX_PREAMBLE_TYPE;
    355     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
    356 
    357     /* Set configuration fields */
    358     /* woneIndex is not relevant to station implementation */
    359     pCfg->preamble = *apPreamble;
    360 
    361     /* Send the configuration command */
    362     rc = CmdQueue_CmdConfigure (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(*pCfg));
    363 
    364     return rc;
    365 }
    366 
    367 
    368 /****************************************************************************
    369  *                      whal_hwInfoElemGeneraedFrameRate()
    370  ****************************************************************************
    371  * DESCRIPTION: Configure/Interrogate the rate
    372  *
    373  * INPUTS:  None
    374  *
    375  * OUTPUT:  None
    376  *
    377  * RETURNS: OK or NOK
    378  ****************************************************************************/
    379 int whal_hwInfoElemGeneratedFrameRateSet (HwMboxConfig_T *pHwMboxConfig,
    380                                           UINT8          *txCtrlFrmRate,
    381                                           UINT8          *txCtrlFrmMod,
    382                                           UINT8          *txMgmtFrmRate,
    383                                           UINT8          *txMgmtFrmMod)
    384 {
    385     int rc;
    386     ACXFwGeneratedFrameRates_t   AcxElm_FrameRate;
    387     ACXFwGeneratedFrameRates_t   *pCfg = &AcxElm_FrameRate;
    388 
    389     /* Set information element header */
    390     pCfg->EleHdr.id = ACX_FW_GEN_FRAME_RATES;
    391     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
    392 
    393     /* Set configuration fields */
    394     /* woneIndex is not relevant to station implementation */
    395     pCfg->txCtrlFrmRate = *txCtrlFrmRate;
    396     pCfg->txCtrlFrmMod  = *txCtrlFrmMod;
    397     pCfg->txMgmtFrmRate = *txMgmtFrmRate;
    398     pCfg->txMgmtFrmMod  = *txMgmtFrmMod;
    399 
    400     /* Send the configuration command */
    401     rc = CmdQueue_CmdConfigure (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(*pCfg));
    402 
    403     return rc;
    404 }
    405 
    406 
    407 /****************************************************************************
    408  *                      whal_hwInfoElemRxConfigSet()
    409  ****************************************************************************
    410  * DESCRIPTION: Configure/Interrogate RxConfig information element
    411  *
    412  * INPUTS:  None
    413  *
    414  * OUTPUT:  None
    415  *
    416  * RETURNS: OK or NOK
    417  ****************************************************************************/
    418 int whal_hwInfoElemRxConfigSet (HwMboxConfig_T* pHwMboxConfig, UINT32* apRxConfigOption, UINT32* apRxFilterOption)
    419 {
    420     int rc;
    421     ACXRxConfig_t AcxElm_RxConfig;
    422     ACXRxConfig_t* pCfg = &AcxElm_RxConfig;
    423 
    424     /* Set information element header */
    425     pCfg->EleHdr.id = ACX_RX_CFG;
    426     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
    427 
    428     /* Set configuration fields */
    429     pCfg->ConfigOptions = ENDIAN_HANDLE_LONG(*apRxConfigOption);
    430     pCfg->FilterOptions = ENDIAN_HANDLE_LONG(*apRxFilterOption);
    431 
    432     /* Send the configuration command */
    433     rc = CmdQueue_CmdConfigure (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(*pCfg));
    434 
    435     return rc;
    436 }
    437 
    438 /****************************************************************************
    439  *                      whal_hwInfoElemBETSet()
    440  ****************************************************************************
    441  * DESCRIPTION: Configures Beacon Early Termination information element
    442  *
    443  * INPUTS:  None
    444  *
    445  * OUTPUT:  None
    446  *
    447  * RETURNS: OK or NOK
    448  ****************************************************************************/
    449 int whal_hwInfoElemBETSet(HwMboxConfig_T* pHwMboxConfig, UINT8 Enable, UINT8 MaximumConsecutiveET)
    450 {
    451     int rc;
    452     ACXBet_Enable_t ACXBet_Enable;
    453     ACXBet_Enable_t* pCfg = &ACXBet_Enable;
    454 
    455     /* Set information element header */
    456     pCfg->EleHdr.id = ACX_BET_ENABLE;
    457     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
    458 
    459     /* Set configuration fields */
    460     pCfg->Enable = Enable;
    461     pCfg->MaximumConsecutiveET = MaximumConsecutiveET;
    462 
    463     WLAN_REPORT_INFORMATION(pHwMboxConfig->hReport, HAL_HW_CTRL_MODULE_LOG,
    464         ("%s: Sending info elem to firmware, Enable=%d, MaximumConsecutiveET=%d\n",
    465 		 __FUNCTION__, (UINT8)pCfg->Enable, (UINT8)pCfg->MaximumConsecutiveET));
    466 
    467     /* Send the configuration command */
    468     rc = CmdQueue_CmdConfigure (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(*pCfg));
    469 
    470     return rc;
    471 }
    472 
    473 /****************************************************************************
    474 *                 whal_hwInfoElemSetRxDataFiltersParams()
    475 *****************************************************************************
    476 * DESCRIPTION: Enables or disables Rx data filtering.
    477 *
    478 * INPUTS:  enabled             - 0 to disable data filtering, any other value to enable
    479 *          defaultAction       - The default action to take on non-matching packets.
    480 *
    481 * OUTPUT:  None
    482 *
    483 * RETURNS: OK or NOK
    484 ****************************************************************************/
    485 int whal_hwInfoElemSetRxDataFiltersParams(HwMboxConfig_T * pHwMboxConfig, BOOL enabled, filter_e defaultAction)
    486 {
    487     DataFilterDefault_t dataFilterDefault;
    488     DataFilterDefault_t * pCfg = &dataFilterDefault;
    489 
    490     /* Set information element header */
    491     pCfg->EleHdr.id = ACX_ENABLE_RX_DATA_FILTER;
    492     pCfg->EleHdr.len = 0;
    493 
    494     WLAN_REPORT_INFORMATION(pHwMboxConfig->hReport, HAL_HW_CTRL_MODULE_LOG,
    495         ("%s: Rx Data Filter configuration:\n", __FUNCTION__));
    496     WLAN_REPORT_INFORMATION(pHwMboxConfig->hReport, HAL_HW_CTRL_MODULE_LOG,
    497         ("%s: enabled = %d, defaultAction = %d\n", __FUNCTION__, enabled, defaultAction));
    498 
    499     /* Set information element configuration fields */
    500     pCfg->enable = enabled;
    501     pCfg->action = defaultAction;
    502     pCfg->EleHdr.len += sizeof(pCfg->enable) + sizeof(pCfg->action);
    503 
    504     WLAN_REPORT_HEX_INFORMATION(pHwMboxConfig->hReport, HAL_HW_CTRL_MODULE_LOG, (UINT8 *) pCfg, sizeof(dataFilterDefault));
    505 
    506     return CmdQueue_CmdConfigure(pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(*pCfg));
    507 }
    508 
    509 
    510 /****************************************************************************
    511 *                      whal_hwInfoElemSetRxDataFilter()
    512 *****************************************************************************
    513 * DESCRIPTION: Add/remove Rx Data filter information element.
    514 *
    515 * INPUTS:  index               - Index of the Rx Data filter
    516 *          command             - Add or remove the filter
    517 *          action              - Action to take on packets matching the pattern
    518 *          numFieldPatterns    - Number of field patterns in the filter
    519 *          lenFieldPatterns    - Length of the field pattern series
    520 *          fieldPatterns       - Series of field patterns
    521 *
    522 * OUTPUT:  None
    523 *
    524 * RETURNS: OK or NOK
    525 ****************************************************************************/
    526 int whal_hwInfoElemSetRxDataFilter(HwMboxConfig_T * pHwMboxConfig, UINT8 index, UINT8 command, filter_e action, UINT8 numFieldPatterns, UINT8 lenFieldPatterns, UINT8 * fieldPatterns)
    527 {
    528     UINT8 dataFilterConfig[sizeof(DataFilterConfig_t) + MAX_DATA_FILTER_SIZE];
    529     DataFilterConfig_t * pCfg = (DataFilterConfig_t *) &dataFilterConfig;
    530 
    531     /* Set information element header */
    532     pCfg->EleHdr.id = ACX_SET_RX_DATA_FILTER;
    533     pCfg->EleHdr.len = 0;
    534 
    535     WLAN_REPORT_INFORMATION(pHwMboxConfig->hReport, HAL_HW_CTRL_MODULE_LOG,
    536         ("%s: Rx Data Filter configuration:\n", __FUNCTION__));
    537     WLAN_REPORT_INFORMATION(pHwMboxConfig->hReport, HAL_HW_CTRL_MODULE_LOG,
    538         ("%s: command = %d, index = %d, action = %d, numFieldPatterns = %d\n", __FUNCTION__,
    539         command, index, action, numFieldPatterns));
    540 
    541     /* Set information element configuration fields */
    542     pCfg->command = command;
    543     pCfg->index = index;
    544     pCfg->EleHdr.len += sizeof(pCfg->command) + sizeof(pCfg->index);
    545 
    546     /* When removing a filter only the index and command are to be sent */
    547     if (command == ADD_FILTER)
    548     {
    549         pCfg->action = action;
    550         pCfg->numOfFields = numFieldPatterns;
    551         pCfg->EleHdr.len += sizeof(pCfg->action) + sizeof(pCfg->numOfFields);
    552 
    553         if (fieldPatterns == NULL)
    554         {
    555             WLAN_REPORT_ERROR(pHwMboxConfig->hReport, HAL_HW_CTRL_MODULE_LOG,
    556                 ("%s: Null pattern table argument received!\n", __FUNCTION__));
    557 
    558             return PARAM_VALUE_NOT_VALID;
    559         }
    560 
    561         os_memoryCopy(pHwMboxConfig->hOs, &pCfg->FPTable, fieldPatterns, lenFieldPatterns);
    562         pCfg->EleHdr.len += lenFieldPatterns;
    563     }
    564 
    565     WLAN_REPORT_HEX_INFORMATION(pHwMboxConfig->hReport, HAL_HW_CTRL_MODULE_LOG, (UINT8 *) pCfg, sizeof(dataFilterConfig));
    566 
    567     return CmdQueue_CmdConfigure(pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(dataFilterConfig));
    568 }
    569 
    570 /****************************************************************************
    571  *                      whal_hwInfoElemGetRxDataFiltersStatistics()
    572  ****************************************************************************
    573  * DESCRIPTION: Get the ACX GWSI counters
    574  *
    575  * INPUTS:
    576  *
    577  * OUTPUT:  None
    578  *
    579  * RETURNS: OK or NOK
    580  ****************************************************************************/
    581 int whal_hwInfoElemGetRxDataFiltersStatistics(HwMboxConfig_T * pHwMboxConfig,
    582                                               void * CB_Func,
    583                                               TI_HANDLE CB_handle,
    584                                               void * CB_Buf)
    585 {
    586     ACXDataFilteringStatistics_t acx;
    587     ACXDataFilteringStatistics_t * pCfg = &acx;
    588 
    589     /* Set information element header */
    590     pCfg->EleHdr.id  = ACX_GET_DATA_FILTER_STATISTICS;
    591     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
    592 
    593     WLAN_REPORT_HEX_INFORMATION(pHwMboxConfig->hReport, HAL_HW_CTRL_MODULE_LOG, (UINT8 *) pCfg, sizeof(ACXDataFilteringStatistics_t));
    594 
    595     /* Send the interrogation command */
    596     return CmdQueue_CmdInterrogateWithCb(pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(*pCfg), CB_Func, CB_handle, CB_Buf);
    597 }
    598 
    599 
    600 /****************************************************************************
    601  *                      whalCtrl_getConsumptionStatistics()
    602  ****************************************************************************
    603  * DESCRIPTION: Get the ACX Power consumption statistics
    604  *
    605  * INPUTS:
    606  *
    607  * OUTPUT:  None
    608  *
    609  * RETURNS: OK or NOK
    610  ****************************************************************************/
    611 int whalCtrl_getConsumptionStatistics(HwMboxConfig_T * pHwMboxConfig, void * CB_Func, TI_HANDLE CB_handle, void * CB_Buf)
    612 {
    613     ACXPowerConsumptionTimeStat_t acx;
    614     ACXPowerConsumptionTimeStat_t * pCfg = &acx;
    615 
    616     /* Set information element header */
    617     pCfg->EleHdr.id  = ACX_PWR_CONSUMPTION_STATISTICS;
    618     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
    619 
    620     /* Send the interrogation command */
    621     return CmdQueue_CmdInterrogateWithCb(pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(*pCfg), CB_Func, CB_handle, CB_Buf);
    622 }
    623 
    624 
    625 /****************************************************************************
    626  *                      whal_hwInfoElemarpIpAddressesTableSet()
    627  ****************************************************************************
    628  * DESCRIPTION: Configure/Interrogate ARP addr table information element for
    629  *              ipV4 only
    630  *
    631  * INPUTS:  None
    632  *
    633  * OUTPUT:  None
    634  *
    635  * RETURNS: OK or NOK
    636  ****************************************************************************/
    637 int whal_hwInfoElemarpIpAddressesTableSet (HwMboxConfig_T* pHwMboxConfig,
    638                                            IpAddress_t *IP_addr,
    639                                            UINT32 isFilteringEnabled)
    640 {
    641     int rc;
    642     ACXConfigureIP_t AcxElm_CmdConfigureIP;
    643     ACXConfigureIP_t *pCfg = &AcxElm_CmdConfigureIP;
    644 
    645     /* Set information element header */
    646     pCfg->EleHdr.id = ACX_ARP_IP_FILTER;
    647     pCfg->EleHdr.len = sizeof(ACXConfigureIP_t) - sizeof(EleHdrStruct);
    648 
    649     pCfg->arpFilterEnable = isFilteringEnabled;
    650 
    651     /* IP address */
    652     /* Note that in the case of IPv4 it is assumed that the extra two bytes are zero */
    653     os_memoryCopy (pHwMboxConfig->hOs, (PVOID)pCfg->address, (PVOID)IP_addr->addr, IP_V4_ADDR_LEN);
    654     WLAN_REPORT_INFORMATION(pHwMboxConfig->hReport, HAL_HW_CTRL_MODULE_LOG,("ip filtering : %d.%d.%d.%d Enabled = %d \n" , pCfg->address[0] , pCfg->address[1] , pCfg->address[2] , pCfg->address[3] , isFilteringEnabled)) ;
    655 
    656     /* Send the configuration command */
    657     rc = CmdQueue_CmdConfigure (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(ACXConfigureIP_t));
    658 
    659     return rc;
    660 }
    661 
    662 
    663 /****************************************************************************
    664  *                      whal_hwInfoElemGroupAdressesTableSet()
    665  ****************************************************************************
    666  * DESCRIPTION: Configure/Interrogate Group addr table information element
    667  *
    668  * INPUTS:  None
    669  *
    670  * OUTPUT:  None
    671  *
    672  * RETURNS: OK or NOK
    673  ****************************************************************************/
    674 int whal_hwInfoElemGroupAdressesTableSet (HwMboxConfig_T* pHwMboxConfig,
    675                                        UINT8* numGroupAddrs,
    676                                        macAddress_t *Group_addr,
    677                                        UINT8* isEnabled)
    678 {
    679     int i = 0;
    680     int rc = OK;
    681     UINT8   *tmpLoc = NULL;
    682     dot11MulticastGroupAddrStart_t  AcxElm_CmdConfigureMulticastIp;
    683     dot11MulticastGroupAddrStart_t* pCfg = &AcxElm_CmdConfigureMulticastIp;
    684 
    685     if ( NULL == pHwMboxConfig )
    686     {
    687         return PARAM_VALUE_NOT_VALID;
    688     }
    689 
    690     os_memoryZero (pHwMboxConfig->hOs, (void *)pCfg, sizeof(dot11MulticastGroupAddrStart_t));
    691 
    692     /* Set information element header */
    693     pCfg->EleHdr.id = DOT11_GROUP_ADDRESS_TBL;
    694     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
    695 
    696     pCfg->numOfGroups = *numGroupAddrs;
    697     pCfg->fltrState = *isEnabled;
    698     tmpLoc = pCfg->dataLocation;
    699 
    700     if (NULL != Group_addr)
    701     {
    702         for (i=0; i<*numGroupAddrs; i++)
    703         {
    704             os_memoryCopy(pHwMboxConfig->hOs, (PVOID)&(tmpLoc[MAC_ADDR_SIZE*i]), (PVOID)&(Group_addr->addr[MAC_ADDR_SIZE*i]), MAC_ADDR_SIZE);
    705             WLAN_REPORT_INFORMATION(pHwMboxConfig->hReport, HAL_HW_CTRL_MODULE_LOG,
    706                 ("whal_hwInfoElemGroupAdressesTable: MAC %x: %x:%x:%x:%x:%x:%x\n",
    707                 i,
    708                 tmpLoc[MAC_ADDR_SIZE*i+0] ,
    709                 tmpLoc[MAC_ADDR_SIZE*i+1] ,
    710                 tmpLoc[MAC_ADDR_SIZE*i+2] ,
    711                 tmpLoc[MAC_ADDR_SIZE*i+3] ,
    712                 tmpLoc[MAC_ADDR_SIZE*i+4] ,
    713                 tmpLoc[MAC_ADDR_SIZE*i+5]));
    714         }
    715     }
    716 
    717     /* Send the configuration command */
    718     rc = CmdQueue_CmdConfigure (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(dot11MulticastGroupAddrStart_t));
    719 
    720     return rc;
    721 }
    722 
    723 
    724 /****************************************************************************
    725  *                      whal_hwInfoElemStationIdSet ()
    726  ****************************************************************************
    727  * DESCRIPTION: Configure StationId information element to/from
    728  *      the wlan hardware.
    729  *      This information element specifies the MAC Address assigned to the
    730  *      STATION or AP.
    731  *      This default value is the permanent MAC address that is stored in the
    732  *      adaptor's non-volatile memory.
    733  *
    734  * INPUTS:  None
    735  *
    736  * OUTPUT:  None
    737  *
    738  * RETURNS: OK or NOK
    739  ****************************************************************************/
    740 int whal_hwInfoElemStationIdSet
    741 (
    742     HwMboxConfig_T           *pHwMboxConfig,
    743     UINT8                    *apStationId
    744 )
    745 {
    746     int i;
    747     int rc;
    748     dot11StationIDStruct AcxElm_StationId;
    749     dot11StationIDStruct* pCfg = &AcxElm_StationId;
    750 
    751     /* Set information element header*/
    752     pCfg->EleHdr.id = DOT11_STATION_ID;
    753     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
    754 
    755     /* Set configuration field (reversed order, see docs)*/
    756     for (i = 0; i < 6; i++)
    757         pCfg->dot11StationID[i] = apStationId[5-i];
    758 
    759     /* Send the configuration command*/
    760     rc = CmdQueue_CmdConfigure (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(*pCfg));
    761 
    762     return rc;
    763 }
    764 
    765 
    766 /****************************************************************************
    767  *                      whal_hwInfoElemStationIdGet ()
    768  ****************************************************************************
    769  * DESCRIPTION: Configure/Interrogate StationId information element to/from
    770  *      the wlan hardware.
    771  *      This information element specifies the MAC Address assigned to the
    772  *      STATION or AP.
    773  *      This default value is the permanent MAC address that is stored in the
    774  *      adaptor's non-volatile memory.
    775  *
    776  * INPUTS:  None
    777  *
    778  * OUTPUT:  None
    779  *
    780  * RETURNS: OK or NOK
    781  ****************************************************************************/
    782 int whal_hwInfoElemStationIdGet
    783 (
    784     HwMboxConfig_T* pHwMboxConfig,
    785     void*           fCb,
    786     TI_HANDLE       hCb,
    787     void*           pCb
    788 )
    789 {
    790     int rc;
    791     dot11StationIDStruct AcxElm_StationId;
    792     dot11StationIDStruct* pCfg = &AcxElm_StationId;
    793 
    794     /* Set information element header*/
    795     pCfg->EleHdr.id = DOT11_STATION_ID;
    796     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
    797 
    798     if ((rc = CmdQueue_CmdInterrogateWithCb (pHwMboxConfig->hCmdMboxQueue,
    799                                              pCfg,
    800                                              sizeof(*pCfg),
    801                                              fCb,
    802                                              hCb,
    803                                              pCb)) == OK)
    804     {
    805     }
    806 
    807     return rc;
    808 }
    809 
    810 
    811 /****************************************************************************
    812  *                      whal_hwInfoElemStationIdForRecoveryGet ()
    813  ****************************************************************************
    814  * DESCRIPTION: Configure/Interrogate StationId information element to/from
    815  *      the wlan hardware.
    816  *      This information element specifies the MAC Address assigned to the
    817  *      STATION or AP.
    818  *      This default value is the permanent MAC address that is stored in the
    819  *      adaptors non-volatile memory.
    820  *
    821  * INPUTS:  None
    822  *
    823  * OUTPUT:  None
    824  *
    825  * RETURNS: OK or NOK
    826  ****************************************************************************/
    827 int whal_hwInfoElemStationIdForRecoveryGet (HwMboxConfig_T* pHwMboxConfig,
    828                                             void *CB_Func, TI_HANDLE CB_handle, dot11StationIDStruct* CB_Buf)
    829 {
    830 
    831     dot11StationIDStruct AcxElm_StationId;
    832     dot11StationIDStruct* pCfg = &AcxElm_StationId;
    833 
    834     /* Set information element header*/
    835     pCfg->EleHdr.id = DOT11_STATION_ID;
    836     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
    837 
    838     CmdQueue_CmdInterrogateWithCb (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(*pCfg), CB_Func, CB_handle, CB_Buf);
    839 
    840     return OK;
    841 }
    842 
    843 
    844 /****************************************************************************
    845  *                      whal_hwInfoElemRSSIGet ()
    846  ****************************************************************************
    847  * DESCRIPTION: Configure/Interrogate StationId information element to/from
    848  *      the wlan hardware.
    849  *      This information element specifies the MAC Address assigned to the
    850  *      STATION or AP.
    851  *      This default value is the permanent MAC address that is stored in the
    852  *      adaptor's non-volatile memory.
    853  *
    854  * INPUTS:  None
    855  *
    856  * OUTPUT:  None
    857  *
    858  * RETURNS: OK or NOK
    859  ****************************************************************************/
    860 int whal_hwInfoElemRSSIGet (HwMboxConfig_T* pHwMboxConfig, void *CB_Func, TI_HANDLE CB_handle, PUINT8 CB_Buf)
    861 {
    862     int rc;
    863     ACXRoamingStatisticsTable_t AcxElm_GetAverageRSSI;
    864     ACXRoamingStatisticsTable_t* pCfg = &AcxElm_GetAverageRSSI;
    865 
    866     /* Set information element header */
    867     pCfg->EleHdr.id = ACX_ROAMING_STATISTICS_TBL;
    868     pCfg->EleHdr.len = sizeof(ACXRoamingStatisticsTable_t) - sizeof(EleHdrStruct);
    869 
    870     rc = CmdQueue_CmdInterrogateWithCb (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(ACXRoamingStatisticsTable_t), CB_Func, CB_handle, CB_Buf);
    871 
    872     /* Send the configuration command */
    873     return rc;
    874 }
    875 
    876 
    877 /****************************************************************************
    878  *                      whal_hwInfoElemACIConfigurationSet()
    879  ****************************************************************************
    880  * DESCRIPTION: Configure the hardware ACI parameters
    881  *
    882  * INPUTS:  None
    883  *
    884  * OUTPUT:  None
    885  *
    886  * RETURNS: OK or NOK
    887  ****************************************************************************/
    888 int whal_hwInfoElemACIConfigurationSet (HwMboxConfig_T* pHwMboxConfig, UINT8 ACIMode,
    889                                         UINT8 inputCCA, UINT8 qualifiedCCA,
    890                                         UINT8 stompForRx, UINT8 stompForTx,
    891                                         UINT8 txCCA)
    892 {
    893     int rc;
    894     ACXConfigACI_t AcxElm_AciConfig;
    895     ACXConfigACI_t* pCfg = &AcxElm_AciConfig;
    896 
    897     /* Set information element header */
    898     pCfg->EleHdr.id = ACX_ACI_OPTION_CFG;
    899     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
    900 
    901     /* Set sequence number */
    902     pCfg->ACIMode = ACIMode;
    903     pCfg->inputCCA = inputCCA;
    904     pCfg->qualifiedCCA = qualifiedCCA;
    905     pCfg->stompForRx = stompForRx;
    906     pCfg->stompForTx = stompForTx;
    907     pCfg->txCCA = txCCA;
    908 
    909     rc = CmdQueue_CmdConfigure (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(*pCfg));
    910 
    911     return rc;
    912 }
    913 
    914 
    915 
    916 /****************************************************************************
    917  *                      whal_hwInfoElemBssPowerSaveGet()
    918  ****************************************************************************
    919  * DESCRIPTION: Configure/Interrogate the Bss in/not power save
    920  *
    921  * INPUTS:  None
    922  *
    923  * OUTPUT:  None
    924  *
    925  * RETURNS: OK or NOK
    926  ****************************************************************************/
    927 int whal_hwInfoElemBssPowerSaveGet (HwMboxConfig_T* pHwMboxConfig, UINT8* apBssInPs_Val)
    928 {
    929     int rc;
    930     ACXBSSPowerSave_t   AcxElm_BssPowerSave;
    931     ACXBSSPowerSave_t   *pCfg = &AcxElm_BssPowerSave;
    932 
    933     /* Set information element heade r*/
    934     pCfg->EleHdr.id = ACX_BSS_IN_PS;
    935     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
    936 
    937     /* Set configuration fields */
    938     pCfg->BSSinPowerSave = *apBssInPs_Val;
    939 
    940     /* Send the configuration command */
    941     rc = CmdQueue_CmdConfigure (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(*pCfg));
    942 
    943     return rc;
    944 }
    945 
    946 
    947 /****************************************************************************
    948  *                      whal_hwInfoElemSoftGeminiEnableSet()
    949  ****************************************************************************
    950  * DESCRIPTION: Enable/Disable the BTH-WLAN
    951  *
    952  * INPUTS:  Enable flag
    953  *
    954  * OUTPUT:  None
    955  *
    956  * RETURNS: OK or NOK
    957  ****************************************************************************/
    958 int whal_hwInfoElemSoftGeminiEnableSet (HwMboxConfig_T* pHwMboxConfig, SoftGeminiEnableModes_e SoftGeminiEnableModes)
    959 {
    960     ACXBluetoothWlanCoEnableStruct        AcxElm_BluetoothWlanEnable;
    961     ACXBluetoothWlanCoEnableStruct* pCfg = &AcxElm_BluetoothWlanEnable;
    962 
    963     WLAN_REPORT_INFORMATION(pHwMboxConfig->hReport, HAL_HW_CTRL_MODULE_LOG,
    964         ("whal_hwInfoElemSoftGeminiEnableSet: Enable flag = %d\n", SoftGeminiEnableModes));
    965 
    966     /* Set information element header */
    967     pCfg->EleHdr.id = ACX_SG_ENABLE;
    968     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
    969 
    970     /* Set enable field */
    971     pCfg->Enable = (UINT8)SoftGeminiEnableModes;
    972 
    973     /* Send the configuration command */
    974     return CmdQueue_CmdConfigure (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(*pCfg));
    975 }
    976 
    977 
    978 /****************************************************************************
    979  *                      whal_hwInfoElemSoftGeminiParamsSet()
    980  ****************************************************************************
    981  * DESCRIPTION: Configure the BTH-WLAN co-exsistance
    982  *
    983  * INPUTS:  Configuration structure pointer
    984  *
    985  * OUTPUT:  None
    986  *
    987  * RETURNS: OK or NOK
    988  ****************************************************************************/
    989 int whal_hwInfoElemSoftGeminiParamsSet (HwMboxConfig_T* pHwMboxConfig, SoftGeminiParam_t *SoftGeminiParam)
    990 {
    991     ACXBluetoothWlanCoParamsStruct          AcxElm_BluetoothWlanEnable;
    992     ACXBluetoothWlanCoParamsStruct* pCfg = &AcxElm_BluetoothWlanEnable;
    993 
    994     WLAN_REPORT_INFORMATION(pHwMboxConfig->hReport, HAL_HW_CTRL_MODULE_LOG,
    995         ("whal_hwInfoElemSoftGeminiParamsSet. \n"));
    996 
    997     /* Set information element header */
    998     pCfg->EleHdr.id = ACX_SG_CFG;
    999     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
   1000     pCfg->afhLeverageOn         = SoftGeminiParam->afhLeverageOn;
   1001     pCfg->btHpMaxTime           = SoftGeminiParam->btHpMaxTime;
   1002     pCfg->maxNumCts             = SoftGeminiParam->maxNumCts;
   1003     pCfg->numberOfBtPackets     = SoftGeminiParam->numberOfBtPackets;
   1004     pCfg->numberOfWlanPackets   = SoftGeminiParam->numberOfWlanPackets;
   1005     pCfg->numberQuietCycle      = SoftGeminiParam->numberQuietCycle;
   1006     pCfg->protectiveRxTimeBeforeBtHp = SoftGeminiParam->protectiveRxTimeBeforeBtHp;
   1007     pCfg->protectiveTxTimeBeforeBtHp = SoftGeminiParam->protectiveTxTimeBeforeBtHp;
   1008     pCfg->protectiveRxTimeBeforeBtHpFastAp = SoftGeminiParam->protectiveRxTimeBeforeBtHpFastAp;
   1009     pCfg->protectiveTxTimeBeforeBtHpFastAp = SoftGeminiParam->protectiveTxTimeBeforeBtHpFastAp;
   1010     pCfg->protectiveWlanCycleTimeForFastAp = SoftGeminiParam->protectiveWlanCycleTimeForFastAp;
   1011     pCfg->senseDisableTimer     = SoftGeminiParam->senseDisableTimer;
   1012     pCfg->sgAntennaType         = SoftGeminiParam->sgAntennaType;
   1013     pCfg->signalingType         = SoftGeminiParam->signalingType;
   1014     pCfg->timeoutNextBtLpPacket = SoftGeminiParam->timeoutNextBtLpPacket;
   1015     pCfg->wlanHpMaxTime         = SoftGeminiParam->wlanHpMaxTime;
   1016     pCfg->numberOfMissedRxForAvalancheTrigger = SoftGeminiParam->numberOfMissedRxForAvalancheTrigger;
   1017     pCfg->wlanElpHpSupport      = SoftGeminiParam->wlanElpHpSupport;
   1018     pCfg->btAntiStarvationNumberOfCyclesWithinThePeriod = SoftGeminiParam->btAntiStarvationNumberOfCyclesWithinThePeriod;
   1019     pCfg->btAntiStarvationPeriod = SoftGeminiParam->btAntiStarvationPeriod;
   1020     pCfg->ackModeDuringBtLpInDualAnt = SoftGeminiParam->ackModeDuringBtLpInDualAnt;
   1021     pCfg->allowPaSdToggleDuringBtActivityEnable = SoftGeminiParam->allowPaSdToggleDuringBtActivityEnable;
   1022     pCfg->wakeUpTimeBeforeBeacon = SoftGeminiParam->wakeUpTimeBeforeBeacon;
   1023 	pCfg->hpdmMaxGuardTime = SoftGeminiParam->hpdmMaxGuardTime;
   1024 	pCfg->timeoutNextWlanPacket = SoftGeminiParam->timeoutNextWlanPacket;
   1025 	pCfg->sgAutoModeNoCts = SoftGeminiParam->sgAutoModeNoCts;
   1026 	pCfg->numOfBtHpRespectedReq = SoftGeminiParam->numOfBtHpRespectedReq;
   1027 
   1028 	/* Convert from pure number to Index. '0' is any rate */
   1029 	if ( SoftGeminiParam->wlanRxMinRateToRespectBtHp )
   1030 	{
   1031 		pCfg->wlanRxMinConvertedRateToRespectBtHp = rateNumberToIndex((UINT8)SoftGeminiParam->wlanRxMinRateToRespectBtHp);
   1032 
   1033 		if (pCfg->wlanRxMinConvertedRateToRespectBtHp == INVALID_RATE_INDEX)
   1034 		{
   1035 			WLAN_REPORT_ERROR(pHwMboxConfig->hReport, HAL_HW_CTRL_MODULE_LOG,
   1036 				("%s wlanRxMinRateToRespectBtHp from %d to 0 (any rate). \n",
   1037 				__FUNCTION__, SoftGeminiParam->wlanRxMinRateToRespectBtHp));
   1038 
   1039 			pCfg->wlanRxMinConvertedRateToRespectBtHp = RATE_INDEX_1MBPS;
   1040 		}
   1041 	}
   1042 	else
   1043 	{
   1044 		pCfg->wlanRxMinConvertedRateToRespectBtHp = RATE_INDEX_1MBPS;
   1045 	}
   1046 
   1047 	WLAN_REPORT_INFORMATION(pHwMboxConfig->hReport, HAL_HW_CTRL_MODULE_LOG,
   1048 		("%s wlanRxMinRateToRespectBtHp from %d to %d. \n",
   1049 		__FUNCTION__, SoftGeminiParam->wlanRxMinRateToRespectBtHp, pCfg->wlanRxMinConvertedRateToRespectBtHp));
   1050 
   1051     /* Send the configuration command */
   1052     return CmdQueue_CmdConfigure (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(*pCfg));
   1053 }
   1054 
   1055 /****************************************************************************
   1056  *                      whal_hwInfoElemSoftGeminiParamsGet()
   1057  ****************************************************************************
   1058  * DESCRIPTION: Get the BTH-WLAN co-exsistance parameters from the Fw
   1059  *
   1060  *
   1061  * OUTPUT:  None
   1062  *
   1063  * RETURNS: OK or NOK
   1064  ****************************************************************************/
   1065 int whal_hwInfoElemSoftGeminiParamsGet (HwMboxConfig_T* pHwMboxConfig, void *CB_Func, TI_HANDLE CB_handle, void* CB_Buf)
   1066 {
   1067     ACXBluetoothWlanCoParamsStruct          AcxElm_BluetoothWlanEnable;
   1068     ACXBluetoothWlanCoParamsStruct* pCfg = &AcxElm_BluetoothWlanEnable;
   1069 
   1070     WLAN_REPORT_INFORMATION(pHwMboxConfig->hReport, HAL_HW_CTRL_MODULE_LOG,
   1071         ("whal_hwInfoElemSoftGeminiParamsGet. \n"));
   1072 
   1073     /* Set information element header */
   1074     pCfg->EleHdr.id = ACX_SG_CFG;
   1075     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
   1076 
   1077     /* Send the configuration command */
   1078     return CmdQueue_CmdInterrogateWithCb (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(ACXBluetoothWlanCoParamsStruct), CB_Func, CB_handle, CB_Buf);
   1079 }
   1080 
   1081 /****************************************************************************
   1082  *                      whal_hwInfoElemMemoryMapSet ()
   1083  ****************************************************************************
   1084  * DESCRIPTION: Configure/Interrogate MemoryMap information element
   1085  *
   1086  * INPUTS:
   1087  *      AcxElm_MemoryMap_T *apMap   pointer to the memory map structure
   1088  *
   1089  * OUTPUT:  None
   1090  *
   1091  * RETURNS: OK or NOK
   1092  ****************************************************************************/
   1093 int whal_hwInfoElemMemoryMapSet
   1094 (
   1095     HwMboxConfig_T *pHwMboxConfig,
   1096     MemoryMap_t    *apMap
   1097 )
   1098 {
   1099     int rc;
   1100     MemoryMap_t SwapMap;
   1101     UINT32 *pSwap, *pOrig, i;
   1102 
   1103     /* Set information element header */
   1104     SwapMap.EleHdr.id  = ACX_MEM_MAP;
   1105     SwapMap.EleHdr.len = sizeof(SwapMap) - sizeof(EleHdrStruct);
   1106 
   1107     /* Solve endian problem (all fields are 32 bit) */
   1108     pOrig = (UINT32* )&apMap->codeStart;
   1109     pSwap = (UINT32* )&SwapMap.codeStart;
   1110     for (i = 0; i < MEM_MAP_NUM_FIELDS; i++)
   1111         pSwap[i] = ENDIAN_HANDLE_LONG(pOrig[i]);
   1112 
   1113     /* Send the configuration command */
   1114     rc = CmdQueue_CmdConfigure (pHwMboxConfig->hCmdMboxQueue, &SwapMap, sizeof(SwapMap));
   1115 
   1116     return rc;
   1117 }
   1118 
   1119 
   1120 /****************************************************************************
   1121  *                      whal_hwInfoElemMemoryMapGet ()
   1122  ****************************************************************************
   1123  * DESCRIPTION: Configure/Interrogate MemoryMap information element
   1124  *
   1125  * INPUTS:
   1126  *      AcxElm_MemoryMap_T *apMap   pointer to the memory map structure
   1127  *
   1128  * OUTPUT:  None
   1129  *
   1130  * RETURNS: OK or NOK
   1131  ****************************************************************************/
   1132 int whal_hwInfoElemMemoryMapGet
   1133 (
   1134     HwMboxConfig_T *pHwMboxConfig,
   1135     MemoryMap_t    *apMap,
   1136     void           *fCb,
   1137     TI_HANDLE       hCb
   1138 )
   1139 {
   1140     int rc;
   1141 
   1142     /* Set information element header */
   1143     apMap->EleHdr.id  = ACX_MEM_MAP;
   1144     apMap->EleHdr.len = sizeof(*apMap) - sizeof(EleHdrStruct);
   1145 
   1146     /* Send the interrogation command */
   1147     if ((rc = CmdQueue_CmdInterrogateWithCb (pHwMboxConfig->hCmdMboxQueue, apMap, sizeof(*apMap), fCb, hCb, apMap)) == OK)
   1148     {
   1149     }
   1150 
   1151     return rc;
   1152 }
   1153 
   1154 
   1155 static int whal_hwInfoElemMemoryMapPrintCb (TI_HANDLE hHwMboxConfig, TI_STATUS status, void *pData)
   1156 {
   1157 #ifdef TI_DBG
   1158     HwMboxConfig_T *pHwMboxConfig = (HwMboxConfig_T *)hHwMboxConfig;
   1159     MemoryMap_t    *pMemMap = &pHwMboxConfig->MemMap;
   1160 
   1161     /* Print the memory map */
   1162     WLAN_OS_REPORT (("whal_hwInfoElemMemoryMapPrint:\n"));
   1163     WLAN_OS_REPORT (("\tCode  (0x%08x, 0x%08x)\n\tWep  (0x%08x, 0x%08x)\n\tTmpl (0x%08x, 0x%08x)\n "
   1164                     "\tQueue (0x%08x, 0x%08x)\n\tPool (0x%08x, 0x%08x)\n\tTraceBuffer (A = 0x%08x, B = 0x%08x)\n",
   1165                     pMemMap->codeStart, pMemMap->codeEnd,
   1166                     pMemMap->wepDefaultKeyStart, pMemMap->wepDefaultKeyEnd,
   1167                     pMemMap->packetTemplateStart, pMemMap->packetTemplateEnd,
   1168                     pMemMap->queueMemoryStart, pMemMap->queueMemoryEnd,
   1169                     pMemMap->packetMemoryPoolStart, pMemMap->packetMemoryPoolEnd,
   1170                     pMemMap->debugBuffer1Start, pMemMap->debugBuffer2Start));
   1171 #endif /* TI_DBG */
   1172     return OK;
   1173 }
   1174 
   1175 
   1176 /****************************************************************************
   1177  *                      whal_hwInfoElemMemoryMapPrint ()
   1178  ****************************************************************************
   1179  * DESCRIPTION: Print some of the MemoryMap information element fields
   1180  *
   1181  * INPUTS:
   1182  *          HwMboxConfig_T* pHwMboxConfig pointer to the acx mailbox
   1183  *
   1184  * OUTPUT:  None
   1185  *
   1186  * RETURNS: None
   1187  ****************************************************************************/
   1188 void whal_hwInfoElemMemoryMapPrint (HwMboxConfig_T* pHwMboxConfig)
   1189 {
   1190     whal_hwInfoElemMemoryMapGet (pHwMboxConfig,
   1191                                  &pHwMboxConfig->MemMap,
   1192                                  (void *)whal_hwInfoElemMemoryMapPrintCb,
   1193                                  (TI_HANDLE)pHwMboxConfig);
   1194 }
   1195 
   1196 
   1197 /****************************************************************************
   1198  *                      whal_hwInfoElemConfigOptionsRead ()
   1199  ****************************************************************************
   1200  * DESCRIPTION: Read ConfigOption information element from the wlan hardware.
   1201  *      This is a special case where the data is already in the mailbox
   1202  *      after wlan hardware reset and no interrogate command should be sent.
   1203  *      This read-only IE provides information stored in the adaptors
   1204  *      non-volatile memory to host.
   1205  *
   1206  * INPUTS:  None
   1207  *
   1208  * OUTPUT:  None
   1209  *
   1210  * RETURNS: OK or NOK
   1211  *
   1212  * NOTE : This function is not in use and must be reexamined (especially the Fw-Driver API)
   1213  *
   1214  ****************************************************************************/
   1215 int whal_hwInfoElemConfigOptionsRead (HwMboxConfig_T* pHwMboxConfig, void* pElm)
   1216 {
   1217     WLAN_OS_REPORT(("%s not implemented\n",__FUNCTION__));
   1218     /* The ConfigOptions information element is ready after reset on the mailbox */
   1219     return 0;
   1220 }
   1221 
   1222 
   1223 /****************************************************************************
   1224  *                      whal_hwInfoElemAcxRevisionGet()
   1225  ****************************************************************************
   1226  * DESCRIPTION: Configure/Interrogate the ACX revision (FW and HW version)
   1227  *
   1228  * INPUTS:  None
   1229  *
   1230  * OUTPUT:  None
   1231  *
   1232  * RETURNS: OK or NOK
   1233  ****************************************************************************/
   1234 int whal_hwInfoElemAcxRevisionGet
   1235 (
   1236      HwMboxConfig_T *pHwMboxConfig,
   1237      void           *fCb,
   1238      TI_HANDLE       hCb,
   1239      void           *pCb
   1240 )
   1241 {
   1242     ACXRevision_t   aElm;
   1243     ACXRevision_t  *apElm = &aElm;
   1244     int rc;
   1245 
   1246     /* Set information element header */
   1247     apElm->EleHdr.id  = ACX_FW_REV;
   1248     apElm->EleHdr.len = sizeof(*apElm) - sizeof(EleHdrStruct);
   1249 
   1250     /* Send the command*/
   1251     rc = CmdQueue_CmdInterrogateWithCb (pHwMboxConfig->hCmdMboxQueue, apElm, sizeof(*apElm), fCb, hCb, pCb);
   1252 
   1253     return rc;
   1254 }
   1255 
   1256 
   1257 /****************************************************************************
   1258  *                      whal_hwInfoElemWepDefaultKeyIdSet()
   1259  ****************************************************************************
   1260  * DESCRIPTION: Configure/Interrogate The default Key Id
   1261  *
   1262  * INPUTS:
   1263  *      UINT8* Key    The default key id to use
   1264  *
   1265  * OUTPUT:  None
   1266  *
   1267  * RETURNS: OK or NOK
   1268  ****************************************************************************/
   1269 int whal_hwInfoElemWepDefaultKeyIdSet (HwMboxConfig_T* pHwMboxConfig, UINT8* apKeyVal,
   1270                                        void *CB_Func, TI_HANDLE CB_handle)
   1271 {
   1272     int rc;
   1273     dot11WEPDefaultKeyId_t  WlanElm_WepDefaultKeyId;
   1274     dot11WEPDefaultKeyId_t  *pCfg = &WlanElm_WepDefaultKeyId;
   1275 
   1276     /* Set information element header*/
   1277     pCfg->EleHdr.id = DOT11_DEFAULT_KEY;
   1278     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
   1279 
   1280     /* Send the command */
   1281     pCfg->DefaultKeyId = *apKeyVal;
   1282 
   1283     /* Send the configuration command */
   1284     rc = CmdQueue_CmdConfigureWithCb (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(*pCfg), CB_Func, CB_handle);
   1285 
   1286     return rc;
   1287 }
   1288 
   1289 
   1290 /****************************************************************************
   1291  *                      whal_hwInfoElemWepDefaultKeyIdGet()
   1292  ****************************************************************************
   1293  * DESCRIPTION: Configure/Interrogate The default Key Id
   1294  *
   1295  * INPUTS:
   1296  *      UINT8* Key    The default key id to use
   1297  *
   1298  * OUTPUT:  None
   1299  *
   1300  * RETURNS: OK or NOK
   1301  ****************************************************************************/
   1302 int whal_hwInfoElemWepDefaultKeyIdGet (HwMboxConfig_T* pHwMboxConfig, UINT8* apKeyVal,
   1303                                        void *CB_Func, TI_HANDLE CB_handle)
   1304 {
   1305     int rc = OK;
   1306     dot11WEPDefaultKeyId_t  WlanElm_WepDefaultKeyId;
   1307     dot11WEPDefaultKeyId_t  *pCfg = &WlanElm_WepDefaultKeyId;
   1308 
   1309     /* Set information element header */
   1310     pCfg->EleHdr.id = DOT11_DEFAULT_KEY;
   1311     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
   1312 
   1313     /* Not implemented */
   1314 
   1315   #if 0
   1316     *apKeyVal = pCfg->DefaultKeyId;
   1317   #endif
   1318 
   1319     return rc;
   1320 }
   1321 
   1322 
   1323 /****************************************************************************
   1324  *                      whal_hwInfoElemAidSet()
   1325  ****************************************************************************
   1326  * DESCRIPTION: Configure/Interrogate the AID info element
   1327  *
   1328  * INPUTS:
   1329  *      UINT16* apAidVal     The AID value
   1330  *
   1331  * OUTPUT:  None
   1332  *
   1333  * RETURNS: OK or NOK
   1334  ****************************************************************************/
   1335 int whal_hwInfoElemAidSet (HwMboxConfig_T* pHwMboxConfig, UINT16* apAidVal)
   1336 {
   1337     int rc;
   1338     ACXAid_t    WlanElm_AID;
   1339     ACXAid_t    *pCfg = &WlanElm_AID;
   1340 
   1341     /* Set information element header */
   1342     pCfg->EleHdr.id = ACX_AID;
   1343     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
   1344 
   1345     /* Send the command */
   1346     pCfg->Aid = ENDIAN_HANDLE_WORD(*apAidVal);
   1347 
   1348     /* Send the configuration command */
   1349     rc = CmdQueue_CmdConfigure (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(*pCfg));
   1350 
   1351     return rc;
   1352 }
   1353 
   1354 
   1355 /****************************************************************************
   1356  *                      whal_hwInfoElemAcxwakeUpConditionSet()
   1357  ****************************************************************************
   1358  * DESCRIPTION: Configure/Interrogate the power management option
   1359  *
   1360  * INPUTS:
   1361  *
   1362  * OUTPUT:  None
   1363  *
   1364  * RETURNS: OK or NOK
   1365  ****************************************************************************/
   1366 int whal_hwInfoElemAcxwakeUpConditionSet (HwMboxConfig_T* pHwMboxConfig,
   1367                                           WakeUpCondition_t* pWlanElm_wakeUpCondition)
   1368 {
   1369     int rc;
   1370     WakeUpCondition_t* pCfg = pWlanElm_wakeUpCondition;
   1371 
   1372     /* Set information element header */
   1373     pCfg->EleHdr.id = ACX_WAKE_UP_CONDITIONS;
   1374     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
   1375 
   1376     /* Send the command */
   1377     rc = CmdQueue_CmdConfigure (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(*pCfg));
   1378 
   1379     return rc;
   1380 }
   1381 
   1382 
   1383 /****************************************************************************
   1384  *                      whal_hwInfoElemAcxPMConfigSet()
   1385  ****************************************************************************
   1386  * DESCRIPTION: Configure/Interrogate the power management option
   1387  *
   1388  * INPUTS:
   1389  *
   1390  * OUTPUT:  None
   1391  *
   1392  * RETURNS: OK or NOK
   1393  ****************************************************************************/
   1394 int whal_hwInfoElemAcxPMConfigSet (HwMboxConfig_T* pHwMboxConfig,
   1395                                    ACXConfigPM_t* pWlanElm_PowerMgmtOptions)
   1396 {
   1397     int rc;
   1398     ACXConfigPM_t* pCfg = pWlanElm_PowerMgmtOptions;
   1399 
   1400     /* Set information element header */
   1401     pCfg->EleHdr.id = ACX_PM_CFG;
   1402     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
   1403 
   1404     /* Send the command */
   1405     rc = CmdQueue_CmdConfigure (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(*pCfg));
   1406 
   1407     return rc;
   1408 }
   1409 
   1410 
   1411 /****************************************************************************
   1412  *                      whal_hwInfoElemAcxSleepAuthoSet()
   1413  ****************************************************************************
   1414  * DESCRIPTION: Configure/Interrogate the power management option
   1415  *
   1416  * INPUTS:
   1417  *
   1418  * OUTPUT:  None
   1419  *
   1420  * RETURNS: OK or NOK
   1421  ****************************************************************************/
   1422 int whal_hwInfoElemAcxSleepAuthoSet (HwMboxConfig_T* pHwMboxConfig,
   1423                                      ACXSleepAuth_t* pWlanElm_SleepAutho)
   1424 {
   1425     int rc;
   1426     ACXSleepAuth_t* pCfg = pWlanElm_SleepAutho;
   1427 
   1428     /* Set information element header*/
   1429     pCfg->EleHdr.id = ACX_SLEEP_AUTH;
   1430     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
   1431 
   1432     /* Send the command */
   1433     rc = CmdQueue_CmdConfigure (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(*pCfg));
   1434 
   1435     return rc;
   1436 }
   1437 
   1438 
   1439 /****************************************************************************
   1440  *                      whal_hwInfoElemAcxBcnBrcOptionsSet()
   1441  ****************************************************************************
   1442  * DESCRIPTION: Configure/Interrogate the power management option
   1443  *
   1444  * INPUTS:
   1445  *
   1446  * OUTPUT:  None
   1447  *
   1448  * RETURNS: OK or NOK
   1449  ****************************************************************************/
   1450 int whal_hwInfoElemAcxBcnBrcOptionsSet (HwMboxConfig_T* pHwMboxConfig,
   1451                                         ACXBeaconAndBroadcastOptions_t* pWlanElm_BcnBrcOptions)
   1452 {
   1453     int rc;
   1454     ACXBeaconAndBroadcastOptions_t* pCfg = pWlanElm_BcnBrcOptions;
   1455 
   1456     /* Set information element header */
   1457     pCfg->EleHdr.id = ACX_BCN_DTIM_OPTIONS;
   1458     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
   1459 
   1460     /* Send the command */
   1461     rc = CmdQueue_CmdConfigure (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(*pCfg));
   1462 
   1463     return rc;
   1464 }
   1465 
   1466 
   1467 /****************************************************************************
   1468  *                      whal_hwInfoElemAcxBcnBrcOptionsGet()
   1469  ****************************************************************************
   1470  * DESCRIPTION: Configure/Interrogate the power management option
   1471  *
   1472  * INPUTS:
   1473  *
   1474  * OUTPUT:  None
   1475  *
   1476  * RETURNS: OK or NOK
   1477  ****************************************************************************/
   1478 int whal_hwInfoElemAcxBcnBrcOptionsGet (HwMboxConfig_T* pHwMboxConfig,
   1479                                         ACXBeaconAndBroadcastOptions_t* pWlanElm_BcnBrcOptions)
   1480 {
   1481     ACXBeaconAndBroadcastOptions_t* pCfg = pWlanElm_BcnBrcOptions;
   1482 
   1483     /* Set information element header */
   1484     pCfg->EleHdr.id = ACX_BCN_DTIM_OPTIONS;
   1485     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
   1486 
   1487     /* The STA does not support interrogate action for this Ie */
   1488     return NOK;
   1489 }
   1490 
   1491 
   1492 /****************************************************************************
   1493  *                      whal_hwInfoElemFeatureConfigSet()
   1494                                     ACXBeaconAndBroadcastOptions_t* pWlanElm_BcnBrcOptions,
   1495  ****************************************************************************
   1496  * DESCRIPTION: Configure the feature config info element
   1497  *
   1498  * INPUTS:
   1499  *
   1500  * OUTPUT:  None
   1501  *
   1502  * RETURNS: OK or NOK
   1503  ****************************************************************************/
   1504 int  whal_hwInfoElemFeatureConfigSet (HwMboxConfig_T* pHwMboxConfig,  UINT32 Options, UINT32 DataFlowOptions)
   1505 {
   1506     ACXFeatureConfig_t  WlanElm_FeatureConfig;
   1507     ACXFeatureConfig_t  *pCfg = &WlanElm_FeatureConfig;
   1508 
   1509     /* Set information element header */
   1510     pCfg->EleHdr.id = ACX_FEATURE_CFG;
   1511     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
   1512 
   1513     /* Set fields */
   1514     pCfg->Options = ENDIAN_HANDLE_LONG(Options);
   1515     pCfg->dataflowOptions = ENDIAN_HANDLE_LONG(DataFlowOptions);
   1516 
   1517     WLAN_REPORT_INFORMATION(pHwMboxConfig->hReport, HAL_HW_CTRL_MODULE_LOG,
   1518         ("whal_hwInfoElemFeatureConfigSet: ## Option=0x%x, DFOption=0x%x\n", Options, DataFlowOptions));
   1519 
   1520     /* Send the configuration command */
   1521     return CmdQueue_CmdConfigure (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(*pCfg));
   1522 }
   1523 
   1524 
   1525 /****************************************************************************
   1526  *                      whal_hwInfoElemAntennaDiversitySet ()
   1527  ****************************************************************************
   1528  * DESCRIPTION: Set antenna diversity parameters
   1529  *
   1530  * INPUTS:
   1531  *
   1532  * OUTPUT:  None
   1533  *
   1534  * RETURNS: OK or NOK
   1535  ****************************************************************************/
   1536 int whal_hwInfoElemAntennaDiversitySet (HwMboxConfig_T* pHwMboxConfig,
   1537                                      whalCtrl_antennaDiversityOptions_t* pAntennaDiversityOptions,
   1538                                      UINT32 antNum)
   1539 {
   1540     AcxSetAntennaDiversityOptions_t ACXAntennaDiversityOptions;
   1541 
   1542     WLAN_REPORT_INFORMATION( pHwMboxConfig->hReport, HAL_HW_CTRL_MODULE_LOG,
   1543                              ("RX diversity enabled: %d TX diversity enabled:%d\n",
   1544                               pAntennaDiversityOptions->enableRxDiversity,
   1545                               pAntennaDiversityOptions->enableTxDiversity) );
   1546     WLAN_REPORT_INFORMATION( pHwMboxConfig->hReport, HAL_HW_CTRL_MODULE_LOG,
   1547                              ("Rx Antenna: %d TX antenna: %d\n",
   1548                               pAntennaDiversityOptions->rxSelectedAntenna,
   1549                               pAntennaDiversityOptions->txSelectedAntenna) );
   1550     WLAN_REPORT_INFORMATION( pHwMboxConfig->hReport, HAL_HW_CTRL_MODULE_LOG,
   1551                              ("Share TX and RX antennas: %d\n",
   1552                               pAntennaDiversityOptions->rxTxSharedAnts) );
   1553 
   1554     /* Set information element header */
   1555     ACXAntennaDiversityOptions.EleHdr.id = ACX_ANTENNA_DIVERSITY_CFG;
   1556     ACXAntennaDiversityOptions.EleHdr.len = sizeof( AcxSetAntennaDiversityOptions_t ) -
   1557                                                 sizeof( EleHdrStruct );
   1558 
   1559     /* Set information element fields */
   1560     ACXAntennaDiversityOptions.enableRxDiversity = pAntennaDiversityOptions->enableRxDiversity;
   1561     ACXAntennaDiversityOptions.rxSelectedAntenna = pAntennaDiversityOptions->rxSelectedAntenna;
   1562     ACXAntennaDiversityOptions.enableTxDiversity = pAntennaDiversityOptions->enableTxDiversity;
   1563     ACXAntennaDiversityOptions.txSelectedAntenna = pAntennaDiversityOptions->txSelectedAntenna;
   1564     ACXAntennaDiversityOptions.rxAntNum = antNum;
   1565     ACXAntennaDiversityOptions.txAntNum = antNum;
   1566     ACXAntennaDiversityOptions.rxTxSharedAnts = pAntennaDiversityOptions->rxTxSharedAnts;
   1567 
   1568     /* Send the command */
   1569     return CmdQueue_CmdConfigure (pHwMboxConfig->hCmdMboxQueue,
   1570                                   &ACXAntennaDiversityOptions,
   1571                                   sizeof(AcxSetAntennaDiversityOptions_t));
   1572 }
   1573 
   1574 
   1575 /****************************************************************************
   1576  *                      whal_hwInfoElemTxPowerSet ()
   1577  ****************************************************************************
   1578  * DESCRIPTION: Set the Tx power
   1579  *
   1580  * INPUTS:
   1581  *
   1582  * OUTPUT:  None
   1583  *
   1584  * RETURNS: OK or NOK
   1585  ****************************************************************************/
   1586 int whal_hwInfoElemTxPowerSet (HwMboxConfig_T* pHwMboxConfig, UINT8 *TxPowerDbm)
   1587 {
   1588     dot11CurrentTxPowerStruct  dot11CurrentTxPower;
   1589     dot11CurrentTxPowerStruct  *pCfg = &dot11CurrentTxPower;
   1590     int rc;
   1591 
   1592 	WLAN_REPORT_INFORMATION( pHwMboxConfig->hReport, HAL_HW_CTRL_MODULE_LOG,
   1593 		("%s power = %d\n", __FUNCTION__, *TxPowerDbm));
   1594 
   1595     /* Set information element header*/
   1596     pCfg->EleHdr.id = DOT11_CUR_TX_PWR;
   1597     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
   1598 
   1599     /* Send the command */
   1600     pCfg->dot11CurrentTxPower = *TxPowerDbm;
   1601     rc = CmdQueue_CmdConfigure (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(*pCfg));
   1602 
   1603     return rc;
   1604 }
   1605 
   1606 
   1607 /****************************************************************************
   1608  *                      whal_hwInfoElemAcxStatisiticsSet ()
   1609  ****************************************************************************
   1610  * DESCRIPTION: Set the ACX statistics counters to zero.
   1611  *
   1612  * INPUTS:
   1613  *
   1614  * OUTPUT:  None
   1615  *
   1616  * RETURNS: OK or NOK
   1617  ****************************************************************************/
   1618 int whal_hwInfoElemAcxStatisiticsSet (HwMboxConfig_T* pHwMboxConfig)
   1619 {
   1620     ACXStatistics_t  acx;
   1621     ACXStatistics_t  *pCfg = &acx;
   1622 
   1623     /* Set information element header */
   1624     pCfg->EleHdr.id  = ACX_STATISTICS;
   1625     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
   1626 
   1627     /* Send the config command */
   1628     return CmdQueue_CmdConfigure (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(*pCfg));
   1629 }
   1630 
   1631 
   1632 /****************************************************************************
   1633  *                      whal_hwInfoElemAcxStatisiticsGet ()
   1634  ****************************************************************************
   1635  * DESCRIPTION: Get the ACX statistics that are required for basic measurement
   1636  *
   1637  * INPUTS:
   1638  *
   1639  * OUTPUT:  None
   1640  *
   1641  * RETURNS: OK or NOK
   1642  ****************************************************************************/
   1643 int whal_hwInfoElemAcxStatisiticsGet (HwMboxConfig_T* pHwMboxConfig, acxStatisitcs_t *acxStatisitcs)
   1644 {
   1645     ACXStatistics_t     acx;
   1646     ACXStatistics_t     *pCfg = &acx;
   1647     int rc = OK;
   1648 
   1649     /* Set information element header */
   1650     pCfg->EleHdr.id  = ACX_STATISTICS;
   1651     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
   1652 
   1653     /* Not implemented */
   1654 
   1655     /* Setting the output params */
   1656   #if 0
   1657     acxStatisitcs->FWpacketReceived = pCfg->isr.RxHeaders;
   1658   #endif
   1659 
   1660     return rc;
   1661 }
   1662 
   1663 
   1664 /****************************************************************************
   1665  *                      whal_hwInfoElemAcxReadGwsiStatisiticsGet ()
   1666  ****************************************************************************
   1667  * DESCRIPTION: Get the ACX GWSI statistics
   1668  *
   1669  * INPUTS:
   1670  *
   1671  * OUTPUT:  None
   1672  *
   1673  * RETURNS: OK or NOK
   1674  ****************************************************************************/
   1675 int whal_hwInfoElemAcxReadGwsiStatisiticsGet (HwMboxConfig_T * pHwMboxConfig,
   1676                                               void * CB_Func,
   1677                                               TI_HANDLE CB_handle,
   1678                                               void * CB_Buf)
   1679 {
   1680     ACXRoamingStatisticsTable_t acx;
   1681     ACXRoamingStatisticsTable_t * pCfg = &acx;
   1682 
   1683     /*
   1684      * Set information element header
   1685      */
   1686     pCfg->EleHdr.id  = ACX_ROAMING_STATISTICS_TBL;
   1687     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
   1688 
   1689     /*
   1690      * Send the interrogation command
   1691      */
   1692     return CmdQueue_CmdInterrogateWithCb (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(*pCfg), CB_Func, CB_handle, CB_Buf);
   1693 }
   1694 
   1695 
   1696 /****************************************************************************
   1697  *                      whal_hwInfoElemAcxReadGwsiCountersGet ()
   1698  ****************************************************************************
   1699  * DESCRIPTION: Get the ACX GWSI counters
   1700  *
   1701  * INPUTS:
   1702  *
   1703  * OUTPUT:  None
   1704  *
   1705  * RETURNS: OK or NOK
   1706  ****************************************************************************/
   1707 int whal_hwInfoElemAcxReadGwsiCountersGet (HwMboxConfig_T * pHwMboxConfig,
   1708                                            void * CB_Func,
   1709                                            TI_HANDLE CB_handle,
   1710                                            void * CB_Buf)
   1711 {
   1712     ACXErrorCounters_t acx;
   1713     ACXErrorCounters_t * pCfg = &acx;
   1714 
   1715     /*
   1716      * Set information element header
   1717      */
   1718     pCfg->EleHdr.id  = ACX_ERROR_CNT;
   1719     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
   1720 
   1721     /*
   1722      * Send the interrogation command
   1723      */
   1724     return CmdQueue_CmdInterrogateWithCb (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(*pCfg), CB_Func, CB_handle, CB_Buf);
   1725 }
   1726 
   1727 
   1728 /****************************************************************************
   1729  *                      whal_hwInfoElemMediumOccupancyGet ()
   1730  ****************************************************************************
   1731  * DESCRIPTION: Get the Medium Occupancy.
   1732  *
   1733  * INPUTS:
   1734  *
   1735  * OUTPUT:  None
   1736  *
   1737  * RETURNS: OK or NOK
   1738  ****************************************************************************/
   1739 int whal_hwInfoElemMediumOccupancyGet (HwMboxConfig_T* pHwMboxConfig,
   1740                                        interogateCmdCBParams_t  mediumUsageCBParams)
   1741 {
   1742     ACXMediumUsage_t    medium;
   1743     ACXMediumUsage_t    *pCfg = &medium;
   1744 
   1745     /* Set information element header */
   1746     pCfg->EleHdr.id  = ACX_MEDIUM_USAGE;
   1747     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
   1748 
   1749     /* Send the interrogation command */
   1750     return CmdQueue_CmdInterrogateWithCb (pHwMboxConfig->hCmdMboxQueue, pCfg,
   1751                                           sizeof(*pCfg),
   1752                                           mediumUsageCBParams.CB_Func,
   1753                                           mediumUsageCBParams.CB_handle,
   1754                                           mediumUsageCBParams.CB_buf);
   1755 }
   1756 
   1757 
   1758 /****************************************************************************
   1759  *                      whal_hwInfoElemTfsDtimGet ()
   1760  ****************************************************************************
   1761  * DESCRIPTION: Get the Tsf and Dtim counter from Fw
   1762  *
   1763  * INPUTS:
   1764  *
   1765  * OUTPUT:  None
   1766  *
   1767  * RETURNS: OK or NOK
   1768  ****************************************************************************/
   1769 int whal_hwInfoElemTfsDtimGet (HwMboxConfig_T* pHwMboxConfig,
   1770                                interogateCmdCBParams_t  mediumUsageCBParams)
   1771 {
   1772     ACX_fwTSFInformation_t    fwTsfDtimMib;
   1773     ACX_fwTSFInformation_t    *pCfg = &fwTsfDtimMib;
   1774     int sendOp = 0;
   1775 
   1776     /* Set information element header*/
   1777     pCfg->EleHdr.id  = ACX_TSF_INFO;
   1778     pCfg->EleHdr.len = sizeof(ACX_fwTSFInformation_t) - sizeof(EleHdrStruct);
   1779 
   1780     /* Send the interrogation command*/
   1781     sendOp = CmdQueue_CmdInterrogateWithCb (pHwMboxConfig->hCmdMboxQueue, pCfg,
   1782                                                sizeof(*pCfg),
   1783                                                mediumUsageCBParams.CB_Func,
   1784                                                mediumUsageCBParams.CB_handle,
   1785                                                mediumUsageCBParams.CB_buf);
   1786     if (0 == sendOp)
   1787     {
   1788         WLAN_REPORT_INFORMATION(pHwMboxConfig->hReport, HAL_HW_CTRL_MODULE_LOG,  ("whal_hwInfoElemTfsDtimGet ACX_fwTSFInformation command sent with to FW wait for results\n"));
   1789     }
   1790     else
   1791     {
   1792         WLAN_REPORT_ERROR(pHwMboxConfig->hReport, HAL_HW_CTRL_MODULE_LOG,  ("whal_hwInfoElemTfsDtimGet ACX_fwTSFInformation command not sent , FAILURE =%d\n" ,sendOp) );
   1793     }
   1794 
   1795     return sendOp;
   1796 }
   1797 
   1798 
   1799 static int  whal_hwInfoElemStatisticsReadCB (HwMboxConfig_T* pHwMboxConfig,UINT16 MboxStatus, ACXStatistics_t* pElem);
   1800 
   1801 
   1802 /****************************************************************************
   1803  *                      whal_hwInfoElemStatisticsPrint ()
   1804  ****************************************************************************
   1805  * DESCRIPTION: Print the statistics from the input IE statistics
   1806  *
   1807  * INPUTS:
   1808  *          ACXStatisticsStruct* pElem  The Statistics information element
   1809  *                                      to be printed
   1810  *
   1811  * OUTPUT:  None
   1812  *
   1813  * RETURNS: OK or NOK
   1814  ****************************************************************************/
   1815 int whal_hwInfoElemStatisticsPrint (HwMboxConfig_T *pHwMboxConfig)
   1816 {
   1817     int rc;
   1818 
   1819     /* Set information element header */
   1820     pHwMboxConfig->pAcxStatistic.EleHdr.id  = ACX_STATISTICS;
   1821     pHwMboxConfig->pAcxStatistic.EleHdr.len = sizeof(pHwMboxConfig->pAcxStatistic) - sizeof(EleHdrStruct);
   1822 
   1823     /* Send the interrogation command */
   1824     if ((rc = CmdQueue_CmdInterrogateWithCb (pHwMboxConfig->hCmdMboxQueue,
   1825                                              &pHwMboxConfig->pAcxStatistic,
   1826                                              sizeof(pHwMboxConfig->pAcxStatistic),
   1827                                              (void *)whal_hwInfoElemStatisticsReadCB,
   1828                                              pHwMboxConfig,
   1829                                              &pHwMboxConfig->pAcxStatistic)) != OK)
   1830         return rc;
   1831 
   1832     return OK;
   1833 }
   1834 
   1835 
   1836 /****************************************************************************
   1837  *                      whal_hwInfoElemStatisticsReadCB ()
   1838  ****************************************************************************
   1839  * DESCRIPTION: Interrogate Statistics from the wlan hardware
   1840  *
   1841  * INPUTS:  None
   1842  *
   1843  * OUTPUT:  None
   1844  *
   1845  * RETURNS: OK or NOK
   1846  ****************************************************************************/
   1847 static int whal_hwInfoElemStatisticsReadCB (HwMboxConfig_T* pHwMboxConfig, UINT16 MboxStatus, ACXStatistics_t* pElem)
   1848 {
   1849     if (MboxStatus != OK)
   1850         return NOK;
   1851 
   1852     /* Solve endian problem*/
   1853     /* Isr */
   1854     pElem->isr.ACXRxProcs       = ENDIAN_HANDLE_LONG(pElem->isr.ACXRxProcs);
   1855     pElem->isr.ACXTxProcs       = ENDIAN_HANDLE_LONG(pElem->isr.ACXTxProcs);
   1856     pElem->isr.Cmd_Cmplt        = ENDIAN_HANDLE_LONG(pElem->isr.Cmd_Cmplt);
   1857     pElem->isr.FIQs             = ENDIAN_HANDLE_LONG(pElem->isr.FIQs);
   1858     pElem->isr.RxHeaders        = ENDIAN_HANDLE_LONG(pElem->isr.RxHeaders);
   1859     pElem->isr.RxCompletes      = ENDIAN_HANDLE_LONG(pElem->isr.RxCompletes);
   1860     pElem->isr.RxMemOverflow    = ENDIAN_HANDLE_LONG(pElem->isr.RxMemOverflow);
   1861     pElem->isr.RxRdys           = ENDIAN_HANDLE_LONG(pElem->isr.RxRdys);
   1862     pElem->isr.IRQs             = ENDIAN_HANDLE_LONG(pElem->isr.IRQs);
   1863     pElem->isr.DecryptDone      = ENDIAN_HANDLE_LONG(pElem->isr.DecryptDone);
   1864     pElem->isr.DMA0Done         = ENDIAN_HANDLE_LONG(pElem->isr.DMA0Done);
   1865     pElem->isr.DMA1Done         = ENDIAN_HANDLE_LONG(pElem->isr.DMA1Done);
   1866     pElem->isr.ACXTxExchComplete= ENDIAN_HANDLE_LONG(pElem->isr.ACXTxExchComplete);
   1867     pElem->isr.ACXCommands      = ENDIAN_HANDLE_LONG(pElem->isr.ACXCommands);
   1868     pElem->isr.HwPMModeChanges  = ENDIAN_HANDLE_LONG(pElem->isr.HwPMModeChanges);
   1869     pElem->isr.HostAcknowledges = ENDIAN_HANDLE_LONG(pElem->isr.HostAcknowledges);
   1870     pElem->isr.PCI_PM           = ENDIAN_HANDLE_LONG(pElem->isr.PCI_PM);
   1871     pElem->isr.ACMWakeups       = ENDIAN_HANDLE_LONG(pElem->isr.ACMWakeups);
   1872 
   1873     /* Rx */
   1874     pElem->rx.RxDroppedFrame    = ENDIAN_HANDLE_LONG(pElem->rx.RxDroppedFrame);
   1875     pElem->rx.RxFcsErr          = ENDIAN_HANDLE_LONG(pElem->rx.RxFcsErr);
   1876     pElem->rx.RxHdrOverflow     = ENDIAN_HANDLE_LONG(pElem->rx.RxHdrOverflow);
   1877     pElem->rx.RxHWStuck         = ENDIAN_HANDLE_LONG(pElem->rx.RxHWStuck);
   1878     pElem->rx.RxOutOfMem        = ENDIAN_HANDLE_LONG(pElem->rx.RxOutOfMem);
   1879     pElem->rx.RxXfrHintTrig     = ENDIAN_HANDLE_LONG(pElem->rx.RxXfrHintTrig);
   1880     pElem->rx.RxResetCounter    = ENDIAN_HANDLE_LONG(pElem->rx.RxResetCounter);
   1881 
   1882     /* Tx */
   1883     pElem->tx.TxInternalDescOverflow = ENDIAN_HANDLE_LONG(pElem->tx.TxInternalDescOverflow);
   1884 
   1885     /* Dma */
   1886     pElem->dma.RxDMARequested   = ENDIAN_HANDLE_LONG(pElem->dma.RxDMARequested);
   1887     pElem->dma.RxDMAErrors      = ENDIAN_HANDLE_LONG(pElem->dma.RxDMAErrors);
   1888     pElem->dma.TxDMARequested   = ENDIAN_HANDLE_LONG(pElem->dma.TxDMARequested);
   1889     pElem->dma.TxDMAErrors      = ENDIAN_HANDLE_LONG(pElem->dma.TxDMAErrors);
   1890 
   1891     /* Wep */
   1892     pElem->wep.WepAddrKeyCount      = ENDIAN_HANDLE_LONG(pElem->wep.WepAddrKeyCount);
   1893     pElem->wep.WepDecryptFail       = ENDIAN_HANDLE_LONG(pElem->wep.WepDecryptFail);
   1894     pElem->wep.WepDefaultKeyCount   = ENDIAN_HANDLE_LONG(pElem->wep.WepDefaultKeyCount);
   1895     pElem->wep.WepKeyNotFound       = ENDIAN_HANDLE_LONG(pElem->wep.WepKeyNotFound);
   1896 
   1897     /* PS */
   1898     pElem->pwr.PSEnterCnt           = ENDIAN_HANDLE_LONG(pElem->pwr.PSEnterCnt);
   1899     pElem->pwr.ELPEnterCnt          = ENDIAN_HANDLE_LONG(pElem->pwr.ELPEnterCnt);
   1900     pElem->pwr.MissingBcnsCnt       = ENDIAN_HANDLE_LONG(pElem->pwr.MissingBcnsCnt);
   1901     pElem->pwr.WakeOnHostCnt        = ENDIAN_HANDLE_LONG(pElem->pwr.WakeOnHostCnt);
   1902     pElem->pwr.WakeOnTimerExpCnt    = ENDIAN_HANDLE_LONG(pElem->pwr.WakeOnTimerExpCnt);
   1903     pElem->pwr.TxWithPSCnt          = ENDIAN_HANDLE_LONG(pElem->pwr.TxWithPSCnt);
   1904     pElem->pwr.TxWithoutPSCnt       = ENDIAN_HANDLE_LONG(pElem->pwr.TxWithoutPSCnt);
   1905     pElem->pwr.RcvdBeaconsCnt       = ENDIAN_HANDLE_LONG(pElem->pwr.RcvdBeaconsCnt);
   1906     pElem->pwr.PowerSaveOffCnt      = ENDIAN_HANDLE_LONG(pElem->pwr.PowerSaveOffCnt);
   1907     pElem->pwr.EnablePSCnt          = ENDIAN_HANDLE_LONG(pElem->pwr.EnablePSCnt);
   1908     pElem->pwr.DisablePSCnt         = ENDIAN_HANDLE_LONG(pElem->pwr.DisablePSCnt);
   1909     pElem->pwr.FixTsfPSCnt          = ENDIAN_HANDLE_LONG(pElem->pwr.FixTsfPSCnt);
   1910     pElem->pwr.ContMissBcnsSpread[0]= ENDIAN_HANDLE_LONG(pElem->pwr.ContMissBcnsSpread[0]);
   1911     pElem->pwr.ContMissBcnsSpread[1]= ENDIAN_HANDLE_LONG(pElem->pwr.ContMissBcnsSpread[1]);
   1912     pElem->pwr.ContMissBcnsSpread[2]= ENDIAN_HANDLE_LONG(pElem->pwr.ContMissBcnsSpread[2]);
   1913     pElem->pwr.ContMissBcnsSpread[3]= ENDIAN_HANDLE_LONG(pElem->pwr.ContMissBcnsSpread[3]);
   1914     pElem->pwr.ContMissBcnsSpread[4]= ENDIAN_HANDLE_LONG(pElem->pwr.ContMissBcnsSpread[4]);
   1915     pElem->pwr.ContMissBcnsSpread[5]= ENDIAN_HANDLE_LONG(pElem->pwr.ContMissBcnsSpread[5]);
   1916     pElem->pwr.ContMissBcnsSpread[6]= ENDIAN_HANDLE_LONG(pElem->pwr.ContMissBcnsSpread[6]);
   1917     pElem->pwr.ContMissBcnsSpread[7]= ENDIAN_HANDLE_LONG(pElem->pwr.ContMissBcnsSpread[7]);
   1918     pElem->pwr.ContMissBcnsSpread[8]= ENDIAN_HANDLE_LONG(pElem->pwr.ContMissBcnsSpread[8]);
   1919     pElem->pwr.ContMissBcnsSpread[9]= ENDIAN_HANDLE_LONG(pElem->pwr.ContMissBcnsSpread[9]);
   1920 
   1921     pElem->ps.psPollTimeOuts        = ENDIAN_HANDLE_LONG(pElem->ps.psPollTimeOuts);
   1922     pElem->ps.upsdTimeOuts          = ENDIAN_HANDLE_LONG(pElem->ps.upsdTimeOuts);
   1923     pElem->ps.upsdMaxSPTime         = ENDIAN_HANDLE_LONG(pElem->ps.upsdMaxSPTime);
   1924     pElem->ps.upsdMaxAPturn         = ENDIAN_HANDLE_LONG(pElem->ps.upsdMaxAPturn);
   1925     pElem->ps.psPollMaxAPturn       = ENDIAN_HANDLE_LONG(pElem->ps.psPollMaxAPturn);
   1926     pElem->ps.psPollUtilization     = ENDIAN_HANDLE_LONG(pElem->ps.psPollUtilization);
   1927     pElem->ps.upsdUtilization       = ENDIAN_HANDLE_LONG(pElem->ps.upsdUtilization);
   1928 
   1929     /* Isr */
   1930     WLAN_OS_REPORT(("------  Isr statistics  -------------------\n"));
   1931     WLAN_OS_REPORT(("ACXRxProcs  = %8d\n", pElem->isr.ACXRxProcs));
   1932     WLAN_OS_REPORT(("RxHeaders   = %8d, RxCompletes       = %8d\n", pElem->isr.RxHeaders, pElem->isr.RxCompletes));
   1933     WLAN_OS_REPORT(("RxRdys      = %8d, RxMemOverflow     = %8d\n", pElem->isr.RxRdys, pElem->isr.RxMemOverflow));
   1934     WLAN_OS_REPORT(("ACXTxProcs  = %8d, ACXTxExchComplete = %8d\n", pElem->isr.ACXTxProcs, pElem->isr.ACXTxExchComplete));
   1935     WLAN_OS_REPORT(("DecryptDone       = %8d\n", pElem->isr.DecryptDone));
   1936     WLAN_OS_REPORT(("HwPMModeChanges   = %8d\n", pElem->isr.HwPMModeChanges));
   1937     WLAN_OS_REPORT(("HostAcknowledges  = %8d\n", pElem->isr.HostAcknowledges));
   1938     WLAN_OS_REPORT(("PCI_PM            = %8d\n", pElem->isr.PCI_PM));
   1939     WLAN_OS_REPORT(("ACMWakeups        = %8d\n", pElem->isr.ACMWakeups));
   1940     WLAN_OS_REPORT(("LowRSSI           = %8d\n", pElem->isr.LowRssi));
   1941     WLAN_OS_REPORT(("ACXCommands = %8d, Cmd_Cmplt= %8d\n", pElem->isr.ACXCommands, pElem->isr.Cmd_Cmplt));
   1942     WLAN_OS_REPORT(("DMA0Done    = %8d, DMA1Done = %8d\n", pElem->isr.DMA0Done, pElem->isr.DMA1Done));
   1943     WLAN_OS_REPORT(("IRQs = %8d, FIQs = %8d\n", pElem->isr.IRQs, pElem->isr.FIQs));
   1944 
   1945     /* Rx */
   1946     WLAN_OS_REPORT(("------  Rx  statistics  -------------------\n"));
   1947     WLAN_OS_REPORT(("RxDroppedFrame    = %d\n", pElem->rx.RxDroppedFrame));
   1948     WLAN_OS_REPORT(("RxFcsErr      = %d\n", pElem->rx.RxFcsErr));
   1949     WLAN_OS_REPORT(("RxHdrOverflow     = %d\n", pElem->rx.RxHdrOverflow));
   1950     WLAN_OS_REPORT(("RxHWStuck         = %d\n", pElem->rx.RxHWStuck));
   1951     WLAN_OS_REPORT(("RxOutOfMem        = %d\n", pElem->rx.RxOutOfMem));
   1952     WLAN_OS_REPORT(("RxXfrHintTrig     = %d\n", pElem->rx.RxXfrHintTrig));
   1953     WLAN_OS_REPORT(("RxResetCounter    = %d\n", pElem->rx.RxResetCounter));
   1954 
   1955     /* Tx */
   1956     WLAN_OS_REPORT(("------  Tx  statistics  -------------------\n"));
   1957     WLAN_OS_REPORT(("TxInDescOverflow  = %d\n", pElem->tx.TxInternalDescOverflow));
   1958 
   1959     /* Dma */
   1960     WLAN_REPORT_REPLY(pHwMboxConfig->hReport, HAL_HW_CTRL_MODULE_LOG,
   1961         ("------  Dma  statistics  -------------------\n"));
   1962     WLAN_REPORT_REPLY(pHwMboxConfig->hReport, HAL_HW_CTRL_MODULE_LOG,
   1963         ("RxDMARequested  = %d\n", pElem->dma.RxDMARequested));
   1964     WLAN_REPORT_REPLY(pHwMboxConfig->hReport, HAL_HW_CTRL_MODULE_LOG,
   1965         ("RxDMAErrors  = %d\n", pElem->dma.RxDMAErrors));
   1966     WLAN_REPORT_REPLY(pHwMboxConfig->hReport, HAL_HW_CTRL_MODULE_LOG,
   1967         ("TxDMARequested  = %d\n", pElem->dma.TxDMARequested));
   1968     WLAN_REPORT_REPLY(pHwMboxConfig->hReport, HAL_HW_CTRL_MODULE_LOG,
   1969         ("TxDMAErrors  = %d\n", pElem->dma.TxDMAErrors));
   1970 
   1971     /* Wep */
   1972     WLAN_OS_REPORT(("------  Wep statistics  -------------------\n"));
   1973     WLAN_OS_REPORT(("WepDefaultKeyCount= %d\n", pElem->wep.WepDefaultKeyCount));
   1974     WLAN_OS_REPORT(("WepAddrKeyCount   = %d\n", pElem->wep.WepAddrKeyCount));
   1975     WLAN_OS_REPORT(("WepDecryptFail    = %d\n", pElem->wep.WepDecryptFail));
   1976     WLAN_OS_REPORT(("WepKeyNotFound    = %d\n", pElem->wep.WepKeyNotFound));
   1977 
   1978     /* AES statistics */
   1979     WLAN_OS_REPORT(("------------  AES Statistics !!!!  ---------------\n"));
   1980     WLAN_OS_REPORT(("Aes Encryption Failure     = %8d, Aes Decryption Failure    = %8d\n",
   1981                       pElem->aes.AesEncryptFail, pElem->aes.AesDecryptFail));
   1982 
   1983     WLAN_OS_REPORT(("Aes Encrypted Packets      = %8d, Aes Decrypted Packets     = %8d\n",
   1984                pElem->aes.AesEncryptPackets, pElem->aes.AesDecryptPackets));
   1985 
   1986     WLAN_OS_REPORT(("Aes Encryption Interrupt   = %8d, Aes Decrryption Interrupt = %8d\n\n",
   1987               pElem->aes.AesEncryptInterrupt, pElem->aes.AesDecryptInterrupt));
   1988 
   1989     /* events */
   1990     WLAN_OS_REPORT(("------  Events  -------------------\n"));
   1991     WLAN_OS_REPORT(("Heartbeat    = %d\n", pElem->event.heartbeat));
   1992 
   1993     WLAN_OS_REPORT(("Calibration    = %d\n", pElem->event.calibration));
   1994     WLAN_OS_REPORT(("rxMismatch    = %d\n", pElem->event.rxMismatch));
   1995     WLAN_OS_REPORT(("rxMemEmpty    = %d\n", pElem->event.rxMemEmpty));
   1996     WLAN_OS_REPORT(("rxPool    = %d\n", pElem->event.rxPool));
   1997     WLAN_OS_REPORT(("oomLate  = %d\n", pElem->event.oomLate));
   1998     WLAN_OS_REPORT(("phyTransmitError    = %d\n", pElem->event.phyTransmitError));
   1999     WLAN_OS_REPORT(("txStuck    = %d\n", pElem->event.txStuck));
   2000 
   2001     /* AES statistics */
   2002     WLAN_REPORT_REPLY(pHwMboxConfig->hReport, HAL_HW_CTRL_MODULE_LOG,
   2003         ("------------  AES Statistics !!!!  ---------------\n"));
   2004     WLAN_REPORT_REPLY(pHwMboxConfig->hReport, HAL_HW_CTRL_MODULE_LOG,
   2005         ("Aes Encryption Failure     = %8d, Aes Decryption Failure     = %8d\n",
   2006                       pElem->aes.AesEncryptFail, pElem->aes.AesDecryptFail));
   2007 
   2008     WLAN_REPORT_REPLY(pHwMboxConfig->hReport, HAL_HW_CTRL_MODULE_LOG,
   2009         ("Aes Encrypted Packets      = %8d, Aes Decrypted Packets     = %8d\n",
   2010                pElem->aes.AesEncryptPackets, pElem->aes.AesDecryptPackets));
   2011 
   2012     WLAN_REPORT_REPLY(pHwMboxConfig->hReport, HAL_HW_CTRL_MODULE_LOG,
   2013         ("Aes Encryption Interrupt   = %8d, Aes Decrryption Interrupt   = %8d\n",
   2014               pElem->aes.AesEncryptInterrupt, pElem->aes.AesDecryptInterrupt));
   2015    /* PsPoll/Upsd */
   2016     WLAN_OS_REPORT(("----------- PsPoll / Upsd -----------\n"));
   2017     WLAN_OS_REPORT(("psPollTimeOuts     = %d\n",pElem->ps.psPollTimeOuts));
   2018     WLAN_OS_REPORT(("upsdTimeOuts       = %d\n",pElem->ps.upsdTimeOuts));
   2019     WLAN_OS_REPORT(("upsdMaxSPTime      = %d\n",pElem->ps.upsdMaxSPTime));
   2020     WLAN_OS_REPORT(("upsdMaxAPturn      = %d\n",pElem->ps.upsdMaxAPturn));
   2021     WLAN_OS_REPORT(("psPollMaxAPturn    = %d\n",pElem->ps.psPollMaxAPturn));
   2022     WLAN_OS_REPORT(("psPollUtilization  = %d\n",pElem->ps.psPollUtilization));
   2023     WLAN_OS_REPORT(("upsdUtilization    = %d\n",pElem->ps.upsdUtilization));
   2024 
   2025     /* Power Save Counters */
   2026     WLAN_OS_REPORT(("------  Power management  ----------\n"));
   2027     WLAN_OS_REPORT(("PSEnterCnt    = %d\n", pElem->pwr.PSEnterCnt));
   2028     WLAN_OS_REPORT(("ELPEnterCnt    = %d\n", pElem->pwr.ELPEnterCnt));
   2029     if(pElem->pwr.RcvdBeaconsCnt != 0)
   2030     {
   2031         WLAN_OS_REPORT(("MissingBcnsCnt    = %d (percentage <= %d) \n",
   2032                 pElem->pwr.MissingBcnsCnt,
   2033                 ((pElem->pwr.MissingBcnsCnt * 100) / (pElem->pwr.RcvdBeaconsCnt + pElem->pwr.MissingBcnsCnt)) ));
   2034     }
   2035     else
   2036     {
   2037         WLAN_OS_REPORT(("MissingBcnsCnt    = %d (percentage = 0) \n", pElem->pwr.MissingBcnsCnt));
   2038     }
   2039     WLAN_OS_REPORT(("WakeOnHostCnt    = %d\n", pElem->pwr.WakeOnHostCnt));
   2040     WLAN_OS_REPORT(("WakeOnTimerExpCnt    = %d\n", pElem->pwr.WakeOnTimerExpCnt));
   2041     WLAN_OS_REPORT(("TxWithPSCnt    = %d\n", pElem->pwr.TxWithPSCnt));
   2042     WLAN_OS_REPORT(("TxWithoutPSCnt    = %d\n", pElem->pwr.TxWithoutPSCnt));
   2043     WLAN_OS_REPORT(("RcvdBeaconsCnt    = %d\n", pElem->pwr.RcvdBeaconsCnt));
   2044     WLAN_OS_REPORT(("PowerSaveOffCnt    = %d\n", pElem->pwr.PowerSaveOffCnt));
   2045     WLAN_OS_REPORT(("EnablePS    = %d\n", pElem->pwr.EnablePSCnt));
   2046     WLAN_OS_REPORT(("DisablePS    = %d\n", pElem->pwr.DisablePSCnt));
   2047     WLAN_OS_REPORT(("FixTsfPSCnt    = %d\n\n", pElem->pwr.FixTsfPSCnt));
   2048     WLAN_OS_REPORT(("Single Missed Beacon           = %d\n", (pElem->pwr.ContMissBcnsSpread[0] & 0xFFFF)));
   2049     WLAN_OS_REPORT(("2 Continuous Missed Beacons    = %d\n", (pElem->pwr.ContMissBcnsSpread[1] & 0xFFFF)));
   2050     WLAN_OS_REPORT(("3 Continuous Missed Beacons    = %d\n", (pElem->pwr.ContMissBcnsSpread[2] & 0xFFFF)));
   2051     WLAN_OS_REPORT(("4 Continuous Missed Beacons    = %d\n", (pElem->pwr.ContMissBcnsSpread[3] & 0xFFFF)));
   2052     WLAN_OS_REPORT(("5 Continuous Missed Beacons    = %d\n", (pElem->pwr.ContMissBcnsSpread[4] & 0xFFFF)));
   2053     WLAN_OS_REPORT(("6 Continuous Missed Beacons    = %d\n", (pElem->pwr.ContMissBcnsSpread[5] & 0xFFFF)));
   2054     WLAN_OS_REPORT(("7 Continuous Missed Beacons    = %d\n", (pElem->pwr.ContMissBcnsSpread[6] & 0xFFFF)));
   2055     WLAN_OS_REPORT(("8 Continuous Missed Beacons    = %d\n", (pElem->pwr.ContMissBcnsSpread[7] & 0xFFFF)));
   2056     WLAN_OS_REPORT(("9 Continuous Missed Beacons    = %d\n", (pElem->pwr.ContMissBcnsSpread[8] & 0xFFFF)));
   2057     WLAN_OS_REPORT((">=10 Continuous Missed Beacons = %d\n\n", (pElem->pwr.ContMissBcnsSpread[9] & 0xFFFF)));
   2058 
   2059     WLAN_OS_REPORT(("RcvdAwakeBeaconsCnt    = %d\n", pElem->pwr.RcvdAwakeBeaconsCnt));
   2060     WLAN_OS_REPORT(("Single Missed Beacon        [Awake] = %d\n", (pElem->pwr.ContMissBcnsSpread[0] >> 16)));
   2061     WLAN_OS_REPORT(("2 Continuous Missed Beacons [Awake] = %d\n", (pElem->pwr.ContMissBcnsSpread[1] >> 16)));
   2062     WLAN_OS_REPORT(("3 Continuous Missed Beacons [Awake] = %d\n", (pElem->pwr.ContMissBcnsSpread[2] >> 16)));
   2063     WLAN_OS_REPORT(("4 Continuous Missed Beacons [Awake] = %d\n", (pElem->pwr.ContMissBcnsSpread[3] >> 16)));
   2064     WLAN_OS_REPORT(("5 Continuous Missed Beacons [Awake] = %d\n", (pElem->pwr.ContMissBcnsSpread[4] >> 16)));
   2065     WLAN_OS_REPORT(("6 Continuous Missed Beacons [Awake] = %d\n", (pElem->pwr.ContMissBcnsSpread[5] >> 16)));
   2066     WLAN_OS_REPORT(("7 Continuous Missed Beacons [Awake] = %d\n", (pElem->pwr.ContMissBcnsSpread[6] >> 16)));
   2067     WLAN_OS_REPORT(("8 Continuous Missed Beacons [Awake] = %d\n", (pElem->pwr.ContMissBcnsSpread[7] >> 16)));
   2068     WLAN_OS_REPORT(("9 Continuous Missed Beacons [Awake] = %d\n", (pElem->pwr.ContMissBcnsSpread[8] >> 16)));
   2069     WLAN_OS_REPORT((">=10 Continuous Missed Beacons [Awake] = %d\n", (pElem->pwr.ContMissBcnsSpread[9] >> 16)));
   2070 
   2071     return OK;
   2072 }
   2073 
   2074 
   2075 /****************************************************************************
   2076  *                      whal_hwInfoElemFcsErrorCntGet ()
   2077  ****************************************************************************
   2078  * DESCRIPTION: Interrogate Fcs error counter from the ACX
   2079  *
   2080  * INPUTS:  None
   2081  *
   2082  * OUTPUT:  None
   2083  *
   2084  * RETURNS: OK or NOK
   2085  *
   2086  * NOTE: This field (at the ACX) is automatically cleared when interrogated
   2087  ****************************************************************************/
   2088 int whal_hwInfoElemFcsErrorCntGet (HwMboxConfig_T* pHwMboxConfig, UINT32* pFcsErrCnt)
   2089 {
   2090     ACXFCSErrorCount_t  WlanElm_FcsError;
   2091     ACXFCSErrorCount_t  *pCfg = &WlanElm_FcsError;
   2092 
   2093     /* Set information element header*/
   2094     pCfg->EleHdr.id = ACX_FCS_ERROR_CNT;
   2095     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
   2096 
   2097     /* Send the interrogation command*/
   2098 
   2099     /* Not implemented */
   2100     {
   2101         /* Solve endian problem*/
   2102         /* *pFcsErrCnt = ENDIAN_HANDLE_LONG(pCfg->FCSErrorCount); */
   2103 
   2104     }
   2105 
   2106     return NOK;
   2107 }
   2108 
   2109 
   2110 /****************************************************************************
   2111  *                      whal_hwInfoElemMiscTableSet ()
   2112  ****************************************************************************
   2113  * DESCRIPTION: Interrogate Statistics from the wlan hardware
   2114  *
   2115  * INPUTS:  None
   2116  *
   2117  * OUTPUT:  None
   2118  *
   2119  * RETURNS: OK or NOK
   2120  ****************************************************************************/
   2121 int whal_hwInfoElemMiscTableSet
   2122 (
   2123     HwMboxConfig_T *pHwMboxConfig,
   2124     ACXMisc_t      *pCfg
   2125 )
   2126 {
   2127     int rc = OK;
   2128     ACXMisc_t  aCfg;
   2129 
   2130     aCfg.EleHdr.id  = ACX_MISC_CFG;
   2131     aCfg.EleHdr.len = sizeof(ACXMisc_t) - sizeof(EleHdrStruct);
   2132 
   2133     /* Solve endian problem */
   2134     aCfg.txActivityLed = ENDIAN_HANDLE_WORD(pCfg->txActivityLed);
   2135     aCfg.fwInitLed     = ENDIAN_HANDLE_WORD(pCfg->fwInitLed);
   2136     aCfg.diagnosticLed = ENDIAN_HANDLE_WORD(pCfg->diagnosticLed);
   2137 
   2138     /* Send the interrogation command */
   2139     if ((rc = CmdQueue_CmdConfigure (pHwMboxConfig->hCmdMboxQueue, &aCfg, sizeof(aCfg))) != OK)
   2140     {
   2141     }
   2142 
   2143     return rc;
   2144 }
   2145 
   2146 
   2147 /****************************************************************************
   2148  *                      whal_hwInfoElemMiscTableGet ()
   2149  ****************************************************************************
   2150  * DESCRIPTION: Interrogate Statistics from the wlan hardware
   2151  *
   2152  * INPUTS:  None
   2153  *
   2154  * OUTPUT:  None
   2155  *
   2156  * RETURNS: OK or NOK
   2157  ****************************************************************************/
   2158 int whal_hwInfoElemMiscTableGet
   2159 (
   2160     HwMboxConfig_T *pHwMboxConfig,
   2161     ACXMisc_t      *pCfg,
   2162     void           *fCb,
   2163     TI_HANDLE       hCb
   2164 )
   2165 {
   2166     int rc = OK;
   2167 
   2168     /* Set information element header */
   2169     pCfg->EleHdr.id  = ACX_MISC_CFG;
   2170     pCfg->EleHdr.len = sizeof(ACXMisc_t) - sizeof(EleHdrStruct);
   2171 
   2172     /* Send the interrogation command */
   2173     if ((rc = CmdQueue_CmdInterrogateWithCb (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(ACXMisc_t), fCb, hCb, pCfg)) != OK)
   2174     {
   2175     }
   2176 
   2177     return rc;
   2178 }
   2179 
   2180 
   2181 #if 0
   2182 /****************************************************************************
   2183  *                      whal_hwInfoElemTxTrafficCategorySet()
   2184  ****************************************************************************
   2185  * DESCRIPTION: Write the Traffic  configuration (For Quality Of Service)
   2186  *
   2187  * INPUTS:
   2188  *
   2189  * OUTPUT:  None
   2190  *
   2191  * RETURNS: OK or NOK
   2192  ****************************************************************************/
   2193 int whal_hwInfoElemTxTrafficCategorySet (HwMboxConfig_T* pHwMboxConfig, whaCtrl_acTrafficParams_t* pTconfParams)
   2194 {
   2195     TrafficCategoryCfgType    TrafficCategoryCfg;
   2196     TrafficCategoryCfgType*   pCfg = &TrafficCategoryCfg;
   2197 
   2198     os_memoryZero( pHwMboxConfig->hOs, (void *)pCfg, sizeof(*pCfg) );
   2199 
   2200     /*
   2201      * Set information element header
   2202      * ==============================
   2203      */
   2204     pCfg->EleHdr.id = ACX_TID_CFG;
   2205     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
   2206 
   2207     /*
   2208      * Set information element Data
   2209      * ==============================
   2210      */
   2211     pCfg->acId = pTconfParams->acId;
   2212     pCfg->aifsn = pTconfParams->aifsn;
   2213     pCfg->cwMax = pTconfParams->cwMax;
   2214     pCfg->cwMin = pTconfParams->cwMin;
   2215     pCfg->longRetryLimit = pTconfParams->longRetryLimit;
   2216     pCfg->shortRetryLimit = pTconfParams->shortRetryLimit;
   2217     pCfg->txopLimit = pTconfParams->txopLimit;
   2218     pCfg->rxTimeout = pTconfParams->rxTimeout;
   2219     pCfg->deliveryTriggerType = pTconfParams->PsParameters;
   2220 
   2221     WLAN_REPORT_INFORMATION(pHwMboxConfig->hReport, HAL_HW_CTRL_MODULE_LOG,  ("whal_hwInfoElemTxTrafficCategory : \n"));
   2222     WLAN_REPORT_INFORMATION(pHwMboxConfig->hReport, HAL_HW_CTRL_MODULE_LOG,  ("pCfg->cfg.acID= %d\n",pCfg->acId));
   2223     WLAN_REPORT_INFORMATION(pHwMboxConfig->hReport, HAL_HW_CTRL_MODULE_LOG,  ("pCfg->cfg.edcfCfg.aifsn= %d\n",pCfg->aifsn));
   2224     WLAN_REPORT_INFORMATION(pHwMboxConfig->hReport, HAL_HW_CTRL_MODULE_LOG,  ("pCfg->cfg.edcfCfg.cwMax= %d\n",pCfg->cwMax));
   2225     WLAN_REPORT_INFORMATION(pHwMboxConfig->hReport, HAL_HW_CTRL_MODULE_LOG,  ("pCfg->cfg.edcfCfg.cwMin= %d\n",pCfg->cwMin));
   2226     WLAN_REPORT_INFORMATION(pHwMboxConfig->hReport, HAL_HW_CTRL_MODULE_LOG,  ("pCfg->cfg.edcfCfg.longRetryLimit= %d\n",pCfg->longRetryLimit));
   2227     WLAN_REPORT_INFORMATION(pHwMboxConfig->hReport, HAL_HW_CTRL_MODULE_LOG,  ("pCfg->cfg.edcfCfg.shortRetryLimit= %d\n",pCfg->shortRetryLimit));
   2228     WLAN_REPORT_INFORMATION(pHwMboxConfig->hReport, HAL_HW_CTRL_MODULE_LOG,  ("pCfg->cfg.edcfCfg.rxTimeout= %d\n", pCfg->rxTimeout));
   2229     WLAN_REPORT_INFORMATION(pHwMboxConfig->hReport, HAL_HW_CTRL_MODULE_LOG,  ("pCfg->cfg.edcfCfg.txopLimit= %d\n", pCfg->txopLimit));
   2230     WLAN_REPORT_INFORMATION(pHwMboxConfig->hReport, HAL_HW_CTRL_MODULE_LOG,  ("pCfg->deliveryTriggerType= %d\n", pCfg->deliveryTriggerType));
   2231 
   2232     /*
   2233      * Send the configuration command
   2234      * ==============================
   2235      */
   2236     return CmdQueue_CmdConfigure (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(*pCfg));
   2237 }
   2238 #endif
   2239 
   2240 
   2241 /****************************************************************************
   2242  *                      whal_hwInfoElemQueueConfigurationSet()
   2243  ****************************************************************************
   2244  * DESCRIPTION: Write the Queue configuration (For Quality Of Service)
   2245  *
   2246  * INPUTS:
   2247  *
   2248  * OUTPUT:  None
   2249  *
   2250  * RETURNS: OK or NOK
   2251  ****************************************************************************/
   2252 int whal_hwInfoElemQueueConfigurationSet (HwMboxConfig_T* pHwMboxConfig,
   2253                                            queueTrafficParams_t* pQtrafficParams)
   2254 {
   2255     ACXTIDConfig_t    TrafficCategoryCfg;
   2256     ACXTIDConfig_t *  pCfg = &TrafficCategoryCfg;
   2257 
   2258     os_memoryZero (pHwMboxConfig->hOs, (void *)pCfg, sizeof(*pCfg));
   2259 
   2260     /*
   2261      * Set information element header
   2262      * ==============================
   2263      */
   2264     pCfg->EleHdr.id = ACX_TID_CFG;
   2265     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
   2266 
   2267     /*
   2268      * Set information element Data
   2269      * ==============================
   2270      */
   2271     pCfg->queueID       = pQtrafficParams->queueID;
   2272     pCfg->channelType   = pQtrafficParams->channelType;
   2273     pCfg->tsid          = pQtrafficParams->tsid;
   2274     pCfg->psScheme      = pQtrafficParams->psScheme;
   2275     pCfg->APSDConf[0]   = pQtrafficParams->APSDConf[0];
   2276     pCfg->APSDConf[1]   = pQtrafficParams->APSDConf[1];
   2277 
   2278     WLAN_REPORT_INFORMATION(pHwMboxConfig->hReport,HAL_HW_CTRL_MODULE_LOG,
   2279         ("%s queueID = 0x%x, channelType = 0x%x, tsid = 0x%x, psScheme = 0x%x\n",
   2280             __FUNCTION__,pCfg->queueID,pCfg->channelType,pCfg->tsid,pCfg->psScheme));
   2281 
   2282     WLAN_REPORT_INFORMATION(pHwMboxConfig->hReport,HAL_HW_CTRL_MODULE_LOG,
   2283         ("APSDConf[0] = 0x%x, APSDConf[1] = 0x%x, len = 0x%x\n",
   2284             pCfg->APSDConf[0],pCfg->APSDConf[0],pCfg->EleHdr.len));
   2285 
   2286     /*
   2287      * Send the configuration command
   2288      * ==============================
   2289      */
   2290     return CmdQueue_CmdConfigure (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(*pCfg));
   2291 }
   2292 
   2293 
   2294 /****************************************************************************
   2295  *                      whal_hwInfoElemAcParansConfigurationWrite()
   2296  ****************************************************************************
   2297  * DESCRIPTION: Write the AC configuration (For Quality Of Service)
   2298  *
   2299  * INPUTS:
   2300  *
   2301  * OUTPUT:  None
   2302  *
   2303  * RETURNS: OK or NOK
   2304  ****************************************************************************/
   2305 int whal_hwInfoElemAcParamsConfigurationSet (HwMboxConfig_T* pHwMboxConfig,
   2306                                               configureCmdCBParams_t *pConfigureCommand)
   2307 {
   2308     ACXAcCfg_t     AcCfg;
   2309     ACXAcCfg_t    *pCfg  = &AcCfg;
   2310     acQosParams_t *pAcQosParams = (acQosParams_t*)(pConfigureCommand->CB_buf);
   2311 
   2312     os_memoryZero (pHwMboxConfig->hOs, (void *)pCfg, sizeof(*pCfg));
   2313 
   2314     /*
   2315      * Set information element header
   2316      * ==============================
   2317      */
   2318     pCfg->EleHdr.id = ACX_AC_CFG;
   2319     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
   2320 
   2321     /*
   2322      * Set information element Data
   2323      * ==============================
   2324      */
   2325 
   2326     pCfg->ac        = pAcQosParams->ac;
   2327     pCfg->aifsn     = pAcQosParams->aifsn;
   2328     pCfg->cwMax     = ENDIAN_HANDLE_WORD(pAcQosParams->cwMax);
   2329     pCfg->cwMin     = pAcQosParams->cwMin;
   2330     pCfg->txopLimit = ENDIAN_HANDLE_WORD(pAcQosParams->txopLimit);
   2331 
   2332     WLAN_REPORT_INFORMATION(pHwMboxConfig->hReport,HAL_HW_CTRL_MODULE_LOG,
   2333         ("whal_hwInfoElemAcParamsConfigurationWrite:\n ac = 0x%x, aifsn = 0x%x, cwMax = 0x%x, cwMin = 0x%x,txopLimit = 0x%x \n",
   2334         pCfg->ac,pCfg->aifsn,pCfg->cwMax,pCfg->cwMin,pCfg->txopLimit));
   2335 
   2336     WLAN_REPORT_INFORMATION(pHwMboxConfig->hReport,HAL_HW_CTRL_MODULE_LOG,
   2337         ("whal_hwInfoElemAcParamsConfigurationWrite:\n ac = 0x%x, aifsn = 0x%x, cwMax = 0x%x, cwMin = 0x%x,txopLimit = 0x%x \n",
   2338         pCfg->ac,pCfg->aifsn,pCfg->cwMax,pCfg->cwMin,pCfg->txopLimit));
   2339 
   2340     return CmdQueue_CmdConfigure (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(*pCfg));
   2341 }
   2342 
   2343 
   2344 /****************************************************************************
   2345  *                      whal_hwInfoElemAcParansConfigurationGet()
   2346  ****************************************************************************
   2347  * DESCRIPTION: Write the AC configuration (For Quality Of Service)
   2348  *
   2349  * INPUTS:
   2350  *
   2351  * OUTPUT:  None
   2352  *
   2353  * RETURNS: OK or NOK
   2354  ****************************************************************************/
   2355 int whal_hwInfoElemAcParamsConfigurationGet (HwMboxConfig_T* pHwMboxConfig,
   2356                                              configureCmdCBParams_t *pConfigureCommand)
   2357 {
   2358     ACXAcCfg_t  AcCfg;
   2359     ACXAcCfg_t *pCfg  = &AcCfg;
   2360     acQosParams_t *pAcQosParams = (acQosParams_t*)(pConfigureCommand->CB_buf);
   2361 
   2362     os_memoryZero (pHwMboxConfig->hOs, (void *)pCfg, sizeof(*pCfg));
   2363 
   2364     /*
   2365      * Set information element header
   2366      * ==============================
   2367      */
   2368     pCfg->EleHdr.id = ACX_AC_CFG;
   2369     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
   2370 
   2371     /*
   2372      * Set information element Data
   2373      * ==============================
   2374      */
   2375     pCfg->ac        = pAcQosParams->ac;
   2376     pCfg->aifsn     = pAcQosParams->aifsn;
   2377     pCfg->cwMax     = ENDIAN_HANDLE_WORD(pAcQosParams->cwMax);
   2378     pCfg->cwMin     = pAcQosParams->cwMin;
   2379     pCfg->txopLimit = ENDIAN_HANDLE_WORD(pAcQosParams->txopLimit);
   2380 
   2381     return CmdQueue_CmdConfigureWithCb (pHwMboxConfig->hCmdMboxQueue,
   2382                                         pCfg,
   2383                                         sizeof(*pCfg),
   2384                                         pConfigureCommand->CB_Func,
   2385                                         pConfigureCommand->CB_handle);
   2386 }
   2387 
   2388 
   2389 /****************************************************************************
   2390  *                      whal_hwInfoElemTxQueueCfgSet()
   2391  ****************************************************************************
   2392  * DESCRIPTION: Write the Access category configuration (For Quality Of Service)
   2393  *
   2394  * INPUTS:
   2395  *
   2396  * OUTPUT:  None
   2397  *
   2398  * RETURNS: OK or NOK
   2399  ****************************************************************************/
   2400 int whal_hwInfoElemTxQueueCfgSet(HwMboxConfig_T* pHwMboxConfig,
   2401                                     acQueuesParams_t* pAcQueuesParams,
   2402                                  UINT32 numOfTxBlk)
   2403 {
   2404     ACXTxQueueCfg_t    AccessCategory;
   2405     ACXTxQueueCfg_t *pCfg = &AccessCategory;
   2406     UINT16 HighblkRatio, LowBlkRatio;
   2407 
   2408     /*
   2409      * Set information element header
   2410      * ==============================
   2411      */
   2412     pCfg->EleHdr.id = ACX_TX_QUEUE_CFG;
   2413     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
   2414 
   2415     /*
   2416      * Set information element Data
   2417      * ==============================
   2418      */
   2419     HighblkRatio = pAcQueuesParams->percentOfBlockHighThreshold;
   2420     LowBlkRatio  = pAcQueuesParams->percentOfBlockLowThreshold;
   2421 
   2422     pCfg->qID = pAcQueuesParams->qId;
   2423     pCfg->numberOfBlockHighThreshold = ENDIAN_HANDLE_WORD((HighblkRatio * numOfTxBlk)/100);
   2424     pCfg->numberOfBlockLowThreshold  = ENDIAN_HANDLE_WORD((LowBlkRatio * numOfTxBlk)/100);
   2425 
   2426     return CmdQueue_CmdConfigure (pHwMboxConfig->hCmdMboxQueue,
   2427                                   pCfg,
   2428                                   sizeof(*pCfg));
   2429 }
   2430 
   2431 
   2432 /****************************************************************************
   2433  *                      whal_hwInfoElemPacketDetectionThresholdSet()
   2434  ****************************************************************************
   2435  * DESCRIPTION:  Set the PacketDetection threshold
   2436  *
   2437  * INPUTS:
   2438  *
   2439  * OUTPUT:  None
   2440  *
   2441  * RETURNS: OK or NOK
   2442  ****************************************************************************/
   2443 int whal_hwInfoElemPacketDetectionThresholdSet (HwMboxConfig_T* pHwMboxConfig, UINT32* pPdThreshold)
   2444 {
   2445     ACXPacketDetection_t    PacketDetectionThresholdCfg;
   2446     ACXPacketDetection_t *pCfg = &PacketDetectionThresholdCfg;
   2447 
   2448     /*
   2449      * Set information element header
   2450      * ==============================
   2451      */
   2452     pCfg->EleHdr.id = ACX_PD_THRESHOLD;
   2453     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
   2454 
   2455     /*
   2456      * Set information element Data
   2457      * ==============================
   2458      */
   2459     pCfg->pdThreshold = ENDIAN_HANDLE_LONG(*pPdThreshold);
   2460 
   2461     WLAN_REPORT_INFORMATION(pHwMboxConfig->hReport, HAL_HW_CTRL_MODULE_LOG,
   2462         ("%s: pdThreshold = 0x%x , len = 0x%x \n",__FUNCTION__,pCfg->pdThreshold,pCfg->EleHdr.len));
   2463 
   2464     return CmdQueue_CmdConfigure (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(*pCfg));
   2465 }
   2466 
   2467 
   2468 /****************************************************************************
   2469  *                      whal_hwInfoElemNoiseHistogramResultsGet()
   2470  ****************************************************************************
   2471  * DESCRIPTION: Get the Noise Histogram Measurement Results.
   2472  *
   2473  * INPUTS:
   2474  *
   2475  * OUTPUT:  None
   2476  *
   2477  * RETURNS: OK or NOK
   2478  ****************************************************************************/
   2479 int whal_hwInfoElemNoiseHistogramResultsGet (HwMboxConfig_T* pHwMboxConfig,
   2480                                              interogateCmdCBParams_t noiseHistCBParams)
   2481 {
   2482     NoiseHistResult_t   results;
   2483     NoiseHistResult_t   *pCfg = &results;
   2484 
   2485     /* Set information element header*/
   2486     pCfg->EleHdr.id  = ACX_NOISE_HIST;
   2487     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
   2488 
   2489     return CmdQueue_CmdInterrogateWithCb (pHwMboxConfig->hCmdMboxQueue,
   2490                                           pCfg,
   2491                                           sizeof(*pCfg),
   2492                                           noiseHistCBParams.CB_Func,
   2493                                           noiseHistCBParams.CB_handle,
   2494                                           noiseHistCBParams.CB_buf);
   2495 }
   2496 
   2497 /****************************************************************************
   2498 *                      whal_hwInfoElemPowerLevelTableGet()
   2499 ****************************************************************************
   2500 * DESCRIPTION: Get the Power level table from NVS.
   2501 *
   2502 * INPUTS:
   2503 *
   2504 * OUTPUT:  None
   2505 *
   2506 * RETURNS: OK or NOK
   2507 ****************************************************************************/
   2508 int  whal_hwInfoElemPowerLevelTableGet		 (HwMboxConfig_T *pHwMboxConfig,
   2509 											  interogateCmdCBParams_t powerLevelCBParams)
   2510 {
   2511 	PowerLevelTable_t   results;
   2512 	PowerLevelTable_t   *pCfg = &results;
   2513 
   2514 	/* Set information element header*/
   2515 	pCfg->EleHdr.id  = ACX_POWER_LEVEL_TABLE;
   2516 	pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
   2517 
   2518 	return CmdQueue_CmdInterrogateWithCb (pHwMboxConfig->hCmdMboxQueue,
   2519 		pCfg,
   2520 		sizeof(*pCfg),
   2521 		powerLevelCBParams.CB_Func,
   2522 		powerLevelCBParams.CB_handle,
   2523 		powerLevelCBParams.CB_buf);
   2524 }
   2525 
   2526 /****************************************************************************
   2527  *                      whal_hwInfoElemAcxBeaconFilterOptionsSet()
   2528  ****************************************************************************
   2529  * DESCRIPTION: Configure/Interrogate the beacon filtering option
   2530  *
   2531  * INPUTS:
   2532  *
   2533  * OUTPUT:  None
   2534  *
   2535  * RETURNS: OK or NOK
   2536  ****************************************************************************/
   2537 int whal_hwInfoElemAcxBeaconFilterOptionsSet (HwMboxConfig_T* pHwMboxConfig,
   2538                                               ACXBeaconFilterOptions_t* pWlanElm_BeaconFilterOptions)
   2539 {
   2540     int rc;
   2541     ACXBeaconFilterOptions_t* pCfg = pWlanElm_BeaconFilterOptions;
   2542 
   2543     if (NULL == pWlanElm_BeaconFilterOptions)
   2544     {
   2545         return NOK;
   2546     }
   2547 
   2548     /* Set information element header */
   2549     pCfg->EleHdr.id = ACX_BEACON_FILTER_OPT;
   2550     pCfg->EleHdr.len = sizeof(ACXBeaconFilterOptions_t) - sizeof(EleHdrStruct);
   2551 
   2552     /* Send the command */
   2553     rc = CmdQueue_CmdConfigure (pHwMboxConfig->hCmdMboxQueue,
   2554                                 pCfg,
   2555                                 sizeof(ACXBeaconFilterOptions_t));
   2556 
   2557     return rc;
   2558 }
   2559 
   2560 
   2561 /****************************************************************************
   2562  *                     whal_hwInfoElemAcxBeaconFilterIETableSet
   2563  ****************************************************************************
   2564  * DESCRIPTION: Configure/Interrogate the beacon filter IE table
   2565  *
   2566  * INPUTS:
   2567  *
   2568  * OUTPUT:  None
   2569  *
   2570  * RETURNS: OK or NOK
   2571  ****************************************************************************/
   2572 int whal_hwInfoElemAcxBeaconFilterIETableSet (HwMboxConfig_T* pHwMboxConfig,
   2573                                               UINT8* numberOfIEs,
   2574                                               UINT8* IETable,
   2575                                               UINT8* IETableSize)
   2576 {
   2577     int rc = OK;
   2578     ACXBeaconFilterIETable_t beaconFilterIETableStruct;
   2579     ACXBeaconFilterIETable_t *pCfg = &beaconFilterIETableStruct;
   2580 
   2581     if (( NULL == IETable ) || ( NULL == pHwMboxConfig ))
   2582     {
   2583         return PARAM_VALUE_NOT_VALID;
   2584     }
   2585 
   2586     pCfg->EleHdr.id = ACX_BEACON_FILTER_TABLE;
   2587     pCfg->EleHdr.len = *IETableSize + 1;
   2588     pCfg->NumberOfIEs = *numberOfIEs;
   2589 
   2590     os_memoryZero (pHwMboxConfig->hOs, (void *)pCfg->IETable, BEACON_FILTER_TABLE_MAX_SIZE);
   2591     os_memoryCopy (pHwMboxConfig->hOs, (void *)pCfg->IETable, (void *)IETable, *IETableSize);
   2592 
   2593     rc = CmdQueue_CmdConfigure (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(ACXBeaconFilterIETable_t));
   2594 
   2595     return rc;
   2596 }
   2597 
   2598 
   2599 /****************************************************************************
   2600  *                      whal_hwInfoElemAcxTxOptionsSet()
   2601  ****************************************************************************
   2602  * DESCRIPTION: Change the Event Vector Mask in the FW
   2603  *
   2604  * INPUTS: MaskVector   The Updated Vector Mask
   2605  *
   2606  * RETURNS: OK or NOK
   2607  ****************************************************************************/
   2608 int whal_hwInfoElemEventMaskSet (HwMboxConfig_T* pHwMboxConfig, UINT32 MaskVector)
   2609 {
   2610     int status;
   2611 
   2612     ACXEventMboxMask_t EventMboxData;
   2613     ACXEventMboxMask_t *pCfg = &EventMboxData;
   2614 
   2615     /* Set information element header*/
   2616     pCfg->EleHdr.id = ACX_EVENT_MBOX_MASK;
   2617     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
   2618     pCfg->lowEventMask = MaskVector;
   2619     pCfg->highEventMask = 0xffffffff; /* Not in Use */
   2620 
   2621     WLAN_REPORT_INFORMATION (pHwMboxConfig->hReport, HAL_HW_CTRL_MODULE_LOG, ("whal_hwInfoElemEventMaskSet:\n"));
   2622 
   2623     status = CmdQueue_CmdConfigure (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(*pCfg));
   2624 
   2625     if (status != OK)
   2626     {
   2627         WLAN_REPORT_ERROR (pHwMboxConfig->hReport, HAL_HW_CTRL_MODULE_LOG,
   2628                           ("whal_hwInfoElemEventMaskSet: Error Configure Mask\n"));
   2629         return NOK;
   2630     }
   2631 
   2632     return OK;
   2633 }
   2634 
   2635 
   2636 /****************************************************************************
   2637  *                      whal_hwInfoElemCcaThresholdSet()
   2638  ****************************************************************************
   2639  * DESCRIPTION: Configure Tx and Rx CCA detection
   2640  *
   2641  * INPUTS:  None
   2642  *
   2643  * OUTPUT:  None
   2644  *
   2645  * RETURNS: OK or NOK
   2646  ****************************************************************************/
   2647 int whal_hwInfoElemCcaThresholdSet (HwMboxConfig_T* pHwMboxConfig, UINT16* ccaThreshold, BOOL bTxEnergyDetection)
   2648 {
   2649     int rc;
   2650     ACXEnergyDetection_t AcxElm_CcaThreshold;
   2651     ACXEnergyDetection_t *pCfg = &AcxElm_CcaThreshold;
   2652 
   2653     /* Set information element header */
   2654     pCfg->EleHdr.id = ACX_CCA_THRESHOLD;
   2655     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
   2656 
   2657     pCfg->rxCCAThreshold = ENDIAN_HANDLE_WORD(*ccaThreshold);
   2658     pCfg->txEnergyDetection = (Bool_e)bTxEnergyDetection;
   2659 
   2660     /* Send the configuration command */
   2661     rc = CmdQueue_CmdConfigure (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(*pCfg));
   2662 
   2663     return rc;
   2664 }
   2665 
   2666 
   2667 /****************************************************************************
   2668  *                      whal_hwInfoElemDtimPeriodSet()
   2669  ****************************************************************************
   2670  * DESCRIPTION: Configure/Interrogate the Slot Time
   2671  *
   2672  * INPUTS:  None
   2673  *
   2674  * OUTPUT:  None
   2675  *
   2676  * RETURNS: OK or NOK
   2677  ****************************************************************************/
   2678 int whal_hwInfoElemDtimPeriodSet (HwMboxConfig_T* pHwMboxConfig, UINT8* dtimPeriod, UINT16*TBTT)
   2679 {
   2680     int rc;
   2681     ACXDtimPeriodCfg_t AcxElm_DtimPeriod;
   2682     ACXDtimPeriodCfg_t *pCfg = &AcxElm_DtimPeriod;
   2683 
   2684     /* Set information element header */
   2685     pCfg->EleHdr.id = ACX_WR_TBTT_AND_DTIM;
   2686     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
   2687 
   2688     pCfg->dtimInterval = (*dtimPeriod);
   2689     pCfg->tbtt = ENDIAN_HANDLE_WORD(*TBTT);
   2690 
   2691     /* Send the configuration command */
   2692     rc = CmdQueue_CmdConfigure (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(*pCfg));
   2693 
   2694     return rc;
   2695 }
   2696 
   2697 
   2698 /****************************************************************************
   2699  *                      whal_hwInfoElemDtimPeriodGet()
   2700  ****************************************************************************
   2701  * DESCRIPTION: Configure/Interrogate the Slot Time
   2702  *
   2703  * INPUTS:  None
   2704  *
   2705  * OUTPUT:  None
   2706  *
   2707  * RETURNS: OK or NOK
   2708  ****************************************************************************/
   2709 int whal_hwInfoElemDtimPeriodGet (HwMboxConfig_T* pHwMboxConfig, UINT8* dtimPeriod, UINT16*TBTT)
   2710 {
   2711     int rc = OK;
   2712     ACXDtimPeriodCfg_t AcxElm_DtimPeriod;
   2713     ACXDtimPeriodCfg_t *pCfg = &AcxElm_DtimPeriod;
   2714 
   2715     /* Set information element header */
   2716     pCfg->EleHdr.id = ACX_WR_TBTT_AND_DTIM;
   2717     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
   2718 
   2719     /* Not implemented */
   2720   #if 0
   2721             *dtimPeriod = pCfg->dtimInterval;
   2722   #endif
   2723 
   2724     return rc;
   2725 }
   2726 
   2727 
   2728 /****************************************************************************
   2729  *                      whal_hwInfoElemAcxLowSNRThresholdSet()
   2730  ****************************************************************************
   2731  * DESCRIPTION: Configure the RSSI threshold parameters
   2732  *
   2733  * INPUTS:  None
   2734  *
   2735  * OUTPUT:  None
   2736  *
   2737  * RETURNS: OK or NOK
   2738  ****************************************************************************/
   2739 int whal_hwInfoElemAcxLowSNRThresholdSet (HwMboxConfig_T* pHwMboxConfig,
   2740                                           ACXLowSNRTriggerParameters_t* AcxElm_LowThresholdOptions)
   2741 {
   2742     /* Set information element header */
   2743     AcxElm_LowThresholdOptions->EleHdr.id = ACX_LOW_SNR;
   2744     AcxElm_LowThresholdOptions->EleHdr.len = sizeof(*AcxElm_LowThresholdOptions) - sizeof(EleHdrStruct);
   2745 
   2746     /* Send the configuration command */
   2747     return CmdQueue_CmdConfigure (pHwMboxConfig->hCmdMboxQueue, AcxElm_LowThresholdOptions, sizeof(*AcxElm_LowThresholdOptions));
   2748 }
   2749 
   2750 
   2751 /****************************************************************************
   2752  *                      whal_hwInfoElemAcxLowRSSIThresholdSet()
   2753  ****************************************************************************
   2754  * DESCRIPTION: Configure the RSSI threshold parameters
   2755  *
   2756  * INPUTS:  None
   2757  *
   2758  * OUTPUT:  None
   2759  *
   2760  * RETURNS: OK or NOK
   2761  ****************************************************************************/
   2762 int whal_hwInfoElemAcxLowRSSIThresholdSet (HwMboxConfig_T* pHwMboxConfig,
   2763                                            ACXLowRSSITriggerParameters_t* pWlanElm_LowRSSIThresholdOptions)
   2764 {
   2765     ACXLowRSSITriggerParameters_t AcxElm_LowRSSIThresholdOptions;
   2766     ACXLowRSSITriggerParameters_t* pCfg = &AcxElm_LowRSSIThresholdOptions;
   2767 
   2768     /* Set information element header */
   2769     pCfg->EleHdr.id = ACX_LOW_RSSI;
   2770     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
   2771 
   2772     pCfg->rssiFilterDepth   = pWlanElm_LowRSSIThresholdOptions->rssiFilterDepth;
   2773     pCfg->rssiFilterWeight = pWlanElm_LowRSSIThresholdOptions->rssiFilterWeight;
   2774     pCfg->rssiThreshold = pWlanElm_LowRSSIThresholdOptions->rssiThreshold;
   2775     pCfg->LowRSSIEventType  = pWlanElm_LowRSSIThresholdOptions->LowRSSIEventType;
   2776 
   2777     /* Send the configuration command */
   2778     return CmdQueue_CmdConfigure (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(*pCfg));
   2779 }
   2780 
   2781 
   2782 /****************************************************************************
   2783  *                      whal_hwInfoElemAcxSetMaxTxRetrySet()
   2784  ****************************************************************************
   2785  * DESCRIPTION: Configure the Max Tx Retry parameters
   2786  *
   2787  * INPUTS:  None
   2788  *
   2789  * OUTPUT:  None
   2790  *
   2791  * RETURNS: OK or NOK
   2792  ****************************************************************************/
   2793 int whal_hwInfoElemAcxSetMaxTxRetrySet (HwMboxConfig_T* pHwMboxConfig,
   2794                                         ACXConsTxFailureTriggerParameters_t* pWlanElm_SetMaxTxRetry)
   2795 {
   2796     ACXConsTxFailureTriggerParameters_t AcxElm_SetMaxTxRetry;
   2797     ACXConsTxFailureTriggerParameters_t* pCfg = &AcxElm_SetMaxTxRetry;
   2798 
   2799     /* Set information element header */
   2800     pCfg->EleHdr.id = ACX_CONS_TX_FAILURE;
   2801     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
   2802 
   2803     pCfg->maxTxRetry = pWlanElm_SetMaxTxRetry->maxTxRetry;
   2804 
   2805     /* Send the configuration command */
   2806     return CmdQueue_CmdConfigure (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(*pCfg));
   2807 }
   2808 
   2809 
   2810 /****************************************************************************
   2811  *                      whal_hwInfoElemAcxBssLossTsfThresholdSet()
   2812  ****************************************************************************
   2813  * DESCRIPTION: Configure the Bss Lost Timeout & TSF miss threshold
   2814  *
   2815  * INPUTS:  None
   2816  *
   2817  * OUTPUT:  None
   2818  *
   2819  * RETURNS: OK or NOK
   2820  ****************************************************************************/
   2821 int whal_hwInfoElemAcxBssLossTsfThresholdSet (HwMboxConfig_T* pHwMboxConfig,
   2822                                               AcxConnectionMonitorOptions* pWlanElm_BssLossTsfSynchronize)
   2823 {
   2824     AcxConnectionMonitorOptions AcxElm_SetBssLossTsfThreshold;
   2825     AcxConnectionMonitorOptions* pCfg = &AcxElm_SetBssLossTsfThreshold;
   2826 
   2827     /* Set information element header */
   2828     pCfg->EleHdr.id     = ACX_CONN_MONIT_PARAMS;
   2829     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
   2830 
   2831     pCfg->BSSLossTimeout        = pWlanElm_BssLossTsfSynchronize->BSSLossTimeout;
   2832     pCfg->TSFMissedThreshold    = pWlanElm_BssLossTsfSynchronize->TSFMissedThreshold;
   2833 
   2834     /* Send the configuration command */
   2835     return CmdQueue_CmdConfigure (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(*pCfg));
   2836 }
   2837 
   2838 
   2839 /****************************************************************************
   2840  *                      whal_hwInfoElemAcxGetAverageRSSIGet()
   2841  ****************************************************************************
   2842  * DESCRIPTION: Configure the Max Tx Retry parameters
   2843  *
   2844  * INPUTS:  None
   2845  *
   2846  * OUTPUT:  None
   2847  *
   2848  * RETURNS: OK or NOK
   2849  ****************************************************************************/
   2850 int whal_hwInfoElemAcxGetAverageRSSIGet (HwMboxConfig_T* pHwMboxConfig, INT8* averageRSSI)
   2851 {
   2852     int rc = OK;
   2853     ACXAvaregeRSSI_t AcxElm_GetAverageRSSI;
   2854     ACXAvaregeRSSI_t* pCfg = &AcxElm_GetAverageRSSI;
   2855 
   2856     /* Set information element header */
   2857     pCfg->EleHdr.id = ACX_AVERAGE_RSSI ;
   2858     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
   2859 
   2860     /* Not implemented */
   2861   #if 0
   2862     *averageRSSI = pCfg->avaregeRSSI;
   2863   #endif
   2864 
   2865     return rc;
   2866 }
   2867 
   2868 
   2869 /****************************************************************************
   2870  *                      whal_hwInfoElemTxRatePolicyConfigurationSet()
   2871  ****************************************************************************
   2872  * DESCRIPTION: Write the TxRateClass configuration
   2873  *
   2874  * INPUTS:
   2875  *
   2876  * OUTPUT:  None
   2877  *
   2878  * RETURNS: OK or NOK
   2879  ****************************************************************************/
   2880 int whal_hwInfoElemTxRatePolicyConfigurationSet (HwMboxConfig_T* pHwMboxConfig,
   2881                                          txRatePolicy_t *pTxRatePolicy)
   2882 {
   2883     ACXTxAttrClasses_t  TxClassCfg;
   2884     ACXTxAttrClasses_t *pCfg  = &TxClassCfg;
   2885     UINT8 PolicyId;
   2886 
   2887     os_memoryZero (pHwMboxConfig->hOs, (void *)pCfg, sizeof(*pCfg));
   2888 
   2889     /*
   2890      * Set information element header
   2891      * ==============================
   2892      */
   2893     pCfg->EleHdr.id = ACX_RATE_POLICY;
   2894     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
   2895     pCfg->numOfClasses = pTxRatePolicy->numOfRateClasses;
   2896 
   2897     for (PolicyId = 0; PolicyId < pTxRatePolicy->numOfRateClasses; PolicyId++)
   2898     {
   2899         os_memoryCopy (pHwMboxConfig->hOs,
   2900                        (void *)&(pCfg->rateClasses[PolicyId]),
   2901                        (void *)&(pTxRatePolicy->rateClass[PolicyId]),
   2902                        sizeof(txRateClass_t));
   2903     }
   2904 
   2905     return CmdQueue_CmdConfigure (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(*pCfg));
   2906 }
   2907 
   2908 
   2909 /****************************************************************************
   2910  *                      whal_hwInfoElemRtsThresholdSet()
   2911  ****************************************************************************
   2912  * DESCRIPTION: Configure The RTS threshold
   2913  *
   2914  * INPUTS:  None
   2915  *
   2916  * OUTPUT:  None
   2917  *
   2918  * RETURNS: OK or NOK
   2919  ****************************************************************************/
   2920 int whal_hwInfoElemRtsThresholdSet (HwMboxConfig_T* pHwMboxConfig,
   2921                                     UINT16 RtsThreshold)
   2922 {
   2923     dot11RTSThreshold_t AcxElm_RtsThreshold;
   2924     dot11RTSThreshold_t *pCfg = &AcxElm_RtsThreshold;
   2925 
   2926     /* Set information element header*/
   2927     pCfg->EleHdr.id = DOT11_RTS_THRESHOLD;
   2928     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
   2929 
   2930     pCfg->RTSThreshold = RtsThreshold;
   2931 
   2932     return CmdQueue_CmdConfigure (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(*pCfg));
   2933 }
   2934 
   2935 
   2936 /****************************************************************************
   2937  *                      whal_hwInfoElemCtsToSelfSet()
   2938  ****************************************************************************
   2939  * DESCRIPTION: Configure The Cts to self feature
   2940  *
   2941  * INPUTS:  None
   2942  *
   2943  * OUTPUT:  None
   2944  *
   2945  * RETURNS: OK or NOK
   2946  ****************************************************************************/
   2947 int whal_hwInfoElemCtsToSelfSet (HwMboxConfig_T* pHwMboxConfig, UINT8 CtsToSelf)
   2948 {
   2949     ACXCtsProtection_t AcxElm_CtsToSelf;
   2950     ACXCtsProtection_t *pCfg = &AcxElm_CtsToSelf;
   2951 
   2952     /* Set information element header*/
   2953     pCfg->EleHdr.id = ACX_CTS_PROTECTION;
   2954     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
   2955 
   2956     pCfg->ctsProtectMode = CtsToSelf;
   2957 
   2958     return CmdQueue_CmdConfigure (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(*pCfg));
   2959 }
   2960 
   2961 
   2962 /****************************************************************************
   2963  *                      whal_hwInfoElemRxMsduLifeTimeSet()
   2964  ****************************************************************************
   2965  * DESCRIPTION: Configure The Cts to self feature
   2966  *
   2967  * INPUTS:  None
   2968  *
   2969  * OUTPUT:  None
   2970  *
   2971  * RETURNS: OK or NOK
   2972  ****************************************************************************/
   2973 int whal_hwInfoElemRxMsduLifeTimeSet (HwMboxConfig_T* pHwMboxConfig, UINT32 RxMsduLifeTime)
   2974 {
   2975     dot11RxMsduLifeTime_t   AcxElm_RxMsduLifeTime;
   2976     dot11RxMsduLifeTime_t *pCfg = &AcxElm_RxMsduLifeTime;
   2977 
   2978     /* Set information element header*/
   2979     pCfg->EleHdr.id = DOT11_RX_MSDU_LIFE_TIME;
   2980     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
   2981     pCfg->RxMsduLifeTime = RxMsduLifeTime;
   2982 
   2983     WLAN_REPORT_INFORMATION(pHwMboxConfig->hReport, HAL_HW_CTRL_MODULE_LOG,
   2984         ("%s: RxMsduLifeTime = 0x%x, len = 0x%x\n",__FUNCTION__,pCfg->RxMsduLifeTime,pCfg->EleHdr.len));
   2985 
   2986     return CmdQueue_CmdConfigure (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(*pCfg));
   2987 }
   2988 
   2989 
   2990 /****************************************************************************
   2991  *                      whal_hwInfoElemRxTimeOutSet()
   2992  ****************************************************************************
   2993  * DESCRIPTION: Configure The Rx Time Out
   2994  *
   2995  * INPUTS:  None
   2996  *
   2997  * OUTPUT:  None
   2998  *
   2999  * RETURNS: OK or NOK
   3000  ****************************************************************************/
   3001 int whal_hwInfoElemRxTimeOutSet (HwMboxConfig_T* pHwMboxConfig, rxTimeOut_t* pRxTimeOut)
   3002 {
   3003     ACXRxTimeout_t AcxElm_rxTimeOut;
   3004     ACXRxTimeout_t *pCfg = &AcxElm_rxTimeOut;
   3005 
   3006     /* Set information element header*/
   3007     pCfg->EleHdr.id = ACX_SERVICE_PERIOD_TIMEOUT;
   3008     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
   3009 
   3010     pCfg->PsPollTimeout = pRxTimeOut->psPoll;
   3011     pCfg->UpsdTimeout   = pRxTimeOut->UPSD;
   3012 
   3013     return CmdQueue_CmdConfigure (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(*pCfg));
   3014 }
   3015 
   3016 /****************************************************************************
   3017  *                      whal_hwInfoElemWiFiWmmPSWASet()
   3018  ****************************************************************************
   3019  * DESCRIPTION: Configure The PS for WMM
   3020  *
   3021  * INPUTS:   TRUE  - Configure PS to work on WMM mode - do not send the NULL/PS_POLL
   3022  *                   packets even if TIM is set.
   3023  *           FALSE - Configure PS to work on Non-WMM mode - work according to the
   3024  *                   standard
   3025  *
   3026  * RETURNS: OK or NOK
   3027  ****************************************************************************/
   3028 int whal_hwInfoElemWiFiWmmPSWASet (HwMboxConfig_T* pHwMboxConfig, BOOL enableWA)
   3029 {
   3030     IEConfigPsWmm_t  ConfigPsWmm;
   3031     IEConfigPsWmm_t *pCfg = &ConfigPsWmm;
   3032 
   3033     /*
   3034      * Set information element header
   3035      */
   3036     pCfg->EleHdr.id = ACX_CONFIG_PS_WMM;
   3037     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
   3038 
   3039     pCfg->ConfigPsOnWmmMode = enableWA;
   3040 
   3041     /* Report the meesage only if we are using the WiFi patch */
   3042     if (enableWA)
   3043     {
   3044         WLAN_OS_REPORT(("%s PS is on WMM mode\n",__FUNCTION__));
   3045     }
   3046 
   3047     return CmdQueue_CmdConfigure (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(*pCfg));
   3048 }
   3049