• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * CmdBldCmdIE.c
3  *
4  * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  *  * Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  *  * Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in
15  *    the documentation and/or other materials provided with the
16  *    distribution.
17  *  * Neither the name Texas Instruments nor the names of its
18  *    contributors may be used to endorse or promote products derived
19  *    from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  */
33 
34 
35 /** \file  CmdBldCmdIE.c
36  *  \brief Command builder. Command information elements
37  *
38  *  \see   CmdBldCmdIE.h
39  */
40 #define __FILE_ID__  FILE_ID_94
41 #include "osApi.h"
42 #include "tidef.h"
43 #include "report.h"
44 #include "TWDriver.h"
45 #include "CmdQueue_api.h"
46 #include "CmdBld.h"
47 
48 
49 /* Local Macros */
50 
51 #define MAC_TO_VENDOR_PREAMBLE(mac) ((mac[0] << 16) | (mac[1] << 8) | mac[2])
52 
53 /*******************************************
54  * Wlan hardware Test (BIT)
55  * =================
56  *
57  * Tests description:
58  * ==================
59  * FCC           = Continuous modulated transmission (should not emit carrier)
60  * TELEC         = Continuous unmodulated carrier transmission (carrier only)
61  * PER_TX_STOP   = Stops the TX test in progress (FCC or TELEC).
62  * ReadRegister  = Read a register value.
63  * WriteRegister = Sets a register value.
64 *
65 * Rx PER test
66 * ========
67 * PerRxStart       = Start or resume the PER measurement. This function will put the device in promiscuous mode, and resume counters update.
68 * PerRxStop        = Stop Rx PER measurements. This function stop counters update and make it is safe to read the PER test result.
69 * PerRxGetResults  = Get the last Rx PER test results.
70 * PerRxClear       = Clear the Rx PER test results.
71  */
72 
73 enum
74 {
75 /* 0 */   TEST_MOD_QPSK,
76 /* 1 */   TEST_MOD_CCK,
77 /* 2 */   TEST_MOD_PBCC,
78           TEST_MOD_NUMOF
79 };
80 
81 enum
82 {
83 /* 0 */   TEST_MOD_LONG_PREAMBLE,
84 /* 1 */   TEST_MOD_SHORT_PREAMBLE
85 };
86 
87 enum
88 {
89 /* 0 */   TEST_BAND_2_4GHZ,
90 /* 1 */   TEST_BAND_5GHZ,
91 /* 2 */   TEST_BAND_4_9GHZ
92 };
93 
94 
95 enum
96 {
97     MOD_PBCC = 1,
98     MOD_CCK,
99     MOD_OFDM
100 };
101 
102 
103 #define TEST_MOD_MIN_GAP           200
104 #define TEST_MOD_MIN_TX_BODYLEN    0
105 #define TEST_MOD_MAX_TX_BODYLEN    2304
106 
107 #define TEST_RX_CAL_SAFE_TIME      5000  /*uSec*/
108 
109 #define TEST_MOD_IS_GAP_OK(gap)     ((gap) >= TEST_MOD_MIN_GAP)
110 
111 #define TEST_MOD_IS_TX_BODYLEN_OK(len)  \
112    (INRANGE((len), TEST_MOD_MIN_TX_BODYLEN, TEST_MOD_MAX_TX_BODYLEN) && \
113    (((len) & 3) == 0) )
114 
115 #define TEST_MOD_IS_PREAMBLE_OK(p)  \
116    INRANGE((p), TEST_MOD_LONG_PREAMBLE, TEST_MOD_SHORT_PREAMBLE)
117 
118 
119 #define RESEARVED_SIZE_FOR_RESPONSE 4
120 
121 
122 /****************************************************************************
123  *                      cmdBld_CmdIeStartBss()
124  ****************************************************************************
125  * DESCRIPTION: Construct the StartBss command fileds and send it to the mailbox
126  *
127  * INPUTS: None
128  *
129  * OUTPUT:  None
130  *
131  * RETURNS: TI_OK or TI_NOK
132  ****************************************************************************/
cmdBld_CmdIeStartBss(TI_HANDLE hCmdBld,BSS_e BssType,void * fJoinCompleteCb,TI_HANDLE hCb)133 TI_STATUS cmdBld_CmdIeStartBss (TI_HANDLE hCmdBld, BSS_e BssType, void *fJoinCompleteCb, TI_HANDLE hCb)
134 {
135     TCmdBld            *pCmdBld = (TCmdBld *)hCmdBld;
136     StartJoinRequest_t  AcxCmd_StartBss;
137     StartJoinRequest_t *pCmd = &AcxCmd_StartBss;
138     TSsid              *pSsid = &DB_BSS(hCmdBld).tSsid;
139     TBssInfoParams     *pBssInfoParams = &DB_BSS(hCmdBld);
140     TI_UINT8 *BssId;
141     TI_UINT8 *cmdBssId;
142     EHwRateBitFiled HwBasicRatesBitmap;
143     TI_UINT32 i;
144 
145     os_memoryZero (pCmdBld->hOs, (void *)pCmd, sizeof(StartJoinRequest_t));
146 
147     /*
148      * Set RxCfg and RxFilterCfg values
149      */
150     pCmd->rxFilter.ConfigOptions = ENDIAN_HANDLE_LONG (DB_WLAN(hCmdBld).RxConfigOption);
151     pCmd->rxFilter.FilterOptions = ENDIAN_HANDLE_LONG (DB_WLAN(hCmdBld).RxFilterOption);
152     pCmd->beaconInterval = ENDIAN_HANDLE_WORD (DB_BSS(hCmdBld).BeaconInterval);
153     pCmd->dtimInterval = DB_BSS(hCmdBld).DtimInterval;
154     pCmd->channelNumber = DB_BSS(hCmdBld).RadioChannel;
155     pCmd->bssType = BssType;
156     /* Add radio band */
157     pCmd->bssType |= DB_WLAN(hCmdBld).RadioBand << 4;
158     /* Bits 0-2: Tx-Session-Count. bit 7: indicates if to flush the Tx queues */
159     pCmd->ctrl = pBssInfoParams->Ctrl;
160 
161     /*
162      * BasicRateSet
163      * The wlan hardware uses pHwMboxCmd field to determine the rate at which to transmit
164      * control frame responses (such as ACK or CTS frames)
165      */
166     cmdBld_ConvertAppRatesBitmap (pBssInfoParams->BasicRateSet, 0, &HwBasicRatesBitmap);
167     pCmd->basicRateSet = ENDIAN_HANDLE_LONG(HwBasicRatesBitmap);
168 
169     /* BSS ID - reversed order (see wlan hardware spec) */
170     BssId = DB_BSS(hCmdBld).BssId;
171     cmdBssId = (TI_UINT8*)&pCmd->bssIdL;
172     for (i = 0; i < MAC_ADDR_LEN; i++)
173         cmdBssId[i] = BssId[MAC_ADDR_LEN - 1 - i];
174 
175     /* SSID string */
176     pCmd->ssidLength = pSsid->len;
177     os_memoryCopy (pCmdBld->hOs, (void *)pCmd->ssidStr, (void *)pSsid->str, pSsid->len);
178 
179     return cmdQueue_SendCommand (pCmdBld->hCmdQueue,
180                              CMD_START_JOIN,
181                              (TI_CHAR *)pCmd,
182                              sizeof(*pCmd),
183                              fJoinCompleteCb,
184                              hCb,
185                              NULL);
186 }
187 
188 
189 /****************************************************************************
190  *                      cmdBld_CmdIeEnableRx()
191  ****************************************************************************
192  * DESCRIPTION: Construct the EnableRx command fileds and send it to the mailbox
193  *
194  * INPUTS: None
195  *
196  * OUTPUT:  None
197  *
198  * RETURNS: TI_OK or TI_NOK
199  ****************************************************************************/
cmdBld_CmdIeEnableRx(TI_HANDLE hCmdBld,void * fCb,TI_HANDLE hCb)200 TI_STATUS cmdBld_CmdIeEnableRx (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb)
201 {
202     TCmdBld  *pCmdBld = (TCmdBld *)hCmdBld;
203     TI_UINT8  uChannelNumber;
204 
205     uChannelNumber = DB_DEFAULT_CHANNEL (hCmdBld);
206 
207     return cmdQueue_SendCommand (pCmdBld->hCmdQueue,
208                              CMD_ENABLE_RX,
209                              (TI_CHAR *)&uChannelNumber,
210                              sizeof(TI_UINT8),
211                              fCb,
212                              hCb,
213                              NULL);
214 }
215 
216 
217 /****************************************************************************
218  *                      cmdBld_CmdIeEnableTx()
219  ****************************************************************************
220  * DESCRIPTION: Construct the EnableTx command fileds and send it to the mailbox
221  *              Note: This Enable_TX command is used also for changing the serving
222  *              channel.
223  *
224  * INPUTS: None
225  *
226  * OUTPUT:  None
227  *
228  * RETURNS: TI_OK or TI_NOK
229  ****************************************************************************/
cmdBld_CmdIeEnableTx(TI_HANDLE hCmdBld,TI_UINT8 channel,void * fCb,TI_HANDLE hCb)230 TI_STATUS cmdBld_CmdIeEnableTx (TI_HANDLE hCmdBld, TI_UINT8 channel, void *fCb, TI_HANDLE hCb)
231 {
232     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
233 
234     return cmdQueue_SendCommand (pCmdBld->hCmdQueue,
235                              CMD_ENABLE_TX,
236                              (TI_CHAR *)&channel,
237                              sizeof(TI_UINT8),
238                              fCb,
239                              hCb,
240                              NULL);
241 }
242 
243 
244 /****************************************************************************
245  *                      cmdBld_CmdIeDisableRx()
246  ****************************************************************************
247  * DESCRIPTION: Construct the DisableRx command fileds and send it to the mailbox
248  *
249  * INPUTS: None
250  *
251  * OUTPUT:  None
252  *
253  * RETURNS: TI_OK or TI_NOK
254  ****************************************************************************/
cmdBld_CmdIeDisableRx(TI_HANDLE hCmdBld,void * fCb,TI_HANDLE hCb)255 TI_STATUS cmdBld_CmdIeDisableRx (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb)
256 {
257     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
258 
259     return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_DISABLE_RX, NULL, 0, fCb, hCb, NULL);
260 }
261 
262 /****************************************************************************
263  *                      cmdBld_CmdIeDisableTx()
264  ****************************************************************************
265  * DESCRIPTION: Construct the DisableTx command fileds and send it to the mailbox
266  *
267  * INPUTS: None
268  *
269  * OUTPUT:  None
270  *
271  * RETURNS: TI_OK or TI_NOK
272  ****************************************************************************/
cmdBld_CmdIeDisableTx(TI_HANDLE hCmdBld,void * fCb,TI_HANDLE hCb)273 TI_STATUS cmdBld_CmdIeDisableTx (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb)
274 {
275     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
276 
277     return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_DISABLE_TX, NULL, 0, fCb, hCb, NULL);
278 }
279 
280 /****************************************************************************
281  *                      cmdBld_CmdIeConfigureTemplateFrame()
282  ****************************************************************************
283  * DESCRIPTION: Generic function which sets the Fw with a template frame according
284  *              to the given template type.
285  *
286  * INPUTS: templateType - CMD_BEACON, CMD_PROBE_REQ, CMD_PROBE_RESP etc.
287  *
288  * OUTPUT:  None
289  *
290  * RETURNS: TI_OK or TI_NOK
291  ****************************************************************************/
cmdBld_CmdIeConfigureTemplateFrame(TI_HANDLE hCmdBld,TTemplateParams * pTemplate,TI_UINT16 uFrameSize,TemplateType_e eTemplateType,TI_UINT8 uIndex,void * fCb,TI_HANDLE hCb)292 TI_STATUS cmdBld_CmdIeConfigureTemplateFrame (TI_HANDLE         hCmdBld,
293                                               TTemplateParams  *pTemplate,
294                                               TI_UINT16         uFrameSize,
295                                               TemplateType_e    eTemplateType,
296                                               TI_UINT8          uIndex,
297                                               void *            fCb,
298                                               TI_HANDLE         hCb)
299 {
300     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
301     PktTemplate_t AcxCmd_PktTemplate;
302     PktTemplate_t *pCmd = &AcxCmd_PktTemplate;
303 
304     /* If the frame size is too big - we truncate the frame template */
305     if (uFrameSize > MAX_TEMPLATES_SIZE)
306     {
307         TRACE3(pCmdBld->hReport, REPORT_SEVERITY_ERROR, ": Frame size (=%d) of CmdType (=%d) is bigger than MAX_TEMPLATES_SIZE(=%d) !!!\n", uFrameSize, eTemplateType, MAX_TEMPLATES_SIZE);
308 
309         uFrameSize = MAX_TEMPLATES_SIZE;
310     }
311 
312     /* if pTemplate is NULL than it means that we just want to reserve place in Fw, and there is no need to copy */
313     if (pTemplate != NULL)
314     {
315         os_memoryCopy(pCmdBld->hOs, (void *)&pCmd->templateStart, (void *)(pTemplate->Buffer), uFrameSize);
316         pCmd->templateTxAttribute.enabledRates    = pTemplate->uRateMask;
317     }
318     pCmd->len = ENDIAN_HANDLE_WORD(uFrameSize);
319     pCmd->index = uIndex;
320     pCmd->templateType = eTemplateType;
321     pCmd->templateTxAttribute.shortRetryLimit = 10;
322     pCmd->templateTxAttribute.longRetryLimit  = 10;
323 
324 #ifdef TI_DBG
325     if (pCmdBld->uDbgTemplatesRateMask != 0)
326     {
327         pCmd->templateTxAttribute.enabledRates = pCmdBld->uDbgTemplatesRateMask;
328     }
329 #endif
330 
331     return cmdQueue_SendCommand (pCmdBld->hCmdQueue,
332                              CMD_SET_TEMPLATE,
333                              (TI_CHAR *)pCmd,
334                              sizeof (PktTemplate_t),
335                              fCb,
336                              hCb,
337                              NULL);
338 }
339 
340 
341 /****************************************************************************
342  *                      cmdBld_CmdIeSetKey()
343  ****************************************************************************
344  * DESCRIPTION: Construct the SetKey command fileds and send it to the mailbox
345  *
346  * INPUTS:
347  *      Action      - add/remove key
348  *      MacAddr     - relevant only for mapping keys
349  *      KeySize     - key size
350  *      KeyType     - default/mapping/TKIP
351  *      KeyId       - relevant only for default keys
352  *      Key         - key data
353  *
354  * OUTPUT:  None
355  *
356  * RETURNS: TI_OK or TI_NOK
357  ****************************************************************************/
cmdBld_CmdIeSetKey(TI_HANDLE hCmdBld,TI_UINT32 action,TI_UINT8 * pMacAddr,TI_UINT32 uKeySize,TI_UINT32 uKeyType,TI_UINT32 uKeyId,TI_UINT8 * pKey,TI_UINT32 uSecuritySeqNumLow,TI_UINT32 uSecuritySeqNumHigh,void * fCb,TI_HANDLE hCb)358 TI_STATUS cmdBld_CmdIeSetKey (TI_HANDLE hCmdBld,
359                               TI_UINT32 action,
360                               TI_UINT8  *pMacAddr,
361                               TI_UINT32 uKeySize,
362                               TI_UINT32 uKeyType,
363                               TI_UINT32 uKeyId,
364                               TI_UINT8  *pKey,
365                               TI_UINT32 uSecuritySeqNumLow,
366                               TI_UINT32 uSecuritySeqNumHigh,
367                               void      *fCb,
368                               TI_HANDLE hCb)
369 {
370     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
371     SetKey_t AcxCmd_SetKey;
372     SetKey_t *pCmd = &AcxCmd_SetKey;
373 
374     os_memoryZero (pCmdBld->hOs, (void *)pCmd, sizeof(*pCmd));
375 
376     MAC_COPY (pCmd->addr, pMacAddr);
377 
378     if (uKeySize > MAX_KEY_SIZE)
379     {
380         os_memoryCopy (pCmdBld->hOs, (void *)pCmd->key, (void *)pKey, MAX_KEY_SIZE);
381     }
382     else
383     {
384         os_memoryCopy (pCmdBld->hOs, (void *)pCmd->key, (void *)pKey, uKeySize);
385     }
386 
387     pCmd->action = ENDIAN_HANDLE_WORD((TI_UINT16)action);
388     pCmd->keySize = (TI_UINT8)uKeySize;
389     pCmd->type = (TI_UINT8)uKeyType;
390     pCmd->id = (TI_UINT8)uKeyId;
391     pCmd->ssidProfile = 0;
392 
393     /*
394      * Preserve TKIP/AES security sequence number after recovery.
395      * Note that our STA Tx is currently using only one sequence-counter
396      * for all ACs (unlike the Rx which is separated per AC).
397      */
398     pCmd->AcSeqNum16[0] = ENDIAN_HANDLE_WORD((TI_UINT16)uSecuritySeqNumLow);
399     pCmd->AcSeqNum16[1] = 0;
400     pCmd->AcSeqNum16[2] = 0;
401     pCmd->AcSeqNum16[3] = 0;
402 
403     pCmd->AcSeqNum32[0] = ENDIAN_HANDLE_LONG(uSecuritySeqNumHigh);
404     pCmd->AcSeqNum32[1] = 0;
405     pCmd->AcSeqNum32[2] = 0;
406     pCmd->AcSeqNum32[3] = 0;
407 
408 
409 TRACE6(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "Addr: %02x:%02x:%02x:%02x:%02x:%02x\n", pCmd->addr[0],pCmd->addr[1],pCmd->addr[2],pCmd->addr[3],pCmd->addr[4],pCmd->addr[5]);
410 
411 TRACE7(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "Action=%x,keySize=0x%x,type=%x, id=%x, ssidProfile=%x, AcSeqNum16[0]=%x, AcSeqNum32[0]=%x\n", pCmd->action,pCmd->keySize, pCmd->type,pCmd->id,pCmd->ssidProfile,pCmd->AcSeqNum16[0],pCmd->AcSeqNum32[0] );
412 
413 	return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_SET_KEYS, (char *)pCmd, sizeof(*pCmd), fCb, hCb, NULL);
414 }
415 
416 
417 /****************************************************************************
418  *                      cmdBld_CmdIeStartScan ()
419  ****************************************************************************
420  * DESCRIPTION: Send SCAN Command
421  *
422  * INPUTS: None
423  *
424  * OUTPUT:  None
425  *
426  * RETURNS: TI_OK or TI_NOK
427  ****************************************************************************/
cmdBld_CmdIeStartScan(TI_HANDLE hCmdBld,ScanParameters_t * pScanParams,void * fScanResponseCb,TI_HANDLE hCb)428 TI_STATUS cmdBld_CmdIeStartScan (TI_HANDLE hCmdBld, ScanParameters_t* pScanParams, void *fScanResponseCb, TI_HANDLE hCb)
429 {
430     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
431 
432     return cmdQueue_SendCommand (pCmdBld->hCmdQueue,
433                              CMD_SCAN,
434                              (TI_CHAR *)pScanParams,
435                              sizeof(ScanParameters_t),
436                              fScanResponseCb,
437                              hCb,
438                              NULL);
439 }
440 
441 /****************************************************************************
442  *                      cmdBld_CmdIeStartSPSScan ()
443  ****************************************************************************
444  * DESCRIPTION: Send SPS SCAN Command
445  *
446  * INPUTS: None
447  *
448  * OUTPUT:  None
449  *
450  * RETURNS: TI_OK or TI_NOK
451  ****************************************************************************/
cmdBld_CmdIeStartSPSScan(TI_HANDLE hCmdBld,ScheduledScanParameters_t * pScanParams,void * fScanResponseCb,TI_HANDLE hCb)452 TI_STATUS cmdBld_CmdIeStartSPSScan (TI_HANDLE hCmdBld, ScheduledScanParameters_t* pScanParams, void* fScanResponseCb, TI_HANDLE hCb)
453 {
454     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
455 
456     return cmdQueue_SendCommand (pCmdBld->hCmdQueue,
457                              CMD_SPS_SCAN,
458                              (TI_CHAR *)pScanParams,
459                              sizeof(ScheduledScanParameters_t),
460                              fScanResponseCb,
461                              hCb,
462                              NULL);
463 }
464 
465 
466 /****************************************************************************
467  *                      cmdBld_CmdIeStopScan ()
468  ****************************************************************************
469  * DESCRIPTION: Construct the STOP_SCAN command fields and send it to the
470  *              mailbox
471  *
472  * INPUTS: None
473  *
474  * OUTPUT:  None
475  *
476  * RETURNS: TI_OK or TI_NOK
477  ****************************************************************************/
cmdBld_CmdIeStopScan(TI_HANDLE hCmdBld,void * fScanResponseCb,TI_HANDLE hCb)478 TI_STATUS cmdBld_CmdIeStopScan (TI_HANDLE hCmdBld, void *fScanResponseCb, TI_HANDLE hCb)
479 {
480     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
481 
482     TRACE0(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "cmdBld_CmdIeStopScan: -------------- \n");
483 
484     return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_STOP_SCAN, 0, 0, fScanResponseCb, hCb, NULL);
485 }
486 
487 
488 /****************************************************************************
489  *                      cmdBld_CmdIeStopSPSScan ()
490  ****************************************************************************
491  * DESCRIPTION: Construct the STOP_SPS_SCAN command fields and send it to the
492  *              mailbox
493  *
494  * INPUTS: None
495  *
496  * OUTPUT:  None
497  *
498  * RETURNS: TI_OK or TI_NOK
499  ****************************************************************************/
cmdBld_CmdIeStopSPSScan(TI_HANDLE hCmdBld,void * fScanResponseCB,TI_HANDLE hCb)500 TI_STATUS cmdBld_CmdIeStopSPSScan (TI_HANDLE hCmdBld, void* fScanResponseCB, TI_HANDLE hCb)
501 {
502     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
503 
504     TRACE0(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "cmdBld_CmdIeStopSPSScan: -------------- \n");
505 
506     return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_STOP_SPS_SCAN, 0, 0, fScanResponseCB, hCb, NULL);
507 }
508 
509 
cmdBld_CmdIeSetSplitScanTimeOut(TI_HANDLE hCmdBld,TI_UINT32 uTimeOut,void * fCB,TI_HANDLE hCb)510 TI_STATUS cmdBld_CmdIeSetSplitScanTimeOut (TI_HANDLE hCmdBld, TI_UINT32 uTimeOut, void *fCB, TI_HANDLE hCb)
511 {
512 	TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
513 	enhancedTriggerTO_t Cmd_enhancedTrigger;
514 	enhancedTriggerTO_t *pCmd = &Cmd_enhancedTrigger;
515 
516 TRACE1(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "cmdBld_CmdIeSetSplitScanTimeOut: uTimeOut=%d -------------- \n", uTimeOut);
517 
518 	pCmd->slicedScanTimeOut = uTimeOut;
519 
520 	return cmdQueue_SendCommand(pCmdBld->hCmdQueue, CMD_TRIGGER_SCAN_TO, (char *)pCmd, sizeof(*pCmd), fCB, hCb, NULL);
521 }
522 
523 /**
524  * \fn     cmdBld_CmdIeScanSsidList
525  * \brief  Sets SSID list for periodic scan
526  *
527  * Sets SSID list for periodic scan
528  *
529  * \param  hCmdBld - handle to command builder object
530  * \param  pSsidList - command data
531  * \param  fScanResponseCB - command complete function callback
532  * \param  hCb - command complete callback handle
533  * \return TI_OK on success, any other code on error
534  * \sa     cmdBld_CmdIePeriodicScanParams, cmdBld_CmdIeStartPeriodicScan, cmdBld_CmdIeStopPeriodicScan
535  */
cmdBld_CmdIeScanSsidList(TI_HANDLE hCmdBld,ConnScanSSIDList_t * pSsidList,void * fScanResponseCB,TI_HANDLE hCb)536 TI_STATUS cmdBld_CmdIeScanSsidList (TI_HANDLE hCmdBld, ConnScanSSIDList_t *pSsidList,
537                                     void* fScanResponseCB, TI_HANDLE hCb)
538 {
539     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
540 
541     return cmdQueue_SendCommand (pCmdBld->hCmdQueue,
542                              CMD_CONNECTION_SCAN_SSID_CFG,
543                              (char *)pSsidList,
544                              sizeof(ConnScanSSIDList_t),
545                              fScanResponseCB,
546                              hCb,
547                              NULL);
548 }
549 
550 /**
551  * \fn     cmdBld_CmdIePeriodicScanParams
552  * \brief  Sets periodic scan parameters
553  *
554  * Sets periodic scan parameters
555  *
556  * \param  hCmdBld - handle to command builder object
557  * \param  pPeriodicScanParams - command data
558  * \param  fScanResponseCB - command complete function callback
559  * \param  hCb - command complete callback handle
560  * \return TI_OK on success, any other code on error
561  * \sa     cmdBld_CmdIeScanSsidList, cmdBld_CmdIeStartPeriodicScan, cmdBld_CmdIeStopPeriodicScan
562  */
cmdBld_CmdIePeriodicScanParams(TI_HANDLE hCmdBld,ConnScanParameters_t * pPeriodicScanParams,void * fScanResponseCB,TI_HANDLE hCb)563 TI_STATUS cmdBld_CmdIePeriodicScanParams (TI_HANDLE hCmdBld, ConnScanParameters_t *pPeriodicScanParams,
564                                           void* fScanResponseCB, TI_HANDLE hCb)
565 {
566     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
567 
568     return cmdQueue_SendCommand (pCmdBld->hCmdQueue,
569                              CMD_CONNECTION_SCAN_CFG,
570                              (char *)pPeriodicScanParams,
571                              sizeof(ConnScanParameters_t),
572                              fScanResponseCB,
573                              hCb,
574                              NULL);
575 }
576 
577 /**
578  * \fn     cmdBld_CmdIeStartPeriodicScan
579  * \brief  Starts a periodic scan operation
580  *
581  * Starts a periodic scan operation
582  *
583  * \param  hCmdBld - handle to command builder object
584  * \param  pPeriodicScanStart - command data
585  * \param  fScanResponseCB - command complete function callback
586  * \param  hCb - command complete callback handle
587  * \return TI_OK on success, any other code on error
588  * \sa     cmdBld_CmdIeScanSsidList,  cmdBld_CmdIePeriodicScanParams, cmdBld_CmdIeStopPeriodicScan
589  */
cmdBld_CmdIeStartPeriodicScan(TI_HANDLE hCmdBld,PeriodicScanTag * pPeriodicScanStart,void * fScanResponseCB,TI_HANDLE hCb)590 TI_STATUS cmdBld_CmdIeStartPeriodicScan (TI_HANDLE hCmdBld, PeriodicScanTag* pPeriodicScanStart,
591                                          void* fScanResponseCB, TI_HANDLE hCb)
592 {
593     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
594 
595     return cmdQueue_SendCommand (pCmdBld->hCmdQueue,
596                              CMD_START_PERIODIC_SCAN,
597                              pPeriodicScanStart, sizeof (PeriodicScanTag),
598                              fScanResponseCB,
599                              hCb,
600                              NULL);
601 }
602 
603 /**
604  * \fn     cmdBld_CmdIeStopPeriodicScan
605  * \brief  Stops an on-going periodic scan operation
606  *
607  * Stops an on-going periodic scan operation
608  *
609  * \param  hCmdBld - handle to command builder object
610  * \param  fScanResponseCB - command complete function callback
611  * \param  hCb - command complete callback handle
612  * \return TI_OK on success, any other code on error
613  * \sa     cmdBld_CmdIeScanSsidList, cmdBld_CmdIePeriodicScanParams, cmdBld_CmdIeStartPeriodicScan
614  */
cmdBld_CmdIeStopPeriodicScan(TI_HANDLE hCmdBld,PeriodicScanTag * pPeriodicScanStop,void * fScanResponseCB,TI_HANDLE hCb)615 TI_STATUS cmdBld_CmdIeStopPeriodicScan (TI_HANDLE hCmdBld,
616                                         PeriodicScanTag* pPeriodicScanStop,
617                                         void* fScanResponseCB,
618                                         TI_HANDLE hCb)
619 {
620     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
621 
622     return cmdQueue_SendCommand (pCmdBld->hCmdQueue,
623                              CMD_STOP_PERIODIC_SCAN,
624                              pPeriodicScanStop,
625                              sizeof(pPeriodicScanStop),
626                              fScanResponseCB,
627                              hCb,
628                              NULL);
629 }
630 
631 /****************************************************************************
632  *                      cmdBld_CmdIeNoiseHistogram ()
633  ****************************************************************************
634  * DESCRIPTION: Send NOISE_HISTOGRAM Command
635  *
636  * INPUTS: None
637  *
638  * OUTPUT:  None
639  *
640  * RETURNS: TI_OK or TI_NOK
641  ****************************************************************************/
cmdBld_CmdIeNoiseHistogram(TI_HANDLE hCmdBld,TNoiseHistogram * pNoiseHistParams,void * fCb,TI_HANDLE hCb)642 TI_STATUS cmdBld_CmdIeNoiseHistogram (TI_HANDLE hCmdBld, TNoiseHistogram *pNoiseHistParams, void *fCb, TI_HANDLE hCb)
643 {
644     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
645     NoiseHistRequest_t AcxCmd_NoiseHistogram;
646     NoiseHistRequest_t *pCmd = &AcxCmd_NoiseHistogram;
647 
648     os_memoryZero(pCmdBld->hOs, (void *)pCmd, sizeof(*pCmd));
649 
650     pCmd->mode = ENDIAN_HANDLE_WORD((TI_UINT16)pNoiseHistParams->cmd);
651     pCmd->sampleIntervalUSec = ENDIAN_HANDLE_WORD(pNoiseHistParams->sampleInterval);
652 
653     os_memoryCopy (pCmdBld->hOs, (void *)&(pCmd->thresholds[0]), (void *)&(pNoiseHistParams->ranges[0]), MEASUREMENT_NOISE_HISTOGRAM_NUM_OF_RANGES);
654 
655     return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_NOISE_HIST, (TI_CHAR *)pCmd, sizeof(*pCmd), fCb, hCb, NULL);
656 }
657 
658 
659 /****************************************************************************
660  *                      cmdBld_CmdIeSetPsMode()
661  ****************************************************************************
662  * DESCRIPTION: send Command for Power Management configuration
663  *              to the mailbox
664  *
665  * INPUTS: None
666  *
667  * OUTPUT:  None
668  *
669  * RETURNS: TI_OK or TI_NOK
670  ****************************************************************************/
cmdBld_CmdIeSetPsMode(TI_HANDLE hCmdBld,TPowerSaveParams * powerSaveParams,void * fCb,TI_HANDLE hCb)671 TI_STATUS cmdBld_CmdIeSetPsMode (TI_HANDLE hCmdBld, TPowerSaveParams* powerSaveParams, void *fCb, TI_HANDLE hCb)
672 {
673     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
674     PSModeParameters_t   Cmd_PowerMgmtCnf;
675     PSModeParameters_t * pCmd = &Cmd_PowerMgmtCnf;
676 
677     os_memoryZero(pCmdBld->hOs, (void *)pCmd, sizeof(*pCmd));
678 
679     if (powerSaveParams->ps802_11Enable)
680     {
681         pCmd->mode = 1;
682     }
683     else
684     {
685         pCmd->mode = 0;
686     }
687 
688     pCmd->hangOverPeriod            = powerSaveParams->hangOverPeriod;
689     pCmd->needToSendNullData        = powerSaveParams->needToSendNullData;
690     pCmd->rateToTransmitNullData    = ENDIAN_HANDLE_LONG(powerSaveParams->NullPktRateModulation);
691     pCmd->numberOfRetries           = powerSaveParams->numNullPktRetries;
692 
693   	return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_SET_PS_MODE, (TI_CHAR *)pCmd, sizeof(*pCmd), fCb, hCb, NULL);
694 }
695 
696 
697 /****************************************************************************
698  *                      cmdBld_CmdIeSwitchChannel ()
699  ****************************************************************************
700  * DESCRIPTION: Send CMD_SWITCH_CHANNEL Command
701  *
702  * INPUTS: None
703  *
704  * OUTPUT:  None
705  *
706  * RETURNS: TI_OK or TI_NOK
707  ****************************************************************************/
cmdBld_CmdIeSwitchChannel(TI_HANDLE hCmdBld,TSwitchChannelParams * pSwitchChannelCmd,void * fCb,TI_HANDLE hCb)708 TI_STATUS cmdBld_CmdIeSwitchChannel (TI_HANDLE hCmdBld, TSwitchChannelParams *pSwitchChannelCmd, void *fCb, TI_HANDLE hCb)
709 {
710     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
711     ChannelSwitchParameters_t AcxCmd_SwitchChannel;
712     ChannelSwitchParameters_t *pCmd = &AcxCmd_SwitchChannel;
713 
714     os_memoryZero (pCmdBld->hOs, (void *)pCmd, sizeof(*pCmd));
715 
716     pCmd->channel = pSwitchChannelCmd->channelNumber;
717     pCmd->switchTime = pSwitchChannelCmd->switchTime;
718     pCmd->txSuspend = pSwitchChannelCmd->txFlag;
719     pCmd->flush = pSwitchChannelCmd->flush;
720 
721     return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CHANNEL_SWITCH, (TI_CHAR *)pCmd, sizeof(*pCmd), fCb, hCb, NULL);
722 }
723 
724 
725 /****************************************************************************
726  *                      cmdBld_CmdIeSwitchChannelCancel ()
727  ****************************************************************************
728  * DESCRIPTION: Send CMD_SWITCH_CHANNEL_CANCEL Command
729  *
730  * INPUTS: None
731  *
732  * OUTPUT:  None
733  *
734  * RETURNS: TI_OK or TI_NOK
735  ****************************************************************************/
cmdBld_CmdIeSwitchChannelCancel(TI_HANDLE hCmdBld,void * fCb,TI_HANDLE hCb)736 TI_STATUS cmdBld_CmdIeSwitchChannelCancel (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb)
737 {
738     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
739 
740     return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_STOP_CHANNEL_SWICTH, 0, 0, fCb, hCb, NULL);
741 }
742 
743 
744 /****************************************************************************
745  *                      cmdBld_CmdIeFwDisconnect()
746  ****************************************************************************
747  * DESCRIPTION: Construct the Disconnect command fileds and send it to the mailbox
748  *
749  * INPUTS: None
750  *
751  * OUTPUT:  None
752  *
753  * RETURNS: TI_OK or TI_NOK
754  ****************************************************************************/
cmdBld_CmdIeFwDisconnect(TI_HANDLE hCmdBld,TI_UINT32 uConfigOptions,TI_UINT32 uFilterOptions,DisconnectType_e uDisconType,TI_UINT16 uDisconReason,void * fCb,TI_HANDLE hCb)755 TI_STATUS cmdBld_CmdIeFwDisconnect (TI_HANDLE hCmdBld, TI_UINT32 uConfigOptions, TI_UINT32 uFilterOptions, DisconnectType_e uDisconType, TI_UINT16 uDisconReason, void *fCb, TI_HANDLE hCb)
756 {
757     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
758     DisconnectParameters_t AcxCmd_Disconnect;
759 
760     AcxCmd_Disconnect.rxFilter.ConfigOptions = ENDIAN_HANDLE_LONG(uConfigOptions);
761     AcxCmd_Disconnect.rxFilter.FilterOptions = ENDIAN_HANDLE_LONG(uFilterOptions);
762     AcxCmd_Disconnect.disconnectReason = ENDIAN_HANDLE_LONG(uDisconReason);
763     AcxCmd_Disconnect.disconnectType = uDisconType;
764 
765     return cmdQueue_SendCommand (pCmdBld->hCmdQueue,
766                              CMD_DISCONNECT,
767                              (void *)&AcxCmd_Disconnect,
768                              sizeof(AcxCmd_Disconnect),
769                              fCb,
770                              hCb,
771                              NULL);
772 }
773 
774 
775 /****************************************************************************
776  *                      cmdBld_CmdIeMeasurement()
777  ****************************************************************************
778  * DESCRIPTION: send Command for measurement configuration
779  *              to the mailbox
780  *
781  * INPUTS: None
782  *
783  * OUTPUT:  None
784  *
785  * RETURNS: TI_OK or TI_NOK
786  ****************************************************************************/
cmdBld_CmdIeMeasurement(TI_HANDLE hCmdBld,TMeasurementParams * pMeasurementParams,void * fMeasureResponseCb,TI_HANDLE hCb)787 TI_STATUS cmdBld_CmdIeMeasurement (TI_HANDLE          hCmdBld,
788                                    TMeasurementParams *pMeasurementParams,
789                                    void               *fMeasureResponseCb,
790                                    TI_HANDLE          hCb)
791 {
792     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
793     MeasurementParameters_t Cmd_MeasurementParam;
794     MeasurementParameters_t *pCmd = &Cmd_MeasurementParam;
795 
796     os_memoryZero (pCmdBld->hOs, (void *)pCmd, sizeof(*pCmd));
797 
798     pCmd->band =                    pMeasurementParams->band;
799     pCmd->channel =                 pMeasurementParams->channel;
800     pCmd->duration =                ENDIAN_HANDLE_LONG(pMeasurementParams->duration);
801     pCmd->rxFilter.ConfigOptions =  ENDIAN_HANDLE_LONG(pMeasurementParams->ConfigOptions);
802     pCmd->rxFilter.FilterOptions =  ENDIAN_HANDLE_LONG(pMeasurementParams->FilterOptions);
803     pCmd->scanTag =                 (TI_UINT8)pMeasurementParams->eTag;
804 
805     return cmdQueue_SendCommand (pCmdBld->hCmdQueue,
806                              CMD_MEASUREMENT,
807                              (TI_CHAR *)pCmd,
808                              sizeof(*pCmd),
809                              fMeasureResponseCb,
810                              hCb,
811                              NULL);
812 }
813 
814 
815 /****************************************************************************
816  *                      cmdBld_CmdIeMeasurementStop()
817  ****************************************************************************
818  * DESCRIPTION: send Command for stoping measurement
819  *
820  * INPUTS: None
821  *
822  * OUTPUT:  None
823  *
824  * RETURNS: TI_OK or TI_NOK
825  ****************************************************************************/
cmdBld_CmdIeMeasurementStop(TI_HANDLE hCmdBld,void * fMeasureResponseCb,TI_HANDLE hCb)826 TI_STATUS cmdBld_CmdIeMeasurementStop (TI_HANDLE hCmdBld, void* fMeasureResponseCb, TI_HANDLE hCb)
827 {
828     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
829 
830     return cmdQueue_SendCommand (pCmdBld->hCmdQueue,
831                              CMD_STOP_MEASUREMENT,
832                              0,
833                              0,
834                              fMeasureResponseCb,
835                              hCb,
836                              NULL);
837 }
838 
839 
840 /****************************************************************************
841  *                      cmdBld_CmdIeApDiscovery()
842  ****************************************************************************
843  * DESCRIPTION: send Command for AP Discovery
844  *              to the mailbox
845  *
846  * INPUTS: None
847  *
848  * OUTPUT:  None
849  *
850  * RETURNS: TI_OK or TI_NOK
851  ****************************************************************************/
cmdBld_CmdIeApDiscovery(TI_HANDLE hCmdBld,TApDiscoveryParams * pApDiscoveryParams,void * fCb,TI_HANDLE hCb)852 TI_STATUS cmdBld_CmdIeApDiscovery (TI_HANDLE hCmdBld, TApDiscoveryParams *pApDiscoveryParams, void *fCb, TI_HANDLE hCb)
853 {
854     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
855     ApDiscoveryParameters_t Cmd_ApDiscovery;
856     ApDiscoveryParameters_t *pCmd = &Cmd_ApDiscovery;
857 
858     os_memoryZero (pCmdBld->hOs, (void *)pCmd, sizeof(*pCmd));
859 
860     pCmd->txPowerAttenuation = pApDiscoveryParams->txPowerDbm;
861     pCmd->numOfProbRqst = pApDiscoveryParams->numOfProbRqst;
862     pCmd->scanDuration  =  ENDIAN_HANDLE_LONG(pApDiscoveryParams->scanDuration);
863     pCmd->scanOptions   =  ENDIAN_HANDLE_WORD(pApDiscoveryParams->scanOptions);
864     pCmd->txdRateSet    =  ENDIAN_HANDLE_LONG(pApDiscoveryParams->txdRateSet);
865     pCmd->rxFilter.ConfigOptions =  ENDIAN_HANDLE_LONG(pApDiscoveryParams->ConfigOptions);
866     pCmd->rxFilter.FilterOptions =  ENDIAN_HANDLE_LONG(pApDiscoveryParams->FilterOptions);
867 
868 	return cmdQueue_SendCommand (pCmdBld->hCmdQueue,
869                              CMD_AP_DISCOVERY,
870                              (void *)pCmd,
871                              sizeof(*pCmd),
872                              fCb,
873                              hCb,
874                              NULL);
875 }
876 
877 
878 /****************************************************************************
879  *                      cmdBld_CmdIeApDiscoveryStop()
880  ****************************************************************************
881  * DESCRIPTION: send Command for stoping AP Discovery
882  *
883  * INPUTS: None
884  *
885  * OUTPUT:  None
886  *
887  * RETURNS: TI_OK or TI_NOK
888  ****************************************************************************/
cmdBld_CmdIeApDiscoveryStop(TI_HANDLE hCmdBld,void * fCb,TI_HANDLE hCb)889 TI_STATUS cmdBld_CmdIeApDiscoveryStop (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb)
890 {
891     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
892 
893     return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_STOP_AP_DISCOVERY, 0, 0, fCb, hCb, NULL);
894 }
895 
896 
897 /****************************************************************************
898  *                      cmdBld_CmdIeHealthCheck()
899  ****************************************************************************
900  * DESCRIPTION:
901  *
902  * INPUTS:
903  *
904  * OUTPUT:
905  *
906  * RETURNS:
907  ****************************************************************************/
cmdBld_CmdIeHealthCheck(TI_HANDLE hCmdBld,void * fCb,TI_HANDLE hCb)908 TI_STATUS cmdBld_CmdIeHealthCheck (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb)
909 {
910     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
911 
912     return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_HEALTH_CHECK, NULL, 0, fCb, hCb, NULL);
913 }
914 
915 /****************************************************************************
916  *                      cmdBld_CmdIeSetStaState()
917  ****************************************************************************
918  * DESCRIPTION: Construct the Disconnect command fileds and send it to the mailbox
919  *
920  * INPUTS: None
921  *
922  * OUTPUT:  None
923  *
924  * RETURNS: TI_OK or TI_NOK
925  ****************************************************************************/
cmdBld_CmdIeSetStaState(TI_HANDLE hCmdBld,TI_UINT8 staState,void * fCb,TI_HANDLE hCb)926 TI_STATUS cmdBld_CmdIeSetStaState (TI_HANDLE hCmdBld, TI_UINT8 staState, void *fCb, TI_HANDLE hCb)
927 {
928     TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
929     SetStaState_t AcxCmd_SetStaState;
930 
931     AcxCmd_SetStaState.staState = staState;
932 
933     return cmdQueue_SendCommand (pCmdBld->hCmdQueue,
934                              CMD_SET_STA_STATE,
935                              (void *)&AcxCmd_SetStaState,
936                              sizeof(AcxCmd_SetStaState),
937                              fCb,
938                              hCb,
939                              NULL);
940 }
941 
942 /****************************************************************************
943  *                      cmdBld_BitIeTestCmd()
944  ****************************************************************************
945  * DESCRIPTION:
946  * INPUTS: None
947  *
948  * OUTPUT:  None
949  *
950  * RETURNS: TI_OK or TI_NOK
951  ****************************************************************************/
cmdBld_CmdIeTest(TI_HANDLE hCmdBld,void * fCb,TI_HANDLE hCb,TTestCmd * pTestCmd)952 TI_STATUS cmdBld_CmdIeTest (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb, TTestCmd* pTestCmd)
953 {
954     TCmdBld		 *pCmdBld = (TI_HANDLE)hCmdBld;
955     TI_UINT32	 paramLength;
956     TI_BOOL      bIsCBfuncNecessary = TI_TRUE;
957 
958     if (NULL == pTestCmd)
959     {
960          TRACE0(pCmdBld->hReport, REPORT_SEVERITY_ERROR, " pTestCmd_Buf = NULL!!!\n");
961 		 return TI_NOK;
962     }
963 
964 	if ( (TestCmdID_enum)pTestCmd->testCmdId < MAX_TEST_CMD_ID )
965 	{
966         bIsCBfuncNecessary = TI_TRUE;
967 	}
968 	else
969 	{
970         TRACE1(pCmdBld->hReport, REPORT_SEVERITY_WARNING, " Unsupported testCmdId (%d)\n", pTestCmd->testCmdId);
971 	}
972 
973     if (bIsCBfuncNecessary && fCb == NULL)
974     {
975         return TI_OK;
976     }
977 
978 	switch( pTestCmd->testCmdId )
979 	{
980 		case TEST_CMD_PD_BUFFER_CAL:
981 			paramLength = sizeof(TTestCmdPdBufferCal);
982 			break;
983 
984 		case TEST_CMD_P2G_CAL:
985 			paramLength = sizeof(TTestCmdP2GCal);
986 			break;
987 
988 		case TEST_CMD_RX_STAT_GET:
989 			paramLength = sizeof(RadioRxStatistics);
990 			break;
991 
992 		/* packet */
993 		case TEST_CMD_FCC:
994 			paramLength = sizeof(TPacketParam);
995 			break;
996 
997 		/* tone */
998 		case TEST_CMD_TELEC:
999 			paramLength = sizeof(TToneParam);
1000 			break;
1001 
1002 		case TEST_CMD_PLT_TEMPLATE:
1003 			paramLength = sizeof(TTxTemplate);
1004 			break;
1005 
1006 		/* channel tune */
1007 		case TEST_CMD_CHANNEL_TUNE:
1008 			paramLength = sizeof(TTestCmdChannel);
1009 			break;
1010 
1011 		case TEST_CMD_GET_FW_VERSIONS:
1012 			paramLength = sizeof(TFWVerisons);
1013 			break;
1014 
1015         case TEST_CMD_INI_FILE_RADIO_PARAM:
1016             paramLength = sizeof(IniFileRadioParam);
1017             break;
1018 
1019         case TEST_CMD_INI_FILE_GENERAL_PARAM:
1020             paramLength = sizeof(IniFileGeneralParam);
1021             break;
1022 
1023 		case TEST_CMD_PLT_GAIN_ADJUST:
1024 			paramLength = sizeof(uint32);
1025 			break;
1026 
1027 		case TEST_CMD_RUN_CALIBRATION_TYPE:
1028 			paramLength = sizeof(TTestCmdRunCalibration);
1029 			break;
1030 
1031 		case TEST_CMD_TX_GAIN_ADJUST:
1032 			paramLength = sizeof(TTxGainAdjust);
1033 			break;
1034         case TEST_CMD_TEST_TONE:
1035             paramLength = sizeof(TestToneParams_t);
1036             break;
1037 
1038 		case TEST_CMD_SET_EFUSE:
1039 			paramLength = sizeof(EfuseParameters_t);
1040 			break;
1041 		case TEST_CMD_GET_EFUSE:
1042 			paramLength = sizeof(EfuseParameters_t);
1043 			break;
1044 
1045 		case TEST_CMD_RX_PLT_CAL:
1046 			paramLength = sizeof(RadioRxPltCal);
1047 			break;
1048 
1049 		case TEST_CMD_UPDATE_PD_REFERENCE_POINT:
1050 			paramLength = sizeof(TTestCmdUpdateReferncePoint);
1051 			break;
1052 
1053 		case TEST_CMD_UPDATE_PD_BUFFER_ERRORS:
1054 			paramLength = sizeof(TTestCmdPdBufferErrors);
1055 			break;
1056 
1057 		case TEST_CMD_POWER_MODE:
1058 			paramLength = sizeof(TTestCmdPowerMode);
1059 			break;
1060 
1061 		case TEST_CMD_STOP_TX:
1062 		case TEST_CMD_RX_STAT_STOP:
1063 		case TEST_CMD_RX_STAT_START:
1064 		case TEST_CMD_RX_STAT_RESET:
1065 		case TEST_CMD_RX_PLT_ENTER:
1066 		case TEST_CMD_RX_PLT_EXIT:
1067 			paramLength = 0;
1068 			break;
1069 
1070 		default:
1071 			paramLength = sizeof(pTestCmd->testCmd_u);
1072 	}
1073 
1074     return cmdQueue_SendCommand (pCmdBld->hCmdQueue,
1075                              CMD_TEST,
1076                              (void *)pTestCmd,
1077                              paramLength + RESEARVED_SIZE_FOR_RESPONSE,
1078                              fCb,
1079                              hCb,
1080                              (void*)pTestCmd);
1081 }
1082