1/*
2 * CmdBldCfgIE.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
35/** \file  CmdBldCfgIE.c
36 *  \brief Command builder. Configuration commands information elements
37 *
38 *  \see   CmdBld.h
39 */
40#define __FILE_ID__  FILE_ID_92
41#include "osApi.h"
42#include "report.h"
43#include "CmdBld.h"
44#include "CmdQueue_api.h"
45#include "rate.h"
46#include "TwIf.h"
47
48/****************************************************************************
49 *                      cmdBld_CfgIeConfigMemory()
50 ****************************************************************************
51 * DESCRIPTION: Configure wlan hardware memory
52 *
53 * INPUTS:
54 *
55 * OUTPUT:  None
56 *
57 * RETURNS: TI_OK or TI_NOK
58 ****************************************************************************/
59TI_STATUS cmdBld_CfgIeConfigMemory (TI_HANDLE hCmdBld, TDmaParams *pDmaParams, void *fCb, TI_HANDLE hCb)
60{
61    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
62    ACXConfigMemory_t AcxElm_ConfigMemory;
63    ACXConfigMemory_t *pCfg = &AcxElm_ConfigMemory;
64
65    os_memoryZero(pCmdBld->hOs, (void *)pCfg, sizeof(*pCfg));
66
67    /*
68     * Set information element header
69     */
70    pCfg->EleHdr.id = ACX_MEM_CFG;
71    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
72
73    /*
74     * Set configuration fields
75     */
76    pCfg->numStations             = pDmaParams->NumStations;
77    pCfg->rxMemblockNumber        = TWD_RX_MEM_BLKS_NUM;
78    pCfg->txMinimumMemblockNumber = TWD_TX_MIN_MEM_BLKS_NUM;
79    pCfg->numSsidProfiles         = 1;
80    pCfg->totalTxDescriptors      = ENDIAN_HANDLE_LONG(NUM_TX_DESCRIPTORS);
81
82    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
83}
84
85
86/* WoneIndex value when running as station */
87#define STATION_WONE_INDEX                  0
88
89
90/****************************************************************************
91 *                      cmdBld_CfgIeSlotTime()
92 ****************************************************************************
93 * DESCRIPTION: Configure/Interrogate the Slot Time
94 *
95 * INPUTS:  None
96 *
97 * OUTPUT:  None
98 *
99 * RETURNS: TI_OK or TI_NOK
100 ****************************************************************************/
101TI_STATUS cmdBld_CfgIeSlotTime (TI_HANDLE hCmdBld, TI_UINT8 apSlotTime, void *fCb, TI_HANDLE hCb)
102{
103    TCmdBld    *pCmdBld = (TCmdBld *)hCmdBld;
104    ACXSlot_t   AcxElm_SlotTime;
105    ACXSlot_t   *pCfg = &AcxElm_SlotTime;
106
107    /* Set information element header */
108    pCfg->EleHdr.id = ACX_SLOT;
109    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
110
111    /* Set configuration fields */
112    /* woneIndex is not relevant to station implementation */
113    pCfg->woneIndex = STATION_WONE_INDEX;
114    pCfg->slotTime = apSlotTime;
115
116    TRACE1(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, ": Sending info elem to firmware, Slot Time = %d\n", (TI_UINT8)pCfg->slotTime);
117
118    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
119}
120
121
122/****************************************************************************
123 *                      cmdBld_CfgIePreamble()
124 ****************************************************************************
125 * DESCRIPTION: Configure/Interrogate the Preamble
126 *
127 * INPUTS:  None
128 *
129 * OUTPUT:  None
130 *
131 * RETURNS: TI_OK or TI_NOK
132 ****************************************************************************/
133TI_STATUS cmdBld_CfgIePreamble (TI_HANDLE hCmdBld, TI_UINT8 preamble, void *fCb, TI_HANDLE hCb)
134{
135    TCmdBld        *pCmdBld = (TCmdBld *)hCmdBld;
136    ACXPreamble_t   AcxElm_Preamble;
137    ACXPreamble_t   *pCfg = &AcxElm_Preamble;
138
139    /* Set information element header */
140    pCfg->EleHdr.id = ACX_PREAMBLE_TYPE;
141    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
142
143    /* Set configuration fields */
144    /* woneIndex is not relevant to station implementation */
145    pCfg->preamble = preamble;
146
147    TRACE2(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "ID=%u: preamble=%u\n", pCfg->EleHdr.id, preamble);
148
149    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
150}
151
152
153/****************************************************************************
154 *                      cmdBld_CfgIeRx()
155 ****************************************************************************
156 * DESCRIPTION: Configure/Interrogate RxConfig information element
157 *
158 * INPUTS:  None
159 *
160 * OUTPUT:  None
161 *
162 * RETURNS: TI_OK or TI_NOK
163 ****************************************************************************/
164TI_STATUS cmdBld_CfgIeRx (TI_HANDLE hCmdBld, TI_UINT32 apRxConfigOption, TI_UINT32 apRxFilterOption, void *fCb, TI_HANDLE hCb)
165{
166    TCmdBld       *pCmdBld = (TCmdBld *)hCmdBld;
167    ACXRxConfig_t   AcxElm_RxConfig;
168    ACXRxConfig_t  *pCfg = &AcxElm_RxConfig;
169
170    /* Set information element header */
171    pCfg->EleHdr.id = ACX_RX_CFG;
172    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
173
174    /* Set configuration fields */
175    pCfg->ConfigOptions = ENDIAN_HANDLE_LONG(apRxConfigOption);
176    pCfg->FilterOptions = ENDIAN_HANDLE_LONG(apRxFilterOption);
177
178    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
179}
180
181/****************************************************************************
182*                 cmdBld_CfgIeEnableRxDataFilter()
183*****************************************************************************
184* DESCRIPTION: Enables or disables Rx data filtering.
185*
186* INPUTS:  enabled             - 0 to disable data filtering, any other value to enable
187*          defaultAction       - The default action to take on non-matching packets.
188*
189* OUTPUT:  None
190*
191* RETURNS: TI_OK or TI_NOK
192****************************************************************************/
193TI_STATUS cmdBld_CfgIeEnableRxDataFilter (TI_HANDLE hCmdBld, TI_BOOL enabled, filter_e defaultAction, void *fCb, TI_HANDLE hCb)
194{
195    TCmdBld       *pCmdBld = (TCmdBld *)hCmdBld;
196    DataFilterDefault_t dataFilterDefault;
197    DataFilterDefault_t * pCfg = &dataFilterDefault;
198
199    /* Set information element header */
200    pCfg->EleHdr.id = ACX_ENABLE_RX_DATA_FILTER;
201    pCfg->EleHdr.len = 0;
202
203    TRACE0(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, ": Rx Data Filter configuration:\n");
204    TRACE2(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, ": enabled = %d, defaultAction = %d\n", enabled, defaultAction);
205
206    /* Set information element configuration fields */
207    pCfg->enable = enabled;
208    pCfg->action = defaultAction;
209    pCfg->EleHdr.len += sizeof(pCfg->enable) + sizeof(pCfg->action);
210
211    TRACE_INFO_HEX(pCmdBld->hReport, (TI_UINT8 *) pCfg, sizeof(dataFilterDefault));
212
213    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
214}
215
216/****************************************************************************
217*                      cmdBld_CfgIeRxDataFilter()
218*****************************************************************************
219* DESCRIPTION: Add/remove Rx Data filter information element.
220*
221* INPUTS:  index               - Index of the Rx Data filter
222*          command             - Add or remove the filter
223*          action              - Action to take on packets matching the pattern
224*          numFieldPatterns    - Number of field patterns in the filter
225*          lenFieldPatterns    - Length of the field pattern series
226*          fieldPatterns       - Series of field patterns
227*
228* OUTPUT:  None
229*
230* RETURNS: TI_OK or TI_NOK
231****************************************************************************/
232TI_STATUS cmdBld_CfgIeRxDataFilter (TI_HANDLE hCmdBld,
233                                    TI_UINT8 index,
234                                    TI_UINT8 command,
235                                    filter_e action,
236                                    TI_UINT8 numFieldPatterns,
237                                    TI_UINT8 lenFieldPatterns,
238                                    TI_UINT8 *pFieldPatterns,
239                                    void *fCb,
240                                    TI_HANDLE hCb)
241{
242    TCmdBld       *pCmdBld = (TCmdBld *)hCmdBld;
243    TI_UINT8 dataFilterConfig[sizeof(DataFilterConfig_t) + MAX_DATA_FILTER_SIZE];
244    DataFilterConfig_t * pCfg = (DataFilterConfig_t *) &dataFilterConfig;
245
246    /* Set information element header */
247    pCfg->EleHdr.id = ACX_SET_RX_DATA_FILTER;
248    pCfg->EleHdr.len = 0;
249
250    TRACE0(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, ": Rx Data Filter configuration:\n");
251    TRACE5(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, ": command = %d, index = %d, action = %d, numFieldPatterns = %d, lenFieldPatterns = %d\n", command, index, action, numFieldPatterns, lenFieldPatterns);
252
253    /* Set information element configuration fields */
254    pCfg->command = command;
255    pCfg->index = index;
256    pCfg->EleHdr.len += sizeof(pCfg->command) + sizeof(pCfg->index);
257
258    /* When removing a filter only the index and command are to be sent */
259    if (command == ADD_FILTER)
260    {
261        pCfg->action = action;
262        pCfg->numOfFields = numFieldPatterns;
263        pCfg->EleHdr.len += sizeof(pCfg->action) + sizeof(pCfg->numOfFields);
264
265        if (pFieldPatterns == NULL)
266        {
267            TRACE0(pCmdBld->hReport, REPORT_SEVERITY_ERROR, ": Null pattern table argument received!\n");
268
269            return PARAM_VALUE_NOT_VALID;
270        }
271
272        os_memoryCopy(pCmdBld->hOs, &pCfg->FPTable, pFieldPatterns, lenFieldPatterns);
273        pCfg->EleHdr.len += lenFieldPatterns;
274    }
275
276    TRACE_INFO_HEX(pCmdBld->hReport, (TI_UINT8 *) pCfg, sizeof(dataFilterConfig));
277
278    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(dataFilterConfig), fCb, hCb, NULL);
279}
280
281/****************************************************************************
282 *                      cmdBld_CfgIeArpIpFilter()
283 ****************************************************************************
284 * DESCRIPTION: Configure/Interrogate ARP addr table information element for
285 *              ipV4 only
286 *
287 * INPUTS:  None
288 *
289 * OUTPUT:  None
290 *
291 * RETURNS: TI_OK or TI_NOK
292 ****************************************************************************/
293TI_STATUS cmdBld_CfgIeArpIpFilter (TI_HANDLE hCmdBld,
294                                   TIpAddr   tIpAddr,
295                                   TI_BOOL   bFilteringEnabled,
296                                   void      *fCb,
297                                   TI_HANDLE hCb)
298{
299    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
300    ACXConfigureIP_t AcxElm_CmdConfigureIP;
301    ACXConfigureIP_t *pCfg = &AcxElm_CmdConfigureIP;
302
303    /* Set information element header */
304    pCfg->EleHdr.id = ACX_ARP_IP_FILTER;
305    pCfg->EleHdr.len = sizeof(ACXConfigureIP_t) - sizeof(EleHdrStruct);
306
307    pCfg->arpFilterEnable = (TI_UINT32)bFilteringEnabled;
308
309    /* IP address */
310    /* Note that in the case of IPv4 it is assumed that the extra two bytes are zero */
311    IP_COPY (pCfg->address, tIpAddr);
312
313    TRACE3(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "ID=%u: ip=%x, enable=%u\n", pCfg->EleHdr.id, *((TI_UINT32*)pCfg->address), bFilteringEnabled);
314
315    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(ACXConfigureIP_t), fCb, hCb, NULL);
316}
317
318
319/****************************************************************************
320 *                      cmdBld_CfgIeGroupAdressTable()
321 ****************************************************************************
322 * DESCRIPTION: Configure/Interrogate Group addr table information element
323 *
324 * INPUTS:  None
325 *
326 * OUTPUT:  None
327 *
328 * RETURNS: TI_OK or TI_NOK
329 ****************************************************************************/
330TI_STATUS cmdBld_CfgIeGroupAdressTable (TI_HANDLE       hCmdBld,
331                                        TI_UINT8        numGroupAddrs,
332                                        TMacAddr        *pGroupAddr,
333                                        TI_BOOL         bEnabled,
334                                        void            *fCb,
335                                        TI_HANDLE       hCb)
336{
337    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
338    TI_UINT32   i = 0;
339    TI_UINT8   *tmpLoc = NULL;
340    dot11MulticastGroupAddrStart_t  AcxElm_CmdConfigureMulticastIp;
341    dot11MulticastGroupAddrStart_t* pCfg = &AcxElm_CmdConfigureMulticastIp;
342
343    os_memoryZero (pCmdBld->hOs, (void *)pCfg, sizeof(dot11MulticastGroupAddrStart_t));
344
345    /* Set information element header */
346    pCfg->EleHdr.id = DOT11_GROUP_ADDRESS_TBL;
347    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
348
349    pCfg->numOfGroups = numGroupAddrs;
350    pCfg->fltrState = bEnabled;
351    tmpLoc = pCfg->dataLocation;
352
353    if (NULL != pGroupAddr)
354    {
355        for (i = 0; i < numGroupAddrs; i++)
356        {
357            MAC_COPY (&tmpLoc[MAC_ADDR_LEN * i], *(pGroupAddr + i));
358
359            TRACE7(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "cmdBld_CfgIeGroupAdressTable: MAC %x: %x:%x:%x:%x:%x:%x\n", i, tmpLoc[MAC_ADDR_LEN*i+0] , tmpLoc[MAC_ADDR_LEN*i+1] , tmpLoc[MAC_ADDR_LEN*i+2] , tmpLoc[MAC_ADDR_LEN*i+3] , tmpLoc[MAC_ADDR_LEN*i+4] , tmpLoc[MAC_ADDR_LEN*i+5]);
360        }
361    }
362
363    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(dot11MulticastGroupAddrStart_t), fCb, hCb, NULL);
364
365}
366
367
368/****************************************************************************
369 *                      cmdBld_CfgIeSgEnable()
370 ****************************************************************************
371 * DESCRIPTION: Enable/Disable the BTH-WLAN
372 *
373 * INPUTS:  Enable flag
374 *
375 * OUTPUT:  None
376 *
377 * RETURNS: TI_OK or TI_NOK
378 ****************************************************************************/
379TI_STATUS cmdBld_CfgIeSgEnable (TI_HANDLE hCmdBld, ESoftGeminiEnableModes SoftGeminiEnableModes, void *fCb, TI_HANDLE hCb)
380{
381    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
382    ACXBluetoothWlanCoEnableStruct  AcxElm_BluetoothWlanEnable;
383    ACXBluetoothWlanCoEnableStruct* pCfg = &AcxElm_BluetoothWlanEnable;
384
385    TRACE1(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "cmdBld_CfgIeSgEnable: Enable flag = %d\n", SoftGeminiEnableModes);
386
387    /* Set information element header */
388    pCfg->EleHdr.id = ACX_SG_ENABLE;
389    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
390
391    /* Set enable field */
392    pCfg->coexOperationMode = (TI_UINT8)SoftGeminiEnableModes;
393
394    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
395}
396
397
398/****************************************************************************
399 *                      cmdBld_CfgIeSg()
400 ****************************************************************************
401 * DESCRIPTION: Configure the BTH-WLAN co-exsistance
402 *
403 * INPUTS:  Configuration structure pointer
404 *
405 * OUTPUT:  None
406 *
407 * RETURNS: TI_OK or TI_NOK
408 ****************************************************************************/
409TI_STATUS cmdBld_CfgIeSg (TI_HANDLE hCmdBld, TSoftGeminiParams *pSoftGeminiParam, void *fCb, TI_HANDLE hCb)
410{
411    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
412    ACXBluetoothWlanCoParamsStruct  AcxElm_BluetoothWlanEnable;
413    ACXBluetoothWlanCoParamsStruct *pCfg = &AcxElm_BluetoothWlanEnable;
414	int i=0;
415
416    TRACE0(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "cmdBld_CfgIeSg. \n");
417
418    /* Set information element header */
419    pCfg->EleHdr.id      		= ACX_SG_CFG;
420    pCfg->EleHdr.len     		= sizeof(*pCfg) - sizeof(EleHdrStruct);
421
422	pCfg->softGeminiParams.paramIdx = pSoftGeminiParam->paramIdx;
423
424
425	for (i=0; i< SOFT_GEMINI_PARAMS_MAX ; i++)
426	{
427		pCfg->softGeminiParams.coexParams[i] = pSoftGeminiParam->coexParams[i];
428	}
429
430    /* Rate conversion is done in the HAL */
431    pCfg->softGeminiParams.coexParams[SOFT_GEMINI_RATE_ADAPT_THRESH] = rateNumberToBitmap((TI_UINT8)pSoftGeminiParam->coexParams[SOFT_GEMINI_RATE_ADAPT_THRESH]);
432
433	if (pCfg->softGeminiParams.coexParams[SOFT_GEMINI_RATE_ADAPT_THRESH] == 0)
434    {
435        TRACE0(pCmdBld->hReport, REPORT_SEVERITY_ERROR, "coexAPRateAdapationThr is 0, convert to 1MBPS. \n");
436        pCfg->softGeminiParams.coexParams[SOFT_GEMINI_RATE_ADAPT_THRESH] = HW_BIT_RATE_1MBPS;
437    }
438
439    /* Send the configuration command */
440    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
441}
442
443
444/****************************************************************************
445 *                      cmdBld_CfgIeFmCoex()
446 ****************************************************************************
447 * DESCRIPTION: Configure the FM-WLAN co-exsistance parameters
448 *
449 * INPUTS:  Configuration structure pointer
450 *
451 * OUTPUT:  None
452 *
453 * RETURNS: TI_OK or TI_NOK
454 ****************************************************************************/
455TI_STATUS cmdBld_CfgIeFmCoex (TI_HANDLE hCmdBld, TFmCoexParams *pFmCoexParams, void *fCb, TI_HANDLE hCb)
456{
457    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
458    ACXWlanFmCoexStruct  tFmWlanCoex;
459    ACXWlanFmCoexStruct *pCfg = &tFmWlanCoex;
460
461    TRACE0(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "cmdBld_CfgIeFmCoex\n");
462
463    /* Set information element header */
464    pCfg->EleHdr.id  = ACX_FM_COEX_CFG;
465    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
466
467    /* Set parameters with endianess handling */
468    pCfg->enable                   = pFmCoexParams->uEnable;
469    pCfg->swallowPeriod            = pFmCoexParams->uSwallowPeriod;
470    pCfg->nDividerFrefSet1         = pFmCoexParams->uNDividerFrefSet1;
471    pCfg->nDividerFrefSet2         = pFmCoexParams->uNDividerFrefSet2;
472    pCfg->mDividerFrefSet1         = ENDIAN_HANDLE_WORD(pFmCoexParams->uMDividerFrefSet1);
473    pCfg->mDividerFrefSet2         = ENDIAN_HANDLE_WORD(pFmCoexParams->uMDividerFrefSet2);
474    pCfg->coexPllStabilizationTime = ENDIAN_HANDLE_LONG(pFmCoexParams->uCoexPllStabilizationTime);
475    pCfg->ldoStabilizationTime     = ENDIAN_HANDLE_WORD(pFmCoexParams->uLdoStabilizationTime);
476    pCfg->fmDisturbedBandMargin    = pFmCoexParams->uFmDisturbedBandMargin;
477    pCfg->swallowClkDif            = pFmCoexParams->uSwallowClkDif;
478
479    /* Send the configuration command */
480    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
481}
482
483
484/****************************************************************************
485 *                      cmdBld_CfgIeMemoryMap ()
486 ****************************************************************************
487 * DESCRIPTION: Configure/Interrogate MemoryMap information element
488 *
489 * INPUTS:
490 *      AcxElm_MemoryMap_T *apMap   pointer to the memory map structure
491 *
492 * OUTPUT:  None
493 *
494 * RETURNS: TI_OK or TI_NOK
495 ****************************************************************************/
496TI_STATUS cmdBld_CfgIeMemoryMap (TI_HANDLE hCmdBld, MemoryMap_t *apMap, void *fCb, TI_HANDLE hCb)
497{
498    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
499    MemoryMap_t SwapMap;
500    TI_UINT32 *pSwap, *pOrig, i, uMemMapNumFields;
501
502    /* Set information element header */
503    SwapMap.EleHdr.id  = ACX_MEM_MAP;
504    SwapMap.EleHdr.len = sizeof(MemoryMap_t) - sizeof(EleHdrStruct);
505
506    /* Solve endian problem (all fields are 32 bit) */
507    pOrig = (TI_UINT32* )&apMap->codeStart;
508    pSwap = (TI_UINT32* )&SwapMap.codeStart;
509    uMemMapNumFields = (sizeof(MemoryMap_t) - sizeof(EleHdrStruct)) % 4;
510    for (i = 0; i < uMemMapNumFields; i++)
511        pSwap[i] = ENDIAN_HANDLE_LONG(pOrig[i]);
512
513    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, &SwapMap, sizeof(SwapMap), fCb, hCb, NULL);
514}
515
516
517/****************************************************************************
518 *                      cmdBld_CfgIeAid()
519 ****************************************************************************
520 * DESCRIPTION: Configure/Interrogate the AID info element
521 *
522 * INPUTS:
523 *      TI_UINT16* apAidVal     The AID value
524 *
525 * OUTPUT:  None
526 *
527 * RETURNS: TI_OK or TI_NOK
528 ****************************************************************************/
529TI_STATUS cmdBld_CfgIeAid (TI_HANDLE hCmdBld, TI_UINT16 apAidVal, void *fCb, TI_HANDLE hCb)
530{
531    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
532    ACXAid_t    WlanElm_AID;
533    ACXAid_t    *pCfg = &WlanElm_AID;
534
535    /* Set information element header */
536    pCfg->EleHdr.id = ACX_AID;
537    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
538
539    pCfg->Aid = ENDIAN_HANDLE_WORD(apAidVal);
540
541    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
542}
543
544
545/****************************************************************************
546 *                      cmdBld_CfgIeWakeUpCondition()
547 ****************************************************************************
548 * DESCRIPTION: Configure/Interrogate the power management option
549 *
550 * INPUTS:
551 *
552 * OUTPUT:  None
553 *
554 * RETURNS: TI_OK or TI_NOK
555 ****************************************************************************/
556TI_STATUS cmdBld_CfgIeWakeUpCondition (TI_HANDLE hCmdBld, TPowerMgmtConfig *pPMConfig, void *fCb, TI_HANDLE hCb)
557{
558    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
559    WakeUpCondition_t WakeUpCondition;
560    WakeUpCondition_t *pCfg = &WakeUpCondition;
561
562    TRACE1(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "WakeUpCondition :\n                             listenInterval = 0x%X\n", pPMConfig->listenInterval);
563
564    switch (pPMConfig->tnetWakeupOn)
565    {
566        case TNET_WAKE_ON_BEACON:
567            pCfg->wakeUpConditionBitmap = WAKE_UP_EVENT_BEACON_BITMAP;
568            break;
569        case TNET_WAKE_ON_DTIM:
570            pCfg->wakeUpConditionBitmap = WAKE_UP_EVENT_DTIM_BITMAP;
571            break;
572        case TNET_WAKE_ON_N_BEACON:
573            pCfg->wakeUpConditionBitmap = WAKE_UP_EVENT_N_BEACONS_BITMAP;
574            break;
575        case TNET_WAKE_ON_N_DTIM:
576            pCfg->wakeUpConditionBitmap = WAKE_UP_EVENT_N_DTIM_BITMAP;
577            break;
578        default:
579            pCfg->wakeUpConditionBitmap = WAKE_UP_EVENT_BEACON_BITMAP;
580            break;
581    }
582
583    pCfg->listenInterval = pPMConfig->listenInterval;
584
585    TRACE2(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, " cmdBld_wakeUpCondition  tnetWakeupOn=0x%x listenInterval=%d\n",pCfg->wakeUpConditionBitmap,pCfg->listenInterval);
586
587    /* Set information element header */
588    pCfg->EleHdr.id = ACX_WAKE_UP_CONDITIONS;
589    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
590
591    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
592}
593
594
595/****************************************************************************
596 *                      cmdBld_CfgIeSleepAuth()
597 ****************************************************************************
598 * DESCRIPTION: Configure/Interrogate the power management option
599 *
600 * INPUTS:
601 *
602 * OUTPUT:  None
603 *
604 * RETURNS: TI_OK or TI_NOK
605 ****************************************************************************/
606TI_STATUS cmdBld_CfgIeSleepAuth (TI_HANDLE hCmdBld, EPowerPolicy eMinPowerLevel, void *fCb, TI_HANDLE hCb)
607{
608    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
609    ACXSleepAuth_t ACXSleepAuth;
610    ACXSleepAuth_t *pCfg = &ACXSleepAuth;
611    EElpCtrlMode eElpCtrlMode;
612
613    /* Set the ELP control according to the new power policy */
614    switch (eMinPowerLevel)
615    {
616    case POWERAUTHO_POLICY_AWAKE:   eElpCtrlMode = ELPCTRL_MODE_KEEP_AWAKE;  break;
617    case POWERAUTHO_POLICY_PD:      eElpCtrlMode = ELPCTRL_MODE_KEEP_AWAKE;  break;
618    case POWERAUTHO_POLICY_ELP:     eElpCtrlMode = ELPCTRL_MODE_NORMAL;      break;
619    default:
620        TRACE1(pCmdBld->hReport, REPORT_SEVERITY_ERROR, " - Param value is not supported, %d\n", eMinPowerLevel);
621        return TI_NOK;
622
623    }
624
625    /* Set the ELP mode only if there is a change */
626    if (pCmdBld->uLastElpCtrlMode != eElpCtrlMode)
627    {
628        pCmdBld->uLastElpCtrlMode = eElpCtrlMode;
629		if (eElpCtrlMode == ELPCTRL_MODE_KEEP_AWAKE)
630		{
631			twIf_Awake(pCmdBld->hTwIf);
632		}
633		else
634		{
635			twIf_Sleep(pCmdBld->hTwIf);
636		}
637    }
638
639    /* In the info element the enums are in reverse */
640    switch (eMinPowerLevel)
641    {
642        case POWERAUTHO_POLICY_ELP:
643            pCfg->sleepAuth = 2;
644            break;
645        case POWERAUTHO_POLICY_AWAKE:
646            pCfg->sleepAuth = 0;
647            break;
648        default:
649            pCfg->sleepAuth = eMinPowerLevel;
650    }
651
652    TRACE1(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, " cmdBld_MinPowerLevelSet  sleepAuth=%d\n", eMinPowerLevel);
653
654    /* Set information element header*/
655    pCfg->EleHdr.id = ACX_SLEEP_AUTH;
656    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
657
658    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
659}
660
661
662/****************************************************************************
663 *                      cmdBld_CfgIeBcnBrcOptions()
664 ****************************************************************************
665 * DESCRIPTION: Configure/Interrogate the power management option
666 *
667 * INPUTS:
668 *
669 * OUTPUT:  None
670 *
671 * RETURNS: TI_OK or TI_NOK
672 ****************************************************************************/
673TI_STATUS cmdBld_CfgIeBcnBrcOptions (TI_HANDLE hCmdBld, TPowerMgmtConfig *pPMConfig, void *fCb, TI_HANDLE hCb)
674{
675    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
676    ACXBeaconAndBroadcastOptions_t ACXBeaconAndBroadcastOptions;
677    ACXBeaconAndBroadcastOptions_t *pCfg = &ACXBeaconAndBroadcastOptions;
678
679    pCfg->beaconRxTimeOut = pPMConfig->BcnBrcOptions.BeaconRxTimeout;
680    pCfg->broadcastTimeOut = pPMConfig->BcnBrcOptions.BroadcastRxTimeout;
681    pCfg->rxBroadcastInPS = pPMConfig->BcnBrcOptions.RxBroadcastInPs;
682	pCfg->consecutivePsPollDeliveryFailureThr = pPMConfig->ConsecutivePsPollDeliveryFailureThreshold;
683
684
685    TRACE4(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, " cmdBld_BcnBrcOptions  BeaconRxTimeout=%d BroadcastRxTimeout=%d RxBroadcastInPs=0x%x, consecutivePsPollDeliveryFailureThr=%d\n",							 pCfg->beaconRxTimeOut,pCfg->broadcastTimeOut,							 pCfg->rxBroadcastInPS, pCfg->consecutivePsPollDeliveryFailureThr);
686
687    /* Set information element header */
688    pCfg->EleHdr.id = ACX_BCN_DTIM_OPTIONS;
689    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
690
691    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
692}
693
694
695/****************************************************************************
696 *                      cmdBld_CfgIeFeatureConfig()
697                                    ACXBeaconAndBroadcastOptions_t* pWlanElm_BcnBrcOptions,
698 ****************************************************************************
699 * DESCRIPTION: Configure the feature config info element
700 *
701 * INPUTS:
702 *
703 * OUTPUT:  None
704 *
705 * RETURNS: TI_OK or TI_NOK
706 ****************************************************************************/
707TI_STATUS cmdBld_CfgIeFeatureConfig (TI_HANDLE hCmdBld, TI_UINT32 options, TI_UINT32 uDataFlowOptions, void *fCb, TI_HANDLE hCb)
708{
709    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
710    ACXFeatureConfig_t  WlanElm_FeatureConfig;
711    ACXFeatureConfig_t  *pCfg = &WlanElm_FeatureConfig;
712
713    /* Set information element header */
714    pCfg->EleHdr.id = ACX_FEATURE_CFG;
715    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
716
717    /* Set fields */
718    pCfg->Options = ENDIAN_HANDLE_LONG(options);
719    pCfg->dataflowOptions = ENDIAN_HANDLE_LONG(uDataFlowOptions);
720
721    TRACE3(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "ID=%u: option=0x%x, def.option=0x%x\n", pCfg->EleHdr.id, options, uDataFlowOptions);
722
723    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
724}
725
726
727/****************************************************************************
728 *                      cmdBld_CfgIeTxPowerDbm ()
729 ****************************************************************************
730 * DESCRIPTION: Set the Tx power in Dbm units.
731 *
732 * INPUTS:
733 *
734 * OUTPUT:  None
735 *
736 * RETURNS: TI_OK or TI_NOK
737 ****************************************************************************/
738TI_STATUS cmdBld_CfgIeTxPowerDbm (TI_HANDLE hCmdBld, TI_UINT8 uTxPowerDbm , void *fCb, TI_HANDLE hCb)
739{
740    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
741    dot11CurrentTxPowerStruct dot11CurrentTxPower;
742    dot11CurrentTxPowerStruct *pCfg = &dot11CurrentTxPower;
743
744   TRACE1( pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, " uTxPowerDbm = %d\n", uTxPowerDbm);
745
746
747    /* Set information element header*/
748    pCfg->EleHdr.id = DOT11_CUR_TX_PWR;
749    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
750
751    pCfg->dot11CurrentTxPower = uTxPowerDbm;
752
753    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
754}
755
756
757/****************************************************************************
758 *                      cmdBld_CfgIeStatisitics ()
759 ****************************************************************************
760 * DESCRIPTION: Set the ACX statistics counters to zero.
761 *
762 * INPUTS:
763 *
764 * OUTPUT:  None
765 *
766 * RETURNS: TI_OK or TI_NOK
767 ****************************************************************************/
768TI_STATUS cmdBld_CfgIeStatisitics (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb)
769{
770    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
771    TI_STATUS status = TI_NOK;
772    ACXStatistics_t  *pCfg;
773
774    pCfg = os_memoryAlloc(pCmdBld->hOs, sizeof(ACXStatistics_t));
775    if (!pCfg)
776        return status;
777    /* Set information element header */
778    pCfg->EleHdr.id  = ACX_STATISTICS;
779    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
780
781    status = cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
782    os_memoryFree(pCmdBld->hOs, pCfg, sizeof(ACXStatistics_t));
783    return status;
784}
785
786
787/****************************************************************************
788 *                      cmdBld_CfgIeTid()
789 ****************************************************************************
790 * DESCRIPTION: Write the Queue configuration (For Quality Of Service)
791 *
792 * INPUTS:
793 *
794 * OUTPUT:  None
795 *
796 * RETURNS: TI_OK or TI_NOK
797 ****************************************************************************/
798TI_STATUS cmdBld_CfgIeTid (TI_HANDLE hCmdBld, TQueueTrafficParams* pQtrafficParams, void *fCb, TI_HANDLE hCb)
799
800{
801    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
802    ACXTIDConfig_t    TrafficCategoryCfg;
803    ACXTIDConfig_t   *pCfg = &TrafficCategoryCfg;
804
805    os_memoryZero (pCmdBld->hOs, (void *)pCfg, sizeof(*pCfg));
806
807    /*
808     * Set information element header
809     * ==============================
810     */
811    pCfg->EleHdr.id = ACX_TID_CFG;
812    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
813
814    /*
815     * Set information element Data
816     * ==============================
817     */
818    pCfg->queueID       = pQtrafficParams->queueID;
819    pCfg->channelType   = pQtrafficParams->channelType;
820    pCfg->tsid          = pQtrafficParams->tsid;
821    pCfg->psScheme      = pQtrafficParams->psScheme;
822    pCfg->APSDConf[0]   = pQtrafficParams->APSDConf[0];
823    pCfg->APSDConf[1]   = pQtrafficParams->APSDConf[1];
824
825    TRACE7(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "ID=%u: queue-id=%u, chan-type=%u, tsid=%u, ps-scheme=%u, apsd-1=0x%x, apsd-2=0x%x\n", pCfg->EleHdr.id, pCfg->queueID, pCfg->channelType, pCfg->tsid, pCfg->psScheme, pCfg->APSDConf[0], pCfg->APSDConf[1]);
826
827    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
828}
829
830
831/****************************************************************************
832 *                      cmdBld_CfgIeAcParams()
833 ****************************************************************************
834 * DESCRIPTION: Write the AC configuration (For Quality Of Service)
835 *
836 * INPUTS:
837 *
838 * OUTPUT:  None
839 *
840 * RETURNS: TI_OK or TI_NOK
841 ****************************************************************************/
842TI_STATUS cmdBld_CfgIeAcParams (TI_HANDLE hCmdBld, TAcQosParams *pAcQosParams, void *fCb, TI_HANDLE hCb)
843{
844    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
845    ACXAcCfg_t     AcCfg;
846    ACXAcCfg_t    *pCfg  = &AcCfg;
847
848    os_memoryZero (pCmdBld->hOs, (void *)pCfg, sizeof(*pCfg));
849
850    /*
851     * Set information element header
852     * ==============================
853     */
854    pCfg->EleHdr.id = ACX_AC_CFG;
855    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
856
857    /*
858     * Set information element Data
859     * ==============================
860     */
861
862    pCfg->ac        = pAcQosParams->ac;
863    pCfg->aifsn     = pAcQosParams->aifsn;
864    pCfg->cwMax     = ENDIAN_HANDLE_WORD(pAcQosParams->cwMax);
865    pCfg->cwMin     = pAcQosParams->cwMin;
866    pCfg->txopLimit = ENDIAN_HANDLE_WORD(pAcQosParams->txopLimit);
867
868    TRACE6(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "ID=%u: ac= %u, aifsn=%u, cw-max=%u, cw-min=%u, txop=%u\n", pCfg->EleHdr.id, pAcQosParams->ac, pAcQosParams->aifsn, pAcQosParams->cwMax, pAcQosParams->cwMin, pAcQosParams->txopLimit);
869
870    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
871}
872
873
874/****************************************************************************
875 *                      cmdBld_CfgIePsRxStreaming()
876 ****************************************************************************
877 * DESCRIPTION: Write the AC PS-Rx-Streaming
878 *
879 * INPUTS:
880 *
881 * OUTPUT:  None
882 *
883 * RETURNS: TI_OK or TI_NOK
884 ****************************************************************************/
885TI_STATUS cmdBld_CfgIePsRxStreaming (TI_HANDLE hCmdBld, TPsRxStreaming *pPsRxStreaming, void *fCb, TI_HANDLE hCb)
886{
887    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
888    ACXPsRxStreaming_t  tStreamingCfg;
889    ACXPsRxStreaming_t *pCfg  = &tStreamingCfg;
890
891    os_memoryZero (pCmdBld->hOs, (void *)pCfg, sizeof(*pCfg));
892
893    /*
894     * Set information element header
895     * ==============================
896     */
897    pCfg->EleHdr.id = ACX_PS_RX_STREAMING;
898    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
899
900    /*
901     * Set information element Data
902     * ============================
903     */
904    pCfg->TID          = (TI_UINT8)pPsRxStreaming->uTid;
905    pCfg->rxPSDEnabled = (TI_UINT8)pPsRxStreaming->bEnabled;
906    pCfg->streamPeriod = (TI_UINT8)pPsRxStreaming->uStreamPeriod;
907    pCfg->txTimeout    = (TI_UINT8)pPsRxStreaming->uTxTimeout;
908
909    TRACE5(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "ID=%u: tid= %u, enable=%u, streamPeriod=%u, txTimeout=%u\n", pCfg->EleHdr.id, pCfg->TID, pCfg->rxPSDEnabled, pCfg->streamPeriod, pCfg->txTimeout);
910
911    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
912}
913
914
915/****************************************************************************
916 *                      cmdBld_CfgIePacketDetectionThreshold()
917 ****************************************************************************
918 * DESCRIPTION:  Set the PacketDetection threshold
919 *
920 * INPUTS:
921 *
922 * OUTPUT:  None
923 *
924 * RETURNS: TI_OK or TI_NOK
925 ****************************************************************************/
926TI_STATUS cmdBld_CfgIePacketDetectionThreshold (TI_HANDLE hCmdBld, TI_UINT32 pdThreshold, void *fCb, TI_HANDLE hCb)
927{
928    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
929    ACXPacketDetection_t  PacketDetectionThresholdCfg;
930    ACXPacketDetection_t *pCfg = &PacketDetectionThresholdCfg;
931
932    /*
933     * Set information element header
934     * ==============================
935     */
936    pCfg->EleHdr.id = ACX_PD_THRESHOLD;
937    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
938
939    /*
940     * Set information element Data
941     * ==============================
942     */
943    pCfg->pdThreshold = ENDIAN_HANDLE_LONG(pdThreshold);
944
945    TRACE2(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, ": pdThreshold = 0x%x , len = 0x%x \n",pCfg->pdThreshold,pCfg->EleHdr.len);
946
947    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
948}
949
950
951
952
953/****************************************************************************
954 *                      cmdBld_CfgIeBeaconFilterOpt()
955 ****************************************************************************
956 * DESCRIPTION: Configure/Interrogate the beacon filtering option
957 *
958 * INPUTS:
959 *
960 * OUTPUT:  None
961 *
962 * RETURNS: TI_OK or TI_NOK
963 ****************************************************************************/
964TI_STATUS cmdBld_CfgIeBeaconFilterOpt (TI_HANDLE hCmdBld, TI_UINT8 beaconFilteringStatus, TI_UINT8 numOfBeaconsToBuffer, void *fCb, TI_HANDLE hCb)
965{
966    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
967    ACXBeaconFilterOptions_t  ACXBeaconFilterOptions;
968    ACXBeaconFilterOptions_t *pCfg = &ACXBeaconFilterOptions;
969
970    pCfg->enable = beaconFilteringStatus;
971    pCfg->maxNumOfBeaconsStored = numOfBeaconsToBuffer;
972
973    /* Set information element header */
974    pCfg->EleHdr.id = ACX_BEACON_FILTER_OPT;
975    pCfg->EleHdr.len = sizeof(ACXBeaconFilterOptions_t) - sizeof(EleHdrStruct);
976
977    TRACE3(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "ID=%u: enable=%u, num-stored=%u\n", pCfg->EleHdr.id, beaconFilteringStatus, numOfBeaconsToBuffer);
978
979    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(ACXBeaconFilterOptions_t), fCb, hCb, NULL);
980}
981/****************************************************************************
982 *                      cmdBld_CfgIeRateMngDbg()
983 ****************************************************************************
984 * DESCRIPTION: Configure the rate managment params
985 * INPUTS:
986 *
987 * OUTPUT:  None
988 *
989 * RETURNS: TI_OK or TI_NOK
990 ****************************************************************************/
991
992TI_STATUS cmdBld_CfgIeRateMngDbg (TI_HANDLE hCmdBld, RateMangeParams_t *pRateMngParams, void *fCb, TI_HANDLE hCb)
993{
994    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
995    AcxRateMangeParams  RateMng;
996    AcxRateMangeParams *pCfg = &RateMng;
997	int i;
998
999    /* Set information element header */
1000    pCfg->EleHdr.id = ACX_SET_RATE_MAMAGEMENT_PARAMS;
1001    pCfg->EleHdr.len = sizeof(AcxRateMangeParams) - sizeof(EleHdrStruct);
1002
1003
1004    TRACE2(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "ID=%u, index=%d \n",pCfg->EleHdr.id,pRateMngParams->paramIndex);
1005
1006	pCfg->paramIndex = pRateMngParams->paramIndex;
1007
1008	pCfg->InverseCuriosityFactor = pRateMngParams->InverseCuriosityFactor;
1009    pCfg->MaxPer = pRateMngParams->MaxPer;
1010	pCfg->PerAdd = pRateMngParams->PerAdd;
1011	pCfg->PerAddShift = pRateMngParams->PerAddShift;
1012	pCfg->PerAlphaShift = pRateMngParams->PerAlphaShift;
1013	pCfg->PerBeta1Shift = pRateMngParams->PerBeta1Shift;
1014	pCfg->PerBeta2Shift = pRateMngParams->PerBeta2Shift;
1015	pCfg->PerTh1 = pRateMngParams->PerTh1;
1016	pCfg->PerTh2 = pRateMngParams->PerTh2;
1017	pCfg->RateCheckDown = pRateMngParams->RateCheckDown;
1018	pCfg->RateCheckUp = pRateMngParams->RateCheckUp;
1019	pCfg->RateRetryScore = pRateMngParams->RateRetryScore;
1020	pCfg->TxFailHighTh = pRateMngParams->TxFailHighTh;
1021	pCfg->TxFailLowTh = pRateMngParams->TxFailLowTh;
1022
1023	for (i=0 ; i< 13 ; i++)
1024	{
1025		pCfg->RateRetryPolicy[i] = pRateMngParams->RateRetryPolicy[i];
1026	}
1027
1028    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(AcxRateMangeParams), fCb, hCb, NULL);
1029}
1030
1031
1032
1033/****************************************************************************
1034 *                     cmdBld_CfgIeBeaconFilterTable
1035 ****************************************************************************
1036 * DESCRIPTION: Configure/Interrogate the beacon filter IE table
1037 *
1038 * INPUTS:
1039 *
1040 * OUTPUT:  None
1041 *
1042 * RETURNS: TI_OK or TI_NOK
1043 ****************************************************************************/
1044TI_STATUS cmdBld_CfgIeBeaconFilterTable (TI_HANDLE hCmdBld,
1045                                         TI_UINT8   uNumberOfIEs,
1046                                         TI_UINT8  *pIETable,
1047                                         TI_UINT8   uIETableSize,
1048                                         void      *fCb,
1049                                         TI_HANDLE  hCb)
1050{
1051    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
1052    ACXBeaconFilterIETable_t beaconFilterIETableStruct;
1053    ACXBeaconFilterIETable_t *pCfg = &beaconFilterIETableStruct;
1054    TI_UINT32 counter;
1055
1056    if (NULL == pIETable)
1057    {
1058        return PARAM_VALUE_NOT_VALID;
1059    }
1060
1061    pCfg->EleHdr.id = ACX_BEACON_FILTER_TABLE;
1062    pCfg->EleHdr.len = uIETableSize + 1;
1063    pCfg->NumberOfIEs = uNumberOfIEs;
1064
1065    os_memoryZero (pCmdBld->hOs, (void *)pCfg->IETable, BEACON_FILTER_TABLE_MAX_SIZE);
1066    os_memoryCopy (pCmdBld->hOs, (void *)pCfg->IETable, (void *)pIETable, uIETableSize);
1067
1068    TRACE3(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "ID=%u: num-ie=%u, table-size=%u\n", pCfg->EleHdr.id, uNumberOfIEs, uIETableSize);
1069
1070TRACE0(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "Beacon IE Table:\n");
1071    for (counter = 0; counter < uIETableSize; counter++)
1072    {
1073TRACE1(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "%2x ", pIETable[counter]);
1074	}
1075TRACE0(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "\n");
1076
1077    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(ACXBeaconFilterIETable_t), fCb, hCb, NULL);
1078}
1079
1080/****************************************************************************
1081 *                     cmdBld_CfgCoexActivity
1082 ****************************************************************************
1083 * DESCRIPTION: Configure/Interrogate the Coex activity IE
1084 *
1085 * INPUTS:
1086 *
1087 * OUTPUT:  None
1088 *
1089 * RETURNS: TI_OK or TI_NOK
1090 ****************************************************************************/
1091TI_STATUS cmdBld_CfgIeCoexActivity (TI_HANDLE hCmdBld,
1092                                         TCoexActivity  *pCoexActivity,
1093                                         void      *fCb,
1094                                         TI_HANDLE  hCb)
1095{
1096    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
1097    ACXCoexActivityIE_t coexActivityIEStruct;
1098    ACXCoexActivityIE_t *pCfg = &coexActivityIEStruct;
1099
1100    if (NULL == pCoexActivity)
1101    {
1102        return PARAM_VALUE_NOT_VALID;
1103    }
1104
1105    pCfg->EleHdr.id = ACX_COEX_ACTIVITY;
1106    pCfg->EleHdr.len = sizeof(ACXCoexActivityIE_t) - sizeof(EleHdrStruct);
1107
1108    TRACE1(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "CoexActivity: ID=0x%x\n", pCfg->EleHdr.id);
1109
1110    pCfg->coexIp          = pCoexActivity->coexIp;
1111    pCfg->activityId      = pCoexActivity->activityId;
1112    pCfg->defaultPriority = pCoexActivity->defaultPriority;
1113    pCfg->raisedPriority  = pCoexActivity->raisedPriority;
1114    pCfg->minService      = ENDIAN_HANDLE_WORD(pCoexActivity->minService);
1115    pCfg->maxService      = ENDIAN_HANDLE_WORD(pCoexActivity->maxService);
1116
1117    TRACE6(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "CoexActivity: 0x%02x 0x%02x - 0x%02x 0x%02x 0x%04x 0x%04x\n",
1118            pCfg->coexIp,
1119            pCfg->activityId,
1120            pCfg->defaultPriority,
1121            pCfg->raisedPriority,
1122            pCfg->minService,
1123            pCfg->maxService);
1124
1125    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
1126}
1127
1128/****************************************************************************
1129 *                      cmdBld_CfgIeCcaThreshold()
1130 ****************************************************************************
1131 * DESCRIPTION: Configure/Interrogate the Slot Time
1132 *
1133 * INPUTS:  None
1134 *
1135 * OUTPUT:  None
1136 *
1137 * RETURNS: TI_OK or TI_NOK
1138 ****************************************************************************/
1139TI_STATUS cmdBld_CfgIeCcaThreshold (TI_HANDLE hCmdBld, TI_UINT16 ccaThreshold, void *fCb, TI_HANDLE hCb)
1140{
1141    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
1142    ACXEnergyDetection_t AcxElm_CcaThreshold;
1143    ACXEnergyDetection_t *pCfg = &AcxElm_CcaThreshold;
1144
1145    /* Set information element header */
1146    pCfg->EleHdr.id = ACX_CCA_THRESHOLD;
1147    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
1148
1149    pCfg->rxCCAThreshold = ENDIAN_HANDLE_WORD(ccaThreshold);
1150
1151    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
1152}
1153
1154
1155/****************************************************************************
1156 *                      cmdBld_CfgIeEventMask()
1157 ****************************************************************************
1158 * DESCRIPTION: Change the Event Vector Mask in the FW
1159 *
1160 * INPUTS: MaskVector   The Updated Vector Mask
1161 *
1162 * RETURNS: TI_OK or TI_NOK
1163 ****************************************************************************/
1164TI_STATUS cmdBld_CfgIeEventMask (TI_HANDLE hCmdBld, TI_UINT32 mask, void *fCb, TI_HANDLE hCb)
1165{
1166    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
1167
1168    ACXEventMboxMask_t EventMboxData;
1169    ACXEventMboxMask_t *pCfg = &EventMboxData;
1170
1171    /* Set information element header*/
1172    pCfg->EleHdr.id = ACX_EVENT_MBOX_MASK;
1173    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
1174    pCfg->lowEventMask = ENDIAN_HANDLE_LONG(mask);
1175    pCfg->highEventMask = ENDIAN_HANDLE_LONG(0xffffffff); /* Not in Use */
1176
1177    TRACE0(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "cmdBld_CfgIeEventMask:\n");
1178
1179    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
1180}
1181
1182
1183/****************************************************************************
1184 *                      cmdBld_CfgIeMaxTxRetry()
1185 ****************************************************************************
1186 * DESCRIPTION: Configure the Max Tx Retry parameters
1187 *
1188 * INPUTS:  None
1189 *
1190 * OUTPUT:  None
1191 *
1192 * RETURNS: TI_OK or TI_NOK
1193 ****************************************************************************/
1194TI_STATUS cmdBld_CfgIeMaxTxRetry (TI_HANDLE hCmdBld,
1195                                  TRroamingTriggerParams *pRoamingTriggerCmd,
1196                                  void      *fCb,
1197                                  TI_HANDLE hCb)
1198{
1199    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
1200    ACXConsTxFailureTriggerParameters_t AcxElm_SetMaxTxRetry;
1201    ACXConsTxFailureTriggerParameters_t* pCfg = &AcxElm_SetMaxTxRetry;
1202
1203    pCfg->maxTxRetry = pRoamingTriggerCmd->maxTxRetry;
1204
1205    /* Set information element header */
1206    pCfg->EleHdr.id = ACX_CONS_TX_FAILURE;
1207    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
1208
1209    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
1210}
1211
1212
1213/****************************************************************************
1214 *                      cmdBld_CfgIeConnMonitParams()
1215 ****************************************************************************
1216 * DESCRIPTION: Configure the Bss Lost Timeout & TSF miss threshold
1217 *
1218 * INPUTS:  None
1219 *
1220 * OUTPUT:  None
1221 *
1222 * RETURNS: TI_OK or TI_NOK
1223 ****************************************************************************/
1224TI_STATUS cmdBld_CfgIeConnMonitParams (TI_HANDLE hCmdBld, TRroamingTriggerParams *pRoamingTriggerCmd, void *fCb, TI_HANDLE hCb)
1225{
1226    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
1227    AcxConnectionMonitorOptions  AcxElm_SetBssLossTsfThreshold;
1228    AcxConnectionMonitorOptions* pCfg = &AcxElm_SetBssLossTsfThreshold;
1229
1230    pCfg->BSSLossTimeout     = ENDIAN_HANDLE_LONG(pRoamingTriggerCmd->BssLossTimeout);
1231    pCfg->TSFMissedThreshold = ENDIAN_HANDLE_LONG(pRoamingTriggerCmd->TsfMissThreshold);
1232
1233    /* Set information element header */
1234    pCfg->EleHdr.id  = ACX_CONN_MONIT_PARAMS;
1235    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
1236
1237    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
1238}
1239
1240
1241/****************************************************************************
1242 *                      cmdBld_CfgIeTxRatePolicy()
1243 ****************************************************************************
1244 * DESCRIPTION: Write the TxRateClass configuration
1245 *
1246 * INPUTS:
1247 *
1248 * OUTPUT:  None
1249 *
1250 * RETURNS: TI_OK or TI_NOK
1251 ****************************************************************************/
1252TI_STATUS cmdBld_CfgIeTxRatePolicy (TI_HANDLE hCmdBld, TTxRatePolicy *pTxRatePolicy, void *fCb, TI_HANDLE hCb)
1253{
1254    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
1255    ACXTxAttrClasses_t  TxClassCfg;
1256    ACXTxAttrClasses_t *pCfg  = &TxClassCfg;
1257    TI_UINT8 PolicyId;
1258
1259    os_memoryZero (pCmdBld->hOs, (void *)pCfg, sizeof(*pCfg));
1260
1261    /*
1262     * Set information element header
1263     * ==============================
1264     */
1265    pCfg->EleHdr.id = ACX_RATE_POLICY;
1266    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
1267    pCfg->numOfClasses = pTxRatePolicy->numOfRateClasses;
1268
1269    for (PolicyId = 0; PolicyId < pTxRatePolicy->numOfRateClasses; PolicyId++)
1270    {
1271        os_memoryCopy (pCmdBld->hOs,
1272                       (void *)&(pCfg->rateClasses[PolicyId]),
1273                       (void *)&(pTxRatePolicy->rateClass[PolicyId]),
1274                       sizeof(TTxRateClass));
1275    }
1276
1277    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
1278}
1279
1280
1281/****************************************************************************
1282 *                      cmdBld_CfgIeRtsThreshold()
1283 ****************************************************************************
1284 * DESCRIPTION: Configure the RTS threshold
1285 *
1286 * INPUTS:  None
1287 *
1288 * OUTPUT:  None
1289 *
1290 * RETURNS: TI_OK or TI_NOK
1291 ****************************************************************************/
1292TI_STATUS cmdBld_CfgIeRtsThreshold (TI_HANDLE hCmdBld, TI_UINT16 uRtsThreshold, void *fCb, TI_HANDLE hCb)
1293{
1294    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
1295    dot11RTSThreshold_t AcxElm_RtsThreshold;
1296    dot11RTSThreshold_t *pCfg = &AcxElm_RtsThreshold;
1297
1298    /* Set information element header */
1299    pCfg->EleHdr.id = DOT11_RTS_THRESHOLD;
1300    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
1301
1302    pCfg->RTSThreshold = ENDIAN_HANDLE_WORD(uRtsThreshold);
1303
1304    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
1305}
1306
1307
1308/****************************************************************************
1309 *                      cmdBld_CfgIeRtsThreshold()
1310 ****************************************************************************
1311 * DESCRIPTION: Configure the tx fragmentation threshold
1312 *
1313 * INPUTS:  None
1314 *
1315 * OUTPUT:  None
1316 *
1317 * RETURNS: TI_OK or TI_NOK
1318 ****************************************************************************/
1319TI_STATUS cmdBld_CfgIeFragmentThreshold (TI_HANDLE hCmdBld, TI_UINT16 uFragmentThreshold, void *fCb, TI_HANDLE hCb)
1320{
1321    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
1322    ACXFRAGThreshold_t AcxElm_FragmentThreshold;
1323    ACXFRAGThreshold_t *pCfg = &AcxElm_FragmentThreshold;
1324
1325    /* Set information element header */
1326    pCfg->EleHdr.id = ACX_FRAG_CFG;
1327    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
1328
1329    pCfg->fragThreshold = ENDIAN_HANDLE_WORD(uFragmentThreshold);
1330
1331    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
1332}
1333
1334
1335/****************************************************************************
1336 *                      cmdBld_CfgIePmConfig()
1337 ****************************************************************************
1338 * DESCRIPTION: Configure PM parameters
1339 *
1340 * INPUTS:  None
1341 *
1342 * OUTPUT:  None
1343 *
1344 * RETURNS: TI_OK or TI_NOK
1345 ****************************************************************************/
1346TI_STATUS cmdBld_CfgIePmConfig (TI_HANDLE   hCmdBld,
1347                                TI_UINT32   uHostClkSettlingTime,
1348                                TI_UINT8    uHostFastWakeupSupport,
1349                                void *      fCb,
1350                                TI_HANDLE   hCb)
1351{
1352    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
1353    ACXPMConfig_t tPmConfig;
1354    ACXPMConfig_t *pCfg = &tPmConfig;
1355
1356    /* Set information element header*/
1357    pCfg->EleHdr.id  = ACX_PM_CONFIG;
1358    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
1359
1360    pCfg->hostClkSettlingTime   = uHostClkSettlingTime;
1361    pCfg->hostFastWakeupSupport = uHostFastWakeupSupport;
1362
1363    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
1364}
1365
1366
1367/****************************************************************************
1368 *                      cmdBld_CfgIeTxCmpltPacing()
1369 ****************************************************************************
1370 * DESCRIPTION: Configure Tx-Complete interrupt pacing to FW
1371 *
1372 * INPUTS:  None
1373 *
1374 * OUTPUT:  None
1375 *
1376 * RETURNS: TI_OK or TI_NOK
1377 ****************************************************************************/
1378TI_STATUS cmdBld_CfgIeTxCmpltPacing (TI_HANDLE  hCmdBld,
1379                                     TI_UINT16  uTxCompletePacingThreshold,
1380                                     TI_UINT16  uTxCompletePacingTimeout,
1381                                     void *     fCb,
1382                                     TI_HANDLE  hCb)
1383{
1384    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
1385    ACXTxConfigOptions_t  tTxCmpltPacing;
1386    ACXTxConfigOptions_t  *pCfg = &tTxCmpltPacing;
1387
1388    /* Set information element header */
1389    pCfg->EleHdr.id  = ACX_TX_CONFIG_OPT;
1390    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
1391
1392    pCfg->txCompleteThreshold = ENDIAN_HANDLE_WORD(uTxCompletePacingThreshold);
1393    pCfg->txCompleteTimeout   = ENDIAN_HANDLE_WORD(uTxCompletePacingTimeout);
1394
1395    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
1396}
1397
1398
1399/****************************************************************************
1400 *                      cmdBld_CfgIeRxIntrPacing()
1401 ****************************************************************************
1402 * DESCRIPTION: Configure Rx-Complete interrupt pacing to FW
1403 *
1404 * INPUTS:  None
1405 *
1406 * OUTPUT:  None
1407 *
1408 * RETURNS: TI_OK or TI_NOK
1409 ****************************************************************************/
1410TI_STATUS cmdBld_CfgIeRxIntrPacing (TI_HANDLE  hCmdBld,
1411                                    TI_UINT16  uRxIntrPacingThreshold,
1412                                    TI_UINT16  uRxIntrPacingTimeout,
1413                                    void *     fCb,
1414                                    TI_HANDLE  hCb)
1415{
1416    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
1417    ACXRxBufferingConfig_t  tRxIntrPacing;
1418    ACXRxBufferingConfig_t  *pCfg = &tRxIntrPacing;
1419
1420    /* Set information element header */
1421    pCfg->EleHdr.id  = ACX_RX_CONFIG_OPT;
1422    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
1423
1424    pCfg->rxPktThreshold    = ENDIAN_HANDLE_WORD(uRxIntrPacingThreshold);
1425    pCfg->rxCompleteTimeout = ENDIAN_HANDLE_WORD(uRxIntrPacingTimeout);
1426    pCfg->rxMblkThreshold   = ENDIAN_HANDLE_WORD(0xFFFF);    /* Set to maximum so it has no effect (only the PktThreshold is used) */
1427    pCfg->rxQueueType       = RX_QUEUE_TYPE_RX_LOW_PRIORITY; /* Only low priority data packets are buffered */
1428
1429    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
1430}
1431
1432
1433/****************************************************************************
1434*                      cmdBld_CfgIeCtsProtection()
1435 ****************************************************************************
1436 * DESCRIPTION: Configure The Cts to self feature
1437 *
1438 * INPUTS:  None
1439 *
1440 * OUTPUT:  None
1441 *
1442 * RETURNS: TI_OK or TI_NOK
1443 ****************************************************************************/
1444TI_STATUS cmdBld_CfgIeCtsProtection (TI_HANDLE hCmdBld, TI_UINT8 ctsProtection, void *fCb, TI_HANDLE hCb)
1445{
1446    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
1447    ACXCtsProtection_t AcxElm_CtsToSelf;
1448    ACXCtsProtection_t *pCfg = &AcxElm_CtsToSelf;
1449
1450    /* Set information element header*/
1451    pCfg->EleHdr.id = ACX_CTS_PROTECTION;
1452    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
1453
1454    pCfg->ctsProtectMode = ctsProtection;
1455
1456    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
1457}
1458
1459
1460/****************************************************************************
1461 *                      cmdBld_CfgIeRxMsduLifeTime()
1462 ****************************************************************************
1463 * DESCRIPTION: Configure The Cts to self feature
1464 *
1465 * INPUTS:  None
1466 *
1467 * OUTPUT:  None
1468 *
1469 * RETURNS: TI_OK or TI_NOK
1470 ****************************************************************************/
1471TI_STATUS cmdBld_CfgIeRxMsduLifeTime (TI_HANDLE hCmdBld, TI_UINT32 RxMsduLifeTime, void *fCb, TI_HANDLE hCb)
1472{
1473    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
1474    dot11RxMsduLifeTime_t   AcxElm_RxMsduLifeTime;
1475    dot11RxMsduLifeTime_t *pCfg = &AcxElm_RxMsduLifeTime;
1476
1477    /* Set information element header*/
1478    pCfg->EleHdr.id = DOT11_RX_MSDU_LIFE_TIME;
1479    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
1480    pCfg->RxMsduLifeTime = RxMsduLifeTime;
1481
1482    TRACE2(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, ": RxMsduLifeTime = 0x%x, len = 0x%x\n",pCfg->RxMsduLifeTime,pCfg->EleHdr.len);
1483
1484    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
1485}
1486
1487
1488/****************************************************************************
1489 *                      cmdBld_CfgIeServicePeriodTimeout()
1490 ****************************************************************************
1491 * DESCRIPTION: Configure The Rx Time Out
1492 *
1493 * INPUTS:  None
1494 *
1495 * OUTPUT:  None
1496 *
1497 * RETURNS: TI_OK or TI_NOK
1498 ****************************************************************************/
1499TI_STATUS cmdBld_CfgIeServicePeriodTimeout (TI_HANDLE hCmdBld, TRxTimeOut* pRxTimeOut, void *fCb, TI_HANDLE hCb)
1500{
1501    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
1502    ACXRxTimeout_t AcxElm_rxTimeOut;
1503    ACXRxTimeout_t *pCfg = &AcxElm_rxTimeOut;
1504
1505    /* Set information element header*/
1506    pCfg->EleHdr.id = ACX_SERVICE_PERIOD_TIMEOUT;
1507    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
1508
1509    pCfg->PsPollTimeout = pRxTimeOut->psPoll;
1510    pCfg->UpsdTimeout   = pRxTimeOut->UPSD;
1511
1512    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
1513}
1514
1515
1516/****************************************************************************
1517 *                      cmdBld_CfgIePsWmm()
1518 ****************************************************************************
1519 * DESCRIPTION: Configure The PS for WMM
1520 *
1521 * INPUTS:   TI_TRUE  - Configure PS to work on WMM mode - do not send the NULL/PS_POLL
1522 *                   packets even if TIM is set.
1523 *           TI_FALSE - Configure PS to work on Non-WMM mode - work according to the
1524 *                   standard
1525 *
1526 * RETURNS: TI_OK or TI_NOK
1527 ****************************************************************************/
1528TI_STATUS cmdBld_CfgIePsWmm (TI_HANDLE hCmdBld, TI_BOOL enableWA, void *fCb, TI_HANDLE hCb)
1529{
1530    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
1531    ACXConfigPsWmm_t  ConfigPsWmm;
1532    ACXConfigPsWmm_t *pCfg = &ConfigPsWmm;
1533
1534    /*
1535     * Set information element header
1536     */
1537    pCfg->EleHdr.id = ACX_CONFIG_PS_WMM;
1538    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
1539
1540    pCfg->ConfigPsOnWmmMode = enableWA;
1541
1542    /* Report the meesage only if we are using the WiFi patch */
1543    if (enableWA)
1544    {
1545        TRACE0(pCmdBld->hReport, REPORT_SEVERITY_CONSOLE, "cmdBld_CfgIePsWmm: PS is on WMM mode\n");
1546        WLAN_OS_REPORT(("%s PS is on WMM mode\n",__FUNCTION__));
1547    }
1548
1549    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
1550}
1551
1552/****************************************************************************
1553 *                      cmdBld_CfgIeRssiSnrTrigger()
1554 ****************************************************************************
1555 * DESCRIPTION: Configure the RSSI/SNR Trigger parameters
1556 *
1557 * INPUTS:  None
1558 *
1559 * OUTPUT:  None
1560 *
1561 * RETURNS: OK or NOK
1562 ****************************************************************************/
1563TI_STATUS cmdBld_CfgIeRssiSnrTrigger (TI_HANDLE hCmdBld, RssiSnrTriggerCfg_t *pTriggerParam, void *fCb, TI_HANDLE hCb)
1564{
1565    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
1566    ACXRssiSnrTriggerCfg_t  tAcxTriggerParameters;
1567    ACXRssiSnrTriggerCfg_t *pCfg = &tAcxTriggerParameters;
1568
1569    pCfg->param.index       = pTriggerParam->index    ;
1570    pCfg->param.threshold   = pTriggerParam->threshold;
1571    pCfg->param.pacing      = pTriggerParam->pacing   ;
1572    pCfg->param.metric      = pTriggerParam->metric   ;
1573    pCfg->param.type        = pTriggerParam->type     ;
1574    pCfg->param.direction   = pTriggerParam->direction;
1575    pCfg->param.hystersis   = pTriggerParam->hystersis;
1576    pCfg->param.enable      = pTriggerParam->enable   ;
1577
1578    /* Set information element header */
1579    pCfg->EleHdr.id = ACX_RSSI_SNR_TRIGGER;
1580    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
1581
1582    TRACE8(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "ID=%u: threshold=%u, pacing=%u, metric=%u, type=%u, dir=%u, hyst=%u, enable=%u\n", pTriggerParam->index, pTriggerParam->threshold, pTriggerParam->pacing, pTriggerParam->metric, pTriggerParam->type, pTriggerParam->direction, pTriggerParam->hystersis, pTriggerParam->enable);
1583
1584    /* Send the configuration command */
1585    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
1586}
1587
1588/****************************************************************************
1589 *                      cmdBld_CfgIeRssiSnrWeights()
1590 ****************************************************************************
1591 * DESCRIPTION: Configure the RSSI/SNR Trigger parameters
1592 *
1593 * INPUTS:  None
1594 *
1595 * OUTPUT:  None
1596 *
1597 * RETURNS: OK or NOK
1598 ****************************************************************************/
1599TI_STATUS cmdBld_CfgIeRssiSnrWeights (TI_HANDLE hCmdBld, RssiSnrAverageWeights_t *pWeightsParam, void *fCb, TI_HANDLE hCb)
1600{
1601    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
1602    ACXRssiSnrAverageWeights_t  tAcxAverageWeights;
1603    ACXRssiSnrAverageWeights_t *pCfg = &tAcxAverageWeights;
1604
1605    pCfg->param.rssiBeaconAverageWeight = pWeightsParam->rssiBeaconAverageWeight;
1606    pCfg->param.rssiPacketAverageWeight = pWeightsParam->rssiPacketAverageWeight;
1607    pCfg->param.snrBeaconAverageWeight  = pWeightsParam->snrBeaconAverageWeight ;
1608    pCfg->param.snrPacketAverageWeight  = pWeightsParam->snrPacketAverageWeight ;
1609
1610    /* Set information element header */
1611    pCfg->EleHdr.id = ACX_RSSI_SNR_WEIGHTS;
1612    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
1613
1614    TRACE4(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "rssi-beacon-avg-weight=%u, rssi-packet-avg-weight=%u, snr-beacon-avg-weight=%u, snr-packet-avg-weight=%u", pWeightsParam->rssiBeaconAverageWeight, pWeightsParam->rssiPacketAverageWeight, pWeightsParam->snrBeaconAverageWeight, pWeightsParam->snrPacketAverageWeight);
1615
1616    /* Send the configuration command */
1617    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
1618}
1619
1620
1621 /*
1622 * ----------------------------------------------------------------------------
1623 * Function : cmdBld_CfgIeBet
1624 *
1625 * Input    :   enabled               - 0 to disable BET, 0 to disable BET
1626 *              MaximumConsecutiveET  - Max number of consecutive beacons
1627 *                                      that may be early terminated.
1628 * Output   : TI_STATUS
1629 * Process  :  Configures Beacon Early Termination information element.
1630 * Note(s)  :  None
1631 * -----------------------------------------------------------------------------
1632 */
1633TI_STATUS cmdBld_CfgIeBet (TI_HANDLE hCmdBld, TI_UINT8 Enable, TI_UINT8 MaximumConsecutiveET, void *fCb, TI_HANDLE hCb)
1634{
1635    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
1636
1637    ACXBet_Enable_t ACXBet_Enable;
1638    ACXBet_Enable_t* pCfg = &ACXBet_Enable;
1639
1640    /* Set information element header */
1641    pCfg->EleHdr.id = ACX_BET_ENABLE;
1642    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
1643
1644    /* Set configuration fields */
1645    pCfg->Enable = Enable;
1646    pCfg->MaximumConsecutiveET = MaximumConsecutiveET;
1647
1648    TRACE2(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, ": Sending info elem to firmware, Enable=%d, MaximumConsecutiveET=%d\n", (TI_UINT32)pCfg->Enable, (TI_UINT32)pCfg->MaximumConsecutiveET);
1649
1650    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
1651}
1652
1653/****************************************************************************
1654 *                      cmdBld_CmdIeConfigureKeepAliveParams()
1655 ****************************************************************************
1656 * DESCRIPTION: Configure keep-alive parameters for a single template
1657 *
1658 * INPUTS:  hCmdBld     - handle to command builder object
1659 *          uIndex      - keep-alive index
1660 *          uEnaDisFlag - whether keep-alive is enabled or disables
1661 *          trigType    - send keep alive when TX is idle or always
1662 *          interval    - keep-alive interval
1663 *          fCB         - callback function for command complete
1664 *          hCb         - handle to be apssed to callback function
1665 *
1666 * OUTPUT:  None
1667 *
1668 * RETURNS: OK or NOK
1669 ****************************************************************************/
1670TI_STATUS cmdBld_CmdIeConfigureKeepAliveParams (TI_HANDLE hCmdBld, TI_UINT8 uIndex,
1671                                                TI_UINT8 uEnaDisFlag, TI_UINT8 trigType,
1672                                                TI_UINT32 interval, void *fCb, TI_HANDLE hCb)
1673{
1674    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
1675    AcxSetKeepAliveConfig_t ACXKeepAlive;
1676
1677    /* set IE header */
1678    ACXKeepAlive.EleHdr.id = ACX_SET_KEEP_ALIVE_CONFIG;
1679    ACXKeepAlive.EleHdr.len = sizeof (AcxSetKeepAliveConfig_t) - sizeof (EleHdrStruct);
1680
1681    /* set Keep-Alive values */
1682    ACXKeepAlive.index = uIndex;
1683    ACXKeepAlive.period = interval;
1684    ACXKeepAlive.trigger = trigType;
1685    ACXKeepAlive.valid = uEnaDisFlag;
1686
1687    TRACE4(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, ": Sending info elem to firmware, index=%d, enaDis=%d, trigType=%d, interval=%d\n", (TI_UINT32)ACXKeepAlive.index, (TI_UINT32)ACXKeepAlive.valid, (TI_UINT32)ACXKeepAlive.trigger, (TI_UINT32)ACXKeepAlive.period);
1688
1689    /* send the command to the FW */
1690    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, &ACXKeepAlive, sizeof(AcxSetKeepAliveConfig_t), fCb, hCb, NULL);
1691}
1692
1693/****************************************************************************
1694 *                      cmdBld_CmdIeConfigureKeepAliveParams()
1695 ****************************************************************************
1696 * DESCRIPTION: Configure keep-alive global enable / disable flag
1697 *
1698 * INPUTS:  enable / disable flag
1699 *
1700 * OUTPUT:  None
1701 *
1702 * RETURNS: OK or NOK
1703 ****************************************************************************/
1704TI_STATUS cmdBld_CmdIeConfigureKeepAliveEnaDis (TI_HANDLE hCmdBld, TI_UINT8 enaDisFlag,
1705                                                void *fCb, TI_HANDLE hCb)
1706{
1707    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
1708    AcxKeepAliveMode ACXKeepAliveMode;
1709
1710    /* set IE header */
1711    ACXKeepAliveMode.EleHdr.id = ACX_KEEP_ALIVE_MODE;
1712    ACXKeepAliveMode.EleHdr.len = sizeof (AcxKeepAliveMode) - sizeof (EleHdrStruct);
1713
1714    /* set Keep-Alive mode */
1715    ACXKeepAliveMode.modeEnabled = enaDisFlag;
1716
1717    TRACE1(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, ": Sending info elem to firmware, enaDis=%d\n", (TI_UINT32)ACXKeepAliveMode.modeEnabled);
1718
1719    /* send the command to the FW */
1720    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, &ACXKeepAliveMode, sizeof(AcxKeepAliveMode), fCb, hCb, NULL);
1721}
1722
1723/**
1724 * \fn     cmdBld_CfgIeSetFwHtCapabilities
1725 * \brief  set the current AP HT Capabilities to the FW.
1726 *
1727 * \note
1728 * \return TI_OK on success or TI_NOK on failure
1729 * \sa
1730 */
1731TI_STATUS cmdBld_CfgIeSetFwHtCapabilities (TI_HANDLE hCmdBld,
1732                                           TI_UINT32 uHtCapabilites,
1733                                           TMacAddr  tMacAddress,
1734                                           TI_UINT8  uAmpduMaxLeng,
1735                                           TI_UINT8  uAmpduMinSpac,
1736                                           void      *fCb,
1737                                           TI_HANDLE hCb)
1738{
1739    TCmdBld                         *pCmdBld = (TCmdBld *)hCmdBld;
1740    TAxcHtCapabilitiesIeFwInterface tAcxFwHtCap;
1741    TAxcHtCapabilitiesIeFwInterface *pCfg    = &tAcxFwHtCap;
1742
1743    /* Set information element header */
1744    pCfg->EleHdr.id = ACX_PEER_HT_CAP;
1745    pCfg->EleHdr.len = sizeof(tAcxFwHtCap) - sizeof(EleHdrStruct);
1746
1747    MAC_COPY (pCfg->aMacAddress, tMacAddress);
1748    pCfg->uHtCapabilites = uHtCapabilites;
1749    pCfg->uAmpduMaxLength = uAmpduMaxLeng;
1750    pCfg->uAmpduMinSpacing = uAmpduMinSpac;
1751
1752    TRACE9(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "cmdBld_CfgIeSetFwHtCapabilities: HtCapabilites=0x%x, AmpduMaxLength=%d, AmpduMinSpac=%d, MAC: %x:%x:%x:%x:%x:%x\n", uHtCapabilites, uAmpduMaxLeng, uAmpduMinSpac, pCfg->aMacAddress[0], pCfg->aMacAddress[1], pCfg->aMacAddress[2], pCfg->aMacAddress[3], pCfg->aMacAddress[4], pCfg->aMacAddress[5]);
1753
1754    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(TAxcHtCapabilitiesIeFwInterface), fCb, hCb, NULL);
1755
1756}
1757
1758/**
1759 * \fn     cmdBld_CfgIeSetFwHtInformation
1760 * \brief  set the current AP HT Information to the FW.
1761 *
1762 * \note
1763 * \return TI_OK on success or TI_NOK on failure
1764 * \sa
1765 */
1766TI_STATUS cmdBld_CfgIeSetFwHtInformation (TI_HANDLE hCmdBld,
1767                                          TI_UINT8  uRifsMode,
1768                                          TI_UINT8  uHtProtection,
1769                                          TI_UINT8  uGfProtection,
1770                                          TI_UINT8  uHtTxBurstLimit,
1771                                          TI_UINT8  uDualCtsProtection,
1772                                          void      *fCb,
1773                                          TI_HANDLE hCb)
1774{
1775    TCmdBld                        *pCmdBld = (TCmdBld *)hCmdBld;
1776    TAxcHtInformationIeFwInterface tAcxFwHtInf;
1777    TAxcHtInformationIeFwInterface *pCfg = &tAcxFwHtInf;
1778
1779    /* Set information element header */
1780    pCfg->EleHdr.id = ACX_HT_BSS_OPERATION;
1781    pCfg->EleHdr.len = sizeof(tAcxFwHtInf) - sizeof(EleHdrStruct);
1782
1783    pCfg->uRifsMode = uRifsMode;
1784    pCfg->uHtProtection = uHtProtection;
1785    pCfg->uGfProtection = uGfProtection;
1786    pCfg->uHtTxBurstLimit = uHtTxBurstLimit;
1787    pCfg->uDualCtsProtection = uDualCtsProtection;
1788
1789    TRACE5(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "cmdBld_CfgIeSetFwHtInformation: RifsMode=0x%x, HtProtection=0x%x, GfProtection=0x%x, HtTxBurstLimit=0x%x, DualCtsProtection=0x%x\n", uRifsMode, uHtProtection, uGfProtection, uHtTxBurstLimit, uDualCtsProtection);
1790
1791    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(TAxcHtInformationIeFwInterface), fCb, hCb, NULL);
1792}
1793
1794/**
1795 * \fn     cmdBld_CfgIeSetBaSession
1796 * \brief  configure BA session initiator\receiver parameters setting in the FW.
1797 *
1798 * \note
1799 * \return TI_OK on success or TI_NOK on failure
1800 * \sa
1801 */
1802TI_STATUS cmdBld_CfgIeSetBaSession (TI_HANDLE hCmdBld,
1803                                    InfoElement_e eBaType,
1804                                    TI_UINT8 uTid,
1805                                    TI_UINT8 uState,
1806                                    TMacAddr tRa,
1807                                    TI_UINT16 uWinSize,
1808                                    TI_UINT16 uInactivityTimeout,
1809                                    void *fCb,
1810                                    TI_HANDLE hCb)
1811{
1812    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
1813    TAxcBaSessionInitiatorResponderPolicy tAcxBaSessionPrm;
1814    TAxcBaSessionInitiatorResponderPolicy *pCfg = &tAcxBaSessionPrm;
1815
1816    /* Set information element header */
1817    pCfg->EleHdr.id = eBaType;
1818    pCfg->EleHdr.len = sizeof(tAcxBaSessionPrm) - sizeof(EleHdrStruct);
1819
1820    MAC_COPY (pCfg->aMacAddress, tRa);
1821    pCfg->uTid = uTid;
1822    pCfg->uPolicy = uState;
1823    pCfg->uWinSize = uWinSize;
1824
1825    if (eBaType == ACX_BA_SESSION_INITIATOR_POLICY)
1826    {
1827        pCfg->uInactivityTimeout = uInactivityTimeout;
1828    }
1829    else
1830    {
1831        if (eBaType == ACX_BA_SESSION_RESPONDER_POLICY)
1832        {
1833            pCfg->uInactivityTimeout = 0;
1834        }
1835        else
1836        {
1837            TRACE1(pCmdBld->hReport, REPORT_SEVERITY_ERROR, "cmdBld_CfgIeSetBaSession: error ID=%u\n", pCfg->EleHdr.id);
1838            return TI_NOK;
1839        }
1840    }
1841
1842    TRACE10(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "cmdBld_CfgIeSetBaSession: ID=, TID=%u, Policy=%u, MAC: %x:%x:%x:%x:%x:%x, uWinSize=%u, Timeout=%u\n", pCfg->uTid, pCfg->uPolicy, pCfg->aMacAddress[0], pCfg->aMacAddress[1], pCfg->aMacAddress[2], pCfg->aMacAddress[3], pCfg->aMacAddress[4], pCfg->aMacAddress[5], pCfg->uWinSize, pCfg->uInactivityTimeout);
1843
1844    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(TAxcBaSessionInitiatorResponderPolicy), fCb, hCb, NULL);
1845}
1846
1847/**
1848 * \fn     cmdBld_CfgIeRadioParams
1849 * \brief  configure radio parameters setting in the FW.
1850 *
1851 * \note
1852 * \return TI_OK on success or TI_NOK on failure
1853 * \sa
1854 */
1855TI_STATUS cmdBld_CfgIeRadioParams (TI_HANDLE hCmdBld, IniFileRadioParam *pIniFileRadioParams, void *fCb, TI_HANDLE hCb)
1856{
1857    static TTestCmd TestCmd;
1858    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
1859    TI_STATUS status = TI_NOK;
1860    TTestCmd *pTestCmd = &TestCmd;
1861
1862    pTestCmd->testCmdId = TEST_CMD_INI_FILE_RADIO_PARAM;
1863
1864    os_memoryCopy(pCmdBld->hOs, &pTestCmd->testCmd_u.IniFileRadioParams, pIniFileRadioParams, sizeof(IniFileRadioParam));
1865
1866    status = cmdQueue_SendCommand (pCmdBld->hCmdQueue,
1867                             CMD_TEST,
1868                             (void *)pTestCmd,
1869                             sizeof(IniFileRadioParam) + 4,
1870                             fCb,
1871                             hCb,
1872                             (void *)pTestCmd);
1873    return status;
1874}
1875
1876
1877TI_STATUS cmdBld_CfgPlatformGenParams (TI_HANDLE hCmdBld, IniFileGeneralParam *pGenParams, void *fCb, TI_HANDLE hCb)
1878{
1879    static TTestCmd TestCmd;
1880    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
1881    TI_STATUS status = TI_NOK;
1882    TTestCmd *pTestCmd = &TestCmd;
1883
1884    pTestCmd->testCmdId = TEST_CMD_INI_FILE_GENERAL_PARAM;
1885
1886    os_memoryCopy(pCmdBld->hOs, &pTestCmd->testCmd_u.IniFileGeneralParams, pGenParams, sizeof(IniFileGeneralParam));
1887
1888    status = cmdQueue_SendCommand (pCmdBld->hCmdQueue,
1889                              CMD_TEST,
1890                              (void *)pTestCmd,
1891                              sizeof(IniFileGeneralParam),
1892                              fCb,
1893                              hCb,
1894                              (void *)pTestCmd);
1895    return status;
1896}
1897
1898
1899/****************************************************************************
1900 *                      cmdBld_CfgIeBurstMode()
1901 ****************************************************************************
1902 * DESCRIPTION: Configure burst mode
1903 *
1904 * INPUTS:  hCmdBld     - handle to command builder object
1905 *          bEnabled    - is enabled flag
1906 *          fCB         - callback function for command complete
1907 *          hCb         - handle to be apssed to callback function
1908 *
1909 * OUTPUT:  None
1910 *
1911 * RETURNS: OK or NOK
1912 ****************************************************************************/
1913TI_STATUS cmdBld_CfgIeBurstMode (TI_HANDLE hCmdBld, TI_BOOL bEnabled, void *fCb, TI_HANDLE hCb)
1914{
1915	TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
1916	AcxBurstMode tAcxBurstMode;
1917	AcxBurstMode *pCfg = &tAcxBurstMode;
1918
1919	/* set IE header */
1920	pCfg->EleHdr.id = ACX_BURST_MODE;
1921	pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
1922
1923	/* set burst mode value */
1924	pCfg->enable = (uint8)bEnabled;
1925
1926	/* send the command to the FW */
1927	return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
1928}
1929
1930/****************************************************************************
1931 *                      cmdBld_CfgIeSRstate()
1932 ****************************************************************************
1933 * DESCRIPTION: Configure sart reflex state
1934 *
1935 * INPUTS:  hCmdBld     - handle to command builder object
1936 *          bEnabled    - is enabled flag
1937 *          fCB         - callback function for command complete
1938 *          hCb         - handle to be apssed to callback function
1939 *
1940 * OUTPUT:  None
1941 *
1942 * RETURNS: OK or NOK
1943 ****************************************************************************/
1944
1945TI_STATUS cmdBld_CfgIeSRState (TI_HANDLE hCmdBld, uint8 SRstate, void *fCb, TI_HANDLE hCb)
1946{
1947    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
1948    ACXSmartReflexState_t tSmartReflexState;
1949    ACXSmartReflexState_t *pCfg = &tSmartReflexState;
1950
1951    /* set IE header */
1952    pCfg->EleHdr.id = ACX_SET_SMART_REFLEX_STATE;
1953    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
1954
1955    /* set smart refelx state */
1956    pCfg->enable = SRstate;
1957
1958    /* send the command to the FW */
1959    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
1960
1961}
1962
1963/****************************************************************************
1964 *                      cmdBld_CfgIeSRParams()
1965 ****************************************************************************
1966 * DESCRIPTION: Configure sart reflex configuration
1967 * INPUTS:  hCmdBld     - handle to command builder object
1968 *          bEnabled    - is enabled flag
1969 *          fCB         - callback function for command complete
1970 *          hCb         - handle to be apssed to callback function
1971 *
1972 * OUTPUT:  None
1973 *
1974 * RETURNS: OK or NOK
1975 ****************************************************************************/
1976TI_STATUS cmdBld_CfgIeSRParams (TI_HANDLE hCmdBld, ACXSmartReflexConfigParams_t *pSRParam, void *fCb, TI_HANDLE hCb)
1977{
1978    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
1979    ACXSmartReflexConfigParams_t tSmartReflexParams;
1980    ACXSmartReflexConfigParams_t *pCfg = &tSmartReflexParams;
1981
1982    /* set IE header */
1983    pCfg->EleHdr.id = ACX_SET_SMART_REFLEX_PARAMS;
1984    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
1985
1986    /* copy smart reflex config params*/
1987    os_memoryCopy(pCmdBld->hOs, &pCfg->errorTable, pSRParam->errorTable, pCfg->EleHdr.len);
1988
1989    /* send the command to the FW */
1990    return  cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
1991}
1992
1993/****************************************************************************
1994 *                      cmdBld_CfgIeSRDebug()
1995 ****************************************************************************
1996 * DESCRIPTION: Send debug param just if it's configured in ini file
1997 * INPUTS:  hCmdBld     - handle to command builder object
1998 *          bEnabled    - is enabled flag
1999 *          fCB         - callback function for command complete
2000 *          hCb         - handle to be apssed to callback function
2001 *
2002 * OUTPUT:  None
2003 *
2004 * RETURNS: OK or NOK
2005 ****************************************************************************/
2006TI_STATUS cmdBld_CfgIeSRDebug (TI_HANDLE hCmdBld, ACXSmartReflexDebugParams_t *pSRDebug, void *fCb, TI_HANDLE hCb)
2007{
2008    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
2009    ACXSmartReflexDebugParams_t tSmartReflexDebug;
2010    ACXSmartReflexDebugParams_t *pCfg = &tSmartReflexDebug;
2011
2012   /* send this command to FW just in case it's initialize in ini file */
2013    if (pSRDebug->senNRN == 0) {
2014        return TI_NOK;
2015    }
2016
2017    /* set IE header */
2018    pCfg->EleHdr.id = ACX_SET_SMART_REFLEX_DEBUG;
2019    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
2020
2021    /* copy smart reflex debug params*/
2022    os_memoryCopy(pCmdBld->hOs, &pCfg->errorTable, &pSRDebug->errorTable, pCfg->EleHdr.len);
2023
2024    /* send the command to the FW */
2025    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
2026}
2027