• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * CmdBld.c
3  *
4  * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  *  * Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  *  * Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in
15  *    the documentation and/or other materials provided with the
16  *    distribution.
17  *  * Neither the name Texas Instruments nor the names of its
18  *    contributors may be used to endorse or promote products derived
19  *    from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  */
33 
34 
35 /** \file  CmdBld.c
36  *  \brief Command builder main
37  *
38  *  \see   CmdBld.h
39  */
40 #define __FILE_ID__  FILE_ID_90
41 #include "TWDriver.h"
42 #include "osApi.h"
43 #include "tidef.h"
44 #include "report.h"
45 #include "public_infoele.h"
46 #include "CmdBld.h"
47 #include "txResult_api.h"
48 #include "CmdBldCmdIE.h"
49 #include "CmdBldCfgIE.h"
50 #include "CmdBldItrIE.h"
51 #include "CmdQueue_api.h"
52 #include "eventMbox_api.h"
53 #include "TWDriverInternal.h"
54 #include "HwInit_api.h"
55 
56 #define DEFAULT_TRACE_ENABLE                   0
57 #define DEFAULT_TRACE_OUT                      0
58 
59 #define DEFAULT_PBCC_DYNAMIC_ENABLE_VAL        0
60 #define DEFAULT_PBCC_DYNAMIC_INTERVAL          500
61 #define DEFAULT_PBCC_DYNAMIC_IGNORE_MCAST      0
62 
63 #define DEFAULT_HW_RADIO_CHANNEL               11
64 
65 #define DEFAULT_CW_MIN                         15
66 
67 #define DEFAULT_USE_DEVICE_ERROR_INTERRUPT     1
68 
69 #define DEFAULT_UCAST_PRIORITY                 0
70 
71 #define DEFAULT_NUM_STATIONS                   1
72 
73 /* only for AP */
74 /*  8 increase number of BC frames */
75 #define DEFAULT_NUM_BCAST_TX_DESC              16
76 
77 #define DEFAULT_BCAST_PRIORITY                 0x81
78 
79 /* hw access method*/
80 typedef enum
81 {
82     HW_ACCESS_BUS_SLAVE_INDIRECT    = 0,
83     HW_ACCESS_BUS_SLAVE_DIRECT      = 1,
84     HW_ACCESS_BUS_MASTER            = 2
85 
86 } EHwAccessMethod;
87 
88 typedef int (*TConfigFwCb) (TI_HANDLE, TI_STATUS);
89 
90 
91 static TI_STATUS cmdBld_ConfigSeq               (TI_HANDLE hCmdBld);
92 static TI_STATUS cmdBld_GetCurrentAssociationId (TI_HANDLE hCmdBld, TI_UINT16 *pAidVal);
93 static TI_STATUS cmdBld_GetArpIpAddressesTable  (TI_HANDLE hCmdBld, TIpAddr *pIpAddr, TI_UINT8 *pEnabled , EIpVer *pIpVer);
94 static TI_STATUS cmdBld_JoinCmpltForReconfigCb  (TI_HANDLE hCmdBld);
95 static TI_STATUS cmdBld_DummyCb                 (TI_HANDLE hCmdBld);
96 
97 
98 
99 
cmdBld_Create(TI_HANDLE hOs)100 TI_HANDLE cmdBld_Create (TI_HANDLE hOs)
101 {
102     TCmdBld        *pCmdBld;
103     TI_UINT32      uNumOfStations;
104     TI_UINT32      i;
105 
106     /* Allocate the command builder */
107     pCmdBld = (TCmdBld *)os_memoryAlloc (hOs, sizeof(TCmdBld));
108     if (pCmdBld == NULL)
109     {
110         WLAN_OS_REPORT(("cmdBld_Create: Error memory allocation\n"));
111         return NULL;
112     }
113     os_memoryZero (hOs, (void *)pCmdBld, sizeof(TCmdBld));
114 
115     pCmdBld->hOs = hOs;
116 
117     /* Create the Params object */
118     /* make this code flat, move it to configure */
119     {
120         TWlanParams     *pWlanParams    = &DB_WLAN(pCmdBld);
121         TDmaParams      *pDmaParams     = &DB_DMA(pCmdBld);
122         TBssInfoParams  *pBssInfoParams = &DB_BSS(pCmdBld);
123         TGenCounters    *pGenCounters   = &DB_CNT(pCmdBld);
124 
125         /* General counters */
126         pGenCounters->FcsErrCnt                     = 0;
127 
128         /* BSS info paramaters */
129         pBssInfoParams->RadioChannel                = DEFAULT_HW_RADIO_CHANNEL;
130         pBssInfoParams->Ctrl                        = 0;
131         /*
132          * Intilaize the ctrl field in the BSS join structure
133          * Only bit_7 in the ctrl field is vurrently in use.
134          * If bit_7 is on => Doing Tx flash before joining new AP
135          */
136         pBssInfoParams->Ctrl                        |= JOIN_CMD_CTRL_TX_FLUSH;
137 
138         /* WLAN parameters*/
139 
140         /* Init filters as station (start/join with BssType will overwrite the values) */
141         cmdBld_SetRxFilter ((TI_HANDLE)pCmdBld, RX_CONFIG_OPTION_MY_DST_MY_BSS, RX_FILTER_OPTION_FILTER_ALL);
142         pWlanParams->UseDeviceErrorInterrupt        = DEFAULT_USE_DEVICE_ERROR_INTERRUPT;
143         /* Initialize the params object database fields */
144         pWlanParams->hwAccessMethod = HW_ACCESS_BUS_SLAVE_INDIRECT;
145         pWlanParams->maxSitesFragCollect = TWD_SITE_FRAG_COLLECT_DEF;
146         pWlanParams->RtsThreshold = TWD_RTS_THRESHOLD_DEF;
147         pWlanParams->bJoin = TI_FALSE;
148         /* Soft Gemini defaults */
149         pWlanParams->SoftGeminiEnable = SG_DISABLE;
150         /* Beacon filter defaults */
151         pWlanParams->beaconFilterParams.desiredState    = TI_FALSE;
152         pWlanParams->beaconFilterParams.numOfElements   = DEF_NUM_STORED_FILTERS;
153         pWlanParams->beaconFilterIETable.numberOfIEs    = DEF_BEACON_FILTER_IE_TABLE_NUM;
154         pWlanParams->beaconFilterIETable.IETableSize    = BEACON_FILTER_IE_TABLE_DEF_SIZE;
155         /* Roaming  parameters */
156         pWlanParams->roamTriggers.BssLossTimeout    = NO_BEACON_DEFAULT_TIMEOUT;
157         pWlanParams->roamTriggers.TsfMissThreshold  = OUT_OF_SYNC_DEFAULT_THRESHOLD;
158         /* CoexActivity table */
159         pWlanParams->tWlanParamsCoexActivityTable.numOfElements = COEX_ACTIVITY_TABLE_DEF_NUM;
160 
161         /* DMA parameters */
162         /* Initialize the Params object database fields*/
163         pDmaParams->NumStations                     = DEFAULT_NUM_STATIONS;
164         uNumOfStations                              = (TI_UINT32)pDmaParams->NumStations;
165         /*
166          * loop an all rssi_snr triggers and initialize only index number.
167          * Reason: 'index' not initialized --> 'index = 0' --> triggers 1..7 will overrun trigger '0' in cmdBld_ConfigSeq
168          */
169         for (i = 0; i < NUM_OF_RSSI_SNR_TRIGGERS ; i++)
170         {
171            pWlanParams->tRssiSnrTrigger[i].index = i;
172         }
173     }
174 
175     pCmdBld->uLastElpCtrlMode = ELPCTRL_MODE_NORMAL;
176 
177     /* Create security objects */
178     pCmdBld->tSecurity.eSecurityMode = TWD_CIPHER_NONE;
179     pCmdBld->tSecurity.uNumOfStations = uNumOfStations;
180     DB_KEYS(pCmdBld).pReconfKeys = (TSecurityKeys*)os_memoryAlloc (hOs,
181                                         sizeof(TSecurityKeys) * (uNumOfStations * NO_OF_RECONF_SECUR_KEYS_PER_STATION + NO_OF_EXTRA_RECONF_SECUR_KEYS));
182     os_memoryZero (hOs,
183                    (void *)(DB_KEYS(pCmdBld).pReconfKeys),
184                    sizeof(TSecurityKeys) * (uNumOfStations * NO_OF_RECONF_SECUR_KEYS_PER_STATION + NO_OF_EXTRA_RECONF_SECUR_KEYS));
185 
186 
187     WLAN_INIT_REPORT(("cmdBld_Create end %x\n",(TI_HANDLE)pCmdBld));
188 
189     return (TI_HANDLE)pCmdBld;
190 }
191 
192 
cmdBld_Destroy(TI_HANDLE hCmdBld)193 TI_STATUS cmdBld_Destroy (TI_HANDLE hCmdBld)
194 {
195     TCmdBld      *pCmdBld = (TCmdBld *)hCmdBld;
196     TDmaParams   *pDmaParams = NULL;
197     TI_UINT32        uNumOfStations;
198 
199     if (pCmdBld == NULL)
200     {
201         return TI_OK;
202     }
203 
204     pDmaParams = &DB_DMA(hCmdBld);
205 
206     uNumOfStations = (TI_UINT32)pDmaParams->NumStations;
207 
208     if (DB_KEYS(pCmdBld).pReconfKeys)
209     {
210         os_memoryFree (pCmdBld->hOs,
211                        DB_KEYS(pCmdBld).pReconfKeys,
212                        sizeof(TSecurityKeys) * (uNumOfStations * NO_OF_RECONF_SECUR_KEYS_PER_STATION + NO_OF_EXTRA_RECONF_SECUR_KEYS));
213     }
214 
215     /* free the whalCtrl data structure */
216     os_memoryFree (pCmdBld->hOs, pCmdBld, sizeof(TCmdBld));
217 
218     return TI_OK;
219 }
220 
cmdBld_Restart(TI_HANDLE hCmdBld)221 TI_STATUS cmdBld_Restart (TI_HANDLE hCmdBld)
222 {
223     TCmdBld      *pCmdBld = (TCmdBld *)hCmdBld;
224 
225     /* This init is for recovery stage */
226     pCmdBld->uLastElpCtrlMode = ELPCTRL_MODE_NORMAL;
227 
228     /*
229      * This call is to have the recovery process in AWAKE mode
230      * Prevent move to sleep mode between Hw_Init and Fw_Init
231      */
232     cmdBld_CfgIeSleepAuth (hCmdBld, DB_WLAN(hCmdBld).minPowerLevel, NULL, NULL);
233 
234     return TI_OK;
235 }
236 
cmdBld_Config(TI_HANDLE hCmdBld,TI_HANDLE hReport,void * fFinalizeDownload,TI_HANDLE hFinalizeDownload,TI_HANDLE hEventMbox,TI_HANDLE hCmdQueue,TI_HANDLE hTwIf)237 TI_STATUS cmdBld_Config (TI_HANDLE  hCmdBld,
238                          TI_HANDLE  hReport,
239                          void      *fFinalizeDownload,
240                          TI_HANDLE  hFinalizeDownload,
241                          TI_HANDLE  hEventMbox,
242                          TI_HANDLE  hCmdQueue,
243                          TI_HANDLE  hTwIf)
244 {
245     TCmdBld        *pCmdBld = (TCmdBld *)hCmdBld;
246     TI_UINT32       index;
247 
248     pCmdBld->hReport = hReport;
249     pCmdBld->fFinalizeDownload = fFinalizeDownload;
250     pCmdBld->hFinalizeDownload = hFinalizeDownload;
251     pCmdBld->hEventMbox = hEventMbox;
252     pCmdBld->hCmdQueue = hCmdQueue;
253     pCmdBld->hTwIf  = hTwIf;
254 
255     /* Reset all reconfig valid fields*/
256     DB_KEYS(pCmdBld).bHwEncDecrEnableValid = TI_FALSE;
257     DB_KEYS(pCmdBld).bDefaultKeyIdValid    = TI_FALSE;
258     for (index = 0;
259          index < pCmdBld->tSecurity.uNumOfStations * NO_OF_RECONF_SECUR_KEYS_PER_STATION + NO_OF_EXTRA_RECONF_SECUR_KEYS;
260          index++)
261         (DB_KEYS(pCmdBld).pReconfKeys + index)->keyType = KEY_NULL;
262 
263 
264     return TI_OK;
265 }
266 
267 
268 
cmdBld_ConfigFwCb(TI_HANDLE hCmdBld,TI_STATUS status,void * pData)269 static void cmdBld_ConfigFwCb (TI_HANDLE hCmdBld, TI_STATUS status, void *pData)
270 {
271     TCmdBld        *pCmdBld = (TCmdBld *)hCmdBld;
272     MemoryMap_t    *pMemMap = &pCmdBld->tMemMap;
273     TDmaParams     *pDmaParams = &DB_DMA(hCmdBld);
274 
275     /* Arrived from callback */
276     if (pData)
277     {
278         TI_UINT32         *pSwap, i, uMemMapNumFields;
279 
280         /* Solve endian problem (all fields are 32 bit) */
281         uMemMapNumFields = (sizeof(MemoryMap_t) - sizeof(EleHdrStruct)) % 4;
282         pSwap = (TI_UINT32* )&(pMemMap->codeStart);
283         for (i = 0; i < uMemMapNumFields; i++)
284         {
285             pSwap[i] = ENDIAN_HANDLE_LONG(pSwap[i]);
286         }
287     }
288 
289     /* Save number of TX blocks */
290     pDmaParams->NumTxBlocks = pMemMap->numTxMemBlks;
291     /* Firmware Control block is internally pointing to TxResultInterface structure */
292     pDmaParams->fwTxResultInterface = pMemMap->trqBlock.controlBlock;
293     pDmaParams->fwRxCBufPtr =           pMemMap->rxCBufPtr;
294     pDmaParams->fwTxCBufPtr =           pMemMap->txCBufPtr;
295     pDmaParams->fwRxControlPtr =        pMemMap->rxControlPtr;
296     pDmaParams->fwTxControlPtr =        pMemMap->txControlPtr;
297 
298     pDmaParams->PacketMemoryPoolStart = (TI_UINT32)pMemMap->packetMemoryPoolStart;
299 
300     /* Indicate that the reconfig process is over. */
301     pCmdBld->bReconfigInProgress = TI_FALSE;
302 
303     /* Call the upper layer callback */
304     (*((TConfigFwCb)pCmdBld->fConfigFwCb)) (pCmdBld->hConfigFwCb, TI_OK);
305 }
306 
307 
308 /****************************************************************************
309  *                      cmdBld_ConfigFw()
310  ****************************************************************************
311  * DESCRIPTION: Configure the WLAN firmware
312  *
313  * INPUTS: None
314  *
315  * OUTPUT: None
316  *
317  * RETURNS: TI_OK or TI_NOK
318  ****************************************************************************/
cmdBld_ConfigFw(TI_HANDLE hCmdBld,void * fConfigFwCb,TI_HANDLE hConfigFwCb)319 TI_STATUS cmdBld_ConfigFw (TI_HANDLE hCmdBld, void *fConfigFwCb, TI_HANDLE hConfigFwCb)
320 {
321     TCmdBld        *pCmdBld = (TCmdBld *)hCmdBld;
322 
323     pCmdBld->fConfigFwCb = fConfigFwCb;
324     pCmdBld->hConfigFwCb = hConfigFwCb;
325     pCmdBld->uIniSeq = 0;
326     pCmdBld->bReconfigInProgress = TI_TRUE;
327     /* should be re-initialized for recovery,   pCmdBld->uLastElpCtrlMode = ELPCTRL_MODE_KEEP_AWAKE; */
328 
329     /* Start configuration sequence */
330     return cmdBld_ConfigSeq (hCmdBld);
331 }
332 
333 
334 typedef TI_STATUS (*TCmdCfgFunc) (TI_HANDLE);
335 
336 
__cmd_probe_req(TI_HANDLE hCmdBld)337 static TI_STATUS __cmd_probe_req (TI_HANDLE hCmdBld)
338 {
339     TI_STATUS   tStatus = TI_OK;
340 
341     /* keep space for 2.4 GHz probe request */
342     tStatus = cmdBld_CmdIeConfigureTemplateFrame (hCmdBld,
343                                                   NULL,
344                                                   DB_WLAN(hCmdBld).probeRequestTemplateSize,
345                                                   CFG_TEMPLATE_PROBE_REQ_2_4,
346                                                   0,
347                                                   NULL,
348                                                   NULL);
349     if (TI_OK != tStatus)
350     {
351         return tStatus;
352     }
353 
354     /* keep space for 5.0 GHz probe request */
355     return cmdBld_CmdIeConfigureTemplateFrame (hCmdBld,
356                                                NULL,
357                                                DB_WLAN(hCmdBld).probeRequestTemplateSize,
358                                                CFG_TEMPLATE_PROBE_REQ_5,
359                                                0,
360                                              (void *)cmdBld_ConfigSeq,
361                                              hCmdBld);
362 }
363 
364 
__cmd_null_data(TI_HANDLE hCmdBld)365 static TI_STATUS __cmd_null_data (TI_HANDLE hCmdBld)
366 {
367     return cmdBld_CmdIeConfigureTemplateFrame (hCmdBld,
368                                              NULL,
369                                              DB_WLAN(hCmdBld).nullTemplateSize,
370                                                TEMPLATE_NULL_DATA,
371                                                0,
372                                              (void *)cmdBld_ConfigSeq,
373                                              hCmdBld);
374 }
375 
__cmd_burst_mode_enable(TI_HANDLE hCmdBld)376 static TI_STATUS __cmd_burst_mode_enable (TI_HANDLE hCmdBld)
377 {
378 	return cmdBld_CfgIeBurstMode (hCmdBld,
379 							  DB_AC(hCmdBld).isBurstModeEnabled,
380 							  (void *)cmdBld_ConfigSeq,
381 							  hCmdBld);
382 }
383 
384 
__cmd_disconn(TI_HANDLE hCmdBld)385 static TI_STATUS __cmd_disconn (TI_HANDLE hCmdBld)
386 {
387     return cmdBld_CmdIeConfigureTemplateFrame (hCmdBld,
388                                              NULL,
389                                              DB_WLAN(hCmdBld).disconnTemplateSize,
390                                              TEMPLATE_DISCONNECT,
391                                              0,
392                                              (void *)cmdBld_ConfigSeq,
393                                              hCmdBld);
394 }
395 
__cmd_ps_poll(TI_HANDLE hCmdBld)396 static TI_STATUS __cmd_ps_poll (TI_HANDLE hCmdBld)
397 {
398     return cmdBld_CmdIeConfigureTemplateFrame (hCmdBld,
399                                              NULL,
400                                              DB_WLAN(hCmdBld).PsPollTemplateSize,
401                                                TEMPLATE_PS_POLL,
402                                                0,
403                                              (void *)cmdBld_ConfigSeq,
404                                              hCmdBld);
405 }
406 
407 
__cmd_qos_null_data(TI_HANDLE hCmdBld)408 static TI_STATUS __cmd_qos_null_data (TI_HANDLE hCmdBld)
409 {
410     return cmdBld_CmdIeConfigureTemplateFrame (hCmdBld,
411                                              NULL,
412                                              DB_WLAN(hCmdBld).qosNullDataTemplateSize,
413                                                TEMPLATE_QOS_NULL_DATA,
414                                                0,
415                                              (void *)cmdBld_ConfigSeq,
416                                              hCmdBld);
417 }
418 
419 
__cmd_probe_resp(TI_HANDLE hCmdBld)420 static TI_STATUS __cmd_probe_resp (TI_HANDLE hCmdBld)
421 {
422     return cmdBld_CmdIeConfigureTemplateFrame (hCmdBld,
423                                              NULL,
424                                              DB_WLAN(hCmdBld).probeResponseTemplateSize,
425                                                TEMPLATE_PROBE_RESPONSE,
426                                                0,
427                                              (void *)cmdBld_ConfigSeq,
428                                              hCmdBld);
429 }
430 
431 
__cmd_beacon(TI_HANDLE hCmdBld)432 static TI_STATUS __cmd_beacon (TI_HANDLE hCmdBld)
433 {
434     return cmdBld_CmdIeConfigureTemplateFrame (hCmdBld,
435                                              NULL,
436                                              DB_WLAN(hCmdBld).beaconTemplateSize,
437                                                TEMPLATE_BEACON,
438                                                0,
439                                              (void *)cmdBld_ConfigSeq,
440                                              hCmdBld);
441 }
442 
__cmd_keep_alive_tmpl(TI_HANDLE hCmdBld)443 static TI_STATUS __cmd_keep_alive_tmpl (TI_HANDLE hCmdBld)
444 {
445     TI_UINT32   index;
446     TI_STATUS   status = TI_NOK;
447 
448     /*
449      * config templates
450      * fisr configure all indexes but the last one with no CB, and than configure the last one
451      * with a CB to continue configuration.
452      */
453     for (index = 0; index < KLV_MAX_TMPL_NUM - 1; index++)
454     {
455         status =  cmdBld_CmdIeConfigureTemplateFrame (hCmdBld,
456                                                       NULL,
457                                                       MAX_TEMPLATES_SIZE,
458                                                       TEMPLATE_KLV,
459                                                       index,
460                                                       NULL,
461                                                       NULL);
462         if (TI_OK != status)
463         {
464             return status;
465         }
466     }
467 
468     status =  cmdBld_CmdIeConfigureTemplateFrame (hCmdBld,
469                                                   NULL,
470                                                   MAX_TEMPLATES_SIZE,
471                                                   TEMPLATE_KLV,
472                                                   index,
473                                                   (void *)cmdBld_ConfigSeq,
474                                                   hCmdBld);
475 
476     return status;
477 }
478 
479 
__cfg_mem(TI_HANDLE hCmdBld)480 static TI_STATUS __cfg_mem (TI_HANDLE hCmdBld)
481 {
482     /* Configure the weight among the different hardware queues */
483     return cmdBld_CfgIeConfigMemory (hCmdBld, &DB_DMA(hCmdBld), (void *)cmdBld_ConfigSeq, hCmdBld);
484 }
485 
486 
__cfg_rx_msdu_life_time(TI_HANDLE hCmdBld)487 static TI_STATUS __cfg_rx_msdu_life_time (TI_HANDLE hCmdBld)
488 {
489     /* Configure the Rx Msdu Life Time (expiry time of de-fragmentation in FW) */
490     return cmdBld_CfgIeRxMsduLifeTime (hCmdBld,
491                                        DB_WLAN(hCmdBld).MaxRxMsduLifetime,
492                                        (void *)cmdBld_ConfigSeq,
493                                        hCmdBld);
494 }
495 
496 
__cfg_rx(TI_HANDLE hCmdBld)497 static TI_STATUS __cfg_rx (TI_HANDLE hCmdBld)
498 {
499     return cmdBld_CfgIeRx (hCmdBld,
500                            DB_WLAN(hCmdBld).RxConfigOption,
501                            DB_WLAN(hCmdBld).RxFilterOption,
502                            (void *)cmdBld_ConfigSeq,
503                            hCmdBld);
504 }
505 
506 
__cfg_ac_params_0(TI_HANDLE hCmdBld)507 static TI_STATUS __cfg_ac_params_0 (TI_HANDLE hCmdBld)
508 {
509     /*
510      * NOTE: Set following parameter only if configured.
511      *       Otherwise, is contains garbage.
512      */
513 
514     if (DB_AC(hCmdBld).isAcConfigured[0])
515     {
516         return cmdBld_CfgAcParams (hCmdBld, &DB_AC(hCmdBld).ac[0], (void *)cmdBld_ConfigSeq, hCmdBld);
517     }
518     else
519     {
520         return TI_NOK;
521     }
522 }
523 
524 
__cfg_ac_params_1(TI_HANDLE hCmdBld)525 static TI_STATUS __cfg_ac_params_1 (TI_HANDLE hCmdBld)
526 {
527     /*
528      * NOTE: Set following parameter only if configured.
529      *       Otherwise, is contains garbage.
530      */
531 
532     if (DB_AC(hCmdBld).isAcConfigured[1])
533     {
534         return cmdBld_CfgAcParams (hCmdBld, &DB_AC(hCmdBld).ac[1], (void *)cmdBld_ConfigSeq, hCmdBld);
535     }
536     else
537     {
538         return TI_NOK;
539     }
540 }
541 
542 
__cfg_ac_params_2(TI_HANDLE hCmdBld)543 static TI_STATUS __cfg_ac_params_2 (TI_HANDLE hCmdBld)
544 {
545     /*
546      * NOTE: Set following parameter only if configured.
547      *       Otherwise, is contains garbage.
548      */
549 
550     if (DB_AC(hCmdBld).isAcConfigured[2])
551     {
552         return cmdBld_CfgAcParams (hCmdBld, &DB_AC(hCmdBld).ac[2], (void *)cmdBld_ConfigSeq, hCmdBld);
553     }
554     else
555     {
556         return TI_NOK;
557     }
558 }
559 
560 
__cfg_ac_params_3(TI_HANDLE hCmdBld)561 static TI_STATUS __cfg_ac_params_3 (TI_HANDLE hCmdBld)
562 {
563     /*
564      * NOTE: Set following parameter only if configured.
565      *       Otherwise, is contains garbage.
566      */
567 
568     if (DB_AC(hCmdBld).isAcConfigured[3])
569     {
570         return cmdBld_CfgAcParams (hCmdBld, &DB_AC(hCmdBld).ac[3], (void *)cmdBld_ConfigSeq, hCmdBld);
571     }
572     else
573     {
574         return TI_NOK;
575     }
576 }
577 
578 
__cfg_tid_0(TI_HANDLE hCmdBld)579 static TI_STATUS __cfg_tid_0 (TI_HANDLE hCmdBld)
580 {
581     /*
582      * NOTE: Set following parameter only if configured.
583      *       Otherwise, is contains garbage.
584      */
585     if (DB_QUEUES(hCmdBld).isQueueConfigured[0])
586     {
587         return cmdBld_CfgTid (hCmdBld, &DB_QUEUES(hCmdBld).queues[0], (void *)cmdBld_ConfigSeq, hCmdBld);
588     }
589     else
590     {
591         return TI_NOK;
592     }
593 }
594 
595 
__cfg_tid_1(TI_HANDLE hCmdBld)596 static TI_STATUS __cfg_tid_1 (TI_HANDLE hCmdBld)
597 {
598     /*
599      * NOTE: Set following parameter only if configured.
600      *       Otherwise, is contains garbage.
601      */
602     if (DB_QUEUES(hCmdBld).isQueueConfigured[1])
603     {
604         return cmdBld_CfgTid (hCmdBld, &DB_QUEUES(hCmdBld).queues[1], (void *)cmdBld_ConfigSeq, hCmdBld);
605     }
606     else
607     {
608         return TI_NOK;
609     }
610 }
611 
612 
__cfg_tid_2(TI_HANDLE hCmdBld)613 static TI_STATUS __cfg_tid_2 (TI_HANDLE hCmdBld)
614 {
615     /*
616      * NOTE: Set following parameter only if configured.
617      *       Otherwise, is contains garbage.
618      */
619     if (DB_QUEUES(hCmdBld).isQueueConfigured[2])
620     {
621         return cmdBld_CfgTid (hCmdBld, &DB_QUEUES(hCmdBld).queues[2], (void *)cmdBld_ConfigSeq, hCmdBld);
622     }
623     else
624     {
625         return TI_NOK;
626     }
627 }
628 
629 
__cfg_tid_3(TI_HANDLE hCmdBld)630 static TI_STATUS __cfg_tid_3 (TI_HANDLE hCmdBld)
631 {
632     /*
633      * NOTE: Set following parameter only if configured.
634      *       Otherwise, is contains garbage.
635      */
636     if (DB_QUEUES(hCmdBld).isQueueConfigured[3])
637     {
638         return cmdBld_CfgTid (hCmdBld, &DB_QUEUES(hCmdBld).queues[3], (void *)cmdBld_ConfigSeq, hCmdBld);
639     }
640     else
641     {
642         return TI_NOK;
643     }
644 }
645 
646 
__cfg_ps_rx_streaming(TI_HANDLE hCmdBld)647 static TI_STATUS __cfg_ps_rx_streaming (TI_HANDLE hCmdBld)
648 {
649     TI_UINT32       index;
650     TI_STATUS        eStatus;
651     TPsRxStreaming *pPsRxStreaming;
652 
653 
654     if (!DB_WLAN(hCmdBld).bJoin)
655     {
656         return TI_NOK;
657     }
658 
659     /* Config enabled streams (disable is the FW default). */
660     for (index = 0; index < MAX_NUM_OF_802_1d_TAGS - 1; index++)
661     {
662         pPsRxStreaming = &(DB_PS_STREAM(hCmdBld).tid[index]);
663 
664         if (pPsRxStreaming->bEnabled)
665         {
666             eStatus = cmdBld_CfgPsRxStreaming (hCmdBld, pPsRxStreaming, NULL, NULL);
667             if (eStatus != TI_OK)
668             {
669                 return eStatus;
670             }
671         }
672     }
673 
674     /* Set NOK for a case the following config is skipped, to indicate that no callback is expected */
675     eStatus = TI_NOK;
676 
677     pPsRxStreaming = &(DB_PS_STREAM(hCmdBld).tid[MAX_NUM_OF_802_1d_TAGS - 1]);
678     if (pPsRxStreaming->bEnabled)
679     {
680         eStatus = cmdBld_CfgPsRxStreaming (hCmdBld, pPsRxStreaming, (void *)cmdBld_ConfigSeq, hCmdBld);
681         if (eStatus != TI_OK)
682         {
683             return eStatus;
684         }
685     }
686 
687     return eStatus;
688     }
689 
690 
__cfg_rx_data_filter(TI_HANDLE hCmdBld)691 static TI_STATUS __cfg_rx_data_filter (TI_HANDLE hCmdBld)
692 {
693     TI_UINT32       index;
694     TI_STATUS       eStatus;
695     TRxDataFilter   *pFilters;
696 
697 
698     if (DB_RX_DATA_FLTR(hCmdBld).bEnabled)
699     {
700         eStatus = cmdBld_CfgIeEnableRxDataFilter (hCmdBld,
701                                                   DB_RX_DATA_FLTR(hCmdBld).bEnabled,
702                                                   DB_RX_DATA_FLTR(hCmdBld).eDefaultAction,
703                                                   NULL,
704                                                   NULL);
705         if (eStatus != TI_OK)
706         {
707             return eStatus;
708         }
709     }
710 
711     /*
712      * Config enabled filters (last one is separated to use the callback)
713      */
714     for (index = 0; index < MAX_DATA_FILTERS - 1; index++)
715     {
716         pFilters = &(DB_RX_DATA_FLTR(hCmdBld).aRxDataFilter[index]);
717 
718         if (pFilters->uCommand == ADD_FILTER)
719         {
720             eStatus = cmdBld_CfgIeRxDataFilter (hCmdBld,
721                                                 pFilters->uIndex,
722                                                 pFilters->uCommand,
723                                                 pFilters->eAction,
724                                                 pFilters->uNumFieldPatterns,
725                                                 pFilters->uLenFieldPatterns,
726                                                 pFilters->aFieldPattern,
727                                                 NULL,
728                                                 NULL);
729             if (eStatus != TI_OK)
730     {
731                 return eStatus;
732             }
733         }
734     }
735 
736     /* Set NOK for a case the following config is skipped, to indicate that no callback is expected */
737         eStatus = TI_NOK;
738 
739     pFilters = &(DB_RX_DATA_FLTR(hCmdBld).aRxDataFilter[MAX_DATA_FILTERS - 1]);
740     if (pFilters->uCommand == ADD_FILTER)
741     {
742         eStatus = cmdBld_CfgIeRxDataFilter (hCmdBld,
743                                             pFilters->uIndex,
744                                             pFilters->uCommand,
745                                             pFilters->eAction,
746                                             pFilters->uNumFieldPatterns,
747                                             pFilters->uLenFieldPatterns,
748                                             pFilters->aFieldPattern,
749                                             (void *)cmdBld_ConfigSeq,
750                                             hCmdBld);
751         if (eStatus != TI_OK)
752         {
753             return eStatus;
754         }
755     }
756 
757     return eStatus;
758 }
759 
760 
__cfg_pd_threshold(TI_HANDLE hCmdBld)761 static TI_STATUS __cfg_pd_threshold (TI_HANDLE hCmdBld)
762 {
763     return cmdBld_CfgIePacketDetectionThreshold (hCmdBld,
764                                                  DB_WLAN(hCmdBld).PacketDetectionThreshold,
765                                                  (void *)cmdBld_ConfigSeq,
766                                                  hCmdBld);
767 }
768 
769 
__cfg_slot_time(TI_HANDLE hCmdBld)770 static TI_STATUS __cfg_slot_time (TI_HANDLE hCmdBld)
771 {
772     return cmdBld_CfgIeSlotTime (hCmdBld, DB_WLAN(hCmdBld).SlotTime, (void *)cmdBld_ConfigSeq, hCmdBld);
773 }
774 
775 
__cfg_arp_ip_filter(TI_HANDLE hCmdBld)776 static TI_STATUS __cfg_arp_ip_filter (TI_HANDLE hCmdBld)
777 {
778     return cmdBld_CfgIeArpIpFilter (hCmdBld,
779                                     DB_WLAN(hCmdBld).arp_IP_addr,
780                                     (EArpFilterType)DB_WLAN(hCmdBld).arpFilterType,
781                                     (void *)cmdBld_ConfigSeq,
782                                     hCmdBld);
783 }
784 
__cfg_group_address_table(TI_HANDLE hCmdBld)785 static TI_STATUS __cfg_group_address_table (TI_HANDLE hCmdBld)
786 {
787     return cmdBld_CfgIeGroupAdressTable (hCmdBld,
788                                          DB_WLAN(hCmdBld).numGroupAddrs,
789                                          DB_WLAN(hCmdBld).aGroupAddr,
790                                          DB_WLAN(hCmdBld).isMacAddrFilteringnabled,
791                                          (void *)cmdBld_ConfigSeq,
792                                          hCmdBld);
793 }
794 
795 
__cfg_service_period_timeout(TI_HANDLE hCmdBld)796 static TI_STATUS __cfg_service_period_timeout (TI_HANDLE hCmdBld)
797 {
798     return cmdBld_CfgIeServicePeriodTimeout (hCmdBld,
799                                              &DB_WLAN(hCmdBld).rxTimeOut,
800                                              (void *)cmdBld_ConfigSeq,
801                                              hCmdBld);
802 }
803 
804 
__cfg_rts_threshold(TI_HANDLE hCmdBld)805 static TI_STATUS __cfg_rts_threshold (TI_HANDLE hCmdBld)
806 {
807     return cmdBld_CfgRtsThreshold (hCmdBld,
808                                    DB_WLAN(hCmdBld).RtsThreshold,
809                                    (void *)cmdBld_ConfigSeq,
810                                    hCmdBld);
811 }
812 
__cfg_dco_itrim_params(TI_HANDLE hCmdBld)813 static TI_STATUS __cfg_dco_itrim_params (TI_HANDLE hCmdBld)
814 {
815     return cmdBld_CfgDcoItrimParams (hCmdBld,
816                                      DB_WLAN(hCmdBld).dcoItrimEnabled,
817                                      DB_WLAN(hCmdBld).dcoItrimModerationTimeoutUsec,
818                                      (void *)cmdBld_ConfigSeq,
819                                      hCmdBld);
820 }
821 
__cfg_fragment_threshold(TI_HANDLE hCmdBld)822 static TI_STATUS __cfg_fragment_threshold (TI_HANDLE hCmdBld)
823 {
824     return cmdBld_CfgIeFragmentThreshold (hCmdBld,
825                                           DB_WLAN(hCmdBld).FragmentThreshold,
826                                           (void *)cmdBld_ConfigSeq,
827                                           hCmdBld);
828 }
829 
830 
__cfg_pm_config(TI_HANDLE hCmdBld)831 static TI_STATUS __cfg_pm_config (TI_HANDLE hCmdBld)
832 {
833     return cmdBld_CfgIePmConfig (hCmdBld,
834                                  DB_WLAN(hCmdBld).uHostClkSettlingTime,
835                                  DB_WLAN(hCmdBld).uHostFastWakeupSupport,
836                                  (void *)cmdBld_ConfigSeq,
837                                  hCmdBld);
838 }
839 
840 
__cfg_beacon_filter_opt(TI_HANDLE hCmdBld)841 static TI_STATUS __cfg_beacon_filter_opt (TI_HANDLE hCmdBld)
842 {
843     /* Set The Beacon Filter in HAL */
844     return cmdBld_CfgIeBeaconFilterOpt (hCmdBld,
845                                         DB_WLAN(hCmdBld).beaconFilterParams.desiredState,
846                                         DB_WLAN(hCmdBld).beaconFilterParams.numOfElements,
847                                         (void *)cmdBld_ConfigSeq,
848                                         hCmdBld);
849 }
850 
851 
__cfg_beacon_filter_table(TI_HANDLE hCmdBld)852 static TI_STATUS __cfg_beacon_filter_table (TI_HANDLE hCmdBld)
853 {
854     return cmdBld_CfgIeBeaconFilterTable (hCmdBld,
855                                           DB_WLAN(hCmdBld).beaconFilterIETable.numberOfIEs,
856                                           DB_WLAN(hCmdBld).beaconFilterIETable.IETable,
857                                           DB_WLAN(hCmdBld).beaconFilterIETable.IETableSize,
858                                           (void *)cmdBld_ConfigSeq,
859                                           hCmdBld);
860 }
861 
862 
__cfg_tx_cmplt_pacing(TI_HANDLE hCmdBld)863 static TI_STATUS __cfg_tx_cmplt_pacing (TI_HANDLE hCmdBld)
864 {
865     return cmdBld_CfgIeTxCmpltPacing (hCmdBld,
866                                       DB_WLAN(hCmdBld).TxCompletePacingThreshold,
867                                       DB_WLAN(hCmdBld).TxCompletePacingTimeout,
868                                       (void *)cmdBld_ConfigSeq,
869                                       hCmdBld);
870 }
871 
872 
__cfg_rx_intr_pacing(TI_HANDLE hCmdBld)873 static TI_STATUS __cfg_rx_intr_pacing (TI_HANDLE hCmdBld)
874 {
875     return cmdBld_CfgIeRxIntrPacing (hCmdBld,
876                                      DB_WLAN(hCmdBld).RxIntrPacingThreshold,
877                                      DB_WLAN(hCmdBld).RxIntrPacingTimeout,
878                          (void *)cmdBld_ConfigSeq,
879                                hCmdBld);
880 }
881 
882 
883 #ifdef TI_TEST
__cfg_coex_activity_table(TI_HANDLE hCmdBld)884 static TI_STATUS __cfg_coex_activity_table (TI_HANDLE hCmdBld)
885 {
886     TCmdBld       *pCmdBld = (TCmdBld *)hCmdBld;
887     TI_UINT32 uNumberOfIEs = DB_WLAN(hCmdBld).tWlanParamsCoexActivityTable.numOfElements;
888     TCoexActivity *CoexActivityTable = DB_WLAN(hCmdBld).tWlanParamsCoexActivityTable.entry;
889     TI_STATUS   status = TI_NOK;
890     TI_UINT32   index;
891 
892     TRACE1(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , " CoexActivity, uNumberOfIEs=%d\n", uNumberOfIEs);
893     if (uNumberOfIEs == 0)
894     {
895         return status;
896     }
897     /*
898      * config CoexActivity table
899      * first configure all indexes but the last one with no CB, and than configure the last one
900      * with a CB to continue configuration.
901      */
902     for (index = 0; index < uNumberOfIEs-1; index++)
903     {
904         TRACE1(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , " CoexActivity, send %d\n", index);
905         status =  cmdBld_CfgIeCoexActivity (hCmdBld, &CoexActivityTable[index],
906                                                 NULL, NULL);
907         if (TI_OK != status)
908         {
909             return status;
910         }
911     }
912 
913     /* Send last activity with a callback to continue config sequence */
914     TRACE1(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , " CoexActivity, send last %d\n", index);
915     status =  cmdBld_CfgIeCoexActivity (hCmdBld, &CoexActivityTable[index],
916                                             (void *)cmdBld_ConfigSeq, hCmdBld);
917 
918     return status;
919 }
920 #endif
921 
__cfg_cca_threshold(TI_HANDLE hCmdBld)922 static TI_STATUS __cfg_cca_threshold (TI_HANDLE hCmdBld)
923 {
924     return cmdBld_CfgIeCcaThreshold (hCmdBld,
925                                      DB_WLAN(hCmdBld).ch14TelecCca,
926                                      (void *)cmdBld_ConfigSeq,
927                                      hCmdBld);
928 }
929 
930 
__cfg_bcn_brc_options(TI_HANDLE hCmdBld)931 static TI_STATUS __cfg_bcn_brc_options (TI_HANDLE hCmdBld)
932 {
933     TPowerMgmtConfig powerMgmtConfig;
934 
935     /* Beacon broadcast options */
936     powerMgmtConfig.BcnBrcOptions = DB_WLAN(hCmdBld).BcnBrcOptions;
937     powerMgmtConfig.ConsecutivePsPollDeliveryFailureThreshold = DB_WLAN(hCmdBld).ConsecutivePsPollDeliveryFailureThreshold;
938 
939     return cmdBld_CfgIeBcnBrcOptions (hCmdBld,
940                                       &powerMgmtConfig,
941                                       (void *)cmdBld_ConfigSeq,
942                                       hCmdBld);
943 }
944 
945 
__cmd_enable_rx(TI_HANDLE hCmdBld)946 static TI_STATUS __cmd_enable_rx (TI_HANDLE hCmdBld)
947 {
948     /* Enable rx path on the hardware */
949     return cmdBld_CmdEnableRx (hCmdBld, (void *)cmdBld_ConfigSeq, hCmdBld);
950 }
951 
952 
__cmd_enable_tx(TI_HANDLE hCmdBld)953 static TI_STATUS __cmd_enable_tx (TI_HANDLE hCmdBld)
954 {
955     /* Enable tx path on the hardware */
956     return cmdBld_CmdEnableTx (hCmdBld,
957                                DB_DEFAULT_CHANNEL(hCmdBld),
958                                (void *)cmdBld_ConfigSeq,
959                                hCmdBld);
960 }
961 
962 
__cfg_ps_wmm(TI_HANDLE hCmdBld)963 static TI_STATUS __cfg_ps_wmm (TI_HANDLE hCmdBld)
964 {
965     /* ACX for a work around for Wi-Fi test */
966     return cmdBld_CfgIePsWmm (hCmdBld,
967                               DB_WLAN(hCmdBld).WiFiWmmPS,
968                               (void *)cmdBld_ConfigSeq,
969                               hCmdBld);
970 }
971 
972 
__cfg_rssi_snr_weights(TI_HANDLE hCmdBld)973 static TI_STATUS __cfg_rssi_snr_weights (TI_HANDLE hCmdBld)
974 {
975     /* RSSI/SNR Weights for Average calculations */
976     return cmdBld_CfgIeRssiSnrWeights (hCmdBld,
977                                        &DB_WLAN(hCmdBld).tRssiSnrWeights,
978                                        (void *)cmdBld_ConfigSeq,
979                                        hCmdBld);
980 }
981 
982 
__cfg_event_scan_cmplt(TI_HANDLE hCmdBld)983 static TI_STATUS __cfg_event_scan_cmplt (TI_HANDLE hCmdBld)
984 {
985     TCmdBld   *pCmdBld = (TCmdBld *)hCmdBld;
986 
987     /* Enable the scan complete interrupt source */
988     return eventMbox_UnMaskEvent (pCmdBld->hEventMbox,
989                                TWD_OWN_EVENT_SCAN_CMPLT,
990                                (void *)cmdBld_ConfigSeq,
991                                hCmdBld);
992 }
993 
__cfg_event_sps_scan_cmplt(TI_HANDLE hCmdBld)994 static TI_STATUS __cfg_event_sps_scan_cmplt (TI_HANDLE hCmdBld)
995 {
996     TCmdBld   *pCmdBld = (TCmdBld *)hCmdBld;
997 
998     return eventMbox_UnMaskEvent (pCmdBld->hEventMbox,
999                                TWD_OWN_EVENT_SPS_SCAN_CMPLT,
1000                                (void *)cmdBld_ConfigSeq,
1001                                hCmdBld);
1002 }
1003 
__cfg_event_plt_rx_calibration_cmplt(TI_HANDLE hCmdBld)1004 static TI_STATUS __cfg_event_plt_rx_calibration_cmplt (TI_HANDLE hCmdBld)
1005 {
1006     TCmdBld   *pCmdBld = (TCmdBld *)hCmdBld;
1007 
1008     return eventMbox_UnMaskEvent (pCmdBld->hEventMbox,
1009                                TWD_OWN_EVENT_PLT_RX_CALIBRATION_COMPLETE,
1010                                (void *)cmdBld_ConfigSeq,
1011                                hCmdBld);
1012 }
1013 
1014 
__cfg_hw_enc_dec_enable(TI_HANDLE hCmdBld)1015 static TI_STATUS __cfg_hw_enc_dec_enable (TI_HANDLE hCmdBld)
1016 {
1017     return cmdBld_CfgHwEncDecEnable (hCmdBld, TI_TRUE, (void *)cmdBld_ConfigSeq, hCmdBld);
1018 }
1019 
1020 
__cfg_rssi_snr_trigger_0(TI_HANDLE hCmdBld)1021 static TI_STATUS __cfg_rssi_snr_trigger_0 (TI_HANDLE hCmdBld)
1022 {
1023     /* RSSI/SNR Troggers */
1024     return  cmdBld_CfgIeRssiSnrTrigger (hCmdBld,
1025                                         &DB_WLAN(hCmdBld).tRssiSnrTrigger[0],
1026                                         (void *)cmdBld_ConfigSeq,
1027                                         hCmdBld);
1028 }
1029 
1030 
__cfg_rssi_snr_trigger_1(TI_HANDLE hCmdBld)1031 static TI_STATUS __cfg_rssi_snr_trigger_1 (TI_HANDLE hCmdBld)
1032 {
1033     /* RSSI/SNR Troggers */
1034     return  cmdBld_CfgIeRssiSnrTrigger (hCmdBld,
1035                                         &DB_WLAN(hCmdBld).tRssiSnrTrigger[1],
1036                                         (void *)cmdBld_ConfigSeq,
1037                                         hCmdBld);
1038 }
1039 
1040 
__cfg_rssi_snr_trigger_2(TI_HANDLE hCmdBld)1041 static TI_STATUS __cfg_rssi_snr_trigger_2 (TI_HANDLE hCmdBld)
1042 {
1043     /* RSSI/SNR Troggers */
1044     return  cmdBld_CfgIeRssiSnrTrigger (hCmdBld,
1045                                         &DB_WLAN(hCmdBld).tRssiSnrTrigger[2],
1046                                         (void *)cmdBld_ConfigSeq,
1047                                         hCmdBld);
1048 }
1049 
1050 
__cfg_rssi_snr_trigger_3(TI_HANDLE hCmdBld)1051 static TI_STATUS __cfg_rssi_snr_trigger_3 (TI_HANDLE hCmdBld)
1052 {
1053     /* RSSI/SNR Troggers */
1054     return  cmdBld_CfgIeRssiSnrTrigger (hCmdBld,
1055                                         &DB_WLAN(hCmdBld).tRssiSnrTrigger[3],
1056                                         (void *)cmdBld_ConfigSeq,
1057                                         hCmdBld);
1058 }
1059 
1060 
__cfg_rssi_snr_trigger_4(TI_HANDLE hCmdBld)1061 static TI_STATUS __cfg_rssi_snr_trigger_4 (TI_HANDLE hCmdBld)
1062 {
1063     /* RSSI/SNR Troggers */
1064     return  cmdBld_CfgIeRssiSnrTrigger (hCmdBld,
1065                                         &DB_WLAN(hCmdBld).tRssiSnrTrigger[4],
1066                                         (void *)cmdBld_ConfigSeq,
1067                                         hCmdBld);
1068 }
1069 
1070 
__cfg_rssi_snr_trigger_5(TI_HANDLE hCmdBld)1071 static TI_STATUS __cfg_rssi_snr_trigger_5 (TI_HANDLE hCmdBld)
1072 {
1073     /* RSSI/SNR Troggers */
1074     return  cmdBld_CfgIeRssiSnrTrigger (hCmdBld,
1075                                         &DB_WLAN(hCmdBld).tRssiSnrTrigger[5],
1076                                         (void *)cmdBld_ConfigSeq,
1077                                         hCmdBld);
1078 }
1079 
1080 
__cfg_rssi_snr_trigger_6(TI_HANDLE hCmdBld)1081 static TI_STATUS __cfg_rssi_snr_trigger_6 (TI_HANDLE hCmdBld)
1082 {
1083     /* RSSI/SNR Troggers */
1084     return  cmdBld_CfgIeRssiSnrTrigger (hCmdBld,
1085                                         &DB_WLAN(hCmdBld).tRssiSnrTrigger[6],
1086                                         (void *)cmdBld_ConfigSeq,
1087                                         hCmdBld);
1088 }
1089 
1090 
__cfg_rssi_snr_trigger_7(TI_HANDLE hCmdBld)1091 static TI_STATUS __cfg_rssi_snr_trigger_7 (TI_HANDLE hCmdBld)
1092 {
1093     /* RSSI/SNR Troggers */
1094     return  cmdBld_CfgIeRssiSnrTrigger (hCmdBld,
1095                                         &DB_WLAN(hCmdBld).tRssiSnrTrigger[7],
1096                                         (void *)cmdBld_ConfigSeq,
1097                                         hCmdBld);
1098 }
1099 
1100 
__cfg_max_tx_retry(TI_HANDLE hCmdBld)1101 static TI_STATUS __cfg_max_tx_retry (TI_HANDLE hCmdBld)
1102 {
1103     return cmdBld_CfgIeMaxTxRetry (hCmdBld,
1104                                    &DB_WLAN(hCmdBld).roamTriggers,
1105                                    (void *)cmdBld_ConfigSeq,
1106                                    hCmdBld);
1107 }
1108 
1109 
1110 
__cfg_split_scan_timeout(TI_HANDLE hCmdBld)1111 static TI_STATUS __cfg_split_scan_timeout (TI_HANDLE hCmdBld)
1112 {
1113     return cmdBld_CmdIeSetSplitScanTimeOut (hCmdBld,
1114                                             DB_WLAN(hCmdBld).uSlicedScanTimeOut,
1115                                             (void *)cmdBld_ConfigSeq,
1116                                             hCmdBld);
1117 }
1118 
1119 
__cfg_conn_monit_params(TI_HANDLE hCmdBld)1120 static TI_STATUS __cfg_conn_monit_params (TI_HANDLE hCmdBld)
1121 {
1122     return cmdBld_CfgIeConnMonitParams (hCmdBld,
1123                                         &DB_WLAN(hCmdBld).roamTriggers,
1124                                         (void *)cmdBld_ConfigSeq,
1125                                         hCmdBld);
1126 }
1127 
1128 
__cfg_bet(TI_HANDLE hCmdBld)1129 static TI_STATUS __cfg_bet (TI_HANDLE hCmdBld)
1130 {
1131     return cmdBld_CfgBet (hCmdBld,
1132                           DB_WLAN(hCmdBld).BetEnable,
1133                           DB_WLAN(hCmdBld).MaximumConsecutiveET,
1134                           (void *)cmdBld_ConfigSeq,
1135                           hCmdBld);
1136 }
1137 
1138 
__cfg_cts_protection(TI_HANDLE hCmdBld)1139 static TI_STATUS __cfg_cts_protection (TI_HANDLE hCmdBld)
1140 {
1141     return cmdBld_CfgIeCtsProtection (hCmdBld,
1142                                       DB_WLAN(hCmdBld).CtsToSelf,
1143                                       (void *)cmdBld_ConfigSeq,
1144                                       hCmdBld);
1145 }
1146 
1147 
__cfg_radio_params(TI_HANDLE hCmdBld)1148 static TI_STATUS __cfg_radio_params (TI_HANDLE hCmdBld)
1149 {
1150     return cmdBld_CfgIeRadioParams (hCmdBld,
1151                                     &DB_RADIO(hCmdBld),
1152                                     (void *)cmdBld_ConfigSeq,
1153                                     hCmdBld);
1154 }
1155 
1156 
__cfg_extended_radio_params(TI_HANDLE hCmdBld)1157 static TI_STATUS __cfg_extended_radio_params (TI_HANDLE hCmdBld)
1158 {
1159     return cmdBld_CfgIeExtendedRadioParams (hCmdBld,
1160 											&DB_EXT_RADIO(hCmdBld),
1161 											(void *)cmdBld_ConfigSeq,
1162 											hCmdBld);
1163 }
1164 
1165 
__cfg_platform_params(TI_HANDLE hCmdBld)1166 static TI_STATUS __cfg_platform_params (TI_HANDLE hCmdBld)
1167 {
1168     return cmdBld_CfgPlatformGenParams(hCmdBld,
1169                                       &DB_GEN(hCmdBld),
1170                                       (void *)cmdBld_ConfigSeq,
1171                                       hCmdBld);
1172 }
1173 
1174 
1175 
__cfg_tx_rate_policy(TI_HANDLE hCmdBld)1176 static TI_STATUS __cfg_tx_rate_policy (TI_HANDLE hCmdBld)
1177 {
1178     /*
1179      * JOIN (use the local parameters), otherwize the CORE will reconnect
1180      */
1181     if (DB_WLAN(hCmdBld).bJoin)
1182     {
1183         /* Set TxRatePolicy */
1184         return cmdBld_CfgTxRatePolicy (hCmdBld,
1185                                        &DB_BSS(hCmdBld).TxRateClassParams,
1186                                        (void *)cmdBld_ConfigSeq,
1187                                        hCmdBld);
1188     }
1189 
1190     return TI_NOK;
1191 }
1192 
1193 
__cmd_beacon_join(TI_HANDLE hCmdBld)1194 static TI_STATUS __cmd_beacon_join (TI_HANDLE hCmdBld)
1195 {
1196     if (DB_WLAN(hCmdBld).bJoin && DB_TEMP(hCmdBld).Beacon.Size != 0)
1197     {
1198         return cmdBld_CmdIeConfigureTemplateFrame (hCmdBld,
1199                                                    &(DB_TEMP(hCmdBld).Beacon),
1200                                                  (TI_UINT16)DB_TEMP(hCmdBld).Beacon.Size,
1201                                                    TEMPLATE_BEACON,
1202                                                    0,
1203                                                  (void *)cmdBld_ConfigSeq,
1204                                                  hCmdBld);
1205     }
1206 
1207     return TI_NOK;
1208 }
1209 
__cmd_probe_resp_join(TI_HANDLE hCmdBld)1210 static TI_STATUS __cmd_probe_resp_join (TI_HANDLE hCmdBld)
1211 {
1212     if (DB_WLAN(hCmdBld).bJoin && DB_TEMP(hCmdBld).ProbeResp.Size != 0)
1213     {
1214         return cmdBld_CmdIeConfigureTemplateFrame (hCmdBld,
1215                                                    &(DB_TEMP(hCmdBld).ProbeResp),
1216                                                  (TI_UINT16)DB_TEMP(hCmdBld).ProbeResp.Size,
1217                                                    TEMPLATE_PROBE_RESPONSE,
1218                                                    0,
1219                                                  (void *)cmdBld_ConfigSeq,
1220                                                  hCmdBld);
1221     }
1222 
1223     return TI_NOK;
1224 }
1225 
1226 
__cmd_probe_req_join(TI_HANDLE hCmdBld)1227 static TI_STATUS __cmd_probe_req_join (TI_HANDLE hCmdBld)
1228 {
1229     TI_STATUS   tStatus;
1230 
1231     /* set Probe Req template also if join == false ! */
1232     if (DB_TEMP(hCmdBld).ProbeReq24.Size != 0)
1233     {
1234         tStatus =  cmdBld_CmdIeConfigureTemplateFrame (hCmdBld,
1235                                                        &(DB_TEMP(hCmdBld).ProbeReq24),
1236                                                        (TI_UINT16)DB_TEMP(hCmdBld).ProbeReq24.Size,
1237                                                        CFG_TEMPLATE_PROBE_REQ_2_4,
1238                                                        0,
1239                                                        NULL,
1240                                                        NULL);
1241         if (TI_OK != tStatus)
1242         {
1243             return tStatus;
1244         }
1245     }
1246 
1247     /* set Probe Req template also if join == false ! */
1248     if (DB_TEMP(hCmdBld).ProbeReq50.Size != 0)
1249     {
1250         return cmdBld_CmdIeConfigureTemplateFrame (hCmdBld,
1251                                                    &(DB_TEMP(hCmdBld).ProbeReq50),
1252                                                    (TI_UINT16)DB_TEMP(hCmdBld).ProbeReq50.Size,
1253                                                    CFG_TEMPLATE_PROBE_REQ_5,
1254                                                    0,
1255                                                  (void *)cmdBld_ConfigSeq,
1256                                                  hCmdBld);
1257     }
1258 
1259     return TI_NOK;
1260 }
1261 
1262 
__cmd_null_data_join(TI_HANDLE hCmdBld)1263 static TI_STATUS __cmd_null_data_join (TI_HANDLE hCmdBld)
1264 {
1265     if (DB_WLAN(hCmdBld).bJoin && DB_TEMP(hCmdBld).NullData.Size != 0)
1266     {
1267         return cmdBld_CmdIeConfigureTemplateFrame (hCmdBld,
1268                                                    &(DB_TEMP(hCmdBld).NullData),
1269                                                  (TI_UINT16)DB_TEMP(hCmdBld).NullData.Size,
1270                                                    TEMPLATE_NULL_DATA,
1271                                                    0,
1272                                                  (void *)cmdBld_ConfigSeq,
1273                                                  hCmdBld);
1274     }
1275 
1276     return TI_NOK;
1277 }
1278 
__cmd_disconn_join(TI_HANDLE hCmdBld)1279 static TI_STATUS __cmd_disconn_join (TI_HANDLE hCmdBld)
1280 {
1281     if (DB_WLAN(hCmdBld).bJoin && DB_TEMP(hCmdBld).Disconn.Size != 0)
1282     {
1283         return cmdBld_CmdIeConfigureTemplateFrame (hCmdBld,
1284                                                    &(DB_TEMP(hCmdBld).Disconn),
1285                                                    (TI_UINT16)DB_TEMP(hCmdBld).Disconn.Size,
1286                                                    TEMPLATE_DISCONNECT,
1287                                                    0,
1288                                                    (void *)cmdBld_ConfigSeq,
1289                                                    hCmdBld);
1290     }
1291 
1292     return TI_NOK;
1293 }
1294 
__cmd_ps_poll_join(TI_HANDLE hCmdBld)1295 static TI_STATUS __cmd_ps_poll_join (TI_HANDLE hCmdBld)
1296 {
1297     if (DB_WLAN(hCmdBld).bJoin && DB_TEMP(hCmdBld).PsPoll.Size != 0)
1298     {
1299         return cmdBld_CmdIeConfigureTemplateFrame (hCmdBld,
1300                                                    &(DB_TEMP(hCmdBld).PsPoll),
1301                                                  (TI_UINT16)DB_TEMP(hCmdBld).PsPoll.Size,
1302                                                    TEMPLATE_PS_POLL,
1303                                                    0,
1304                                                  (void *)cmdBld_ConfigSeq,
1305                                                  hCmdBld);
1306     }
1307 
1308     return TI_NOK;
1309 }
1310 
__cmd_arp_rsp(TI_HANDLE hCmdBld)1311 static TI_STATUS __cmd_arp_rsp (TI_HANDLE hCmdBld)
1312 {
1313 
1314    return cmdBld_CmdIeConfigureTemplateFrame (hCmdBld,
1315                                                    NULL,
1316                                                    DB_WLAN(hCmdBld).ArpRspTemplateSize,
1317                                                    TEMPLATE_ARP_RSP,
1318                                                    0,
1319                                                    (void *)cmdBld_ConfigSeq,
1320                                                    hCmdBld);
1321 }
1322 
1323 
__cmd_arp_rsp_join(TI_HANDLE hCmdBld)1324 static TI_STATUS __cmd_arp_rsp_join (TI_HANDLE hCmdBld)
1325 {
1326 
1327     if ((DB_WLAN(hCmdBld).bJoin) && (DB_TEMP(hCmdBld).ArpRsp.Size != 0))
1328     {
1329         return cmdBld_CmdIeConfigureTemplateFrame (hCmdBld,
1330                                                    &(DB_TEMP(hCmdBld).ArpRsp),
1331                                                    DB_TEMP(hCmdBld).ArpRsp.Size,
1332                                                    TEMPLATE_ARP_RSP,
1333                                                    0,
1334                                                    (void *)cmdBld_ConfigSeq,
1335                                                    hCmdBld);
1336     }
1337 
1338     return TI_NOK;
1339 }
1340 
1341 
1342 
1343 
__cmd_keep_alive_tmpl_join(TI_HANDLE hCmdBld)1344 static TI_STATUS __cmd_keep_alive_tmpl_join (TI_HANDLE hCmdBld)
1345 {
1346     TI_UINT32   index;
1347     TI_STATUS   status = TI_NOK;
1348 
1349     /*
1350      * config templates
1351      * first configure all indexes but the last one with no CB, and than configure the last one
1352      * with a CB to continue configuration.
1353      */
1354     for (index = 0; index < KLV_MAX_TMPL_NUM - 1; index++)
1355     {
1356         if (DB_WLAN(hCmdBld).bJoin && DB_TEMP(hCmdBld).KeepAlive[ index ].Size != 0)
1357         {
1358             status =  cmdBld_CmdIeConfigureTemplateFrame (hCmdBld,
1359                                                           &(DB_TEMP(hCmdBld).KeepAlive[index]),
1360                                                           (TI_UINT16)DB_TEMP(hCmdBld).KeepAlive[index].Size,
1361                                                           TEMPLATE_KLV,
1362                                                           index,
1363                                                           NULL,
1364                                                           NULL);
1365             if (TI_OK != status)
1366             {
1367                 return status;
1368             }
1369         }
1370     }
1371 
1372     if (DB_WLAN(hCmdBld).bJoin && DB_TEMP(hCmdBld).KeepAlive[ index ].Size != 0)
1373     {
1374         status =  cmdBld_CmdIeConfigureTemplateFrame (hCmdBld,
1375                                                       &(DB_TEMP(hCmdBld).KeepAlive[index]),
1376                                                       (TI_UINT16)DB_TEMP(hCmdBld).KeepAlive[index].Size,
1377                                                       TEMPLATE_KLV,
1378                                                       index,
1379                                                       (void *)cmdBld_ConfigSeq,
1380                                                       hCmdBld);
1381         if (TI_OK != status)
1382         {
1383             return status;
1384         }
1385     }
1386 
1387     return status;
1388 }
1389 
1390 
__cmd_keep_alive_params(TI_HANDLE hCmdBld)1391 static TI_STATUS __cmd_keep_alive_params(TI_HANDLE hCmdBld)
1392 {
1393     TI_UINT32   index;
1394     TI_STATUS   status;
1395 
1396     /* config gloabl enable / disable flag */
1397     cmdBld_CfgKeepAliveEnaDis (hCmdBld, DB_KLV(hCmdBld).enaDisFlag, NULL, NULL);
1398 
1399     /*
1400      * config per-template params
1401      * fisr configure all indexes but the last one with no CB, and than configure the last one
1402      * with a CB to continue configuration.
1403      */
1404     for (index = 0; index < KLV_MAX_TMPL_NUM - 1; index++)
1405     {
1406         if (DB_WLAN(hCmdBld).bJoin && DB_KLV(hCmdBld).keepAliveParams[ index ].enaDisFlag != 0)
1407         {
1408             status =  cmdBld_CmdIeConfigureKeepAliveParams (hCmdBld,
1409                                                             index,
1410                                                             DB_KLV(hCmdBld).keepAliveParams[ index ].enaDisFlag,
1411                                                             DB_KLV(hCmdBld).keepAliveParams[ index ].trigType,
1412                                                             DB_KLV(hCmdBld).keepAliveParams[ index ].interval,
1413                                                             NULL,
1414                                                             NULL);
1415             if (TI_OK != status)
1416             {
1417                 return status;
1418             }
1419         }
1420     }
1421 
1422     /* Set NOK for a case the following config is skipped, to indicate that no callback is expected */
1423     status = TI_NOK;
1424 
1425     if (DB_WLAN(hCmdBld).bJoin && DB_KLV(hCmdBld).keepAliveParams[ index ].enaDisFlag != 0)
1426     {
1427         status =  cmdBld_CmdIeConfigureKeepAliveParams (hCmdBld,
1428                                                         index,
1429                                                         DB_KLV(hCmdBld).keepAliveParams[ index ].enaDisFlag,
1430                                                         DB_KLV(hCmdBld).keepAliveParams[ index ].trigType,
1431                                                         DB_KLV(hCmdBld).keepAliveParams[ index ].interval,
1432                                                         (void *)cmdBld_ConfigSeq,
1433                                                         hCmdBld);
1434         if (TI_OK != status)
1435         {
1436             return status;
1437         }
1438     }
1439 
1440     return status;
1441 }
1442 
__cmd_power_auth(TI_HANDLE hCmdBld)1443 static TI_STATUS __cmd_power_auth (TI_HANDLE hCmdBld)
1444 {
1445     return cmdBld_CfgIeSleepAuth (hCmdBld,
1446                               DB_WLAN(hCmdBld).minPowerLevel,
1447                               (void *)cmdBld_ConfigSeq,
1448                               hCmdBld);
1449 }
1450 
__cmd_start_join(TI_HANDLE hCmdBld)1451 static TI_STATUS __cmd_start_join (TI_HANDLE hCmdBld)
1452 {
1453     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
1454 
1455     if (DB_WLAN(hCmdBld).bJoin)
1456     {
1457         /*
1458          * Replace the Join-Complete event CB by a local function.
1459          * Thus, the reconfig sequence will not continue until the Join is completed!
1460          * The original CB is restored after Join-Complete.
1461          */
1462         eventMbox_ReplaceEvent (pCmdBld->hEventMbox,
1463                                   TWD_OWN_EVENT_JOIN_CMPLT,
1464                                   (void *)cmdBld_JoinCmpltForReconfigCb,
1465                                   hCmdBld,
1466                                   &pCmdBld->fJoinCmpltOriginalCbFunc,
1467                                   &pCmdBld->hJoinCmpltOriginalCbHndl);
1468         /*
1469          * Call the hardware to start/join the bss
1470          */
1471         return cmdBld_CmdStartJoin (hCmdBld,
1472                                     (ScanBssType_e)DB_BSS(hCmdBld).ReqBssType,
1473                                     (void *)cmdBld_DummyCb,
1474                                     hCmdBld);
1475     }
1476 
1477     return TI_NOK;
1478 }
1479 
__cmd_sta_state(TI_HANDLE hCmdBld)1480 static TI_STATUS __cmd_sta_state (TI_HANDLE hCmdBld)
1481 {
1482     if (DB_WLAN(hCmdBld).bStaConnected)
1483     {
1484         return cmdBld_CmdSetStaState (hCmdBld,
1485                                     STA_STATE_CONNECTED,
1486                                     (void *)cmdBld_ConfigSeq,
1487                                     hCmdBld);
1488     }
1489 
1490     return TI_NOK;
1491 }
1492 
__cfg_aid(TI_HANDLE hCmdBld)1493 static TI_STATUS __cfg_aid (TI_HANDLE hCmdBld)
1494 {
1495     if (DB_WLAN(hCmdBld).bJoin)
1496     {
1497         return cmdBld_CfgAid (hCmdBld, DB_WLAN(hCmdBld).Aid, (void *)cmdBld_ConfigSeq, hCmdBld);
1498     }
1499 
1500     return TI_NOK;
1501 }
1502 
1503 
__cfg_slot_time_join(TI_HANDLE hCmdBld)1504 static TI_STATUS __cfg_slot_time_join (TI_HANDLE hCmdBld)
1505 {
1506     if (DB_WLAN(hCmdBld).bJoin)
1507     {
1508         /* Slot time must be setting after doing join */
1509         return cmdBld_CfgSlotTime (hCmdBld, (ESlotTime)(DB_WLAN(hCmdBld).SlotTime), (void *)cmdBld_ConfigSeq, hCmdBld);
1510     }
1511 
1512     return TI_NOK;
1513 }
1514 
1515 
__cfg_preamble_join(TI_HANDLE hCmdBld)1516 static TI_STATUS __cfg_preamble_join (TI_HANDLE hCmdBld)
1517 {
1518     if (DB_WLAN(hCmdBld).bJoin)
1519     {
1520         /* Preamble type must be set after doing join */
1521         return cmdBld_CfgPreamble (hCmdBld, (Preamble_e) DB_WLAN(hCmdBld).preamble, (void *)cmdBld_ConfigSeq, hCmdBld);
1522     }
1523 
1524     return TI_NOK;
1525 }
1526 
1527 
__cfg_ht_capabilities(TI_HANDLE hCmdBld)1528 static TI_STATUS __cfg_ht_capabilities (TI_HANDLE hCmdBld)
1529 {
1530     if (DB_WLAN(hCmdBld).bJoin && DB_BSS(hCmdBld).bHtCap)
1531     {
1532         /* HT capabilities must be set after doing join */
1533         return cmdBld_CfgIeSetFwHtCapabilities (hCmdBld,
1534                                                 DB_BSS(hCmdBld).uHtCapabilites,
1535                                                 DB_BSS(hCmdBld).tMacAddress,
1536                                                 DB_BSS(hCmdBld).uAmpduMaxLeng,
1537                                                 DB_BSS(hCmdBld).uAmpduMinSpac,
1538                                                 (void *)cmdBld_ConfigSeq,
1539                                                 hCmdBld);
1540     }
1541 
1542     return TI_NOK;
1543 }
1544 
1545 
__cfg_ht_information(TI_HANDLE hCmdBld)1546 static TI_STATUS __cfg_ht_information (TI_HANDLE hCmdBld)
1547 {
1548     if (DB_WLAN(hCmdBld).bJoin && DB_BSS(hCmdBld).bHtInf)
1549     {
1550         /* HT Information must be set after doing join */
1551         return cmdBld_CfgIeSetFwHtInformation (hCmdBld,
1552                                                DB_BSS(hCmdBld).uRifsMode,
1553                                                DB_BSS(hCmdBld).uHtProtection,
1554                                                DB_BSS(hCmdBld).uGfProtection,
1555                                                DB_BSS(hCmdBld).uHtTxBurstLimit,
1556                                                DB_BSS(hCmdBld).uDualCtsProtection,
1557                                                (void *)cmdBld_ConfigSeq,
1558                                                hCmdBld);
1559     }
1560 
1561     return TI_NOK;
1562 }
1563 
1564 
__cfg_ba_set_session(TI_HANDLE hCmdBld)1565 static TI_STATUS __cfg_ba_set_session (TI_HANDLE hCmdBld)
1566 {
1567 	TI_STATUS tRes = TI_NOK;
1568 
1569     if (DB_WLAN(hCmdBld).bJoin)
1570     {
1571         TI_UINT32 uTid;
1572 		TI_UINT32 uLastTid = MAX_NUM_OF_802_1d_TAGS; /* initial value is "not found" */
1573 
1574 		/* Look through configured BA sessions in data base to find the last set TID */
1575         for (uTid = 0; uTid < MAX_NUM_OF_802_1d_TAGS; uTid++)
1576         {
1577             /* Is BA initiator or responder configured? */
1578             if (DB_BSS(hCmdBld).bBaInitiator[uTid] || DB_BSS(hCmdBld).bBaResponder[uTid])
1579             {
1580 				uLastTid = uTid;
1581             }
1582 		}
1583 
1584 		if (uLastTid != MAX_NUM_OF_802_1d_TAGS)
1585 		{
1586 			/* At least one TID is set */
1587 			for (uTid = 0; uTid < uLastTid; ++uTid)
1588 			{
1589 				if (DB_BSS(hCmdBld).bBaInitiator[uTid])
1590 				{
1591 					/* set BA Initiator */
1592 					tRes = cmdBld_CfgIeSetBaSession (hCmdBld,
1593 													 ACX_BA_SESSION_INITIATOR_POLICY,
1594 													 uTid,
1595 													 DB_BSS(hCmdBld).tBaSessionInitiatorPolicy[uTid].uPolicy,
1596 													 DB_BSS(hCmdBld).tBaSessionInitiatorPolicy[uTid].aMacAddress,
1597 													 DB_BSS(hCmdBld).tBaSessionInitiatorPolicy[uTid].uWinSize,
1598 													 DB_BSS(hCmdBld).tBaSessionInitiatorPolicy[uTid].uInactivityTimeout,
1599 													 NULL,
1600 													 NULL);
1601 					if (tRes != TI_OK)
1602 					{
1603 						return tRes;
1604 					}
1605 				}
1606 
1607 				if (DB_BSS(hCmdBld).bBaResponder[uTid])
1608 				{
1609 					/* set BA Responder */
1610 					tRes = cmdBld_CfgIeSetBaSession (hCmdBld,
1611 													 ACX_BA_SESSION_RESPONDER_POLICY,
1612 													 uTid,
1613 													 DB_BSS(hCmdBld).tBaSessionResponderPolicy[uTid].uPolicy,
1614 													 DB_BSS(hCmdBld).tBaSessionResponderPolicy[uTid].aMacAddress,
1615 													 DB_BSS(hCmdBld).tBaSessionResponderPolicy[uTid].uWinSize,
1616 													 DB_BSS(hCmdBld).tBaSessionResponderPolicy[uTid].uInactivityTimeout,
1617 													 NULL,
1618 													 NULL);
1619 					if (tRes != TI_OK)
1620 					{
1621 						return tRes;
1622 					}
1623 				}
1624 			}
1625 
1626 			/* Push the last command of the last TID entry into queue with a call back function */
1627 			if (DB_BSS(hCmdBld).bBaInitiator[uLastTid] && !(DB_BSS(hCmdBld).bBaResponder[uLastTid]))
1628 			{
1629 
1630 				tRes = cmdBld_CfgIeSetBaSession (hCmdBld,
1631 												 ACX_BA_SESSION_INITIATOR_POLICY,
1632 												 uLastTid,
1633 												 DB_BSS(hCmdBld).tBaSessionInitiatorPolicy[uLastTid].uPolicy,
1634 												 DB_BSS(hCmdBld).tBaSessionInitiatorPolicy[uLastTid].aMacAddress,
1635 												 DB_BSS(hCmdBld).tBaSessionInitiatorPolicy[uLastTid].uWinSize,
1636 												 DB_BSS(hCmdBld).tBaSessionInitiatorPolicy[uLastTid].uInactivityTimeout,
1637 												 (void *)cmdBld_ConfigSeq,
1638 												 hCmdBld);
1639 			}
1640 			else if (!(DB_BSS(hCmdBld).bBaInitiator[uLastTid]) && DB_BSS(hCmdBld).bBaResponder[uLastTid])
1641 			{
1642 				tRes = cmdBld_CfgIeSetBaSession (hCmdBld,
1643 												 ACX_BA_SESSION_RESPONDER_POLICY,
1644 												 uLastTid,
1645 												 DB_BSS(hCmdBld).tBaSessionResponderPolicy[uLastTid].uPolicy,
1646 												 DB_BSS(hCmdBld).tBaSessionResponderPolicy[uLastTid].aMacAddress,
1647 												 DB_BSS(hCmdBld).tBaSessionResponderPolicy[uLastTid].uWinSize,
1648 												 DB_BSS(hCmdBld).tBaSessionResponderPolicy[uLastTid].uInactivityTimeout,
1649 												 (void *)cmdBld_ConfigSeq,
1650 												 hCmdBld);
1651 			}
1652 			else
1653 			{
1654 				/* Initiator & Responsder policy is to be set */
1655 				tRes = cmdBld_CfgIeSetBaSession (hCmdBld,
1656 												 ACX_BA_SESSION_INITIATOR_POLICY,
1657 												 uLastTid,
1658 												 DB_BSS(hCmdBld).tBaSessionInitiatorPolicy[uLastTid].uPolicy,
1659 												 DB_BSS(hCmdBld).tBaSessionInitiatorPolicy[uLastTid].aMacAddress,
1660 												 DB_BSS(hCmdBld).tBaSessionInitiatorPolicy[uLastTid].uWinSize,
1661 												 DB_BSS(hCmdBld).tBaSessionInitiatorPolicy[uLastTid].uInactivityTimeout,
1662 												 NULL,
1663 												 NULL);
1664 				if (tRes != TI_OK)
1665 				{
1666 					return tRes;
1667 				}
1668 
1669 				tRes = cmdBld_CfgIeSetBaSession (hCmdBld,
1670 												 ACX_BA_SESSION_RESPONDER_POLICY,
1671 												 uLastTid,
1672 												 DB_BSS(hCmdBld).tBaSessionResponderPolicy[uLastTid].uPolicy,
1673 												 DB_BSS(hCmdBld).tBaSessionResponderPolicy[uLastTid].aMacAddress,
1674 												 DB_BSS(hCmdBld).tBaSessionResponderPolicy[uLastTid].uWinSize,
1675 												 DB_BSS(hCmdBld).tBaSessionResponderPolicy[uLastTid].uInactivityTimeout,
1676 												 (void *)cmdBld_ConfigSeq,
1677 												 hCmdBld);
1678 			}
1679 		}
1680 	}
1681 
1682 	return tRes;
1683 }
1684 
1685 
__cfg_tx_power_join(TI_HANDLE hCmdBld)1686 static TI_STATUS __cfg_tx_power_join (TI_HANDLE hCmdBld)
1687 {
1688     if (DB_WLAN(hCmdBld).bJoin)
1689     {
1690         /* Tx-power must be set after doing join */
1691         return cmdBld_CfgTxPowerDbm (hCmdBld, DB_WLAN(hCmdBld).TxPowerDbm, (void *)cmdBld_ConfigSeq, hCmdBld);
1692     }
1693 
1694     return TI_NOK;
1695 }
1696 
1697 
__cfg_keys(TI_HANDLE hCmdBld)1698 static TI_STATUS __cfg_keys (TI_HANDLE hCmdBld)
1699 {
1700     TCmdBld   *pCmdBld = (TCmdBld *)hCmdBld;
1701     TI_UINT32  index;
1702 
1703     if (!DB_WLAN(hCmdBld).bJoin)
1704     {
1705         return TI_NOK;
1706     }
1707 
1708     if (pCmdBld->tSecurity.eSecurityMode != TWD_CIPHER_NONE)
1709     {
1710         /*
1711          * We are doing recovery during security so increase security-sequence-number by 255 just to ensure
1712          *   the AP will see progress from last Tx before the recovery (actually needed only for TKIP and AES).
1713          * Decrementing the low byte by one is handled like it wrpped around, i.e. increment total number by 255.
1714          */
1715         cmdBld_SetSecuritySeqNum (hCmdBld, (TI_UINT8)(pCmdBld->uSecuritySeqNumLow - 1));
1716 
1717 
1718         /* set the keys to the HW*/
1719         for (index = 0;
1720              index < pCmdBld->tSecurity.uNumOfStations * NO_OF_RECONF_SECUR_KEYS_PER_STATION + NO_OF_EXTRA_RECONF_SECUR_KEYS;
1721              index++)
1722         {
1723             if ((DB_KEYS(pCmdBld).pReconfKeys + index)->keyType != KEY_NULL)
1724             {
1725                 if (cmdBld_CmdAddKey (hCmdBld, DB_KEYS(pCmdBld).pReconfKeys + index, TI_TRUE, NULL, NULL) != TI_OK)
1726                 {
1727                     TRACE1(pCmdBld->hReport, REPORT_SEVERITY_ERROR, "__cfg_keys: ERROR cmdBld_CmdAddKey failure index=%d\n", index);
1728                     return TI_NOK;
1729                 }
1730             }
1731         }
1732 
1733         if (DB_KEYS(pCmdBld).bDefaultKeyIdValid)
1734         {
1735             /* Set the deafult key ID to the HW*/
1736             if (cmdBld_CmdSetWepDefaultKeyId (hCmdBld, DB_KEYS(pCmdBld).uReconfDefaultKeyId, NULL, NULL) != TI_OK)
1737             {
1738                 TRACE0(pCmdBld->hReport, REPORT_SEVERITY_ERROR, "__cfg_keys: ERROR cmdBld_CmdSetWepDefaultKeyId failure\n");
1739                 return TI_NOK;
1740             }
1741         }
1742     }
1743 
1744     /* Set the encryption/decryption control on the HW */
1745     if (cmdBld_CfgHwEncDecEnable (hCmdBld,
1746                                   DB_KEYS(pCmdBld).bReconfHwEncEnable,
1747                                   (void *)cmdBld_ConfigSeq,
1748                                   hCmdBld) != TI_OK)
1749     {
1750         TRACE0(pCmdBld->hReport, REPORT_SEVERITY_ERROR, "__cfg_keys: ERROR cmdBld_CfgHwEncDecEnable failure \n");
1751         return TI_NOK;
1752     }
1753 
1754     return TI_OK;
1755 }
1756 
__cfg_sg_enable(TI_HANDLE hCmdBld)1757 static TI_STATUS __cfg_sg_enable (TI_HANDLE hCmdBld)
1758 {
1759     /* Set the Soft Gemini state */
1760     return cmdBld_CfgSgEnable (hCmdBld,
1761                                DB_WLAN(hCmdBld).SoftGeminiEnable,
1762                                (void *)cmdBld_ConfigSeq,
1763                                hCmdBld);
1764 }
1765 
1766 
__cfg_sg(TI_HANDLE hCmdBld)1767 static TI_STATUS __cfg_sg (TI_HANDLE hCmdBld)
1768 {
1769     /* Set the Soft Gemini params */
1770 
1771 	/* signals the FW to config all the paramters from the DB*/
1772 	DB_WLAN(hCmdBld).SoftGeminiParams.paramIdx = 0xFF;
1773 
1774     return cmdBld_CfgSg (hCmdBld,
1775                          &DB_WLAN(hCmdBld).SoftGeminiParams,
1776                          (void *)cmdBld_ConfigSeq,
1777                          hCmdBld);
1778 }
1779 
1780 
__cfg_fm_coex(TI_HANDLE hCmdBld)1781 static TI_STATUS __cfg_fm_coex (TI_HANDLE hCmdBld)
1782 {
1783     /* Set the FM Coexistence params */
1784     return cmdBld_CfgIeFmCoex (hCmdBld,
1785                                &DB_WLAN(hCmdBld).tFmCoexParams,
1786                                (void *)cmdBld_ConfigSeq,
1787                                hCmdBld);
1788 }
1789 
1790 
__cfg_rate_management(TI_HANDLE hCmdBld)1791 static TI_STATUS __cfg_rate_management (TI_HANDLE hCmdBld)
1792 {
1793 	DB_RM(hCmdBld).rateMngParams.paramIndex = (rateAdaptParam_e) 0xFF;
1794 
1795 	return cmdBld_CfgIeRateMngDbg(hCmdBld,
1796 						   &DB_RM(hCmdBld).rateMngParams,
1797 						   (void *)cmdBld_ConfigSeq,
1798 						   hCmdBld);
1799 
1800 }
1801 
1802 
__itr_memory_map(TI_HANDLE hCmdBld)1803 TI_STATUS __itr_memory_map (TI_HANDLE hCmdBld)
1804 {
1805     TCmdBld   *pCmdBld = (TCmdBld *)hCmdBld;
1806 
1807     WLAN_OS_REPORT(("Interrogate TX/RX parameters\n"));
1808 
1809     /* Interrogate TX/RX parameters */
1810     return cmdBld_ItrIeMemoryMap (hCmdBld,
1811                                   &pCmdBld->tMemMap,
1812                                   (void *)cmdBld_ConfigFwCb,
1813                                   hCmdBld);
1814 }
1815 
1816 
1817 static const TCmdCfgFunc aCmdIniSeq [] =
1818 {
1819     __cfg_platform_params,
1820     __cfg_radio_params,
1821 	__cfg_extended_radio_params,
1822     __cmd_probe_req,
1823     __cmd_null_data,
1824     __cmd_disconn,
1825     __cmd_ps_poll,
1826     __cmd_qos_null_data,
1827     __cmd_probe_resp,
1828     __cmd_beacon,
1829     __cmd_keep_alive_tmpl,
1830     __cfg_mem,
1831     __cfg_rx_msdu_life_time,
1832     __cfg_rx,
1833     __cfg_ac_params_0,
1834     __cfg_tid_0,
1835     __cfg_ac_params_1,
1836     __cfg_tid_1,
1837     __cfg_ac_params_2,
1838     __cfg_tid_2,
1839     __cfg_ac_params_3,
1840     __cfg_tid_3,
1841     __cfg_pd_threshold,
1842     __cfg_slot_time,
1843     __cmd_arp_rsp,
1844     __cfg_arp_ip_filter,
1845     __cfg_group_address_table,
1846     __cfg_service_period_timeout,
1847     __cfg_rts_threshold,
1848     __cfg_dco_itrim_params,
1849     __cfg_fragment_threshold,
1850     __cfg_pm_config,
1851     __cfg_beacon_filter_opt,
1852     __cfg_beacon_filter_table,
1853     __cfg_tx_cmplt_pacing,
1854     __cfg_rx_intr_pacing,
1855     __cfg_sg,
1856     __cfg_sg_enable,
1857     __cfg_fm_coex,
1858     __cfg_cca_threshold,
1859     __cfg_bcn_brc_options,
1860     __cmd_enable_rx,
1861     __cmd_enable_tx,
1862     __cfg_ps_wmm,
1863     __cfg_event_scan_cmplt,
1864     __cfg_event_sps_scan_cmplt,
1865     __cfg_event_plt_rx_calibration_cmplt,
1866     __cfg_hw_enc_dec_enable,
1867     __cfg_rssi_snr_weights,
1868     __cfg_rssi_snr_trigger_0,
1869     __cfg_rssi_snr_trigger_1,
1870     __cfg_rssi_snr_trigger_2,
1871     __cfg_rssi_snr_trigger_3,
1872     __cfg_rssi_snr_trigger_4,
1873     __cfg_rssi_snr_trigger_5,
1874     __cfg_rssi_snr_trigger_6,
1875     __cfg_rssi_snr_trigger_7,
1876     __cfg_max_tx_retry,
1877     __cfg_split_scan_timeout,
1878 
1879     /* Re-join sequence */
1880     __cfg_tx_rate_policy,
1881     __cmd_beacon_join,
1882     __cmd_probe_resp_join,
1883     __cmd_probe_req_join,
1884     __cmd_null_data_join,
1885     __cmd_disconn_join,
1886     __cmd_ps_poll_join,
1887     __cmd_keep_alive_tmpl_join,
1888     __cfg_slot_time_join,
1889     __cfg_preamble_join,
1890     __cfg_ht_capabilities,
1891     __cfg_ht_information,
1892     __cmd_start_join,
1893     __cfg_aid,
1894     __cfg_ba_set_session,
1895     __cfg_tx_power_join,
1896     __cfg_keys,
1897     __cmd_keep_alive_params,
1898     __cfg_conn_monit_params,
1899     __cfg_bet,
1900     __cfg_cts_protection,
1901     __cfg_ps_rx_streaming,
1902     __cfg_rx_data_filter,
1903     __cmd_sta_state,
1904     __cmd_power_auth,
1905 	__cmd_burst_mode_enable,
1906 	__cfg_rate_management,
1907     __cmd_arp_rsp_join,
1908     /* Interrogate command -> must be last!! */
1909     __itr_memory_map,
1910 
1911     NULL
1912 };
1913 
1914 
1915 /****************************************************************************
1916  *                      cmdBld_ConfigSeq()
1917  ****************************************************************************
1918  * DESCRIPTION: Configuration sequence engine
1919  *
1920  * INPUTS: None
1921  *
1922  * OUTPUT: None
1923  *
1924  * RETURNS: TI_OK or TI_NOK
1925  ****************************************************************************/
cmdBld_ConfigSeq(TI_HANDLE hCmdBld)1926 TI_STATUS cmdBld_ConfigSeq (TI_HANDLE hCmdBld)
1927 {
1928     TCmdBld   *pCmdBld = (TCmdBld *)hCmdBld;
1929 
1930     do
1931     {
1932         if (aCmdIniSeq [pCmdBld->uIniSeq++] == NULL)
1933         {
1934             return TI_NOK;
1935         }
1936     }
1937     while ((*aCmdIniSeq [pCmdBld->uIniSeq - 1])(hCmdBld) != TI_OK);
1938 
1939     return TI_OK;
1940 }
1941 
1942 /****************************************************************************
1943  *                      cmdBld_FinalizeDownload()
1944  ****************************************************************************
1945  * DESCRIPTION: Finalize all the remaining initialization after the download has finished
1946  *
1947  * INPUTS:
1948  *
1949  * OUTPUT:  None
1950  *
1951  * RETURNS: void
1952  ****************************************************************************/
cmdBld_FinalizeDownload(TI_HANDLE hCmdBld,TBootAttr * pBootAttr,FwStaticData_t * pFwInfo)1953 void cmdBld_FinalizeDownload (TI_HANDLE hCmdBld, TBootAttr *pBootAttr, FwStaticData_t *pFwInfo)
1954 {
1955     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
1956     TI_UINT8    *pMacAddr = pFwInfo->dot11StationID;
1957     TI_UINT32    i;
1958     TI_UINT8     uTmp;
1959 
1960     /* Save FW version */
1961     os_memoryCopy (pCmdBld->hOs,
1962                    (void *)DB_HW(hCmdBld).fwVer,
1963                    (void *)pFwInfo->FWVersion,
1964                    sizeof(DB_HW(hCmdBld).fwVer));
1965 
1966     /* Save MAC adress (correct the bytes order first) */
1967     for (i = 0; i < 3; i++)
1968     {
1969         uTmp = pMacAddr[i];
1970         pMacAddr[i] = pMacAddr[5 - i];
1971         pMacAddr[5 - i] = uTmp;
1972     }
1973     MAC_COPY (DB_HW(hCmdBld).macAddress, pMacAddr);
1974 
1975     /* Save chip ID */
1976     os_memoryCopy (pCmdBld->hOs,
1977                    (void *)&(DB_HW(hCmdBld).uHardWareVersion),
1978                    (void *)&(pFwInfo->HardWareVersion),
1979                    sizeof(DB_HW(hCmdBld).uHardWareVersion));
1980 
1981     /* Save power-levels table */
1982     os_memoryCopy (pCmdBld->hOs,
1983                    (void *)DB_HW(hCmdBld).txPowerTable,
1984                    (void *)pFwInfo->txPowerTable,
1985                    sizeof(DB_HW(hCmdBld).txPowerTable));
1986 
1987     /* Call the upper layer callback */
1988     (*((TFinalizeCb)pCmdBld->fFinalizeDownload)) (pCmdBld->hFinalizeDownload);
1989 }
1990 
1991 
cmdBld_GetParam(TI_HANDLE hCmdBld,TTwdParamInfo * pParamInfo)1992 TI_STATUS cmdBld_GetParam (TI_HANDLE hCmdBld, TTwdParamInfo *pParamInfo)
1993 {
1994     TCmdBld       *pCmdBld = (TCmdBld *)hCmdBld;
1995     TWlanParams   *pWlanParams = &DB_WLAN(hCmdBld);
1996 
1997     switch (pParamInfo->paramType)
1998     {
1999         case TWD_RTS_THRESHOLD_PARAM_ID:
2000             pParamInfo->content.halCtrlRtsThreshold = pWlanParams->RtsThreshold;
2001             break;
2002 
2003         case TWD_FRAG_THRESHOLD_PARAM_ID:
2004             pParamInfo->content.halCtrlFragThreshold = pWlanParams->FragmentThreshold;
2005             break;
2006 
2007         case TWD_COUNTERS_PARAM_ID:
2008             /* Constant zero because the ACX last buffer next pointer is always pointed
2009                to itself, so it's like an endless buffer*/
2010             pParamInfo->content.halCtrlCounters.RecvNoBuffer = 0;
2011             pParamInfo->content.halCtrlCounters.FragmentsRecv = 0; /* not supported;*/
2012             pParamInfo->content.halCtrlCounters.FrameDuplicates = 0;/* not supported*/
2013             pParamInfo->content.halCtrlCounters.FcsErrors = DB_CNT(hCmdBld).FcsErrCnt;
2014             pParamInfo->content.halCtrlCounters.RecvError = DB_CNT(hCmdBld).FcsErrCnt;
2015             break;
2016 
2017         case TWD_LISTEN_INTERVAL_PARAM_ID:
2018             pParamInfo->content.halCtrlListenInterval = pWlanParams->ListenInterval;
2019             break;
2020 
2021         case TWD_RSN_DEFAULT_KEY_ID_PARAM_ID:
2022             /* Not implemented */
2023             return TI_NOK;
2024 
2025         case TWD_RSN_SECURITY_MODE_PARAM_ID:
2026              pParamInfo->content.rsnEncryptionStatus = pCmdBld->tSecurity.eSecurityMode;
2027             break;
2028 
2029       case TWD_ACX_STATISTICS_PARAM_ID:
2030             /* Not implemented */
2031          #if 0
2032             {
2033                 acxStatisitcs_t     acxStatisitics;
2034                 pParamInfo->content.acxStatisitics.FWpacketReceived = acxStatisitics.FWpacketReceived;
2035                 /* Not supported */
2036                 pParamInfo->content.acxStatisitics.HALpacketReceived = 0;
2037             }
2038          #endif
2039             return TI_NOK;
2040 
2041     case TWD_MEDIUM_OCCUPANCY_PARAM_ID:
2042         if (cmdBld_ItrIeMediumOccupancy (hCmdBld, pParamInfo->content.interogateCmdCBParams) != TI_OK)
2043             return TI_NOK;
2044             break;
2045 
2046     case TWD_TSF_DTIM_MIB_PARAM_ID:
2047         if (cmdBld_ItrIeTfsDtim (hCmdBld, pParamInfo->content.interogateCmdCBParams) != TI_OK)
2048             return TI_NOK;
2049         break;
2050 
2051     case TWD_AID_PARAM_ID:
2052         if (cmdBld_GetCurrentAssociationId (hCmdBld, &pParamInfo->content.halCtrlAid) != TI_OK)
2053             return TI_NOK;
2054 
2055         TRACE1(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , " AID 2 %d\n", pParamInfo->content.halCtrlAid);
2056         break;
2057 
2058     case TWD_NOISE_HISTOGRAM_PARAM_ID:
2059         if (cmdBld_ItrIeNoiseHistogramResults (hCmdBld, pParamInfo->content.interogateCmdCBParams) != TI_OK)
2060         {
2061             return TI_NOK;
2062         }
2063         break;
2064 
2065     case TWD_CURRENT_CHANNEL_PARAM_ID:
2066         /* Get current channel number */
2067         pParamInfo->content.halCtrlCurrentChannel = DB_BSS(hCmdBld).RadioChannel;
2068         break;
2069 
2070     /* SNR and RSSI belongs to the same MIB, and the relevant CB is passed here*/
2071     case TWD_RSSI_LEVEL_PARAM_ID:
2072     case TWD_SNR_RATIO_PARAM_ID:
2073         /* Retrive the Callback function and read buffer pointer that are in fact stored in the TIWLAN_ADAPTER and then send it to the Command Mailbox */
2074         cmdBld_ItrRSSI (hCmdBld,
2075                         pParamInfo->content.interogateCmdCBParams.fCb,
2076                         pParamInfo->content.interogateCmdCBParams.hCb,
2077                         pParamInfo->content.interogateCmdCBParams.pCb);
2078         break;
2079 
2080     case TWD_BCN_BRC_OPTIONS_PARAM_ID:
2081         pParamInfo->content.BcnBrcOptions.BeaconRxTimeout    = pWlanParams->BcnBrcOptions.BeaconRxTimeout;
2082         pParamInfo->content.BcnBrcOptions.BroadcastRxTimeout = pWlanParams->BcnBrcOptions.BroadcastRxTimeout;
2083         pParamInfo->content.BcnBrcOptions.RxBroadcastInPs    = pWlanParams->BcnBrcOptions.RxBroadcastInPs;
2084         break;
2085 
2086     case TWD_MAX_RX_MSDU_LIFE_TIME_PARAM_ID:
2087         pParamInfo->content.halCtrlMaxRxMsduLifetime = pWlanParams->MaxRxMsduLifetime;
2088         break;
2089 
2090     case TWD_TX_RATE_CLASS_PARAM_ID:
2091         pParamInfo->content.pTxRatePlicy = &DB_BSS(hCmdBld).TxRateClassParams;
2092         break;
2093 
2094     case TWD_SG_CONFIG_PARAM_ID:
2095         return cmdBld_ItrSg (hCmdBld,
2096                              pParamInfo->content.interogateCmdCBParams.fCb,
2097                              pParamInfo->content.interogateCmdCBParams.hCb,
2098                              (void*)pParamInfo->content.interogateCmdCBParams.pCb);
2099 
2100     case TWD_TX_POWER_PARAM_ID:
2101         pParamInfo->content.halCtrlTxPowerDbm = DB_WLAN(hCmdBld).TxPowerDbm;
2102         break;
2103 
2104     case TWD_RADIO_TEST_PARAM_ID:
2105         TRACE0(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "Radio Test\n");
2106         return cmdBld_CmdTest (hCmdBld,
2107                                pParamInfo->content.interogateCmdCBParams.fCb,
2108                                pParamInfo->content.interogateCmdCBParams.hCb,
2109                                (TTestCmd*)pParamInfo->content.interogateCmdCBParams.pCb);
2110 
2111     case TWD_DCO_ITRIM_PARAMS_ID:
2112         pParamInfo->content.tDcoItrimParams.enable = pWlanParams->dcoItrimEnabled;
2113         pParamInfo->content.tDcoItrimParams.moderationTimeoutUsec = pWlanParams->dcoItrimModerationTimeoutUsec;
2114         break;
2115 
2116     default:
2117         TRACE1(pCmdBld->hReport, REPORT_SEVERITY_ERROR, "cmdBld_GetParam - ERROR - Param is not supported, %d\n\n", pParamInfo->paramType);
2118         return (PARAM_NOT_SUPPORTED);
2119     }
2120 
2121     return TI_OK;
2122 }
2123 
2124 
cmdBld_ReadMibBeaconFilterIETable(TI_HANDLE hCmdBld,TI_HANDLE hCb,void * fCb,void * pCb)2125 static TI_STATUS cmdBld_ReadMibBeaconFilterIETable (TI_HANDLE hCmdBld, TI_HANDLE hCb, void* fCb, void* pCb)
2126 {
2127     TCmdBld *pCmdBld                = (TCmdBld *)hCmdBld;
2128     TMib *pMib                      = (TMib*)pCb;
2129     TCmdQueueInterrogateCb RetFunc  = (TCmdQueueInterrogateCb)fCb;
2130     TI_UINT8 IETableSize            = 0;
2131 
2132     /*Get params*/
2133     pMib->aData.BeaconFilter.iNumberOfIEs = DB_WLAN(hCmdBld).beaconFilterIETable.numberOfIEs;
2134     IETableSize = DB_WLAN(hCmdBld).beaconFilterIETable.IETableSize;
2135 
2136     os_memoryZero (pCmdBld->hOs,
2137                    pMib->aData.BeaconFilter.iIETable,
2138                    sizeof(pMib->aData.BeaconFilter.iIETable));
2139 
2140     os_memoryCopy (pCmdBld->hOs,
2141                    pMib->aData.BeaconFilter.iIETable,
2142                    DB_WLAN(hCmdBld).beaconFilterIETable.IETable,
2143                    IETableSize);
2144 
2145     pMib->Length = IETableSize + 1;
2146 
2147     RetFunc(hCb, TI_OK, pCb);
2148 
2149     return TI_OK;
2150 }
2151 
2152 /**
2153  * \author \n
2154  * \date \n
2155  * \brief Coordinates between legacy TxRatePolicy implementation and the MIB format: \n
2156  *        Converts the pGwsi_txRatePolicy back to whal commands
2157  *        Activates the whal whalCtrl_set function
2158  * Function Scope \e Public.\n
2159  * \param  - \n
2160  * \return \n
2161  */
cmdBld_ReadMibTxRatePolicy(TI_HANDLE hCmdBld,TI_HANDLE hCb,void * fCb,void * pCb)2162 static TI_STATUS cmdBld_ReadMibTxRatePolicy (TI_HANDLE hCmdBld, TI_HANDLE hCb, void* fCb, void* pCb)
2163 {
2164     TMib* pMib = (TMib*)pCb;
2165     TCmdQueueInterrogateCb RetFunc = (TCmdQueueInterrogateCb)fCb;
2166     TTwdParamInfo param;
2167     TI_STATUS status = TI_OK;
2168 
2169     param.paramType = TWD_TX_RATE_CLASS_PARAM_ID;
2170     cmdBld_GetParam (hCmdBld, &param);
2171     if (param.content.pTxRatePlicy == NULL)
2172         return TI_NOK;
2173 
2174     /*Copy the data form the param to the MIB*/
2175     pMib->aData.txRatePolicy = *param.content.pTxRatePlicy;
2176     pMib->Length = pMib->aData.txRatePolicy.numOfRateClasses * sizeof(pMib->aData.txRatePolicy.rateClass[0]) +
2177                    sizeof(pMib->aData.txRatePolicy.numOfRateClasses);
2178     RetFunc (hCb, status, pCb);
2179     return status;
2180 }
2181 
2182 
cmdBld_ReadMib(TI_HANDLE hCmdBld,TI_HANDLE hCb,void * fCb,void * pCb)2183 TI_STATUS cmdBld_ReadMib (TI_HANDLE hCmdBld, TI_HANDLE hCb, void* fCb, void* pCb)
2184 {
2185     TCmdBld     *pCmdBld = (TCmdBld *)hCmdBld;
2186     TMib    *pMibBuf = (TMib*)pCb;
2187     TCmdQueueInterrogateCb RetFunc = (TCmdQueueInterrogateCb)fCb;
2188     TI_STATUS Status = TI_OK;
2189 
2190     TRACE1(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "cmdBld_ReadMib :pMibBuf %p:\n",pMibBuf);
2191 
2192     TRACE1(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "cmdBld_ReadMib :aMib %x:\n", pMibBuf->aMib);
2193 
2194     switch (pMibBuf->aMib)
2195     {
2196     case MIB_dot11MaxReceiveLifetime:
2197         {
2198             TTwdParamInfo ParamInfo;
2199             ParamInfo.paramType = TWD_MAX_RX_MSDU_LIFE_TIME_PARAM_ID;
2200             ParamInfo.paramLength = sizeof(ParamInfo.content.halCtrlMaxRxMsduLifetime);
2201             Status = cmdBld_GetParam (hCmdBld, &ParamInfo);
2202             pMibBuf->aData.MaxReceiveLifeTime = ParamInfo.content.halCtrlMaxRxMsduLifetime / 1024; /* converting from usecs to TUs*/
2203             pMibBuf->Length = sizeof(pMibBuf->aData.MaxReceiveLifeTime);
2204         }
2205         break;
2206 
2207     case MIB_dot11GroupAddressesTable:
2208         {
2209             Status = cmdBld_GetGroupAddressTable (hCmdBld,
2210                                                   &pMibBuf->aData.GroupAddressTable.bFilteringEnable,
2211                                                   &pMibBuf->aData.GroupAddressTable.nNumberOfAddresses,
2212                                                   pMibBuf->aData.GroupAddressTable.aGroupTable);
2213 
2214             pMibBuf->Length = sizeof(pMibBuf->aData.GroupAddressTable.bFilteringEnable) +
2215                               sizeof(pMibBuf->aData.GroupAddressTable.nNumberOfAddresses) +
2216                               pMibBuf->aData.GroupAddressTable.nNumberOfAddresses * sizeof(TMacAddr);
2217         }
2218         break;
2219 
2220     case MIB_ctsToSelf:
2221         {
2222             TTwdParamInfo ParamInfo;
2223             ParamInfo.paramType = TWD_CTS_TO_SELF_PARAM_ID;
2224             ParamInfo.paramLength = sizeof(ParamInfo.content.halCtrlCtsToSelf);
2225             Status = cmdBld_GetParam (hCmdBld, &ParamInfo);
2226             pMibBuf->aData.CTSToSelfEnable = ParamInfo.content.halCtrlCtsToSelf;
2227             pMibBuf->Length = sizeof(pMibBuf->aData.CTSToSelfEnable);
2228         }
2229         break;
2230 
2231     case MIB_arpIpAddressesTable:
2232         {
2233             TIpAddr   IpAddress;
2234             EIpVer    IPver;
2235             TI_UINT8  Enable;
2236 
2237             pMibBuf->Length = sizeof(TMibArpIpAddressesTable);
2238             Status = cmdBld_GetArpIpAddressesTable (hCmdBld, &IpAddress, &Enable, &IPver);
2239             if (Status == TI_OK)
2240             {
2241                 pMibBuf->aData.ArpIpAddressesTable.FilteringEnable = Enable;
2242 
2243                 if (IP_VER_4 == IPver) /* IP_VER_4 only */
2244                 {
2245                     IP_COPY (pMibBuf->aData.ArpIpAddressesTable.addr, IpAddress);
2246                 }
2247                 else
2248                 {
2249                     Status = TI_NOK;
2250                 }
2251             }
2252             return Status;
2253         }
2254 
2255     case MIB_rxFilter:
2256         {
2257             TI_UINT32 RxConfigOption;
2258             TI_UINT32 RxFilterOption;
2259 
2260             pMibBuf->Length = 1;
2261             pMibBuf->aData.RxFilter = 0;
2262 
2263             /* Get RX filter data */
2264             Status = cmdBld_GetRxFilters (hCmdBld, &RxConfigOption, &RxFilterOption);
2265             if (TI_OK == Status)
2266             {
2267                 /*Translate to MIB bitmap*/
2268                 if ((RxConfigOption & RX_CFG_MAC) == RX_CFG_ENABLE_ANY_DEST_MAC)
2269                     pMibBuf->aData.RxFilter |= MIB_RX_FILTER_PROMISCOUS_SET;
2270 
2271                 if ((RxConfigOption & RX_CFG_BSSID) == RX_CFG_ENABLE_ONLY_MY_BSSID)
2272                     pMibBuf->aData.RxFilter |= MIB_RX_FILTER_BSSID_SET;
2273             }
2274         }
2275         break;
2276 
2277     case MIB_beaconFilterIETable:
2278         return cmdBld_ReadMibBeaconFilterIETable (hCmdBld, hCb, fCb, pCb);
2279 
2280     case MIB_txRatePolicy:
2281         return cmdBld_ReadMibTxRatePolicy (hCmdBld, hCb, fCb, pCb);
2282 
2283     case MIB_countersTable:
2284         return cmdBld_ItrErrorCnt (hCmdBld, fCb, hCb, pCb);
2285 
2286     case MIB_statisticsTable:
2287         return cmdBld_ItrRoamimgStatisitics (hCmdBld, fCb, hCb, pCb);
2288 
2289     default:
2290         TRACE1(pCmdBld->hReport, REPORT_SEVERITY_ERROR, "TWD_ReadMib:MIB aMib 0x%x Not supported\n",pMibBuf->aMib);
2291         return TI_NOK;
2292     }
2293 
2294     if(RetFunc)
2295         RetFunc(hCb, Status, pCb);
2296 
2297     return TI_OK;
2298 }
2299 
2300 
cmdBld_GetGroupAddressTable(TI_HANDLE hCmdBld,TI_UINT8 * pEnabled,TI_UINT8 * pNumGroupAddrs,TMacAddr * pGroupAddr)2301 TI_STATUS cmdBld_GetGroupAddressTable (TI_HANDLE hCmdBld, TI_UINT8* pEnabled, TI_UINT8* pNumGroupAddrs, TMacAddr *pGroupAddr)
2302 {
2303     TCmdBld   *pCmdBld = (TCmdBld *)hCmdBld;
2304     TI_UINT32     i;
2305 
2306     if (NULL == pEnabled || NULL == pNumGroupAddrs || NULL == pGroupAddr)
2307     {
2308         TRACE3(pCmdBld->hReport, REPORT_SEVERITY_ERROR, "cmdBld_GetGroupAddressTable: pisEnabled=0x%p pnumGroupAddrs=0x%p  Group_addr=0x%p !!!\n", pEnabled, pNumGroupAddrs, pGroupAddr);
2309         return PARAM_VALUE_NOT_VALID;
2310     }
2311 
2312     *pNumGroupAddrs = DB_WLAN(hCmdBld).numGroupAddrs;
2313     *pEnabled = DB_WLAN(hCmdBld).isMacAddrFilteringnabled;
2314 
2315     os_memoryZero (pCmdBld->hOs, pGroupAddr, sizeof(pGroupAddr));
2316     for (i = 0; i < *pNumGroupAddrs; i++)
2317     {
2318         os_memoryCopy (pCmdBld->hOs,
2319                        (void *)&((*pGroupAddr)[MAC_ADDR_LEN*i]),
2320                        &DB_WLAN(hCmdBld).aGroupAddr[i],
2321                        MAC_ADDR_LEN);
2322     }
2323 
2324     return TI_OK;
2325 }
2326 
2327 
cmdBld_GetRxFilters(TI_HANDLE hCmdBld,TI_UINT32 * pRxConfigOption,TI_UINT32 * pRxFilterOption)2328 TI_STATUS cmdBld_GetRxFilters (TI_HANDLE hCmdBld, TI_UINT32* pRxConfigOption, TI_UINT32* pRxFilterOption)
2329 {
2330     *pRxConfigOption = DB_WLAN(hCmdBld).RxConfigOption;
2331     *pRxFilterOption = DB_WLAN(hCmdBld).RxFilterOption;
2332 
2333     return TI_OK;
2334 }
2335 
2336 
cmdBld_GetFWInfo(TI_HANDLE hCmdBld)2337 TFwInfo * cmdBld_GetFWInfo (TI_HANDLE hCmdBld)
2338 {
2339     return &DB_HW(hCmdBld);
2340 }
2341 
2342 
2343 
cmdBld_SetRadioBand(TI_HANDLE hCmdBld,ERadioBand eRadioBand)2344 TI_STATUS cmdBld_SetRadioBand (TI_HANDLE hCmdBld, ERadioBand eRadioBand)
2345 {
2346     DB_WLAN(hCmdBld).RadioBand = eRadioBand;
2347 
2348     return TI_OK;
2349 }
2350 
2351 
2352 /****************************************************************************
2353  *                      cmdBld_CurrentAssociationIdGet()
2354  ****************************************************************************
2355  * DESCRIPTION: Get the current TX antenna
2356  *
2357  * INPUTS:
2358  *
2359  * OUTPUT:
2360  *
2361  * RETURNS: TI_OK or TI_NOK
2362  ****************************************************************************/
cmdBld_GetCurrentAssociationId(TI_HANDLE hCmdBld,TI_UINT16 * pAidVal)2363 TI_STATUS cmdBld_GetCurrentAssociationId (TI_HANDLE hCmdBld, TI_UINT16 *pAidVal)
2364 {
2365     *pAidVal = DB_WLAN(hCmdBld).Aid;
2366 
2367     return TI_OK;
2368 }
2369 
2370 
2371  /****************************************************************************
2372  *                      cmdBld_GetArpIpAddressesTable()
2373  ****************************************************************************
2374  * DESCRIPTION: Sets the Group table according to the given configuration.
2375  *
2376  * OUTPUT:  None
2377  *
2378  * RETURNS: TI_OK or TI_NOK
2379  ****************************************************************************/
cmdBld_GetArpIpAddressesTable(TI_HANDLE hCmdBld,TIpAddr * pIp,TI_UINT8 * pbEnabled,EIpVer * pIpVer)2380 TI_STATUS cmdBld_GetArpIpAddressesTable (TI_HANDLE hCmdBld, TIpAddr *pIp, TI_UINT8* pbEnabled, EIpVer *pIpVer)
2381 {
2382     *pIpVer = (EIpVer)DB_WLAN(hCmdBld).arp_IP_ver;
2383 
2384     IP_COPY (*pIp, DB_WLAN(hCmdBld).arp_IP_addr);
2385 
2386     *pbEnabled = (TI_UINT8)DB_WLAN(hCmdBld).arpFilterType;
2387 
2388     return TI_OK;
2389 }
2390 
2391 
cmdBld_ConvertAppRatesBitmap(TI_UINT32 uAppRatesBitmap,TI_UINT32 uAppModulation,EHwRateBitFiled * pHwRatesBitmap)2392 TI_STATUS cmdBld_ConvertAppRatesBitmap (TI_UINT32 uAppRatesBitmap, TI_UINT32 uAppModulation, EHwRateBitFiled *pHwRatesBitmap)
2393 {
2394     EHwRateBitFiled uRatesBitmap = 0;
2395 
2396     if (uAppRatesBitmap & DRV_RATE_MASK_1_BARKER)    uRatesBitmap |= HW_BIT_RATE_1MBPS;
2397     if (uAppRatesBitmap & DRV_RATE_MASK_2_BARKER)    uRatesBitmap |= HW_BIT_RATE_2MBPS;
2398     if (uAppRatesBitmap & DRV_RATE_MASK_5_5_CCK)     uRatesBitmap |= HW_BIT_RATE_5_5MBPS;
2399     if (uAppRatesBitmap & DRV_RATE_MASK_11_CCK)      uRatesBitmap |= HW_BIT_RATE_11MBPS;
2400     if (uAppRatesBitmap & DRV_RATE_MASK_22_PBCC)     uRatesBitmap |= HW_BIT_RATE_22MBPS;
2401     if (uAppRatesBitmap & DRV_RATE_MASK_6_OFDM)      uRatesBitmap |= HW_BIT_RATE_6MBPS;
2402     if (uAppRatesBitmap & DRV_RATE_MASK_9_OFDM)      uRatesBitmap |= HW_BIT_RATE_9MBPS;
2403     if (uAppRatesBitmap & DRV_RATE_MASK_12_OFDM)     uRatesBitmap |= HW_BIT_RATE_12MBPS;
2404     if (uAppRatesBitmap & DRV_RATE_MASK_18_OFDM)     uRatesBitmap |= HW_BIT_RATE_18MBPS;
2405     if (uAppRatesBitmap & DRV_RATE_MASK_24_OFDM)     uRatesBitmap |= HW_BIT_RATE_24MBPS;
2406     if (uAppRatesBitmap & DRV_RATE_MASK_36_OFDM)     uRatesBitmap |= HW_BIT_RATE_36MBPS;
2407     if (uAppRatesBitmap & DRV_RATE_MASK_48_OFDM)     uRatesBitmap |= HW_BIT_RATE_48MBPS;
2408     if (uAppRatesBitmap & DRV_RATE_MASK_54_OFDM)     uRatesBitmap |= HW_BIT_RATE_54MBPS;
2409     if (uAppRatesBitmap & DRV_RATE_MASK_MCS_0_OFDM)  uRatesBitmap |= HW_BIT_RATE_MCS_0;
2410     if (uAppRatesBitmap & DRV_RATE_MASK_MCS_1_OFDM)  uRatesBitmap |= HW_BIT_RATE_MCS_1;
2411     if (uAppRatesBitmap & DRV_RATE_MASK_MCS_2_OFDM)  uRatesBitmap |= HW_BIT_RATE_MCS_2;
2412     if (uAppRatesBitmap & DRV_RATE_MASK_MCS_3_OFDM)  uRatesBitmap |= HW_BIT_RATE_MCS_3;
2413     if (uAppRatesBitmap & DRV_RATE_MASK_MCS_4_OFDM)  uRatesBitmap |= HW_BIT_RATE_MCS_4;
2414     if (uAppRatesBitmap & DRV_RATE_MASK_MCS_5_OFDM)  uRatesBitmap |= HW_BIT_RATE_MCS_5;
2415     if (uAppRatesBitmap & DRV_RATE_MASK_MCS_6_OFDM)  uRatesBitmap |= HW_BIT_RATE_MCS_6;
2416     if (uAppRatesBitmap & DRV_RATE_MASK_MCS_7_OFDM)  uRatesBitmap |= HW_BIT_RATE_MCS_7;
2417 
2418     *pHwRatesBitmap = uRatesBitmap;
2419 
2420     return TI_OK;
2421 }
2422 
rateNumberToBitmap(TI_UINT8 uRate)2423 EHwRateBitFiled rateNumberToBitmap(TI_UINT8 uRate)
2424 {
2425 	switch(uRate)
2426 	{
2427 	case 1:   return HW_BIT_RATE_1MBPS;
2428 	case 2:   return HW_BIT_RATE_2MBPS;
2429 	case 5:   return HW_BIT_RATE_5_5MBPS;
2430 	case 6:   return HW_BIT_RATE_6MBPS;
2431 	case 9:   return HW_BIT_RATE_9MBPS;
2432 	case 11:  return HW_BIT_RATE_11MBPS;
2433 	case 12:  return HW_BIT_RATE_12MBPS;
2434 	case 18:  return HW_BIT_RATE_18MBPS;
2435 	case 22:  return HW_BIT_RATE_22MBPS;
2436 	case 24:  return HW_BIT_RATE_24MBPS;
2437 	case 36:  return HW_BIT_RATE_36MBPS;
2438 	case 48:  return HW_BIT_RATE_48MBPS;
2439 	case 54:  return HW_BIT_RATE_54MBPS;
2440 	default:
2441 		return 0;
2442 	}
2443 }
2444 
cmdBld_ConvertAppRate(ERate AppRate,TI_UINT8 * pHwRate)2445 TI_STATUS cmdBld_ConvertAppRate (ERate AppRate, TI_UINT8 *pHwRate)
2446 {
2447     TI_UINT8     Rate = 0;
2448     TI_STATUS status = TI_OK;
2449 
2450     switch (AppRate)
2451     {
2452         /*
2453          *  The handle for 5.5/11/22 PBCC was removed !!!
2454          */
2455 
2456         case DRV_RATE_1M:           Rate = txPolicy1;          break;
2457         case DRV_RATE_2M:           Rate = txPolicy2;          break;
2458         case DRV_RATE_5_5M:         Rate = txPolicy5_5;        break;
2459         case DRV_RATE_11M:          Rate = txPolicy11;         break;
2460         case DRV_RATE_22M:          Rate = txPolicy22;         break;
2461         case DRV_RATE_6M:           Rate = txPolicy6;          break;
2462         case DRV_RATE_9M:           Rate = txPolicy9;          break;
2463         case DRV_RATE_12M:          Rate = txPolicy12;         break;
2464         case DRV_RATE_18M:          Rate = txPolicy18;         break;
2465         case DRV_RATE_24M:          Rate = txPolicy24;         break;
2466         case DRV_RATE_36M:          Rate = txPolicy36;         break;
2467         case DRV_RATE_48M:          Rate = txPolicy48;         break;
2468         case DRV_RATE_54M:          Rate = txPolicy54;         break;
2469         case DRV_RATE_MCS_0:          Rate = txPolicyMcs0;         break;
2470         case DRV_RATE_MCS_1:          Rate = txPolicyMcs1;         break;
2471         case DRV_RATE_MCS_2:          Rate = txPolicyMcs2;         break;
2472         case DRV_RATE_MCS_3:          Rate = txPolicyMcs3;         break;
2473         case DRV_RATE_MCS_4:          Rate = txPolicyMcs4;         break;
2474         case DRV_RATE_MCS_5:          Rate = txPolicyMcs5;         break;
2475         case DRV_RATE_MCS_6:          Rate = txPolicyMcs6;         break;
2476         case DRV_RATE_MCS_7:          Rate = txPolicyMcs7;         break;
2477 
2478         default:
2479             WLAN_OS_REPORT(("%s wrong app rate = %d\n",__FUNCTION__,AppRate));
2480             status = TI_NOK;
2481             break;
2482     }
2483 
2484     if (status == TI_OK)
2485         *pHwRate = Rate;
2486     else
2487         *pHwRate = txPolicy1;
2488 
2489     return status;
2490 }
2491 
2492 
cmdBld_SetRxFilter(TI_HANDLE hCmdBld,TI_UINT32 uRxConfigOption,TI_UINT32 uRxFilterOption)2493 TI_STATUS cmdBld_SetRxFilter (TI_HANDLE hCmdBld, TI_UINT32 uRxConfigOption, TI_UINT32 uRxFilterOption)
2494 {
2495     DB_WLAN(hCmdBld).RxConfigOption = uRxConfigOption;
2496     DB_WLAN(hCmdBld).RxFilterOption = uRxFilterOption;
2497     DB_WLAN(hCmdBld).RxConfigOption |= RX_CFG_ENABLE_PHY_HEADER_PLCP;
2498 
2499     if (DB_WLAN(hCmdBld).RxDisableBroadcast)
2500     {
2501         DB_WLAN(hCmdBld).RxConfigOption |= RX_CFG_DISABLE_BCAST;
2502     }
2503 
2504     return TI_OK;
2505 }
2506 
2507 
cmdBld_GetBssType(TI_HANDLE hCmdBld)2508 TI_UINT8 cmdBld_GetBssType (TI_HANDLE hCmdBld)
2509 {
2510     return DB_BSS(hCmdBld).ReqBssType;
2511 }
2512 
2513 
cmdBld_GetAckPolicy(TI_HANDLE hCmdBld,TI_UINT32 uQueueId)2514 TI_UINT32 cmdBld_GetAckPolicy (TI_HANDLE hCmdBld, TI_UINT32 uQueueId)
2515 {
2516     return (TI_UINT32)DB_QUEUES(hCmdBld).queues[uQueueId].ackPolicy;
2517 }
2518 
2519 
cmdBld_SetSecuritySeqNum(TI_HANDLE hCmdBld,TI_UINT8 securitySeqNumLsByte)2520 TI_STATUS cmdBld_SetSecuritySeqNum (TI_HANDLE hCmdBld, TI_UINT8 securitySeqNumLsByte)
2521 {
2522     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
2523 
2524     /* If 8 lsb wrap around occurred (new < old). */
2525     if ((TI_UINT16)securitySeqNumLsByte < (pCmdBld->uSecuritySeqNumLow & 0xFF))
2526     {
2527         /* Increment the upper byte of the 16 lsb. */
2528         pCmdBld->uSecuritySeqNumLow += 0x100;
2529 
2530         /* If 16 bit wrap around occurred, increment the upper 32 bit. */
2531         if (!(pCmdBld->uSecuritySeqNumLow & 0xFF00))
2532             pCmdBld->uSecuritySeqNumHigh++;
2533     }
2534 
2535     /* Save new sequence number 8 lsb (received from the FW). */
2536     pCmdBld->uSecuritySeqNumLow &= 0xFF00;
2537     pCmdBld->uSecuritySeqNumLow |= (TI_UINT16)securitySeqNumLsByte;
2538 
2539     return TI_OK;
2540 }
2541 
2542 /****************************************************************************
2543  *                      cmdBld_JoinCmpltForReconfigCb()
2544  ****************************************************************************
2545  * DESCRIPTION:   The Join-Complete callback used by the reconfig sequenc (see __cmd_start_join()).
2546  *                It restores the original Join-Complete CB and continues the sequence.
2547  *                It is needed so the reconfig sequence won't progress before the Join
2548  *                    command is completed (otherwise the FW may drop the other commands).
2549  *
2550  * INPUTS: hCmdBld - The module object
2551  *
2552  * OUTPUT:  None
2553  *
2554  * RETURNS: TI_OK
2555  ****************************************************************************/
cmdBld_JoinCmpltForReconfigCb(TI_HANDLE hCmdBld)2556 static TI_STATUS cmdBld_JoinCmpltForReconfigCb (TI_HANDLE hCmdBld)
2557 {
2558     TCmdBld    *pCmdBld = (TCmdBld *)hCmdBld;
2559     void       *fDummyCb;
2560     TI_HANDLE   hDummyHndl;
2561 
2562     /* Restored the original Join-Complete callback function */
2563     eventMbox_ReplaceEvent (pCmdBld->hEventMbox,
2564                               TWD_OWN_EVENT_JOIN_CMPLT,
2565                               pCmdBld->fJoinCmpltOriginalCbFunc,
2566                               pCmdBld->hJoinCmpltOriginalCbHndl,
2567                               &fDummyCb,
2568                               &hDummyHndl);
2569 
2570     /* Call the reconfig sequence to continue the configuration after Join completion */
2571     cmdBld_ConfigSeq (hCmdBld);
2572 
2573     return TI_OK;
2574 }
2575 
2576 
2577 
cmdBld_DummyCb(TI_HANDLE hCmdBld)2578 static TI_STATUS cmdBld_DummyCb (TI_HANDLE hCmdBld)
2579 {
2580     return TI_OK;
2581 }
2582 
2583 
2584 
2585 
2586 
2587 #ifdef TI_DBG
2588 
cmdBld_DbgForceTemplatesRates(TI_HANDLE hCmdBld,TI_UINT32 uRateMask)2589 void cmdBld_DbgForceTemplatesRates (TI_HANDLE hCmdBld, TI_UINT32 uRateMask)
2590 {
2591     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
2592 
2593     pCmdBld->uDbgTemplatesRateMask = uRateMask;
2594 }
2595 
2596 #endif /* TI_DBG */
2597 
2598