Home | History | Annotate | Download | only in Ctrl
      1 /*
      2  * CmdBldItrIE.c
      3  *
      4  * Copyright(c) 1998 - 2009 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 #define __FILE_ID__  FILE_ID_96
     35 #include "osApi.h"
     36 #include "report.h"
     37 #include "CmdBld.h"
     38 #include "CmdQueue_api.h"
     39 
     40 
     41 TI_STATUS cmdBld_ItrIeMemoryMap (TI_HANDLE hCmdBld, MemoryMap_t *apMap, void *fCb, TI_HANDLE hCb)
     42 {
     43     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
     44 
     45     /* Set information element header */
     46     apMap->EleHdr.id  = ACX_MEM_MAP;
     47     apMap->EleHdr.len = sizeof(*apMap) - sizeof(EleHdrStruct);
     48 
     49     return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_INTERROGATE, apMap, sizeof(*apMap), fCb, hCb, apMap);
     50 }
     51 
     52 
     53 /****************************************************************************
     54  *                      cmdBld_ItrIeRoamimgStatisitics ()
     55  ****************************************************************************
     56  * DESCRIPTION: Get the ACX GWSI statistics
     57  *
     58  * INPUTS:
     59  *
     60  * OUTPUT:  None
     61  *
     62  * RETURNS: TI_OK or TI_NOK
     63  ****************************************************************************/
     64 TI_STATUS cmdBld_ItrIeRoamimgStatisitics (TI_HANDLE  hCmdBld, void *fCb, TI_HANDLE hCb, void *pCb)
     65 {
     66     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
     67     ACXRoamingStatisticsTable_t acx;
     68     ACXRoamingStatisticsTable_t * pCfg = &acx;
     69 
     70     /*
     71      * Set information element header
     72      */
     73     pCfg->EleHdr.id  = ACX_ROAMING_STATISTICS_TBL;
     74     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
     75 
     76 
     77     return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_INTERROGATE, pCfg, sizeof(*pCfg), fCb, hCb, pCb);
     78 }
     79 
     80 
     81 /****************************************************************************
     82  *                      cmdBld_ItrIeErrorCnt ()
     83  ****************************************************************************
     84  * DESCRIPTION: Get the ACX GWSI counters
     85  *
     86  * INPUTS:
     87  *
     88  * OUTPUT:  None
     89  *
     90  * RETURNS: TI_OK or TI_NOK
     91  ****************************************************************************/
     92 TI_STATUS cmdBld_ItrIeErrorCnt (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb, void *pCb)
     93 {
     94     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
     95     ACXErrorCounters_t acx;
     96     ACXErrorCounters_t * pCfg = &acx;
     97 
     98     /*
     99      * Set information element header
    100      */
    101     pCfg->EleHdr.id  = ACX_ERROR_CNT;
    102     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
    103 
    104 
    105     return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_INTERROGATE, pCfg, sizeof(*pCfg), fCb, hCb, pCb);
    106 }
    107 
    108 
    109 /****************************************************************************
    110  *                      cmdBld_ItrIeRSSI ()
    111  ****************************************************************************
    112  * DESCRIPTION: Configure/Interrogate StationId information element to/from
    113  *      the wlan hardware.
    114  *      This information element specifies the MAC Address assigned to the
    115  *      STATION or AP.
    116  *      This default value is the permanent MAC address that is stored in the
    117  *      adaptor's non-volatile memory.
    118  *
    119  * INPUTS:  None
    120  *
    121  * OUTPUT:  None
    122  *
    123  * RETURNS: TI_OK or TI_NOK
    124  ****************************************************************************/
    125 TI_STATUS cmdBld_ItrIeRSSI (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb, TI_UINT8* pCb)
    126 {
    127     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
    128     ACXRoamingStatisticsTable_t AcxElm_GetAverageRSSI;
    129     ACXRoamingStatisticsTable_t* pCfg = &AcxElm_GetAverageRSSI;
    130 
    131     /* Set information element header */
    132     pCfg->EleHdr.id = ACX_ROAMING_STATISTICS_TBL;
    133     pCfg->EleHdr.len = sizeof(ACXRoamingStatisticsTable_t) - sizeof(EleHdrStruct);
    134 
    135 
    136     return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_INTERROGATE, pCfg, sizeof(ACXRoamingStatisticsTable_t), fCb, hCb, pCb);
    137 }
    138 
    139 
    140 /****************************************************************************
    141  *                      cmdBld_ItrIeSg()
    142  ****************************************************************************
    143  * DESCRIPTION: Get the BTH-WLAN co-exsistance parameters from the Fw
    144  *
    145  *
    146  * OUTPUT:  None
    147  *
    148  * RETURNS: TI_OK or TI_NOK
    149  ****************************************************************************/
    150 TI_STATUS cmdBld_ItrIeSg (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb, void* pCb)
    151 {
    152     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
    153     ACXBluetoothWlanCoParamsStruct  AcxElm_BluetoothWlanEnable;
    154     ACXBluetoothWlanCoParamsStruct* pCfg = &AcxElm_BluetoothWlanEnable;
    155 
    156     TRACE0(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "cmdBld_ItrIeSg \n");
    157 
    158     /* Set information element header */
    159     pCfg->EleHdr.id = ACX_SG_CFG;
    160     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
    161 
    162    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_INTERROGATE, pCfg, sizeof(ACXBluetoothWlanCoParamsStruct), fCb, hCb, pCb);
    163 }
    164 /****************************************************************************
    165  *                      cmdBld_ItrIeRateParams()
    166  ****************************************************************************
    167  * DESCRIPTION: Get the rate managment configuration
    168  *
    169  *
    170  * OUTPUT:  None
    171  *
    172  * RETURNS: TI_OK or TI_NOK
    173  ****************************************************************************/
    174 
    175 TI_STATUS cmdBld_ItrIeRateParams (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb, void* pCb)
    176 {
    177     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
    178 	AcxRateMangeParams  RateParams;
    179     AcxRateMangeParams* pCfg = &RateParams;
    180 
    181     TRACE0(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "cmdBld_ItrIeRateParams \n");
    182 
    183     /* Set information element header */
    184     pCfg->EleHdr.id = ACX_GET_RATE_MAMAGEMENT_PARAMS;
    185     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
    186 
    187     return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_INTERROGATE, pCfg, sizeof(AcxRateMangeParams), fCb, hCb, pCb);
    188 }
    189 
    190 /****************************************************************************
    191  *                      cmdBld_ItrIePowerConsumptionstat()
    192  ****************************************************************************
    193  * DESCRIPTION: Get the Power consumption statistic from the Fw
    194  *
    195  *
    196  * OUTPUT:  None
    197  *
    198  * RETURNS: TI_OK or TI_NOK
    199  ****************************************************************************/
    200 TI_STATUS cmdBld_ItrIePowerConsumptionstat(TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb, void* pCb)
    201 {
    202     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
    203     ACXPowerConsumptionTimeStat_t  AcxPowerConsumptionStat;
    204     ACXPowerConsumptionTimeStat_t* pCfg = &AcxPowerConsumptionStat;
    205 
    206     TRACE0(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "cmdBld_ItrIePowerConsumptionstat \n");
    207 
    208     /* Set information element header */
    209     pCfg->EleHdr.id = ACX_PWR_CONSUMPTION_STATISTICS;
    210     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
    211 
    212     return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_INTERROGATE, pCfg, sizeof(AcxPowerConsumptionStat), fCb, hCb, pCb);
    213 
    214 }
    215 
    216 
    217 
    218 /****************************************************************************
    219  *                      cmdBld_ItrIeStatistics ()
    220  ****************************************************************************
    221  * DESCRIPTION: Print the statistics from the input IE statistics
    222  *
    223  * INPUTS:
    224  *          ACXStatisticsStruct* pElem  The Statistics information element
    225  *                                      to be printed
    226  *
    227  * OUTPUT:  None
    228  *
    229  * RETURNS: TI_OK or TI_NOK
    230  ****************************************************************************/
    231 TI_STATUS cmdBld_ItrIeStatistics (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb, void *pCb)
    232 {
    233     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
    234     ACXStatistics_t *pACXStatistics = (ACXStatistics_t *)pCb;
    235 
    236     /* Set information element header */
    237     pACXStatistics->EleHdr.id  = ACX_STATISTICS;
    238     pACXStatistics->EleHdr.len = sizeof(*pACXStatistics) - sizeof(EleHdrStruct);
    239 
    240     return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_INTERROGATE, pCb, sizeof(*pACXStatistics), fCb, hCb, pCb);
    241 }
    242 
    243 
    244 /****************************************************************************
    245  *                      cmdBld_ItrIeMediumOccupancy ()
    246  ****************************************************************************
    247  * DESCRIPTION: Get the Medium Occupancy.
    248  *
    249  * INPUTS:
    250  *
    251  * OUTPUT:  None
    252  *
    253  * RETURNS: TI_OK or TI_NOK
    254  ****************************************************************************/
    255 TI_STATUS cmdBld_ItrIeMediumOccupancy (TI_HANDLE hCmdBld,
    256                                        TInterrogateCmdCbParams  mediumUsageCBParams)
    257 {
    258     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
    259     ACXMediumUsage_t    medium;
    260     ACXMediumUsage_t    *pCfg = &medium;
    261 
    262     /* Set information element header */
    263     pCfg->EleHdr.id  = ACX_MEDIUM_USAGE;
    264     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
    265 
    266     return cmdQueue_SendCommand (pCmdBld->hCmdQueue,
    267                                  CMD_INTERROGATE,
    268                                  pCfg,
    269                                  sizeof(*pCfg),
    270                                  mediumUsageCBParams.fCb,
    271                                  mediumUsageCBParams.hCb,
    272                                  mediumUsageCBParams.pCb);
    273 }
    274 
    275 
    276 /****************************************************************************
    277  *                      cmdBld_ItrIeTfsDtim ()
    278  ****************************************************************************
    279  * DESCRIPTION: Get the Tsf and Dtim counter from Fw
    280  *
    281  * INPUTS:
    282  *
    283  * OUTPUT:  None
    284  *
    285  * RETURNS: TI_OK or TI_NOK
    286  ****************************************************************************/
    287 TI_STATUS cmdBld_ItrIeTfsDtim (TI_HANDLE hCmdBld,
    288                                TInterrogateCmdCbParams  mediumUsageCBParams)
    289 {
    290     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
    291     ACX_fwTSFInformation_t    fwTsfDtimMib;
    292     ACX_fwTSFInformation_t    *pCfg = &fwTsfDtimMib;
    293 
    294     /* Set information element header*/
    295     pCfg->EleHdr.id  = ACX_TSF_INFO;
    296     pCfg->EleHdr.len = sizeof(ACX_fwTSFInformation_t) - sizeof(EleHdrStruct);
    297 
    298     return cmdQueue_SendCommand (pCmdBld->hCmdQueue,
    299                                  CMD_INTERROGATE,
    300                                  pCfg,
    301                                  sizeof(*pCfg),
    302                                  mediumUsageCBParams.fCb,
    303                                  mediumUsageCBParams.hCb,
    304                                  mediumUsageCBParams.pCb);
    305 }
    306 
    307 
    308 /****************************************************************************
    309  *                      cmdBld_ItrIeNoiseHistogramResults()
    310  ****************************************************************************
    311  * DESCRIPTION: Get the Noise Histogram Measurement Results.
    312  *
    313  * INPUTS:
    314  *
    315  * OUTPUT:  None
    316  *
    317  * RETURNS: TI_OK or TI_NOK
    318  ****************************************************************************/
    319 TI_STATUS cmdBld_ItrIeNoiseHistogramResults (TI_HANDLE hCmdBld,
    320                                              TInterrogateCmdCbParams noiseHistCBParams)
    321 {
    322     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
    323     NoiseHistResult_t   results;
    324     NoiseHistResult_t   *pCfg = &results;
    325 
    326     /* Set information element header*/
    327     pCfg->EleHdr.id  = ACX_NOISE_HIST;
    328     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
    329 
    330     return cmdQueue_SendCommand (pCmdBld->hCmdQueue,
    331                                  CMD_INTERROGATE,
    332                                  pCfg,
    333                                  sizeof(*pCfg),
    334                                  noiseHistCBParams.fCb,
    335                                  noiseHistCBParams.hCb,
    336                                  noiseHistCBParams.pCb);
    337 }
    338 
    339 /****************************************************************************
    340  *                      cmdBld_ItrIeDataFilterStatistics()
    341  ****************************************************************************
    342  * DESCRIPTION: Get the ACX GWSI counters
    343  *
    344  * INPUTS:
    345  *
    346  * OUTPUT:  None
    347  *
    348  * RETURNS: TI_OK or TI_NOK
    349  ****************************************************************************/
    350 TI_STATUS cmdBld_ItrIeDataFilterStatistics (TI_HANDLE  hCmdBld,
    351                                             void      *fCb,
    352                                             TI_HANDLE  hCb,
    353                                             void      *pCb)
    354 {
    355 	TCmdBld       *pCmdBld = (TCmdBld *)hCmdBld;
    356     ACXDataFilteringStatistics_t acx;
    357     ACXDataFilteringStatistics_t * pCfg = &acx;
    358 
    359     /* Set information element header */
    360     pCfg->EleHdr.id  = ACX_GET_DATA_FILTER_STATISTICS;
    361     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
    362 
    363     TRACE_INFO_HEX(pCmdBld->hReport, (TI_UINT8 *) pCfg, sizeof(ACXDataFilteringStatistics_t));
    364 
    365     /* Send the interrogation command */
    366     return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_INTERROGATE, pCfg, sizeof(*pCfg), fCb, hCb, pCb);
    367 }
    368 
    369 
    370