CmdBldCfg.c revision 981801b95b81e6d1c7a2085967406e86af0f08fc
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 ****************************************************************************/
61TI_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 ****************************************************************************/
92TI_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 ****************************************************************************/
118TI_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 ****************************************************************************/
140TI_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 ****************************************************************************/
184TI_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 ****************************************************************************/
199TI_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 ****************************************************************************/
219TI_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 ****************************************************************************/
238TI_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 ****************************************************************************/
255TI_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 ****************************************************************************/
272TI_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
281typedef 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 ****************************************************************************/
296TI_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 ****************************************************************************/
330TI_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 ****************************************************************************/
366TI_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
371TI_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
392TI_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 ****************************************************************************/
431TI_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 ****************************************************************************/
451TI_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 ****************************************************************************/
471TI_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 ****************************************************************************/
490TI_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 ****************************************************************************/
509TI_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/****************************************************************************
527 *                     cmdBld_SetBeaconFilterIETable
528 ****************************************************************************
529 * DESCRIPTION: Sets Beacon filtering state
530 *
531 * INPUTS:  None
532 *
533 * OUTPUT:  None
534 *
535 * RETURNS: TI_OK or TI_NOK
536 ****************************************************************************/
537TI_STATUS cmdBld_CfgBeaconFilterTable (TI_HANDLE    hCmdBld,
538                                       TI_UINT8     uNumberOfIEs,
539                                       TI_UINT8     *pIETable,
540                                       TI_UINT8     uIETableSize,
541                                       void         *fCb,
542                                       TI_HANDLE    hCb)
543{
544    TCmdBld   *pCmdBld = (TCmdBld *)hCmdBld;
545
546    if (uIETableSize > BEACON_FILTER_TABLE_MAX_SIZE)
547    {
548        TRACE2(pCmdBld->hReport, REPORT_SEVERITY_ERROR, "cmdBld_CfgBeaconFilterTable: Table size is too big %d (>%d)\n", uIETableSize, BEACON_FILTER_TABLE_MAX_SIZE);
549
550        return PARAM_VALUE_NOT_VALID;
551    }
552
553    os_memoryZero (pCmdBld->hOs,
554                   (void *)DB_WLAN(hCmdBld).beaconFilterIETable.IETable,
555                   BEACON_FILTER_TABLE_MAX_SIZE);
556    os_memoryCopy (pCmdBld->hOs,
557                   (void *)DB_WLAN(hCmdBld).beaconFilterIETable.IETable,
558                   (void *)pIETable,
559                   uIETableSize);
560    DB_WLAN(hCmdBld).beaconFilterIETable.numberOfIEs = uNumberOfIEs;
561    DB_WLAN(hCmdBld).beaconFilterIETable.IETableSize = uIETableSize;
562
563    return cmdBld_CfgIeBeaconFilterTable (hCmdBld, uNumberOfIEs, pIETable, uIETableSize, fCb, hCb);
564}
565
566
567/*----------------------------------------*/
568/* Roaming Trigger Configuration Commands */
569/*----------------------------------------*/
570
571/****************************************************************************
572 *                      cmdBld_CfgRssiSnrTrigger()
573 ****************************************************************************
574 * DESCRIPTION: Set the RSSI/SNR Trigger parameters.
575 *
576 * INPUTS:
577 *
578 * OUTPUT:  None
579 *
580 * RETURNS: None
581 ****************************************************************************/
582TI_STATUS cmdBld_CfgRssiSnrTrigger (TI_HANDLE hCmdBld, RssiSnrTriggerCfg_t *pTriggerParam, void *fCb, TI_HANDLE hCb)
583{
584    DB_WLAN(hCmdBld).tRssiSnrTrigger[pTriggerParam->index].index     = pTriggerParam->index;
585    DB_WLAN(hCmdBld).tRssiSnrTrigger[pTriggerParam->index].threshold = pTriggerParam->threshold;
586    DB_WLAN(hCmdBld).tRssiSnrTrigger[pTriggerParam->index].pacing    = pTriggerParam->pacing;
587    DB_WLAN(hCmdBld).tRssiSnrTrigger[pTriggerParam->index].metric    = pTriggerParam->metric;
588    DB_WLAN(hCmdBld).tRssiSnrTrigger[pTriggerParam->index].type      = pTriggerParam->type;
589    DB_WLAN(hCmdBld).tRssiSnrTrigger[pTriggerParam->index].direction = pTriggerParam->direction;
590    DB_WLAN(hCmdBld).tRssiSnrTrigger[pTriggerParam->index].hystersis = pTriggerParam->hystersis;
591    DB_WLAN(hCmdBld).tRssiSnrTrigger[pTriggerParam->index].enable    = pTriggerParam->enable;
592
593    return cmdBld_CfgIeRssiSnrTrigger (hCmdBld, pTriggerParam, fCb, hCb);
594}
595
596
597/****************************************************************************
598 *                      cmdBld_CfgRssiSnrWeights()
599 ****************************************************************************
600 * DESCRIPTION: Set RSSI/SNR Weights for Average calculations.
601 *
602 * INPUTS:
603 *
604 * OUTPUT:  None
605 *
606 * RETURNS: None
607 ****************************************************************************/
608TI_STATUS cmdBld_CfgRssiSnrWeights (TI_HANDLE hCmdBld, RssiSnrAverageWeights_t *pWeightsParam, void *fCb, TI_HANDLE hCb)
609{
610    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
611
612    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  );
613
614    DB_WLAN(hCmdBld).tRssiSnrWeights.rssiBeaconAverageWeight = pWeightsParam->rssiBeaconAverageWeight;
615    DB_WLAN(hCmdBld).tRssiSnrWeights.rssiPacketAverageWeight = pWeightsParam->rssiPacketAverageWeight;
616    DB_WLAN(hCmdBld).tRssiSnrWeights.snrBeaconAverageWeight  = pWeightsParam->snrBeaconAverageWeight ;
617    DB_WLAN(hCmdBld).tRssiSnrWeights.snrPacketAverageWeight  = pWeightsParam->snrPacketAverageWeight ;
618
619    return cmdBld_CfgIeRssiSnrWeights (hCmdBld, pWeightsParam, fCb, hCb);
620}
621
622
623/****************************************************************************
624 *                      cmdBld_SetMaxTxRetryParameters()
625 ****************************************************************************
626 * DESCRIPTION: Set Max Tx retry parmaters.
627 *
628 * INPUTS:
629 *      maxTxRetry             max Tx Retry
630 *
631 * OUTPUT:  None
632 *
633 * RETURNS: None
634 ****************************************************************************/
635TI_STATUS cmdBld_CfgMaxTxRetry (TI_HANDLE hCmdBld, TRroamingTriggerParams *pRoamingTriggerCmd, void *fCb, TI_HANDLE hCb)
636{
637    DB_WLAN(hCmdBld).roamTriggers.maxTxRetry = pRoamingTriggerCmd->maxTxRetry;
638
639    return cmdBld_CfgIeMaxTxRetry (hCmdBld, pRoamingTriggerCmd, fCb, hCb);
640}
641
642
643/****************************************************************************
644 *                      cmdBld_SoftGeminiEnable()
645 ****************************************************************************
646 * DESCRIPTION: Save Soft Gemini enable parameter
647 *
648 * INPUTS:
649 *
650 * OUTPUT:
651 *
652 * RETURNS: TI_OK or TI_NOK
653 ****************************************************************************/
654TI_STATUS cmdBld_CfgSgEnable (TI_HANDLE hCmdBld, ESoftGeminiEnableModes eSgEnable, void *fCb, TI_HANDLE hCb)
655{
656    DB_WLAN(hCmdBld).SoftGeminiEnable = eSgEnable;
657
658    return cmdBld_CfgIeSgEnable (hCmdBld, eSgEnable, fCb, hCb);
659}
660
661
662/****************************************************************************
663 *                      cmdBld_SetSoftGeminiParams()
664 ****************************************************************************
665 * DESCRIPTION: Save Soft Gemini config parameter
666 *
667 * INPUTS:
668 *
669 * OUTPUT:
670 *
671 * RETURNS: TI_OK or TI_NOK
672 ****************************************************************************/
673TI_STATUS cmdBld_CfgSg (TI_HANDLE hCmdBld, TSoftGeminiParams *pSgParam, void *fCb, TI_HANDLE hCb)
674{
675    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
676
677    /* Copy params for recovery */
678    os_memoryCopy (pCmdBld->hOs,
679                   (void*)&DB_WLAN(hCmdBld).SoftGeminiParams,
680                   (void*)pSgParam,
681                   sizeof(TSoftGeminiParams));
682
683    return cmdBld_CfgIeSg (hCmdBld, pSgParam, fCb, hCb);
684}
685
686/****************************************************************************
687 *                      cmdBld_SetCoexActivityTable()
688 ****************************************************************************
689 * DESCRIPTION: Sets the CoexActivity table.
690 *
691 * OUTPUT:  None
692 *
693 * RETURNS: TI_OK or TI_NOK  pWlanParams->RtsThreshold
694 ****************************************************************************/
695TI_STATUS cmdBld_CfgCoexActivity (TI_HANDLE hCmdBld, TCoexActivity *pCoexActivity, void *fCb, TI_HANDLE hCb)
696{
697    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
698    TWlanParams *pWlanParams = &DB_WLAN(hCmdBld);
699    TCoexActivity *pSaveCoex = &pWlanParams->tWlanParamsCoexActivityTable.entry[0];
700    int numOfElements = pWlanParams->tWlanParamsCoexActivityTable.numOfElements;
701    int i;
702
703    /* Check if to overwrite existing entry or put on last index */
704    for (i=0; i<numOfElements; i++)
705    {
706        if ((pSaveCoex[i].activityId == pCoexActivity->activityId) && (pSaveCoex->coexIp == pCoexActivity->coexIp))
707        {
708            break;
709        }
710    }
711
712    TRACE4(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "cmdBld_CfgCoexActivity: save Param %d in index %d, %d %d\n", 0, i, pCoexActivity->coexIp, pCoexActivity->activityId);
713    /* save in WlanParams for recovery */
714    pSaveCoex[i].coexIp          = pCoexActivity->coexIp;
715    pSaveCoex[i].activityId      = pCoexActivity->activityId;
716    pSaveCoex[i].defaultPriority = pCoexActivity->defaultPriority;
717    pSaveCoex[i].raisedPriority  = pCoexActivity->raisedPriority;
718    pSaveCoex[i].minService      = pCoexActivity->minService;
719    pSaveCoex[i].maxService      = pCoexActivity->maxService;
720
721    if (i == numOfElements)
722    {
723        /* no existing entry overwrite, increment number of elements */
724        pWlanParams->tWlanParamsCoexActivityTable.numOfElements++;
725    }
726
727    return cmdBld_CfgIeCoexActivity (hCmdBld, pCoexActivity, fCb, hCb);
728}
729
730/****************************************************************************
731 *                      cmdBld_TxRatePolicy()
732 ****************************************************************************
733 * DESCRIPTION: configure TxRatePolicy params
734 *
735 * INPUTS: None
736 *
737 * OUTPUT:  None
738 *
739 * RETURNS: TI_OK or TI_NOK
740 ****************************************************************************/
741TI_STATUS cmdBld_CfgTxRatePolicy (TI_HANDLE hCmdBld, TTxRatePolicy *pTxRatePolicy, void *fCb, TI_HANDLE hCb)
742{
743    TCmdBld       *pCmdBld      = (TCmdBld *)hCmdBld;
744    TTxRateClass  *pTxRateClass = pTxRatePolicy->rateClass;
745    TI_UINT8       index;
746
747    TRACE1(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "_1, Num of classes = 0x%x\n", pTxRatePolicy->numOfRateClasses);
748
749    DB_BSS(hCmdBld).TxRateClassParams.numOfRateClasses = pTxRatePolicy->numOfRateClasses;
750
751    for (index = 0; index < pTxRatePolicy->numOfRateClasses; index++, pTxRateClass++)
752    {
753        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);
754
755        DB_BSS(hCmdBld).TxRateClassParams.rateClass[index] = *pTxRateClass;
756    }
757
758    return cmdBld_CfgIeTxRatePolicy (hCmdBld, pTxRatePolicy, fCb, hCb);
759}
760
761
762TI_STATUS cmdBld_CfgSlotTime (TI_HANDLE hCmdBld, ESlotTime eSlotTime, void *fCb, TI_HANDLE hCb)
763{
764    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
765
766    DB_WLAN(hCmdBld).SlotTime = eSlotTime;
767
768    TRACE1(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "TWD_SetSlotTime : Slot time = %d\n", eSlotTime);
769
770    /* Configure the new Slot-Time value to the FW. */
771    return cmdBld_CfgIeSlotTime (hCmdBld, (TI_UINT8)eSlotTime, fCb, hCb);
772}
773
774
775TI_STATUS cmdBld_CfgEventMask (TI_HANDLE hCmdBld, TI_UINT32 uEventMask, void *fCb, TI_HANDLE hCb)
776{
777    return cmdBld_CfgIeEventMask (hCmdBld, uEventMask, fCb, hCb);
778}
779
780
781/*
782 * ----------------------------------------------------------------------------
783 * Function : cmdBld_CfgHwEncEnable
784 *
785 * Input    :
786 * Output   :
787 * Process  :
788 * Note(s)  :
789 * -----------------------------------------------------------------------------
790 */
791TI_STATUS cmdBld_CfgHwEncEnable (TI_HANDLE hCmdBld, TI_BOOL bHwEncEnable, TI_BOOL bHwDecEnable, void *fCb, TI_HANDLE hCb)
792{
793    TCmdBld     *pCmdBld = (TCmdBld *)hCmdBld;
794    TWlanParams *pWlanParams = &DB_WLAN(hCmdBld);
795
796    /* Store the HW encryption Enable flag for reconfigure time (FW reload)*/
797    DB_KEYS(pCmdBld).bReconfHwEncEnable = bHwEncEnable;
798    DB_KEYS(pCmdBld).bHwEncDecrEnableValid = TI_TRUE;
799
800    if (bHwEncEnable)
801    {
802        pWlanParams->FeatureDataFlowOptions &= ~DF_ENCRYPTION_DISABLE;
803    }
804    else
805    {
806        pWlanParams->FeatureDataFlowOptions |= DF_ENCRYPTION_DISABLE;
807    }
808
809    /* Set bit DF_SNIFF_MODE_ENABLE to enable or prevent decryption in fw */
810    /* WARNING: Have to check how to control the decryption (which bit) and then set/reset
811                the  appropriate bit*/
812    if (bHwDecEnable)
813    {
814        pWlanParams->FeatureDataFlowOptions &= ~DF_SNIFF_MODE_ENABLE;
815    }
816    else
817    {
818        pWlanParams->FeatureDataFlowOptions |= DF_SNIFF_MODE_ENABLE;
819    }
820
821    return cmdBld_CfgIeFeatureConfig (hCmdBld,
822                                      pWlanParams->FeatureOptions,
823                                      pWlanParams->FeatureDataFlowOptions,
824                                      fCb,
825                                      hCb);
826}
827
828
829TI_STATUS cmdBld_CfgHwEncDecEnable (TI_HANDLE hCmdBld, TI_BOOL bHwEncEnable, void *fCb, TI_HANDLE hCb)
830{
831    return cmdBld_CfgHwEncEnable (hCmdBld, bHwEncEnable, bHwEncEnable, fCb, hCb);
832}
833
834
835/*
836 * ----------------------------------------------------------------------------
837 * Function : cmdBld_CfgSecureMode
838 *
839 * Input    :
840 * Output   :
841 * Process  :
842 * Note(s)  :
843 * -----------------------------------------------------------------------------
844 */
845TI_STATUS cmdBld_CfgSecureMode (TI_HANDLE hCmdBld, ECipherSuite eSecurMode, void *fCb, TI_HANDLE hCb)
846{
847    TCmdBld  *pCmdBld = (TCmdBld *)hCmdBld;
848    TI_UINT32     index;
849
850    if (eSecurMode < TWD_CIPHER_MAX)
851    {
852        TRACE2(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "cmdBld_CfgSecureMode: change tSecurity mode from %d --> %d\n", pCmdBld->tSecurity.eSecurityMode, eSecurMode);
853        /* check if tSecurity mode is equal to previous one*/
854        if (pCmdBld->tSecurity.eSecurityMode == eSecurMode)
855        {
856            return TI_OK;
857        }
858
859        /* Reset all reconfig valid fields*/
860        DB_KEYS(pCmdBld).bHwEncDecrEnableValid = TI_FALSE;
861        DB_KEYS(pCmdBld).bDefaultKeyIdValid = TI_FALSE;
862        for (index = 0;
863             index < pCmdBld->tSecurity.uNumOfStations * NO_OF_RECONF_SECUR_KEYS_PER_STATION + NO_OF_EXTRA_RECONF_SECUR_KEYS;
864             index++)
865        {
866            (DB_KEYS(pCmdBld).pReconfKeys + index)->keyType = KEY_NULL;
867        }
868
869        /* set the new tSecurity mode*/
870        pCmdBld->tSecurity.eSecurityMode = eSecurMode;
871
872        /* disable defrag, duplicate detection on TNETW+XCC on chip level*/
873        /* YV- to add fragmentation control (if there is- artur ?)*/
874        return cmdBld_CfgRxMsduFormat (hCmdBld,
875                                       pCmdBld->tSecurity.eSecurityMode != TWD_CIPHER_CKIP,
876                                       fCb,
877                                       hCb);
878    }
879    else
880    {
881        return TI_NOK;
882    }
883}
884
885
886TI_STATUS cmdBld_CfgConnMonitParams (TI_HANDLE  hCmdBld,
887                                     TRroamingTriggerParams *pRoamingTriggerCmd,
888                                     void       *fCb,
889                                     TI_HANDLE  hCb)
890{
891    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
892
893    TRACE2(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "SetBssLossTsfThresholdParamsCmd :\n                             BssLossTimeout = %d\n                             TsfMissThreshold = %d \n ", pRoamingTriggerCmd->BssLossTimeout, pRoamingTriggerCmd->TsfMissThreshold);
894
895    DB_WLAN(hCmdBld).roamTriggers.BssLossTimeout = pRoamingTriggerCmd->BssLossTimeout;
896    DB_WLAN(hCmdBld).roamTriggers.TsfMissThreshold = pRoamingTriggerCmd->TsfMissThreshold;
897
898    return cmdBld_CfgIeConnMonitParams (hCmdBld, pRoamingTriggerCmd, fCb, hCb);
899}
900
901
902/****************************************************************************
903 *                 cmdBld_CfgEnableRxDataFilter()
904 ****************************************************************************
905 * DESCRIPTION: Enables or disables Rx data filtering.
906 *
907 * INPUTS:  enabled             - 0 to disable data filtering, any other value to enable.
908 *          defaultAction       - The default action to take on non-matching packets.
909 *
910 * OUTPUT:  None
911 *
912 * RETURNS: TI_OK or TI_NOK
913 ****************************************************************************/
914TI_STATUS cmdBld_CfgEnableRxDataFilter (TI_HANDLE   hCmdBld,
915                                        TI_BOOL     bEnabled,
916                                        filter_e    eDefaultAction,
917                                        void        *fCb,
918                                        TI_HANDLE   hCb)
919{
920    /* Save parameters for reconfig phase */
921    DB_RX_DATA_FLTR(hCmdBld).bEnabled       = bEnabled;
922    DB_RX_DATA_FLTR(hCmdBld).eDefaultAction = eDefaultAction;
923
924    return cmdBld_CfgIeEnableRxDataFilter (hCmdBld, bEnabled, eDefaultAction, fCb, hCb);
925}
926
927
928/****************************************************************************
929*                      cmdBld_CfgRxDataFilter()
930*****************************************************************************
931* DESCRIPTION: Add/remove Rx Data filter information element.
932*
933* INPUTS:  index               - Index of the Rx Data filter
934*          command             - Add or remove the filter
935*          action              - Action to take on packets matching the pattern
936*          numFieldPatterns    - Number of field patterns in the filter
937*          lenFieldPatterns    - Length of the field pattern series
938*          fieldPatterns       - Series of field patterns
939*
940* OUTPUT:  None
941*
942* RETURNS: TI_OK or TI_NOK
943****************************************************************************/
944TI_STATUS cmdBld_CfgRxDataFilter (TI_HANDLE hCmdBld,
945                                  TI_UINT8     index,
946                                  TI_UINT8     command,
947                                  filter_e  eAction,
948                                  TI_UINT8     uNumFieldPatterns,
949                                  TI_UINT8     uLenFieldPatterns,
950                                  TI_UINT8  *pFieldPatterns,
951                                  void      *fCb,
952                                  TI_HANDLE hCb)
953{
954    TCmdBld         *pCmdBld  = (TCmdBld *)hCmdBld;
955    TRxDataFilter   *pFilters = &(DB_RX_DATA_FLTR(hCmdBld).aRxDataFilter[index]);
956
957
958    /* Save parameters for reconfig phase */
959    pFilters->uIndex            = index;
960    pFilters->uCommand          = command;
961    pFilters->eAction           = eAction;
962    pFilters->uNumFieldPatterns = uNumFieldPatterns;
963    pFilters->uLenFieldPatterns = uLenFieldPatterns;
964    os_memoryCopy(pCmdBld->hOs, pFilters->aFieldPattern, pFieldPatterns, uLenFieldPatterns);
965
966
967    return cmdBld_CfgIeRxDataFilter (hCmdBld,
968                                     index,
969                                     command,
970                                     eAction,
971                                     uNumFieldPatterns,
972                                     uLenFieldPatterns,
973                                     pFieldPatterns,
974                                     fCb,
975                                     hCb);
976}
977
978
979TI_STATUS cmdBld_CfgCtsProtection (TI_HANDLE hCmdBld, TI_UINT8 uCtsProtection, void *fCb, TI_HANDLE hCb)
980    {
981        DB_WLAN(hCmdBld).CtsToSelf = uCtsProtection;
982
983    return cmdBld_CfgIeCtsProtection (hCmdBld, uCtsProtection, fCb, hCb);
984}
985
986
987TI_STATUS cmdBld_CfgServicePeriodTimeout (TI_HANDLE hCmdBld, TRxTimeOut *pRxTimeOut, void *fCb, TI_HANDLE hCb)
988{
989    return cmdBld_CfgIeServicePeriodTimeout (hCmdBld, pRxTimeOut, fCb, hCb);
990}
991
992
993TI_STATUS cmdBld_CfgRxMsduLifeTime (TI_HANDLE hCmdBld, TI_UINT32 uRxMsduLifeTime, void *fCb, TI_HANDLE hCb)
994    {
995        DB_WLAN(hCmdBld).MaxRxMsduLifetime = uRxMsduLifeTime;
996
997    return cmdBld_CfgIeRxMsduLifeTime (hCmdBld, uRxMsduLifeTime, fCb, hCb);
998}
999
1000
1001TI_STATUS cmdBld_CfgStatisitics (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb)
1002{
1003    return cmdBld_CfgIeStatisitics (hCmdBld, fCb, hCb);
1004}
1005
1006
1007TI_STATUS cmdBld_CfgTxPowerDbm (TI_HANDLE hCmdBld, TI_UINT8 uTxPowerDbm, void *fCb, TI_HANDLE hCb)
1008{
1009    return cmdBld_CfgIeTxPowerDbm (hCmdBld, uTxPowerDbm, fCb, hCb);
1010}
1011
1012 /*
1013 * ----------------------------------------------------------------------------
1014 * Function : cmdBld_setBetParams
1015 *
1016 * Input    :   enabled               - 0 to disable BET, 0 to disable BET
1017 *              MaximumConsecutiveET  - Max number of consecutive beacons
1018 *                                      that may be early terminated.
1019 * Output   : TI_STATUS
1020 * Process  :  Configures Beacon Early Termination information element.
1021 * Note(s)  :  None
1022 * -----------------------------------------------------------------------------
1023 */
1024TI_STATUS cmdBld_CfgBet (TI_HANDLE hCmdBld, TI_UINT8 Enable, TI_UINT8 MaximumConsecutiveET, void *fCb, TI_HANDLE hCb)
1025{
1026    DB_WLAN(hCmdBld).BetEnable              = Enable;
1027    DB_WLAN(hCmdBld).MaximumConsecutiveET   = MaximumConsecutiveET;
1028
1029    return cmdBld_CfgIeBet (hCmdBld, Enable, MaximumConsecutiveET, fCb, hCb);
1030}
1031
1032/****************************************************************************
1033 *                      cmdBld_CmdKeepAlive()
1034 ****************************************************************************
1035 * DESCRIPTION: Set keep-alive paramters for a single index
1036 *
1037 * INPUTS: Paramters and CB
1038 *
1039 * OUTPUT:  None
1040 *
1041 * RETURNS: TI_OK or TI_NOK
1042 ****************************************************************************/
1043TI_STATUS cmdBld_CfgKeepAlive (TI_HANDLE hCmdBld, TKeepAliveParams *pKeepAliveParams, void *fCb, TI_HANDLE hCb)
1044{
1045    TCmdBld   *pCmdBld = (TCmdBld *)hCmdBld;
1046
1047    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);
1048
1049    os_memoryCopy (pCmdBld->hOs,
1050                   (void *)&DB_KLV(hCmdBld).keepAliveParams[ pKeepAliveParams->index ],
1051                   (void *)pKeepAliveParams,
1052                   sizeof (TKeepAliveParams));
1053
1054    return cmdBld_CmdIeConfigureKeepAliveParams (hCmdBld,
1055                                                 pKeepAliveParams->index,
1056                                                 pKeepAliveParams->enaDisFlag,
1057                                                 (TI_UINT8)pKeepAliveParams->trigType,
1058                                                 pKeepAliveParams->interval,
1059                                                 fCb,
1060                                                 hCb);
1061}
1062
1063/****************************************************************************
1064 *                      cmdBld_CfgKeepAliveEnaDis()
1065 ****************************************************************************
1066 * DESCRIPTION: Set global keep-alive enable / disable flag
1067 *
1068 * INPUTS: Paramters and CB
1069 *
1070 * OUTPUT:  None
1071 *
1072 * RETURNS: TI_OK or TI_NOK
1073 ****************************************************************************/
1074TI_STATUS cmdBld_CfgKeepAliveEnaDis(TI_HANDLE hCmdBld, TI_UINT8 enaDisFlag, void *fCb, TI_HANDLE hCb)
1075{
1076    TCmdBld   *pCmdBld = (TCmdBld *)hCmdBld;
1077
1078    TRACE1(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "CmdBld: Seeting keep-alive Global ena / dis flag to %d\n", (TI_UINT32)enaDisFlag);
1079
1080    DB_KLV(hCmdBld).enaDisFlag = enaDisFlag;
1081
1082    return cmdBld_CmdIeConfigureKeepAliveEnaDis (hCmdBld, enaDisFlag, fCb, hCb);
1083}
1084
1085/**
1086 * \fn     cmdBld_CfgSetFwHtCapabilities
1087 * \brief  set the current AP HT Capabilities to the FW.
1088 *
1089 * \note
1090 * \return TI_OK on success or TI_NOK on failure
1091 * \sa
1092 */
1093TI_STATUS cmdBld_CfgSetFwHtCapabilities (TI_HANDLE hCmdBld,
1094                                         TI_UINT32 uHtCapabilites,
1095                                         TMacAddr  tMacAddress,
1096                                         TI_UINT8  uAmpduMaxLeng,
1097                                         TI_UINT8  uAmpduMinSpac,
1098                                         void      *fCb,
1099                                         TI_HANDLE hCb)
1100{
1101
1102    DB_BSS(hCmdBld).bHtCap = TI_TRUE;
1103    DB_BSS(hCmdBld).uHtCapabilites = uHtCapabilites;
1104    MAC_COPY ((DB_BSS(hCmdBld).tMacAddress), tMacAddress);
1105    DB_BSS(hCmdBld).uAmpduMaxLeng = uAmpduMaxLeng;
1106    DB_BSS(hCmdBld).uAmpduMinSpac = uAmpduMinSpac;
1107
1108    return cmdBld_CfgIeSetFwHtCapabilities (hCmdBld,
1109                                            uHtCapabilites,
1110                                            tMacAddress,
1111                                            uAmpduMaxLeng,
1112                                            uAmpduMinSpac,
1113                                            fCb,
1114                                            hCb);
1115}
1116
1117/**
1118 * \fn     cmdBld_CfgSetFwHtInformation
1119 * \brief  set the current AP HT Information to the FW.
1120 *
1121 * \note
1122 * \return TI_OK on success or TI_NOK on failure
1123 * \sa
1124 */
1125TI_STATUS cmdBld_CfgSetFwHtInformation (TI_HANDLE hCmdBld,
1126                                        TI_UINT8  uRifsMode,
1127                                        TI_UINT8  uHtProtection,
1128                                        TI_UINT8  uGfProtection,
1129                                        TI_UINT8  uHtTxBurstLimit,
1130                                        TI_UINT8  uDualCtsProtection,
1131                                        void      *fCb,
1132                                        TI_HANDLE hCb)
1133{
1134
1135    DB_BSS(hCmdBld).bHtInf = TI_TRUE;
1136    DB_BSS(hCmdBld).uRifsMode = uRifsMode;
1137    DB_BSS(hCmdBld).uHtProtection = uHtProtection;
1138    DB_BSS(hCmdBld).uGfProtection = uGfProtection;
1139    DB_BSS(hCmdBld).uHtTxBurstLimit = uHtTxBurstLimit;
1140    DB_BSS(hCmdBld).uDualCtsProtection = uDualCtsProtection;
1141
1142    return cmdBld_CfgIeSetFwHtInformation (hCmdBld,
1143                                           uRifsMode,
1144                                           uHtProtection,
1145                                           uGfProtection,
1146                                           uHtTxBurstLimit,
1147                                           uDualCtsProtection,
1148                                           fCb,
1149                                           hCb);
1150}
1151
1152/**
1153 * \fn     cmdBld_CfgSetBaInitiator
1154 * \brief  configure BA session initiator\receiver parameters setting in the FW.
1155 *
1156 * \note
1157 * \return TI_OK on success or TI_NOK on failure
1158 * \sa
1159 */
1160TI_STATUS cmdBld_CfgSetBaSession (TI_HANDLE hCmdBld,
1161                                  InfoElement_e eBaType,
1162                                  TI_UINT8 uTid,
1163                                  TI_UINT8 uState,
1164                                  TMacAddr tRa,
1165                                  TI_UINT16 uWinSize,
1166                                  TI_UINT16 uInactivityTimeout,
1167                                  void *fCb,
1168                                  TI_HANDLE hCb)
1169{
1170    if (ACX_BA_SESSION_INITIATOR_POLICY == eBaType)
1171    {
1172        DB_BSS(hCmdBld).bBaInitiator[uTid] = TI_TRUE;
1173        DB_BSS(hCmdBld).tBaSessionInitiatorPolicy[uTid].uTid = uTid;
1174        DB_BSS(hCmdBld).tBaSessionInitiatorPolicy[uTid].uPolicy = uState;
1175        MAC_COPY ((DB_BSS(hCmdBld).tBaSessionInitiatorPolicy[uTid].aMacAddress),tRa);
1176        DB_BSS(hCmdBld).tBaSessionInitiatorPolicy[uTid].uWinSize = uWinSize;
1177        DB_BSS(hCmdBld).tBaSessionInitiatorPolicy[uTid].uInactivityTimeout = uInactivityTimeout;
1178    }
1179    else
1180    {
1181        DB_BSS(hCmdBld).bBaResponder[uTid] = TI_TRUE;
1182        DB_BSS(hCmdBld).tBaSessionResponderPolicy[uTid].uTid = uTid;
1183        DB_BSS(hCmdBld).tBaSessionResponderPolicy[uTid].uPolicy = uState;
1184        MAC_COPY ((DB_BSS(hCmdBld).tBaSessionResponderPolicy[uTid].aMacAddress),tRa);
1185        DB_BSS(hCmdBld).tBaSessionResponderPolicy[uTid].uWinSize = uWinSize;
1186        DB_BSS(hCmdBld).tBaSessionResponderPolicy[uTid].uInactivityTimeout = uInactivityTimeout;
1187    }
1188
1189    return cmdBld_CfgIeSetBaSession (hCmdBld,
1190                                     eBaType,
1191                                     uTid,
1192                                     uState,
1193                                     tRa,
1194                                     uWinSize,
1195                                     uInactivityTimeout,
1196                                     fCb,
1197                                     hCb);
1198}
1199
1200
1201TI_STATUS cmdBld_CfgBurstMode (TI_HANDLE hCmdBld, TI_BOOL bEnabled, void *fCb, TI_HANDLE hCb)
1202{
1203	DB_AC(hCmdBld).isBurstModeEnabled = bEnabled;
1204	return cmdBld_CfgIeBurstMode (hCmdBld, bEnabled, fCb, hCb);
1205}
1206
1207