• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * CmdBldCfgIE.c
3  *
4  * Copyright(c) 1998 - 2010 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  ****************************************************************************/
cmdBld_CfgIeConfigMemory(TI_HANDLE hCmdBld,TDmaParams * pDmaParams,void * fCb,TI_HANDLE hCb)59 TI_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        = pDmaParams->NumRxBlocks;
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  ****************************************************************************/
cmdBld_CfgIeSlotTime(TI_HANDLE hCmdBld,TI_UINT8 apSlotTime,void * fCb,TI_HANDLE hCb)101 TI_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  ****************************************************************************/
cmdBld_CfgIePreamble(TI_HANDLE hCmdBld,TI_UINT8 preamble,void * fCb,TI_HANDLE hCb)133 TI_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  ****************************************************************************/
cmdBld_CfgIeRx(TI_HANDLE hCmdBld,TI_UINT32 apRxConfigOption,TI_UINT32 apRxFilterOption,void * fCb,TI_HANDLE hCb)164 TI_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 ****************************************************************************/
cmdBld_CfgIeEnableRxDataFilter(TI_HANDLE hCmdBld,TI_BOOL enabled,filter_e defaultAction,void * fCb,TI_HANDLE hCb)193 TI_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 ****************************************************************************/
cmdBld_CfgIeRxDataFilter(TI_HANDLE hCmdBld,TI_UINT8 index,TI_UINT8 command,filter_e action,TI_UINT8 numFieldPatterns,TI_UINT8 lenFieldPatterns,TI_UINT8 * pFieldPatterns,void * fCb,TI_HANDLE hCb)232 TI_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  ****************************************************************************/
cmdBld_CfgIeArpIpFilter(TI_HANDLE hCmdBld,TIpAddr tIpAddr,EArpFilterType filterType,void * fCb,TI_HANDLE hCb)293 TI_STATUS cmdBld_CfgIeArpIpFilter (TI_HANDLE hCmdBld,
294                                    TIpAddr   tIpAddr,
295                                    EArpFilterType  filterType,
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_UINT8)filterType;
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), filterType);
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  ****************************************************************************/
cmdBld_CfgIeGroupAdressTable(TI_HANDLE hCmdBld,TI_UINT8 numGroupAddrs,TMacAddr * pGroupAddr,TI_BOOL bEnabled,void * fCb,TI_HANDLE hCb)330 TI_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  ****************************************************************************/
cmdBld_CfgIeSgEnable(TI_HANDLE hCmdBld,ESoftGeminiEnableModes SoftGeminiEnableModes,void * fCb,TI_HANDLE hCb)379 TI_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  ****************************************************************************/
cmdBld_CfgIeSg(TI_HANDLE hCmdBld,TSoftGeminiParams * pSoftGeminiParam,void * fCb,TI_HANDLE hCb)409 TI_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  ****************************************************************************/
cmdBld_CfgIeFmCoex(TI_HANDLE hCmdBld,TFmCoexParams * pFmCoexParams,void * fCb,TI_HANDLE hCb)455 TI_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  ****************************************************************************/
cmdBld_CfgIeMemoryMap(TI_HANDLE hCmdBld,MemoryMap_t * apMap,void * fCb,TI_HANDLE hCb)496 TI_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  ****************************************************************************/
cmdBld_CfgIeAid(TI_HANDLE hCmdBld,TI_UINT16 apAidVal,void * fCb,TI_HANDLE hCb)529 TI_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  ****************************************************************************/
cmdBld_CfgIeWakeUpCondition(TI_HANDLE hCmdBld,TPowerMgmtConfig * pPMConfig,void * fCb,TI_HANDLE hCb)556 TI_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  ****************************************************************************/
cmdBld_CfgIeSleepAuth(TI_HANDLE hCmdBld,EPowerPolicy eMinPowerLevel,void * fCb,TI_HANDLE hCb)606 TI_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  ****************************************************************************/
cmdBld_CfgIeBcnBrcOptions(TI_HANDLE hCmdBld,TPowerMgmtConfig * pPMConfig,void * fCb,TI_HANDLE hCb)673 TI_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  ****************************************************************************/
cmdBld_CfgIeFeatureConfig(TI_HANDLE hCmdBld,TI_UINT32 options,TI_UINT32 uDataFlowOptions,void * fCb,TI_HANDLE hCb)707 TI_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  ****************************************************************************/
cmdBld_CfgIeTxPowerDbm(TI_HANDLE hCmdBld,TI_UINT8 uTxPowerDbm,void * fCb,TI_HANDLE hCb)738 TI_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  ****************************************************************************/
cmdBld_CfgIeStatisitics(TI_HANDLE hCmdBld,void * fCb,TI_HANDLE hCb)768 TI_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     {
777         return status;
778     }
779 
780     /* Set information element header */
781     pCfg->EleHdr.id  = ACX_STATISTICS;
782     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
783 
784     status = cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
785     os_memoryFree(pCmdBld->hOs, pCfg, sizeof(ACXStatistics_t));
786     return status;
787 }
788 
789 
790 /****************************************************************************
791  *                      cmdBld_CfgIeTid()
792  ****************************************************************************
793  * DESCRIPTION: Write the Queue configuration (For Quality Of Service)
794  *
795  * INPUTS:
796  *
797  * OUTPUT:  None
798  *
799  * RETURNS: TI_OK or TI_NOK
800  ****************************************************************************/
cmdBld_CfgIeTid(TI_HANDLE hCmdBld,TQueueTrafficParams * pQtrafficParams,void * fCb,TI_HANDLE hCb)801 TI_STATUS cmdBld_CfgIeTid (TI_HANDLE hCmdBld, TQueueTrafficParams* pQtrafficParams, void *fCb, TI_HANDLE hCb)
802 
803 {
804     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
805     ACXTIDConfig_t    TrafficCategoryCfg;
806     ACXTIDConfig_t   *pCfg = &TrafficCategoryCfg;
807 
808     os_memoryZero (pCmdBld->hOs, (void *)pCfg, sizeof(*pCfg));
809 
810     /*
811      * Set information element header
812      * ==============================
813      */
814     pCfg->EleHdr.id = ACX_TID_CFG;
815     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
816 
817     /*
818      * Set information element Data
819      * ==============================
820      */
821     pCfg->queueID       = pQtrafficParams->queueID;
822     pCfg->channelType   = pQtrafficParams->channelType;
823     pCfg->tsid          = pQtrafficParams->tsid;
824     pCfg->psScheme      = pQtrafficParams->psScheme;
825     pCfg->APSDConf[0]   = pQtrafficParams->APSDConf[0];
826     pCfg->APSDConf[1]   = pQtrafficParams->APSDConf[1];
827 
828     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]);
829 
830     return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
831 }
832 
833 
834 /****************************************************************************
835  *                      cmdBld_CfgIeAcParams()
836  ****************************************************************************
837  * DESCRIPTION: Write the AC configuration (For Quality Of Service)
838  *
839  * INPUTS:
840  *
841  * OUTPUT:  None
842  *
843  * RETURNS: TI_OK or TI_NOK
844  ****************************************************************************/
cmdBld_CfgIeAcParams(TI_HANDLE hCmdBld,TAcQosParams * pAcQosParams,void * fCb,TI_HANDLE hCb)845 TI_STATUS cmdBld_CfgIeAcParams (TI_HANDLE hCmdBld, TAcQosParams *pAcQosParams, void *fCb, TI_HANDLE hCb)
846 {
847     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
848     ACXAcCfg_t     AcCfg;
849     ACXAcCfg_t    *pCfg  = &AcCfg;
850 
851     os_memoryZero (pCmdBld->hOs, (void *)pCfg, sizeof(*pCfg));
852 
853     /*
854      * Set information element header
855      * ==============================
856      */
857     pCfg->EleHdr.id = ACX_AC_CFG;
858     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
859 
860     /*
861      * Set information element Data
862      * ==============================
863      */
864 
865     pCfg->ac        = pAcQosParams->ac;
866     pCfg->aifsn     = pAcQosParams->aifsn;
867     pCfg->cwMax     = ENDIAN_HANDLE_WORD(pAcQosParams->cwMax);
868     pCfg->cwMin     = pAcQosParams->cwMin;
869     pCfg->txopLimit = ENDIAN_HANDLE_WORD(pAcQosParams->txopLimit);
870 
871     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);
872 
873     return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
874 }
875 
876 
877 /****************************************************************************
878  *                      cmdBld_CfgIePsRxStreaming()
879  ****************************************************************************
880  * DESCRIPTION: Write the AC PS-Rx-Streaming
881  *
882  * INPUTS:
883  *
884  * OUTPUT:  None
885  *
886  * RETURNS: TI_OK or TI_NOK
887  ****************************************************************************/
cmdBld_CfgIePsRxStreaming(TI_HANDLE hCmdBld,TPsRxStreaming * pPsRxStreaming,void * fCb,TI_HANDLE hCb)888 TI_STATUS cmdBld_CfgIePsRxStreaming (TI_HANDLE hCmdBld, TPsRxStreaming *pPsRxStreaming, void *fCb, TI_HANDLE hCb)
889 {
890     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
891     ACXPsRxStreaming_t  tStreamingCfg;
892     ACXPsRxStreaming_t *pCfg  = &tStreamingCfg;
893 
894     os_memoryZero (pCmdBld->hOs, (void *)pCfg, sizeof(*pCfg));
895 
896     /*
897      * Set information element header
898      * ==============================
899      */
900     pCfg->EleHdr.id = ACX_PS_RX_STREAMING;
901     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
902 
903     /*
904      * Set information element Data
905      * ============================
906      */
907     pCfg->TID          = (TI_UINT8)pPsRxStreaming->uTid;
908     pCfg->rxPSDEnabled = (TI_UINT8)pPsRxStreaming->bEnabled;
909     pCfg->streamPeriod = (TI_UINT8)pPsRxStreaming->uStreamPeriod;
910     pCfg->txTimeout    = (TI_UINT8)pPsRxStreaming->uTxTimeout;
911 
912     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);
913 
914     return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
915 }
916 
917 
918 /****************************************************************************
919  *                      cmdBld_CfgIePacketDetectionThreshold()
920  ****************************************************************************
921  * DESCRIPTION:  Set the PacketDetection threshold
922  *
923  * INPUTS:
924  *
925  * OUTPUT:  None
926  *
927  * RETURNS: TI_OK or TI_NOK
928  ****************************************************************************/
cmdBld_CfgIePacketDetectionThreshold(TI_HANDLE hCmdBld,TI_UINT32 pdThreshold,void * fCb,TI_HANDLE hCb)929 TI_STATUS cmdBld_CfgIePacketDetectionThreshold (TI_HANDLE hCmdBld, TI_UINT32 pdThreshold, void *fCb, TI_HANDLE hCb)
930 {
931     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
932     ACXPacketDetection_t  PacketDetectionThresholdCfg;
933     ACXPacketDetection_t *pCfg = &PacketDetectionThresholdCfg;
934 
935     /*
936      * Set information element header
937      * ==============================
938      */
939     pCfg->EleHdr.id = ACX_PD_THRESHOLD;
940     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
941 
942     /*
943      * Set information element Data
944      * ==============================
945      */
946     pCfg->pdThreshold = ENDIAN_HANDLE_LONG(pdThreshold);
947 
948     TRACE2(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, ": pdThreshold = 0x%x , len = 0x%x \n",pCfg->pdThreshold,pCfg->EleHdr.len);
949 
950     return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
951 }
952 
953 
954 
955 
956 /****************************************************************************
957  *                      cmdBld_CfgIeBeaconFilterOpt()
958  ****************************************************************************
959  * DESCRIPTION: Configure/Interrogate the beacon filtering option
960  *
961  * INPUTS:
962  *
963  * OUTPUT:  None
964  *
965  * RETURNS: TI_OK or TI_NOK
966  ****************************************************************************/
cmdBld_CfgIeBeaconFilterOpt(TI_HANDLE hCmdBld,TI_UINT8 beaconFilteringStatus,TI_UINT8 numOfBeaconsToBuffer,void * fCb,TI_HANDLE hCb)967 TI_STATUS cmdBld_CfgIeBeaconFilterOpt (TI_HANDLE hCmdBld, TI_UINT8 beaconFilteringStatus, TI_UINT8 numOfBeaconsToBuffer, void *fCb, TI_HANDLE hCb)
968 {
969     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
970     ACXBeaconFilterOptions_t  ACXBeaconFilterOptions;
971     ACXBeaconFilterOptions_t *pCfg = &ACXBeaconFilterOptions;
972 
973     pCfg->enable = beaconFilteringStatus;
974     pCfg->maxNumOfBeaconsStored = numOfBeaconsToBuffer;
975 
976     /* Set information element header */
977     pCfg->EleHdr.id = ACX_BEACON_FILTER_OPT;
978     pCfg->EleHdr.len = sizeof(ACXBeaconFilterOptions_t) - sizeof(EleHdrStruct);
979 
980     TRACE3(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "ID=%u: enable=%u, num-stored=%u\n", pCfg->EleHdr.id, beaconFilteringStatus, numOfBeaconsToBuffer);
981 
982     return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(ACXBeaconFilterOptions_t), fCb, hCb, NULL);
983 }
984 /****************************************************************************
985  *                      cmdBld_CfgIeRateMngDbg()
986  ****************************************************************************
987  * DESCRIPTION: Configure the rate managment params
988  * INPUTS:
989  *
990  * OUTPUT:  None
991  *
992  * RETURNS: TI_OK or TI_NOK
993  ****************************************************************************/
994 
cmdBld_CfgIeRateMngDbg(TI_HANDLE hCmdBld,RateMangeParams_t * pRateMngParams,void * fCb,TI_HANDLE hCb)995 TI_STATUS cmdBld_CfgIeRateMngDbg (TI_HANDLE hCmdBld, RateMangeParams_t *pRateMngParams, void *fCb, TI_HANDLE hCb)
996 {
997     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
998     AcxRateMangeParams  RateMng;
999     AcxRateMangeParams *pCfg = &RateMng;
1000 	int i;
1001 
1002     /* Set information element header */
1003     pCfg->EleHdr.id = ACX_SET_RATE_MAMAGEMENT_PARAMS;
1004     pCfg->EleHdr.len = sizeof(AcxRateMangeParams) - sizeof(EleHdrStruct);
1005 
1006 
1007     TRACE2(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "ID=%u, index=%d \n",pCfg->EleHdr.id,pRateMngParams->paramIndex);
1008 
1009 	pCfg->paramIndex = pRateMngParams->paramIndex;
1010 
1011 	pCfg->InverseCuriosityFactor = pRateMngParams->InverseCuriosityFactor;
1012     pCfg->MaxPer = pRateMngParams->MaxPer;
1013 	pCfg->PerAdd = pRateMngParams->PerAdd;
1014 	pCfg->PerAddShift = pRateMngParams->PerAddShift;
1015 	pCfg->PerAlphaShift = pRateMngParams->PerAlphaShift;
1016 	pCfg->PerBeta1Shift = pRateMngParams->PerBeta1Shift;
1017 	pCfg->PerBeta2Shift = pRateMngParams->PerBeta2Shift;
1018 	pCfg->PerTh1 = pRateMngParams->PerTh1;
1019 	pCfg->PerTh2 = pRateMngParams->PerTh2;
1020 	pCfg->RateCheckDown = pRateMngParams->RateCheckDown;
1021 	pCfg->RateCheckUp = pRateMngParams->RateCheckUp;
1022 	pCfg->RateRetryScore = pRateMngParams->RateRetryScore;
1023 	pCfg->TxFailHighTh = pRateMngParams->TxFailHighTh;
1024 	pCfg->TxFailLowTh = pRateMngParams->TxFailLowTh;
1025 
1026 	for (i=0 ; i< 13 ; i++)
1027 	{
1028 		pCfg->RateRetryPolicy[i] = pRateMngParams->RateRetryPolicy[i];
1029 	}
1030 
1031     return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(AcxRateMangeParams), fCb, hCb, NULL);
1032 }
1033 
1034 
1035 
1036 /****************************************************************************
1037  *                     cmdBld_CfgIeBeaconFilterTable
1038  ****************************************************************************
1039  * DESCRIPTION: Configure/Interrogate the beacon filter IE table
1040  *
1041  * INPUTS:
1042  *
1043  * OUTPUT:  None
1044  *
1045  * RETURNS: TI_OK or TI_NOK
1046  ****************************************************************************/
cmdBld_CfgIeBeaconFilterTable(TI_HANDLE hCmdBld,TI_UINT8 uNumberOfIEs,TI_UINT8 * pIETable,TI_UINT8 uIETableSize,void * fCb,TI_HANDLE hCb)1047 TI_STATUS cmdBld_CfgIeBeaconFilterTable (TI_HANDLE hCmdBld,
1048                                          TI_UINT8   uNumberOfIEs,
1049                                          TI_UINT8  *pIETable,
1050                                          TI_UINT8   uIETableSize,
1051                                          void      *fCb,
1052                                          TI_HANDLE  hCb)
1053 {
1054     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
1055     ACXBeaconFilterIETable_t beaconFilterIETableStruct;
1056     ACXBeaconFilterIETable_t *pCfg = &beaconFilterIETableStruct;
1057     TI_UINT32 counter;
1058 
1059     if (NULL == pIETable)
1060     {
1061         return PARAM_VALUE_NOT_VALID;
1062     }
1063 
1064     pCfg->EleHdr.id = ACX_BEACON_FILTER_TABLE;
1065     pCfg->EleHdr.len = uIETableSize + 1;
1066     pCfg->NumberOfIEs = uNumberOfIEs;
1067 
1068     os_memoryZero (pCmdBld->hOs, (void *)pCfg->IETable, BEACON_FILTER_TABLE_MAX_SIZE);
1069     os_memoryCopy (pCmdBld->hOs, (void *)pCfg->IETable, (void *)pIETable, uIETableSize);
1070 
1071     TRACE3(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "ID=%u: num-ie=%u, table-size=%u\n", pCfg->EleHdr.id, uNumberOfIEs, uIETableSize);
1072 
1073 TRACE0(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "Beacon IE Table:\n");
1074     for (counter = 0; counter < uIETableSize; counter++)
1075     {
1076 TRACE1(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "%2x ", pIETable[counter]);
1077 	}
1078 TRACE0(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "\n");
1079 
1080     return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(ACXBeaconFilterIETable_t), fCb, hCb, NULL);
1081 }
1082 
1083 /****************************************************************************
1084  *                     cmdBld_CfgCoexActivity
1085  ****************************************************************************
1086  * DESCRIPTION: Configure/Interrogate the Coex activity IE
1087  *
1088  * INPUTS:
1089  *
1090  * OUTPUT:  None
1091  *
1092  * RETURNS: TI_OK or TI_NOK
1093  ****************************************************************************/
cmdBld_CfgIeCoexActivity(TI_HANDLE hCmdBld,TCoexActivity * pCoexActivity,void * fCb,TI_HANDLE hCb)1094 TI_STATUS cmdBld_CfgIeCoexActivity (TI_HANDLE hCmdBld,
1095                                          TCoexActivity  *pCoexActivity,
1096                                          void      *fCb,
1097                                          TI_HANDLE  hCb)
1098 {
1099     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
1100     ACXCoexActivityIE_t coexActivityIEStruct;
1101     ACXCoexActivityIE_t *pCfg = &coexActivityIEStruct;
1102 
1103     if (NULL == pCoexActivity)
1104     {
1105         return PARAM_VALUE_NOT_VALID;
1106     }
1107 
1108     pCfg->EleHdr.id = ACX_COEX_ACTIVITY;
1109     pCfg->EleHdr.len = sizeof(ACXCoexActivityIE_t) - sizeof(EleHdrStruct);
1110 
1111     TRACE1(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "CoexActivity: ID=0x%x\n", pCfg->EleHdr.id);
1112 
1113     pCfg->coexIp          = pCoexActivity->coexIp;
1114     pCfg->activityId      = pCoexActivity->activityId;
1115     pCfg->defaultPriority = pCoexActivity->defaultPriority;
1116     pCfg->raisedPriority  = pCoexActivity->raisedPriority;
1117     pCfg->minService      = ENDIAN_HANDLE_WORD(pCoexActivity->minService);
1118     pCfg->maxService      = ENDIAN_HANDLE_WORD(pCoexActivity->maxService);
1119 
1120     TRACE6(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "CoexActivity: 0x%02x 0x%02x - 0x%02x 0x%02x 0x%04x 0x%04x\n",
1121             pCfg->coexIp,
1122             pCfg->activityId,
1123             pCfg->defaultPriority,
1124             pCfg->raisedPriority,
1125             pCfg->minService,
1126             pCfg->maxService);
1127 
1128     return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
1129 }
1130 
1131 /****************************************************************************
1132  *                      cmdBld_CfgIeCcaThreshold()
1133  ****************************************************************************
1134  * DESCRIPTION: Configure/Interrogate the Slot Time
1135  *
1136  * INPUTS:  None
1137  *
1138  * OUTPUT:  None
1139  *
1140  * RETURNS: TI_OK or TI_NOK
1141  ****************************************************************************/
cmdBld_CfgIeCcaThreshold(TI_HANDLE hCmdBld,TI_UINT16 ccaThreshold,void * fCb,TI_HANDLE hCb)1142 TI_STATUS cmdBld_CfgIeCcaThreshold (TI_HANDLE hCmdBld, TI_UINT16 ccaThreshold, void *fCb, TI_HANDLE hCb)
1143 {
1144     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
1145     ACXEnergyDetection_t AcxElm_CcaThreshold;
1146     ACXEnergyDetection_t *pCfg = &AcxElm_CcaThreshold;
1147 
1148     /* Set information element header */
1149     pCfg->EleHdr.id = ACX_CCA_THRESHOLD;
1150     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
1151 
1152     pCfg->rxCCAThreshold = ENDIAN_HANDLE_WORD(ccaThreshold);
1153 
1154     return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
1155 }
1156 
1157 
1158 /****************************************************************************
1159  *                      cmdBld_CfgIeEventMask()
1160  ****************************************************************************
1161  * DESCRIPTION: Change the Event Vector Mask in the FW
1162  *
1163  * INPUTS: MaskVector   The Updated Vector Mask
1164  *
1165  * RETURNS: TI_OK or TI_NOK
1166  ****************************************************************************/
cmdBld_CfgIeEventMask(TI_HANDLE hCmdBld,TI_UINT32 mask,void * fCb,TI_HANDLE hCb)1167 TI_STATUS cmdBld_CfgIeEventMask (TI_HANDLE hCmdBld, TI_UINT32 mask, void *fCb, TI_HANDLE hCb)
1168 {
1169     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
1170 
1171     ACXEventMboxMask_t EventMboxData;
1172     ACXEventMboxMask_t *pCfg = &EventMboxData;
1173 
1174     /* Set information element header*/
1175     pCfg->EleHdr.id = ACX_EVENT_MBOX_MASK;
1176     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
1177     pCfg->lowEventMask = ENDIAN_HANDLE_LONG(mask);
1178     pCfg->highEventMask = ENDIAN_HANDLE_LONG(0xffffffff); /* Not in Use */
1179 
1180     TRACE0(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "cmdBld_CfgIeEventMask:\n");
1181 
1182     return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
1183 }
1184 
1185 
1186 /****************************************************************************
1187  *                      cmdBld_CfgIeMaxTxRetry()
1188  ****************************************************************************
1189  * DESCRIPTION: Configure the Max Tx Retry parameters
1190  *
1191  * INPUTS:  None
1192  *
1193  * OUTPUT:  None
1194  *
1195  * RETURNS: TI_OK or TI_NOK
1196  ****************************************************************************/
cmdBld_CfgIeMaxTxRetry(TI_HANDLE hCmdBld,TRroamingTriggerParams * pRoamingTriggerCmd,void * fCb,TI_HANDLE hCb)1197 TI_STATUS cmdBld_CfgIeMaxTxRetry (TI_HANDLE hCmdBld,
1198                                   TRroamingTriggerParams *pRoamingTriggerCmd,
1199                                   void      *fCb,
1200                                   TI_HANDLE hCb)
1201 {
1202     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
1203     ACXConsTxFailureTriggerParameters_t AcxElm_SetMaxTxRetry;
1204     ACXConsTxFailureTriggerParameters_t* pCfg = &AcxElm_SetMaxTxRetry;
1205 
1206     pCfg->maxTxRetry = pRoamingTriggerCmd->maxTxRetry;
1207 
1208     /* Set information element header */
1209     pCfg->EleHdr.id = ACX_CONS_TX_FAILURE;
1210     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
1211 
1212     return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
1213 }
1214 
1215 
1216 /****************************************************************************
1217  *                      cmdBld_CfgIeConnMonitParams()
1218  ****************************************************************************
1219  * DESCRIPTION: Configure the Bss Lost Timeout & TSF miss threshold
1220  *
1221  * INPUTS:  None
1222  *
1223  * OUTPUT:  None
1224  *
1225  * RETURNS: TI_OK or TI_NOK
1226  ****************************************************************************/
cmdBld_CfgIeConnMonitParams(TI_HANDLE hCmdBld,TRroamingTriggerParams * pRoamingTriggerCmd,void * fCb,TI_HANDLE hCb)1227 TI_STATUS cmdBld_CfgIeConnMonitParams (TI_HANDLE hCmdBld, TRroamingTriggerParams *pRoamingTriggerCmd, void *fCb, TI_HANDLE hCb)
1228 {
1229     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
1230     AcxConnectionMonitorOptions  AcxElm_SetBssLossTsfThreshold;
1231     AcxConnectionMonitorOptions* pCfg = &AcxElm_SetBssLossTsfThreshold;
1232 
1233     pCfg->BSSLossTimeout     = ENDIAN_HANDLE_LONG(pRoamingTriggerCmd->BssLossTimeout);
1234     pCfg->TSFMissedThreshold = ENDIAN_HANDLE_LONG(pRoamingTriggerCmd->TsfMissThreshold);
1235 
1236     /* Set information element header */
1237     pCfg->EleHdr.id  = ACX_CONN_MONIT_PARAMS;
1238     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
1239 
1240     return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
1241 }
1242 
1243 
1244 /****************************************************************************
1245  *                      cmdBld_CfgIeTxRatePolicy()
1246  ****************************************************************************
1247  * DESCRIPTION: Write the TxRateClass configuration
1248  *
1249  * INPUTS:
1250  *
1251  * OUTPUT:  None
1252  *
1253  * RETURNS: TI_OK or TI_NOK
1254  ****************************************************************************/
cmdBld_CfgIeTxRatePolicy(TI_HANDLE hCmdBld,TTxRatePolicy * pTxRatePolicy,void * fCb,TI_HANDLE hCb)1255 TI_STATUS cmdBld_CfgIeTxRatePolicy (TI_HANDLE hCmdBld, TTxRatePolicy *pTxRatePolicy, void *fCb, TI_HANDLE hCb)
1256 {
1257     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
1258     ACXTxAttrClasses_t  TxClassCfg;
1259     ACXTxAttrClasses_t *pCfg  = &TxClassCfg;
1260     TI_UINT8 PolicyId;
1261 
1262     os_memoryZero (pCmdBld->hOs, (void *)pCfg, sizeof(*pCfg));
1263 
1264     /*
1265      * Set information element header
1266      * ==============================
1267      */
1268     pCfg->EleHdr.id = ACX_RATE_POLICY;
1269     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
1270     pCfg->numOfClasses = pTxRatePolicy->numOfRateClasses;
1271 
1272     for (PolicyId = 0; PolicyId < pTxRatePolicy->numOfRateClasses; PolicyId++)
1273     {
1274         os_memoryCopy (pCmdBld->hOs,
1275                        (void *)&(pCfg->rateClasses[PolicyId]),
1276                        (void *)&(pTxRatePolicy->rateClass[PolicyId]),
1277                        sizeof(TTxRateClass));
1278     }
1279 
1280     return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
1281 }
1282 
1283 
1284 /****************************************************************************
1285  *                      cmdBld_CfgIeRtsThreshold()
1286  ****************************************************************************
1287  * DESCRIPTION: Configure the RTS threshold
1288  *
1289  * INPUTS:  None
1290  *
1291  * OUTPUT:  None
1292  *
1293  * RETURNS: TI_OK or TI_NOK
1294  ****************************************************************************/
cmdBld_CfgIeRtsThreshold(TI_HANDLE hCmdBld,TI_UINT16 uRtsThreshold,void * fCb,TI_HANDLE hCb)1295 TI_STATUS cmdBld_CfgIeRtsThreshold (TI_HANDLE hCmdBld, TI_UINT16 uRtsThreshold, void *fCb, TI_HANDLE hCb)
1296 {
1297     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
1298     dot11RTSThreshold_t AcxElm_RtsThreshold;
1299     dot11RTSThreshold_t *pCfg = &AcxElm_RtsThreshold;
1300 
1301     /* Set information element header */
1302     pCfg->EleHdr.id = DOT11_RTS_THRESHOLD;
1303     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
1304 
1305     pCfg->RTSThreshold = ENDIAN_HANDLE_WORD(uRtsThreshold);
1306 
1307     return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
1308 }
1309 
1310 
1311 /****************************************************************************
1312  *                      cmdBld_CfgIeRtsThreshold()
1313  ****************************************************************************
1314  * DESCRIPTION: Configure the tx fragmentation threshold
1315  *
1316  * INPUTS:  None
1317  *
1318  * OUTPUT:  None
1319  *
1320  * RETURNS: TI_OK or TI_NOK
1321  ****************************************************************************/
cmdBld_CfgIeFragmentThreshold(TI_HANDLE hCmdBld,TI_UINT16 uFragmentThreshold,void * fCb,TI_HANDLE hCb)1322 TI_STATUS cmdBld_CfgIeFragmentThreshold (TI_HANDLE hCmdBld, TI_UINT16 uFragmentThreshold, void *fCb, TI_HANDLE hCb)
1323 {
1324     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
1325     ACXFRAGThreshold_t AcxElm_FragmentThreshold;
1326     ACXFRAGThreshold_t *pCfg = &AcxElm_FragmentThreshold;
1327 
1328     /* Set information element header */
1329     pCfg->EleHdr.id = ACX_FRAG_CFG;
1330     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
1331 
1332     pCfg->fragThreshold = ENDIAN_HANDLE_WORD(uFragmentThreshold);
1333 
1334     return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
1335 }
1336 
1337 
1338 /****************************************************************************
1339  *                      cmdBld_CfgIePmConfig()
1340  ****************************************************************************
1341  * DESCRIPTION: Configure PM parameters
1342  *
1343  * INPUTS:  None
1344  *
1345  * OUTPUT:  None
1346  *
1347  * RETURNS: TI_OK or TI_NOK
1348  ****************************************************************************/
cmdBld_CfgIePmConfig(TI_HANDLE hCmdBld,TI_UINT32 uHostClkSettlingTime,TI_UINT8 uHostFastWakeupSupport,void * fCb,TI_HANDLE hCb)1349 TI_STATUS cmdBld_CfgIePmConfig (TI_HANDLE   hCmdBld,
1350                                 TI_UINT32   uHostClkSettlingTime,
1351                                 TI_UINT8    uHostFastWakeupSupport,
1352                                 void *      fCb,
1353                                 TI_HANDLE   hCb)
1354 {
1355     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
1356     ACXPMConfig_t tPmConfig;
1357     ACXPMConfig_t *pCfg = &tPmConfig;
1358 
1359     /* Set information element header*/
1360     pCfg->EleHdr.id  = ACX_PM_CONFIG;
1361     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
1362 
1363     pCfg->hostClkSettlingTime   = uHostClkSettlingTime;
1364     pCfg->hostFastWakeupSupport = uHostFastWakeupSupport;
1365 
1366     return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
1367 }
1368 
1369 
1370 /****************************************************************************
1371  *                      cmdBld_CfgIeTxCmpltPacing()
1372  ****************************************************************************
1373  * DESCRIPTION: Configure Tx-Complete interrupt pacing to FW
1374  *
1375  * INPUTS:  None
1376  *
1377  * OUTPUT:  None
1378  *
1379  * RETURNS: TI_OK or TI_NOK
1380  ****************************************************************************/
cmdBld_CfgIeTxCmpltPacing(TI_HANDLE hCmdBld,TI_UINT16 uTxCompletePacingThreshold,TI_UINT16 uTxCompletePacingTimeout,void * fCb,TI_HANDLE hCb)1381 TI_STATUS cmdBld_CfgIeTxCmpltPacing (TI_HANDLE  hCmdBld,
1382                                      TI_UINT16  uTxCompletePacingThreshold,
1383                                      TI_UINT16  uTxCompletePacingTimeout,
1384                                      void *     fCb,
1385                                      TI_HANDLE  hCb)
1386 {
1387     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
1388     ACXTxConfigOptions_t  tTxCmpltPacing;
1389     ACXTxConfigOptions_t  *pCfg = &tTxCmpltPacing;
1390 
1391     /* Set information element header */
1392     pCfg->EleHdr.id  = ACX_TX_CONFIG_OPT;
1393     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
1394 
1395     pCfg->txCompleteThreshold = ENDIAN_HANDLE_WORD(uTxCompletePacingThreshold);
1396     pCfg->txCompleteTimeout   = ENDIAN_HANDLE_WORD(uTxCompletePacingTimeout);
1397 
1398     return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
1399 }
1400 
1401 
1402 /****************************************************************************
1403  *                      cmdBld_CfgIeRxIntrPacing()
1404  ****************************************************************************
1405  * DESCRIPTION: Configure Rx-Complete interrupt pacing to FW
1406  *
1407  * INPUTS:  None
1408  *
1409  * OUTPUT:  None
1410  *
1411  * RETURNS: TI_OK or TI_NOK
1412  ****************************************************************************/
cmdBld_CfgIeRxIntrPacing(TI_HANDLE hCmdBld,TI_UINT16 uRxIntrPacingThreshold,TI_UINT16 uRxIntrPacingTimeout,void * fCb,TI_HANDLE hCb)1413 TI_STATUS cmdBld_CfgIeRxIntrPacing (TI_HANDLE  hCmdBld,
1414                                     TI_UINT16  uRxIntrPacingThreshold,
1415                                     TI_UINT16  uRxIntrPacingTimeout,
1416                                     void *     fCb,
1417                                     TI_HANDLE  hCb)
1418 {
1419     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
1420     ACXRxBufferingConfig_t  tRxIntrPacing;
1421     ACXRxBufferingConfig_t  *pCfg = &tRxIntrPacing;
1422 
1423     /* Set information element header */
1424     pCfg->EleHdr.id  = ACX_RX_CONFIG_OPT;
1425     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
1426 
1427     pCfg->rxPktThreshold    = ENDIAN_HANDLE_WORD(uRxIntrPacingThreshold);
1428     pCfg->rxCompleteTimeout = ENDIAN_HANDLE_WORD(uRxIntrPacingTimeout);
1429     pCfg->rxMblkThreshold   = ENDIAN_HANDLE_WORD(0xFFFF);    /* Set to maximum so it has no effect (only the PktThreshold is used) */
1430     pCfg->rxQueueType       = RX_QUEUE_TYPE_RX_LOW_PRIORITY; /* Only low priority data packets are buffered */
1431 
1432     return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
1433 }
1434 
1435 
1436 /****************************************************************************
1437 *                      cmdBld_CfgIeCtsProtection()
1438  ****************************************************************************
1439  * DESCRIPTION: Configure The Cts to self feature
1440  *
1441  * INPUTS:  None
1442  *
1443  * OUTPUT:  None
1444  *
1445  * RETURNS: TI_OK or TI_NOK
1446  ****************************************************************************/
cmdBld_CfgIeCtsProtection(TI_HANDLE hCmdBld,TI_UINT8 ctsProtection,void * fCb,TI_HANDLE hCb)1447 TI_STATUS cmdBld_CfgIeCtsProtection (TI_HANDLE hCmdBld, TI_UINT8 ctsProtection, void *fCb, TI_HANDLE hCb)
1448 {
1449     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
1450     ACXCtsProtection_t AcxElm_CtsToSelf;
1451     ACXCtsProtection_t *pCfg = &AcxElm_CtsToSelf;
1452 
1453     /* Set information element header*/
1454     pCfg->EleHdr.id = ACX_CTS_PROTECTION;
1455     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
1456 
1457     pCfg->ctsProtectMode = ctsProtection;
1458 
1459     return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
1460 }
1461 
1462 
1463 /****************************************************************************
1464  *                      cmdBld_CfgIeRxMsduLifeTime()
1465  ****************************************************************************
1466  * DESCRIPTION: Configure The Cts to self feature
1467  *
1468  * INPUTS:  None
1469  *
1470  * OUTPUT:  None
1471  *
1472  * RETURNS: TI_OK or TI_NOK
1473  ****************************************************************************/
cmdBld_CfgIeRxMsduLifeTime(TI_HANDLE hCmdBld,TI_UINT32 RxMsduLifeTime,void * fCb,TI_HANDLE hCb)1474 TI_STATUS cmdBld_CfgIeRxMsduLifeTime (TI_HANDLE hCmdBld, TI_UINT32 RxMsduLifeTime, void *fCb, TI_HANDLE hCb)
1475 {
1476     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
1477     dot11RxMsduLifeTime_t   AcxElm_RxMsduLifeTime;
1478     dot11RxMsduLifeTime_t *pCfg = &AcxElm_RxMsduLifeTime;
1479 
1480     /* Set information element header*/
1481     pCfg->EleHdr.id = DOT11_RX_MSDU_LIFE_TIME;
1482     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
1483     pCfg->RxMsduLifeTime = RxMsduLifeTime;
1484 
1485     TRACE2(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, ": RxMsduLifeTime = 0x%x, len = 0x%x\n",pCfg->RxMsduLifeTime,pCfg->EleHdr.len);
1486 
1487     return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
1488 }
1489 
1490 
1491 /****************************************************************************
1492  *                      cmdBld_CfgIeServicePeriodTimeout()
1493  ****************************************************************************
1494  * DESCRIPTION: Configure The Rx Time Out
1495  *
1496  * INPUTS:  None
1497  *
1498  * OUTPUT:  None
1499  *
1500  * RETURNS: TI_OK or TI_NOK
1501  ****************************************************************************/
cmdBld_CfgIeServicePeriodTimeout(TI_HANDLE hCmdBld,TRxTimeOut * pRxTimeOut,void * fCb,TI_HANDLE hCb)1502 TI_STATUS cmdBld_CfgIeServicePeriodTimeout (TI_HANDLE hCmdBld, TRxTimeOut* pRxTimeOut, void *fCb, TI_HANDLE hCb)
1503 {
1504     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
1505     ACXRxTimeout_t AcxElm_rxTimeOut;
1506     ACXRxTimeout_t *pCfg = &AcxElm_rxTimeOut;
1507 
1508     /* Set information element header*/
1509     pCfg->EleHdr.id = ACX_SERVICE_PERIOD_TIMEOUT;
1510     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
1511 
1512     pCfg->PsPollTimeout = pRxTimeOut->psPoll;
1513     pCfg->UpsdTimeout   = pRxTimeOut->UPSD;
1514 
1515     return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
1516 }
1517 
1518 
1519 /****************************************************************************
1520  *                      cmdBld_CfgIePsWmm()
1521  ****************************************************************************
1522  * DESCRIPTION: Configure The PS for WMM
1523  *
1524  * INPUTS:   TI_TRUE  - Configure PS to work on WMM mode - do not send the NULL/PS_POLL
1525  *                   packets even if TIM is set.
1526  *           TI_FALSE - Configure PS to work on Non-WMM mode - work according to the
1527  *                   standard
1528  *
1529  * RETURNS: TI_OK or TI_NOK
1530  ****************************************************************************/
cmdBld_CfgIePsWmm(TI_HANDLE hCmdBld,TI_BOOL enableWA,void * fCb,TI_HANDLE hCb)1531 TI_STATUS cmdBld_CfgIePsWmm (TI_HANDLE hCmdBld, TI_BOOL enableWA, void *fCb, TI_HANDLE hCb)
1532 {
1533     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
1534     ACXConfigPsWmm_t  ConfigPsWmm;
1535     ACXConfigPsWmm_t *pCfg = &ConfigPsWmm;
1536 
1537     /*
1538      * Set information element header
1539      */
1540     pCfg->EleHdr.id = ACX_CONFIG_PS_WMM;
1541     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
1542 
1543     pCfg->ConfigPsOnWmmMode = enableWA;
1544 
1545     /* Report the meesage only if we are using the WiFi patch */
1546     if (enableWA)
1547     {
1548         TRACE0(pCmdBld->hReport, REPORT_SEVERITY_CONSOLE, "cmdBld_CfgIePsWmm: PS is on WMM mode\n");
1549         WLAN_OS_REPORT(("%s PS is on WMM mode\n",__FUNCTION__));
1550     }
1551 
1552     return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
1553 }
1554 
1555 /****************************************************************************
1556  *                      cmdBld_CfgIeRssiSnrTrigger()
1557  ****************************************************************************
1558  * DESCRIPTION: Configure the RSSI/SNR Trigger parameters
1559  *
1560  * INPUTS:  None
1561  *
1562  * OUTPUT:  None
1563  *
1564  * RETURNS: OK or NOK
1565  ****************************************************************************/
cmdBld_CfgIeRssiSnrTrigger(TI_HANDLE hCmdBld,RssiSnrTriggerCfg_t * pTriggerParam,void * fCb,TI_HANDLE hCb)1566 TI_STATUS cmdBld_CfgIeRssiSnrTrigger (TI_HANDLE hCmdBld, RssiSnrTriggerCfg_t *pTriggerParam, void *fCb, TI_HANDLE hCb)
1567 {
1568     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
1569     ACXRssiSnrTriggerCfg_t  tAcxTriggerParameters;
1570     ACXRssiSnrTriggerCfg_t *pCfg = &tAcxTriggerParameters;
1571 
1572     pCfg->param.index       = pTriggerParam->index    ;
1573     pCfg->param.threshold   = pTriggerParam->threshold;
1574     pCfg->param.pacing      = pTriggerParam->pacing   ;
1575     pCfg->param.metric      = pTriggerParam->metric   ;
1576     pCfg->param.type        = pTriggerParam->type     ;
1577     pCfg->param.direction   = pTriggerParam->direction;
1578     pCfg->param.hystersis   = pTriggerParam->hystersis;
1579     pCfg->param.enable      = pTriggerParam->enable   ;
1580 
1581     /* Set information element header */
1582     pCfg->EleHdr.id = ACX_RSSI_SNR_TRIGGER;
1583     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
1584 
1585     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);
1586 
1587     /* Send the configuration command */
1588     return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
1589 }
1590 
1591 /****************************************************************************
1592  *                      cmdBld_CfgIeRssiSnrWeights()
1593  ****************************************************************************
1594  * DESCRIPTION: Configure the RSSI/SNR Trigger parameters
1595  *
1596  * INPUTS:  None
1597  *
1598  * OUTPUT:  None
1599  *
1600  * RETURNS: OK or NOK
1601  ****************************************************************************/
cmdBld_CfgIeRssiSnrWeights(TI_HANDLE hCmdBld,RssiSnrAverageWeights_t * pWeightsParam,void * fCb,TI_HANDLE hCb)1602 TI_STATUS cmdBld_CfgIeRssiSnrWeights (TI_HANDLE hCmdBld, RssiSnrAverageWeights_t *pWeightsParam, void *fCb, TI_HANDLE hCb)
1603 {
1604     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
1605     ACXRssiSnrAverageWeights_t  tAcxAverageWeights;
1606     ACXRssiSnrAverageWeights_t *pCfg = &tAcxAverageWeights;
1607 
1608     pCfg->param.rssiBeaconAverageWeight = pWeightsParam->rssiBeaconAverageWeight;
1609     pCfg->param.rssiPacketAverageWeight = pWeightsParam->rssiPacketAverageWeight;
1610     pCfg->param.snrBeaconAverageWeight  = pWeightsParam->snrBeaconAverageWeight ;
1611     pCfg->param.snrPacketAverageWeight  = pWeightsParam->snrPacketAverageWeight ;
1612 
1613     /* Set information element header */
1614     pCfg->EleHdr.id = ACX_RSSI_SNR_WEIGHTS;
1615     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
1616 
1617     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);
1618 
1619     /* Send the configuration command */
1620     return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
1621 }
1622 
1623 
1624  /*
1625  * ----------------------------------------------------------------------------
1626  * Function : cmdBld_CfgIeBet
1627  *
1628  * Input    :   enabled               - 0 to disable BET, 0 to disable BET
1629  *              MaximumConsecutiveET  - Max number of consecutive beacons
1630  *                                      that may be early terminated.
1631  * Output   : TI_STATUS
1632  * Process  :  Configures Beacon Early Termination information element.
1633  * Note(s)  :  None
1634  * -----------------------------------------------------------------------------
1635  */
cmdBld_CfgIeBet(TI_HANDLE hCmdBld,TI_UINT8 Enable,TI_UINT8 MaximumConsecutiveET,void * fCb,TI_HANDLE hCb)1636 TI_STATUS cmdBld_CfgIeBet (TI_HANDLE hCmdBld, TI_UINT8 Enable, TI_UINT8 MaximumConsecutiveET, void *fCb, TI_HANDLE hCb)
1637 {
1638     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
1639 
1640     ACXBet_Enable_t ACXBet_Enable;
1641     ACXBet_Enable_t* pCfg = &ACXBet_Enable;
1642 
1643     /* Set information element header */
1644     pCfg->EleHdr.id = ACX_BET_ENABLE;
1645     pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
1646 
1647     /* Set configuration fields */
1648     pCfg->Enable = Enable;
1649     pCfg->MaximumConsecutiveET = MaximumConsecutiveET;
1650 
1651     TRACE2(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, ": Sending info elem to firmware, Enable=%d, MaximumConsecutiveET=%d\n", (TI_UINT32)pCfg->Enable, (TI_UINT32)pCfg->MaximumConsecutiveET);
1652 
1653     return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
1654 }
1655 
1656 /****************************************************************************
1657  *                      cmdBld_CmdIeConfigureKeepAliveParams()
1658  ****************************************************************************
1659  * DESCRIPTION: Configure keep-alive parameters for a single template
1660  *
1661  * INPUTS:  hCmdBld     - handle to command builder object
1662  *          uIndex      - keep-alive index
1663  *          uEnaDisFlag - whether keep-alive is enabled or disables
1664  *          trigType    - send keep alive when TX is idle or always
1665  *          interval    - keep-alive interval
1666  *          fCB         - callback function for command complete
1667  *          hCb         - handle to be apssed to callback function
1668  *
1669  * OUTPUT:  None
1670  *
1671  * RETURNS: OK or NOK
1672  ****************************************************************************/
cmdBld_CmdIeConfigureKeepAliveParams(TI_HANDLE hCmdBld,TI_UINT8 uIndex,TI_UINT8 uEnaDisFlag,TI_UINT8 trigType,TI_UINT32 interval,void * fCb,TI_HANDLE hCb)1673 TI_STATUS cmdBld_CmdIeConfigureKeepAliveParams (TI_HANDLE hCmdBld, TI_UINT8 uIndex,
1674                                                 TI_UINT8 uEnaDisFlag, TI_UINT8 trigType,
1675                                                 TI_UINT32 interval, void *fCb, TI_HANDLE hCb)
1676 {
1677     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
1678     AcxSetKeepAliveConfig_t ACXKeepAlive;
1679 
1680     /* set IE header */
1681     ACXKeepAlive.EleHdr.id = ACX_SET_KEEP_ALIVE_CONFIG;
1682     ACXKeepAlive.EleHdr.len = sizeof (AcxSetKeepAliveConfig_t) - sizeof (EleHdrStruct);
1683 
1684     /* set Keep-Alive values */
1685     ACXKeepAlive.index = uIndex;
1686     ACXKeepAlive.period = interval;
1687     ACXKeepAlive.trigger = trigType;
1688     ACXKeepAlive.valid = uEnaDisFlag;
1689 
1690     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);
1691 
1692     /* send the command to the FW */
1693     return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, &ACXKeepAlive, sizeof(AcxSetKeepAliveConfig_t), fCb, hCb, NULL);
1694 }
1695 
1696 /****************************************************************************
1697  *                      cmdBld_CmdIeConfigureKeepAliveParams()
1698  ****************************************************************************
1699  * DESCRIPTION: Configure keep-alive global enable / disable flag
1700  *
1701  * INPUTS:  enable / disable flag
1702  *
1703  * OUTPUT:  None
1704  *
1705  * RETURNS: OK or NOK
1706  ****************************************************************************/
cmdBld_CmdIeConfigureKeepAliveEnaDis(TI_HANDLE hCmdBld,TI_UINT8 enaDisFlag,void * fCb,TI_HANDLE hCb)1707 TI_STATUS cmdBld_CmdIeConfigureKeepAliveEnaDis (TI_HANDLE hCmdBld, TI_UINT8 enaDisFlag,
1708                                                 void *fCb, TI_HANDLE hCb)
1709 {
1710     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
1711     AcxKeepAliveMode ACXKeepAliveMode;
1712 
1713     /* set IE header */
1714     ACXKeepAliveMode.EleHdr.id = ACX_KEEP_ALIVE_MODE;
1715     ACXKeepAliveMode.EleHdr.len = sizeof (AcxKeepAliveMode) - sizeof (EleHdrStruct);
1716 
1717     /* set Keep-Alive mode */
1718     ACXKeepAliveMode.modeEnabled = enaDisFlag;
1719 
1720     TRACE1(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, ": Sending info elem to firmware, enaDis=%d\n", (TI_UINT32)ACXKeepAliveMode.modeEnabled);
1721 
1722     /* send the command to the FW */
1723     return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, &ACXKeepAliveMode, sizeof(AcxKeepAliveMode), fCb, hCb, NULL);
1724 }
1725 
1726 /**
1727  * \fn     cmdBld_CfgIeSetFwHtCapabilities
1728  * \brief  set the current AP HT Capabilities to the FW.
1729  *
1730  * \note
1731  * \return TI_OK on success or TI_NOK on failure
1732  * \sa
1733  */
cmdBld_CfgIeSetFwHtCapabilities(TI_HANDLE hCmdBld,TI_UINT32 uHtCapabilites,TMacAddr tMacAddress,TI_UINT8 uAmpduMaxLeng,TI_UINT8 uAmpduMinSpac,void * fCb,TI_HANDLE hCb)1734 TI_STATUS cmdBld_CfgIeSetFwHtCapabilities (TI_HANDLE hCmdBld,
1735                                            TI_UINT32 uHtCapabilites,
1736                                            TMacAddr  tMacAddress,
1737                                            TI_UINT8  uAmpduMaxLeng,
1738                                            TI_UINT8  uAmpduMinSpac,
1739                                            void      *fCb,
1740                                            TI_HANDLE hCb)
1741 {
1742     TCmdBld                         *pCmdBld = (TCmdBld *)hCmdBld;
1743     TAxcHtCapabilitiesIeFwInterface tAcxFwHtCap;
1744     TAxcHtCapabilitiesIeFwInterface *pCfg    = &tAcxFwHtCap;
1745 
1746     /* Set information element header */
1747     pCfg->EleHdr.id = ACX_PEER_HT_CAP;
1748     pCfg->EleHdr.len = sizeof(tAcxFwHtCap) - sizeof(EleHdrStruct);
1749 
1750     MAC_COPY (pCfg->aMacAddress, tMacAddress);
1751     pCfg->uHtCapabilites = uHtCapabilites;
1752     pCfg->uAmpduMaxLength = uAmpduMaxLeng;
1753     pCfg->uAmpduMinSpacing = uAmpduMinSpac;
1754 
1755     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]);
1756 
1757     return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(TAxcHtCapabilitiesIeFwInterface), fCb, hCb, NULL);
1758 
1759 }
1760 
1761 /**
1762  * \fn     cmdBld_CfgIeSetFwHtInformation
1763  * \brief  set the current AP HT Information to the FW.
1764  *
1765  * \note
1766  * \return TI_OK on success or TI_NOK on failure
1767  * \sa
1768  */
cmdBld_CfgIeSetFwHtInformation(TI_HANDLE hCmdBld,TI_UINT8 uRifsMode,TI_UINT8 uHtProtection,TI_UINT8 uGfProtection,TI_UINT8 uHtTxBurstLimit,TI_UINT8 uDualCtsProtection,void * fCb,TI_HANDLE hCb)1769 TI_STATUS cmdBld_CfgIeSetFwHtInformation (TI_HANDLE hCmdBld,
1770                                           TI_UINT8  uRifsMode,
1771                                           TI_UINT8  uHtProtection,
1772                                           TI_UINT8  uGfProtection,
1773                                           TI_UINT8  uHtTxBurstLimit,
1774                                           TI_UINT8  uDualCtsProtection,
1775                                           void      *fCb,
1776                                           TI_HANDLE hCb)
1777 {
1778     TCmdBld                        *pCmdBld = (TCmdBld *)hCmdBld;
1779     TAxcHtInformationIeFwInterface tAcxFwHtInf;
1780     TAxcHtInformationIeFwInterface *pCfg = &tAcxFwHtInf;
1781 
1782     /* Set information element header */
1783     pCfg->EleHdr.id = ACX_HT_BSS_OPERATION;
1784     pCfg->EleHdr.len = sizeof(tAcxFwHtInf) - sizeof(EleHdrStruct);
1785 
1786     pCfg->uRifsMode = uRifsMode;
1787     pCfg->uHtProtection = uHtProtection;
1788     pCfg->uGfProtection = uGfProtection;
1789     pCfg->uHtTxBurstLimit = uHtTxBurstLimit;
1790     pCfg->uDualCtsProtection = uDualCtsProtection;
1791 
1792     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);
1793 
1794     return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(TAxcHtInformationIeFwInterface), fCb, hCb, NULL);
1795 }
1796 
1797 /**
1798  * \fn     cmdBld_CfgIeSetBaSession
1799  * \brief  configure BA session initiator\receiver parameters setting in the FW.
1800  *
1801  * \note
1802  * \return TI_OK on success or TI_NOK on failure
1803  * \sa
1804  */
cmdBld_CfgIeSetBaSession(TI_HANDLE hCmdBld,InfoElement_e eBaType,TI_UINT8 uTid,TI_UINT8 uState,TMacAddr tRa,TI_UINT16 uWinSize,TI_UINT16 uInactivityTimeout,void * fCb,TI_HANDLE hCb)1805 TI_STATUS cmdBld_CfgIeSetBaSession (TI_HANDLE hCmdBld,
1806                                     InfoElement_e eBaType,
1807                                     TI_UINT8 uTid,
1808                                     TI_UINT8 uState,
1809                                     TMacAddr tRa,
1810                                     TI_UINT16 uWinSize,
1811                                     TI_UINT16 uInactivityTimeout,
1812                                     void *fCb,
1813                                     TI_HANDLE hCb)
1814 {
1815     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
1816     TAxcBaSessionInitiatorResponderPolicy tAcxBaSessionPrm;
1817     TAxcBaSessionInitiatorResponderPolicy *pCfg = &tAcxBaSessionPrm;
1818 
1819     /* Set information element header */
1820     pCfg->EleHdr.id = eBaType;
1821     pCfg->EleHdr.len = sizeof(tAcxBaSessionPrm) - sizeof(EleHdrStruct);
1822 
1823     MAC_COPY (pCfg->aMacAddress, tRa);
1824     pCfg->uTid = uTid;
1825     pCfg->uPolicy = uState;
1826     pCfg->uWinSize = uWinSize;
1827 
1828     if (eBaType == ACX_BA_SESSION_INITIATOR_POLICY)
1829     {
1830         pCfg->uInactivityTimeout = uInactivityTimeout;
1831     }
1832     else
1833     {
1834         if (eBaType == ACX_BA_SESSION_RESPONDER_POLICY)
1835         {
1836             pCfg->uInactivityTimeout = 0;
1837         }
1838         else
1839         {
1840             TRACE1(pCmdBld->hReport, REPORT_SEVERITY_ERROR, "cmdBld_CfgIeSetBaSession: error ID=%u\n", pCfg->EleHdr.id);
1841             return TI_NOK;
1842         }
1843     }
1844 
1845     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);
1846 
1847     return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(TAxcBaSessionInitiatorResponderPolicy), fCb, hCb, NULL);
1848 }
1849 
1850 /**
1851  * \fn     cmdBld_CfgIeRadioParams
1852  * \brief  configure radio parameters setting in the FW.
1853  *
1854  * \note
1855  * \return TI_OK on success or TI_NOK on failure
1856  * \sa
1857  */
cmdBld_CfgIeRadioParams(TI_HANDLE hCmdBld,IniFileRadioParam * pIniFileRadioParams,void * fCb,TI_HANDLE hCb)1858 TI_STATUS cmdBld_CfgIeRadioParams (TI_HANDLE hCmdBld, IniFileRadioParam *pIniFileRadioParams, void *fCb, TI_HANDLE hCb)
1859 {
1860     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
1861     TI_STATUS status = TI_NOK;
1862     TTestCmd *pTestCmd;
1863 
1864     pTestCmd = os_memoryAlloc(pCmdBld->hOs, sizeof(TTestCmd));
1865     if (!pTestCmd)
1866     {
1867         return status;
1868     }
1869 
1870     pTestCmd->testCmdId = TEST_CMD_INI_FILE_RADIO_PARAM;
1871 
1872     os_memoryCopy(pCmdBld->hOs, &pTestCmd->testCmd_u.IniFileRadioParams, pIniFileRadioParams, sizeof(IniFileRadioParam));
1873 
1874     status = cmdQueue_SendCommand (pCmdBld->hCmdQueue,
1875                              CMD_TEST,
1876                              (void *)pTestCmd,
1877                              sizeof(IniFileRadioParam) + 4,
1878                              fCb,
1879                              hCb,
1880                              NULL);
1881     os_memoryFree(pCmdBld->hOs, pTestCmd, sizeof(TTestCmd));
1882     return status;
1883 }
1884 
1885 
1886 /**
1887  * \fn     cmdBld_CfgIeExtendedRadioParams
1888  * \brief  configure extended radio parameters setting in the
1889  * FW.
1890  *
1891  * \note
1892  * \return TI_OK on success or TI_NOK on failure
1893  * \sa
1894  */
cmdBld_CfgIeExtendedRadioParams(TI_HANDLE hCmdBld,IniFileExtendedRadioParam * pIniFileExtRadioParams,void * fCb,TI_HANDLE hCb)1895 TI_STATUS cmdBld_CfgIeExtendedRadioParams (TI_HANDLE hCmdBld,
1896 										   IniFileExtendedRadioParam *pIniFileExtRadioParams,
1897 										   void *fCb,
1898 										   TI_HANDLE hCb)
1899 {
1900     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
1901     TI_STATUS status = TI_NOK;
1902     TTestCmd *pTestCmd;
1903 
1904     pTestCmd = os_memoryAlloc(pCmdBld->hOs, sizeof(TTestCmd));
1905     if (!pTestCmd)
1906     {
1907         return status;
1908     }
1909 
1910     pTestCmd->testCmdId = TEST_CMD_INI_FILE_RF_EXTENDED_PARAM;
1911 
1912     os_memoryCopy(pCmdBld->hOs, &pTestCmd->testCmd_u.IniFileExtendedRadioParams,
1913 				  pIniFileExtRadioParams, sizeof(IniFileExtendedRadioParam));
1914 
1915     status = cmdQueue_SendCommand (pCmdBld->hCmdQueue,
1916                              CMD_TEST,
1917                              (void *)pTestCmd,
1918                              sizeof(IniFileExtendedRadioParam) + 4,
1919                              fCb,
1920                              hCb,
1921                              NULL);
1922     os_memoryFree(pCmdBld->hOs, pTestCmd, sizeof(TTestCmd));
1923     return status;
1924 }
1925 
1926 
cmdBld_CfgPlatformGenParams(TI_HANDLE hCmdBld,IniFileGeneralParam * pGenParams,void * fCb,TI_HANDLE hCb)1927 TI_STATUS cmdBld_CfgPlatformGenParams (TI_HANDLE hCmdBld, IniFileGeneralParam *pGenParams, void *fCb, TI_HANDLE hCb)
1928 {
1929     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
1930     TI_STATUS status = TI_NOK;
1931     TTestCmd *pTestCmd;
1932 
1933     pTestCmd = os_memoryAlloc(pCmdBld->hOs, sizeof(TTestCmd));
1934     if (!pTestCmd)
1935     {
1936         return status;
1937     }
1938 
1939     pTestCmd->testCmdId = TEST_CMD_INI_FILE_GENERAL_PARAM;
1940 
1941     os_memoryCopy(pCmdBld->hOs, &pTestCmd->testCmd_u.IniFileGeneralParams, pGenParams, sizeof(IniFileGeneralParam));
1942 
1943     status = cmdQueue_SendCommand (pCmdBld->hCmdQueue,
1944                               CMD_TEST,
1945                               (void *)pTestCmd,
1946                               sizeof(IniFileGeneralParam),
1947                               fCb,
1948                               hCb,
1949                               NULL);
1950     os_memoryFree(pCmdBld->hOs, pTestCmd, sizeof(TTestCmd));
1951     return status;
1952 }
1953 
1954 
1955 /****************************************************************************
1956  *                      cmdBld_CfgIeBurstMode()
1957  ****************************************************************************
1958  * DESCRIPTION: Configure burst mode
1959  *
1960  * INPUTS:  hCmdBld     - handle to command builder object
1961  *          bEnabled    - is enabled flag
1962  *          fCB         - callback function for command complete
1963  *          hCb         - handle to be apssed to callback function
1964  *
1965  * OUTPUT:  None
1966  *
1967  * RETURNS: OK or NOK
1968  ****************************************************************************/
cmdBld_CfgIeBurstMode(TI_HANDLE hCmdBld,TI_BOOL bEnabled,void * fCb,TI_HANDLE hCb)1969 TI_STATUS cmdBld_CfgIeBurstMode (TI_HANDLE hCmdBld, TI_BOOL bEnabled, void *fCb, TI_HANDLE hCb)
1970 {
1971 	TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
1972 	AcxBurstMode tAcxBurstMode;
1973 	AcxBurstMode *pCfg = &tAcxBurstMode;
1974 
1975 	/* set IE header */
1976 	pCfg->EleHdr.id = ACX_BURST_MODE;
1977 	pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
1978 
1979 	/* set burst mode value */
1980 	pCfg->enable = (uint8)bEnabled;
1981 
1982 	/* send the command to the FW */
1983 	return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
1984 }
1985 
1986 
1987 /****************************************************************************
1988  *                      cmdBld_CfgIeDcoItrimParams()
1989  ****************************************************************************
1990  * DESCRIPTION: Configure/Interrogate the DCO Itrim parameters
1991  *
1992  * INPUTS:
1993  *
1994  * OUTPUT:  None
1995  *
1996  * RETURNS: TI_OK or TI_NOK
1997  ****************************************************************************/
cmdBld_CfgIeDcoItrimParams(TI_HANDLE hCmdBld,TI_BOOL enable,TI_UINT32 moderationTimeoutUsec,void * fCb,TI_HANDLE hCb)1998 TI_STATUS cmdBld_CfgIeDcoItrimParams (TI_HANDLE hCmdBld, TI_BOOL enable, TI_UINT32 moderationTimeoutUsec, void *fCb, TI_HANDLE hCb)
1999 {
2000     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
2001     ACXDCOItrimParams_t ACXBeaconFilterOptions;
2002     ACXDCOItrimParams_t *pCfg = &ACXBeaconFilterOptions;
2003 
2004     pCfg->enable = enable;
2005     pCfg->moderation_timeout_usec = moderationTimeoutUsec;
2006 
2007     /* Set information element header */
2008     pCfg->EleHdr.id = ACX_SET_DCO_ITRIM_PARAMS;
2009     pCfg->EleHdr.len = sizeof(ACXDCOItrimParams_t) - sizeof(EleHdrStruct);
2010 
2011     TRACE3(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "ID=%u: enable=%u, moderation_timeout_usec=%u\n", pCfg->EleHdr.id, enable, moderationTimeoutUsec);
2012 
2013     return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(ACXDCOItrimParams_t), fCb, hCb, NULL);
2014 }
2015