• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * CmdBldCfg.c
3  *
4  * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  *  * Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  *  * Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in
15  *    the documentation and/or other materials provided with the
16  *    distribution.
17  *  * Neither the name Texas Instruments nor the names of its
18  *    contributors may be used to endorse or promote products derived
19  *    from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  */
33 
34 
35 /** \file  CmdBldCfg.c
36  *  \brief Command builder. Configuration commands
37  *
38  *  \see   CmdBld.h
39  */
40 #define __FILE_ID__  FILE_ID_91
41 #include "osApi.h"
42 #include "tidef.h"
43 #include "report.h"
44 #include "CmdBld.h"
45 #include "CmdBldCfgIE.h"
46 #include "TWDriverInternal.h"
47 
48 
49 /****************************************************************************
50  *                      cmdBld_setRxFilters()
51  ****************************************************************************
52  * DESCRIPTION: Sets the filters according to the given configuration.
53  *
54  * INPUTS:  RxConfigOption  - The given Rx filters configuration
55  *          RxFilterOption  - The given Rx filters options
56  *
57  * OUTPUT:  None
58  *
59  * RETURNS: TI_OK or TI_NOK
60  ****************************************************************************/
cmdBld_CfgRx(TI_HANDLE hCmdBld,TI_UINT32 uRxConfigOption,TI_UINT32 uRxFilterOption,void * fCb,TI_HANDLE hCb)61 TI_STATUS cmdBld_CfgRx (TI_HANDLE hCmdBld, TI_UINT32 uRxConfigOption, TI_UINT32 uRxFilterOption, void *fCb, TI_HANDLE hCb)
62 {
63     DB_WLAN(hCmdBld).RxConfigOption = uRxConfigOption;
64     DB_WLAN(hCmdBld).RxFilterOption = uRxFilterOption;
65     DB_WLAN(hCmdBld).RxConfigOption |= RX_CFG_ENABLE_PHY_HEADER_PLCP;
66   #if defined (TNETW_MASTER_MODE) || defined (TNETW_USB_MODE)
67     DB_WLAN(hCmdBld).RxConfigOption |= RX_CFG_COPY_RX_STATUS;
68   #endif
69 
70     if (DB_WLAN(hCmdBld).RxDisableBroadcast)
71     {
72         DB_WLAN(hCmdBld).RxConfigOption |= RX_CFG_DISABLE_BCAST;
73     }
74 
75     return cmdBld_CfgIeRx (hCmdBld,
76                            DB_WLAN(hCmdBld).RxConfigOption,
77                            DB_WLAN(hCmdBld).RxFilterOption,
78                            fCb,
79                            hCb);
80 }
81 
82 
83 /****************************************************************************
84  *                      cmdBld_SetarpIpAddressesTable()
85  ****************************************************************************
86  * DESCRIPTION: Sets the ARP IP table according to the given configuration.
87  *
88  * OUTPUT:  None
89  *
90  * RETURNS: TI_OK or TI_NOK
91  ****************************************************************************/
cmdBld_CfgArpIpAddrTable(TI_HANDLE hCmdBld,TIpAddr tIpAddr,TI_BOOL bEnabled,EIpVer eIpVer,void * fCb,TI_HANDLE hCb)92 TI_STATUS cmdBld_CfgArpIpAddrTable (TI_HANDLE hCmdBld, TIpAddr tIpAddr, TI_BOOL bEnabled, EIpVer eIpVer, void *fCb, TI_HANDLE hCb)
93 {
94     DB_WLAN(hCmdBld).arp_IP_ver = eIpVer;
95 
96     /* no support for IPV6 */
97     if (eIpVer == IP_VER_4)
98     {
99         IP_COPY (DB_WLAN(hCmdBld).arp_IP_addr, tIpAddr);
100     }
101 
102     DB_WLAN(hCmdBld).isArpIpFilteringEnabled = bEnabled;
103 
104     /* Set the new ip with the current state (e/d) */
105     return cmdBld_CfgIeArpIpFilter (hCmdBld, tIpAddr, bEnabled, fCb, hCb);
106 }
107 
108 
109  /****************************************************************************
110  *                      cmdBld_SetarpIpFilterEnabled()
111  ****************************************************************************
112  * DESCRIPTION: Enable\Disable the ARP filter
113  *
114  * OUTPUT:  None
115  *
116  * RETURNS: TI_OK or TI_NOK
117  ****************************************************************************/
cmdBld_CfgArpIpFilter(TI_HANDLE hCmdBld,TI_BOOL bEnabled,void * fCb,TI_HANDLE hCb)118 TI_STATUS cmdBld_CfgArpIpFilter (TI_HANDLE hCmdBld, TI_BOOL bEnabled, void *fCb, TI_HANDLE hCb)
119 {
120     /* Set the current ip address with the new state (e/d) */
121     DB_WLAN(hCmdBld).isArpIpFilteringEnabled = bEnabled;
122 
123     return cmdBld_CfgIeArpIpFilter (hCmdBld,
124                                     DB_WLAN(hCmdBld).arp_IP_addr,
125                                     bEnabled,
126                                     fCb,
127                                     hCb);
128 }
129 
130 
131 /****************************************************************************
132  *                      cmdBld_SetGroupAddressesTable()
133  ****************************************************************************
134  * DESCRIPTION: Sets the Group table according to the given configuration.
135  *
136  * OUTPUT:  None
137  *
138  * RETURNS: TI_OK or TI_NOK
139  ****************************************************************************/
cmdBld_CfgGroupAddressTable(TI_HANDLE hCmdBld,TI_UINT8 uNumGroupAddr,TMacAddr * pGroupAddr,TI_BOOL bEnabled,void * fCb,TI_HANDLE hCb)140 TI_STATUS cmdBld_CfgGroupAddressTable (TI_HANDLE        hCmdBld,
141                                        TI_UINT8         uNumGroupAddr,
142                                        TMacAddr         *pGroupAddr,
143                                        TI_BOOL          bEnabled,
144                                        void             *fCb,
145                                        TI_HANDLE        hCb)
146 {
147     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
148     TI_UINT32    i;
149 
150     if (uNumGroupAddr > MAX_MULTICAST_GROUP_ADDRS)
151     {
152         TRACE1(pCmdBld->hReport, REPORT_SEVERITY_ERROR, "cmdBld_CfgGroupAddressTable: numGroupAddrs=%d\n", uNumGroupAddr);
153         return PARAM_VALUE_NOT_VALID;
154     }
155 
156     if (NULL == pGroupAddr)
157     {
158         TRACE2(pCmdBld->hReport, REPORT_SEVERITY_ERROR, "cmdBld_SetGroupAddressesTable: numGroupAddrs=%d Group_addr=0x%x  !!!\n", uNumGroupAddr, pGroupAddr);
159         return PARAM_VALUE_NOT_VALID;
160     }
161 
162     /* Keeps the parameters in the db */
163     DB_WLAN(hCmdBld).numGroupAddrs = uNumGroupAddr;
164     DB_WLAN(hCmdBld).isMacAddrFilteringnabled = bEnabled;
165 
166     for (i = 0; i < uNumGroupAddr; i++)
167     {
168         MAC_COPY (DB_WLAN(hCmdBld).aGroupAddr[i], *(pGroupAddr + i));
169     }
170 
171     return cmdBld_CfgIeGroupAdressTable (hCmdBld, uNumGroupAddr, pGroupAddr, bEnabled, fCb, hCb);
172 }
173 
174 
175 /****************************************************************************
176  *                      cmdBld_SetRtsThreshold()
177  ****************************************************************************
178  * DESCRIPTION: Sets the Rts Threshold.
179  *
180  * OUTPUT:  None
181  *
182  * RETURNS: TI_OK or TI_NOK  pWlanParams->RtsThreshold
183  ****************************************************************************/
cmdBld_CfgRtsThreshold(TI_HANDLE hCmdBld,TI_UINT16 threshold,void * fCb,TI_HANDLE hCb)184 TI_STATUS cmdBld_CfgRtsThreshold (TI_HANDLE hCmdBld, TI_UINT16 threshold, void *fCb, TI_HANDLE hCb)
185 {
186     return cmdBld_CfgIeRtsThreshold (hCmdBld, threshold, fCb, hCb);
187 }
188 
189 
190 /****************************************************************************
191  *                      cmdBld_CfgFragmentThreshold()
192  ****************************************************************************
193  * DESCRIPTION: Sets the tx fragmentation Threshold.
194  *
195  * OUTPUT:  None
196  *
197  * RETURNS: TI_OK or TI_NOK
198  ****************************************************************************/
cmdBld_CfgFragmentThreshold(TI_HANDLE hCmdBld,TI_UINT16 uFragmentThreshold,void * fCb,TI_HANDLE hCb)199 TI_STATUS cmdBld_CfgFragmentThreshold (TI_HANDLE hCmdBld, TI_UINT16 uFragmentThreshold, void *fCb, TI_HANDLE hCb)
200 {
201     DB_WLAN(hCmdBld).FragmentThreshold = uFragmentThreshold;
202 
203     return cmdBld_CfgIeFragmentThreshold (hCmdBld, uFragmentThreshold, fCb, hCb);
204 }
205 
206 
207 /****************************************************************************
208  *                      cmdBld_SetPreamble()
209  ****************************************************************************
210  * DESCRIPTION: Set the preamble in ?????? hardware register
211  *
212  * INPUTS:
213  *      preambleVal
214  *
215  * OUTPUT:  None
216  *
217  * RETURNS: None
218  ****************************************************************************/
cmdBld_CfgPreamble(TI_HANDLE hCmdBld,Preamble_e ePreamble,void * fCb,TI_HANDLE hCb)219 TI_STATUS cmdBld_CfgPreamble (TI_HANDLE hCmdBld, Preamble_e ePreamble, void *fCb, TI_HANDLE hCb)
220 {
221     DB_WLAN(hCmdBld).preamble = ePreamble;
222 
223     return cmdBld_CfgIePreamble (hCmdBld, (TI_UINT8)ePreamble, fCb, hCb);
224 }
225 
226 
227 /****************************************************************************
228  *                      cmdBld_BcnBrcOptions()
229  ****************************************************************************
230  * DESCRIPTION: Configure the wlan hardware
231  *
232  * INPUTS: None
233  *
234  * OUTPUT:  None
235  *
236  * RETURNS: TI_OK or TI_NOK
237  ****************************************************************************/
cmdBld_CfgBcnBrcOptions(TI_HANDLE hCmdBld,TPowerMgmtConfig * pPMConfig,void * fCb,TI_HANDLE hCb)238 TI_STATUS cmdBld_CfgBcnBrcOptions (TI_HANDLE hCmdBld, TPowerMgmtConfig *pPMConfig, void *fCb, TI_HANDLE hCb)
239 {
240     return cmdBld_CfgIeBcnBrcOptions (hCmdBld, pPMConfig, fCb, hCb);
241 }
242 
243 
244 /****************************************************************************
245  *                      cmdBld_wakeUpCondition()
246  ****************************************************************************
247  * DESCRIPTION: Configure the wlan hardware
248  *
249  * INPUTS: None
250  *
251  * OUTPUT:  None
252  *
253  * RETURNS: TI_OK or TI_NOK
254  ****************************************************************************/
cmdBld_CfgWakeUpCondition(TI_HANDLE hCmdBld,TPowerMgmtConfig * pPMConfig,void * fCb,TI_HANDLE hCb)255 TI_STATUS cmdBld_CfgWakeUpCondition (TI_HANDLE hCmdBld, TPowerMgmtConfig *pPMConfig, void *fCb, TI_HANDLE hCb)
256 {
257     return cmdBld_CfgIeWakeUpCondition (hCmdBld, pPMConfig, fCb, hCb);
258 }
259 
260 
261 /****************************************************************************
262  *                      cmdBld_MinPowerLevelSet ()
263  ****************************************************************************
264  * DESCRIPTION: Set the min power level
265  *
266  * INPUTS:
267  *
268  * OUTPUT:
269  *
270  * RETURNS: TI_OK or TI_NOK
271  ****************************************************************************/
cmdBld_CfgSleepAuth(TI_HANDLE hCmdBld,EPowerPolicy eMinPowerLevel,void * fCb,TI_HANDLE hCb)272 TI_STATUS cmdBld_CfgSleepAuth (TI_HANDLE hCmdBld, EPowerPolicy eMinPowerLevel, void *fCb, TI_HANDLE hCb)
273 {
274     /* Save th parameter in database */
275     DB_WLAN(hCmdBld).minPowerLevel = eMinPowerLevel;
276 
277     return cmdBld_CfgIeSleepAuth (hCmdBld, eMinPowerLevel, fCb, hCb);
278 }
279 
280 
281 typedef enum { HW_CLOCK_40_MHZ = 40, HW_CLOCK_80_MHZ = 80 } EHwClock;
282 
283 
284 /****************************************************************************
285  *                      cmdBld_ArmClockSet()
286  ****************************************************************************
287  * DESCRIPTION: Configure the arm clock
288  *  !!! Note that the firmware will set the slot time according to the new clock
289  *
290  * INPUTS: None
291  *
292  * OUTPUT:  None
293  *
294  * RETURNS: TI_OK or TI_NOK
295  ****************************************************************************/
cmdBld_CfgArmClock(TI_HANDLE hCmdBld,TI_UINT32 uArmClock,void * fCb,TI_HANDLE hCb)296 TI_STATUS cmdBld_CfgArmClock (TI_HANDLE hCmdBld, TI_UINT32 uArmClock, void *fCb, TI_HANDLE hCb)
297 {
298     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
299     TWlanParams *pWlanParams = &DB_WLAN(hCmdBld);
300 
301     pWlanParams->ArmClock = uArmClock;
302 
303     /* Illegal combination Mac=80, Arm=40 ==> force setting 40/40*/
304     if (pWlanParams->MacClock == HW_CLOCK_80_MHZ && pWlanParams->ArmClock == HW_CLOCK_40_MHZ)
305     {
306         TRACE0(pCmdBld->hReport, REPORT_SEVERITY_ERROR, "cmdBld_ArmClockSet: Illegal combination Mac=80, Arm=40 ==> force setting 40/40\n");
307         pWlanParams->MacClock = HW_CLOCK_40_MHZ;
308     }
309 
310     return cmdBld_CfgIeFeatureConfig (hCmdBld,
311                                       pWlanParams->FeatureOptions,
312                                       pWlanParams->FeatureDataFlowOptions,
313                                       fCb,
314                                       hCb);
315 }
316 
317 
318 /****************************************************************************
319  *                      cmdBld_MacClockSet()
320  ****************************************************************************
321  * DESCRIPTION: Configure the mac clock
322  *  !!! Note that the firmware will set the slot time according to the new clock
323  *
324  * INPUTS: None
325  *
326  * OUTPUT:  None
327  *
328  * RETURNS: TI_OK or TI_NOK
329  ****************************************************************************/
cmdBld_CfgMacClock(TI_HANDLE hCmdBld,TI_UINT32 uMacClock,void * fCb,TI_HANDLE hCb)330 TI_STATUS cmdBld_CfgMacClock (TI_HANDLE hCmdBld, TI_UINT32 uMacClock, void *fCb, TI_HANDLE hCb)
331 {
332     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
333     TWlanParams *pWlanParams = &DB_WLAN(hCmdBld);
334 
335     pWlanParams->MacClock = uMacClock;
336 
337     /* Force same clock - for printing */
338     pWlanParams->ArmClock = uMacClock;
339 
340     /* Illegal combination Mac=80, Arm=40 ==> force setting 40/40*/
341     if (pWlanParams->MacClock == HW_CLOCK_80_MHZ && pWlanParams->ArmClock == HW_CLOCK_40_MHZ)
342     {
343         TRACE0(pCmdBld->hReport, REPORT_SEVERITY_ERROR, "cmdBld_MacClockSet: Illegal combination Mac=80, Arm=40 ==> force setting 40/40\n");
344         pWlanParams->MacClock = HW_CLOCK_40_MHZ;
345     }
346 
347     return cmdBld_CfgIeFeatureConfig (hCmdBld,
348                                       pWlanParams->FeatureOptions,
349                                       pWlanParams->FeatureDataFlowOptions,
350                                       fCb,
351                                       hCb);
352 }
353 
354 
355 /****************************************************************************
356  *                      cmdBld_AidSet()
357  ****************************************************************************
358  * DESCRIPTION: Set the AID
359  *
360  * INPUTS:
361  *
362  * OUTPUT:
363  *
364  * RETURNS: TI_OK or TI_NOK
365  ****************************************************************************/
cmdBld_CfgAid(TI_HANDLE hCmdBld,TI_UINT16 uAidVal,void * fCb,TI_HANDLE hCb)366 TI_STATUS cmdBld_CfgAid (TI_HANDLE hCmdBld, TI_UINT16 uAidVal, void *fCb, TI_HANDLE hCb)
367 {
368     return cmdBld_CfgIeAid (hCmdBld, uAidVal, fCb, hCb);
369 }
370 
cmdBld_CfgClkRun(TI_HANDLE hCmdBld,TI_BOOL aClkRunEnable,void * fCb,TI_HANDLE hCb)371 TI_STATUS cmdBld_CfgClkRun (TI_HANDLE hCmdBld, TI_BOOL aClkRunEnable, void *fCb, TI_HANDLE hCb)
372 {
373     TWlanParams *pWlanParams = &DB_WLAN(hCmdBld);
374 
375     if (aClkRunEnable)
376     {
377         pWlanParams->FeatureDataFlowOptions |= FEAT_PCI_CLK_RUN_ENABLE;
378     }
379     else
380     {
381         pWlanParams->FeatureDataFlowOptions &= ~FEAT_PCI_CLK_RUN_ENABLE;
382     }
383 
384     return cmdBld_CfgIeFeatureConfig (hCmdBld,
385                                       pWlanParams->FeatureOptions,
386                                       pWlanParams->FeatureDataFlowOptions,
387                                       fCb,
388                                       hCb);
389 }
390 
391 
cmdBld_CfgRxMsduFormat(TI_HANDLE hCmdBld,TI_BOOL bRxMsduForamtEnable,void * fCb,TI_HANDLE hCb)392 TI_STATUS cmdBld_CfgRxMsduFormat (TI_HANDLE hCmdBld, TI_BOOL bRxMsduForamtEnable, void *fCb, TI_HANDLE hCb)
393 {
394 #if 1
395     /* WARNING:  Have to check how to control the Rx Frame format select (which bit)
396                  and then access the HW*/
397     return TI_OK;
398 #else
399     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
400     TWlanParams *pWlanParams = &DB_WLAN(hCmdBld);
401 
402     if (aRxMsduForamtEnable)
403     {
404         pWlanParams->FeatureDataFlowOptions |= DATA_FLOW_RX_MSDU_FRAME;
405     }
406     else
407     {
408         pWlanParams->FeatureDataFlowOptions &= ~DATA_FLOW_RX_MSDU_FRAME;
409     }
410 
411     return cmdBld_CfgIeFeatureConfig (hCmdBld,
412                                       pWlanParams->FeatureOptions,
413                                       pWlanParams->FeatureDataFlowOptions,
414                                       fCb,
415                                       hCb);
416 #endif
417 }
418 
419 
420 /****************************************************************************
421  *                      cmdBld_TrafficConf()
422  ****************************************************************************
423  * DESCRIPTION: configure Queue traffic params
424  *
425  * INPUTS: None
426  *
427  * OUTPUT:  None
428  *
429  * RETURNS: TI_OK or TI_NOK
430  ****************************************************************************/
cmdBld_CfgTid(TI_HANDLE hCmdBld,TQueueTrafficParams * pQtrafficParams,void * fCb,TI_HANDLE hCb)431 TI_STATUS cmdBld_CfgTid (TI_HANDLE hCmdBld, TQueueTrafficParams *pQtrafficParams, void *fCb, TI_HANDLE hCb)
432 {
433     DB_QUEUES(hCmdBld).isQueueConfigured[pQtrafficParams->queueID] = TI_TRUE;
434     DB_QUEUES(hCmdBld).queues[pQtrafficParams->queueID] = *pQtrafficParams;
435 
436     return cmdBld_CfgIeTid (hCmdBld, pQtrafficParams, fCb, hCb);
437 }
438 
439 
440 /****************************************************************************
441  *                      cmdBld_AcParamsConf()
442  ****************************************************************************
443  * DESCRIPTION: configure AC params
444  *
445  * INPUTS: None
446  *
447  * OUTPUT:  None
448  *
449  * RETURNS: TI_OK or TI_NOK
450  ****************************************************************************/
cmdBld_CfgAcParams(TI_HANDLE hCmdBld,TAcQosParams * pAcQosParams,void * fCb,TI_HANDLE hCb)451 TI_STATUS cmdBld_CfgAcParams (TI_HANDLE hCmdBld, TAcQosParams *pAcQosParams, void *fCb, TI_HANDLE hCb)
452 {
453     DB_AC(hCmdBld).isAcConfigured[pAcQosParams->ac] = TI_TRUE;
454     DB_AC(hCmdBld).ac[pAcQosParams->ac] = *pAcQosParams;
455 
456     return cmdBld_CfgIeAcParams (hCmdBld, pAcQosParams, fCb, hCb);
457 }
458 
459 
460 /****************************************************************************
461  *                      cmdBld_CfgPsRxStreaming()
462  ****************************************************************************
463  * DESCRIPTION: configure PS-Rx-Streaming params
464  *
465  * INPUTS: None
466  *
467  * OUTPUT:  None
468  *
469  * RETURNS: TI_OK or TI_NOK
470  ****************************************************************************/
cmdBld_CfgPsRxStreaming(TI_HANDLE hCmdBld,TPsRxStreaming * pPsRxStreaming,void * fCb,TI_HANDLE hCb)471 TI_STATUS cmdBld_CfgPsRxStreaming (TI_HANDLE hCmdBld, TPsRxStreaming *pPsRxStreaming, void *fCb, TI_HANDLE hCb)
472 {
473     DB_PS_STREAM(hCmdBld).tid[pPsRxStreaming->uTid] = *pPsRxStreaming;
474 
475     return cmdBld_CfgIePsRxStreaming (hCmdBld, pPsRxStreaming, fCb, hCb);
476 }
477 
478 
479 /****************************************************************************
480  *                     cmdBld_CfgPacketDetectionThreshold
481  ****************************************************************************
482  * DESCRIPTION: Sets Packet Detection Threshold
483  *
484  * INPUTS:  None
485  *
486  * OUTPUT:  None
487  *
488  * RETURNS: TI_OK or TI_NOK
489  ****************************************************************************/
cmdBld_CfgPacketDetectionThreshold(TI_HANDLE hCmdBld,TI_UINT32 threshold,void * fCb,TI_HANDLE hCb)490 TI_STATUS cmdBld_CfgPacketDetectionThreshold (TI_HANDLE hCmdBld, TI_UINT32 threshold, void *fCb, TI_HANDLE hCb)
491 {
492     DB_WLAN(hCmdBld).PacketDetectionThreshold = threshold;
493 
494     return cmdBld_CfgIePacketDetectionThreshold (hCmdBld, threshold, fCb, hCb);
495 }
496 
497 
498 /****************************************************************************
499  *                     cmdBld_SetBeaconFiltering
500  ****************************************************************************
501  * DESCRIPTION: Sets Beacon filtering state
502  *
503  * INPUTS:  None
504  *
505  * OUTPUT:  None
506  *
507  * RETURNS: TI_OK or TI_NOK
508  ****************************************************************************/
cmdBld_CfgBeaconFilterOpt(TI_HANDLE hCmdBld,TI_UINT8 uBeaconFilteringStatus,TI_UINT8 uNumOfBeaconsToBuffer,void * fCb,TI_HANDLE hCb)509 TI_STATUS cmdBld_CfgBeaconFilterOpt (TI_HANDLE  hCmdBld,
510                                      TI_UINT8   uBeaconFilteringStatus,
511                                      TI_UINT8   uNumOfBeaconsToBuffer,
512                                      void       *fCb,
513                                      TI_HANDLE  hCb)
514 {
515     DB_WLAN(hCmdBld).beaconFilterParams.desiredState = uBeaconFilteringStatus;
516     DB_WLAN(hCmdBld).beaconFilterParams.numOfElements = uNumOfBeaconsToBuffer;
517 
518     return cmdBld_CfgIeBeaconFilterOpt (hCmdBld,
519                                         uBeaconFilteringStatus,
520                                         uNumOfBeaconsToBuffer,
521                                         fCb,
522                                         hCb);
523 }
524 
525 /****************************************************************************
526  *                     cmdBld_CfgRateMngDbg
527  ****************************************************************************
528  * DESCRIPTION: Sets rate managment params
529  *
530  * INPUTS:  None
531  *
532  * OUTPUT:  None
533  *
534  * RETURNS: TI_OK or TI_NOK
535  ****************************************************************************/
536 
cmdBld_CfgRateMngDbg(TI_HANDLE hCmdBld,RateMangeParams_t * pRateMngParams,void * fCb,TI_HANDLE hCb)537 TI_STATUS cmdBld_CfgRateMngDbg (TI_HANDLE  hCmdBld,
538                                 RateMangeParams_t *pRateMngParams ,
539                                 void       *fCb,
540                                 TI_HANDLE  hCb)
541 {
542 
543 	TRateMngParams      *pRateMngParamsDB = &DB_RM(hCmdBld);
544 	int uIndex;
545 
546 	pRateMngParamsDB->rateMngParams.paramIndex = pRateMngParams->paramIndex;
547 
548 	 switch (pRateMngParams->paramIndex)
549 		{
550 		case RATE_MGMT_RETRY_SCORE_PARAM:
551 			pRateMngParamsDB->rateMngParams.RateRetryScore = pRateMngParams->RateRetryScore;
552 			break;
553 		case RATE_MGMT_PER_ADD_PARAM:
554 			pRateMngParamsDB->rateMngParams.PerAdd = pRateMngParams->PerAdd;
555 			break;
556 		case RATE_MGMT_PER_TH1_PARAM:
557 			pRateMngParamsDB->rateMngParams.PerTh1 = pRateMngParams->PerTh1;
558 			break;
559 		case RATE_MGMT_PER_TH2_PARAM:
560 			pRateMngParamsDB->rateMngParams.PerTh2 = pRateMngParams->PerTh2;
561 			break;
562 		case RATE_MGMT_MAX_PER_PARAM:
563 			pRateMngParamsDB->rateMngParams.MaxPer = pRateMngParams->MaxPer;
564 			break;
565 		case RATE_MGMT_INVERSE_CURIOSITY_FACTOR_PARAM:
566 			pRateMngParamsDB->rateMngParams.InverseCuriosityFactor = pRateMngParams->InverseCuriosityFactor;
567 			break;
568 		case RATE_MGMT_TX_FAIL_LOW_TH_PARAM:
569 			pRateMngParamsDB->rateMngParams.TxFailLowTh = pRateMngParams->TxFailLowTh;
570 			break;
571 		case RATE_MGMT_TX_FAIL_HIGH_TH_PARAM:
572 			pRateMngParamsDB->rateMngParams.TxFailHighTh = pRateMngParams->TxFailHighTh;
573 			break;
574 		case RATE_MGMT_PER_ALPHA_SHIFT_PARAM:
575 			pRateMngParamsDB->rateMngParams.PerAlphaShift = pRateMngParams->PerAlphaShift;
576 			break;
577 		case RATE_MGMT_PER_ADD_SHIFT_PARAM:
578 			pRateMngParamsDB->rateMngParams.PerAddShift = pRateMngParams->PerAddShift;
579 			break;
580 		case RATE_MGMT_PER_BETA1_SHIFT_PARAM:
581 			pRateMngParamsDB->rateMngParams.PerBeta1Shift = pRateMngParams->PerBeta1Shift;
582 			break;
583 		case RATE_MGMT_PER_BETA2_SHIFT_PARAM:
584 			pRateMngParamsDB->rateMngParams.PerBeta2Shift = pRateMngParams->PerBeta2Shift;
585 			break;
586 		case RATE_MGMT_RATE_CHECK_UP_PARAM:
587 			pRateMngParamsDB->rateMngParams.RateCheckUp = pRateMngParams->RateCheckUp;
588 			break;
589 		case RATE_MGMT_RATE_CHECK_DOWN_PARAM:
590 			pRateMngParamsDB->rateMngParams.RateCheckDown = pRateMngParams->RateCheckDown;
591 			break;
592 	    case RATE_MGMT_RATE_RETRY_POLICY_PARAM:
593 			for (uIndex = 0; uIndex < 13; uIndex++)
594 				{
595 					pRateMngParamsDB->rateMngParams.RateRetryPolicy[uIndex] = pRateMngParams->RateRetryPolicy[uIndex];
596 				}
597 			break;
598 	 }
599 
600 
601     return cmdBld_CfgIeRateMngDbg (hCmdBld,
602                                    pRateMngParams,
603                                    fCb,
604                                    hCb);
605 
606 }
607 
608 
609 /****************************************************************************
610  *                     cmdBld_SetBeaconFilterIETable
611  ****************************************************************************
612  * DESCRIPTION: Sets Beacon filtering state
613  *
614  * INPUTS:  None
615  *
616  * OUTPUT:  None
617  *
618  * RETURNS: TI_OK or TI_NOK
619  ****************************************************************************/
cmdBld_CfgBeaconFilterTable(TI_HANDLE hCmdBld,TI_UINT8 uNumberOfIEs,TI_UINT8 * pIETable,TI_UINT8 uIETableSize,void * fCb,TI_HANDLE hCb)620 TI_STATUS cmdBld_CfgBeaconFilterTable (TI_HANDLE    hCmdBld,
621                                        TI_UINT8     uNumberOfIEs,
622                                        TI_UINT8     *pIETable,
623                                        TI_UINT8     uIETableSize,
624                                        void         *fCb,
625                                        TI_HANDLE    hCb)
626 {
627     TCmdBld   *pCmdBld = (TCmdBld *)hCmdBld;
628 
629     if (uIETableSize > BEACON_FILTER_TABLE_MAX_SIZE)
630     {
631         TRACE2(pCmdBld->hReport, REPORT_SEVERITY_ERROR, "cmdBld_CfgBeaconFilterTable: Table size is too big %d (>%d)\n", uIETableSize, BEACON_FILTER_TABLE_MAX_SIZE);
632 
633         return PARAM_VALUE_NOT_VALID;
634     }
635 
636     os_memoryZero (pCmdBld->hOs,
637                    (void *)DB_WLAN(hCmdBld).beaconFilterIETable.IETable,
638                    BEACON_FILTER_TABLE_MAX_SIZE);
639     os_memoryCopy (pCmdBld->hOs,
640                    (void *)DB_WLAN(hCmdBld).beaconFilterIETable.IETable,
641                    (void *)pIETable,
642                    uIETableSize);
643     DB_WLAN(hCmdBld).beaconFilterIETable.numberOfIEs = uNumberOfIEs;
644     DB_WLAN(hCmdBld).beaconFilterIETable.IETableSize = uIETableSize;
645 
646     return cmdBld_CfgIeBeaconFilterTable (hCmdBld, uNumberOfIEs, pIETable, uIETableSize, fCb, hCb);
647 }
648 
649 
650 /*----------------------------------------*/
651 /* Roaming Trigger Configuration Commands */
652 /*----------------------------------------*/
653 
654 /****************************************************************************
655  *                      cmdBld_CfgRssiSnrTrigger()
656  ****************************************************************************
657  * DESCRIPTION: Set the RSSI/SNR Trigger parameters.
658  *
659  * INPUTS:
660  *
661  * OUTPUT:  None
662  *
663  * RETURNS: None
664  ****************************************************************************/
cmdBld_CfgRssiSnrTrigger(TI_HANDLE hCmdBld,RssiSnrTriggerCfg_t * pTriggerParam,void * fCb,TI_HANDLE hCb)665 TI_STATUS cmdBld_CfgRssiSnrTrigger (TI_HANDLE hCmdBld, RssiSnrTriggerCfg_t *pTriggerParam, void *fCb, TI_HANDLE hCb)
666 {
667     DB_WLAN(hCmdBld).tRssiSnrTrigger[pTriggerParam->index].index     = pTriggerParam->index;
668     DB_WLAN(hCmdBld).tRssiSnrTrigger[pTriggerParam->index].threshold = pTriggerParam->threshold;
669     DB_WLAN(hCmdBld).tRssiSnrTrigger[pTriggerParam->index].pacing    = pTriggerParam->pacing;
670     DB_WLAN(hCmdBld).tRssiSnrTrigger[pTriggerParam->index].metric    = pTriggerParam->metric;
671     DB_WLAN(hCmdBld).tRssiSnrTrigger[pTriggerParam->index].type      = pTriggerParam->type;
672     DB_WLAN(hCmdBld).tRssiSnrTrigger[pTriggerParam->index].direction = pTriggerParam->direction;
673     DB_WLAN(hCmdBld).tRssiSnrTrigger[pTriggerParam->index].hystersis = pTriggerParam->hystersis;
674     DB_WLAN(hCmdBld).tRssiSnrTrigger[pTriggerParam->index].enable    = pTriggerParam->enable;
675 
676     return cmdBld_CfgIeRssiSnrTrigger (hCmdBld, pTriggerParam, fCb, hCb);
677 }
678 
679 
680 /****************************************************************************
681  *                      cmdBld_CfgRssiSnrWeights()
682  ****************************************************************************
683  * DESCRIPTION: Set RSSI/SNR Weights for Average calculations.
684  *
685  * INPUTS:
686  *
687  * OUTPUT:  None
688  *
689  * RETURNS: None
690  ****************************************************************************/
cmdBld_CfgRssiSnrWeights(TI_HANDLE hCmdBld,RssiSnrAverageWeights_t * pWeightsParam,void * fCb,TI_HANDLE hCb)691 TI_STATUS cmdBld_CfgRssiSnrWeights (TI_HANDLE hCmdBld, RssiSnrAverageWeights_t *pWeightsParam, void *fCb, TI_HANDLE hCb)
692 {
693     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
694 
695     TRACE4(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "\n cmdBld_CfgRssiSnrWeights :\n                             uRssiBeaconAverageWeight = %d\n                             uRssiPacketAverageWeight = %d\n                             uSnrBeaconAverageWeight  = %d\n                             uSnrPacketAverageWeight = %d \n ", pWeightsParam->rssiBeaconAverageWeight, pWeightsParam->rssiPacketAverageWeight, pWeightsParam->snrBeaconAverageWeight , pWeightsParam->snrPacketAverageWeight  );
696 
697     DB_WLAN(hCmdBld).tRssiSnrWeights.rssiBeaconAverageWeight = pWeightsParam->rssiBeaconAverageWeight;
698     DB_WLAN(hCmdBld).tRssiSnrWeights.rssiPacketAverageWeight = pWeightsParam->rssiPacketAverageWeight;
699     DB_WLAN(hCmdBld).tRssiSnrWeights.snrBeaconAverageWeight  = pWeightsParam->snrBeaconAverageWeight ;
700     DB_WLAN(hCmdBld).tRssiSnrWeights.snrPacketAverageWeight  = pWeightsParam->snrPacketAverageWeight ;
701 
702     return cmdBld_CfgIeRssiSnrWeights (hCmdBld, pWeightsParam, fCb, hCb);
703 }
704 
705 
706 /****************************************************************************
707  *                      cmdBld_SetMaxTxRetryParameters()
708  ****************************************************************************
709  * DESCRIPTION: Set Max Tx retry parmaters.
710  *
711  * INPUTS:
712  *      maxTxRetry             max Tx Retry
713  *
714  * OUTPUT:  None
715  *
716  * RETURNS: None
717  ****************************************************************************/
cmdBld_CfgMaxTxRetry(TI_HANDLE hCmdBld,TRroamingTriggerParams * pRoamingTriggerCmd,void * fCb,TI_HANDLE hCb)718 TI_STATUS cmdBld_CfgMaxTxRetry (TI_HANDLE hCmdBld, TRroamingTriggerParams *pRoamingTriggerCmd, void *fCb, TI_HANDLE hCb)
719 {
720     DB_WLAN(hCmdBld).roamTriggers.maxTxRetry = pRoamingTriggerCmd->maxTxRetry;
721 
722     return cmdBld_CfgIeMaxTxRetry (hCmdBld, pRoamingTriggerCmd, fCb, hCb);
723 }
724 
725 
726 /****************************************************************************
727  *                      cmdBld_SoftGeminiEnable()
728  ****************************************************************************
729  * DESCRIPTION: Save Soft Gemini enable parameter
730  *
731  * INPUTS:
732  *
733  * OUTPUT:
734  *
735  * RETURNS: TI_OK or TI_NOK
736  ****************************************************************************/
cmdBld_CfgSgEnable(TI_HANDLE hCmdBld,ESoftGeminiEnableModes eSgEnable,void * fCb,TI_HANDLE hCb)737 TI_STATUS cmdBld_CfgSgEnable (TI_HANDLE hCmdBld, ESoftGeminiEnableModes eSgEnable, void *fCb, TI_HANDLE hCb)
738 {
739     DB_WLAN(hCmdBld).SoftGeminiEnable = eSgEnable;
740 
741     return cmdBld_CfgIeSgEnable (hCmdBld, eSgEnable, fCb, hCb);
742 }
743 
744 
745 /****************************************************************************
746  *                      cmdBld_SetSoftGeminiParams()
747  ****************************************************************************
748  * DESCRIPTION: Save Soft Gemini config parameter
749  *
750  * INPUTS:
751  *
752  * OUTPUT:
753  *
754  * RETURNS: TI_OK or TI_NOK
755  ****************************************************************************/
cmdBld_CfgSg(TI_HANDLE hCmdBld,TSoftGeminiParams * pSgParam,void * fCb,TI_HANDLE hCb)756 TI_STATUS cmdBld_CfgSg (TI_HANDLE hCmdBld, TSoftGeminiParams *pSgParam, void *fCb, TI_HANDLE hCb)
757 {
758     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
759 
760     /* Copy params for recovery */
761     os_memoryCopy (pCmdBld->hOs,
762                    (void*)&DB_WLAN(hCmdBld).SoftGeminiParams,
763                    (void*)pSgParam,
764                    sizeof(TSoftGeminiParams));
765 
766     return cmdBld_CfgIeSg (hCmdBld, pSgParam, fCb, hCb);
767 }
768 
769 /****************************************************************************
770  *                      cmdBld_SetCoexActivityTable()
771  ****************************************************************************
772  * DESCRIPTION: Sets the CoexActivity table.
773  *
774  * OUTPUT:  None
775  *
776  * RETURNS: TI_OK or TI_NOK  pWlanParams->RtsThreshold
777  ****************************************************************************/
cmdBld_CfgCoexActivity(TI_HANDLE hCmdBld,TCoexActivity * pCoexActivity,void * fCb,TI_HANDLE hCb)778 TI_STATUS cmdBld_CfgCoexActivity (TI_HANDLE hCmdBld, TCoexActivity *pCoexActivity, void *fCb, TI_HANDLE hCb)
779 {
780     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
781     TWlanParams *pWlanParams = &DB_WLAN(hCmdBld);
782     TCoexActivity *pSaveCoex = &pWlanParams->tWlanParamsCoexActivityTable.entry[0];
783     int numOfElements = pWlanParams->tWlanParamsCoexActivityTable.numOfElements;
784     int i;
785 
786     /* Check if to overwrite existing entry or put on last index */
787     for (i=0; i<numOfElements; i++)
788     {
789         if ((pSaveCoex[i].activityId == pCoexActivity->activityId) && (pSaveCoex->coexIp == pCoexActivity->coexIp))
790         {
791             break;
792         }
793     }
794 
795     TRACE4(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "cmdBld_CfgCoexActivity: save Param %d in index %d, %d %d\n", 0, i, pCoexActivity->coexIp, pCoexActivity->activityId);
796     /* save in WlanParams for recovery */
797     pSaveCoex[i].coexIp          = pCoexActivity->coexIp;
798     pSaveCoex[i].activityId      = pCoexActivity->activityId;
799     pSaveCoex[i].defaultPriority = pCoexActivity->defaultPriority;
800     pSaveCoex[i].raisedPriority  = pCoexActivity->raisedPriority;
801     pSaveCoex[i].minService      = pCoexActivity->minService;
802     pSaveCoex[i].maxService      = pCoexActivity->maxService;
803 
804     if (i == numOfElements)
805     {
806         /* no existing entry overwrite, increment number of elements */
807         pWlanParams->tWlanParamsCoexActivityTable.numOfElements++;
808     }
809 
810     return cmdBld_CfgIeCoexActivity (hCmdBld, pCoexActivity, fCb, hCb);
811 }
812 
813 /****************************************************************************
814  *                      cmdBld_CfgFmCoex()
815  ****************************************************************************
816  * DESCRIPTION: Save and configure FM coexistence parameters
817  *
818  * INPUTS:
819  *
820  * OUTPUT:
821  *
822  * RETURNS: TI_OK or TI_NOK
823  ****************************************************************************/
cmdBld_CfgFmCoex(TI_HANDLE hCmdBld,TFmCoexParams * pFmCoexParams,void * fCb,TI_HANDLE hCb)824 TI_STATUS cmdBld_CfgFmCoex (TI_HANDLE hCmdBld, TFmCoexParams *pFmCoexParams, void *fCb, TI_HANDLE hCb)
825 {
826     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
827 
828     /* Copy params for recovery */
829     os_memoryCopy (pCmdBld->hOs,
830                    (void*)&(DB_WLAN(hCmdBld).tFmCoexParams),
831                    (void*)pFmCoexParams,
832                    sizeof(TFmCoexParams));
833 
834     return cmdBld_CfgIeFmCoex (hCmdBld, pFmCoexParams, fCb, hCb);
835 }
836 
837 /****************************************************************************
838  *                      cmdBld_TxRatePolicy()
839  ****************************************************************************
840  * DESCRIPTION: configure TxRatePolicy params
841  *
842  * INPUTS: None
843  *
844  * OUTPUT:  None
845  *
846  * RETURNS: TI_OK or TI_NOK
847  ****************************************************************************/
cmdBld_CfgTxRatePolicy(TI_HANDLE hCmdBld,TTxRatePolicy * pTxRatePolicy,void * fCb,TI_HANDLE hCb)848 TI_STATUS cmdBld_CfgTxRatePolicy (TI_HANDLE hCmdBld, TTxRatePolicy *pTxRatePolicy, void *fCb, TI_HANDLE hCb)
849 {
850     TCmdBld       *pCmdBld      = (TCmdBld *)hCmdBld;
851     TTxRateClass  *pTxRateClass = pTxRatePolicy->rateClass;
852     TI_UINT8       index;
853 
854     TRACE1(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "_1, Num of classes = 0x%x\n", pTxRatePolicy->numOfRateClasses);
855 
856     DB_BSS(hCmdBld).TxRateClassParams.numOfRateClasses = pTxRatePolicy->numOfRateClasses;
857 
858     for (index = 0; index < pTxRatePolicy->numOfRateClasses; index++, pTxRateClass++)
859     {
860         TRACE4(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "_2loop, Index = %d, Short R = 0x%x, Long R = 0x%x, Rates = 0x%x\n", index, pTxRateClass->shortRetryLimit, pTxRateClass->longRetryLimit, pTxRateClass->txEnabledRates);
861 
862         DB_BSS(hCmdBld).TxRateClassParams.rateClass[index] = *pTxRateClass;
863     }
864 
865     return cmdBld_CfgIeTxRatePolicy (hCmdBld, pTxRatePolicy, fCb, hCb);
866 }
867 
868 
cmdBld_CfgSlotTime(TI_HANDLE hCmdBld,ESlotTime eSlotTime,void * fCb,TI_HANDLE hCb)869 TI_STATUS cmdBld_CfgSlotTime (TI_HANDLE hCmdBld, ESlotTime eSlotTime, void *fCb, TI_HANDLE hCb)
870 {
871     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
872 
873     DB_WLAN(hCmdBld).SlotTime = eSlotTime;
874 
875     TRACE1(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "TWD_SetSlotTime : Slot time = %d\n", eSlotTime);
876 
877     /* Configure the new Slot-Time value to the FW. */
878     return cmdBld_CfgIeSlotTime (hCmdBld, (TI_UINT8)eSlotTime, fCb, hCb);
879 }
880 
881 
cmdBld_CfgEventMask(TI_HANDLE hCmdBld,TI_UINT32 uEventMask,void * fCb,TI_HANDLE hCb)882 TI_STATUS cmdBld_CfgEventMask (TI_HANDLE hCmdBld, TI_UINT32 uEventMask, void *fCb, TI_HANDLE hCb)
883 {
884     return cmdBld_CfgIeEventMask (hCmdBld, uEventMask, fCb, hCb);
885 }
886 
887 
888 /*
889  * ----------------------------------------------------------------------------
890  * Function : cmdBld_CfgHwEncEnable
891  *
892  * Input    :
893  * Output   :
894  * Process  :
895  * Note(s)  :
896  * -----------------------------------------------------------------------------
897  */
cmdBld_CfgHwEncEnable(TI_HANDLE hCmdBld,TI_BOOL bHwEncEnable,TI_BOOL bHwDecEnable,void * fCb,TI_HANDLE hCb)898 TI_STATUS cmdBld_CfgHwEncEnable (TI_HANDLE hCmdBld, TI_BOOL bHwEncEnable, TI_BOOL bHwDecEnable, void *fCb, TI_HANDLE hCb)
899 {
900     TCmdBld     *pCmdBld = (TCmdBld *)hCmdBld;
901     TWlanParams *pWlanParams = &DB_WLAN(hCmdBld);
902 
903     /* Store the HW encryption Enable flag for reconfigure time (FW reload)*/
904     DB_KEYS(pCmdBld).bReconfHwEncEnable = bHwEncEnable;
905     DB_KEYS(pCmdBld).bHwEncDecrEnableValid = TI_TRUE;
906 
907     if (bHwEncEnable)
908     {
909         pWlanParams->FeatureDataFlowOptions &= ~DF_ENCRYPTION_DISABLE;
910     }
911     else
912     {
913         pWlanParams->FeatureDataFlowOptions |= DF_ENCRYPTION_DISABLE;
914     }
915 
916     /* Set bit DF_SNIFF_MODE_ENABLE to enable or prevent decryption in fw */
917     /* WARNING: Have to check how to control the decryption (which bit) and then set/reset
918                 the  appropriate bit*/
919     if (bHwDecEnable)
920     {
921         pWlanParams->FeatureDataFlowOptions &= ~DF_SNIFF_MODE_ENABLE;
922     }
923     else
924     {
925         pWlanParams->FeatureDataFlowOptions |= DF_SNIFF_MODE_ENABLE;
926     }
927 
928     return cmdBld_CfgIeFeatureConfig (hCmdBld,
929                                       pWlanParams->FeatureOptions,
930                                       pWlanParams->FeatureDataFlowOptions,
931                                       fCb,
932                                       hCb);
933 }
934 
935 
cmdBld_CfgHwEncDecEnable(TI_HANDLE hCmdBld,TI_BOOL bHwEncEnable,void * fCb,TI_HANDLE hCb)936 TI_STATUS cmdBld_CfgHwEncDecEnable (TI_HANDLE hCmdBld, TI_BOOL bHwEncEnable, void *fCb, TI_HANDLE hCb)
937 {
938     return cmdBld_CfgHwEncEnable (hCmdBld, bHwEncEnable, bHwEncEnable, fCb, hCb);
939 }
940 
941 
942 /*
943  * ----------------------------------------------------------------------------
944  * Function : cmdBld_CfgSecureMode
945  *
946  * Input    :
947  * Output   :
948  * Process  :
949  * Note(s)  :
950  * -----------------------------------------------------------------------------
951  */
cmdBld_CfgSecureMode(TI_HANDLE hCmdBld,ECipherSuite eSecurMode,void * fCb,TI_HANDLE hCb)952 TI_STATUS cmdBld_CfgSecureMode (TI_HANDLE hCmdBld, ECipherSuite eSecurMode, void *fCb, TI_HANDLE hCb)
953 {
954     TCmdBld  *pCmdBld = (TCmdBld *)hCmdBld;
955     TI_UINT32     index;
956 
957     if (eSecurMode < TWD_CIPHER_MAX)
958     {
959         TRACE2(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "cmdBld_CfgSecureMode: change tSecurity mode from %d --> %d\n", pCmdBld->tSecurity.eSecurityMode, eSecurMode);
960         /* check if tSecurity mode is equal to previous one*/
961         if (pCmdBld->tSecurity.eSecurityMode == eSecurMode)
962         {
963             return TI_OK;
964         }
965 
966         /* Reset all reconfig valid fields*/
967         DB_KEYS(pCmdBld).bHwEncDecrEnableValid = TI_FALSE;
968         DB_KEYS(pCmdBld).bDefaultKeyIdValid = TI_FALSE;
969         for (index = 0;
970              index < pCmdBld->tSecurity.uNumOfStations * NO_OF_RECONF_SECUR_KEYS_PER_STATION + NO_OF_EXTRA_RECONF_SECUR_KEYS;
971              index++)
972         {
973             (DB_KEYS(pCmdBld).pReconfKeys + index)->keyType = KEY_NULL;
974         }
975 
976         /* set the new tSecurity mode*/
977         pCmdBld->tSecurity.eSecurityMode = eSecurMode;
978 
979         /* disable defrag, duplicate detection on TNETW+XCC on chip level*/
980         /* YV- to add fragmentation control (if there is- artur ?)*/
981         return cmdBld_CfgRxMsduFormat (hCmdBld,
982                                        pCmdBld->tSecurity.eSecurityMode != TWD_CIPHER_CKIP,
983                                        fCb,
984                                        hCb);
985     }
986     else
987     {
988         return TI_NOK;
989     }
990 }
991 
992 
cmdBld_CfgConnMonitParams(TI_HANDLE hCmdBld,TRroamingTriggerParams * pRoamingTriggerCmd,void * fCb,TI_HANDLE hCb)993 TI_STATUS cmdBld_CfgConnMonitParams (TI_HANDLE  hCmdBld,
994                                      TRroamingTriggerParams *pRoamingTriggerCmd,
995                                      void       *fCb,
996                                      TI_HANDLE  hCb)
997 {
998     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
999 
1000     TRACE2(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "SetBssLossTsfThresholdParamsCmd :\n                             BssLossTimeout = %d\n                             TsfMissThreshold = %d \n ", pRoamingTriggerCmd->BssLossTimeout, pRoamingTriggerCmd->TsfMissThreshold);
1001 
1002     DB_WLAN(hCmdBld).roamTriggers.BssLossTimeout = pRoamingTriggerCmd->BssLossTimeout;
1003     DB_WLAN(hCmdBld).roamTriggers.TsfMissThreshold = pRoamingTriggerCmd->TsfMissThreshold;
1004 
1005     return cmdBld_CfgIeConnMonitParams (hCmdBld, pRoamingTriggerCmd, fCb, hCb);
1006 }
1007 
1008 
1009 /****************************************************************************
1010  *                 cmdBld_CfgEnableRxDataFilter()
1011  ****************************************************************************
1012  * DESCRIPTION: Enables or disables Rx data filtering.
1013  *
1014  * INPUTS:  enabled             - 0 to disable data filtering, any other value to enable.
1015  *          defaultAction       - The default action to take on non-matching packets.
1016  *
1017  * OUTPUT:  None
1018  *
1019  * RETURNS: TI_OK or TI_NOK
1020  ****************************************************************************/
cmdBld_CfgEnableRxDataFilter(TI_HANDLE hCmdBld,TI_BOOL bEnabled,filter_e eDefaultAction,void * fCb,TI_HANDLE hCb)1021 TI_STATUS cmdBld_CfgEnableRxDataFilter (TI_HANDLE   hCmdBld,
1022                                         TI_BOOL     bEnabled,
1023                                         filter_e    eDefaultAction,
1024                                         void        *fCb,
1025                                         TI_HANDLE   hCb)
1026 {
1027     /* Save parameters for reconfig phase */
1028     DB_RX_DATA_FLTR(hCmdBld).bEnabled       = bEnabled;
1029     DB_RX_DATA_FLTR(hCmdBld).eDefaultAction = eDefaultAction;
1030 
1031     return cmdBld_CfgIeEnableRxDataFilter (hCmdBld, bEnabled, eDefaultAction, fCb, hCb);
1032 }
1033 
1034 
1035 /****************************************************************************
1036 *                      cmdBld_CfgRxDataFilter()
1037 *****************************************************************************
1038 * DESCRIPTION: Add/remove Rx Data filter information element.
1039 *
1040 * INPUTS:  index               - Index of the Rx Data filter
1041 *          command             - Add or remove the filter
1042 *          action              - Action to take on packets matching the pattern
1043 *          numFieldPatterns    - Number of field patterns in the filter
1044 *          lenFieldPatterns    - Length of the field pattern series
1045 *          fieldPatterns       - Series of field patterns
1046 *
1047 * OUTPUT:  None
1048 *
1049 * RETURNS: TI_OK or TI_NOK
1050 ****************************************************************************/
cmdBld_CfgRxDataFilter(TI_HANDLE hCmdBld,TI_UINT8 index,TI_UINT8 command,filter_e eAction,TI_UINT8 uNumFieldPatterns,TI_UINT8 uLenFieldPatterns,TI_UINT8 * pFieldPatterns,void * fCb,TI_HANDLE hCb)1051 TI_STATUS cmdBld_CfgRxDataFilter (TI_HANDLE hCmdBld,
1052                                   TI_UINT8     index,
1053                                   TI_UINT8     command,
1054                                   filter_e  eAction,
1055                                   TI_UINT8     uNumFieldPatterns,
1056                                   TI_UINT8     uLenFieldPatterns,
1057                                   TI_UINT8  *pFieldPatterns,
1058                                   void      *fCb,
1059                                   TI_HANDLE hCb)
1060 {
1061     TCmdBld         *pCmdBld  = (TCmdBld *)hCmdBld;
1062     TRxDataFilter   *pFilters = &(DB_RX_DATA_FLTR(hCmdBld).aRxDataFilter[index]);
1063 
1064     /* Save parameters for reconfig phase */
1065     pFilters->uIndex            = index;
1066     pFilters->uCommand          = command;
1067     pFilters->eAction           = eAction;
1068     pFilters->uNumFieldPatterns = uNumFieldPatterns;
1069     pFilters->uLenFieldPatterns = uLenFieldPatterns;
1070     os_memoryCopy(pCmdBld->hOs, pFilters->aFieldPattern, pFieldPatterns, uLenFieldPatterns);
1071 
1072     return cmdBld_CfgIeRxDataFilter (hCmdBld,
1073                                      index,
1074                                      command,
1075                                      eAction,
1076                                      uNumFieldPatterns,
1077                                      uLenFieldPatterns,
1078                                      pFieldPatterns,
1079                                      fCb,
1080                                      hCb);
1081 }
1082 
1083 
cmdBld_CfgCtsProtection(TI_HANDLE hCmdBld,TI_UINT8 uCtsProtection,void * fCb,TI_HANDLE hCb)1084 TI_STATUS cmdBld_CfgCtsProtection (TI_HANDLE hCmdBld, TI_UINT8 uCtsProtection, void *fCb, TI_HANDLE hCb)
1085     {
1086         DB_WLAN(hCmdBld).CtsToSelf = uCtsProtection;
1087 
1088     return cmdBld_CfgIeCtsProtection (hCmdBld, uCtsProtection, fCb, hCb);
1089 }
1090 
1091 
cmdBld_CfgServicePeriodTimeout(TI_HANDLE hCmdBld,TRxTimeOut * pRxTimeOut,void * fCb,TI_HANDLE hCb)1092 TI_STATUS cmdBld_CfgServicePeriodTimeout (TI_HANDLE hCmdBld, TRxTimeOut *pRxTimeOut, void *fCb, TI_HANDLE hCb)
1093 {
1094     return cmdBld_CfgIeServicePeriodTimeout (hCmdBld, pRxTimeOut, fCb, hCb);
1095 }
1096 
1097 
cmdBld_CfgRxMsduLifeTime(TI_HANDLE hCmdBld,TI_UINT32 uRxMsduLifeTime,void * fCb,TI_HANDLE hCb)1098 TI_STATUS cmdBld_CfgRxMsduLifeTime (TI_HANDLE hCmdBld, TI_UINT32 uRxMsduLifeTime, void *fCb, TI_HANDLE hCb)
1099     {
1100         DB_WLAN(hCmdBld).MaxRxMsduLifetime = uRxMsduLifeTime;
1101 
1102     return cmdBld_CfgIeRxMsduLifeTime (hCmdBld, uRxMsduLifeTime, fCb, hCb);
1103 }
1104 
1105 
cmdBld_CfgStatisitics(TI_HANDLE hCmdBld,void * fCb,TI_HANDLE hCb)1106 TI_STATUS cmdBld_CfgStatisitics (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb)
1107 {
1108     return cmdBld_CfgIeStatisitics (hCmdBld, fCb, hCb);
1109 }
1110 
1111 
cmdBld_CfgTxPowerDbm(TI_HANDLE hCmdBld,TI_UINT8 uTxPowerDbm,void * fCb,TI_HANDLE hCb)1112 TI_STATUS cmdBld_CfgTxPowerDbm (TI_HANDLE hCmdBld, TI_UINT8 uTxPowerDbm, void *fCb, TI_HANDLE hCb)
1113 {
1114     return cmdBld_CfgIeTxPowerDbm (hCmdBld, uTxPowerDbm, fCb, hCb);
1115 }
1116 
1117  /*
1118  * ----------------------------------------------------------------------------
1119  * Function : cmdBld_setBetParams
1120  *
1121  * Input    :   enabled               - 0 to disable BET, 0 to disable BET
1122  *              MaximumConsecutiveET  - Max number of consecutive beacons
1123  *                                      that may be early terminated.
1124  * Output   : TI_STATUS
1125  * Process  :  Configures Beacon Early Termination information element.
1126  * Note(s)  :  None
1127  * -----------------------------------------------------------------------------
1128  */
cmdBld_CfgBet(TI_HANDLE hCmdBld,TI_UINT8 Enable,TI_UINT8 MaximumConsecutiveET,void * fCb,TI_HANDLE hCb)1129 TI_STATUS cmdBld_CfgBet (TI_HANDLE hCmdBld, TI_UINT8 Enable, TI_UINT8 MaximumConsecutiveET, void *fCb, TI_HANDLE hCb)
1130 {
1131     DB_WLAN(hCmdBld).BetEnable              = Enable;
1132     DB_WLAN(hCmdBld).MaximumConsecutiveET   = MaximumConsecutiveET;
1133 
1134     return cmdBld_CfgIeBet (hCmdBld, Enable, MaximumConsecutiveET, fCb, hCb);
1135 }
1136 
1137 /****************************************************************************
1138  *                      cmdBld_CmdKeepAlive()
1139  ****************************************************************************
1140  * DESCRIPTION: Set keep-alive paramters for a single index
1141  *
1142  * INPUTS: Paramters and CB
1143  *
1144  * OUTPUT:  None
1145  *
1146  * RETURNS: TI_OK or TI_NOK
1147  ****************************************************************************/
cmdBld_CfgKeepAlive(TI_HANDLE hCmdBld,TKeepAliveParams * pKeepAliveParams,void * fCb,TI_HANDLE hCb)1148 TI_STATUS cmdBld_CfgKeepAlive (TI_HANDLE hCmdBld, TKeepAliveParams *pKeepAliveParams, void *fCb, TI_HANDLE hCb)
1149 {
1150     TCmdBld   *pCmdBld = (TCmdBld *)hCmdBld;
1151 
1152     TRACE4(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "CmdBld: Seeting keep-alive params, index=%d, interval=%d msec, trigType=%d, enaFlag=%d\n", pKeepAliveParams->index, pKeepAliveParams->interval, pKeepAliveParams->trigType, pKeepAliveParams->enaDisFlag);
1153 
1154     os_memoryCopy (pCmdBld->hOs,
1155                    (void *)&DB_KLV(hCmdBld).keepAliveParams[ pKeepAliveParams->index ],
1156                    (void *)pKeepAliveParams,
1157                    sizeof (TKeepAliveParams));
1158 
1159     return cmdBld_CmdIeConfigureKeepAliveParams (hCmdBld,
1160                                                  pKeepAliveParams->index,
1161                                                  pKeepAliveParams->enaDisFlag,
1162                                                  (TI_UINT8)pKeepAliveParams->trigType,
1163                                                  pKeepAliveParams->interval,
1164                                                  fCb,
1165                                                  hCb);
1166 }
1167 
1168 /****************************************************************************
1169  *                      cmdBld_CfgKeepAliveEnaDis()
1170  ****************************************************************************
1171  * DESCRIPTION: Set global keep-alive enable / disable flag
1172  *
1173  * INPUTS: Paramters and CB
1174  *
1175  * OUTPUT:  None
1176  *
1177  * RETURNS: TI_OK or TI_NOK
1178  ****************************************************************************/
cmdBld_CfgKeepAliveEnaDis(TI_HANDLE hCmdBld,TI_UINT8 enaDisFlag,void * fCb,TI_HANDLE hCb)1179 TI_STATUS cmdBld_CfgKeepAliveEnaDis(TI_HANDLE hCmdBld, TI_UINT8 enaDisFlag, void *fCb, TI_HANDLE hCb)
1180 {
1181     TCmdBld   *pCmdBld = (TCmdBld *)hCmdBld;
1182 
1183     TRACE1(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "CmdBld: Seeting keep-alive Global ena / dis flag to %d\n", (TI_UINT32)enaDisFlag);
1184 
1185     DB_KLV(hCmdBld).enaDisFlag = enaDisFlag;
1186 
1187     return cmdBld_CmdIeConfigureKeepAliveEnaDis (hCmdBld, enaDisFlag, fCb, hCb);
1188 }
1189 
1190 /**
1191  * \fn     cmdBld_CfgSetFwHtCapabilities
1192  * \brief  set the current AP HT Capabilities to the FW.
1193  *
1194  * \note
1195  * \return TI_OK on success or TI_NOK on failure
1196  * \sa
1197  */
cmdBld_CfgSetFwHtCapabilities(TI_HANDLE hCmdBld,TI_UINT32 uHtCapabilites,TMacAddr tMacAddress,TI_UINT8 uAmpduMaxLeng,TI_UINT8 uAmpduMinSpac,void * fCb,TI_HANDLE hCb)1198 TI_STATUS cmdBld_CfgSetFwHtCapabilities (TI_HANDLE hCmdBld,
1199                                          TI_UINT32 uHtCapabilites,
1200                                          TMacAddr  tMacAddress,
1201                                          TI_UINT8  uAmpduMaxLeng,
1202                                          TI_UINT8  uAmpduMinSpac,
1203                                          void      *fCb,
1204                                          TI_HANDLE hCb)
1205 {
1206 
1207     DB_BSS(hCmdBld).bHtCap = TI_TRUE;
1208     DB_BSS(hCmdBld).uHtCapabilites = uHtCapabilites;
1209     MAC_COPY ((DB_BSS(hCmdBld).tMacAddress), tMacAddress);
1210     DB_BSS(hCmdBld).uAmpduMaxLeng = uAmpduMaxLeng;
1211     DB_BSS(hCmdBld).uAmpduMinSpac = uAmpduMinSpac;
1212 
1213     return cmdBld_CfgIeSetFwHtCapabilities (hCmdBld,
1214                                             uHtCapabilites,
1215                                             tMacAddress,
1216                                             uAmpduMaxLeng,
1217                                             uAmpduMinSpac,
1218                                             fCb,
1219                                             hCb);
1220 }
1221 
1222 /**
1223  * \fn     cmdBld_CfgSetFwHtInformation
1224  * \brief  set the current AP HT Information to the FW.
1225  *
1226  * \note
1227  * \return TI_OK on success or TI_NOK on failure
1228  * \sa
1229  */
cmdBld_CfgSetFwHtInformation(TI_HANDLE hCmdBld,TI_UINT8 uRifsMode,TI_UINT8 uHtProtection,TI_UINT8 uGfProtection,TI_UINT8 uHtTxBurstLimit,TI_UINT8 uDualCtsProtection,void * fCb,TI_HANDLE hCb)1230 TI_STATUS cmdBld_CfgSetFwHtInformation (TI_HANDLE hCmdBld,
1231                                         TI_UINT8  uRifsMode,
1232                                         TI_UINT8  uHtProtection,
1233                                         TI_UINT8  uGfProtection,
1234                                         TI_UINT8  uHtTxBurstLimit,
1235                                         TI_UINT8  uDualCtsProtection,
1236                                         void      *fCb,
1237                                         TI_HANDLE hCb)
1238 {
1239 
1240     DB_BSS(hCmdBld).bHtInf = TI_TRUE;
1241     DB_BSS(hCmdBld).uRifsMode = uRifsMode;
1242     DB_BSS(hCmdBld).uHtProtection = uHtProtection;
1243     DB_BSS(hCmdBld).uGfProtection = uGfProtection;
1244     DB_BSS(hCmdBld).uHtTxBurstLimit = uHtTxBurstLimit;
1245     DB_BSS(hCmdBld).uDualCtsProtection = uDualCtsProtection;
1246 
1247     return cmdBld_CfgIeSetFwHtInformation (hCmdBld,
1248                                            uRifsMode,
1249                                            uHtProtection,
1250                                            uGfProtection,
1251                                            uHtTxBurstLimit,
1252                                            uDualCtsProtection,
1253                                            fCb,
1254                                            hCb);
1255 }
1256 
1257 /**
1258  * \fn     cmdBld_CfgSetBaInitiator
1259  * \brief  configure BA session initiator\receiver parameters setting in the FW.
1260  *
1261  * \note
1262  * \return TI_OK on success or TI_NOK on failure
1263  * \sa
1264  */
cmdBld_CfgSetBaSession(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)1265 TI_STATUS cmdBld_CfgSetBaSession (TI_HANDLE hCmdBld,
1266                                   InfoElement_e eBaType,
1267                                   TI_UINT8 uTid,
1268                                   TI_UINT8 uState,
1269                                   TMacAddr tRa,
1270                                   TI_UINT16 uWinSize,
1271                                   TI_UINT16 uInactivityTimeout,
1272                                   void *fCb,
1273                                   TI_HANDLE hCb)
1274 {
1275     if (ACX_BA_SESSION_INITIATOR_POLICY == eBaType)
1276     {
1277         DB_BSS(hCmdBld).bBaInitiator[uTid] = TI_TRUE;
1278         DB_BSS(hCmdBld).tBaSessionInitiatorPolicy[uTid].uTid = uTid;
1279         DB_BSS(hCmdBld).tBaSessionInitiatorPolicy[uTid].uPolicy = uState;
1280         MAC_COPY ((DB_BSS(hCmdBld).tBaSessionInitiatorPolicy[uTid].aMacAddress),tRa);
1281         DB_BSS(hCmdBld).tBaSessionInitiatorPolicy[uTid].uWinSize = uWinSize;
1282         DB_BSS(hCmdBld).tBaSessionInitiatorPolicy[uTid].uInactivityTimeout = uInactivityTimeout;
1283     }
1284     else
1285     {
1286         DB_BSS(hCmdBld).bBaResponder[uTid] = TI_TRUE;
1287         DB_BSS(hCmdBld).tBaSessionResponderPolicy[uTid].uTid = uTid;
1288         DB_BSS(hCmdBld).tBaSessionResponderPolicy[uTid].uPolicy = uState;
1289         MAC_COPY ((DB_BSS(hCmdBld).tBaSessionResponderPolicy[uTid].aMacAddress),tRa);
1290         DB_BSS(hCmdBld).tBaSessionResponderPolicy[uTid].uWinSize = uWinSize;
1291         DB_BSS(hCmdBld).tBaSessionResponderPolicy[uTid].uInactivityTimeout = uInactivityTimeout;
1292     }
1293 
1294     return cmdBld_CfgIeSetBaSession (hCmdBld,
1295                                      eBaType,
1296                                      uTid,
1297                                      uState,
1298                                      tRa,
1299                                      uWinSize,
1300                                      uInactivityTimeout,
1301                                      fCb,
1302                                      hCb);
1303 }
1304 
1305 
cmdBld_CfgBurstMode(TI_HANDLE hCmdBld,TI_BOOL bEnabled,void * fCb,TI_HANDLE hCb)1306 TI_STATUS cmdBld_CfgBurstMode (TI_HANDLE hCmdBld, TI_BOOL bEnabled, void *fCb, TI_HANDLE hCb)
1307 {
1308 	DB_AC(hCmdBld).isBurstModeEnabled = bEnabled;
1309 	return cmdBld_CfgIeBurstMode (hCmdBld, bEnabled, fCb, hCb);
1310 }
1311 
1312