PageRenderTime 76ms CodeModel.GetById 6ms RepoModel.GetById 0ms app.codeStats 1ms

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

http://github.com/CyanogenMod/cm-kernel
C | 2526 lines | 1442 code | 477 blank | 607 comment | 46 complexity | 6f483839279275d1d2ab27aea9552aec MD5 | raw file
Possible License(s): AGPL-1.0, GPL-2.0, LGPL-2.0

Large files files are truncated, but you can click here to view the full file

  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 pDa

Large files files are truncated, but you can click here to view the full file