Home | History | Annotate | Download | only in src
      1 /****************************************************************************
      2 **+-----------------------------------------------------------------------+**
      3 **|                                                                       |**
      4 **| Copyright(c) 1998 - 2008 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 
     36 #ifdef _WINDOWS    /*nick*/
     37 #elif defined(__ARMCC__)
     38 #include "string.h"
     39 #endif
     40 
     41 #include "osAdapter.h"
     42 #include "srcApi.h"
     43 #include "tiwlnif.h"
     44 #include "osDot11.h"
     45 #include "osUtil.h"
     46 #include "paramOut.h"
     47 #include "wspVer.h"
     48 #include "osClsfr.h"
     49 #include "whalHwMboxCmdBit.h"
     50 
     51 static TI_STATUS
     52 UtilRegulatoryDomain_setCountryIE(
     53 								 PTIWLN_ADAPTER_T pAdapter,
     54 								 externalParam_e ParamType,
     55 								 PUCHAR pData,
     56 								 ULONG Length
     57 								 );
     58 
     59 #ifdef TIWLN_WINCE30
     60 
     61 gprintf(const char *format ,... )
     62 {
     63 #if 1
     64 #ifdef DEBUG_PB
     65 	wchar_t Buf[500];
     66 #endif
     67 
     68 	FILE *Fpn;
     69 
     70 	Fpn = fopen("TILog.txt","a");
     71 
     72 	if (Fpn)
     73 	{
     74 		char Msg[500];
     75 		va_list ap;
     76 		va_start(ap,format);
     77 		_vsnprintf(Msg,500,format,ap);
     78 		fprintf(Fpn,"%s", Msg);
     79 #ifdef DEBUG_PB
     80 		mbstowcs(Buf,Msg,strlen(Msg)+1);
     81 		DEBUGMSG(1,(Buf));
     82 #endif
     83 
     84 		fclose(Fpn);
     85 
     86 	}
     87 #endif
     88 }
     89 
     90 #endif
     91 
     92 
     93 /*-----------------------------------------------------------------------------
     94 Routine Name: UtilSetParam
     95 Routine Description:
     96 Arguments:
     97 Return Value:
     98 -----------------------------------------------------------------------------*/
     99 TI_STATUS
    100 UtilSetParam(
    101 			PTIWLN_ADAPTER_T pAdapter,
    102 			externalParam_e ParamType,
    103 			PUCHAR pData,
    104 			ULONG Length
    105 			)
    106 {
    107 	paramInfo_t Param;
    108 	TI_STATUS Status;
    109 
    110 	Param.paramType = ParamType;
    111 	if (Length > sizeof(Param.content))
    112 	{
    113 		PRINTF(DBG_NDIS_OIDS_VERY_LOUD, (" UtilSetParam: Buffer for parameter 0x%X is bigger(%d) then Param size(%d)\n", ParamType, (int)Length, sizeof(Param.content)));
    114 		Param.paramLength = sizeof(Param.content);
    115 		NdisMoveMemory(&Param.content, pData, sizeof(Param.content));
    116 	} else
    117 	{
    118 		Param.paramLength = Length;
    119 		NdisMoveMemory(&Param.content, pData, Length);
    120 	}
    121 
    122 	Status = configMgr_setParam(pAdapter->CoreHalCtx, &Param);
    123 
    124 	return Status;
    125 }
    126 
    127 
    128 /*-----------------------------------------------------------------------------
    129 Routine Name: UtilGetParam
    130 Routine Description:
    131 Arguments:
    132 Return Value:
    133 -----------------------------------------------------------------------------*/
    134 TI_STATUS
    135 UtilGetParam(
    136 			PTIWLN_ADAPTER_T pAdapter,
    137 			externalParam_e ParamType,
    138 			PUCHAR pData,
    139 			ULONG Length
    140 			)
    141 {
    142 	paramInfo_t Param;
    143 	TI_STATUS Status;
    144 
    145 	Param.paramType = ParamType;
    146 	Param.paramLength = Length;
    147 
    148 	Status = configMgr_getParam(pAdapter->CoreHalCtx, &Param);
    149 
    150 	if (Status == NOK)
    151 	{
    152 		PRINTF(DBG_NDIS_OIDS_VERY_LOUD, (" UtilGetParam: ERROR on return from get param, status=%d, param=%d\n",
    153 										 Status, ParamType));
    154 	} else if ( Status != NOK )
    155 	{
    156 		PRINTF(DBG_NDIS_OIDS_LOUD, (" UtilGetParam: WARNING on return from get param, status=%d, param=%d\n",
    157 									Status, ParamType));
    158 	}
    159 
    160 	if (Length > sizeof(Param.content))
    161 	{
    162 		PRINTF(DBG_NDIS_OIDS_VERY_LOUD, (" UtilGetParam: Buffer for parameter 0x%X is bigger then Param size\n", ParamType));
    163 		NdisMoveMemory(pData, &Param.content, sizeof(Param.content));
    164 	} else
    165 	{
    166 		NdisMoveMemory(pData, &Param.content, Length);
    167 	}
    168 
    169 	return Status;
    170 }
    171 
    172 /*-----------------------------------------------------------------------------
    173 Routine Name: UtilSetGetParam
    174 Routine Description:
    175 Arguments:
    176 Return Value:
    177 -----------------------------------------------------------------------------*/
    178 TI_STATUS
    179 UtilSetGetParam(
    180 			   PTIWLN_ADAPTER_T pAdapter,
    181 			   externalParam_e ParamType,
    182 			   PUCHAR pData,
    183 			   ULONG Length
    184 			   )
    185 {
    186 	paramInfo_t Param;
    187 	TI_STATUS Status;
    188 
    189 	Param.paramType = ParamType;
    190 	if (Length > sizeof(Param.content))
    191 	{
    192 		PRINTF(DBG_NDIS_OIDS_VERY_LOUD, (" UtilSetParam: Buffer for parameter 0x%X is bigger(%d) then Param size(%d)\n", ParamType, (int)Length, sizeof(Param.content)));
    193 		Param.paramLength = sizeof(Param.content);
    194 		NdisMoveMemory(&Param.content, pData, sizeof(Param.content));
    195 	} else
    196 	{
    197 		Param.paramLength = Length;
    198 		NdisMoveMemory(&Param.content, pData, Length);
    199 	}
    200 
    201 	Status = configMgr_setParam(pAdapter->CoreHalCtx, &Param);
    202 
    203 	if (Length > sizeof(Param.content))
    204 	{
    205 		PRINTF(DBG_NDIS_OIDS_VERY_LOUD, (" UtilGetParam: Buffer for parameter 0x%X is bigger then Param size\n", ParamType));
    206 		NdisMoveMemory(pData, &Param.content, sizeof(Param.content));
    207 	} else
    208 	{
    209 		NdisMoveMemory(pData, &Param.content, Length);
    210 	}
    211 
    212 	return Status;
    213 }
    214 
    215 /*-----------------------------------------------------------------------------
    216 Routine Name: UtilGetTxPowerValue
    217 Routine Description:
    218 Arguments:
    219 Return Value:
    220 -----------------------------------------------------------------------------*/
    221 ULONG
    222 UtilGetTxPowerValue(
    223 				   PTIWLN_ADAPTER_T pAdapter,
    224 				   externalParam_e ParamType,
    225 				   PUCHAR pData,
    226 				   ULONG Length
    227 				   )
    228 {
    229 	paramInfo_t Param;
    230 	TI_STATUS Status;
    231 
    232 	Param.paramType = ParamType;
    233 	Param.paramLength = Length;
    234 	Status = configMgr_getParam(pAdapter->CoreHalCtx, &Param);
    235 
    236 	*(PULONG)pData = (ULONG)Param.content.regulatoryDomainParam.txPower;
    237 
    238 	return Status;
    239 }
    240 
    241 
    242 /*-----------------------------------------------------------------------------
    243 Routine Name:	UtilSetTxPowerDbm
    244 Routine Description:
    245 Arguments:
    246 Return Value:
    247 -----------------------------------------------------------------------------*/
    248 ULONG UtilSetTxPowerDbm(PTIWLN_ADAPTER_T pAdapter,
    249 						  PUCHAR pData,
    250 						  ULONG Length)
    251 {
    252 	ULONG retValue;
    253 
    254 	retValue = UtilSetParam(pAdapter, REGULATORY_DOMAIN_CURRENT_TX_POWER_IN_DBM_PARAM, pData, sizeof(UINT8));
    255 
    256 	return retValue;
    257 }
    258 
    259 
    260 /*-----------------------------------------------------------------------------
    261 Routine Name:	UtilGetTxPowerLevel
    262 Routine Description:
    263 Arguments:
    264 Return Value:
    265 -----------------------------------------------------------------------------*/
    266 ULONG UtilGetTxPowerLevel(PTIWLN_ADAPTER_T pAdapter,
    267 						  PUCHAR pData,
    268 						  PULONG Length)
    269 {
    270 	ULONG retValue;
    271 
    272 	retValue = UtilGetParam(pAdapter, REGULATORY_DOMAIN_TX_POWER_LEVEL_TABLE_PARAM, pData, sizeof(TIWLAN_POWER_LEVEL_TABLE));
    273 	*Length=sizeof(TIWLAN_POWER_LEVEL_TABLE);
    274 
    275 	return retValue;
    276 }
    277 
    278 
    279 
    280 /*-----------------------------------------------------------------------------
    281 Routine Name:	UtilEnableDisableRxDataFilters
    282 Routine Description:
    283 Arguments:
    284 Return Value:
    285 -----------------------------------------------------------------------------*/
    286 ULONG UtilEnableDisableRxDataFilters(PTIWLN_ADAPTER_T pAdapter,
    287                                      PUCHAR pData,
    288                                      ULONG Length)
    289 {
    290     ULONG retValue;
    291 
    292     retValue = UtilSetParam(pAdapter, RX_DATA_ENABLE_DISABLE_RX_DATA_FILTERS, pData, Length);
    293 
    294     return retValue;
    295 }
    296 
    297 
    298 
    299 /*-----------------------------------------------------------------------------
    300 Routine Name:	UtilGetRxDataFiltersStatisticsCB
    301 
    302 Routine Description: This is the CB triggered when Rx Data Filter statistics
    303 					 are returned by the FW.
    304 Arguments:
    305 
    306 Return Value:
    307 -----------------------------------------------------------------------------*/
    308 static VOID UtilGetRxDataFiltersStatisticsCB(TI_HANDLE hAdapter, TI_STATUS status, PUINT8 pReadBuff)
    309 {
    310 	PTIWLN_ADAPTER_T pAdapter = (PTIWLN_ADAPTER_T) hAdapter;
    311     ACXDataFilteringStatistics_t * pStatistics = (ACXDataFilteringStatistics_t *) pReadBuff;
    312     TIWLAN_DATA_FILTER_STATISTICS * pResult = (TIWLAN_DATA_FILTER_STATISTICS *) &(pAdapter->pIoBuffer[0]);
    313     int i;
    314 
    315     pResult->UnmatchedPacketsCount = pStatistics->unmatchedPacketsCount;
    316 
    317     for (i = 0; i < MAX_DATA_FILTERS; ++i)
    318     {
    319         pResult->MatchedPacketsCount[i] = pStatistics->matchedPacketsCount[i];
    320     }
    321 
    322     *(pAdapter->pIoCompleteBuffSize) = sizeof(TIWLAN_DATA_FILTER_STATISTICS);
    323 
    324     /* indicate that the buffer is ready */
    325 	os_IoctlComplete(pAdapter, status);
    326 }
    327 
    328 
    329 /*-----------------------------------------------------------------------------
    330 Routine Name:	UtilEnableDisableRxDataFilters
    331 Routine Description:
    332 Arguments:
    333 Return Value:
    334 -----------------------------------------------------------------------------*/
    335 ULONG UtilGetRxDataFiltersStatistics(PTIWLN_ADAPTER_T pAdapter,
    336                                      PUCHAR pData,
    337                                      PULONG Length)
    338 {
    339     paramInfo_t Param;
    340 
    341     memset(&(pAdapter->IoCompleteBuff[0]) , 0xFF , MAX_IO_BUFFER_COMPLETE_SIZE);
    342 
    343     pAdapter->pIoBuffer = pData;
    344     pAdapter->pIoCompleteBuffSize = Length;
    345 
    346     Param.paramType = RX_DATA_GET_RX_DATA_FILTERS_STATISTICS;
    347     Param.paramLength = sizeof(TIWLAN_DATA_FILTER_STATISTICS);
    348     Param.content.interogateCmdCBParams.CB_handle = (TI_HANDLE) pAdapter;
    349     Param.content.interogateCmdCBParams.CB_Func = (PVOID) UtilGetRxDataFiltersStatisticsCB;
    350     Param.content.interogateCmdCBParams.CB_buf = &(pAdapter->IoCompleteBuff[0]) ;
    351 
    352     return configMgr_getParam(pAdapter->CoreHalCtx, &Param);
    353 }
    354 
    355 
    356 /*-----------------------------------------------------------------------------
    357 Routine Name:	UtilGetPowerConsumptionStatisticsCB
    358 
    359 Routine Description: This is the CB triggered when Power consumption statistics
    360 					 are returned by the FW.
    361 Arguments:
    362 
    363 Return Value:
    364 -----------------------------------------------------------------------------*/
    365 static VOID UtilGetPowerConsumptionStatisticsCB(TI_HANDLE hAdapter, TI_STATUS status, PUINT8 pReadBuff)
    366 {
    367 	PTIWLN_ADAPTER_T pAdapter = (PTIWLN_ADAPTER_T) hAdapter;
    368     ACXPowerConsumptionTimeStat_t * pStatistics = (ACXPowerConsumptionTimeStat_t *) pReadBuff;
    369     PowerConsumptionTimeStat_t * pResult = (PowerConsumptionTimeStat_t *) &(pAdapter->pIoBuffer[0]);
    370 
    371     pResult->activeTimeCnt_Hi = pStatistics->activeTimeCnt_Hi;
    372     pResult->activeTimeCnt_Low = pStatistics->activeTimeCnt_Low;
    373     pResult->elpTimeCnt_Hi = pStatistics->elpTimeCnt_Hi;
    374     pResult->elpTimeCnt_Low = pStatistics->elpTimeCnt_Low;
    375     pResult->powerDownTimeCnt_Hi = pStatistics->powerDownTimeCnt_Hi;
    376     pResult->powerDownTimeCnt_Low = pStatistics->powerDownTimeCnt_Low;
    377 
    378     *(pAdapter->pIoCompleteBuffSize) = sizeof(PowerConsumptionTimeStat_t);
    379 
    380     /* indicate that the buffer is ready */
    381 	os_IoctlComplete(pAdapter, status);
    382 }
    383 
    384 
    385 /*-----------------------------------------------------------------------------
    386 Routine Name:	UtilGetPowerConsumptionStatistics
    387 Routine Description: Request the power consumption statistics from the FW
    388 Arguments:
    389 Return Value:
    390 -----------------------------------------------------------------------------*/
    391 ULONG UtilGetPowerConsumptionStatistics(PTIWLN_ADAPTER_T pAdapter, PUCHAR pData, PULONG Length)
    392 {
    393     paramInfo_t Param;
    394 
    395     memset(&(pAdapter->IoCompleteBuff[0]) , 0xFF , MAX_IO_BUFFER_COMPLETE_SIZE);
    396 
    397     pAdapter->pIoBuffer = pData;
    398     pAdapter->pIoCompleteBuffSize = Length;
    399 
    400     Param.paramType = HAL_CTRL_POWER_CONSUMPTION;
    401     Param.paramLength = sizeof(PowerConsumptionTimeStat_t);
    402     Param.content.interogateCmdCBParams.CB_handle = (TI_HANDLE) pAdapter;
    403     Param.content.interogateCmdCBParams.CB_Func = (PVOID) UtilGetPowerConsumptionStatisticsCB;
    404     Param.content.interogateCmdCBParams.CB_buf = &(pAdapter->IoCompleteBuff[0]);
    405 
    406     return configMgr_getParam(pAdapter->CoreHalCtx, &Param);
    407 }
    408 
    409 
    410 /*-----------------------------------------------------------------------------
    411 Routine Name:	UtilAddRxDataFilter
    412 Routine Description:
    413 Arguments:
    414 Return Value:
    415 -----------------------------------------------------------------------------*/
    416 ULONG UtilAddRxDataFilter(PTIWLN_ADAPTER_T pAdapter,
    417                           PUCHAR pData,
    418                           ULONG Length)
    419 {
    420     ULONG retValue;
    421 
    422     retValue = UtilSetParam(pAdapter, RX_DATA_ADD_RX_DATA_FILTER, pData, Length);
    423 
    424     return retValue;
    425 }
    426 
    427 
    428 
    429 /*-----------------------------------------------------------------------------
    430 Routine Name:	UtilRemoveRxDataFilter
    431 Routine Description:
    432 Arguments:
    433 Return Value:
    434 -----------------------------------------------------------------------------*/
    435 ULONG UtilRemoveRxDataFilter(PTIWLN_ADAPTER_T pAdapter,
    436                              PUCHAR pData,
    437                              ULONG Length)
    438 {
    439     ULONG retValue;
    440 
    441     retValue = UtilSetParam(pAdapter, RX_DATA_REMOVE_RX_DATA_FILTER, pData, Length);
    442 
    443     return retValue;
    444 }
    445 
    446 
    447 
    448 /*-----------------------------------------------------------------------------
    449 Routine Name:	UtilGetCurrentRssiLevel
    450 Routine Description:
    451 Arguments:
    452 Return Value:
    453 -----------------------------------------------------------------------------*/
    454 ULONG UtilGetCurrentRssiLevel(PTIWLN_ADAPTER_T pAdapter,
    455 							  PUCHAR pData,
    456 							  PULONG Length)
    457 {
    458 	ULONG retValue;
    459 	retValue = UtilGetParam(pAdapter, SITE_MGR_CURRENT_SIGNAL_PARAM, pData, sizeof(INT32));
    460 	*Length = sizeof(INT32);
    461 	return retValue;
    462 }
    463 
    464 
    465 /*-----------------------------------------------------------------------------
    466 Routine Name:	RssiUtilIoctlCompleteCB
    467 
    468 Routine Description: This is the CB triggered when  Rssi/Snr have been
    469 					returned by FW - return RSSI only to user
    470 Arguments:
    471 
    472 Return Value:
    473 -----------------------------------------------------------------------------*/
    474 VOID RssiUtilIoctlCompleteCB(TI_HANDLE hAdapter, TI_STATUS status, PUINT8 pReadBuff)
    475 {
    476 	PTIWLN_ADAPTER_T pAdapter = (PTIWLN_ADAPTER_T)hAdapter;
    477 	TIWLN_RADIO_RX_QUALITY tmpRadioRxQuality;
    478 	paramInfo_t Param;
    479 	ACXRoamingStatisticsTable_t * radioResults = (ACXRoamingStatisticsTable_t *) pReadBuff;
    480 
    481 	tmpRadioRxQuality.Rssi = radioResults->rssi;
    482 	tmpRadioRxQuality.Snr = (INT32) radioResults->snr;
    483 
    484 	/* here we update the site manager about these new values */
    485 	Param.paramType = SITE_MGR_CURRENT_SIGNAL_PARAM;
    486 	Param.paramLength = sizeof(INT32);
    487 	Param.content.siteMgrCurrentRssi = tmpRadioRxQuality.Rssi;
    488 	configMgr_setParam(pAdapter->CoreHalCtx, &Param);
    489 
    490 
    491 	*(pAdapter->pIoCompleteBuffSize) = sizeof(INT32);
    492 	os_memoryCopy(hAdapter, (PVOID) &(pAdapter->pIoBuffer[0]), (PVOID) &(tmpRadioRxQuality.Rssi), sizeof(INT32));
    493 
    494 	/* Call back the Completion that will indicate to the user that the buffer is ready to be read */
    495 	os_IoctlComplete(pAdapter, status);
    496 }
    497 
    498 /*-----------------------------------------------------------------------------
    499 Routine Name:	SnrUtilIoctlCompleteCB
    500 
    501 Routine Description: This is the CB triggered when  Rssi/Snr have been
    502 					returned by FW - return SNR only to user
    503 Arguments:
    504 
    505 Return Value:
    506 -----------------------------------------------------------------------------*/
    507 VOID SnrUtilIoctlCompleteCB(TI_HANDLE hAdapter, TI_STATUS status, PUINT8 pReadBuff)
    508 {
    509 	PTIWLN_ADAPTER_T pAdapter = (PTIWLN_ADAPTER_T) hAdapter;
    510 	TIWLN_RADIO_RX_QUALITY tmpRadioRxQuality;
    511 	ACXRoamingStatisticsTable_t * radioResults = (ACXRoamingStatisticsTable_t *) pReadBuff;
    512 
    513     tmpRadioRxQuality.Rssi = radioResults->rssi;
    514 	/* The SNR returned by FW is not true. We have to divide it by 2 and turns it to a signed */
    515 	tmpRadioRxQuality.Snr = (INT32) radioResults->snr;
    516 
    517 	*(pAdapter->pIoCompleteBuffSize) = sizeof(INT32);
    518 
    519 	os_memoryCopy(hAdapter, (PVOID) &(pAdapter->pIoBuffer[0]), (PVOID) &(tmpRadioRxQuality.Snr), sizeof(INT32));
    520 
    521 	os_IoctlComplete(pAdapter, status);
    522 }
    523 
    524 
    525 /*-----------------------------------------------------------------------------
    526 Routine Name:	UtilGetAsyncCurrentRssiLevel
    527 Routine Description:
    528 Arguments:
    529 Return Value:
    530 -----------------------------------------------------------------------------*/
    531 ULONG UtilGetAsyncCurrentRssiLevel(PTIWLN_ADAPTER_T pAdapter,
    532 								   PUCHAR pData,
    533 								   PULONG Length)
    534 {
    535 	paramInfo_t Param;
    536 
    537 
    538 	TI_STATUS Status;
    539 
    540 	memset(&(pAdapter->IoCompleteBuff[0]) , 0xFF , MAX_IO_BUFFER_COMPLETE_SIZE );
    541 
    542 	/* To implement the Async IOCTL store the user buffer pointer to be filled at
    543 	the Command Completion calback */
    544 	pAdapter->pIoBuffer =  pData;
    545 	pAdapter->pIoCompleteBuffSize =  Length ;
    546 
    547 	/* Fill the IOCTL struct to the Command Mailbox by giving a stack parameter */
    548 	Param.paramType = HAL_CTRL_RSSI_LEVEL_PARAM;
    549 	Param.paramLength = sizeof(INT32);
    550 	Param.content.interogateCmdCBParams.CB_handle  =  (TI_HANDLE)pAdapter;
    551 	Param.content.interogateCmdCBParams.CB_Func    =  (PVOID)RssiUtilIoctlCompleteCB;
    552 	Param.content.interogateCmdCBParams.CB_buf     =  &(pAdapter->IoCompleteBuff[0]) ;
    553 
    554 	/* This Get Param will in fact get till the HAL and will interrogate the FW */
    555 	Status = configMgr_getParam(pAdapter->CoreHalCtx, &Param);
    556 
    557 	return Status;
    558 }
    559 
    560 
    561 /*-----------------------------------------------------------------------------
    562 Routine Name:	UtilGetAsyncCurrentRssiLevel
    563 Routine Description:
    564 Arguments:
    565 Return Value:
    566 -----------------------------------------------------------------------------*/
    567 ULONG UtilGetAsyncCurrentSnrRatio(PTIWLN_ADAPTER_T pAdapter,
    568 								  PUCHAR pData,
    569 								  PULONG Length)
    570 {
    571 	paramInfo_t Param;
    572 
    573 
    574 	TI_STATUS Status;
    575 
    576 	memset(&(pAdapter->IoCompleteBuff[0]) , 0xFF , MAX_IO_BUFFER_COMPLETE_SIZE );
    577 
    578 	pAdapter->pIoBuffer =  pData;
    579 	pAdapter->pIoCompleteBuffSize =  Length ;
    580 
    581 	Param.paramType = HAL_CTRL_SNR_RATIO_PARAM;
    582 	Param.paramLength = sizeof(INT32);
    583 	Param.content.interogateCmdCBParams.CB_handle  =  (TI_HANDLE)pAdapter;
    584 	Param.content.interogateCmdCBParams.CB_Func    =  (PVOID)SnrUtilIoctlCompleteCB;
    585 	Param.content.interogateCmdCBParams.CB_buf     =  &(pAdapter->IoCompleteBuff[0]) ;
    586 
    587 	Status = configMgr_getParam(pAdapter->CoreHalCtx, &Param);
    588 
    589 	return Status;
    590 
    591 
    592 }
    593 
    594 
    595 /*-----------------------------------------------------------------------------
    596 Routine Name: UtilGetAPTxPowerLevel
    597 Routine Description:
    598 Arguments:
    599 Return Value:
    600 -----------------------------------------------------------------------------*/
    601 ULONG
    602 UtilGetAPTxPowerLevel(
    603 					 PTIWLN_ADAPTER_T pAdapter,
    604 					 externalParam_e ParamType,
    605 					 PUCHAR pData,
    606 					 ULONG Length
    607 					 )
    608 {
    609 	paramInfo_t Param;
    610 	TI_STATUS Status;
    611 
    612 	Param.paramType = ParamType;
    613 	Param.paramLength = Length;
    614 	Status = configMgr_getParam(pAdapter->CoreHalCtx, &Param);
    615 
    616 	*(PULONG)pData = (ULONG)Param.content.APTxPower;
    617 
    618 	return Status;
    619 }
    620 
    621 
    622 /*-----------------------------------------------------------------------------
    623 Routine Name: UtilGetCountryCode
    624 Routine Description:
    625 Arguments:
    626 Return Value:
    627 -----------------------------------------------------------------------------*/
    628 ULONG
    629 UtilGetCountryCode(
    630 				  PTIWLN_ADAPTER_T pAdapter,
    631 				  externalParam_e ParamType,
    632 				  PUCHAR pData,
    633 				  ULONG Length
    634 				  )
    635 {
    636 	paramInfo_t Param;
    637 	TI_STATUS Status;
    638 
    639 	Param.paramType = ParamType;
    640 	Param.paramLength = Length;
    641 	Status = configMgr_getParam(pAdapter->CoreHalCtx, &Param);
    642 
    643 	NdisMoveMemory(pData, Param.content.pCountryString, Length);
    644 
    645 	return Status;
    646 }
    647 
    648 
    649 
    650 /*-----------------------------------------------------------------------------
    651 Routine Name: UtilGetRegDomainBand
    652 Routine Description:
    653 Arguments:
    654 Return Value:
    655 -----------------------------------------------------------------------------*/
    656 ULONG
    657 UtilGetRegDomainBand(
    658 					PTIWLN_ADAPTER_T pAdapter,
    659 					externalParam_e ParamType,
    660 					PUCHAR pData,
    661 					ULONG Length
    662 					)
    663 {
    664 	paramInfo_t Param;
    665 	TI_STATUS Status;
    666 
    667 	Param.paramType = ParamType;
    668 	Param.paramLength = Length;
    669 
    670 	Status = configMgr_getParam(pAdapter->CoreHalCtx, &Param);
    671 
    672 	*(PULONG)pData = (ULONG) *(PUCHAR)&Param.content;
    673 
    674 	return Status;
    675 }
    676 
    677 
    678 /*-----------------------------------------------------------------------------
    679 Routine Name: UtilGetPacketBursting
    680 Routine Description:
    681 Arguments:
    682 Return Value:
    683 -----------------------------------------------------------------------------*/
    684 ULONG
    685 UtilGetPacketBursting(
    686 					 PTIWLN_ADAPTER_T pAdapter,
    687 					 externalParam_e ParamType,
    688 					 PUCHAR pData,
    689 					 ULONG Length
    690 					 )
    691 {
    692 	paramInfo_t Param;
    693 	TI_STATUS Status;
    694 
    695 	Param.paramType = ParamType;
    696 	Param.paramLength = Length;
    697 
    698 	Status = configMgr_getParam(pAdapter->CoreHalCtx, &Param);
    699 
    700 	*(PULONG)pData = (ULONG)Param.content.qosPacketBurstEnb;
    701 	return Status;
    702 }
    703 
    704 
    705 /*-----------------------------------------------------------------------------
    706 Routine Name: UtilGetMixedMode
    707 Routine Description:
    708 Arguments:
    709 Return Value:
    710 -----------------------------------------------------------------------------*/
    711 ULONG
    712 UtilGetMixedMode(
    713 				PTIWLN_ADAPTER_T pAdapter,
    714 				externalParam_e ParamType,
    715 				PUCHAR pData,
    716 				PULONG Length
    717 				)
    718 {
    719 	paramInfo_t Param;
    720 	TI_STATUS Status;
    721 
    722 	Param.paramType = ParamType;
    723 
    724 	Status = configMgr_getParam(pAdapter->CoreHalCtx, &Param);
    725 
    726 	*(PULONG)pData = (ULONG)Param.content.rsnMixedMode;
    727 	return Status;
    728 }
    729 
    730 /*-----------------------------------------------------------------------------
    731 Routine Name: UtilGetDefaultKeyId
    732 Routine Description:
    733 Arguments:
    734 Return Value:
    735 -----------------------------------------------------------------------------*/
    736 ULONG
    737 UtilGetDefaultKeyId(
    738 				   PTIWLN_ADAPTER_T pAdapter,
    739 				   externalParam_e ParamType,
    740 				   PUCHAR pData,
    741 				   PULONG Length
    742 				   )
    743 {
    744 	paramInfo_t Param;
    745 	TI_STATUS Status;
    746 
    747 	Param.paramType = ParamType;
    748 
    749 	Status = configMgr_getParam(pAdapter->CoreHalCtx, &Param);
    750 
    751 	*(PULONG)pData = (ULONG)Param.content.rsnDefaultKeyID;
    752 	return Status;
    753 }
    754 
    755 
    756 /*-----------------------------------------------------------------------------
    757 Routine Name: UtilSetTrafficIntensityThresholds
    758 Routine Description: Sets the traffic intensity thresholds
    759 Arguments:
    760 Return Value:
    761 -----------------------------------------------------------------------------*/
    762 ULONG UtilSetTrafficIntensityThresholds(PTIWLN_ADAPTER_T pAdapter, PUCHAR pData, ULONG Length)
    763 {
    764 	ULONG retValue;
    765 	retValue = UtilSetParam(pAdapter,CTRL_DATA_TRAFFIC_INTENSITY_THRESHOLD , pData, Length);
    766 	return retValue;
    767 }
    768 
    769 
    770 /*-----------------------------------------------------------------------------
    771 Routine Name: UtilGetTrafficIntensityThresholds
    772 Routine Description: retrieves the traffic intensity thresholds
    773 Arguments:
    774 Return Value:
    775 -----------------------------------------------------------------------------*/
    776 ULONG UtilGetTrafficIntensityThresholds(PTIWLN_ADAPTER_T pAdapter, PUCHAR pData, PULONG Length)
    777 {
    778 	ULONG retValue;
    779 	retValue = UtilGetParam(pAdapter, CTRL_DATA_TRAFFIC_INTENSITY_THRESHOLD, pData, (*Length));
    780 	*Length = sizeof(OS_802_11_TRAFFIC_INTENSITY_THRESHOLD_PARAMS);
    781 	return retValue;
    782 }
    783 
    784 
    785 /*-----------------------------------------------------------------------------
    786 Routine Name: UtilToggleTrafficIntensityEvents
    787 Routine Description: Toggles ON/OFF traffic intensity events
    788 Arguments:
    789 Return Value:
    790 -----------------------------------------------------------------------------*/
    791 ULONG UtilToggleTrafficIntensityEvents(PTIWLN_ADAPTER_T pAdapter, PUCHAR pData, ULONG Length)
    792 {
    793 	ULONG retValue;
    794 	retValue = UtilSetParam(pAdapter,CTRL_DATA_TOGGLE_TRAFFIC_INTENSITY_EVENTS , pData, Length);
    795 	return retValue;
    796 }
    797 
    798 
    799 
    800 
    801 /*-----------------------------------------------------------------------------
    802 Routine Name:
    803 
    804 	UtilSetBSSID
    805 Routine Description:
    806 Arguments:
    807 Return Value:
    808 -----------------------------------------------------------------------------*/
    809 ULONG
    810 UtilSetBSSID(
    811 			PTIWLN_ADAPTER_T pAdapter,
    812 			PUCHAR pData,
    813 			ULONG Length
    814 			)
    815 {
    816 	return UtilSetParam(pAdapter, SITE_MGR_DESIRED_BSSID_PARAM, pData, ETH_ADDR_SIZE);
    817 }
    818 
    819 /*-----------------------------------------------------------------------------
    820 Routine Name: UtilGetBSSID
    821 Routine Description:
    822 Arguments:
    823 Return Value:
    824 -----------------------------------------------------------------------------*/
    825 ULONG
    826 UtilGetBSSID(
    827 			PTIWLN_ADAPTER_T pAdapter,
    828 			PUCHAR pData,
    829 			PULONG Length
    830 			)
    831 {
    832 	TI_STATUS res;
    833 
    834 	if (!Length)
    835 		return NOK;
    836 
    837 	res = UtilGetParam(pAdapter, CTRL_DATA_CURRENT_BSSID_PARAM, pData, ETH_ADDR_SIZE);
    838 
    839 	*Length = ETH_ADDR_SIZE;
    840 
    841 	return res;
    842 }
    843 
    844 
    845 /*-----------------------------------------------------------------------------
    846 Routine Name: UtilGetSSID
    847 Routine Description:
    848 Arguments:
    849 Return Value:
    850 -----------------------------------------------------------------------------*/
    851 ULONG
    852 UtilGetSSID(
    853 		   PTIWLN_ADAPTER_T pAdapter,
    854 		   PUCHAR pData,
    855 		   PULONG Length
    856 		   )
    857 {
    858 	ULONG size;
    859 	ssid_t ssid;
    860 	OS_802_11_SSID* RetSsid;
    861 
    862 	if (*Length<sizeof(OS_802_11_SSID))
    863 		return NOK;
    864 
    865 	size = sizeof(ssid_t);
    866 	UtilGetParam(pAdapter, SITE_MGR_CURRENT_SSID_PARAM, (PUCHAR)&ssid, size);
    867 
    868 	RetSsid = (OS_802_11_SSID*) pData;
    869 
    870 	RetSsid->SsidLength = ssid.len;
    871 	NdisMoveMemory((void *)RetSsid->Ssid, (void *)ssid.ssidString, ssid.len);
    872 
    873 	*Length = sizeof(OS_802_11_SSID);
    874 
    875 	return OK;
    876 }
    877 
    878 
    879 /*-----------------------------------------------------------------------------
    880 Routine Name: UtilGetDesiredSSID
    881 Routine Description:
    882 Arguments:
    883 Return Value:
    884 -----------------------------------------------------------------------------*/
    885 ULONG
    886 UtilGetDesiredSSID(
    887 				  PTIWLN_ADAPTER_T pAdapter,
    888 				  PUCHAR pData,
    889 				  PULONG Length
    890 				  )
    891 {
    892 	ULONG size,retValue;
    893 	ssid_t ssid;
    894 	OS_802_11_SSID* RetSsid;
    895 
    896 	if (!(*Length))
    897 	{
    898 		*Length = sizeof(OS_802_11_SSID);
    899 		return NOK;
    900 	}
    901 
    902 	size = sizeof(ssid_t);
    903 	retValue = UtilGetParam(pAdapter, SITE_MGR_DESIRED_SSID_PARAM, (PUCHAR)&ssid, size);
    904 
    905 	RetSsid = (OS_802_11_SSID*) pData;
    906 
    907 	RetSsid->SsidLength = ssid.len;
    908 	NdisMoveMemory((void *)RetSsid->Ssid, (void *)ssid.ssidString, ssid.len);
    909 
    910 	*Length = sizeof(OS_802_11_SSID);
    911 	return retValue;
    912 }
    913 
    914 
    915 /*-----------------------------------------------------------------------------
    916 Routine Name: UtilSetSSID
    917 Routine Description:
    918 Arguments:
    919 Return Value:
    920 -----------------------------------------------------------------------------*/
    921 ULONG
    922 UtilSetSSID(
    923 		   PTIWLN_ADAPTER_T pAdapter,
    924 		   PUCHAR pData,
    925 		   ULONG Length
    926 		   )
    927 {
    928 	OS_802_11_SSID* UtilSsid;
    929 	ssid_t ssid;
    930 
    931 	UtilSsid = (OS_802_11_SSID*) pData;
    932 
    933 	if (UtilSsid->SsidLength<=MAX_SSID_LEN)
    934 	{
    935 		ssid.len = (UINT8)UtilSsid->SsidLength;
    936 
    937 		NdisMoveMemory((void *)ssid.ssidString, (void *)UtilSsid->Ssid, ssid.len);
    938 
    939 		/* The driver should support setting the SSID to NULL string */
    940 		if (ssid.len == 0)
    941 			ssid.ssidString[0] = '\0';
    942 
    943 #ifdef TI_DBG
    944 		{
    945 			UCHAR   tempName[33];
    946 
    947 			NdisMoveMemory(tempName, (void *)UtilSsid->Ssid, ssid.len);
    948 			tempName[ssid.len] ='\0';
    949 
    950 			PRINTF(DBG_NDIS_OIDS_LOUD, ("  SET SSID: Len=%d %s\n", ssid.len, tempName));
    951 		}
    952 #endif
    953 
    954 		UtilSetParam(pAdapter, SITE_MGR_DESIRED_SSID_PARAM, (PUCHAR)&ssid, sizeof(ssid_t));
    955 	}
    956 
    957 	return OK;
    958 
    959 }
    960 
    961 
    962 /*-----------------------------------------------------------------------------
    963 Routine Name: UtilNetworkTypesSupported
    964 Routine Description:
    965 Arguments:
    966 Return Value:
    967 -----------------------------------------------------------------------------*/
    968 ULONG
    969 UtilNetworkTypesSupported(
    970 						 PTIWLN_ADAPTER_T pAdapter,
    971 						 PUCHAR pData,
    972 						 PULONG Length
    973 						 )
    974 {
    975 	OS_802_11_NETWORK_TYPE_LIST * pList;
    976 	ULONG mode, size;
    977 
    978 	UtilGetParam(pAdapter, SITE_MGR_DESIRED_DOT11_MODE_PARAM,
    979 							(PUCHAR)&mode, sizeof(ULONG));
    980 
    981 	if (!(*Length))
    982 	{
    983 
    984 		/**/
    985 		/* Return the maximum size*/
    986 		/**/
    987 		size = sizeof(OS_802_11_NETWORK_TYPE_LIST) +
    988 			   3 * sizeof(OS_802_11_NETWORK_TYPE) -
    989 			   sizeof(OS_802_11_NETWORK_TYPE);
    990 
    991 		*Length = size;
    992 		return NOK;
    993 
    994 	}
    995 
    996 	pList = (OS_802_11_NETWORK_TYPE_LIST *) pData;
    997 
    998 	switch (mode)
    999 	{
   1000 
   1001 	case 1:
   1002 		pList->NumberOfItems = 1;
   1003 		pList->NetworkType[0] = os802_11DS;
   1004 		break;
   1005 
   1006 	case 2:
   1007 		pList->NumberOfItems = 1;
   1008 		pList->NetworkType[0] = os802_11OFDM5;
   1009 		break;
   1010 
   1011 	case 3:
   1012 		pList->NumberOfItems = 2;
   1013 		pList->NetworkType[0] = os802_11DS;
   1014 		pList->NetworkType[1] = os802_11OFDM24;
   1015 		break;
   1016 
   1017 	case 4:
   1018 		pList->NumberOfItems = 3;
   1019 		pList->NetworkType[0] = os802_11DS;
   1020 		pList->NetworkType[1] = os802_11OFDM24;
   1021 		pList->NetworkType[2] = os802_11OFDM5;
   1022 		break;
   1023 
   1024 	default:
   1025 		pList->NumberOfItems = 1;
   1026 		pList->NetworkType[0] = os802_11DS;
   1027 		break;
   1028 	}
   1029 
   1030 	size = sizeof(OS_802_11_NETWORK_TYPE_LIST) +
   1031 		   pList->NumberOfItems * sizeof(OS_802_11_NETWORK_TYPE) -
   1032 		   sizeof(OS_802_11_NETWORK_TYPE);
   1033 
   1034 	*Length = size;
   1035 	return OK;
   1036 }
   1037 
   1038 
   1039 /*-----------------------------------------------------------------------------
   1040 Routine Name: UtilNetworkTypeInUseGet
   1041 Routine Description:
   1042 Arguments:
   1043 Return Value:
   1044 -----------------------------------------------------------------------------*/
   1045 ULONG
   1046 UtilNetworkTypeInUseGet(
   1047 					   PTIWLN_ADAPTER_T pAdapter,
   1048 					   PUCHAR pData,
   1049 					   PULONG Length
   1050 					   )
   1051 {
   1052 	ULONG mode;
   1053 	if (!(*Length))
   1054 	{
   1055 
   1056 		*Length = sizeof(OS_802_11_NETWORK_TYPE);
   1057 		return NOK;
   1058 
   1059 	}
   1060 
   1061 	UtilGetParam(pAdapter, SITE_MGR_DESIRED_DOT11_MODE_PARAM,
   1062 				 (PUCHAR)&mode, sizeof(ULONG));
   1063 
   1064 	switch (mode)
   1065 	{
   1066 
   1067 	case 1:
   1068 		*((OS_802_11_NETWORK_TYPE *) pData) = os802_11DS;
   1069 		break;
   1070 
   1071 	case 2:
   1072 		*((OS_802_11_NETWORK_TYPE *) pData) = os802_11OFDM5;
   1073 		break;
   1074 
   1075 	case 3:
   1076 		*((OS_802_11_NETWORK_TYPE *) pData) = os802_11OFDM24;
   1077 		break;
   1078 
   1079 	case 4:
   1080 		*((OS_802_11_NETWORK_TYPE *) pData) = os802_11Automode;
   1081 		break;
   1082 
   1083 	default:
   1084 		*((OS_802_11_NETWORK_TYPE *) pData) = os802_11DS;
   1085 		break;
   1086 
   1087 	}
   1088 
   1089 	*Length = sizeof(OS_802_11_NETWORK_TYPE);
   1090 	return OK;
   1091 }
   1092 
   1093 
   1094 /*-----------------------------------------------------------------------------
   1095 Routine Name: UtilNetworkTypeInUseSet
   1096 Routine Description:
   1097 Arguments:
   1098 Return Value:
   1099 -----------------------------------------------------------------------------*/
   1100 ULONG
   1101 UtilNetworkTypeInUseSet(
   1102 					   PTIWLN_ADAPTER_T pAdapter,
   1103 					   PUCHAR pData,
   1104 					   ULONG Length
   1105 					   )
   1106 {
   1107 	ULONG retValue;
   1108 	retValue = UtilSetParam(pAdapter, SITE_MGR_DESIRED_DOT11_MODE_PARAM, pData, sizeof(ULONG));
   1109 	return retValue;
   1110 }
   1111 
   1112 
   1113 /*-----------------------------------------------------------------------------
   1114 Routine Name: UtilSetPacketBursting
   1115 Routine Description:
   1116 Arguments:
   1117 Return Value:
   1118 -----------------------------------------------------------------------------*/
   1119 ULONG
   1120 UtilSetPacketBursting(
   1121 					 PTIWLN_ADAPTER_T pAdapter,
   1122 					 PUCHAR pData,
   1123 					 ULONG Length
   1124 					 )
   1125 {
   1126 	paramInfo_t Param;
   1127 	TI_STATUS Status;
   1128 
   1129 	Param.paramType = QOS_PACKET_BURST_ENABLE;
   1130 	Param.content.qosPacketBurstEnb = *((UINT8*)pData);
   1131 	Status = configMgr_setParam(pAdapter->CoreHalCtx, &Param);
   1132 	return Status;
   1133 }
   1134 
   1135 
   1136 /*-----------------------------------------------------------------------------
   1137 Routine Name: UtilSetMixedMode
   1138 Routine Description:
   1139 Arguments:
   1140 Return Value:
   1141 -----------------------------------------------------------------------------*/
   1142 ULONG
   1143 UtilSetMixedMode(
   1144 				PTIWLN_ADAPTER_T pAdapter,
   1145 				PUCHAR pData,
   1146 				ULONG Length
   1147 				)
   1148 {
   1149 	paramInfo_t Param;
   1150 	TI_STATUS Status;
   1151 
   1152 	Param.paramType = RSN_MIXED_MODE;
   1153 	Param.content.rsnMixedMode = *((UINT32*)pData);
   1154 	Status = configMgr_setParam(pAdapter->CoreHalCtx, &Param);
   1155 
   1156 	return Status;
   1157 }
   1158 
   1159 
   1160 /*-----------------------------------------------------------------------------
   1161 Routine Name: UtilPowerModeSet
   1162 Routine Description:
   1163 Arguments:
   1164 Return Value:
   1165 -----------------------------------------------------------------------------*/
   1166 ULONG
   1167 UtilPowerModeSet(
   1168 				PTIWLN_ADAPTER_T pAdapter,
   1169 				PUCHAR pData,
   1170 				ULONG Length
   1171 				)
   1172 {
   1173 	ULONG retValue;
   1174 	PowerMgr_PowerMode_t PowerMgr_PowerMode;
   1175 	PowerMgr_PowerMode.PowerMode = (PowerMgr_PowerMode_e)*pData;
   1176 	PowerMgr_PowerMode.powerMngPriority = POWER_MANAGER_USER_PRIORITY;
   1177 	retValue = UtilSetParam(pAdapter, POWER_MGR_POWER_MODE,(PUCHAR)&PowerMgr_PowerMode, sizeof(PowerMgr_PowerMode));
   1178 	return retValue;
   1179 }
   1180 
   1181 
   1182 /*-----------------------------------------------------------------------------
   1183 Routine Name: UtilPowerModeGet
   1184 Routine Description:
   1185 Arguments:
   1186 Return Value:
   1187 -----------------------------------------------------------------------------*/
   1188 ULONG
   1189 UtilPowerModeGet(
   1190 				PTIWLN_ADAPTER_T pAdapter,
   1191 				PUCHAR pData,
   1192 				PULONG Length
   1193 				)
   1194 {
   1195 	ULONG retValue;
   1196 	retValue = UtilGetParam(pAdapter, POWER_MGR_POWER_MODE, pData, sizeof(PowerMgr_PowerMode_e));
   1197 	*Length = sizeof(PowerMgr_PowerMode_e);
   1198 	return retValue;
   1199 }
   1200 
   1201 
   1202 
   1203 /*-----------------------------------------------------------------------------
   1204 Routine Name: UtilPowerLevelPSGet
   1205 Routine Description:
   1206 Arguments:
   1207 Return Value:
   1208 -----------------------------------------------------------------------------*/
   1209 ULONG
   1210 UtilPowerLevelPSGet(
   1211 				   PTIWLN_ADAPTER_T pAdapter,
   1212 				   PUCHAR pData,
   1213 				   PULONG Length
   1214 				   )
   1215 {
   1216 	ULONG retValue;
   1217 	retValue = UtilGetParam(pAdapter, POWER_MGR_POWER_LEVEL_PS, pData, sizeof(powerAutho_PowerPolicy_e));
   1218 	*Length = sizeof(powerAutho_PowerPolicy_e);
   1219 	return retValue;
   1220 }
   1221 
   1222 /*-----------------------------------------------------------------------------
   1223 Routine Name: UtilPowerLevelPSSet
   1224 Routine Description:
   1225 Arguments:
   1226 Return Value:
   1227 -----------------------------------------------------------------------------*/
   1228 ULONG
   1229 UtilPowerLevelPSSet(
   1230 				   PTIWLN_ADAPTER_T pAdapter,
   1231 				   PUCHAR pData,
   1232 				   PULONG Length
   1233 				   )
   1234 {
   1235 	ULONG retValue;
   1236 	retValue = UtilSetParam(pAdapter, POWER_MGR_POWER_LEVEL_PS, pData, sizeof(powerAutho_PowerPolicy_e));
   1237 	*Length = sizeof(powerAutho_PowerPolicy_e);
   1238 	return retValue;
   1239 }
   1240 
   1241 /*-----------------------------------------------------------------------------
   1242 Routine Name: UtilPowerLevelDefaultGet
   1243 Routine Description:
   1244 Arguments:
   1245 Return Value:
   1246 -----------------------------------------------------------------------------*/
   1247 ULONG
   1248 UtilPowerLevelDefaultGet(
   1249 						PTIWLN_ADAPTER_T pAdapter,
   1250 						PUCHAR pData,
   1251 						PULONG Length
   1252 						)
   1253 {
   1254 	ULONG retValue;
   1255 	retValue = UtilGetParam(pAdapter, POWER_MGR_POWER_LEVEL_DEFAULT, pData, sizeof(powerAutho_PowerPolicy_e));
   1256 	*Length = sizeof(powerAutho_PowerPolicy_e);
   1257 	return retValue;
   1258 }
   1259 
   1260 /*-----------------------------------------------------------------------------
   1261 Routine Name: UtilPowerLevelDefaultSet
   1262 Routine Description:
   1263 Arguments:
   1264 Return Value:
   1265 -----------------------------------------------------------------------------*/
   1266 ULONG
   1267 UtilPowerLevelDefaultSet(
   1268 						PTIWLN_ADAPTER_T pAdapter,
   1269 						PUCHAR pData,
   1270 						PULONG Length
   1271 						)
   1272 {
   1273 	ULONG retValue;
   1274 	retValue = UtilSetParam(pAdapter, POWER_MGR_POWER_LEVEL_DEFAULT, pData, sizeof(powerAutho_PowerPolicy_e));
   1275 	*Length = sizeof(powerAutho_PowerPolicy_e);
   1276 	return retValue;
   1277 }
   1278 
   1279 /*-----------------------------------------------------------------------------
   1280 Routine Name: UtilPowerLevelDozeModeGet
   1281 Routine Description:
   1282 Arguments:
   1283 Return Value:
   1284 -----------------------------------------------------------------------------*/
   1285 ULONG
   1286 UtilPowerLevelDozeModeGet(
   1287     PTIWLN_ADAPTER_T pAdapter,
   1288     PUCHAR pData,
   1289     PULONG Length
   1290     )
   1291 {
   1292    ULONG retValue;
   1293    retValue = UtilGetParam(pAdapter, POWER_MGR_POWER_LEVEL_DOZE_MODE, pData, sizeof(PowerMgr_PowerMode_e));
   1294    *Length = sizeof(PowerMgr_PowerMode_e);
   1295    return retValue;
   1296 }
   1297 
   1298 /*-----------------------------------------------------------------------------
   1299 Routine Name: UtilPowerLevelDozeModeSet
   1300 Routine Description:
   1301 Arguments:
   1302 Return Value:
   1303 -----------------------------------------------------------------------------*/
   1304 ULONG
   1305 UtilPowerLevelDozeModeSet(
   1306     PTIWLN_ADAPTER_T pAdapter,
   1307     PUCHAR pData,
   1308     PULONG Length
   1309     )
   1310 {
   1311    ULONG retValue;
   1312    retValue = UtilSetParam(pAdapter, POWER_MGR_POWER_LEVEL_DOZE_MODE, pData, sizeof(PowerMgr_PowerMode_e));
   1313    *Length = sizeof(PowerMgr_PowerMode_e);
   1314    return retValue;
   1315 }
   1316 
   1317 
   1318 /*-----------------------------------------------------------------------------
   1319 Routine Name: UtilBeaconFilterDesiredStateSet
   1320 Routine Description:
   1321 Arguments:
   1322 Return Value:
   1323 -----------------------------------------------------------------------------*/
   1324 ULONG
   1325 UtilBeaconFilterDesiredStateSet(
   1326 							   PTIWLN_ADAPTER_T pAdapter,
   1327 							   PUCHAR pData,
   1328 							   PULONG Length
   1329 							   )
   1330 {
   1331 	ULONG retValue;
   1332 
   1333 	retValue = UtilSetParam(pAdapter, SITE_MGR_BEACON_FILTER_DESIRED_STATE_PARAM, pData, sizeof(UINT8));
   1334 	*Length = sizeof(UINT8);
   1335 	return retValue;
   1336 }
   1337 
   1338 /*-----------------------------------------------------------------------------
   1339 Routine Name: UtilBeaconFilterDesiredStateGet
   1340 Routine Description: gets the current beacon filter state
   1341 Arguments:
   1342 Return Value:
   1343 -----------------------------------------------------------------------------*/
   1344 ULONG
   1345 UtilBeaconFilterDesiredStateGet(
   1346 							   PTIWLN_ADAPTER_T pAdapter,
   1347 							   PUCHAR pData,
   1348 							   PULONG Length
   1349 							   )
   1350 {
   1351 	ULONG retValue;
   1352 	retValue = UtilGetParam(pAdapter, SITE_MGR_BEACON_FILTER_DESIRED_STATE_PARAM, pData, sizeof(UINT8));
   1353 	*Length = sizeof(UINT8);
   1354 	return retValue;
   1355 }
   1356 
   1357 
   1358 /*-----------------------------------------------------------------------------
   1359 Routine Name: UtilBssidListGet
   1360 Routine Description:
   1361 Arguments:
   1362 Return Value:
   1363 -----------------------------------------------------------------------------*/
   1364 ULONG
   1365 UtilBssidListGet(
   1366 				PTIWLN_ADAPTER_T pAdapter,
   1367 				PUCHAR pData,
   1368 				PULONG Length,
   1369 				BOOLEAN ExtBssid,
   1370 				BOOLEAN allVarIes
   1371 				)
   1372 {
   1373 	OS_802_11_BSSID_LIST_EX* pListEx;
   1374 	OS_802_11_BSSID_EX* pBssidEx;
   1375 	OS_802_11_BSSID* pBssid;
   1376 	OS_802_11_BSSID_LIST* pList;
   1377 	paramInfo_t Param;
   1378 	ULONG RetSize, i;
   1379 	TI_STATUS Status;
   1380 	PUCHAR pTempData=NULL;
   1381 	ULONG LocalLength = sizeof(OS_802_11_BSSID_LIST_EX)+NUM_OF_SITE_TABLE*MAX_SITES_BG_BAND*sizeof(OS_802_11_BSSID);
   1382 
   1383 
   1384 	/******  At the callback of RSSI update the RSSI in the Site TAble in the Site Manager *
   1385 	 Update Site Table in order to represent the RSSI of current AP correctly in the utility
   1386 	param.paramType = SITE_MGR_CURRENT_SIGNAL_PARAM;
   1387 	param.content.siteMgrCurrentSignal.rssi = pCurrBSS->averageRssi;
   1388 	siteMgr_setParam(pCurrBSS->hSiteMgr, &param);
   1389 	***************************************/
   1390 
   1391 
   1392 	if (allVarIes)
   1393 	{
   1394 		Param.paramType = SITE_MGR_BSSID_FULL_LIST_PARAM;
   1395 	} else
   1396 	{
   1397 		Param.paramType = SITE_MGR_BSSID_LIST_PARAM;
   1398 	}
   1399 
   1400 	if (ExtBssid)
   1401 	{
   1402 		*(PULONG)&Param.content = (ULONG)pData;
   1403 		Param.paramLength = *Length;
   1404 	} else
   1405 	{
   1406 		if (*Length)
   1407 		{
   1408 			pTempData = os_memoryAlloc(pAdapter, LocalLength);
   1409 
   1410 			if (!pTempData)
   1411 			{
   1412 				*(PULONG)pData = LocalLength;
   1413 				*Length = 0;
   1414 				return NOK;
   1415 			}
   1416 
   1417 			*(PULONG)&Param.content = (ULONG)pTempData;
   1418 			Param.paramLength = *Length;
   1419 		} else
   1420 		{
   1421 			*Length = LocalLength;
   1422 			return NOK;
   1423 		}
   1424 	}
   1425 
   1426 	Status = configMgr_getParam(pAdapter->CoreHalCtx, &Param);
   1427 
   1428 	if (!(*Length))
   1429 	{
   1430 
   1431 		*Length = Param.paramLength * 4;
   1432 		return NOK;
   1433 
   1434 	}
   1435 
   1436 	if (Status != OK)
   1437 	{
   1438 		*(PULONG)pData = Param.paramLength;
   1439 		PRINT(DBG_IOCTL_LOUD, "...More buffer space needed\n");
   1440 		if (!ExtBssid)
   1441 			os_memoryFree(pAdapter, pTempData, LocalLength);
   1442 
   1443 		*Length = 0;
   1444 		return NOK;
   1445 
   1446 	}
   1447 
   1448 	if (!ExtBssid)
   1449 	{
   1450 
   1451 		pListEx = (OS_802_11_BSSID_LIST_EX*) pTempData;
   1452 
   1453 		if (pListEx->NumberOfItems)
   1454 		{
   1455 
   1456 			if ((sizeof(OS_802_11_BSSID_LIST) +
   1457 				 sizeof(OS_802_11_BSSID)*pListEx->NumberOfItems -
   1458 				 sizeof(OS_802_11_BSSID)) > *Length)
   1459 			{
   1460 				PRINT(DBG_IOCTL_LOUD, "Utility buffer is too small\n");
   1461 				os_memoryFree(pAdapter, pTempData, LocalLength);
   1462 				*Length = 0;
   1463 				return NOK;
   1464 			}
   1465             if (pListEx->NumberOfItems >
   1466                 ((0xFFFFFFFFUL - ((ULONG)sizeof(OS_802_11_BSSID_LIST) - 1)) /
   1467                  (ULONG)sizeof(OS_802_11_BSSID) + 1)) /* Dm: Security fix */
   1468             {
   1469                 printk("TI: %s - Security Error\n", __FUNCTION__);
   1470                 PRINT(DBG_IOCTL_LOUD, "Number of AP is too big\n");
   1471                 os_memoryFree(pAdapter, pTempData, LocalLength);
   1472                 *Length = 0;
   1473                 return NOK;
   1474             }
   1475 
   1476             pList = (OS_802_11_BSSID_LIST *)pData;
   1477 			pList->NumberOfItems = pListEx->NumberOfItems;
   1478 
   1479 			*Length = RetSize = sizeof(OS_802_11_BSSID_LIST) +
   1480 					  sizeof(OS_802_11_BSSID)*pList->NumberOfItems -
   1481 					  sizeof(OS_802_11_BSSID);
   1482 
   1483 			pBssidEx = pListEx->Bssid;
   1484 
   1485 			for (i=0; i<pListEx->NumberOfItems; i++)
   1486 			{
   1487 
   1488 				pBssid = (OS_802_11_BSSID*) pBssidEx;
   1489 
   1490 				NdisMoveMemory(&pList->Bssid[i], pBssid,
   1491 							   sizeof(OS_802_11_BSSID));
   1492 
   1493 				pList->Bssid[i].Length = sizeof(OS_802_11_BSSID);
   1494 
   1495 				pBssidEx = (OS_802_11_BSSID_EX*) ((PUCHAR)pBssidEx +
   1496 												  pBssidEx->Length);
   1497 
   1498 			}
   1499 
   1500 		}
   1501 
   1502 		else
   1503 		{
   1504 
   1505 			pList = (OS_802_11_BSSID_LIST*) pData;
   1506 			pList->NumberOfItems = 0;
   1507 
   1508 			RetSize = sizeof(OS_802_11_BSSID_LIST);
   1509 			*Length = RetSize;
   1510 
   1511 		}
   1512 
   1513 		PRINT(DBG_IOCTL_LOUD, "...Copy done.\n");
   1514 
   1515 		os_memoryFree(pAdapter, pTempData, LocalLength);
   1516 
   1517 	}
   1518 
   1519 	else
   1520 	{
   1521 
   1522 		RetSize = Param.paramLength;
   1523 		*Length = RetSize;
   1524 
   1525 	}
   1526 
   1527 	return OK;
   1528 }
   1529 
   1530 
   1531 /*-----------------------------------------------------------------------------
   1532 Routine Name: UtilStartAppScanSet
   1533 Routine Description:
   1534 Arguments:
   1535 Return Value:
   1536 -----------------------------------------------------------------------------*/
   1537 ULONG
   1538 UtilStartAppScanSet(
   1539 				   PTIWLN_ADAPTER_T pAdapter,
   1540 				   PUCHAR pData,
   1541 				   ULONG Length
   1542 				   )
   1543 {
   1544 	ULONG retValue;
   1545 	/* scan concentrator will start an application scan */
   1546 	retValue = UtilSetParam(pAdapter, SCAN_CNCN_START_APP_SCAN, (PUCHAR)&pData, sizeof(PUCHAR));
   1547 	return retValue;
   1548 }
   1549 
   1550 
   1551 /*-----------------------------------------------------------------------------
   1552 Routine Name: UtilStopAppScanSet
   1553 Routine Description:
   1554 Arguments:
   1555 Return Value:
   1556 -----------------------------------------------------------------------------*/
   1557 ULONG
   1558 UtilStopAppScanSet(
   1559 				  PTIWLN_ADAPTER_T pAdapter,
   1560 				  PUCHAR pData,
   1561 				  ULONG Length
   1562 				  )
   1563 {
   1564 	ULONG retValue;
   1565 	/* scan concentrator will stop the running application scan (if any) */
   1566 	retValue = UtilSetParam(pAdapter, SCAN_CNCN_STOP_APP_SCAN, NULL, 0);
   1567 	return retValue;
   1568 }
   1569 
   1570 
   1571 /*-----------------------------------------------------------------------------
   1572 Routine Name: UtilScanPolicyParamSet
   1573 Routine Description:
   1574 Arguments:
   1575 Return Value:
   1576 -----------------------------------------------------------------------------*/
   1577 ULONG
   1578 UtilScanPolicyParamSet(
   1579 					  PTIWLN_ADAPTER_T pAdapter,
   1580 					  PUCHAR pData,
   1581 					  ULONG Length
   1582 					  )
   1583 {
   1584 	ULONG retValue;
   1585 
   1586 	applicationConfigBuffer_t applicationConfigBuffer;
   1587 
   1588 	applicationConfigBuffer.buffer = pData;
   1589 	applicationConfigBuffer.bufferSize = (UINT16)Length;
   1590 
   1591 	/* set the scan manager policy */
   1592 	retValue = UtilSetParam( pAdapter, SCAN_MNGR_SET_CONFIGURATION, (PUCHAR)&applicationConfigBuffer, sizeof(applicationConfigBuffer_t) );
   1593 
   1594 	return retValue;
   1595 }
   1596 
   1597 
   1598 /*-----------------------------------------------------------------------------
   1599 Routine Name: UtilScanBssListGet
   1600 Routine Description:
   1601 Arguments:
   1602 Return Value:
   1603 -----------------------------------------------------------------------------*/
   1604 ULONG
   1605 UtilScanBssListGet(
   1606 				  PTIWLN_ADAPTER_T pAdapter,
   1607 				  PUCHAR pData,
   1608 				  PULONG Length
   1609 				  )
   1610 {
   1611 	paramInfo_t param;
   1612 	TI_STATUS status;
   1613 
   1614 	param.paramType = SCAN_MNGR_BSS_LIST_GET;
   1615 	param.paramLength = sizeof(PUCHAR);
   1616 
   1617 	status = configMgr_getParam(pAdapter->CoreHalCtx, &param);
   1618 
   1619 	NdisMoveMemory( pData, param.content.pScanBssList, *Length );
   1620 	*Length = sizeof(bssList_t);
   1621 
   1622 	return status;
   1623 }
   1624 
   1625 
   1626 /*-----------------------------------------------------------------------------
   1627 Routine Name: UtilBssidListScanOid
   1628 Routine Description:
   1629 Arguments:
   1630 Return Value:
   1631 -----------------------------------------------------------------------------*/
   1632 ULONG
   1633 UtilBssidListScanOid(
   1634 					PTIWLN_ADAPTER_T pAdapter,
   1635 					PUCHAR pData,
   1636 					ULONG Length
   1637 					)
   1638 {
   1639 	TI_STATUS Status;
   1640 //TRS: Scan changes from TI
   1641     Status = UtilSetParam(pAdapter, SCAN_CNCN_BSSID_LIST_SCAN_PARAM, pData, 0);
   1642 //TRS: end of Scan changes from TI
   1643 	return Status;
   1644 }
   1645 
   1646 
   1647 /*-----------------------------------------------------------------------------
   1648 Routine Name: UtilInfrastructureModeGet
   1649 Routine Description:
   1650 Arguments:
   1651 Return Value:
   1652 -----------------------------------------------------------------------------*/
   1653 ULONG
   1654 UtilInfrastructureModeGet(
   1655 						 PTIWLN_ADAPTER_T pAdapter,
   1656 						 PUCHAR pData,
   1657 						 PULONG Length
   1658 						 )
   1659 {
   1660 	ULONG retValue;
   1661 
   1662 	if (!Length)
   1663 		return NOK;
   1664 
   1665 	retValue = UtilGetParam(pAdapter, CTRL_DATA_CURRENT_BSS_TYPE_PARAM, pData, sizeof(bssType_e));
   1666 	*Length = sizeof(ULONG);
   1667 	return(retValue);
   1668 }
   1669 
   1670 
   1671 /*-----------------------------------------------------------------------------
   1672 Routine Name: UtilDesiredInfrastructureModeGet
   1673 Routine Description:
   1674 Arguments:
   1675 Return Value:
   1676 -----------------------------------------------------------------------------*/
   1677 ULONG
   1678 UtilDesiredInfrastructureModeGet(
   1679 								PTIWLN_ADAPTER_T pAdapter,
   1680 								PUCHAR pData,
   1681 								PULONG Length
   1682 								)
   1683 {
   1684 	ULONG retValue;
   1685 
   1686 	if (!Length)
   1687 		return NOK;
   1688 
   1689 	retValue = UtilGetParam(pAdapter, SITE_MGR_DESIRED_BSS_TYPE_PARAM, pData, sizeof(bssType_e));
   1690 
   1691 	*Length = sizeof(ULONG);
   1692 	return retValue;
   1693 }
   1694 
   1695 
   1696 /*-----------------------------------------------------------------------------
   1697 Routine Name: UtilInfrastructureModeSet
   1698 Routine Description:
   1699 Arguments:
   1700 Return Value:
   1701 -----------------------------------------------------------------------------*/
   1702 ULONG
   1703 UtilInfrastructureModeSet(
   1704 						 PTIWLN_ADAPTER_T pAdapter,
   1705 						 PUCHAR pData,
   1706 						 ULONG Length
   1707 						 )
   1708 {
   1709 	ULONG retValue;
   1710 	retValue = UtilSetParam(pAdapter, SITE_MGR_DESIRED_BSS_TYPE_PARAM, pData, sizeof(bssType_e));
   1711 	return retValue;
   1712 }
   1713 
   1714 
   1715 /*-----------------------------------------------------------------------------
   1716 Routine Name: UtilFragmentationThresholdGet
   1717 Routine Description:
   1718 Arguments:
   1719 Return Value:
   1720 -----------------------------------------------------------------------------*/
   1721 ULONG
   1722 UtilFragmentationThresholdGet(
   1723 							 PTIWLN_ADAPTER_T pAdapter,
   1724 							 PUCHAR pData,
   1725 							 PULONG Length
   1726 							 )
   1727 {
   1728 	UINT16 FragThreshold;
   1729 	ULONG retValue;
   1730 
   1731 	if (!Length)
   1732 	{
   1733 		*Length = sizeof(ULONG);
   1734 		return NOK;
   1735 	}
   1736 
   1737 	retValue = UtilGetParam(pAdapter, HAL_CTRL_FRAG_THRESHOLD_PARAM, pData, sizeof(ULONG));
   1738 
   1739 	FragThreshold = *(PUINT16)pData;
   1740 	*(PULONG)pData = FragThreshold;
   1741 
   1742 	*Length = sizeof(ULONG);
   1743 	return retValue;
   1744 }
   1745 
   1746 
   1747 /*-----------------------------------------------------------------------------
   1748 Routine Name: UtilFragmentationThresholdSet
   1749 Routine Description:
   1750 Arguments:
   1751 Return Value:
   1752 -----------------------------------------------------------------------------*/
   1753 ULONG
   1754 UtilFragmentationThresholdSet(
   1755 							 PTIWLN_ADAPTER_T pAdapter,
   1756 							 PUCHAR pData,
   1757 							 ULONG Length
   1758 							 )
   1759 {
   1760 	UINT16 FragThreshold = (UINT16) *(PULONG)pData;
   1761 	ULONG retValue;
   1762 
   1763 	FragThreshold = ((FragThreshold+1)>>1) << 1; /*make it always even(GreenA)*/
   1764 	retValue = UtilSetParam(pAdapter, HAL_CTRL_FRAG_THRESHOLD_PARAM, (PUCHAR)&FragThreshold, sizeof(UINT16));
   1765 
   1766 	return retValue;
   1767 }
   1768 
   1769 
   1770 /*-----------------------------------------------------------------------------
   1771 Routine Name: UtilRtsThresholdGet
   1772 Routine Description:
   1773 Arguments:
   1774 Return Value:
   1775 -----------------------------------------------------------------------------*/
   1776 ULONG
   1777 UtilRtsThresholdGet(
   1778 				   PTIWLN_ADAPTER_T pAdapter,
   1779 				   PUCHAR pData,
   1780 				   PULONG Length
   1781 				   )
   1782 {
   1783 	UINT16 RtsThreshold;
   1784 	ULONG retValue;
   1785 
   1786 	if (!Length)
   1787 	{
   1788 		*Length = sizeof(ULONG);
   1789 		return NOK;
   1790 	}
   1791 
   1792 	retValue = UtilGetParam(pAdapter, HAL_CTRL_RTS_THRESHOLD_PARAM, pData, sizeof(ULONG));
   1793 
   1794 	RtsThreshold = *(PUINT16)pData;
   1795 	*(PULONG)pData = RtsThreshold;
   1796 	*Length = sizeof (ULONG);
   1797 
   1798 	return retValue;
   1799 }
   1800 
   1801 
   1802 /*-----------------------------------------------------------------------------
   1803 Routine Name: UtilSupportedRates
   1804 Routine Description:
   1805 Arguments:
   1806 Return Value:
   1807 -----------------------------------------------------------------------------*/
   1808 ULONG
   1809 UtilSupportedRates(
   1810 				  PTIWLN_ADAPTER_T pAdapter,
   1811 				  PUCHAR pData,
   1812 				  PULONG Length
   1813 				  )
   1814 {
   1815 	rates_t rateSet;
   1816 	ULONG retValue;
   1817 
   1818 	retValue = UtilGetParam(pAdapter, SITE_MGR_DESIRED_SUPPORTED_RATE_SET_PARAM, (PUCHAR)&rateSet, sizeof(rates_t));
   1819 
   1820 	NdisMoveMemory(pData, (PUCHAR)&rateSet, *Length);
   1821 	*Length = rateSet.len +1; /* 1 is added for the length field itself */
   1822 
   1823 	return retValue;
   1824 }
   1825 
   1826 
   1827 /*-----------------------------------------------------------------------------
   1828 Routine Name: UtilSupportedRatesSet
   1829 Routine Description:
   1830 Arguments:
   1831 Return Value:
   1832 -----------------------------------------------------------------------------*/
   1833 ULONG
   1834 UtilSupportedRatesSet(
   1835 					 PTIWLN_ADAPTER_T pAdapter,
   1836 					 PUCHAR pData,
   1837 					 ULONG Length
   1838 					 )
   1839 {
   1840 	rates_t rateSet;
   1841 	ULONG retValue;
   1842 
   1843 	NdisMoveMemory(&rateSet, pData, Length);
   1844 
   1845 	retValue = UtilSetParam(pAdapter, SITE_MGR_DESIRED_SUPPORTED_RATE_SET_PARAM, (PUCHAR)&rateSet, sizeof(rates_t));
   1846 
   1847 	return retValue;
   1848 }
   1849 
   1850 
   1851 /*-----------------------------------------------------------------------------
   1852 Routine Name: UtilRtsThresholdSet
   1853 Routine Description:
   1854 Arguments:
   1855 Return Value:
   1856 -----------------------------------------------------------------------------*/
   1857 ULONG
   1858 UtilRtsThresholdSet(
   1859 				   PTIWLN_ADAPTER_T pAdapter,
   1860 				   PUCHAR pData,
   1861 				   ULONG Length
   1862 				   )
   1863 {
   1864 	UINT16 RtsThreshold = (UINT16) *(PULONG)pData;
   1865 	ULONG retValue;
   1866 
   1867 	retValue = UtilSetParam(pAdapter, HAL_CTRL_RTS_THRESHOLD_PARAM,
   1868 							(PUCHAR)&RtsThreshold, sizeof(UINT16));
   1869 
   1870 	return retValue;
   1871 
   1872 }
   1873 
   1874 
   1875 /*-----------------------------------------------------------------------------
   1876 Routine Name: UtilChannelGet
   1877 Routine Description:
   1878 Arguments:
   1879 Return Value:
   1880 -----------------------------------------------------------------------------*/
   1881 ULONG
   1882 UtilChannelGet(
   1883 			  PTIWLN_ADAPTER_T pAdapter,
   1884 			  PUCHAR pData,
   1885 			  PULONG Length
   1886 			  )
   1887 {
   1888 	ULONG Channel,retValue;
   1889 
   1890 	if (!Length)
   1891 		return NOK;
   1892 
   1893 	retValue = UtilGetParam(pAdapter, SITE_MGR_CURRENT_CHANNEL_PARAM, pData, sizeof(ULONG));
   1894 
   1895 	Channel = *(PUCHAR)pData;
   1896 	*(PULONG)pData = (ULONG) Channel;
   1897 	*Length = sizeof (ULONG);
   1898 
   1899 	return retValue;
   1900 }
   1901 
   1902 
   1903 /*-----------------------------------------------------------------------------
   1904 Routine Name: UtilDesiredChannelGet
   1905 Routine Description:
   1906 Arguments:
   1907 Return Value:
   1908 -----------------------------------------------------------------------------*/
   1909 ULONG
   1910 UtilDesiredChannelGet(
   1911 					 PTIWLN_ADAPTER_T pAdapter,
   1912 					 PUCHAR pData,
   1913 					 PULONG Length
   1914 					 )
   1915 {
   1916 	ULONG Channel,retValue;
   1917 
   1918 	if (!Length)
   1919 		return NOK;
   1920 
   1921 	retValue = UtilGetParam(pAdapter, SITE_MGR_DESIRED_CHANNEL_PARAM, pData, sizeof(ULONG));
   1922 
   1923 	Channel = *(PUCHAR)pData;
   1924 	*(PULONG)pData = (ULONG) Channel;
   1925 	*Length = sizeof (ULONG);
   1926 
   1927 	return retValue;
   1928 
   1929 }
   1930 
   1931 
   1932 /*-----------------------------------------------------------------------------
   1933 Routine Name: UtilDesiredChannelSet
   1934 Routine Description:
   1935 Arguments:
   1936 Return Value:
   1937 -----------------------------------------------------------------------------*/
   1938 ULONG
   1939 UtilDesiredChannelSet(
   1940 					 PTIWLN_ADAPTER_T pAdapter,
   1941 					 PUCHAR pData,
   1942 					 ULONG Length
   1943 					 )
   1944 {
   1945 	UINT8 Channel = *pData;
   1946 	ULONG retValue;
   1947 
   1948 	retValue = UtilSetParam(pAdapter, SITE_MGR_DESIRED_CHANNEL_PARAM, &Channel, sizeof(UCHAR));
   1949 
   1950 	return retValue;
   1951 
   1952 }
   1953 
   1954 
   1955 /*-----------------------------------------------------------------------------
   1956 Routine Name: UtilShortPreambleGet
   1957 Routine Description:
   1958 Arguments:
   1959 Return Value:
   1960 -----------------------------------------------------------------------------*/
   1961 ULONG
   1962 UtilShortPreambleGet(
   1963 					PTIWLN_ADAPTER_T pAdapter,
   1964 					PUCHAR pData,
   1965 					PULONG Length
   1966 					)
   1967 {
   1968 	ULONG retValue;
   1969 	if (!Length)
   1970 	{
   1971 		*Length = sizeof(ULONG);
   1972 		return NOK;
   1973 	}
   1974 
   1975 	retValue = UtilGetParam(pAdapter, SITE_MGR_DESIRED_PREAMBLE_TYPE_PARAM, pData, sizeof(ULONG));
   1976 
   1977 	*Length = sizeof (ULONG);
   1978 
   1979 	return retValue;
   1980 
   1981 }
   1982 
   1983 
   1984 /*-----------------------------------------------------------------------------
   1985 Routine Name: UtilShortPreambleSet
   1986 Routine Description:
   1987 Arguments:
   1988 Return Value:
   1989 -----------------------------------------------------------------------------*/
   1990 ULONG
   1991 UtilShortPreambleSet(
   1992 					PTIWLN_ADAPTER_T pAdapter,
   1993 					PUCHAR pData,
   1994 					ULONG Length
   1995 					)
   1996 {
   1997 	ULONG retValue;
   1998 	retValue = UtilSetParam(pAdapter, SITE_MGR_DESIRED_PREAMBLE_TYPE_PARAM,
   1999 							pData, sizeof(ULONG));
   2000 
   2001 	return retValue;
   2002 
   2003 }
   2004 
   2005 
   2006 /*-----------------------------------------------------------------------------
   2007 Routine Name: UtilRegulatoryDomain_enableDisable_802_11d
   2008 Routine Description:
   2009 Arguments:
   2010 Return Value:
   2011 -----------------------------------------------------------------------------*/
   2012 ULONG
   2013 UtilRegulatoryDomain_enableDisable_802_11d(
   2014 										  PTIWLN_ADAPTER_T pAdapter,
   2015 										  PUCHAR pData,
   2016 										  ULONG Length
   2017 										  )
   2018 {
   2019 	ULONG retValue;
   2020 	retValue = UtilSetParam(pAdapter, REGULATORY_DOMAIN_ENABLE_DISABLE_802_11D, pData, sizeof(UINT8));
   2021 
   2022 	return retValue;
   2023 
   2024 }
   2025 
   2026 /*-----------------------------------------------------------------------------
   2027 Routine Name: UtilRegulatoryDomain_enableDisable_802_11h
   2028 Routine Description:
   2029 Arguments:
   2030 Return Value:
   2031 -----------------------------------------------------------------------------*/
   2032 ULONG
   2033 UtilRegulatoryDomain_enableDisable_802_11h(
   2034 										  PTIWLN_ADAPTER_T pAdapter,
   2035 										  PUCHAR pData,
   2036 										  ULONG Length
   2037 										  )
   2038 {
   2039 	ULONG retValue;
   2040 	retValue = UtilSetParam(pAdapter, REGULATORY_DOMAIN_ENABLE_DISABLE_802_11H, pData, sizeof(UINT8));
   2041 
   2042 	return retValue;
   2043 
   2044 }
   2045 
   2046 
   2047 /*-----------------------------------------------------------------------------
   2048 Routine Name: UtilRegulatoryDomain_Get_802_11d
   2049 Routine Description:
   2050 Arguments:
   2051 Return Value:
   2052 -----------------------------------------------------------------------------*/
   2053 ULONG
   2054 UtilRegulatoryDomain_Get_802_11d(
   2055 								PTIWLN_ADAPTER_T pAdapter,
   2056 								PUCHAR pData,
   2057 								PULONG Length
   2058 								)
   2059 {
   2060 	ULONG retValue;
   2061 	retValue = UtilGetParam(pAdapter, REGULATORY_DOMAIN_ENABLED_PARAM, pData, sizeof(UINT8));
   2062 
   2063 	return retValue;
   2064 
   2065 }
   2066 
   2067 /*-----------------------------------------------------------------------------
   2068 Routine Name: UtilRegulatoryDomain_Get_802_11h
   2069 Routine Description:
   2070 Arguments:
   2071 Return Value:
   2072 -----------------------------------------------------------------------------*/
   2073 ULONG
   2074 UtilRegulatoryDomain_Get_802_11h(
   2075 								PTIWLN_ADAPTER_T pAdapter,
   2076 								PUCHAR pData,
   2077 								PULONG Length
   2078 								)
   2079 {
   2080 	ULONG retValue;
   2081 	retValue = UtilGetParam(pAdapter, REGULATORY_DOMAIN_MANAGEMENT_CAPABILITY_ENABLED_PARAM, pData, sizeof(UINT8));
   2082 
   2083 	return retValue;
   2084 
   2085 }
   2086 
   2087 /*-----------------------------------------------------------------------------
   2088 Routine Name: UtilRegulatoryDomain_setCountryIE
   2089 Routine Description:
   2090 Arguments:
   2091 Return Value:
   2092 -----------------------------------------------------------------------------*/
   2093 static TI_STATUS
   2094 UtilRegulatoryDomain_setCountryIE(
   2095 								 PTIWLN_ADAPTER_T pAdapter,
   2096 								 externalParam_e ParamType,
   2097 								 PUCHAR pData,
   2098 								 ULONG Length
   2099 								 )
   2100 {
   2101 	paramInfo_t Param;
   2102 	TI_STATUS Status;
   2103 	country_t  countryIe;
   2104 
   2105 	Param.paramType = ParamType;
   2106 	Param.paramLength = sizeof(country_t);
   2107 	NdisMoveMemory(&countryIe, pData, Length);
   2108 
   2109 	Param.content.pCountry = &countryIe;
   2110 	Status = configMgr_setParam(pAdapter->CoreHalCtx, &Param);
   2111 
   2112 	return Status;
   2113 
   2114 }
   2115 
   2116 
   2117 /*-----------------------------------------------------------------------------
   2118 Routine Name: UtilRegulatoryDomain_setCountryIE_2_4
   2119 Routine Description:
   2120 Arguments:
   2121 Return Value:
   2122 -----------------------------------------------------------------------------*/
   2123 ULONG
   2124 UtilRegulatoryDomain_setCountryIE_2_4(
   2125 									 PTIWLN_ADAPTER_T pAdapter,
   2126 									 PUCHAR pData,
   2127 									 ULONG Length)
   2128 {
   2129 	ULONG retValue;
   2130 
   2131 	retValue = UtilRegulatoryDomain_setCountryIE(pAdapter, REGULATORY_DOMAIN_COUNTRY_2_4_PARAM, pData, sizeof(country_t));
   2132 
   2133 	return retValue;
   2134 
   2135 }
   2136 
   2137 
   2138 
   2139 /*-----------------------------------------------------------------------------
   2140 Routine Name: UtilRegulatoryDomain_getCountryIE_2_4
   2141 Routine Description:
   2142 Arguments:
   2143 Return Value:
   2144 -----------------------------------------------------------------------------*/
   2145 ULONG
   2146 UtilRegulatoryDomain_getCountryIE_2_4(
   2147 									 PTIWLN_ADAPTER_T pAdapter,
   2148 									 PUCHAR pData,
   2149 									 PULONG Length
   2150 									 )
   2151 {
   2152 	ULONG retValue;
   2153 	retValue = UtilGetParam(pAdapter, REGULATORY_DOMAIN_COUNTRY_2_4_PARAM, pData, COUNTRY_STRING_LEN);
   2154 
   2155 	return retValue;
   2156 
   2157 }
   2158 
   2159 /*-----------------------------------------------------------------------------
   2160 Routine Name: UtilRegulatoryDomain_setCountryIE_5
   2161 Routine Description:
   2162 Arguments:
   2163 Return Value:
   2164 -----------------------------------------------------------------------------*/
   2165 ULONG
   2166 UtilRegulatoryDomain_setCountryIE_5(
   2167 								   PTIWLN_ADAPTER_T pAdapter,
   2168 								   PUCHAR pData,
   2169 								   ULONG Length
   2170 								   )
   2171 {
   2172 	ULONG retValue;
   2173 	retValue = UtilRegulatoryDomain_setCountryIE(pAdapter, REGULATORY_DOMAIN_COUNTRY_5_PARAM, pData, sizeof(country_t));
   2174 
   2175 	return retValue;
   2176 
   2177 }
   2178 
   2179 
   2180 /*-----------------------------------------------------------------------------
   2181 Routine Name: UtilRegulatoryDomain_getCountryIE_5
   2182 Routine Description:
   2183 Arguments:
   2184 Return Value:
   2185 -----------------------------------------------------------------------------*/
   2186 ULONG
   2187 UtilRegulatoryDomain_getCountryIE_5(
   2188 								   PTIWLN_ADAPTER_T pAdapter,
   2189 								   PUCHAR pData,
   2190 								   PULONG Length
   2191 								   )
   2192 {
   2193 	ULONG retValue;
   2194 	retValue = UtilGetParam(pAdapter, REGULATORY_DOMAIN_COUNTRY_5_PARAM, pData, COUNTRY_STRING_LEN);
   2195 
   2196 	return retValue;
   2197 
   2198 }
   2199 
   2200 /*-----------------------------------------------------------------------------
   2201 Routine Name: UtilRegulatoryDomain_setMinMaxDfsChannels
   2202 Routine Description:
   2203 Arguments:
   2204 Return Value:
   2205 -----------------------------------------------------------------------------*/
   2206 ULONG
   2207 UtilRegulatoryDomain_setMinMaxDfsChannels(
   2208     PTIWLN_ADAPTER_T pAdapter,
   2209     PUCHAR pData,
   2210     ULONG Length
   2211     )
   2212 {
   2213     ULONG retValue;
   2214 
   2215     retValue = UtilSetParam(pAdapter, REGULATORY_DOMAIN_DFS_CHANNELS_RANGE, pData, sizeof(DFS_ChannelRange_t));
   2216 
   2217     return retValue;
   2218 
   2219 }
   2220 
   2221 
   2222 /*-----------------------------------------------------------------------------
   2223 Routine Name: UtilRegulatoryDomain_getMinMaxDfsChannels
   2224 Routine Description:
   2225 Arguments:
   2226 Return Value:
   2227 -----------------------------------------------------------------------------*/
   2228 ULONG
   2229 UtilRegulatoryDomain_getMinMaxDfsChannels(
   2230     PTIWLN_ADAPTER_T pAdapter,
   2231     PUCHAR pData,
   2232     PULONG Length
   2233     )
   2234 {
   2235     ULONG retValue;
   2236     retValue = UtilGetParam(pAdapter, REGULATORY_DOMAIN_DFS_CHANNELS_RANGE, pData, sizeof(DFS_ChannelRange_t));
   2237 
   2238     return retValue;
   2239 
   2240 }
   2241 
   2242 
   2243 /*-----------------------------------------------------------------------------
   2244 Routine Name: UtilShortRetryGet
   2245 Routine Description:
   2246 Arguments:
   2247 Return Value:
   2248 -----------------------------------------------------------------------------*/
   2249 ULONG
   2250 UtilShortRetryGet(
   2251 				 PTIWLN_ADAPTER_T pAdapter,
   2252 				 PUCHAR pData,
   2253 				 PULONG Length
   2254 				 )
   2255 
   2256 {
   2257 	ULONG retValue;
   2258 
   2259 
   2260 	txRatePolicy_t  TxRatePolicy;
   2261 	/*
   2262 	 * NOTE: currently supporting only ONE txRatePolicy!!!!!!!!!
   2263 	 */
   2264 
   2265 
   2266 	if (!Length)
   2267 		return sizeof(ULONG);
   2268 
   2269 	retValue = UtilGetParam(pAdapter, CTRL_DATA_SHORT_RETRY_LIMIT_PARAM,
   2270 							(PUCHAR)(&TxRatePolicy), sizeof(txRatePolicy_t));
   2271 
   2272 	*(PULONG)pData = TxRatePolicy.rateClass[0].shortRetryLimit;
   2273 
   2274 	return retValue;
   2275 }
   2276 
   2277 
   2278 /*-----------------------------------------------------------------------------
   2279 Routine Name: UtilShortRetrySet
   2280 Routine Description:
   2281 Arguments:
   2282 Return Value:
   2283 -----------------------------------------------------------------------------*/
   2284 ULONG
   2285 UtilShortRetrySet(
   2286 				 PTIWLN_ADAPTER_T pAdapter,
   2287 				 PUCHAR pData,
   2288 				 ULONG Length
   2289 				 )
   2290 {
   2291 	ULONG retValue;
   2292 	txRatePolicy_t  TxRatePolicy;
   2293 
   2294 	/*
   2295 	 * NOTE: currently supporting only ONE txRatePolicy!!!!!!!!!
   2296 	 */
   2297 
   2298 
   2299 	TxRatePolicy.rateClass[0].shortRetryLimit = (UINT8) *(PULONG)pData;
   2300 
   2301 	retValue = UtilSetParam(pAdapter, CTRL_DATA_SHORT_RETRY_LIMIT_PARAM,
   2302 							(PUCHAR)(&TxRatePolicy), sizeof(txRatePolicy_t));
   2303 
   2304 	return retValue ;
   2305 
   2306 }
   2307 
   2308 
   2309 /*-----------------------------------------------------------------------------
   2310 Routine Name: UtilLongRetryGet
   2311 Routine Description:
   2312 Arguments:
   2313 Return Value:
   2314 -----------------------------------------------------------------------------*/
   2315 ULONG
   2316 UtilLongRetryGet(
   2317 				PTIWLN_ADAPTER_T pAdapter,
   2318 				PUCHAR pData,
   2319 				PULONG Length
   2320 				)
   2321 {
   2322 	ULONG retValue;
   2323 	txRatePolicy_t  TxRatePolicy;
   2324 	/*
   2325 	 * NOTE: currently supporting only ONE txRatePolicy!!!!!!!!!
   2326 	 */
   2327 
   2328 
   2329 	if (!Length)
   2330 		return NOK;
   2331 
   2332 	retValue = UtilGetParam(pAdapter, CTRL_DATA_LONG_RETRY_LIMIT_PARAM,
   2333 							(PUCHAR)(&TxRatePolicy), sizeof(txRatePolicy_t));
   2334 
   2335 	*(PULONG)pData = TxRatePolicy.rateClass[0].longRetryLimit;
   2336 	return retValue;
   2337 
   2338 }
   2339 
   2340 
   2341 /*-----------------------------------------------------------------------------
   2342 Routine Name: UtilLongRetrySet
   2343 Routine Description:
   2344 Arguments:
   2345 Return Value:
   2346 -----------------------------------------------------------------------------*/
   2347 ULONG
   2348 UtilLongRetrySet(
   2349 				PTIWLN_ADAPTER_T pAdapter,
   2350 				PUCHAR pData,
   2351 				ULONG Length
   2352 				)
   2353 {
   2354 	txRatePolicy_t  TxRatePolicy;
   2355 	ULONG retValue;
   2356 
   2357 	/*
   2358 	 * NOTE: currently supporting only ONE txRatePolicy!!!!!!!!!
   2359 	 */
   2360 
   2361 
   2362 	TxRatePolicy.rateClass[0].longRetryLimit = (UINT8) *(PULONG)pData;
   2363 
   2364 	retValue = UtilSetParam(pAdapter, CTRL_DATA_SHORT_RETRY_LIMIT_PARAM,
   2365 							(PUCHAR)(&TxRatePolicy), sizeof(txRatePolicy_t));
   2366 
   2367 	return retValue;
   2368 }
   2369 /*-----------------------------------------------------------------------------*/
   2370 ULONG
   2371 UtilDesiredRatesGet(
   2372 				   PTIWLN_ADAPTER_T pAdapter,
   2373 				   PUCHAR pData,
   2374 				   PULONG Length
   2375 				   )
   2376 {
   2377 	UCHAR rate;
   2378 	ULONG retValue;
   2379 
   2380 	if (!Length)
   2381 		return NOK;
   2382 
   2383 	retValue = UtilGetParam(pAdapter, SITE_MGR_DESIRED_TX_RATE_PARAM, (PUCHAR)&rate, sizeof(UCHAR));
   2384 
   2385 	*Length = sizeof(UCHAR);
   2386 	*(PUCHAR)pData = rate;
   2387 
   2388 	return retValue;
   2389 }
   2390 
   2391 /*-----------------------------------------------------------------------------
   2392 Routine Name: UtilCurrentRatesGet
   2393 Routine Description:
   2394 Arguments:
   2395 Return Value:
   2396 -----------------------------------------------------------------------------*/
   2397 ULONG
   2398 UtilCurrentRatesGet(
   2399 				   PTIWLN_ADAPTER_T pAdapter,
   2400 				   PUCHAR pData,
   2401 				   PULONG Length
   2402 				   )
   2403 {
   2404 	UCHAR rate;
   2405 	ULONG retValue;
   2406 
   2407 	rate = (UCHAR) *(PULONG)pData;
   2408 
   2409 	retValue = UtilGetParam(pAdapter, SITE_MGR_CURRENT_TX_RATE_PARAM, (PUCHAR)&rate, sizeof(UCHAR));
   2410 	*(PUCHAR)pData = rate;
   2411 	*Length = sizeof(UCHAR);
   2412 
   2413 	return retValue;
   2414 }
   2415 
   2416 
   2417 /*-----------------------------------------------------------------------------
   2418 Routine Name: UtilConfigurationGet
   2419 Routine Description:
   2420 Arguments:
   2421 Return Value:
   2422 -----------------------------------------------------------------------------*/
   2423 ULONG
   2424 UtilConfigurationGet(
   2425 					PTIWLN_ADAPTER_T pAdapter,
   2426 					PUCHAR pData,
   2427 					PULONG Length
   2428 					)
   2429 {
   2430 	paramInfo_t Param;
   2431 	ULONG retValue;
   2432 
   2433 	if (!Length)
   2434 	{
   2435 		*Length = sizeof(OS_802_11_CONFIGURATION);
   2436 		return NOK;
   2437 	}
   2438 
   2439 	Param.paramType = SITE_MGR_CONFIGURATION_PARAM;
   2440 	Param.paramLength = *Length;
   2441 	*(PULONG)&Param.content = (ULONG)pData;
   2442 
   2443 	retValue = configMgr_getParam(pAdapter->CoreHalCtx, &Param);
   2444 
   2445 	*Length = sizeof(OS_802_11_CONFIGURATION);
   2446 
   2447 	return retValue;
   2448 
   2449 }
   2450 
   2451 
   2452 /*-----------------------------------------------------------------------------
   2453 Routine Name: UtilConfigurationSet
   2454 Routine Description:
   2455 Arguments:
   2456 Return Value:
   2457 -----------------------------------------------------------------------------*/
   2458 ULONG
   2459 UtilConfigurationSet(
   2460 					PTIWLN_ADAPTER_T pAdapter,
   2461 					PUCHAR pData,
   2462 					ULONG Length
   2463 					)
   2464 {
   2465 	paramInfo_t Param;
   2466 	ULONG retValue;
   2467 
   2468 	Param.paramType = SITE_MGR_CONFIGURATION_PARAM;
   2469 	Param.paramLength = Length;
   2470 	*(PULONG)&Param.content = (ULONG)pData;
   2471 
   2472 	retValue = configMgr_setParam(pAdapter->CoreHalCtx, &Param);
   2473 
   2474 	return retValue;
   2475 
   2476 }
   2477 
   2478 /*-----------------------------------------------------------------------------
   2479 Routine Name: UtilGetCounter
   2480 Routine Description:
   2481 Arguments:
   2482 Return Value:
   2483 -----------------------------------------------------------------------------*/
   2484 ULONG
   2485 UtilGetCounter(
   2486 			  PTIWLN_ADAPTER_T pAdapter,
   2487 			  PUCHAR pData,
   2488 			  ULONG Offset
   2489 			  )
   2490 {
   2491 	TIWLN_COUNTERS TiCounters;
   2492 
   2493 	UtilGetParam(pAdapter, SITE_MGR_TI_WLAN_COUNTERS_PARAM,
   2494 				 (PUCHAR)&TiCounters, sizeof(TIWLN_COUNTERS));
   2495 
   2496 	NdisMoveMemory(pData, (PUCHAR)&TiCounters + Offset, sizeof(ULONG));
   2497 
   2498 	return sizeof(ULONG);
   2499 }
   2500 
   2501 /*-----------------------------------------------------------------------------
   2502 Routine Name: UtilStatistics
   2503 Routine Description:
   2504 Arguments:
   2505 Return Value:
   2506 -----------------------------------------------------------------------------*/
   2507 ULONG
   2508 UtilStatistics(
   2509 			  PTIWLN_ADAPTER_T pAdapter,
   2510 			  PUCHAR pData,
   2511 			  PULONG Length
   2512 			  )
   2513 {
   2514 	TIWLN_STATISTICS* pStats;
   2515 	paramInfo_t Param;
   2516 	ULONG RetSize, data,retValue,dataSize;
   2517 
   2518 
   2519     if (*Length >= sizeof(TIWLN_STATISTICS)) //TRS:GAA allow larger than needed buffer
   2520 	{
   2521 		pStats = (TIWLN_STATISTICS *) pData;
   2522 		NdisZeroMemory(pStats, sizeof(TIWLN_STATISTICS));
   2523 
   2524 		RetSize = sizeof(TIWLN_STATISTICS);
   2525 
   2526 		NdisMoveMemory(&pStats->currentMACAddress, pAdapter->CurrentAddr, ETH_ADDR_SIZE);
   2527 
   2528 		dataSize = sizeof(tiUINT32);
   2529 		if ((retValue = UtilPowerModeGet(pAdapter, (PUCHAR)&pStats->PowerMode, &dataSize)) != OK)
   2530 			return retValue;
   2531 
   2532 		dataSize = sizeof(OS_802_11_SSID);
   2533 		if ((retValue = UtilGetSSID(pAdapter, (PUCHAR)&pStats->dot11DesiredSSID, &dataSize)) != OK)
   2534 			return retValue;
   2535 
   2536 		dataSize = sizeof(UINT32);
   2537 		if ((retValue = UtilChannelGet(pAdapter, (PUCHAR)&pStats->dot11CurrentChannel, &dataSize)) != OK)
   2538 			return retValue;
   2539 
   2540 		dataSize = sizeof(ULONG);
   2541 		if ((retValue = UtilExtAuthenticationModeGet(pAdapter, (PUCHAR)&pStats->AuthenticationMode, &dataSize)) != OK)
   2542 			return retValue;
   2543 
   2544 		dataSize = sizeof(ULONG);
   2545 		if ((retValue = UtilRtsThresholdGet(pAdapter, (PUCHAR)&pStats->RTSThreshold,    &dataSize)) != OK)
   2546 			return retValue;
   2547 
   2548 		dataSize = sizeof(ULONG);
   2549 		if ((retValue = UtilFragmentationThresholdGet(pAdapter, (PUCHAR)&pStats->FragmentationThreshold, &dataSize)) != OK)
   2550 			return retValue;
   2551 
   2552 		dataSize = sizeof(ULONG);
   2553         if ((retValue = UtilGetParam(pAdapter, REGULATORY_DOMAIN_CURRENT_TX_POWER_IN_DBM_PARAM,
   2554 									(PUCHAR)&pStats->TxPowerDbm, dataSize)) != OK)
   2555 			return retValue;
   2556 
   2557 		dataSize = sizeof(ULONG);
   2558 		if ((retValue = UtilInfrastructureModeGet(pAdapter, (PUCHAR)&pStats->dot11BSSType, &dataSize)) != OK)
   2559 			return retValue;
   2560 
   2561 		dataSize = sizeof(ULONG);
   2562 		if ((retValue = UtilWepStatusGet(pAdapter, (PUCHAR)&pStats->WEPStatus, &dataSize)) != OK)
   2563 			return retValue;
   2564 
   2565 		if ((retValue = UtilGetParam(pAdapter, SITE_MGR_CONNECTION_STATUS_PARAM, (PUCHAR)&pStats->dot11State, sizeof(ULONG))) != OK)
   2566 			return retValue;
   2567 
   2568 		pStats->dot11CurrentTxRate = pAdapter->LinkSpeed/5000;
   2569 
   2570 		if ((retValue = UtilGetParam(pAdapter, SITE_MGR_CURRENT_PREAMBLE_TYPE_PARAM, (PUCHAR)&data, sizeof(ULONG))) != OK)
   2571 			return retValue;
   2572 
   2573 		pStats->bShortPreambleUsed = (BOOLEAN) data;
   2574 
   2575 		Param.paramType = SITE_MGR_GET_SELECTED_BSSID_INFO;
   2576 		Param.content.pSiteMgrPrimarySiteDesc = &pStats->targetAP;
   2577 		if ((retValue = configMgr_getParam(pAdapter->CoreHalCtx, &Param)) != OK)
   2578 			return retValue;
   2579 
   2580 		PRINTF(DBG_IOCTL_LOUD, ("...RSSI: %d\n", pStats->targetAP.Rssi));
   2581 		pStats->RxLevel = pStats->targetAP.Rssi;
   2582 
   2583 		dataSize = sizeof(ULONG);
   2584 		if ((retValue = UtilTxAntennaGet(pAdapter, (PUCHAR)&pStats->TxAntenna, &dataSize)) != OK)
   2585 			return retValue;
   2586 
   2587 		dataSize = sizeof(ULONG);
   2588 		if ((retValue = UtilRxAntennaGet(pAdapter, (PUCHAR)&pStats->RxAntenna, &dataSize)) != OK)
   2589 			return retValue;
   2590 
   2591 #ifdef EXC_MODULE_INCLUDED
   2592 		dataSize = sizeof(BOOL);
   2593 		if ((retValue = UtilExcNetworkEapGet(pAdapter, (PUCHAR)&pStats->dwSecuritySuit, &dataSize)) != OK)
   2594 			return retValue;
   2595 		if ((pStats->dwSecuritySuit==OS_EXC_NETWORK_EAP_ON) && (pStats->WEPStatus==os802_11WEPEnabled))
   2596 		{
   2597 			pStats->dwSecuritySuit = TIWLN_STAT_SECURITY_RESERVE_1;
   2598 		} else
   2599 #else
   2600 		{
   2601 			pStats->dwSecuritySuit = 0;
   2602 		}
   2603 #endif
   2604 		if ((retValue = UtilGetParam(pAdapter, RSN_SECURITY_STATE_PARAM, (PUCHAR)&pStats->dwSecurityState, sizeof(ULONG))) != OK)
   2605 			return retValue;
   2606 
   2607 		pStats->dwSecurityAuthStatus = 0;
   2608 		pStats->dwFeatureSuit = 0;
   2609 
   2610 		if ((retValue = UtilGetParam(pAdapter, SITE_MGR_TI_WLAN_COUNTERS_PARAM, (PUCHAR)&pStats->tiCounters, sizeof(TIWLN_COUNTERS))) != OK)
   2611 			return retValue;
   2612 
   2613         if ((retValue = UtilGetParam(pAdapter, MLME_BEACON_RECV, (PUCHAR)&pStats->tiCounters, sizeof(TIWLN_COUNTERS))) != OK)
   2614 			return retValue;
   2615 	}
   2616 
   2617 	else
   2618 	{
   2619 
   2620 		NdisZeroMemory(pData, *Length);
   2621 		*Length = 0;
   2622 		return NOK;
   2623 
   2624 	}
   2625 
   2626 	*Length = RetSize;
   2627 	return retValue;
   2628 }
   2629 
   2630 
   2631 /*-----------------------------------------------------------------------------
   2632 Routine Name: UtilTxStatistics
   2633 Routine Description:
   2634 Arguments:
   2635 Return Value:
   2636 -----------------------------------------------------------------------------*/
   2637 ULONG
   2638 UtilTxStatistics(
   2639 				PTIWLN_ADAPTER_T pAdapter,
   2640 				PUCHAR pData,
   2641 				ULONG inLength,
   2642 				PULONG outLength
   2643 				)
   2644 {
   2645 	ULONG retValue;
   2646 	txDataCounters_t  *pTxDataCounters;
   2647 	UINT32 resetStatsFlag;
   2648 
   2649 	if (*outLength == sizeof(TIWLN_TX_STATISTICS))
   2650 	{
   2651 		/* check whether statistics clear is also requested */
   2652 		resetStatsFlag = *pData;
   2653 
   2654 		/* note that only the pointer (by reference!) is passed to UtilGetParam, and the actual copying of data
   2655 		   is done here */
   2656 		if ((retValue = UtilGetParam( pAdapter, TX_DATA_COUNTERS_PARAM,
   2657 									  (PUCHAR)&pTxDataCounters, sizeof(txDataCounters_t*))) != OK)
   2658 			return retValue;
   2659 
   2660 		NdisMoveMemory( pData, pTxDataCounters, sizeof(TIWLN_TX_STATISTICS) );
   2661 
   2662 		*outLength = sizeof(TIWLN_TX_STATISTICS);
   2663 
   2664 		if ( 1 == resetStatsFlag )
   2665 		{
   2666 			UtilSetParam( pAdapter, TX_DATA_RESET_COUNTERS_PARAM, NULL, 0 );
   2667 		}
   2668 	} else
   2669 	{
   2670 		NdisZeroMemory(pData, *outLength);
   2671 		*outLength = 0;
   2672 		return NOK;
   2673 	}
   2674 
   2675 	return retValue;
   2676 }
   2677 
   2678 
   2679 /*-----------------------------------------------------------------------------
   2680 Routine Name: UtilAddWep
   2681 Routine Description:
   2682 Arguments:
   2683 Return Value:
   2684 -----------------------------------------------------------------------------*/
   2685 ULONG
   2686 UtilAddWep(
   2687 		  PTIWLN_ADAPTER_T pAdapter,
   2688 		  PUCHAR pData,
   2689 		  ULONG Length,
   2690 		  BOOLEAN CalledFromIoctl
   2691 		  )
   2692 {
   2693 	OS_802_11_WEP* pWep;
   2694 	OS_802_11_KEY  key;
   2695 	UINT32         keyIndexTxRx;
   2696 	TI_STATUS Status;
   2697 
   2698 	pWep = (OS_802_11_WEP*) pData;
   2699 
   2700 	if ((pWep->KeyIndex & 0x3FFFFFFF) > 3)
   2701 	{
   2702 		return 0;
   2703 	}
   2704 
   2705 	if (CalledFromIoctl)
   2706 	{
   2707 		NdisMoveMemory(&pAdapter->DefaultWepKeys[pWep->KeyIndex & 0x3FFFFFFF],
   2708 					   pWep, sizeof(OS_802_11_WEP));
   2709 	}
   2710 	key.Length = pWep->Length;
   2711 	/* Convert the Key index to match OS_802_11_KEY index */
   2712 
   2713 	keyIndexTxRx = (pWep->KeyIndex & 0x80000000);
   2714 
   2715 	key.KeyIndex = keyIndexTxRx | /*(keyIndexTxRx>>1) |*/
   2716 				   (pWep->KeyIndex & 0x3FFFFFFF);
   2717 
   2718 	key.KeyLength = pWep->KeyLength;
   2719 
   2720     if( pWep->KeyLength > sizeof(key.KeyMaterial) ) { /* Dm: Security fix */
   2721         printk("TI: %s - Security Error\n", __FUNCTION__);
   2722         return EXTERNAL_SET_PARAM_DENIED;
   2723     }
   2724 
   2725 	NdisMoveMemory(key.KeyMaterial, (void *)pWep->KeyMaterial, pWep->KeyLength);
   2726 	/* Set the MAC Address to zero for WEP */
   2727 	NdisZeroMemory(key.BSSID, sizeof(key.BSSID));
   2728 
   2729 	Status = UtilSetParam(pAdapter, RSN_ADD_KEY_PARAM,
   2730 						  (PUCHAR)&key, sizeof(OS_802_11_KEY));
   2731 
   2732 	return Status;
   2733 }
   2734 
   2735 
   2736 /*-----------------------------------------------------------------------------
   2737 Routine Name: UtilRemoveWep
   2738 Routine Description:
   2739 Arguments:
   2740 Return Value:
   2741 -----------------------------------------------------------------------------*/
   2742 ULONG
   2743 UtilRemoveWep(
   2744 			 PTIWLN_ADAPTER_T pAdapter,
   2745 			 PUCHAR pData,
   2746 			 ULONG Length
   2747 			 )
   2748 {
   2749 	UINT32          keyIndex;
   2750 	OS_802_11_KEY  key;
   2751 	TI_STATUS Status;
   2752 
   2753 	keyIndex = *(UINT32*)pData;
   2754 
   2755 	/* Convert the Key index to match OS_802_11_KEY index */
   2756 	NdisZeroMemory(&key, sizeof(OS_802_11_KEY));
   2757 
   2758 	key.KeyIndex = keyIndex;
   2759 
   2760 	Status = UtilSetParam(pAdapter, RSN_REMOVE_KEY_PARAM,
   2761 						  (PUCHAR)&key, sizeof(OS_802_11_KEY));
   2762 
   2763 	return(Status);
   2764 }
   2765 
   2766 
   2767 #define ADD_KEY_HEADER_LENGTH 26
   2768 
   2769 
   2770 /*-----------------------------------------------------------------------------
   2771 Routine Name: UtilAddKey
   2772 Routine Description:
   2773 Arguments:
   2774 Return Value:
   2775 -----------------------------------------------------------------------------*/
   2776 ULONG
   2777 UtilAddKey(
   2778 		  PTIWLN_ADAPTER_T pAdapter,
   2779 		  PUCHAR pData,
   2780 		  ULONG Length
   2781 		  )
   2782 {
   2783 	TI_STATUS   status;
   2784 	OS_802_11_KEY* pKey;
   2785 
   2786 	pKey = (OS_802_11_KEY*) pData;
   2787 
   2788 	status = UtilSetParam(pAdapter, RSN_ADD_KEY_PARAM, pData, pKey->Length);
   2789 
   2790 	return status;
   2791 }
   2792 
   2793 
   2794 /*-----------------------------------------------------------------------------
   2795 Routine Name: UtilRemoveKey
   2796 Routine Description:
   2797 Arguments:
   2798 Return Value:
   2799 -----------------------------------------------------------------------------*/
   2800 ULONG
   2801 UtilRemoveKey(
   2802 			 PTIWLN_ADAPTER_T pAdapter,
   2803 			 PUCHAR pData,
   2804 			 ULONG Length
   2805 			 )
   2806 {
   2807 	TI_STATUS               status;
   2808 	OS_802_11_REMOVE_KEY    *pRemoveKey;
   2809 	OS_802_11_KEY           key;
   2810 
   2811 	pRemoveKey = (OS_802_11_REMOVE_KEY*)pData;
   2812 
   2813 	key.KeyIndex = pRemoveKey->KeyIndex;
   2814 	NdisMoveMemory(key.BSSID, (void *)pRemoveKey->BSSID, sizeof(key.BSSID));
   2815 
   2816 	status = UtilSetParam(pAdapter, RSN_REMOVE_KEY_PARAM,
   2817 						  (PUCHAR)&key, sizeof(OS_802_11_KEY));
   2818 
   2819 	return(status);
   2820 }
   2821 
   2822 
   2823 /*-----------------------------------------------------------------------------
   2824 Routine Name: UtilExtAuthenticationModeSet
   2825 Routine Description:
   2826 Arguments:
   2827 Return Value:
   2828 -----------------------------------------------------------------------------*/
   2829 ULONG
   2830 UtilExtAuthenticationModeSet(
   2831 							PTIWLN_ADAPTER_T pAdapter,
   2832 							PUCHAR pData,
   2833 							ULONG Length
   2834 							)
   2835 {
   2836 	ULONG retValue;
   2837 
   2838 	retValue = UtilSetParam(pAdapter, RSN_EXT_AUTHENTICATION_MODE, pData, sizeof(ULONG));
   2839 
   2840 	return retValue;
   2841 }
   2842 
   2843 
   2844 /*-----------------------------------------------------------------------------
   2845 Routine Name: UtilExtAuthenticationModeGet
   2846 Routine Description:
   2847 Arguments:
   2848 Return Value:
   2849 -----------------------------------------------------------------------------*/
   2850 ULONG
   2851 UtilExtAuthenticationModeGet(
   2852 							PTIWLN_ADAPTER_T pAdapter,
   2853 							PUCHAR pData,
   2854 							PULONG Length
   2855 							)
   2856 {
   2857 	ULONG retValue;
   2858 
   2859 	if (!Length)
   2860 		return NOK;
   2861 
   2862 	retValue = UtilGetParam(pAdapter, RSN_EXT_AUTHENTICATION_MODE, pData, sizeof(ULONG));
   2863 
   2864 	*Length = sizeof (ULONG);
   2865 
   2866 	return retValue;
   2867 }
   2868 
   2869 
   2870 /*-----------------------------------------------------------------------------
   2871 Routine Name: Util802CapabilityGet
   2872 Routine Description:
   2873 Arguments:
   2874 Return Value:
   2875 -----------------------------------------------------------------------------*/
   2876 ULONG Util802CapabilityGet(
   2877 						  PTIWLN_ADAPTER_T pAdapter,
   2878 						  PUCHAR pData,
   2879 						  PULONG Length)
   2880 {
   2881 	OS_802_11_CAPABILITY         *capability_802_11;
   2882 	rsnAuthEncrCapability_t       rsnAuthEncrCap;
   2883 	OS_802_11_ENCRYPTION_STATUS   encrStatus = os802_11EncryptionDisabled;
   2884 	ULONG                         neededLength = 0;
   2885 	UINT                          i = 0;
   2886 	paramInfo_t                   Param;
   2887 	TI_STATUS                     status;
   2888 
   2889 	/* If length of the input buffer less than needed length, do nothing, */
   2890 	/* return the needed length                                           */
   2891 	neededLength = sizeof(OS_802_11_CAPABILITY) +
   2892 				   (sizeof(OS_802_11_AUTH_ENCRYPTION) * (MAX_AUTH_ENCR_PAIR -1));
   2893 
   2894 	if (*Length < neededLength)
   2895 	{
   2896 		*Length = neededLength;
   2897 		return NOK;
   2898 	}
   2899 
   2900 	NdisZeroMemory (pData, neededLength);
   2901 	capability_802_11  = (OS_802_11_CAPABILITY *)pData;
   2902 
   2903 	/* Fill Param fields and get the 802_11 capability information */
   2904 	Param.paramType   = RSN_AUTH_ENCR_CAPABILITY;
   2905 	Param.paramLength = neededLength;
   2906 	Param.content.pRsnAuthEncrCapability = &rsnAuthEncrCap;
   2907 
   2908 	status = configMgr_getParam(pAdapter->CoreHalCtx, &Param);
   2909 
   2910 	if (status != OK)
   2911 	{
   2912 		/* return the default values only */
   2913 		/* PMKIDs is 0, AUTH/Encr pairs is 1, Auth/Encr is OPEN/NONE (0/0) */
   2914 		capability_802_11->Length     = sizeof(OS_802_11_CAPABILITY);
   2915 		capability_802_11->Version    = OID_CAPABILITY_VERSION;
   2916 		capability_802_11->NoOfPmKIDs = 0;
   2917 		capability_802_11->NoOfAuthEncryptPairsSupported = 1;
   2918 		capability_802_11->AuthEncryptionSupported[0].AuthModeSupported  =
   2919 		os802_11AuthModeOpen;
   2920 		capability_802_11->AuthEncryptionSupported[0].EncryptionStatusSupported =
   2921 		os802_11EncryptionDisabled;
   2922 
   2923 
   2924 		*Length = sizeof(OS_802_11_CAPABILITY);
   2925 		return NOK;
   2926 	}
   2927 
   2928 	/* Copy the received info to the OS_802_11_CAPABILITY needed format */
   2929 	capability_802_11->Length     = neededLength;
   2930 	capability_802_11->Version    = OID_CAPABILITY_VERSION;
   2931 	capability_802_11->NoOfPmKIDs = rsnAuthEncrCap.NoOfPMKIDs;
   2932 	capability_802_11->NoOfAuthEncryptPairsSupported =
   2933 	rsnAuthEncrCap.NoOfAuthEncrPairSupported;
   2934 
   2935 	/* Convert received cipher suite type to encr.status type */
   2936 	for (i = 0; i < rsnAuthEncrCap.NoOfAuthEncrPairSupported; i ++)
   2937 	{
   2938 		capability_802_11->AuthEncryptionSupported[i].AuthModeSupported =
   2939 		(OS_802_11_AUTHENTICATION_MODE)rsnAuthEncrCap.authEncrPairs[i].authenticationMode;
   2940 
   2941 		switch (rsnAuthEncrCap.authEncrPairs[i].cipherSuite)
   2942 		{
   2943 		case RSN_CIPHER_NONE:
   2944 			encrStatus = os802_11EncryptionDisabled;
   2945 			break;
   2946 
   2947 		case RSN_CIPHER_WEP:
   2948 			encrStatus = os802_11WEPEnabled;
   2949 			break;
   2950 
   2951 		case RSN_CIPHER_TKIP:
   2952 			encrStatus = os802_11Encryption2Enabled;
   2953 			break;
   2954 
   2955 		case RSN_CIPHER_AES_CCMP:
   2956 			encrStatus = os802_11Encryption3Enabled;
   2957 			break;
   2958 
   2959 		default:
   2960 			encrStatus = os802_11EncryptionDisabled;
   2961 			break;
   2962 
   2963 		}
   2964 		capability_802_11->AuthEncryptionSupported[i].EncryptionStatusSupported
   2965 		= encrStatus;
   2966 	}
   2967 
   2968 	/* Success; return the actual length of the written data */
   2969 	*Length = neededLength;
   2970 	return status;
   2971 
   2972 }
   2973 
   2974 
   2975 /*-----------------------------------------------------------------------------
   2976 Routine Name:	Util802PmkidGet
   2977 Routine Description:
   2978 Arguments:
   2979 Return Value:
   2980 -----------------------------------------------------------------------------*/
   2981 ULONG Util802PmkidGet(
   2982 					 PTIWLN_ADAPTER_T pAdapter,
   2983 					 PUCHAR pData,
   2984 					 PULONG Length)
   2985 {
   2986 	OS_802_11_PMKID         *pPmkidList = (OS_802_11_PMKID *)pData;
   2987 	TI_STATUS                status = NOK;
   2988 
   2989 	/* Check the data buffer size */
   2990 	if (*Length < sizeof(OS_802_11_PMKID))
   2991 	{
   2992 		*Length = (sizeof(OS_802_11_PMKID));
   2993 		return NOK;
   2994 	}
   2995 
   2996 	NdisZeroMemory(pData, sizeof(OS_802_11_PMKID));
   2997 	pPmkidList->Length = *Length;
   2998 
   2999 	status = UtilGetParam(pAdapter, RSN_PMKID_LIST, pData, *Length);
   3000 
   3001 	if (status != OK)
   3002 	{
   3003 		if (*Length < (pPmkidList->Length))
   3004 			*Length = pPmkidList->Length;
   3005 		else
   3006 			*Length	= 0;
   3007 	}
   3008     else
   3009 	{
   3010 		*Length = pPmkidList->Length;
   3011 	}
   3012 
   3013 	return status;
   3014 }
   3015 
   3016 /*-----------------------------------------------------------------------------
   3017 Routine Name:	Util802PmkidSet
   3018 Routine Description:
   3019 Arguments:
   3020 Return Value:
   3021 -----------------------------------------------------------------------------*/
   3022 ULONG
   3023 Util802PmkidSet(
   3024 			   PTIWLN_ADAPTER_T pAdapter,
   3025 			   PUCHAR pData,
   3026 			   ULONG Length
   3027 			   )
   3028 {
   3029 	paramInfo_t Param;
   3030 	TI_STATUS   status;
   3031 
   3032 	Param.paramType = RSN_PMKID_LIST;
   3033     Param.paramLength = Length;
   3034     if( Length > sizeof(Param.content) ) { /* Dm: Security fix */
   3035         printk("TI: %s - Security Error\n",__FUNCTION__);
   3036         return EXTERNAL_SET_PARAM_DENIED;
   3037     }
   3038 	NdisMoveMemory(&Param.content, pData, Length);
   3039 
   3040 	status = configMgr_setParam(pAdapter->CoreHalCtx, &Param);
   3041 
   3042 	return(status);
   3043 }
   3044 
   3045 /*-----------------------------------------------------------------------------
   3046 Routine Name:	Util802FSWAvailableOptionsGet
   3047 Routine Description:
   3048 Arguments:
   3049 Return Value:
   3050 -----------------------------------------------------------------------------*/
   3051 ULONG
   3052 Util802FSWAvailableOptionsGet(
   3053 							 PTIWLN_ADAPTER_T pAdapter,
   3054 							 PUCHAR pData,
   3055 							 PULONG Length)
   3056 {
   3057 	ULONG retValue;
   3058 
   3059 	if (!Length)
   3060 	{
   3061 		*Length = sizeof(ULONG);
   3062 		return NOK;
   3063 	}
   3064 
   3065 	retValue = UtilGetParam(pAdapter, RSN_WPA_PROMOTE_AVAILABLE_OPTIONS,
   3066 							pData, sizeof(ULONG));
   3067 	*Length = sizeof(ULONG);
   3068 
   3069 	return retValue;
   3070 }
   3071 
   3072 
   3073 /*-----------------------------------------------------------------------------
   3074 Routine Name:	Util802FSWOptionsGet
   3075 Routine Description:
   3076 Arguments:
   3077 Return Value:
   3078 -----------------------------------------------------------------------------*/
   3079 ULONG
   3080 Util802FSWOptionsGet(
   3081 					PTIWLN_ADAPTER_T pAdapter,
   3082 					PUCHAR pData,
   3083 					PULONG Length)
   3084 {
   3085 	ULONG retValue;
   3086 
   3087 	if (!Length)
   3088 	{
   3089 		*Length = sizeof(ULONG);
   3090 		return NOK;
   3091 	}
   3092 
   3093 	retValue = UtilGetParam(pAdapter, RSN_WPA_PROMOTE_OPTIONS, pData, sizeof(ULONG));
   3094 
   3095 	*Length = sizeof(ULONG);
   3096 	return retValue;
   3097 }
   3098 
   3099 /*-----------------------------------------------------------------------------
   3100 Routine Name:	Util802FSWOptionsSet
   3101 Routine Description:
   3102 Arguments:
   3103 Return Value:
   3104 -----------------------------------------------------------------------------*/
   3105 
   3106 ULONG
   3107 Util802FSWOptionsSet(
   3108 					PTIWLN_ADAPTER_T pAdapter,
   3109 					PUCHAR pData,
   3110 					ULONG Length)
   3111 {
   3112 	ULONG retValue;
   3113 
   3114 	retValue = UtilSetParam(pAdapter, RSN_WPA_PROMOTE_OPTIONS, pData, sizeof(ULONG));
   3115 
   3116 	return retValue;
   3117 }
   3118 
   3119 /*-----------------------------------------------------------------------------
   3120 Routine Name:	UtilWepStatusGet
   3121 Routine Description:
   3122 Arguments:
   3123 Return Value:
   3124 -----------------------------------------------------------------------------*/
   3125 ULONG
   3126 UtilWepStatusGet(
   3127 				PTIWLN_ADAPTER_T pAdapter,
   3128 				PUCHAR pData,
   3129 				PULONG Length
   3130 				)
   3131 {
   3132 	ULONG retValue;
   3133 
   3134 	if (!Length)
   3135 	{
   3136 		*Length = sizeof(ULONG);
   3137 		return NOK;
   3138 	}
   3139 
   3140 	retValue = UtilGetParam(pAdapter, RSN_ENCRYPTION_STATUS_PARAM, pData, sizeof(ULONG));
   3141 
   3142 	*Length = sizeof(ULONG);
   3143 	return retValue;
   3144 
   3145 }
   3146 
   3147 
   3148 /*-----------------------------------------------------------------------------
   3149 Routine Name:	UtilWepStatusSet
   3150 Routine Description:
   3151 Arguments:
   3152 Return Value:
   3153 -----------------------------------------------------------------------------*/
   3154 ULONG
   3155 UtilWepStatusSet(
   3156 				PTIWLN_ADAPTER_T pAdapter,
   3157 				PUCHAR pData,
   3158 				ULONG Length
   3159 				)
   3160 {
   3161 	ULONG retValue;
   3162 	retValue = UtilSetParam(pAdapter, RSN_ENCRYPTION_STATUS_PARAM, pData, sizeof(ULONG));
   3163 	return retValue;
   3164 }
   3165 
   3166 
   3167 
   3168 /*-----------------------------------------------------------------------------
   3169 Routine Name:	UtilAssociationInfoGet
   3170 Routine Description:
   3171 Arguments:
   3172 Return Value:
   3173 -----------------------------------------------------------------------------*/
   3174 ULONG
   3175 UtilAssociationInfoGet(
   3176 					  PTIWLN_ADAPTER_T pAdapter,
   3177 					  PUCHAR pData,
   3178 					  PULONG Length
   3179 					  )
   3180 {
   3181 	OS_802_11_ASSOCIATION_INFORMATION  *assocInformation;
   3182 	UINT8 *requestIEs;
   3183 	UINT8 *responseIEs;
   3184 	ULONG TotalLength = 0,retValue;
   3185 	paramInfo_t param;
   3186 
   3187 	if (*Length < sizeof(OS_802_11_ASSOCIATION_INFORMATION))
   3188 	{
   3189 		PRINT(DBG_IOCTL_LOUD, "...More buffer space needed\n");
   3190 		return(sizeof(OS_802_11_ASSOCIATION_INFORMATION));
   3191 	}
   3192 
   3193 	param.paramType   = ASSOC_ASSOCIATION_INFORMATION_PARAM;
   3194 	param.paramLength = *Length;
   3195 
   3196 	retValue = configMgr_getParam(pAdapter->CoreHalCtx, &param);
   3197 
   3198 	TotalLength =  sizeof(OS_802_11_ASSOCIATION_INFORMATION) +
   3199 				   param.content.assocAssociationInformation.RequestIELength +
   3200 				   param.content.assocAssociationInformation.ResponseIELength;
   3201 
   3202 	if (TotalLength <= *Length)
   3203 	{
   3204 		NdisMoveMemory(pData, (UINT8 *)&param.content, sizeof(OS_802_11_ASSOCIATION_INFORMATION));
   3205 		assocInformation = (OS_802_11_ASSOCIATION_INFORMATION*)pData;
   3206 		requestIEs = (UINT8*)pData + sizeof(OS_802_11_ASSOCIATION_INFORMATION);
   3207 
   3208 		if (assocInformation->RequestIELength > 0)
   3209 		{
   3210 
   3211 			NdisMoveMemory(requestIEs, (UINT8*)assocInformation->OffsetRequestIEs,
   3212 						   assocInformation->RequestIELength);
   3213 
   3214 			assocInformation->OffsetRequestIEs = sizeof(OS_802_11_ASSOCIATION_INFORMATION);
   3215 		}
   3216 
   3217 		if (assocInformation->ResponseIELength > 0)
   3218 		{
   3219 
   3220 			responseIEs = requestIEs + assocInformation->RequestIELength;
   3221 
   3222 			NdisMoveMemory(responseIEs, (UINT8*)assocInformation->OffsetResponseIEs,
   3223 						   assocInformation->ResponseIELength);
   3224 
   3225 			assocInformation->OffsetResponseIEs =
   3226 			assocInformation->OffsetRequestIEs + assocInformation->RequestIELength;
   3227 		}
   3228 
   3229 		PRINTF(DBG_IOCTL_LOUD, ("UtilAssociationInfoGet: pData=%p, "
   3230 								"OffsetRequestIEs=0x%lx, OffsetResponseIEs=0x%lx\n",
   3231 								pData, (long)assocInformation->OffsetRequestIEs,
   3232 								(long)assocInformation->OffsetResponseIEs));
   3233 	} else
   3234 	{
   3235 		*(PULONG)pData = TotalLength;
   3236 		PRINT(DBG_IOCTL_LOUD, "...More buffer space needed\n");
   3237 	}
   3238 
   3239 	*Length = TotalLength;
   3240 	return retValue;
   3241 
   3242 }
   3243 
   3244 /*-----------------------------------------------------------------------------
   3245 Routine Name:	UtilCurrentRegDomainGet
   3246 Routine Description:
   3247 Arguments:
   3248 Return Value:
   3249 -----------------------------------------------------------------------------*/
   3250 ULONG
   3251 UtilCurrentRegDomainGet(
   3252 					   PTIWLN_ADAPTER_T pAdapter,
   3253 					   PUCHAR pData,
   3254 					   PULONG Length
   3255 					   )
   3256 {
   3257 	ULONG retValue;
   3258 
   3259 	if (!Length)
   3260 		return NOK;
   3261 
   3262 	retValue = UtilGetParam(pAdapter, REGULATORY_DOMAIN_CURRENT_REGULATORY_DOMAIN_PARAM, pData, sizeof(UINT8));
   3263 
   3264 	*Length = sizeof(UINT8);
   3265 
   3266 	return retValue;
   3267 }
   3268 
   3269 /*-----------------------------------------------------------------------------
   3270 Routine Name:	Util4xActiveStateGet
   3271 Routine Description:
   3272 Arguments:
   3273 Return Value:
   3274 -----------------------------------------------------------------------------*/
   3275 ULONG
   3276 Util4xActiveStateGet(
   3277 					PTIWLN_ADAPTER_T pAdapter,
   3278 					PUCHAR pData,
   3279 					PULONG Length
   3280 					)
   3281 {
   3282 	ULONG retValue;
   3283 	retValue = UtilGetParam(pAdapter, CTRL_DATA_FOUR_X_CURRRENT_STATUS_PARAM, pData, sizeof(UINT8));
   3284 	*Length = sizeof(UINT8);
   3285 	return retValue;
   3286 }
   3287 
   3288 /*-----------------------------------------------------------------------------
   3289 Routine Name:	power
   3290 Routine Description:
   3291 Arguments:
   3292 Return Value:
   3293 -----------------------------------------------------------------------------*/
   3294 static int power(int x, int y)
   3295 {
   3296 	int i = 0,z = 1;
   3297 
   3298 	for (i = 0; i < y; i++)
   3299 		z *= x;
   3300 
   3301 	return z;
   3302 }
   3303 
   3304 /*-----------------------------------------------------------------------------
   3305 Routine Name:	UtilGetSwVersion
   3306 Routine Description:
   3307 Arguments:
   3308 Return Value:
   3309 -----------------------------------------------------------------------------*/
   3310 ULONG
   3311 UtilGetSwVersion(
   3312 				PTIWLN_ADAPTER_T pAdapter,
   3313 				PUCHAR pData,
   3314 				PULONG Length
   3315 				)
   3316 {
   3317 	TIWLN_VERSION* swVer;
   3318 	ULONG retValue,tmpLen;
   3319 	UCHAR FwVersion[FW_VERSION_LEN];
   3320 	e2Version_t EepromVersion;
   3321 	int i, start = 0, end = 0, temp = 0;
   3322 
   3323 	swVer = (TIWLN_VERSION *) pData;
   3324 
   3325 	swVer->DrvVersion.major = SW_VERSION_MAJOR;
   3326 	swVer->DrvVersion.minor = SW_VERSION_MINOR;
   3327 	swVer->DrvVersion.bugfix = SW_VERSION_PATCH;
   3328 	swVer->DrvVersion.subld = SW_VERSION_SUBLD;
   3329         swVer->DrvVersion.build = SW_VERSION_BUILD;
   3330 
   3331 	NdisZeroMemory(&swVer->FWVersion, sizeof(swVer->FWVersion));
   3332 
   3333 	UtilGetParam(pAdapter, SITE_MGR_FIRMWARE_VERSION_PARAM, FwVersion, FW_VERSION_LEN);
   3334 
   3335 	/* major */
   3336 	start = end = temp = 4;
   3337 	while (FwVersion[end++] != '.');
   3338 	temp = end;
   3339 	end -= 2;
   3340 	for (i = end; i>= start; i--)
   3341     {
   3342 		swVer->FWVersion.major += (FwVersion[i] - 0x30)*power(10, end - i);
   3343     }
   3344 
   3345 
   3346 	/* minor */
   3347 	start = end = temp;
   3348 	while (FwVersion[end++] != '.');
   3349 	temp = end;
   3350 	end -= 2;
   3351 	for (i = end; i>= start; i--)
   3352     {
   3353 		swVer->FWVersion.minor += (FwVersion[i] - 0x30)*power(10, end - i);
   3354     }
   3355 
   3356 	/* bug fix */
   3357 	start = end = temp;
   3358 	while (FwVersion[end++] != '.');
   3359 	temp = end;
   3360 	end -= 2;
   3361 	for (i = end; i>= start; i--)
   3362     {
   3363 		swVer->FWVersion.bugfix += (FwVersion[i] - 0x30)*power(10, end - i);
   3364     }
   3365 
   3366 
   3367     /* build */
   3368 	start = end = temp;
   3369 	while (FwVersion[end++] != '.');
   3370 	temp = end;
   3371 	end -= 2;
   3372 	for (i = end; i>= start; i--)
   3373     {
   3374 		swVer->FWVersion.subld += (FwVersion[i] - 0x30)*power(10, end - i);
   3375     }
   3376 
   3377 	/* minor build */
   3378 	start = end = temp;
   3379 	while (FwVersion[end++] != 0);
   3380 	temp = end;
   3381 	end -= 2;
   3382 	for (i = end; i>= start; i--)
   3383     {
   3384 		swVer->FWVersion.build += (FwVersion[i] - 0x30)*power(10, end - i);
   3385     }
   3386 
   3387 
   3388 	NdisZeroMemory(&swVer->HWVersion, sizeof(swVer->HWVersion));
   3389 
   3390 	retValue = UtilGetParam(pAdapter, SITE_MGR_EEPROM_VERSION_PARAM, (PUCHAR)&EepromVersion, sizeof(e2Version_t));
   3391 
   3392 	swVer->HWVersion.major = (UCHAR) EepromVersion.major;
   3393 	swVer->HWVersion.minor = (UCHAR) EepromVersion.minor;
   3394 	swVer->HWVersion.bugfix = (UCHAR) EepromVersion.bugfix;
   3395 
   3396 	swVer->osNdisVersion  = (TIWLN_MAJOR_VERSION  << 16) + TIWLN_MINOR_VERSION;
   3397 
   3398 	tmpLen = sizeof(TIWLN_VERSION);
   3399 
   3400     if (*Length >= sizeof(TIWLN_VERSION_EX)) //TRS:GAA allow larger than needed buffer
   3401 	{
   3402 
   3403 		((PTIWLN_VERSION_EX)swVer)->extVerSign = 2;
   3404 
   3405 		((PTIWLN_VERSION_EX)swVer)->NVVersion.bugfix = EepromVersion.last;
   3406 
   3407 		((PTIWLN_VERSION_EX)swVer)->NVVersion.minor = EepromVersion.minor;
   3408 
   3409 		((PTIWLN_VERSION_EX)swVer)->NVVersion.major =
   3410 		(UCHAR)EepromVersion.major;
   3411 
   3412 		((PTIWLN_VERSION_EX)swVer)->NVVersion.subld =
   3413 		(UCHAR)EepromVersion.bugfix;
   3414 
   3415 		tmpLen = sizeof(TIWLN_VERSION_EX);
   3416 
   3417 	}
   3418 
   3419 	*Length = tmpLen;
   3420 
   3421 	return retValue;
   3422 }
   3423 
   3424 
   3425 
   3426 /*-----------------------------------------------------------------------------
   3427 Routine Name:	UtilRxAntennaSet
   3428 Routine Description:
   3429 Arguments:
   3430 Return Value:
   3431 -----------------------------------------------------------------------------*/
   3432 ULONG
   3433 UtilRxAntennaSet(
   3434 				PTIWLN_ADAPTER_T pAdapter,
   3435 				PUCHAR pData,
   3436 				ULONG Length
   3437 				)
   3438 {
   3439 	ULONG retValue;
   3440 	retValue = UtilSetParam(pAdapter, HAL_CTRL_RX_ANTENNA_PARAM, pData, sizeof(ULONG));
   3441 	return retValue;
   3442 }
   3443 
   3444 
   3445 /*-----------------------------------------------------------------------------
   3446 Routine Name:	UtilRxAntennaGet
   3447 Routine Description:
   3448 Arguments:
   3449 Return Value:
   3450 -----------------------------------------------------------------------------*/
   3451 ULONG
   3452 UtilRxAntennaGet(
   3453 				PTIWLN_ADAPTER_T pAdapter,
   3454 				PUCHAR pData,
   3455 				PULONG Length
   3456 				)
   3457 {
   3458 	ULONG retValue;
   3459 
   3460 	if ((!Length) || (*Length == 0))
   3461 		return NOK;
   3462 
   3463 	retValue = UtilGetParam(pAdapter, HAL_CTRL_RX_ANTENNA_PARAM, pData, sizeof(UINT8));
   3464 	*Length = sizeof(UINT8);
   3465 	return retValue;
   3466 }
   3467 
   3468 
   3469 /*-----------------------------------------------------------------------------
   3470 Routine Name:	UtilTxAntennaSet
   3471 Routine Description:
   3472 Arguments:
   3473 Return Value:
   3474 -----------------------------------------------------------------------------*/
   3475 ULONG
   3476 UtilTxAntennaSet(
   3477 				PTIWLN_ADAPTER_T pAdapter,
   3478 				PUCHAR pData,
   3479 				ULONG Length
   3480 				)
   3481 {
   3482 	ULONG retValue;
   3483 	retValue = UtilSetParam(pAdapter, HAL_CTRL_TX_ANTENNA_PARAM, pData, sizeof(ULONG));
   3484 	return retValue;
   3485 }
   3486 
   3487 
   3488 /*-----------------------------------------------------------------------------
   3489 Routine Name:	UtilTxAntennaGet
   3490 Routine Description:
   3491 Arguments:
   3492 Return Value:
   3493 -----------------------------------------------------------------------------*/
   3494 ULONG
   3495 UtilTxAntennaGet(
   3496 				PTIWLN_ADAPTER_T pAdapter,
   3497 				PUCHAR pData,
   3498 				PULONG Length
   3499 				)
   3500 {
   3501 	ULONG retValue;
   3502 
   3503 	if ((!Length) || (*Length == 0))
   3504 		return NOK;
   3505 
   3506 	retValue = UtilGetParam(pAdapter, HAL_CTRL_TX_ANTENNA_PARAM, pData, sizeof(UINT8));
   3507 	*Length = sizeof (UINT8);
   3508 	return retValue;
   3509 }
   3510 
   3511 
   3512 /*-----------------------------------------------------------------------------
   3513 Routine Name:	UtilNumberOfAntennas
   3514 Routine Description:
   3515 Arguments:
   3516 Return Value:
   3517 -----------------------------------------------------------------------------*/
   3518 ULONG
   3519 UtilNumberOfAntennas(
   3520 					PTIWLN_ADAPTER_T pAdapter,
   3521 					PUCHAR pData,
   3522 					PULONG Length
   3523 					)
   3524 {
   3525 	if ((!Length) || (*Length == 0))
   3526 		return NOK;
   3527 
   3528 	*(PULONG)pData = 2;
   3529 	*Length = sizeof(ULONG);
   3530 	return OK;
   3531 }
   3532 
   3533 /*-----------------------------------------------------------------------------
   3534 Routine Name:
   3535 	UtilAntennaDivresitySet
   3536 Routine Description:
   3537 Arguments:
   3538 Return Value:
   3539 -----------------------------------------------------------------------------*/
   3540 ULONG
   3541 UtilAntennaDivresitySet(
   3542 					   PTIWLN_ADAPTER_T pAdapter,
   3543 					   PUCHAR pData,
   3544 					   ULONG Length
   3545 					   )
   3546 {
   3547 
   3548 	return(UtilSetParam(pAdapter, HAL_CTRL_ANTENNA_DIVERSITY_PARAMS, pData, Length));
   3549 }
   3550 
   3551 /*-----------------------------------------------------------------------------
   3552 Routine Name:	UtilDriverStatusGet
   3553 Routine Description:
   3554 Arguments:
   3555 Return Value:
   3556 -----------------------------------------------------------------------------*/
   3557 ULONG
   3558 UtilDriverStatusGet(
   3559 				   PTIWLN_ADAPTER_T pAdapter,
   3560 				   PUCHAR pData,
   3561 				   PULONG Length
   3562 				   )
   3563 {
   3564 	ULONG retValue;
   3565 	retValue = UtilGetParam(pAdapter, DRIVER_STATUS_PARAM, pData, sizeof(ULONG));
   3566 	*Length = sizeof (ULONG);
   3567 	return retValue;
   3568 }
   3569 
   3570 
   3571 /*-----------------------------------------------------------------------------
   3572 Routine Name:	UtilDriverSuspend
   3573 Routine Description:
   3574 Arguments:
   3575 Return Value:
   3576 -----------------------------------------------------------------------------*/
   3577 ULONG
   3578 UtilDriverSuspend(
   3579 				 PTIWLN_ADAPTER_T pAdapter,
   3580 				 PUCHAR pData,
   3581 				 ULONG Length
   3582 				 )
   3583 {
   3584 	ULONG retValue;
   3585 	OS_802_11_SSID FakeSsid;
   3586 	UINT32 loopIndex;
   3587 
   3588 	for (loopIndex = 0; loopIndex < MAX_SSID_LEN; loopIndex++)
   3589 		FakeSsid.Ssid[loopIndex] = (loopIndex+1);
   3590 
   3591 	FakeSsid.SsidLength = MAX_SSID_LEN;
   3592 	retValue = UtilSetSSID(pAdapter, (PUCHAR)&FakeSsid, sizeof(OS_802_11_SSID));
   3593 
   3594 	return retValue;
   3595 
   3596 }
   3597 
   3598 /*-----------------------------------------------------------------------------
   3599 Routine Name:	UtilDriverStatusSet
   3600 Routine Description:
   3601 Arguments:
   3602 Return Value:
   3603 -----------------------------------------------------------------------------*/
   3604 ULONG
   3605 UtilDriverStatusSet(
   3606 				   PTIWLN_ADAPTER_T pAdapter,
   3607 				   PUCHAR pData,
   3608 				   ULONG Length
   3609 				   )
   3610 {
   3611 	ULONG retValue;
   3612 
   3613 	if (*(PULONG)pData)
   3614 	{
   3615 		retValue = configMgr_start(pAdapter->CoreHalCtx);
   3616 	} else
   3617 	{
   3618 		retValue = configMgr_stop(pAdapter->CoreHalCtx);
   3619 	}
   3620 
   3621 	return retValue;
   3622 }
   3623 
   3624 
   3625 /*-----------------------------------------------------------------------------
   3626 Routine Name:	UtilRssiGet
   3627 Routine Description:
   3628 Arguments:
   3629 Return Value:
   3630 -----------------------------------------------------------------------------*/
   3631 ULONG
   3632 UtilRssiGet(
   3633 		   PTIWLN_ADAPTER_T pAdapter,
   3634 		   PUCHAR pData,
   3635 		   PULONG Length
   3636 		   )
   3637 {
   3638 	TIWLN_STATISTICS pStats;
   3639 	paramInfo_t Param;
   3640 	ULONG retValue;
   3641 
   3642 	if (!Length)
   3643 		return NOK;
   3644 
   3645 	NdisZeroMemory(&pStats, sizeof(TIWLN_STATISTICS));
   3646 
   3647 	Param.paramType = SITE_MGR_GET_SELECTED_BSSID_INFO;
   3648 	Param.content.pSiteMgrPrimarySiteDesc = &pStats.targetAP;
   3649 
   3650 	retValue = configMgr_getParam(pAdapter->CoreHalCtx, &Param);
   3651 
   3652 	*(PULONG)pData = pStats.targetAP.Rssi;
   3653 
   3654 	*Length = sizeof(ULONG);
   3655 	return retValue;
   3656 }
   3657 
   3658 
   3659 /*-----------------------------------------------------------------------------
   3660 Routine Name:	UtilDeviceSuspend
   3661 Routine Description:
   3662 Arguments:
   3663 Return Value:
   3664 -----------------------------------------------------------------------------*/
   3665 VOID
   3666 UtilDeviceSuspend(
   3667 				 PTIWLN_ADAPTER_T pAdapter
   3668 				 )
   3669 {
   3670 	configMgr_stop(pAdapter->CoreHalCtx);
   3671 }
   3672 
   3673 
   3674 /*-----------------------------------------------------------------------------
   3675 Routine Name:	UtilDeviceResume
   3676 Routine Description:
   3677 Arguments:
   3678 Return Value:
   3679 -----------------------------------------------------------------------------*/
   3680 VOID
   3681 UtilDeviceResume(
   3682 				PTIWLN_ADAPTER_T pAdapter
   3683 				)
   3684 {
   3685 	configMgr_start(pAdapter->CoreHalCtx);
   3686 }
   3687 
   3688 
   3689 /*-----------------------------------------------------------------------------
   3690 Routine Name:	UtilIbssProtectionGet
   3691 Routine Description:
   3692 Arguments:
   3693 Return Value:
   3694 -----------------------------------------------------------------------------*/
   3695 ULONG
   3696 UtilIbssProtectionGet(
   3697 					 PTIWLN_ADAPTER_T pAdapter,
   3698 					 PUCHAR pData,
   3699 					 PULONG Length
   3700 					 )
   3701 {
   3702 	ULONG retValue;
   3703 	if (!Length)
   3704 		return NOK;
   3705 	retValue = UtilGetParam(pAdapter, CTRL_DATA_CURRENT_IBSS_PROTECTION_PARAM, pData, sizeof(ULONG));
   3706 	*Length = sizeof(ULONG);
   3707 	return retValue;
   3708 }
   3709 
   3710 
   3711 /*-----------------------------------------------------------------------------
   3712 Routine Name:	UtilIbssProtectionSet
   3713 Routine Description:
   3714 Arguments:
   3715 Return Value:
   3716 -----------------------------------------------------------------------------*/
   3717 ULONG
   3718 UtilIbssProtectionSet(
   3719 					 PTIWLN_ADAPTER_T pAdapter,
   3720 					 PUCHAR pData,
   3721 					 ULONG Length
   3722 					 )
   3723 {
   3724 	ULONG retValue;
   3725 	retValue = UtilSetParam(pAdapter, CTRL_DATA_CURRENT_IBSS_PROTECTION_PARAM, pData, sizeof(ULONG));
   3726 	return retValue;
   3727 }
   3728 
   3729 
   3730 /*-----------------------------------------------------------------------------
   3731 Routine Name:	UtilShortSlotGet
   3732 Routine Description:
   3733 Arguments:
   3734 Return Value:
   3735 -----------------------------------------------------------------------------*/
   3736 ULONG
   3737 UtilShortSlotGet(
   3738 				PTIWLN_ADAPTER_T pAdapter,
   3739 				PUCHAR pData,
   3740 				PULONG Length
   3741 				)
   3742 {
   3743 	ULONG retValue;
   3744 
   3745 	if (!Length)
   3746 		return NOK;
   3747 
   3748 	retValue = UtilGetParam(pAdapter, SITE_MGR_DESIRED_SLOT_TIME_PARAM, pData, sizeof(ULONG));
   3749 	*Length = sizeof (ULONG);
   3750 	return retValue;
   3751 }
   3752 
   3753 
   3754 /*-----------------------------------------------------------------------------
   3755 Routine Name:	UtilShortSlotSet
   3756 Routine Description:
   3757 Arguments:
   3758 Return Value:
   3759 -----------------------------------------------------------------------------*/
   3760 ULONG
   3761 UtilShortSlotSet(
   3762 				PTIWLN_ADAPTER_T pAdapter,
   3763 				PUCHAR pData,
   3764 				ULONG Length
   3765 				)
   3766 {
   3767 	ULONG retValue;
   3768 	retValue = UtilSetParam(pAdapter, SITE_MGR_DESIRED_SLOT_TIME_PARAM, pData, sizeof(ULONG));
   3769 	return retValue;
   3770 }
   3771 
   3772 
   3773 /*-----------------------------------------------------------------------------
   3774 Routine Name:	UtilExtRatesIeGet
   3775 Routine Description:
   3776 Arguments:
   3777 Return Value:
   3778 -----------------------------------------------------------------------------*/
   3779 ULONG
   3780 UtilExtRatesIeGet(
   3781 				 PTIWLN_ADAPTER_T pAdapter,
   3782 				 PUCHAR pData,
   3783 				 PULONG Length
   3784 				 )
   3785 {
   3786 	ULONG retValue;
   3787 
   3788 	if (!Length)
   3789 		return NOK;
   3790 
   3791 	retValue = UtilGetParam(pAdapter, SITE_MGR_USE_DRAFT_NUM_PARAM, pData, sizeof(ULONG));
   3792 
   3793 	*Length = sizeof(ULONG);
   3794 
   3795 	return retValue;
   3796 }
   3797 
   3798 
   3799 /*-----------------------------------------------------------------------------
   3800 Routine Name:	UtilExtRatesIeSet
   3801 Routine Description:
   3802 Arguments:
   3803 Return Value:
   3804 -----------------------------------------------------------------------------*/
   3805 ULONG
   3806 UtilExtRatesIeSet(
   3807 				 PTIWLN_ADAPTER_T pAdapter,
   3808 				 PUCHAR pData,
   3809 				 ULONG Length
   3810 				 )
   3811 {
   3812 	ULONG retValue;
   3813 	retValue = UtilSetParam(pAdapter, SITE_MGR_USE_DRAFT_NUM_PARAM, pData, sizeof(ULONG));
   3814 	return retValue;
   3815 }
   3816 
   3817 
   3818 /*-----------------------------------------------------------------------------
   3819 Routine Name:	UtilQosSetParams
   3820 Routine Description:
   3821 Arguments:
   3822 Return Value:
   3823 -----------------------------------------------------------------------------*/
   3824 ULONG UtilQosSetParams(PTIWLN_ADAPTER_T pAdapter,
   3825 					   PUCHAR pData,
   3826 					   ULONG Length)
   3827 {
   3828 	ULONG retValue;
   3829 	retValue = UtilSetParam(pAdapter, QOS_MNGR_SET_OS_PARAMS, pData, Length);
   3830 	return retValue;
   3831 }
   3832 
   3833 /*-----------------------------------------------------------------------------
   3834 Routine Name:	UtilQosSetParams
   3835 Routine Description:
   3836 Arguments:
   3837 Return Value:
   3838 -----------------------------------------------------------------------------*/
   3839 ULONG UtilQosSetRxTimeOut(PTIWLN_ADAPTER_T pAdapter,
   3840 						  PUCHAR pData,
   3841 						  ULONG Length)
   3842 {
   3843 	ULONG retValue;
   3844 	retValue = UtilSetParam(pAdapter, QOS_SET_RX_TIME_OUT, pData, Length);
   3845 	return retValue;
   3846 }
   3847 
   3848 /*-----------------------------------------------------------------------------
   3849 Routine Name:	UtilSetDTagToAcMappingTable
   3850 Routine Description:
   3851 Arguments:
   3852 Return Value:
   3853 -----------------------------------------------------------------------------*/
   3854 ULONG UtilSetDTagToAcMappingTable(PTIWLN_ADAPTER_T pAdapter,
   3855 						  		  PUCHAR pData,
   3856 						  		  ULONG Length)
   3857 {
   3858 	ULONG retValue;
   3859 	retValue = UtilSetParam(pAdapter, TX_DATA_TAG_TO_AC_CLASSIFIER_TABLE, pData, Length);
   3860 	return retValue;
   3861 }
   3862 
   3863 /*-----------------------------------------------------------------------------
   3864 Routine Name:	UtilSetVAD
   3865 Routine Description:
   3866 Arguments:
   3867 Return Value:
   3868 -----------------------------------------------------------------------------*/
   3869 ULONG UtilSetVAD(PTIWLN_ADAPTER_T pAdapter, PUCHAR pData, ULONG Length)
   3870 {
   3871 	ULONG retValue;
   3872 	retValue = UtilSetParam(pAdapter, TX_DATA_SET_VAD, pData, Length);
   3873 	return retValue;
   3874 }
   3875 
   3876 ULONG UtilGetVAD (PTIWLN_ADAPTER_T pAdapter, PUCHAR pData, PULONG Length)
   3877 {
   3878 	ULONG retValue;
   3879 	retValue = UtilGetParam(pAdapter, TX_DATA_GET_VAD , pData, sizeof(txDataVadTimerParams_t));
   3880 	*Length = sizeof(txDataVadTimerParams_t);
   3881 	return retValue;
   3882 }
   3883 
   3884 /*-----------------------------------------------------------------------------
   3885 Routine Name: UtilRemoveClassifierEntry
   3886 Routine Description:
   3887 Arguments:
   3888 Return Value:
   3889 -----------------------------------------------------------------------------*/
   3890 ULONG UtilRemoveClassifierEntry(PTIWLN_ADAPTER_T pAdapter,
   3891 								PUCHAR ioBuffer,
   3892 								ULONG inBufLen)
   3893 {
   3894 	ULONG retValue;
   3895 	retValue = UtilSetParam(pAdapter, CTRL_DATA_CLSFR_REMOVE_ENTRY,ioBuffer, inBufLen);
   3896 	return retValue;
   3897 }
   3898 
   3899 
   3900 /*-----------------------------------------------------------------------------
   3901 Routine Name: UtilConfigTxClassifier
   3902 Routine Description:
   3903 Arguments:
   3904 Return Value:
   3905 -----------------------------------------------------------------------------*/
   3906 ULONG UtilConfigTxClassifier(PTIWLN_ADAPTER_T pAdapter,
   3907 							 PUCHAR ioBuffer,
   3908 							 ULONG inBufLen)
   3909 {
   3910 	ULONG retValue;
   3911 	retValue = UtilSetParam(pAdapter, CTRL_DATA_CLSFR_CONFIG,ioBuffer, inBufLen);
   3912 	return retValue;
   3913 }
   3914 
   3915 
   3916 /*-----------------------------------------------------------------------------
   3917 Routine Name: UtilGetClsfrType
   3918 Routine Description:
   3919 Arguments:
   3920 Return Value:
   3921 -----------------------------------------------------------------------------*/
   3922 ULONG UtilGetClsfrType(PTIWLN_ADAPTER_T pAdapter,
   3923 					   PUCHAR pData,
   3924 					   PULONG Length)
   3925 {
   3926 	ULONG retValue;
   3927 	retValue = UtilGetParam(pAdapter, CTRL_DATA_CLSFR_TYPE , pData, sizeof(clsfrTypeAndSupport));
   3928 	*Length = sizeof(clsfrTypeAndSupport);
   3929 	return retValue;
   3930 }
   3931 
   3932 
   3933 /*-----------------------------------------------------------------------------
   3934 Routine Name:	UtilGetAPQosParams
   3935 Routine Description:
   3936 Arguments:
   3937 Return Value:
   3938 -----------------------------------------------------------------------------*/
   3939 ULONG UtilGetAPQosParams(PTIWLN_ADAPTER_T pAdapter,
   3940 						 PUCHAR pData,
   3941 						 PULONG Length)
   3942 {
   3943 	ULONG retValue;
   3944 	retValue = UtilSetGetParam(pAdapter, QOS_MNGR_AP_QOS_PARAMETERS , pData, sizeof(OS_802_11_AC_QOS_PARAMS));
   3945 	*Length = sizeof(OS_802_11_AC_QOS_PARAMS);
   3946 	return(retValue);
   3947 }
   3948 
   3949 
   3950 /*-----------------------------------------------------------------------------
   3951 Routine Name:	UtilGetAPQosCapabilities
   3952 Routine Description:
   3953 Arguments:
   3954 Return Value:
   3955 -----------------------------------------------------------------------------*/
   3956 ULONG UtilGetAPQosCapabilities(PTIWLN_ADAPTER_T pAdapter,
   3957 							   PUCHAR pData,
   3958 							   PULONG Length)
   3959 {
   3960 	ULONG retValue;
   3961 	*Length=sizeof(OS_802_11_AP_QOS_CAPABILITIES_PARAMS);
   3962 	retValue = UtilGetParam(pAdapter, SITE_MGR_GET_AP_QOS_CAPABILITIES , pData, sizeof(OS_802_11_AP_QOS_CAPABILITIES_PARAMS));
   3963 	return(retValue);
   3964 }
   3965 
   3966 
   3967 /*-----------------------------------------------------------------------------
   3968 Routine Name:	UtilAddTspec
   3969 Routine Description:
   3970 Arguments:
   3971 Return Value:
   3972 -----------------------------------------------------------------------------*/
   3973 ULONG UtilAddTspec(PTIWLN_ADAPTER_T pAdapter,
   3974 				   PUCHAR pData,
   3975 				   ULONG Length)
   3976 {
   3977 	ULONG retValue;
   3978 	retValue = UtilSetParam(pAdapter, QOS_MNGR_ADD_TSPEC_REQUEST , pData, sizeof(OS_802_11_QOS_TSPEC_PARAMS));
   3979 	return retValue;
   3980 }
   3981 
   3982 
   3983 /*-----------------------------------------------------------------------------
   3984 Routine Name:	UtilGetTspecParams
   3985 Routine Description:
   3986 Arguments:
   3987 Return Value:
   3988 -----------------------------------------------------------------------------*/
   3989 ULONG UtilGetTspecParams(PTIWLN_ADAPTER_T pAdapter,
   3990 						 PUCHAR pData,
   3991 						 PULONG Length)
   3992 {
   3993 	ULONG retValue;
   3994 	retValue = UtilSetGetParam(pAdapter, QOS_MNGR_OS_TSPEC_PARAMS , pData, sizeof(OS_802_11_QOS_TSPEC_PARAMS));
   3995 	*Length = sizeof(OS_802_11_QOS_TSPEC_PARAMS);
   3996 	return retValue;
   3997 }
   3998 
   3999 
   4000 /*-----------------------------------------------------------------------------
   4001 Routine Name:	UtilDeleteTspec
   4002 Routine Description:
   4003 Arguments:
   4004 Return Value:
   4005 -----------------------------------------------------------------------------*/
   4006 ULONG UtilDeleteTspec(PTIWLN_ADAPTER_T pAdapter,
   4007 					  PUCHAR pData,
   4008 					  ULONG Length)
   4009 {
   4010 	ULONG retValue;
   4011 	retValue = UtilSetParam(pAdapter, QOS_MNGR_DEL_TSPEC_REQUEST , pData, sizeof(OS_802_11_QOS_DELETE_TSPEC_PARAMS));
   4012 	return retValue;
   4013 }
   4014 
   4015 
   4016 /*-----------------------------------------------------------------------------
   4017 Routine Name:	UtilGetCurrentAcStatus
   4018 Routine Description:
   4019 Arguments:
   4020 Return Value:
   4021 -----------------------------------------------------------------------------*/
   4022 ULONG UtilGetCurrentAcStatus(PTIWLN_ADAPTER_T pAdapter,
   4023 							 PUCHAR pData,
   4024 							 PULONG Length)
   4025 {
   4026 	ULONG retValue;
   4027 	retValue = UtilSetGetParam(pAdapter, QOS_MNGR_AC_STATUS , pData, sizeof(OS_802_11_AC_UPSD_STATUS_PARAMS));
   4028 	*Length = sizeof(OS_802_11_AC_UPSD_STATUS_PARAMS);
   4029 	return retValue;
   4030 }
   4031 
   4032 
   4033 /*-----------------------------------------------------------------------------
   4034 Routine Name:	UtilGetUserPriorityOfStream
   4035 Routine Description:
   4036 Arguments:
   4037 Return Value:
   4038 -----------------------------------------------------------------------------*/
   4039 ULONG UtilGetUserPriorityOfStream(PTIWLN_ADAPTER_T pAdapter,
   4040 								  PUCHAR pData,
   4041 								  PULONG Length)
   4042 {
   4043 	ULONG retValue;
   4044 	retValue = UtilSetGetParam(pAdapter, CTRL_DATA_GET_USER_PRIORITY_OF_STREAM , pData, sizeof(STREAM_TRAFFIC_PROPERTIES));
   4045 	*Length = sizeof(STREAM_TRAFFIC_PROPERTIES);
   4046 	return retValue;
   4047 }
   4048 
   4049 
   4050 /*-----------------------------------------------------------------------------
   4051 Routine Name:	UtilSetMediumUsageThreshold
   4052 Routine Description:
   4053 Arguments:
   4054 Return Value:
   4055 -----------------------------------------------------------------------------*/
   4056 ULONG UtilSetMediumUsageThreshold(PTIWLN_ADAPTER_T pAdapter,
   4057 								  PUCHAR pData,
   4058 								  ULONG Length)
   4059 {
   4060 	ULONG retValue;
   4061 	retValue = UtilSetParam(pAdapter, TX_DATA_SET_MEDIUM_USAGE_THRESHOLD , pData, sizeof(OS_802_11_THRESHOLD_CROSS_PARAMS));
   4062 	return retValue;
   4063 }
   4064 
   4065 
   4066 /*-----------------------------------------------------------------------------
   4067 Routine Name:	UtilSetPhyRateThreshold
   4068 Routine Description:
   4069 Arguments:
   4070 Return Value:
   4071 -----------------------------------------------------------------------------*/
   4072 ULONG UtilSetPhyRateThreshold(PTIWLN_ADAPTER_T pAdapter,
   4073 							  PUCHAR pData,
   4074 							  ULONG Length)
   4075 {
   4076 	ULONG retValue;
   4077 	retValue = UtilSetParam(pAdapter, QOS_SET_RATE_THRESHOLD , pData, sizeof(OS_802_11_THRESHOLD_CROSS_PARAMS));
   4078 	return retValue;
   4079 }
   4080 
   4081 
   4082 /*-----------------------------------------------------------------------------
   4083 Routine Name:	UtilGetMediumUsageThreshold
   4084 Routine Description:
   4085 Arguments:
   4086 Return Value:
   4087 -----------------------------------------------------------------------------*/
   4088 ULONG UtilGetMediumUsageThreshold(PTIWLN_ADAPTER_T pAdapter,
   4089 								  PUCHAR pData,
   4090 								  PULONG Length)
   4091 {
   4092 	ULONG retValue;
   4093 	retValue = UtilSetGetParam(pAdapter, TX_DATA_GET_MEDIUM_USAGE_THRESHOLD , pData, sizeof(OS_802_11_THRESHOLD_CROSS_PARAMS));
   4094 	*Length = sizeof(OS_802_11_THRESHOLD_CROSS_PARAMS);
   4095 	return retValue;
   4096 }
   4097 
   4098 
   4099 /*-----------------------------------------------------------------------------
   4100 Routine Name:	UtilGetPhyRateThreshold
   4101 Routine Description:
   4102 Arguments:
   4103 Return Value:
   4104 -----------------------------------------------------------------------------*/
   4105 ULONG UtilGetPhyRateThreshold(PTIWLN_ADAPTER_T pAdapter,
   4106 							  PUCHAR pData,
   4107 							  PULONG Length)
   4108 {
   4109 	ULONG retValue;
   4110 	retValue = UtilSetGetParam(pAdapter, QOS_GET_RATE_THRESHOLD , pData, sizeof(OS_802_11_THRESHOLD_CROSS_PARAMS));
   4111 	*Length = sizeof(OS_802_11_THRESHOLD_CROSS_PARAMS);
   4112 	return retValue;
   4113 }
   4114 
   4115 
   4116 /*-----------------------------------------------------------------------------
   4117 Routine Name:	UtilGetDesiredPsMode
   4118 Routine Description:
   4119 Arguments:
   4120 Return Value:
   4121 -----------------------------------------------------------------------------*/
   4122 ULONG UtilGetDesiredPsMode(PTIWLN_ADAPTER_T pAdapter,
   4123 						   PUCHAR pData,
   4124 						   PULONG  Length)
   4125 {
   4126 	ULONG retValue;
   4127 	retValue = UtilGetParam(pAdapter, QOS_MNGR_GET_DESIRED_PS_MODE , pData, sizeof(OS_802_11_QOS_DESIRED_PS_MODE));
   4128 	*Length = sizeof(OS_802_11_QOS_DESIRED_PS_MODE);
   4129 	return retValue;
   4130 }
   4131 
   4132 
   4133 /*-----------------------------------------------------------------------------
   4134 Routine Name:	UtilPollApPackets
   4135 Routine Description:
   4136 Arguments:
   4137 Return Value:
   4138 -----------------------------------------------------------------------------*/
   4139 ULONG UtilPollApPackets(PTIWLN_ADAPTER_T pAdapter,
   4140 						PUCHAR pData,
   4141 						ULONG Length)
   4142 {
   4143 	ULONG retValue;
   4144 	retValue = configMgr_PollApPackets(pAdapter->CoreHalCtx);
   4145 	return retValue;
   4146 }
   4147 
   4148 
   4149 /*-----------------------------------------------------------------------------
   4150 Routine Name:	UtilPollApPacketsFromAC
   4151 Routine Description:
   4152 Arguments:
   4153 Return Value:
   4154 -----------------------------------------------------------------------------*/
   4155 ULONG UtilPollApPacketsFromAC(PTIWLN_ADAPTER_T pAdapter,
   4156 							  PUCHAR pData,
   4157 							  ULONG Length)
   4158 {
   4159 	ULONG retValue;
   4160 	retValue = UtilSetParam(pAdapter, TX_DATA_POLL_AP_PACKETS_FROM_AC , (unsigned char *)pData, Length);
   4161 	return retValue;
   4162 }
   4163 
   4164 
   4165 /*-----------------------------------------------------------------------------
   4166 Routine Name:	UtilEnableEvent
   4167 Routine Description:
   4168 Arguments:
   4169 Return Value:
   4170 -----------------------------------------------------------------------------*/
   4171 ULONG UtilEnableEvent(PTIWLN_ADAPTER_T pAdapter,
   4172 					  PUCHAR pData,
   4173 					  ULONG Length)
   4174 {
   4175 	/*UtilSetParam(pAdapter,  , pData, Length);  EITAN TBD */
   4176 	return PARAM_NOT_SUPPORTED;
   4177 }
   4178 
   4179 
   4180 /*-----------------------------------------------------------------------------
   4181 Routine Name:	UtilDisableEvent
   4182 Routine Description:
   4183 Arguments:
   4184 Return Value:
   4185 -----------------------------------------------------------------------------*/
   4186 ULONG UtilDisableEvent(PTIWLN_ADAPTER_T pAdapter,
   4187 					   PUCHAR pData,
   4188 					   ULONG Length)
   4189 {
   4190 	/*UtilSetParam(pAdapter,  , pData, Length);  EITAN TBD */
   4191 	return PARAM_NOT_SUPPORTED;
   4192 }
   4193 
   4194 
   4195 /*-----------------------------------------------------------------------------
   4196 Routine Name:	UtilConfigRSSI
   4197 Routine Description:
   4198 Arguments:
   4199 Return Value:
   4200 -----------------------------------------------------------------------------*/
   4201 ULONG UtilConfigRSSI(PTIWLN_ADAPTER_T pAdapter,
   4202 					 UINT32 pData,
   4203 					 ULONG Length)
   4204 {
   4205 	ULONG retValue;
   4206 	retValue = UtilSetParam(pAdapter, SITE_MGR_DESIRED_RSSI_THRESHOLD_SET , (unsigned char *)pData, Length);
   4207 	return retValue;
   4208 }
   4209 
   4210 
   4211 /*-----------------------------------------------------------------------------
   4212 Routine Name:	UtilConfigPERLevel
   4213 Routine Description:
   4214 Arguments:
   4215 Return Value:
   4216 -----------------------------------------------------------------------------*/
   4217 ULONG UtilConfigPERLevel(PTIWLN_ADAPTER_T pAdapter,
   4218 						 UINT32 pData,
   4219 						 ULONG Length)
   4220 {
   4221 	ULONG retValue;
   4222 	retValue = UtilSetParam(pAdapter, SITE_MGR_DESIRED_TX_RATE_PRCT_SET , (unsigned char *)pData, Length);
   4223 	return retValue;
   4224 }
   4225 
   4226 
   4227 /*-----------------------------------------------------------------------------
   4228 Routine Name:	UtilGetDrvCapabilities
   4229 Routine Description:
   4230 Arguments:
   4231 Return Value:
   4232 -----------------------------------------------------------------------------*/
   4233 ULONG UtilGetDrvCapabilities(PTIWLN_ADAPTER_T pAdapter,
   4234 							 PUCHAR pData,
   4235 							 PULONG Length)
   4236 {
   4237 	/*UtilSetParam(pAdapter,  , pData, Length);  EITAN TBD */
   4238 	return PARAM_NOT_SUPPORTED;
   4239 }
   4240 
   4241 
   4242 /*-----------------------------------------------------------------------------
   4243 Routine Name:	UtilGetPrimaryBSSIDInfo
   4244 Routine Description:
   4245 Arguments:
   4246 Return Value:
   4247 -----------------------------------------------------------------------------*/
   4248 ULONG UtilGetPrimaryBSSIDInfo(PTIWLN_ADAPTER_T pAdapter,
   4249                        PUCHAR pData,
   4250                        PULONG Length)
   4251 {
   4252 	paramInfo_t Param;
   4253 	TI_STATUS Status;
   4254 
   4255 	if ( *Length < sizeof(OS_802_11_BSSID_EX) )
   4256     {
   4257 		PRINTF(DBG_NDIS_OIDS_ERROR, ("UtilGetPrimaryBSSIDInfo: ERROR Length is:%ld < %d\n",
   4258                                          *Length, sizeof(OS_802_11_BSSID)) );
   4259         return NOK;
   4260     }
   4261 
   4262     Param.paramType = SITE_MGR_PRIMARY_SITE_PARAM;
   4263 	Param.paramLength = *Length;
   4264 	Param.content.pSiteMgrSelectedSiteInfo = (OS_802_11_BSSID_EX*)pData;
   4265     Status = configMgr_getParam(pAdapter->CoreHalCtx, &Param);
   4266 
   4267 	if(Status != OK) {
   4268 		PRINTF(DBG_NDIS_OIDS_ERROR, (" UtilGetPrimaryBSSIDInfo: ERROR on return from get param SITE_MGR_PRIMARY_SITE_PARAM\n"));
   4269     }
   4270     else
   4271     {
   4272         *Length = Param.paramLength;
   4273     }
   4274 
   4275 	return Status;
   4276 }
   4277 
   4278 /*-----------------------------------------------------------------------------
   4279 Routine Name:	UtilGetSelectedBSSIDInfo
   4280 Routine Description:
   4281 Arguments:
   4282 Return Value:
   4283 -----------------------------------------------------------------------------*/
   4284 ULONG UtilGetSelectedBSSIDInfo(PTIWLN_ADAPTER_T pAdapter,
   4285 							   PUCHAR pData,
   4286 							   PULONG Length)
   4287 {
   4288 	paramInfo_t Param;
   4289 	TI_STATUS Status;
   4290 
   4291 	if ( *Length < sizeof(OS_802_11_BSSID_EX) )
   4292 	{
   4293 		PRINTF(DBG_NDIS_OIDS_ERROR, ("UtilGetSelectedBSSIDInfo: ERROR Length is:%ld < %d",
   4294 										 *Length, sizeof(OS_802_11_BSSID)) );
   4295 		return NOK;
   4296 	}
   4297 
   4298 	Param.paramType = SITE_MGR_GET_SELECTED_BSSID_INFO;
   4299 	Param.paramLength = *Length;
   4300 	Param.content.pSiteMgrPrimarySiteDesc = (OS_802_11_BSSID*)pData;
   4301 	Status = configMgr_getParam(pAdapter->CoreHalCtx, &Param);
   4302 
   4303 	if(Status != OK)
   4304         {
   4305 		PRINTF(DBG_NDIS_OIDS_ERROR, (" UtilGetSelectedBSSIDInfo: ERROR on return from get param SITE_MGR_GET_SELECTED_BSSID_INFO"));
   4306 	}
   4307 
   4308 	return Status;
   4309 }
   4310 
   4311 
   4312 /*-----------------------------------------------------------------------------
   4313 Routine Name:	UtilGetDriverState
   4314 Routine Description:
   4315 Arguments:
   4316 Return Value:
   4317 -----------------------------------------------------------------------------*/
   4318 ULONG UtilGetDriverState (PTIWLN_ADAPTER_T pAdapter, PUCHAR pData, PULONG Length)
   4319 {
   4320 	ULONG retValue;
   4321 	retValue = UtilGetParam(pAdapter, SME_SM_STATE_PARAM , pData, *Length);
   4322 	*Length = sizeof (ULONG);
   4323 	return retValue;
   4324 }
   4325 
   4326 
   4327 /*#ifdef NDIS51_MINIPORT*/
   4328 
   4329 /*-----------------------------------------------------------------------------
   4330 Routine Name:	UtilPrivacyFilterGet
   4331 Routine Description:
   4332 Arguments:
   4333 Return Value:
   4334 -----------------------------------------------------------------------------*/
   4335 ULONG
   4336 UtilPrivacyFilterGet(
   4337 					PTIWLN_ADAPTER_T pAdapter,
   4338 					PUCHAR pData,
   4339 					PULONG Length
   4340 					)
   4341 {
   4342 	ULONG WepStatus,retValue,dataSize;
   4343 
   4344 	if (!Length)
   4345 		return NOK;
   4346 
   4347 	dataSize = sizeof (ULONG);
   4348 	retValue = UtilWepStatusGet(pAdapter, (PUCHAR)&WepStatus, &dataSize);
   4349 
   4350 	if (WepStatus)
   4351 	{
   4352 		*(PULONG)pData = os802_11PrivFilterAcceptAll;
   4353 	} else
   4354 	{
   4355 		*(PULONG)pData = os802_11PrivFilter8021xWEP;
   4356 	}
   4357 	*Length = sizeof (ULONG);
   4358 
   4359 	return retValue;
   4360 }
   4361 
   4362 
   4363 /*-----------------------------------------------------------------------------
   4364 Routine Name:	UtilPrivacyFilterSet
   4365 Routine Description:
   4366 Arguments:
   4367 Return Value:
   4368 -----------------------------------------------------------------------------*/
   4369 ULONG
   4370 UtilPrivacyFilterSet(
   4371 					PTIWLN_ADAPTER_T pAdapter,
   4372 					PUCHAR pData,
   4373 					ULONG Length
   4374 					)
   4375 {
   4376 	ULONG WepStatus,dataSize,retValue;
   4377 
   4378 	dataSize = sizeof(ULONG);
   4379 	retValue = UtilWepStatusGet(pAdapter, (PUCHAR)&WepStatus, &dataSize);
   4380 
   4381 	if ((WepStatus && (*(PULONG)pData == os802_11PrivFilter8021xWEP)) || (retValue != OK))
   4382 		return NOK;	/* was return -1 */
   4383 
   4384 	if ((!WepStatus) && (retValue == OK))
   4385 	{
   4386 		*(PULONG)pData = 0;
   4387 		retValue = UtilSetParam(pAdapter, RX_DATA_EXCLUDE_UNENCRYPTED_PARAM, pData, sizeof(ULONG));
   4388 	}
   4389 
   4390 	return retValue;
   4391 }
   4392 
   4393 
   4394 
   4395 /*#endif*/
   4396 
   4397 /*-----------------------------------------------------------------------------
   4398 Routine Name:	UtilReadReg
   4399 Routine Description:
   4400 Arguments:
   4401 Return Value:
   4402 -----------------------------------------------------------------------------*/
   4403 ULONG
   4404 UtilReadReg(
   4405 		   PTIWLN_ADAPTER_T pAdapter,
   4406 		   PUCHAR pData,
   4407 		   PULONG Length
   4408 		   )
   4409 {
   4410 	TIWLN_REG_RW * pReg;
   4411 
   4412 	pReg = (TIWLN_REG_RW *) pData;
   4413 
   4414 #if defined(TNETW1150)
   4415 	if (pReg->regAddr >= 0x3C0000)
   4416 		pReg->regValue = configMgr_ReadPhyRegister(pAdapter->CoreHalCtx, pReg->regAddr);
   4417 	else
   4418 		pReg->regValue = configMgr_ReadMacRegister(pAdapter->CoreHalCtx, pReg->regAddr);
   4419 #else
   4420 	if (pReg->regAddr >= 0x1000)
   4421 		pReg->regValue = configMgr_ReadPhyRegister(pAdapter->CoreHalCtx, pReg->regAddr);
   4422 	else
   4423 		pReg->regValue = configMgr_ReadMacRegister(pAdapter->CoreHalCtx, pReg->regAddr);
   4424 #endif
   4425 
   4426 
   4427 #ifdef __LINUX__
   4428 	print_info("Register %#x=%#x(%d)\n", pReg->regAddr, pReg->regValue, pReg->regValue );
   4429 #endif
   4430 	*Length = sizeof(TIWLN_REG_RW);
   4431 	return OK;
   4432 }
   4433 
   4434 /*-----------------------------------------------------------------------------
   4435 Routine Name:	UtilWriteReg
   4436 Routine Description:
   4437 Arguments:
   4438 Return Value:
   4439 -----------------------------------------------------------------------------*/
   4440 ULONG
   4441 UtilWriteReg(
   4442 			PTIWLN_ADAPTER_T pAdapter,
   4443 			PUCHAR pData,
   4444 			ULONG Length
   4445 			)
   4446 {
   4447 	TIWLN_REG_RW * pReg;
   4448 
   4449 	pReg = (TIWLN_REG_RW *) pData;
   4450 
   4451 #if defined(TNETW1150)
   4452 	if (pReg->regAddr >= 0x3C0000)
   4453 		configMgr_WritePhyRegister(pAdapter->CoreHalCtx, pReg->regAddr, pReg->regValue);
   4454 	else
   4455 		configMgr_WriteMacRegister(pAdapter->CoreHalCtx, pReg->regAddr, pReg->regValue);
   4456 #else
   4457 	if (pReg->regAddr >= 0x1000)
   4458 		configMgr_WritePhyRegister(pAdapter->CoreHalCtx, pReg->regAddr, pReg->regValue);
   4459 	else
   4460 		configMgr_WriteMacRegister(pAdapter->CoreHalCtx, pReg->regAddr, pReg->regValue);
   4461 #endif
   4462 
   4463 	return OK;
   4464 }
   4465 
   4466 
   4467 
   4468 /*-----------------------------------------------------------------------------
   4469 Routine Name:	UtilDisassociate
   4470 Routine Description:
   4471 Arguments:
   4472 Return Value:
   4473 -----------------------------------------------------------------------------*/
   4474 ULONG
   4475 UtilDisassociate(
   4476 				PTIWLN_ADAPTER_T pAdapter,
   4477 				PUCHAR pData,
   4478 				ULONG Length
   4479 				)
   4480 {
   4481 	OS_802_11_SSID FakeSsid;
   4482 	UINT32 loopIndex;
   4483 	ULONG retValue;
   4484 
   4485 	/*
   4486 	 * Clean up desired SSID value
   4487 	*/
   4488 	for (loopIndex = 0; loopIndex < MAX_SSID_LEN; loopIndex++)
   4489 		FakeSsid.Ssid[loopIndex] = (loopIndex+1);
   4490 
   4491 	FakeSsid.SsidLength = MAX_SSID_LEN;
   4492 
   4493 	retValue = UtilSetSSID(pAdapter, (PUCHAR)&FakeSsid, sizeof(OS_802_11_SSID));
   4494 
   4495 	return retValue;
   4496 }
   4497 
   4498 /*-----------------------------------------------------------------------------
   4499 Routine Name:	UtilInfoCodeQueryInformation
   4500 Routine Description:
   4501 Arguments:
   4502 Return Value:
   4503 -----------------------------------------------------------------------------*/
   4504 ULONG
   4505 UtilInfoCodeQueryInformation(
   4506 							PTIWLN_ADAPTER_T pAdapter,
   4507 							PUCHAR pData,
   4508 							PULONG Length
   4509 							)
   4510 {
   4511 	UINT32 InfoCode, retVal, PureInfoLength;
   4512 	ULONG dataSize;
   4513 	PRINT(DBG_IOCTL_LOUD, "UtilInfoCodeQueryInformation\n");
   4514 
   4515 	retVal = OK;
   4516 
   4517 	if (*Length<sizeof(InfoCode))
   4518 	{
   4519 		*Length = sizeof(ULONG);
   4520 		return NOK;
   4521 	}
   4522 
   4523 	InfoCode = *((UINT32*)pData);
   4524 	#ifndef _WINDOWS
   4525 		PureInfoLength = *Length - sizeof(InfoCode);
   4526 	#else
   4527 	#endif
   4528 
   4529 	switch (InfoCode)
   4530 	{
   4531 	case VAL_TX_POWER_VALUE:
   4532 		PRINT(DBG_IOCTL_LOUD, "case VAL_TX_POWER_VALUE (100)\n");
   4533 		retVal = UtilGetTxPowerValue(pAdapter, REGULATORY_DOMAIN_CURRENT_TX_POWER_IN_DBM_PARAM, pData, PureInfoLength);
   4534 		break;
   4535 	case VAL_NETWORK_TYPE:
   4536 		PRINT(DBG_IOCTL_LOUD, "case VAL_NETWORK_TYPE (101)\n");
   4537 		dataSize = PureInfoLength;
   4538 		retVal = UtilNetworkTypeInUseGet(pAdapter, pData, &dataSize);
   4539 		break;
   4540 	case VAL_AP_TX_POWER_LEVEL:
   4541 		PRINT(DBG_IOCTL_LOUD, "case VAL_AP_TX_POWER_LEVEL (102)\n");
   4542 		retVal = UtilGetAPTxPowerLevel(pAdapter, SITE_MGR_AP_TX_POWER_PARAM, pData, PureInfoLength);
   4543 		break;
   4544 	case VAL_PACKET_BURSTING:
   4545 		PRINT(DBG_IOCTL_LOUD, "case VAL_PACKET_BURSTING (106)\n");
   4546 		retVal = UtilGetPacketBursting(pAdapter, QOS_PACKET_BURST_ENABLE, pData, PureInfoLength);
   4547 		break;
   4548 	case VAL_MIXED_MODE:
   4549 		dataSize = PureInfoLength;
   4550 		retVal = UtilGetMixedMode(pAdapter, RSN_MIXED_MODE, pData, &dataSize);
   4551 		break;
   4552 	case VAL_DEFAULT_KEY_ID:
   4553 		PRINT(DBG_IOCTL_LOUD, "case VAL_DEFAULT_KEY_ID (110)\n");
   4554 		dataSize = PureInfoLength;
   4555 		retVal = UtilGetDefaultKeyId(pAdapter, RSN_DEFAULT_KEY_ID, pData, &dataSize);
   4556 		break;
   4557 	default:
   4558 		PRINT(DBG_IOCTL_LOUD, "case default\n");
   4559 		break;
   4560 	}
   4561 	*Length = PureInfoLength;
   4562 	return retVal;
   4563 }
   4564 
   4565 /*-----------------------------------------------------------------------------
   4566 Routine Name:	UtilInfoCodeSetInformation
   4567 Routine Description:
   4568 Arguments:
   4569 Return Value:
   4570 -----------------------------------------------------------------------------*/
   4571 ULONG
   4572 UtilInfoCodeSetInformation(
   4573 						  PTIWLN_ADAPTER_T pAdapter,
   4574 						  PUCHAR pData,
   4575 						  ULONG Length
   4576 						  )
   4577 {
   4578 	UINT32 InfoCode, retVal, PureInfoLength;
   4579 
   4580 	PRINT(DBG_IOCTL_LOUD, "UtilInfoCodeSetInformation\n");
   4581 
   4582 	if (Length<sizeof(UINT32))
   4583 		return NOK;
   4584 
   4585 	InfoCode = *((UINT32*)pData);
   4586 	retVal = PureInfoLength = Length - sizeof(InfoCode);
   4587 
   4588 	switch (InfoCode)
   4589 	{
   4590 	case VAL_TX_POWER_VALUE:
   4591 		PRINT(DBG_IOCTL_LOUD, "case VAL_TX_POWER_VALUE (100)\n");
   4592 		retVal = UtilSetParam(pAdapter, REGULATORY_DOMAIN_CURRENT_TX_POWER_IN_DBM_PARAM, pData+sizeof(InfoCode), PureInfoLength);
   4593 		break;
   4594 	case VAL_NETWORK_TYPE:
   4595 		PRINT(DBG_IOCTL_LOUD, "case VAL_NETWORK_TYPE (101)\n");
   4596 		retVal = UtilNetworkTypeInUseSet(pAdapter, pData+sizeof(InfoCode), PureInfoLength);
   4597 		break;
   4598 	case VAL_PACKET_BURSTING:
   4599 		PRINT(DBG_IOCTL_LOUD, "case VAL_PACKET_BURSTING (106)\n");
   4600 		retVal = UtilSetPacketBursting(pAdapter, pData+sizeof(InfoCode), PureInfoLength);
   4601 		break;
   4602 	case VAL_MIXED_MODE:
   4603 		retVal = UtilSetMixedMode(pAdapter, pData+sizeof(InfoCode), PureInfoLength);
   4604 		break;
   4605 	case VAL_DEFAULT_KEY_ID:
   4606 		retVal = UtilSetParam(pAdapter, RSN_DEFAULT_KEY_ID, pData+sizeof(InfoCode), PureInfoLength);
   4607 		break;
   4608 	default:
   4609 		PRINT(DBG_IOCTL_LOUD, "case default\n");
   4610 		break;
   4611 	}
   4612 	return retVal;
   4613 }
   4614 
   4615 #ifdef _WINDOWS
   4616 #endif /* _WINDOWS */
   4617 
   4618 /*-----------------------------------------------------------------------------
   4619 Routine Name:	UtilTxPowerLevelDbmGet
   4620 Routine Description:
   4621 Arguments:
   4622 Return Value:
   4623 -----------------------------------------------------------------------------*/
   4624 ULONG
   4625 UtilTxPowerLevelDbmGet(
   4626 					  PTIWLN_ADAPTER_T pAdapter,
   4627 					  PUCHAR pData,
   4628 					  PULONG Length
   4629 					  )
   4630 {
   4631 	ULONG retValue;
   4632 
   4633 	if (!Length)
   4634 		return NOK;
   4635 
   4636 	retValue = UtilGetParam(pAdapter, REGULATORY_DOMAIN_CURRENT_TX_POWER_IN_DBM_PARAM, pData, sizeof(UINT8));
   4637 	*Length = sizeof(INT8);
   4638 
   4639 	return retValue;
   4640 }
   4641 
   4642 
   4643 /*-----------------------------------------------------------------------------
   4644 Routine Name:	UtilTxPowerLevelDbmSet
   4645 Routine Description:
   4646 Arguments:
   4647 Return Value:
   4648 -----------------------------------------------------------------------------*/
   4649 ULONG
   4650 UtilTxPowerLevelDbmSet(
   4651 					  PTIWLN_ADAPTER_T pAdapter,
   4652 					  PUCHAR pData,
   4653 					  ULONG Length
   4654 					  )
   4655 {
   4656 ULONG mW, Dbm, power,retValue;
   4657 
   4658 	if (!Length)
   4659 		return NOK;
   4660 
   4661 	mW = *(PULONG)pData;
   4662 
   4663 	for (power=1; mW/10; mW/=10, power++);
   4664 
   4665 	Dbm = 20 * power;
   4666 
   4667 
   4668 	retValue = UtilSetParam(pAdapter, REGULATORY_DOMAIN_CURRENT_TX_POWER_IN_DBM_PARAM, (PUCHAR)&Dbm, sizeof(ULONG));
   4669 	return retValue;
   4670 }
   4671 
   4672 /*-----------------------------------------------------------------------------
   4673 Routine Name:	Util802EapTypeGet
   4674 Routine Description:
   4675 Arguments:
   4676 Return Value:
   4677 -----------------------------------------------------------------------------*/
   4678 ULONG
   4679 Util802EapTypeGet(
   4680 				 PTIWLN_ADAPTER_T pAdapter,
   4681 				 PUCHAR pData,
   4682 				 PULONG Length
   4683 				 )
   4684 {
   4685 	ULONG retValue;
   4686 	retValue = UtilGetParam(pAdapter, RSN_EAP_TYPE, pData, sizeof(ULONG));
   4687 	*Length = sizeof(ULONG);
   4688 	return retValue;
   4689 }
   4690 
   4691 /*-----------------------------------------------------------------------------
   4692 Routine Name:	Util802EapTypeSet
   4693 Routine Description:
   4694 Arguments:
   4695 Return Value:
   4696 -----------------------------------------------------------------------------*/
   4697 ULONG
   4698 Util802EapTypeSet(
   4699 				 PTIWLN_ADAPTER_T pAdapter,
   4700 				 PUCHAR pData,
   4701 				 ULONG Length
   4702 				 )
   4703 {
   4704 	ULONG retValue;
   4705 	retValue = UtilSetParam(pAdapter, RSN_EAP_TYPE, pData, sizeof(ULONG));
   4706 	return retValue;
   4707 }
   4708 
   4709 #ifdef EXC_MODULE_INCLUDED
   4710 
   4711 /*-----------------------------------------------------------------------------
   4712 Routine Name:	UtilExcConfigurationGet
   4713 Routine Description:
   4714 Arguments:
   4715 Return Value:
   4716 -----------------------------------------------------------------------------*/
   4717 ULONG
   4718 UtilExcConfigurationGet(
   4719 					   PTIWLN_ADAPTER_T pAdapter,
   4720 					   PUCHAR pData,
   4721 					   PULONG Length
   4722 					   )
   4723 {
   4724 	ULONG retValue;
   4725 	retValue = UtilGetParam(pAdapter, EXC_CONFIGURATION, pData, sizeof(ULONG));
   4726 	*Length = sizeof(ULONG);
   4727 	return retValue;
   4728 }
   4729 
   4730 /*-----------------------------------------------------------------------------
   4731 Routine Name:	UtilExcNetworkEapGet
   4732 Routine Description:
   4733 Arguments:
   4734 Return Value:
   4735 -----------------------------------------------------------------------------*/
   4736 ULONG
   4737 UtilExcNetworkEapGet(
   4738 					PTIWLN_ADAPTER_T pAdapter,
   4739 					PUCHAR pData,
   4740 					PULONG Length
   4741 					)
   4742 {
   4743 	ULONG retValue;
   4744 	retValue = UtilGetParam(pAdapter, RSN_EXC_NETWORK_EAP, pData, sizeof(ULONG));
   4745 	*Length = sizeof(ULONG);
   4746 	return retValue;
   4747 }
   4748 
   4749 /*-----------------------------------------------------------------------------
   4750 Routine Name:	UtilExcConfigurationSet
   4751 Routine Description:
   4752 Arguments:
   4753 Return Value:
   4754 -----------------------------------------------------------------------------*/
   4755 ULONG
   4756 UtilExcConfigurationSet(
   4757 					   PTIWLN_ADAPTER_T pAdapter,
   4758 					   PUCHAR pData,
   4759 					   ULONG Length
   4760 					   )
   4761 {
   4762 	ULONG retValue;
   4763 	retValue = UtilSetParam(pAdapter, EXC_CONFIGURATION, pData, sizeof(ULONG));
   4764 	return retValue;
   4765 }
   4766 
   4767 /*-----------------------------------------------------------------------------
   4768 Routine Name:	UtilExcNetworkEapSet
   4769 Routine Description:
   4770 Arguments:
   4771 Return Value:
   4772 -----------------------------------------------------------------------------*/
   4773 ULONG
   4774 UtilExcNetworkEapSet(
   4775 					PTIWLN_ADAPTER_T pAdapter,
   4776 					PUCHAR pData,
   4777 					ULONG Length
   4778 					)
   4779 {
   4780 	ULONG retValue;
   4781 	retValue = UtilSetParam(pAdapter, RSN_EXC_NETWORK_EAP, pData, sizeof(ULONG));
   4782 	return retValue;
   4783 }
   4784 
   4785 
   4786 /*-----------------------------------------------------------------------------
   4787 Routine Name: UtilExcRogueApDetectedSet
   4788 Routine Description:
   4789 Arguments:
   4790 Return Value:
   4791 -----------------------------------------------------------------------------*/
   4792 ULONG
   4793 UtilExcRogueApDetectedSet(
   4794 						 PTIWLN_ADAPTER_T pAdapter,
   4795 						 PUCHAR pData,
   4796 						 ULONG Length
   4797 						 )
   4798 {
   4799 	ULONG retValue;
   4800 	retValue = UtilSetParam(pAdapter, EXC_ROGUE_AP_DETECTED, pData, sizeof(OS_EXC_ROGUE_AP_DETECTED));
   4801 	return retValue;
   4802 }
   4803 
   4804 /*-----------------------------------------------------------------------------
   4805 Routine Name:	UtilExcReportRogueApSet
   4806 Routine Description:
   4807 Arguments:
   4808 Return Value:
   4809 -----------------------------------------------------------------------------*/
   4810 ULONG
   4811 UtilExcReportRogueApSet(
   4812 					   PTIWLN_ADAPTER_T pAdapter,
   4813 					   PUCHAR pData,
   4814 					   ULONG Length
   4815 					   )
   4816 {
   4817 	ULONG retValue;
   4818 	retValue = UtilSetParam(pAdapter, EXC_REPORT_ROGUE_APS, pData, 0);
   4819 	return retValue;
   4820 }
   4821 
   4822 /*-----------------------------------------------------------------------------
   4823 Routine Name:	UtilExcAuthSuccessSet
   4824 Routine Description:
   4825 Arguments:
   4826 Return Value:
   4827 -----------------------------------------------------------------------------*/
   4828 ULONG
   4829 UtilExcAuthSuccessSet(
   4830 					 PTIWLN_ADAPTER_T pAdapter,
   4831 					 PUCHAR pData,
   4832 					 ULONG Length
   4833 					 )
   4834 {
   4835 	ULONG retValue;
   4836 	retValue = UtilSetParam(pAdapter, EXC_AUTH_SUCCESS, pData, sizeof(OS_EXC_AUTH_SUCCESS));
   4837 	return retValue;
   4838 }
   4839 
   4840 
   4841 /*-----------------------------------------------------------------------------
   4842 Routine Name:	UtilExcCckmRequestSet
   4843 Routine Description:
   4844 Arguments:
   4845 Return Value:
   4846 -----------------------------------------------------------------------------*/
   4847 ULONG
   4848 UtilExcCckmRequestSet(
   4849 					 PTIWLN_ADAPTER_T pAdapter,
   4850 					 PUCHAR pData,
   4851 					 ULONG Length
   4852 					 )
   4853 {
   4854 	ULONG retValue;
   4855 
   4856 	OS_EXC_CCKM_REQUEST *cckmRequest = (OS_EXC_CCKM_REQUEST*)pData;
   4857 	ULONG reqLength = cckmRequest->AssociationRequestIELength+sizeof(cckmRequest->RequestCode)+sizeof(cckmRequest->AssociationRequestIELength);
   4858 
   4859 	PRINTF(DBG_IOCTL_LOUD, ("UtilExcCckmRequestSet, In Length = %d, Required Length=%d\n",
   4860 							(int) Length, (int) reqLength));
   4861 
   4862 	if ((cckmRequest==NULL) || (reqLength > Length))
   4863 	{
   4864 		PRINTF(DBG_IOCTL_LOUD, ("UtilExcCckmRequestSet, wrong size or pointer, In Length = %d, Required Length=%d\n",
   4865 								(int) Length, (int) reqLength));
   4866 		return NOK;
   4867 	}
   4868 	retValue = UtilSetParam(pAdapter, EXC_CCKM_REQUEST, pData, reqLength);
   4869 	return retValue;
   4870 }
   4871 
   4872 
   4873 /*-----------------------------------------------------------------------------
   4874 Routine Name:	UtilExcCckmResultSet
   4875 Routine Description:
   4876 Arguments:
   4877 Return Value:
   4878 -----------------------------------------------------------------------------*/
   4879 ULONG
   4880 UtilExcCckmResultSet(
   4881 					PTIWLN_ADAPTER_T pAdapter,
   4882 					PUCHAR pData,
   4883 					ULONG Length
   4884 					)
   4885 {
   4886 	ULONG retValue;
   4887 	retValue = UtilSetParam(pAdapter, EXC_CCKM_RESULT, pData, sizeof(ULONG));
   4888 	return retValue;
   4889 }
   4890 
   4891 #endif /* EXC_MODULE_INCLUDED */
   4892 
   4893 
   4894 /*-----------------------------------------------------------------------------
   4895 Routine Name: UtilGetMACAddress
   4896 Routine Description:
   4897 Arguments:
   4898 Return Value:
   4899 -----------------------------------------------------------------------------*/
   4900 ULONG
   4901 UtilGetMACAddress(
   4902 				 PTIWLN_ADAPTER_T pAdapter,
   4903 				 PUCHAR pData,
   4904 				 PULONG Length
   4905 				 )
   4906 {
   4907 	ULONG retValue;
   4908 
   4909 	if ((*Length) < MAC_ADDR_LEN)
   4910 	{
   4911 		*Length = MAC_ADDR_LEN;
   4912 		return NOK;
   4913 	}
   4914 
   4915 	retValue = UtilGetParam(pAdapter, CTRL_DATA_MAC_ADDRESS, pData, MAC_ADDR_LEN);
   4916 	*Length = MAC_ADDR_LEN;
   4917 	return retValue;
   4918 }
   4919 
   4920 
   4921 /*-----------------------------------------------------------------------------
   4922 Routine Name:	UtilConfigRoamingParamsSet
   4923 Routine Description:
   4924 Arguments:
   4925 Return Value:
   4926 -----------------------------------------------------------------------------*/
   4927 ULONG
   4928 UtilConfigRoamingParamsSet(
   4929 						  PTIWLN_ADAPTER_T pAdapter,
   4930 						  PUCHAR pData,
   4931 						  ULONG Length
   4932 						  )
   4933 {
   4934 	ULONG retValue;
   4935 	applicationConfigBuffer_t applicationConfigBuffer;
   4936 
   4937 	applicationConfigBuffer.buffer = pData;
   4938 	applicationConfigBuffer.bufferSize = (UINT16)Length;
   4939 
   4940 	retValue = UtilSetParam(pAdapter, ROAMING_MNGR_APPLICATION_CONFIGURATION, (PUCHAR)&applicationConfigBuffer, sizeof(applicationConfigBuffer_t));
   4941 
   4942 	return retValue;
   4943 }
   4944 
   4945 /*-----------------------------------------------------------------------------
   4946 Routine Name:	UtilConfigRoamingParamsGet
   4947 Routine Description:
   4948 Arguments:
   4949 Return Value:
   4950 -----------------------------------------------------------------------------*/
   4951 ULONG
   4952 UtilConfigRoamingParamsGet(
   4953 						  PTIWLN_ADAPTER_T pAdapter,
   4954 						  PUCHAR pData,
   4955 						  PULONG Length
   4956 						  )
   4957 {
   4958 	ULONG retValue;
   4959 	retValue = UtilGetParam(pAdapter, ROAMING_MNGR_APPLICATION_CONFIGURATION, pData, *Length);
   4960 	return retValue;
   4961 }
   4962 
   4963 
   4964 /*-----------------------------------------------------------------------------
   4965 Routine Name:	UtilMeasurementEnableDisableParamsSet
   4966 Routine Description:
   4967 Arguments:
   4968 Return Value:
   4969 -----------------------------------------------------------------------------*/
   4970 ULONG
   4971 UtilMeasurementEnableDisableParamsSet(
   4972 									 PTIWLN_ADAPTER_T pAdapter,
   4973 									 PUCHAR pData,
   4974 									 ULONG Length
   4975 									 )
   4976 {
   4977 	ULONG retValue;
   4978 	retValue = UtilSetParam(pAdapter, MEASUREMENT_ENABLE_DISABLE_PARAM, pData, Length);
   4979 	return retValue;
   4980 }
   4981 
   4982 /*-----------------------------------------------------------------------------
   4983 Routine Name:	UtilMeasurementMaxDurationParamsSet
   4984 Routine Description:
   4985 Arguments:
   4986 Return Value:
   4987 -----------------------------------------------------------------------------*/
   4988 ULONG
   4989 UtilMeasurementMaxDurationParamsSet(
   4990 								   PTIWLN_ADAPTER_T pAdapter,
   4991 								   PUCHAR pData,
   4992 								   ULONG Length
   4993 								   )
   4994 {
   4995 	ULONG retValue;
   4996 	retValue = UtilSetParam(pAdapter, MEASUREMENT_MAX_DURATION_PARAM, pData, sizeof(UINT32));
   4997 	return retValue;
   4998 }
   4999 
   5000 /*-----------------------------------------------------------------------------
   5001 Routine Name:	UtilEarlyWakeupIeGet
   5002 Routine Description:
   5003 Arguments:
   5004 Return Value:
   5005 -----------------------------------------------------------------------------*/
   5006 ULONG
   5007 UtilEarlyWakeupIeGet(
   5008 				 PTIWLN_ADAPTER_T pAdapter,
   5009 				 PUCHAR pData,
   5010 				 PULONG Length
   5011 				 )
   5012 {
   5013 	ULONG retValue;
   5014 
   5015 	if (!Length)
   5016 		return NOK;
   5017 
   5018 	retValue = UtilGetParam(pAdapter, HAL_CTRL_EARLY_WAKEUP, pData, sizeof(UINT8));
   5019 
   5020 	*Length = sizeof(UINT8);
   5021 
   5022 	return retValue;
   5023 }
   5024 
   5025 
   5026 /*-----------------------------------------------------------------------------
   5027 Routine Name:	UtilEarlyWakeupIeSet
   5028 Routine Description:
   5029 Arguments:
   5030 Return Value:
   5031 -----------------------------------------------------------------------------*/
   5032 ULONG
   5033 UtilEarlyWakeupIeSet(
   5034 				 PTIWLN_ADAPTER_T pAdapter,
   5035 				 PUCHAR pData,
   5036 				 ULONG Length
   5037 				 )
   5038 {
   5039 	ULONG retValue;
   5040 	retValue = UtilSetParam(pAdapter, HAL_CTRL_EARLY_WAKEUP, pData, sizeof(ULONG));
   5041 	return retValue;
   5042 }
   5043 
   5044 
   5045 
   5046 /*-----------------------------------------------------------------------------
   5047 Routine Name:	UtilBthWlanCoeEnable
   5048 Routine Description:
   5049 Arguments:
   5050 Return Value:
   5051 -----------------------------------------------------------------------------*/
   5052 ULONG
   5053 UtilBthWlanCoeEnable(
   5054 					PTIWLN_ADAPTER_T pAdapter,
   5055 					PUCHAR pData,
   5056 					ULONG Length
   5057 					)
   5058 {
   5059 	ULONG retValue;
   5060 	retValue = UtilSetParam(pAdapter, SOFT_GEMINI_SET_ENABLE, pData, sizeof(ULONG));
   5061 	return retValue;
   5062 }
   5063 
   5064 /*-----------------------------------------------------------------------------
   5065 Routine Name:	UtilBthWlanCoeRate
   5066 Routine Description:
   5067 Arguments:
   5068 Return Value:
   5069 -----------------------------------------------------------------------------*/
   5070 ULONG
   5071 UtilBthWlanCoeRate(
   5072 				  PTIWLN_ADAPTER_T pAdapter,
   5073 				  PUCHAR pData,
   5074 				  ULONG Length
   5075 				  )
   5076 {
   5077 	ULONG retValue;
   5078 	retValue = UtilSetParam(pAdapter, SOFT_GEMINI_SET_RATE, pData, sizeof(ULONG)*NUM_OF_RATES_IN_SG);
   5079 	return retValue;
   5080 }
   5081 
   5082 
   5083 /*-----------------------------------------------------------------------------
   5084 Routine Name:	UtilBthWlanCoeConfig
   5085 Routine Description:
   5086 Arguments:
   5087 Return Value:
   5088 -----------------------------------------------------------------------------*/
   5089 ULONG
   5090 UtilBthWlanCoeConfig(
   5091 					PTIWLN_ADAPTER_T pAdapter,
   5092 					PUCHAR pData,
   5093 					ULONG Length
   5094 					)
   5095 {
   5096 	ULONG retValue;
   5097 	retValue = UtilSetParam(pAdapter, SOFT_GEMINI_SET_CONFIG, pData, sizeof(ULONG) * NUM_OF_CONFIG_PARAMS_IN_SG);
   5098 	return retValue;
   5099 }
   5100 
   5101 
   5102 /*-----------------------------------------------------------------------------
   5103 Routine Name:	UtilBthWlanCoeGetStatus
   5104 Routine Description:
   5105 Arguments:
   5106 Return Value:
   5107 -----------------------------------------------------------------------------*/
   5108 ULONG
   5109 UtilBthWlanCoeGetStatus(
   5110 					   PTIWLN_ADAPTER_T pAdapter,
   5111 					   PUCHAR pData,
   5112 					   PULONG Length
   5113 					   )
   5114 {
   5115 	ULONG retValue;
   5116 	retValue = UtilGetParam(pAdapter, SOFT_GEMINI_GET_STATUS, pData, 0);
   5117 	*Length = 0;
   5118 	return retValue;
   5119 }
   5120 
   5121 
   5122 /*-----------------------------------------------------------------------------
   5123 Routine Name: UtilPltRxPerStart
   5124 Routine Description:
   5125 Arguments:
   5126 Return Value:
   5127 -----------------------------------------------------------------------------*/
   5128 ULONG
   5129 UtilPltRxPerStart(
   5130 				 PTIWLN_ADAPTER_T pAdapter,
   5131 				 PUCHAR pData,
   5132 				 ULONG Length
   5133 				 )
   5134 {
   5135 	ULONG Status;
   5136 	interogateCmdCBParams_t interogateCmdCBParams;
   5137 	memset(&(pAdapter->IoCompleteBuff[0]) , 0xFF , MAX_IO_BUFFER_COMPLETE_SIZE );
   5138 
   5139 	/* Fill the IOCTL struct to the Command Mailbox by giving a stack parameter */
   5140 	interogateCmdCBParams.CB_handle  =  (TI_HANDLE)pAdapter;
   5141 	interogateCmdCBParams.CB_Func    =  NULL;
   5142 	interogateCmdCBParams.CB_buf     =  NULL;
   5143 	Status = UtilSetParam(pAdapter, HAL_CTRL_PLT_RX_PER_START, (PUCHAR)&interogateCmdCBParams, sizeof(interogateCmdCBParams));
   5144 
   5145 	return Status;
   5146 }
   5147 
   5148 /*-----------------------------------------------------------------------------
   5149 Routine Name: UtilPltRxPerStop
   5150 Routine Description:
   5151 Arguments:
   5152 Return Value:
   5153 -----------------------------------------------------------------------------*/
   5154 ULONG
   5155 UtilPltRxPerStop(
   5156 				PTIWLN_ADAPTER_T pAdapter,
   5157 				PUCHAR pData,
   5158 				ULONG Length
   5159 				)
   5160 {
   5161 	ULONG Status;
   5162 	interogateCmdCBParams_t interogateCmdCBParams;
   5163 
   5164 	/* Fill the IOCTL struct to the Command Mailbox by giving a stack parameter */
   5165 	interogateCmdCBParams.CB_handle  =  (TI_HANDLE)pAdapter;
   5166 	interogateCmdCBParams.CB_Func    =  NULL;
   5167 	interogateCmdCBParams.CB_buf     =  NULL;
   5168 	Status = UtilSetParam(pAdapter, HAL_CTRL_PLT_RX_PER_STOP, (PUCHAR)&interogateCmdCBParams, sizeof(interogateCmdCBParams));
   5169 	return Status;
   5170 }
   5171 
   5172 /*-----------------------------------------------------------------------------
   5173 Routine Name: UtilPltRxPerClear
   5174 Routine Description:
   5175 Arguments:
   5176 Return Value:
   5177 -----------------------------------------------------------------------------*/
   5178 ULONG
   5179 UtilPltRxPerClear(
   5180 				 PTIWLN_ADAPTER_T pAdapter,
   5181 				 PUCHAR pData,
   5182 				 ULONG Length
   5183 				 )
   5184 {
   5185 	ULONG Status;
   5186 	interogateCmdCBParams_t interogateCmdCBParams;
   5187 	memset(&(pAdapter->IoCompleteBuff[0]) , 0xFF , MAX_IO_BUFFER_COMPLETE_SIZE );
   5188 
   5189 	/* Fill the IOCTL struct to the Command Mailbox by giving a stack parameter */
   5190 	interogateCmdCBParams.CB_handle  =  (TI_HANDLE)pAdapter;
   5191 	interogateCmdCBParams.CB_Func    =  NULL;
   5192 	interogateCmdCBParams.CB_buf     =  NULL;
   5193 	Status = UtilSetParam(pAdapter, HAL_CTRL_PLT_RX_PER_CLEAR, (PUCHAR)&interogateCmdCBParams, sizeof(interogateCmdCBParams));
   5194 	return Status;
   5195 }
   5196 
   5197 /*-----------------------------------------------------------------------------
   5198 Routine Name: UtilPltRxPerGetResults
   5199 Routine Description:
   5200 Arguments:
   5201 Return Value:
   5202 -----------------------------------------------------------------------------*/
   5203 ULONG
   5204 UtilPltRxPerGetResults(
   5205 					  PTIWLN_ADAPTER_T pAdapter,
   5206 					  PUCHAR pData,
   5207 					  PULONG pLength
   5208 					  )
   5209 {
   5210 
   5211 	ULONG Status;
   5212 	paramInfo_t Param;
   5213 	interogateCmdCBParams_t* pInterogateCmdCBParams = &Param.content.interogateCmdCBParams;
   5214 
   5215 	memset(&(pAdapter->IoCompleteBuff[0]) , 0xFF , MAX_IO_BUFFER_COMPLETE_SIZE );
   5216 
   5217 	/* To implement the Async IOCTL store the user buffer pointer to be filled at
   5218 	the Command Completion calback */
   5219 	pAdapter->pIoBuffer =  pData;
   5220 	pAdapter->pIoCompleteBuffSize =  pLength ;
   5221 
   5222 
   5223 	/* Fill the IOCTL struct to the Command Mailbox by giving a stack parameter */
   5224 	pInterogateCmdCBParams->CB_handle  =  (TI_HANDLE)pAdapter;
   5225 	pInterogateCmdCBParams->CB_Func    =  (PVOID)UtilPltRxPerCB;
   5226 	pInterogateCmdCBParams->CB_buf     =  &(pAdapter->IoCompleteBuff[0]);
   5227 
   5228 	Param.paramType = HAL_CTRL_PLT_RX_PER_GET_RESULTS;
   5229 	Param.paramLength = sizeof(interogateCmdCBParams_t);
   5230 
   5231 	Status = configMgr_getParam(pAdapter->CoreHalCtx, &Param);
   5232 
   5233 	return Status;
   5234 }
   5235 
   5236 
   5237 /*-----------------------------------------------------------------------------
   5238 Routine Name:	UtilPltRxPerCB
   5239 
   5240 Routine Description: This is the CB triggered when  PltRX command been
   5241 					returned by FW.
   5242 Arguments:
   5243 
   5244 Return Value:
   5245 -----------------------------------------------------------------------------*/
   5246 VOID UtilPltRxPerCB(TI_HANDLE hAdapter,TI_STATUS status,PUINT8 pReadBuff)
   5247 {
   5248 	HwMboxCmdBit_RxPer_t* pRxPer =  (HwMboxCmdBit_RxPer_t* )pReadBuff;
   5249 	PTIWLN_ADAPTER_T pAdapter = (PTIWLN_ADAPTER_T)hAdapter;
   5250 
   5251 	if (pRxPer->CB_RxPerCmd == PLT_RX_PER_GETRESULTS)
   5252 	{
   5253 		*(pAdapter->pIoCompleteBuffSize) = sizeof(pRxPer->PltRxPer);
   5254 		os_memoryCopy(hAdapter, (void*)&(pAdapter->pIoBuffer[0]) ,(void*) &(pRxPer->PltRxPer) , *(pAdapter->pIoCompleteBuffSize));
   5255 		/* Call back the Completion that will indicate to the user that the buffer is ready to be read */
   5256 		os_IoctlComplete(pAdapter, status);
   5257 
   5258 	}
   5259 }
   5260 
   5261 /*-----------------------------------------------------------------------------
   5262 Routine Name: UtilPltTxCW
   5263 Routine Description:
   5264 Arguments:
   5265 Return Value:
   5266 -----------------------------------------------------------------------------*/
   5267 ULONG UtilPltTxCW(PTIWLN_ADAPTER_T pAdapter, PUCHAR pData, ULONG Length)
   5268 {
   5269 	ULONG retValue;
   5270 	retValue = UtilSetParam(pAdapter, HAL_CTRL_PLT_TX_CW, pData, Length);
   5271 	return retValue;
   5272 }
   5273 /*-----------------------------------------------------------------------------
   5274 Routine Name: UtilPltTxContinues
   5275 Routine Description:
   5276 Arguments:
   5277 Return Value:
   5278 -----------------------------------------------------------------------------*/
   5279 ULONG UtilPltTxContinues(PTIWLN_ADAPTER_T pAdapter, PUCHAR pData, ULONG Length)
   5280 {
   5281 	ULONG retValue;
   5282 	retValue = UtilSetParam(pAdapter, HAL_CTRL_PLT_TX_CONTINUES, pData, Length);
   5283 	return retValue;
   5284 }
   5285 
   5286 /*-----------------------------------------------------------------------------
   5287 Routine Name: UtilPltTxStop
   5288 Routine Description:
   5289 Arguments:
   5290 Return Value:
   5291 -----------------------------------------------------------------------------*/
   5292 ULONG UtilPltTxStop(PTIWLN_ADAPTER_T pAdapter, PUCHAR pData, ULONG Length)
   5293 {
   5294 	ULONG retValue;
   5295 	retValue = UtilSetParam(pAdapter, HAL_CTRL_PLT_TX_STOP, pData, 0);
   5296 	return retValue;
   5297 }
   5298 
   5299 /*-----------------------------------------------------------------------------
   5300 Routine Name: UtilPltWriteMib
   5301 Routine Description:
   5302 Arguments:
   5303 Return Value:
   5304 -----------------------------------------------------------------------------*/
   5305 ULONG UtilPltWriteMib(PTIWLN_ADAPTER_T pAdapter, PUCHAR pData, ULONG Length)
   5306 {
   5307 	ULONG retValue;
   5308 	retValue = UtilSetParam(pAdapter, HAL_CTRL_PLT_WRITE_MIB, pData, Length);
   5309 	return retValue;
   5310 }
   5311 /*-----------------------------------------------------------------------------
   5312 Routine Name: UtilPltReadMib
   5313 Routine Description:
   5314 Arguments:
   5315 Return Value:
   5316 -----------------------------------------------------------------------------*/
   5317 ULONG UtilPltReadMib(PTIWLN_ADAPTER_T pAdapter, PUCHAR pData, PULONG pOutLength, ULONG InLength)
   5318 {
   5319 	ULONG Status;
   5320 	paramInfo_t Param;
   5321 
   5322 	/* To implement the Async IOCTL store the user buffer pointer to be filled at
   5323 	the Command Completion calback */
   5324 	pAdapter->pIoBuffer =  pData;
   5325 	pAdapter->pIoCompleteBuffSize =  pOutLength;
   5326 
   5327 	os_memoryCopy((TI_HANDLE)pAdapter, (PVOID)pAdapter->IoCompleteBuff, pData, InLength);
   5328 
   5329 	/* Fill the IOCTL struct to the Command Mailbox by giving a stack parameter */
   5330 	Param.content.interogateCmdCBParams.CB_handle  =  (TI_HANDLE)pAdapter;
   5331 	Param.content.interogateCmdCBParams.CB_Func  =  (PVOID)UtilPltReadMibCB;
   5332 	Param.content.interogateCmdCBParams.CB_buf  =  pAdapter->IoCompleteBuff;
   5333 
   5334 	Param.paramType = HAL_CTRL_PLT_READ_MIB;
   5335 	Param.paramLength = sizeof(interogateCmdCBParams_t);
   5336 	Status = configMgr_getParam(pAdapter->CoreHalCtx, &Param);
   5337 
   5338 	return Status;
   5339 }
   5340 
   5341 
   5342 /*-----------------------------------------------------------------------------
   5343 Routine Name:	UtilPltReadMibCB
   5344 
   5345 Routine Description: This is the CB triggered when  PltReadRegister command been
   5346 					returned by FW.
   5347 Arguments:
   5348 
   5349 Return Value:
   5350 -----------------------------------------------------------------------------*/
   5351 VOID UtilPltReadMibCB(TI_HANDLE hAdapter,TI_STATUS status,PUINT8 pReadBuff)
   5352 {
   5353 	PTIWLN_ADAPTER_T pAdapter = (PTIWLN_ADAPTER_T)hAdapter;
   5354 	PLT_MIB_t* pReturnMib = (PLT_MIB_t*)pAdapter->pIoBuffer;
   5355 	tiBOOL IsAsync = TRUE;
   5356 
   5357 	switch (pReturnMib->aMib)
   5358 	{
   5359 	case PLT_MIB_dot11StationId:
   5360 		{
   5361 			dot11StationIDStruct* pdot11StationID = (dot11StationIDStruct*)pReadBuff;
   5362 			pReturnMib->Length = sizeof(pReturnMib->aData.StationId);
   5363 			os_memoryCopy(hAdapter, (PVOID)pReturnMib->aData.StationId.addr, (PVOID)pdot11StationID->dot11StationID, sizeof(pReturnMib->aData.StationId));
   5364 		}
   5365 		break;
   5366 
   5367 	case PLT_MIB_countersTable:
   5368 		{
   5369 			ACXErrorCounters_t* pACXErrorCounters = (ACXErrorCounters_t*)pReadBuff;
   5370 			pReturnMib->Length = sizeof(pReturnMib->aData.CounterTable);
   5371 			pReturnMib->aData.CounterTable.FCSErrorCount = pACXErrorCounters->FCSErrorCount;
   5372 			pReturnMib->aData.CounterTable.PLCPErrorCount = pACXErrorCounters->PLCPErrorCount;
   5373 		}
   5374 		break;
   5375 
   5376 		/* MIBs with data which is already in pReadBuff and in the correct form. */
   5377 	case PLT_MIB_ctsToSelf:
   5378 	case PLT_MIB_dot11MaxReceiveLifetime:
   5379 	case PLT_MIB_dot11GroupAddressesTable:
   5380 	case PLT_MIB_arpIpAddressesTable:
   5381 	case PLT_MIB_rxFilter:
   5382 	case PLT_MIB_templateFrame:
   5383 	case PLT_MIB_beaconFilterIETable:
   5384 	case PLT_MIB_txRatePolicy:
   5385 		IsAsync = FALSE;
   5386 		PRINTF(DBG_NDIS_OIDS_LOUD, ("UtilPltReadMibCB:MIB aMib 0x%x \n",pReturnMib->aMib));
   5387 		os_memoryCopy(hAdapter, (PVOID)pAdapter->pIoBuffer, (PVOID)pAdapter->IoCompleteBuff, sizeof(PLT_MIB_t));
   5388 		break;
   5389 	default:
   5390 		PRINTF(DBG_NDIS_OIDS_LOUD, ("UtilPltReadMibCB:MIB aMib 0x%x Not supported\n",pReturnMib->aMib));
   5391 	}
   5392 	/* Call back the Completion that will indicate to the user that the buffer is ready to be read */
   5393 	if (IsAsync)
   5394 		os_IoctlComplete(pAdapter, status);
   5395 }
   5396 
   5397 /*-----------------------------------------------------------------------------
   5398 Routine Name: UtilPltReadRegister
   5399 Routine Description:
   5400 Arguments:
   5401 Return Value:
   5402 -----------------------------------------------------------------------------*/
   5403 ULONG
   5404 UtilPltReadRegister(
   5405 				   PTIWLN_ADAPTER_T pAdapter,
   5406 				   PUCHAR pData,
   5407 				   PULONG Length
   5408 				   )
   5409 {
   5410 
   5411 	ULONG Status;
   5412 	paramInfo_t Param;
   5413 	interogateCmdCBParams_t* pInterogateCmdCBParams = &Param.content.interogateCmdCBParams;
   5414 	ReadWriteCommand_t* pReadWriteCommandStruct = (ReadWriteCommand_t*)pAdapter->IoCompleteBuff;
   5415 	UINT32* pRegAdress = (UINT32*)pData;
   5416 
   5417 	/* To implement the Async IOCTL store the user buffer pointer to be filled at
   5418 	the Command Completion calback */
   5419 	pAdapter->pIoBuffer =  pData;
   5420 	pAdapter->pIoCompleteBuffSize =  Length ;
   5421 
   5422 	memset(&(pAdapter->IoCompleteBuff[0]) , 0xFF , MAX_IO_BUFFER_COMPLETE_SIZE );
   5423 	pReadWriteCommandStruct->addr = *pRegAdress;
   5424 	pReadWriteCommandStruct->size = 4;
   5425 
   5426 	/* Fill the IOCTL struct to the Command Mailbox by giving a stack parameter */
   5427 	pInterogateCmdCBParams->CB_handle  =  (TI_HANDLE)pAdapter;
   5428 	pInterogateCmdCBParams->CB_Func    =  (PVOID)UtilPltReadRegisterCB;
   5429 	pInterogateCmdCBParams->CB_buf     =  &(pAdapter->IoCompleteBuff[0]) ;
   5430 
   5431 	Param.paramType = HAL_CTRL_PLT_READ_REGISTER;
   5432 	Param.paramLength = sizeof(interogateCmdCBParams_t);
   5433 
   5434 	Status = configMgr_getParam(pAdapter->CoreHalCtx, &Param);
   5435 	return Status;
   5436 }
   5437 
   5438 /*-----------------------------------------------------------------------------
   5439 Routine Name:	UtilPltReadRegisterCB
   5440 
   5441 Routine Description: This is the CB triggered when  PltReadRegister command been
   5442 					returned by FW.
   5443 Arguments:
   5444 
   5445 Return Value:
   5446 -----------------------------------------------------------------------------*/
   5447 VOID UtilPltReadRegisterCB(TI_HANDLE hAdapter,TI_STATUS status,PUINT8 pReadBuff)
   5448 {
   5449 	PTIWLN_ADAPTER_T pAdapter = (PTIWLN_ADAPTER_T)hAdapter;
   5450 	ReadWriteCommand_t* pReadWriteCommandStruct = (ReadWriteCommand_t*)pReadBuff;
   5451 	UINT32* pRegDataReturn = (UINT32*)pAdapter->pIoBuffer;
   5452 
   5453 	*(pAdapter->pIoCompleteBuffSize) = sizeof(INT32);
   5454 
   5455 	/*Convert the returned data structure from ReadWriteCommandStruct to UINT32*/
   5456 	os_memoryCopy(hAdapter, (PVOID)pRegDataReturn, (PVOID)pReadWriteCommandStruct->value, sizeof(UINT32));
   5457 
   5458 	/* Call back the Completion that will indicate to the user that the buffer is ready to be read */
   5459 	os_IoctlComplete(pAdapter, status);
   5460 }
   5461 
   5462 /*-----------------------------------------------------------------------------
   5463 Routine Name: UtilPltWriteRegister
   5464 Routine Description:
   5465 Arguments:
   5466 Return Value:
   5467 -----------------------------------------------------------------------------*/
   5468 ULONG
   5469 UtilPltWriteRegister(
   5470 					PTIWLN_ADAPTER_T pAdapter,
   5471 					PUCHAR pData,
   5472 					ULONG Length
   5473 					)
   5474 {
   5475 	ReadWriteCommand_t* pReadWriteCommandStruct = (ReadWriteCommand_t*)pAdapter->IoCompleteBuff;
   5476 	TIWLN_REG_RW* pReg = (TIWLN_REG_RW*)pData;
   5477 	interogateCmdCBParams_t interogateCmdCBParams;
   5478 	UINT32 Status;
   5479 
   5480 
   5481 	pReadWriteCommandStruct->addr = pReg->regAddr;
   5482 	pReadWriteCommandStruct->size = pReg->regSize;
   5483 	os_memoryCopy((TI_HANDLE)pAdapter, (PVOID)pReadWriteCommandStruct->value, (PVOID)&pReg->regValue, pReadWriteCommandStruct->size);
   5484 
   5485 	/* Fill the IOCTL struct to the Command Mailbox by giving a stack parameter */
   5486 	interogateCmdCBParams.CB_handle  =  (TI_HANDLE)pAdapter;
   5487 	interogateCmdCBParams.CB_Func    =  NULL;
   5488 	interogateCmdCBParams.CB_buf     =  pAdapter->IoCompleteBuff;
   5489 	Status = UtilSetParam(pAdapter, HAL_CTRL_PLT_WRITE_REGISTER, (PUCHAR)&interogateCmdCBParams, sizeof(interogateCmdCBParams));
   5490 	return Status;
   5491 }
   5492 
   5493 /*-----------------------------------------------------------------------------
   5494 Routine Name: utilPltRxTxCal
   5495 Routine Description:
   5496 Arguments:
   5497 Return Value:
   5498 -----------------------------------------------------------------------------*/
   5499 ULONG UtilPltRxTxCal(
   5500 				   PTIWLN_ADAPTER_T pAdapter,
   5501 				   PUCHAR pData,
   5502 				   PULONG pOutLength,
   5503 				   ULONG  InLength)
   5504 
   5505 {
   5506 	paramInfo_t Param;
   5507 	interogateCmdCBParams_t* pInterogateCmdCBParams = &Param.content.interogateCmdCBParams;
   5508 
   5509 	/* To implement the Async IOCTL store the user buffer pointer to be filled at
   5510 	the Command Completion callback */
   5511 	pAdapter->pIoBuffer =  (PUINT8)pData;
   5512 	pAdapter->pIoCompleteBuffSize =  pOutLength;
   5513 
   5514 	/* Fill the IOCTL struct to the Command Mailbox by giving a stack parameter */
   5515 	pInterogateCmdCBParams->CB_handle  =  (TI_HANDLE)pAdapter;
   5516 	pInterogateCmdCBParams->CB_Func    =  (PVOID)UtilPltRxTxCalCB;
   5517     pInterogateCmdCBParams->CB_buf     = pAdapter->pIoBuffer;
   5518 
   5519 	Param.paramType = HAL_CTRL_PLT_RX_TX_CAL;
   5520 	Param.paramLength = sizeof(interogateCmdCBParams_t);
   5521 
   5522 	return configMgr_getParam(pAdapter->CoreHalCtx, &Param);
   5523 }
   5524 
   5525 /*-----------------------------------------------------------------------------
   5526 Routine Name:	UtilPltRxTxCalCB
   5527 
   5528 Routine Description: This is the CB triggered when  utilPltRxTxCal command been
   5529 					returned by FW.
   5530 Arguments:          pReadBuff - Should return the TestCmd_t
   5531 
   5532 Return Value:
   5533 -----------------------------------------------------------------------------*/
   5534 VOID UtilPltRxTxCalCB(TI_HANDLE hAdapter,TI_STATUS status,PUINT8 pReadBuff)
   5535 {
   5536 	PTIWLN_ADAPTER_T pAdapter = (PTIWLN_ADAPTER_T)hAdapter;
   5537 
   5538     *(pAdapter->pIoCompleteBuffSize) = sizeof(TestCmd_t);
   5539 
   5540      /* Call back the Completion that will indicate to the user that the buffer is ready to be read */
   5541 	os_IoctlComplete(pAdapter, status);
   5542 }
   5543 
   5544 /*-----------------------------------------------------------------------------
   5545 Routine Name: UtilPltRxCal
   5546 Routine Description:
   5547 Arguments:
   5548 Return Value:
   5549 -----------------------------------------------------------------------------*/
   5550 ULONG UtilPltRxCal(
   5551                    PTIWLN_ADAPTER_T pAdapter,
   5552                    PUCHAR pData,
   5553                    PULONG pOutLength,
   5554                    ULONG InLength)
   5555 {
   5556     whalParamInfo_t Param;
   5557 
   5558     Param.paramType = HAL_CTRL_PLT_RX_TX_CAL;
   5559     Param.paramLength = sizeof(TestCmd_t*);
   5560     Param.content.interogateCmdCBParams.CB_Func = NULL;
   5561     Param.content.interogateCmdCBParams.CB_handle = NULL;
   5562     Param.content.interogateCmdCBParams.CB_buf = (PUINT8)pData;
   5563 
   5564     return configMgr_getParam(pAdapter->CoreHalCtx, (paramInfo_t*)&Param);
   5565 }
   5566 
   5567 /*-----------------------------------------------------------------------------
   5568 Routine Name: utilRxCalibrationStatus
   5569 Routine Description:
   5570 Arguments:
   5571 Return Value:
   5572 -----------------------------------------------------------------------------*/
   5573 ULONG utilRxCalibrationStatus(
   5574                    PTIWLN_ADAPTER_T pAdapter,
   5575                    PUCHAR pData,
   5576                    PULONG pOutLength,
   5577                    ULONG  InLength)
   5578 {
   5579     whalParamInfo_t Param;
   5580     ULONG status;
   5581 
   5582     Param.paramType = HAL_CTRL_PLT_RX_CAL_STATUS;
   5583     Param.paramLength = sizeof(TI_STATUS);
   5584 
   5585     status = configMgr_getParam(pAdapter->CoreHalCtx, (paramInfo_t*)&Param);
   5586 
   5587     *pData = Param.content.PltRxCalibrationStatus;
   5588 
   5589     return status;
   5590 }
   5591