PageRenderTime 67ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 1ms

/drivers/net/wireless/tiwlan1251/pform/common/src/osUtil.c

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