PageRenderTime 62ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 1ms

/drivers/net/wireless/tiwlan1251/common/src/hal/hw_ctrl/whalHwMboxConfig.c

https://bitbucket.org/cyanogenmod/cm-kernel
C | 3048 lines | 1369 code | 463 blank | 1216 comment | 51 complexity | 3da79156b721ac35b4ac23118809ddd3 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.0, AGPL-1.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. /****************************************************************************
  36. *
  37. * MODULE: whalHwMboxConfig.c
  38. * PURPOSE: Handle the wlan hardware information elements:
  39. *
  40. ****************************************************************************/
  41. #include "whalCommon.h"
  42. #include "whalHwDefs.h"
  43. #include "public_infoele.h"
  44. #include "CmdQueue_api.h"
  45. #include "whalHwMboxConfig.h"
  46. /****************************************************************************
  47. * whal_hwMboxConfig_Create()
  48. ****************************************************************************
  49. * DESCRIPTION: Create the mailbox configuration commands object
  50. *
  51. * INPUTS:
  52. *
  53. * OUTPUT: None
  54. *
  55. * RETURNS: The Created object
  56. ****************************************************************************/
  57. HwMboxConfig_T* whal_hwMboxConfig_Create (TI_HANDLE hOs)
  58. {
  59. HwMboxConfig_T* pObj;
  60. pObj = os_memoryAlloc (hOs, sizeof(HwMboxConfig_T));
  61. if (pObj == NULL)
  62. return NULL;
  63. os_memoryZero (hOs, (void *)pObj, sizeof(HwMboxConfig_T));
  64. pObj->hOs = hOs;
  65. return(pObj);
  66. }
  67. /****************************************************************************
  68. * whal_hwMboxConfig_Destroy()
  69. ****************************************************************************
  70. * DESCRIPTION: Destroy the object
  71. *
  72. * INPUTS:
  73. * pHwMboxConfig The object to free
  74. *
  75. * OUTPUT: None
  76. *
  77. * RETURNS: OK or NOK
  78. ****************************************************************************/
  79. int whal_hwMboxConfig_Destroy (HwMboxConfig_T* pHwMboxConfig)
  80. {
  81. if (pHwMboxConfig)
  82. os_memoryFree(pHwMboxConfig->hOs, pHwMboxConfig, sizeof(HwMboxConfig_T));
  83. return (OK);
  84. }
  85. /****************************************************************************
  86. * whal_hwMboxConfig_Config()
  87. ****************************************************************************
  88. * DESCRIPTION: Configure the object
  89. *
  90. * INPUTS:
  91. *
  92. * OUTPUT: None
  93. *
  94. * RETURNS: OK or NOK
  95. ****************************************************************************/
  96. int whal_hwMboxConfig_Config (HwMboxConfig_T* pHwMboxConfig,TI_HANDLE hCmdMboxQueue, TI_HANDLE hReport)
  97. {
  98. pHwMboxConfig->hReport = hReport;
  99. pHwMboxConfig->hCmdMboxQueue = hCmdMboxQueue;
  100. return (OK);
  101. }
  102. /****************************************************************************
  103. * whal_hwInfoElemConfigMemorySet()
  104. ****************************************************************************
  105. * DESCRIPTION: Configure wlan hardware memory
  106. *
  107. * INPUTS:
  108. *
  109. * OUTPUT: None
  110. *
  111. * RETURNS: OK or NOK
  112. ****************************************************************************/
  113. int whal_hwInfoElemConfigMemorySet (HwMboxConfig_T* pHwMboxConfig, DmaParams_T *pDmaParams)
  114. {
  115. ACXConfigMemoryStruct_t AcxElm_ConfigMemory;
  116. ACXConfigMemoryStruct_t *pCfg = &AcxElm_ConfigMemory;
  117. int Qid;
  118. os_memoryZero(pHwMboxConfig->hOs, (void *)pCfg, sizeof(*pCfg));
  119. /*
  120. * Set information element header
  121. */
  122. pCfg->memConfig.EleHdr.id = ACX_MEM_CFG;
  123. pCfg->memConfig.EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
  124. /*
  125. * Set configuration fields
  126. */
  127. pCfg->memConfig.numStations = ENDIAN_HANDLE_WORD(pDmaParams->NumStations); /*(1)*/
  128. pCfg->memConfig.rxMemblockNumber = pDmaParams->rxMemBlkNumber; /*(60)*/
  129. pCfg->memConfig.txMinimumMemblockNumber = pDmaParams->txMinMemBlkNumber; /*(60)*/
  130. pCfg->memConfig.numTxQueues = pDmaParams->NumTxQueues; /*(4)*/
  131. pCfg->memConfig.hostifOptions = 3; /*(3 - HOST_IF_PKT_RING)*/
  132. pCfg->memConfig.numSsidProfiles = 1;
  133. pCfg->memConfig.debugBufferSize = ENDIAN_HANDLE_WORD(pDmaParams->TraceBufferSize/4); /*(4)*/
  134. /*
  135. * Rx queue config
  136. */
  137. pCfg->RxQueueConfig.dmaAddress = 0;
  138. pCfg->RxQueueConfig.numDescs = (UINT8)pDmaParams->RxNumDesc;
  139. pCfg->RxQueueConfig.Priority = (UINT8)pDmaParams->RxQPriority;
  140. pCfg->RxQueueConfig.Type = pDmaParams->RxQueue_Type;
  141. /*
  142. * Tx queue config
  143. */
  144. for (Qid=0; Qid<pDmaParams->NumTxQueues; Qid++)
  145. {
  146. pCfg->TxQueueConfig[Qid].numDescs = pDmaParams->TxNumDesc[Qid];
  147. pCfg->TxQueueConfig[Qid].attributes = pDmaParams->TxQPriority[Qid];
  148. }
  149. /* The structure contain array of TxQueueConfig_T
  150. * The size of the array is QUEUE_CONFIG_MAX_TX_QUEUES buf the actual number of
  151. * Queues are pCfg->NumTxQueues so the structure length must be fixed */
  152. pCfg->memConfig.EleHdr.len -= (NUM_ACCESS_CATEGORIES_QUEUES - pDmaParams->NumTxQueues) * sizeof(ACXtxQueueConfig);
  153. /*
  154. * Send the configuration command
  155. */
  156. return CmdQueue_CmdConfigure (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(*pCfg));
  157. }
  158. /****************************************************************************
  159. * whal_hwInfoElemDataPathParamsSet()
  160. ****************************************************************************
  161. * DESCRIPTION: configure Data path and TX complete parameters
  162. *
  163. * INPUTS:
  164. *
  165. * OUTPUT: None
  166. *
  167. * RETURNS: OK or NOK
  168. ****************************************************************************/
  169. int whal_hwInfoElemDataPathParamsSet (HwMboxConfig_T* pHwMboxConfig,UINT16 rxPacketRingChunkSize,
  170. UINT16 txPacketRingChunkSize, UINT8 rxPacketRingChunkNum,
  171. UINT8 txPacketRingChunkNum, UINT8 txCompleteThreshold,
  172. UINT8 txCompleteRingDepth, UINT32 txCompleteTimeOut)
  173. {
  174. ACXDataPathParams_t DataPathParams;
  175. ACXDataPathParams_t* pCfg = &DataPathParams;
  176. /*
  177. * Set information element header
  178. */
  179. pCfg->EleHdr.id = ACX_DATA_PATH_PARAMS;
  180. pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
  181. /*
  182. * Set configuration fields
  183. */
  184. pCfg->rxPacketRingChunkSize = ENDIAN_HANDLE_WORD(rxPacketRingChunkSize);
  185. pCfg->txPacketRingChunkSize = ENDIAN_HANDLE_WORD(txPacketRingChunkSize );
  186. pCfg->rxPacketRingChunkNum = rxPacketRingChunkNum;
  187. pCfg->txPacketRingChunkNum = txPacketRingChunkNum;
  188. pCfg->txCompleteThreshold = txCompleteThreshold;
  189. pCfg->txCompleteRingDepth = txCompleteRingDepth;
  190. pCfg->txCompleteTimeOut = txCompleteTimeOut;
  191. /* Send the configuration command*/
  192. return CmdQueue_CmdConfigure (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(*pCfg));
  193. }
  194. /****************************************************************************
  195. * whal_hwInfoElemDataPathParamsGet()
  196. ****************************************************************************
  197. * DESCRIPTION: Get data path specific parameters
  198. *
  199. * INPUTS:
  200. *
  201. * OUTPUT: None
  202. *
  203. * RETURNS: OK or NOK
  204. ****************************************************************************/
  205. int whal_hwInfoElemDataPathParamsGet (HwMboxConfig_T* pHwMboxConfig, ACXDataPathParamsResp_t* pCfg, void *fCb, TI_HANDLE hCb)
  206. {
  207. int rc;
  208. /* Set information element header */
  209. pCfg->EleHdr.id = ACX_DATA_PATH_PARAMS;
  210. pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
  211. /* Send the interrogation command*/
  212. if ((rc = CmdQueue_CmdInterrogateWithCb (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(*pCfg), fCb, hCb, pCfg)) == OK)
  213. {
  214. }
  215. return rc;
  216. }
  217. /****************************************************************************
  218. * whal_hwInfoElemQueueHeadGet()
  219. ****************************************************************************
  220. * DESCRIPTION: Read the Queue addresses after memory init
  221. *
  222. * INPUTS:
  223. *
  224. * OUTPUT: None
  225. *
  226. * RETURNS: OK or NOK
  227. ****************************************************************************/
  228. int whal_hwInfoElemQueueHeadGet (HwMboxConfig_T* pHwMboxConfig, int NumTxQueues, int pElem, void *fCb, TI_HANDLE hCb)
  229. {
  230. #if 0 /*Benzy: should be fixed after the firmware/driver integration*/
  231. int Qid;
  232. int Stt;
  233. /* only interrogate is enabled to this info element */
  234. if (aAction != INTERROGATE_ACTION)
  235. return (NOK);
  236. /*
  237. * Set information element header
  238. */
  239. pElem->EleHdr.id = ACX_QUEUE_HEAD;
  240. pElem->EleHdr.len = sizeof(*pElem) - sizeof(EleHdrStruct);
  241. /*
  242. * Send the interrogation command, and fill the structure
  243. */
  244. if ((Stt=CmdQueue_CmdInterrogateWithCb (pHwMboxConfig->hCmdMboxQueue, pElem, sizeof(*pElem), fCb, hCb, pElem)) != OK)
  245. return (Stt);
  246. /*
  247. * Solve endian problem
  248. */
  249. pElem->rxMemBlkQ = (UINT32 *)ENDIAN_HANDLE_LONG((UINT32)(pElem->rxMemBlkQ));
  250. pElem->txMemBlkQ = (UINT32 *)ENDIAN_HANDLE_LONG((UINT32)(pElem->txMemBlkQ));
  251. pElem->rxQueueHead.addr = ENDIAN_HANDLE_LONG(pElem->rxQueueHead.addr);
  252. for (Qid=0; Qid<NumTxQueues; Qid++)
  253. {
  254. pElem->txQueueHead[Qid].addr = ENDIAN_HANDLE_LONG(pElem->txQueueHead[Qid].addr);
  255. }
  256. #endif
  257. WLAN_OS_REPORT(("Command Disabled: whal_hwInfoElemQueueHeadGet\n"));
  258. return OK;
  259. }
  260. /****************************************************************************
  261. * whal_hwInfoElemSlotTimeSet()
  262. ****************************************************************************
  263. * DESCRIPTION: Configure/Interrogate the Slot Time
  264. *
  265. * INPUTS: None
  266. *
  267. * OUTPUT: None
  268. *
  269. * RETURNS: OK or NOK
  270. ****************************************************************************/
  271. int whal_hwInfoElemSlotTimeSet (HwMboxConfig_T* pHwMboxConfig, UINT8* apSlotTime)
  272. {
  273. int rc;
  274. ACXSlot_t AcxElm_SlotTime;
  275. ACXSlot_t *pCfg = &AcxElm_SlotTime;
  276. /* Set information element header */
  277. pCfg->EleHdr.id = ACX_SLOT;
  278. pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
  279. /* Set configuration fields */
  280. /* woneIndex is not relevant to station implementation */
  281. pCfg->woneIndex = STATION_WONE_INDEX;
  282. pCfg->slotTime = *apSlotTime;
  283. WLAN_REPORT_INFORMATION(pHwMboxConfig->hReport, HAL_HW_CTRL_MODULE_LOG,
  284. ("%s: Sending info elem to firmware, Slot Time = %d\n", __FUNCTION__, (UINT8)pCfg->slotTime));
  285. /* Send the configuration command */
  286. rc = CmdQueue_CmdConfigure (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(*pCfg));
  287. return rc;
  288. }
  289. /****************************************************************************
  290. * whal_hwInfoElemPreambleSet()
  291. ****************************************************************************
  292. * DESCRIPTION: Configure/Interrogate the Preamble
  293. *
  294. * INPUTS: None
  295. *
  296. * OUTPUT: None
  297. *
  298. * RETURNS: OK or NOK
  299. ****************************************************************************/
  300. int whal_hwInfoElemPreambleSet (HwMboxConfig_T* pHwMboxConfig, UINT8* apPreamble)
  301. {
  302. int rc;
  303. ACXPreamble_t AcxElm_Preamble;
  304. ACXPreamble_t *pCfg = &AcxElm_Preamble;
  305. /* Set information element header */
  306. pCfg->EleHdr.id = ACX_PREAMBLE_TYPE;
  307. pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
  308. /* Set configuration fields */
  309. /* woneIndex is not relevant to station implementation */
  310. pCfg->preamble = *apPreamble;
  311. /* Send the configuration command */
  312. rc = CmdQueue_CmdConfigure (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(*pCfg));
  313. return rc;
  314. }
  315. /****************************************************************************
  316. * whal_hwInfoElemGeneraedFrameRate()
  317. ****************************************************************************
  318. * DESCRIPTION: Configure/Interrogate the rate
  319. *
  320. * INPUTS: None
  321. *
  322. * OUTPUT: None
  323. *
  324. * RETURNS: OK or NOK
  325. ****************************************************************************/
  326. int whal_hwInfoElemGeneratedFrameRateSet (HwMboxConfig_T *pHwMboxConfig,
  327. UINT8 *txCtrlFrmRate,
  328. UINT8 *txCtrlFrmMod,
  329. UINT8 *txMgmtFrmRate,
  330. UINT8 *txMgmtFrmMod)
  331. {
  332. int rc;
  333. ACXFwGeneratedFrameRates_t AcxElm_FrameRate;
  334. ACXFwGeneratedFrameRates_t *pCfg = &AcxElm_FrameRate;
  335. /* Set information element header */
  336. pCfg->EleHdr.id = ACX_FW_GEN_FRAME_RATES;
  337. pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
  338. /* Set configuration fields */
  339. /* woneIndex is not relevant to station implementation */
  340. pCfg->txCtrlFrmRate = *txCtrlFrmRate;
  341. pCfg->txCtrlFrmMod = *txCtrlFrmMod;
  342. pCfg->txMgmtFrmRate = *txMgmtFrmRate;
  343. pCfg->txMgmtFrmMod = *txMgmtFrmMod;
  344. /* Send the configuration command */
  345. rc = CmdQueue_CmdConfigure (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(*pCfg));
  346. return rc;
  347. }
  348. /****************************************************************************
  349. * whal_hwInfoElemRxConfigSet()
  350. ****************************************************************************
  351. * DESCRIPTION: Configure/Interrogate RxConfig information element
  352. *
  353. * INPUTS: None
  354. *
  355. * OUTPUT: None
  356. *
  357. * RETURNS: OK or NOK
  358. ****************************************************************************/
  359. int whal_hwInfoElemRxConfigSet (HwMboxConfig_T* pHwMboxConfig, UINT32* apRxConfigOption, UINT32* apRxFilterOption)
  360. {
  361. int rc;
  362. ACXRxConfig_t AcxElm_RxConfig;
  363. ACXRxConfig_t* pCfg = &AcxElm_RxConfig;
  364. /* Set information element header */
  365. pCfg->EleHdr.id = ACX_RX_CFG;
  366. pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
  367. /* Set configuration fields */
  368. pCfg->ConfigOptions = ENDIAN_HANDLE_LONG(*apRxConfigOption);
  369. pCfg->FilterOptions = ENDIAN_HANDLE_LONG(*apRxFilterOption);
  370. /* Send the configuration command */
  371. rc = CmdQueue_CmdConfigure (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(*pCfg));
  372. return rc;
  373. }
  374. /****************************************************************************
  375. * whal_hwInfoElemBETSet()
  376. ****************************************************************************
  377. * DESCRIPTION: Configures Beacon Early Termination information element
  378. *
  379. * INPUTS: None
  380. *
  381. * OUTPUT: None
  382. *
  383. * RETURNS: OK or NOK
  384. ****************************************************************************/
  385. int whal_hwInfoElemBETSet(HwMboxConfig_T* pHwMboxConfig, UINT8 Enable, UINT8 MaximumConsecutiveET)
  386. {
  387. int rc;
  388. ACXBet_Enable_t ACXBet_Enable;
  389. ACXBet_Enable_t* pCfg = &ACXBet_Enable;
  390. /* Set information element header */
  391. pCfg->EleHdr.id = ACX_BET_ENABLE;
  392. pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
  393. /* Set configuration fields */
  394. pCfg->Enable = Enable;
  395. pCfg->MaximumConsecutiveET = MaximumConsecutiveET;
  396. WLAN_REPORT_INFORMATION(pHwMboxConfig->hReport, HAL_HW_CTRL_MODULE_LOG,
  397. ("%s: Sending info elem to firmware, Enable=%d, MaximumConsecutiveET=%d\n",
  398. __FUNCTION__, (UINT8)pCfg->Enable, (UINT8)pCfg->MaximumConsecutiveET));
  399. /* Send the configuration command */
  400. rc = CmdQueue_CmdConfigure (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(*pCfg));
  401. return rc;
  402. }
  403. /****************************************************************************
  404. * whal_hwInfoElemSetRxDataFiltersParams()
  405. *****************************************************************************
  406. * DESCRIPTION: Enables or disables Rx data filtering.
  407. *
  408. * INPUTS: enabled - 0 to disable data filtering, any other value to enable
  409. * defaultAction - The default action to take on non-matching packets.
  410. *
  411. * OUTPUT: None
  412. *
  413. * RETURNS: OK or NOK
  414. ****************************************************************************/
  415. int whal_hwInfoElemSetRxDataFiltersParams(HwMboxConfig_T * pHwMboxConfig, BOOL enabled, filter_e defaultAction)
  416. {
  417. DataFilterDefault_t dataFilterDefault;
  418. DataFilterDefault_t * pCfg = &dataFilterDefault;
  419. /* Set information element header */
  420. pCfg->EleHdr.id = ACX_ENABLE_RX_DATA_FILTER;
  421. pCfg->EleHdr.len = 0;
  422. WLAN_REPORT_INFORMATION(pHwMboxConfig->hReport, HAL_HW_CTRL_MODULE_LOG,
  423. ("%s: Rx Data Filter configuration:\n", __FUNCTION__));
  424. WLAN_REPORT_INFORMATION(pHwMboxConfig->hReport, HAL_HW_CTRL_MODULE_LOG,
  425. ("%s: enabled = %d, defaultAction = %d\n", __FUNCTION__, enabled, defaultAction));
  426. /* Set information element configuration fields */
  427. pCfg->enable = enabled;
  428. pCfg->action = defaultAction;
  429. pCfg->EleHdr.len += sizeof(pCfg->enable) + sizeof(pCfg->action);
  430. WLAN_REPORT_HEX_INFORMATION(pHwMboxConfig->hReport, HAL_HW_CTRL_MODULE_LOG, (UINT8 *) pCfg, sizeof(dataFilterDefault));
  431. return CmdQueue_CmdConfigure(pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(*pCfg));
  432. }
  433. /****************************************************************************
  434. * whal_hwInfoElemSetRxDataFilter()
  435. *****************************************************************************
  436. * DESCRIPTION: Add/remove Rx Data filter information element.
  437. *
  438. * INPUTS: index - Index of the Rx Data filter
  439. * command - Add or remove the filter
  440. * action - Action to take on packets matching the pattern
  441. * numFieldPatterns - Number of field patterns in the filter
  442. * lenFieldPatterns - Length of the field pattern series
  443. * fieldPatterns - Series of field patterns
  444. *
  445. * OUTPUT: None
  446. *
  447. * RETURNS: OK or NOK
  448. ****************************************************************************/
  449. int whal_hwInfoElemSetRxDataFilter(HwMboxConfig_T * pHwMboxConfig, UINT8 index, UINT8 command, filter_e action, UINT8 numFieldPatterns, UINT8 lenFieldPatterns, UINT8 * fieldPatterns)
  450. {
  451. UINT8 dataFilterConfig[sizeof(DataFilterConfig_t) + MAX_DATA_FILTER_SIZE];
  452. DataFilterConfig_t * pCfg = (DataFilterConfig_t *) &dataFilterConfig;
  453. /* Set information element header */
  454. pCfg->EleHdr.id = ACX_SET_RX_DATA_FILTER;
  455. pCfg->EleHdr.len = 0;
  456. WLAN_REPORT_INFORMATION(pHwMboxConfig->hReport, HAL_HW_CTRL_MODULE_LOG,
  457. ("%s: Rx Data Filter configuration:\n", __FUNCTION__));
  458. WLAN_REPORT_INFORMATION(pHwMboxConfig->hReport, HAL_HW_CTRL_MODULE_LOG,
  459. ("%s: command = %d, index = %d, action = %d, numFieldPatterns = %d\n", __FUNCTION__,
  460. command, index, action, numFieldPatterns));
  461. /* Set information element configuration fields */
  462. pCfg->command = command;
  463. pCfg->index = index;
  464. pCfg->EleHdr.len += sizeof(pCfg->command) + sizeof(pCfg->index);
  465. /* When removing a filter only the index and command are to be sent */
  466. if (command == ADD_FILTER)
  467. {
  468. pCfg->action = action;
  469. pCfg->numOfFields = numFieldPatterns;
  470. pCfg->EleHdr.len += sizeof(pCfg->action) + sizeof(pCfg->numOfFields);
  471. if (fieldPatterns == NULL)
  472. {
  473. WLAN_REPORT_ERROR(pHwMboxConfig->hReport, HAL_HW_CTRL_MODULE_LOG,
  474. ("%s: Null pattern table argument received!\n", __FUNCTION__));
  475. return PARAM_VALUE_NOT_VALID;
  476. }
  477. os_memoryCopy(pHwMboxConfig->hOs, &pCfg->FPTable, fieldPatterns, lenFieldPatterns);
  478. pCfg->EleHdr.len += lenFieldPatterns;
  479. }
  480. WLAN_REPORT_HEX_INFORMATION(pHwMboxConfig->hReport, HAL_HW_CTRL_MODULE_LOG, (UINT8 *) pCfg, sizeof(dataFilterConfig));
  481. return CmdQueue_CmdConfigure(pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(dataFilterConfig));
  482. }
  483. /****************************************************************************
  484. * whal_hwInfoElemGetRxDataFiltersStatistics()
  485. ****************************************************************************
  486. * DESCRIPTION: Get the ACX GWSI counters
  487. *
  488. * INPUTS:
  489. *
  490. * OUTPUT: None
  491. *
  492. * RETURNS: OK or NOK
  493. ****************************************************************************/
  494. int whal_hwInfoElemGetRxDataFiltersStatistics(HwMboxConfig_T * pHwMboxConfig,
  495. void * CB_Func,
  496. TI_HANDLE CB_handle,
  497. void * CB_Buf)
  498. {
  499. ACXDataFilteringStatistics_t acx;
  500. ACXDataFilteringStatistics_t * pCfg = &acx;
  501. /* Set information element header */
  502. pCfg->EleHdr.id = ACX_GET_DATA_FILTER_STATISTICS;
  503. pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
  504. WLAN_REPORT_HEX_INFORMATION(pHwMboxConfig->hReport, HAL_HW_CTRL_MODULE_LOG, (UINT8 *) pCfg, sizeof(ACXDataFilteringStatistics_t));
  505. /* Send the interrogation command */
  506. return CmdQueue_CmdInterrogateWithCb(pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(*pCfg), CB_Func, CB_handle, CB_Buf);
  507. }
  508. /****************************************************************************
  509. * whalCtrl_getConsumptionStatistics()
  510. ****************************************************************************
  511. * DESCRIPTION: Get the ACX Power consumption statistics
  512. *
  513. * INPUTS:
  514. *
  515. * OUTPUT: None
  516. *
  517. * RETURNS: OK or NOK
  518. ****************************************************************************/
  519. int whalCtrl_getConsumptionStatistics(HwMboxConfig_T * pHwMboxConfig, void * CB_Func, TI_HANDLE CB_handle, void * CB_Buf)
  520. {
  521. ACXPowerConsumptionTimeStat_t acx;
  522. ACXPowerConsumptionTimeStat_t * pCfg = &acx;
  523. /* Set information element header */
  524. pCfg->EleHdr.id = ACX_PWR_CONSUMPTION_STATISTICS;
  525. pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
  526. /* Send the interrogation command */
  527. return CmdQueue_CmdInterrogateWithCb(pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(*pCfg), CB_Func, CB_handle, CB_Buf);
  528. }
  529. /****************************************************************************
  530. * whal_hwInfoElemarpIpAddressesTableSet()
  531. ****************************************************************************
  532. * DESCRIPTION: Configure/Interrogate ARP addr table information element for
  533. * ipV4 only
  534. *
  535. * INPUTS: None
  536. *
  537. * OUTPUT: None
  538. *
  539. * RETURNS: OK or NOK
  540. ****************************************************************************/
  541. int whal_hwInfoElemarpIpAddressesTableSet (HwMboxConfig_T* pHwMboxConfig,
  542. IpAddress_t *IP_addr,
  543. UINT32 isFilteringEnabled)
  544. {
  545. int rc;
  546. ACXConfigureIP_t AcxElm_CmdConfigureIP;
  547. ACXConfigureIP_t *pCfg = &AcxElm_CmdConfigureIP;
  548. /* Set information element header */
  549. pCfg->EleHdr.id = ACX_ARP_IP_FILTER;
  550. pCfg->EleHdr.len = sizeof(ACXConfigureIP_t) - sizeof(EleHdrStruct);
  551. pCfg->arpFilterEnable = isFilteringEnabled;
  552. /* IP address */
  553. /* Note that in the case of IPv4 it is assumed that the extra two bytes are zero */
  554. os_memoryCopy (pHwMboxConfig->hOs, (PVOID)pCfg->address, (PVOID)IP_addr->addr, IP_V4_ADDR_LEN);
  555. WLAN_REPORT_INFORMATION(pHwMboxConfig->hReport, HAL_HW_CTRL_MODULE_LOG,("ip filtering : %d.%d.%d.%d Enabled = %d \n" , pCfg->address[0] , pCfg->address[1] , pCfg->address[2] , pCfg->address[3] , isFilteringEnabled)) ;
  556. /* Send the configuration command */
  557. rc = CmdQueue_CmdConfigure (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(ACXConfigureIP_t));
  558. return rc;
  559. }
  560. /****************************************************************************
  561. * whal_hwInfoElemGroupAdressesTableSet()
  562. ****************************************************************************
  563. * DESCRIPTION: Configure/Interrogate Group addr table information element
  564. *
  565. * INPUTS: None
  566. *
  567. * OUTPUT: None
  568. *
  569. * RETURNS: OK or NOK
  570. ****************************************************************************/
  571. int whal_hwInfoElemGroupAdressesTableSet (HwMboxConfig_T* pHwMboxConfig,
  572. UINT8* numGroupAddrs,
  573. macAddress_t *Group_addr,
  574. UINT8* isEnabled)
  575. {
  576. int i = 0;
  577. int rc = OK;
  578. UINT8 *tmpLoc = NULL;
  579. dot11MulticastGroupAddrStart_t AcxElm_CmdConfigureMulticastIp;
  580. dot11MulticastGroupAddrStart_t* pCfg = &AcxElm_CmdConfigureMulticastIp;
  581. if ( NULL == pHwMboxConfig )
  582. {
  583. return PARAM_VALUE_NOT_VALID;
  584. }
  585. os_memoryZero (pHwMboxConfig->hOs, (void *)pCfg, sizeof(dot11MulticastGroupAddrStart_t));
  586. /* Set information element header */
  587. pCfg->EleHdr.id = DOT11_GROUP_ADDRESS_TBL;
  588. pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
  589. pCfg->numOfGroups = *numGroupAddrs;
  590. pCfg->fltrState = *isEnabled;
  591. tmpLoc = pCfg->dataLocation;
  592. if (NULL != Group_addr)
  593. {
  594. for (i=0; i<*numGroupAddrs; i++)
  595. {
  596. os_memoryCopy(pHwMboxConfig->hOs, (PVOID)&(tmpLoc[MAC_ADDR_SIZE*i]), (PVOID)&(Group_addr->addr[MAC_ADDR_SIZE*i]), MAC_ADDR_SIZE);
  597. WLAN_REPORT_INFORMATION(pHwMboxConfig->hReport, HAL_HW_CTRL_MODULE_LOG,
  598. ("whal_hwInfoElemGroupAdressesTable: MAC %x: %x:%x:%x:%x:%x:%x\n",
  599. i,
  600. tmpLoc[MAC_ADDR_SIZE*i+0] ,
  601. tmpLoc[MAC_ADDR_SIZE*i+1] ,
  602. tmpLoc[MAC_ADDR_SIZE*i+2] ,
  603. tmpLoc[MAC_ADDR_SIZE*i+3] ,
  604. tmpLoc[MAC_ADDR_SIZE*i+4] ,
  605. tmpLoc[MAC_ADDR_SIZE*i+5]));
  606. }
  607. }
  608. /* Send the configuration command */
  609. rc = CmdQueue_CmdConfigure (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(dot11MulticastGroupAddrStart_t));
  610. return rc;
  611. }
  612. /****************************************************************************
  613. * whal_hwInfoElemStationIdSet ()
  614. ****************************************************************************
  615. * DESCRIPTION: Configure StationId information element to/from
  616. * the wlan hardware.
  617. * This information element specifies the MAC Address assigned to the
  618. * STATION or AP.
  619. * This default value is the permanent MAC address that is stored in the
  620. * adaptor's non-volatile memory.
  621. *
  622. * INPUTS: None
  623. *
  624. * OUTPUT: None
  625. *
  626. * RETURNS: OK or NOK
  627. ****************************************************************************/
  628. int whal_hwInfoElemStationIdSet
  629. (
  630. HwMboxConfig_T *pHwMboxConfig,
  631. UINT8 *apStationId
  632. )
  633. {
  634. int i;
  635. int rc;
  636. dot11StationIDStruct AcxElm_StationId;
  637. dot11StationIDStruct* pCfg = &AcxElm_StationId;
  638. /* Set information element header*/
  639. pCfg->EleHdr.id = DOT11_STATION_ID;
  640. pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
  641. /* Set configuration field (reversed order, see docs)*/
  642. for (i = 0; i < 6; i++)
  643. pCfg->dot11StationID[i] = apStationId[5-i];
  644. /* Send the configuration command*/
  645. rc = CmdQueue_CmdConfigure (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(*pCfg));
  646. return rc;
  647. }
  648. /****************************************************************************
  649. * whal_hwInfoElemStationIdGet ()
  650. ****************************************************************************
  651. * DESCRIPTION: Configure/Interrogate StationId information element to/from
  652. * the wlan hardware.
  653. * This information element specifies the MAC Address assigned to the
  654. * STATION or AP.
  655. * This default value is the permanent MAC address that is stored in the
  656. * adaptor's non-volatile memory.
  657. *
  658. * INPUTS: None
  659. *
  660. * OUTPUT: None
  661. *
  662. * RETURNS: OK or NOK
  663. ****************************************************************************/
  664. int whal_hwInfoElemStationIdGet
  665. (
  666. HwMboxConfig_T* pHwMboxConfig,
  667. void* fCb,
  668. TI_HANDLE hCb,
  669. void* pCb
  670. )
  671. {
  672. int rc;
  673. dot11StationIDStruct AcxElm_StationId;
  674. dot11StationIDStruct* pCfg = &AcxElm_StationId;
  675. /* Set information element header*/
  676. pCfg->EleHdr.id = DOT11_STATION_ID;
  677. pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
  678. if ((rc = CmdQueue_CmdInterrogateWithCb (pHwMboxConfig->hCmdMboxQueue,
  679. pCfg,
  680. sizeof(*pCfg),
  681. fCb,
  682. hCb,
  683. pCb)) == OK)
  684. {
  685. }
  686. return rc;
  687. }
  688. /****************************************************************************
  689. * whal_hwInfoElemStationIdForRecoveryGet ()
  690. ****************************************************************************
  691. * DESCRIPTION: Configure/Interrogate StationId information element to/from
  692. * the wlan hardware.
  693. * This information element specifies the MAC Address assigned to the
  694. * STATION or AP.
  695. * This default value is the permanent MAC address that is stored in the
  696. * adaptors non-volatile memory.
  697. *
  698. * INPUTS: None
  699. *
  700. * OUTPUT: None
  701. *
  702. * RETURNS: OK or NOK
  703. ****************************************************************************/
  704. int whal_hwInfoElemStationIdForRecoveryGet (HwMboxConfig_T* pHwMboxConfig,
  705. void *CB_Func, TI_HANDLE CB_handle, dot11StationIDStruct* CB_Buf)
  706. {
  707. dot11StationIDStruct AcxElm_StationId;
  708. dot11StationIDStruct* pCfg = &AcxElm_StationId;
  709. /* Set information element header*/
  710. pCfg->EleHdr.id = DOT11_STATION_ID;
  711. pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
  712. CmdQueue_CmdInterrogateWithCb (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(*pCfg), CB_Func, CB_handle, CB_Buf);
  713. return OK;
  714. }
  715. /****************************************************************************
  716. * whal_hwInfoElemRSSIGet ()
  717. ****************************************************************************
  718. * DESCRIPTION: Configure/Interrogate StationId information element to/from
  719. * the wlan hardware.
  720. * This information element specifies the MAC Address assigned to the
  721. * STATION or AP.
  722. * This default value is the permanent MAC address that is stored in the
  723. * adaptor's non-volatile memory.
  724. *
  725. * INPUTS: None
  726. *
  727. * OUTPUT: None
  728. *
  729. * RETURNS: OK or NOK
  730. ****************************************************************************/
  731. int whal_hwInfoElemRSSIGet (HwMboxConfig_T* pHwMboxConfig, void *CB_Func, TI_HANDLE CB_handle, PUINT8 CB_Buf)
  732. {
  733. int rc;
  734. ACXRoamingStatisticsTable_t AcxElm_GetAverageRSSI;
  735. ACXRoamingStatisticsTable_t* pCfg = &AcxElm_GetAverageRSSI;
  736. /* Set information element header */
  737. pCfg->EleHdr.id = ACX_ROAMING_STATISTICS_TBL;
  738. pCfg->EleHdr.len = sizeof(ACXRoamingStatisticsTable_t) - sizeof(EleHdrStruct);
  739. rc = CmdQueue_CmdInterrogateWithCb (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(ACXRoamingStatisticsTable_t), CB_Func, CB_handle, CB_Buf);
  740. /* Send the configuration command */
  741. return rc;
  742. }
  743. /****************************************************************************
  744. * whal_hwInfoElemACIConfigurationSet()
  745. ****************************************************************************
  746. * DESCRIPTION: Configure the hardware ACI parameters
  747. *
  748. * INPUTS: None
  749. *
  750. * OUTPUT: None
  751. *
  752. * RETURNS: OK or NOK
  753. ****************************************************************************/
  754. int whal_hwInfoElemACIConfigurationSet (HwMboxConfig_T* pHwMboxConfig, UINT8 ACIMode,
  755. UINT8 inputCCA, UINT8 qualifiedCCA,
  756. UINT8 stompForRx, UINT8 stompForTx,
  757. UINT8 txCCA)
  758. {
  759. int rc;
  760. ACXConfigACI_t AcxElm_AciConfig;
  761. ACXConfigACI_t* pCfg = &AcxElm_AciConfig;
  762. /* Set information element header */
  763. pCfg->EleHdr.id = ACX_ACI_OPTION_CFG;
  764. pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
  765. /* Set sequence number */
  766. pCfg->ACIMode = ACIMode;
  767. pCfg->inputCCA = inputCCA;
  768. pCfg->qualifiedCCA = qualifiedCCA;
  769. pCfg->stompForRx = stompForRx;
  770. pCfg->stompForTx = stompForTx;
  771. pCfg->txCCA = txCCA;
  772. rc = CmdQueue_CmdConfigure (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(*pCfg));
  773. return rc;
  774. }
  775. /****************************************************************************
  776. * whal_hwInfoElemBssPowerSaveGet()
  777. ****************************************************************************
  778. * DESCRIPTION: Configure/Interrogate the Bss in/not power save
  779. *
  780. * INPUTS: None
  781. *
  782. * OUTPUT: None
  783. *
  784. * RETURNS: OK or NOK
  785. ****************************************************************************/
  786. int whal_hwInfoElemBssPowerSaveGet (HwMboxConfig_T* pHwMboxConfig, UINT8* apBssInPs_Val)
  787. {
  788. int rc;
  789. ACXBSSPowerSave_t AcxElm_BssPowerSave;
  790. ACXBSSPowerSave_t *pCfg = &AcxElm_BssPowerSave;
  791. /* Set information element heade r*/
  792. pCfg->EleHdr.id = ACX_BSS_IN_PS;
  793. pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
  794. /* Set configuration fields */
  795. pCfg->BSSinPowerSave = *apBssInPs_Val;
  796. /* Send the configuration command */
  797. rc = CmdQueue_CmdConfigure (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(*pCfg));
  798. return rc;
  799. }
  800. /****************************************************************************
  801. * whal_hwInfoElemSoftGeminiEnableSet()
  802. ****************************************************************************
  803. * DESCRIPTION: Enable/Disable the BTH-WLAN
  804. *
  805. * INPUTS: Enable flag
  806. *
  807. * OUTPUT: None
  808. *
  809. * RETURNS: OK or NOK
  810. ****************************************************************************/
  811. int whal_hwInfoElemSoftGeminiEnableSet (HwMboxConfig_T* pHwMboxConfig, SoftGeminiEnableModes_e SoftGeminiEnableModes)
  812. {
  813. ACXBluetoothWlanCoEnableStruct AcxElm_BluetoothWlanEnable;
  814. ACXBluetoothWlanCoEnableStruct* pCfg = &AcxElm_BluetoothWlanEnable;
  815. WLAN_REPORT_INFORMATION(pHwMboxConfig->hReport, HAL_HW_CTRL_MODULE_LOG,
  816. ("whal_hwInfoElemSoftGeminiEnableSet: Enable flag = %d\n", SoftGeminiEnableModes));
  817. /* Set information element header */
  818. pCfg->EleHdr.id = ACX_SG_ENABLE;
  819. pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
  820. /* Set enable field */
  821. pCfg->Enable = (UINT8)SoftGeminiEnableModes;
  822. /* Send the configuration command */
  823. return CmdQueue_CmdConfigure (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(*pCfg));
  824. }
  825. /****************************************************************************
  826. * whal_hwInfoElemSoftGeminiParamsSet()
  827. ****************************************************************************
  828. * DESCRIPTION: Configure the BTH-WLAN co-exsistance
  829. *
  830. * INPUTS: Configuration structure pointer
  831. *
  832. * OUTPUT: None
  833. *
  834. * RETURNS: OK or NOK
  835. ****************************************************************************/
  836. int whal_hwInfoElemSoftGeminiParamsSet (HwMboxConfig_T* pHwMboxConfig, SoftGeminiParam_t *SoftGeminiParam)
  837. {
  838. ACXBluetoothWlanCoParamsStruct AcxElm_BluetoothWlanEnable;
  839. ACXBluetoothWlanCoParamsStruct* pCfg = &AcxElm_BluetoothWlanEnable;
  840. WLAN_REPORT_INFORMATION(pHwMboxConfig->hReport, HAL_HW_CTRL_MODULE_LOG,
  841. ("whal_hwInfoElemSoftGeminiParamsSet. \n"));
  842. /* Set information element header */
  843. pCfg->EleHdr.id = ACX_SG_CFG;
  844. pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
  845. pCfg->afhLeverageOn = SoftGeminiParam->afhLeverageOn;
  846. pCfg->btHpMaxTime = SoftGeminiParam->btHpMaxTime;
  847. pCfg->maxNumCts = SoftGeminiParam->maxNumCts;
  848. pCfg->numberOfBtPackets = SoftGeminiParam->numberOfBtPackets;
  849. pCfg->numberOfWlanPackets = SoftGeminiParam->numberOfWlanPackets;
  850. pCfg->numberQuietCycle = SoftGeminiParam->numberQuietCycle;
  851. pCfg->protectiveRxTimeBeforeBtHp = SoftGeminiParam->protectiveRxTimeBeforeBtHp;
  852. pCfg->protectiveTxTimeBeforeBtHp = SoftGeminiParam->protectiveTxTimeBeforeBtHp;
  853. pCfg->protectiveRxTimeBeforeBtHpFastAp = SoftGeminiParam->protectiveRxTimeBeforeBtHpFastAp;
  854. pCfg->protectiveTxTimeBeforeBtHpFastAp = SoftGeminiParam->protectiveTxTimeBeforeBtHpFastAp;
  855. pCfg->protectiveWlanCycleTimeForFastAp = SoftGeminiParam->protectiveWlanCycleTimeForFastAp;
  856. pCfg->senseDisableTimer = SoftGeminiParam->senseDisableTimer;
  857. pCfg->sgAntennaType = SoftGeminiParam->sgAntennaType;
  858. pCfg->signalingType = SoftGeminiParam->signalingType;
  859. pCfg->timeoutNextBtLpPacket = SoftGeminiParam->timeoutNextBtLpPacket;
  860. pCfg->wlanHpMaxTime = SoftGeminiParam->wlanHpMaxTime;
  861. pCfg->numberOfMissedRxForAvalancheTrigger = SoftGeminiParam->numberOfMissedRxForAvalancheTrigger;
  862. pCfg->wlanElpHpSupport = SoftGeminiParam->wlanElpHpSupport;
  863. pCfg->btAntiStarvationNumberOfCyclesWithinThePeriod = SoftGeminiParam->btAntiStarvationNumberOfCyclesWithinThePeriod;
  864. pCfg->btAntiStarvationPeriod = SoftGeminiParam->btAntiStarvationPeriod;
  865. pCfg->ackModeDuringBtLpInDualAnt = SoftGeminiParam->ackModeDuringBtLpInDualAnt;
  866. pCfg->allowPaSdToggleDuringBtActivityEnable = SoftGeminiParam->allowPaSdToggleDuringBtActivityEnable;
  867. pCfg->wakeUpTimeBeforeBeacon = SoftGeminiParam->wakeUpTimeBeforeBeacon;
  868. pCfg->hpdmMaxGuardTime = SoftGeminiParam->hpdmMaxGuardTime;
  869. pCfg->timeoutNextWlanPacket = SoftGeminiParam->timeoutNextWlanPacket;
  870. pCfg->sgAutoModeNoCts = SoftGeminiParam->sgAutoModeNoCts;
  871. pCfg->numOfBtHpRespectedReq = SoftGeminiParam->numOfBtHpRespectedReq;
  872. /* Convert from pure number to Index. '0' is any rate */
  873. if ( SoftGeminiParam->wlanRxMinRateToRespectBtHp )
  874. {
  875. pCfg->wlanRxMinConvertedRateToRespectBtHp = rateNumberToIndex((UINT8)SoftGeminiParam->wlanRxMinRateToRespectBtHp);
  876. if (pCfg->wlanRxMinConvertedRateToRespectBtHp == INVALID_RATE_INDEX)
  877. {
  878. WLAN_REPORT_ERROR(pHwMboxConfig->hReport, HAL_HW_CTRL_MODULE_LOG,
  879. ("%s wlanRxMinRateToRespectBtHp from %d to 0 (any rate). \n",
  880. __FUNCTION__, SoftGeminiParam->wlanRxMinRateToRespectBtHp));
  881. pCfg->wlanRxMinConvertedRateToRespectBtHp = RATE_INDEX_1MBPS;
  882. }
  883. }
  884. else
  885. {
  886. pCfg->wlanRxMinConvertedRateToRespectBtHp = RATE_INDEX_1MBPS;
  887. }
  888. WLAN_REPORT_INFORMATION(pHwMboxConfig->hReport, HAL_HW_CTRL_MODULE_LOG,
  889. ("%s wlanRxMinRateToRespectBtHp from %d to %d. \n",
  890. __FUNCTION__, SoftGeminiParam->wlanRxMinRateToRespectBtHp, pCfg->wlanRxMinConvertedRateToRespectBtHp));
  891. /* Send the configuration command */
  892. return CmdQueue_CmdConfigure (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(*pCfg));
  893. }
  894. /****************************************************************************
  895. * whal_hwInfoElemSoftGeminiParamsGet()
  896. ****************************************************************************
  897. * DESCRIPTION: Get the BTH-WLAN co-exsistance parameters from the Fw
  898. *
  899. *
  900. * OUTPUT: None
  901. *
  902. * RETURNS: OK or NOK
  903. ****************************************************************************/
  904. int whal_hwInfoElemSoftGeminiParamsGet (HwMboxConfig_T* pHwMboxConfig, void *CB_Func, TI_HANDLE CB_handle, void* CB_Buf)
  905. {
  906. ACXBluetoothWlanCoParamsStruct AcxElm_BluetoothWlanEnable;
  907. ACXBluetoothWlanCoParamsStruct* pCfg = &AcxElm_BluetoothWlanEnable;
  908. WLAN_REPORT_INFORMATION(pHwMboxConfig->hReport, HAL_HW_CTRL_MODULE_LOG,
  909. ("whal_hwInfoElemSoftGeminiParamsGet. \n"));
  910. /* Set information element header */
  911. pCfg->EleHdr.id = ACX_SG_CFG;
  912. pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
  913. /* Send the configuration command */
  914. return CmdQueue_CmdInterrogateWithCb (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(ACXBluetoothWlanCoParamsStruct), CB_Func, CB_handle, CB_Buf);
  915. }
  916. /****************************************************************************
  917. * whal_hwInfoElemMemoryMapSet ()
  918. ****************************************************************************
  919. * DESCRIPTION: Configure/Interrogate MemoryMap information element
  920. *
  921. * INPUTS:
  922. * AcxElm_MemoryMap_T *apMap pointer to the memory map structure
  923. *
  924. * OUTPUT: None
  925. *
  926. * RETURNS: OK or NOK
  927. ****************************************************************************/
  928. int whal_hwInfoElemMemoryMapSet
  929. (
  930. HwMboxConfig_T *pHwMboxConfig,
  931. MemoryMap_t *apMap
  932. )
  933. {
  934. int rc;
  935. MemoryMap_t SwapMap;
  936. UINT32 *pSwap, *pOrig, i;
  937. /* Set information element header */
  938. SwapMap.EleHdr.id = ACX_MEM_MAP;
  939. SwapMap.EleHdr.len = sizeof(SwapMap) - sizeof(EleHdrStruct);
  940. /* Solve endian problem (all fields are 32 bit) */
  941. pOrig = (UINT32* )&apMap->codeStart;
  942. pSwap = (UINT32* )&SwapMap.codeStart;
  943. for (i = 0; i < MEM_MAP_NUM_FIELDS; i++)
  944. pSwap[i] = ENDIAN_HANDLE_LONG(pOrig[i]);
  945. /* Send the configuration command */
  946. rc = CmdQueue_CmdConfigure (pHwMboxConfig->hCmdMboxQueue, &SwapMap, sizeof(SwapMap));
  947. return rc;
  948. }
  949. /****************************************************************************
  950. * whal_hwInfoElemMemoryMapGet ()
  951. ****************************************************************************
  952. * DESCRIPTION: Configure/Interrogate MemoryMap information element
  953. *
  954. * INPUTS:
  955. * AcxElm_MemoryMap_T *apMap pointer to the memory map structure
  956. *
  957. * OUTPUT: None
  958. *
  959. * RETURNS: OK or NOK
  960. ****************************************************************************/
  961. int whal_hwInfoElemMemoryMapGet
  962. (
  963. HwMboxConfig_T *pHwMboxConfig,
  964. MemoryMap_t *apMap,
  965. void *fCb,
  966. TI_HANDLE hCb
  967. )
  968. {
  969. int rc;
  970. /* Set information element header */
  971. apMap->EleHdr.id = ACX_MEM_MAP;
  972. apMap->EleHdr.len = sizeof(*apMap) - sizeof(EleHdrStruct);
  973. /* Send the interrogation command */
  974. if ((rc = CmdQueue_CmdInterrogateWithCb (pHwMboxConfig->hCmdMboxQueue, apMap, sizeof(*apMap), fCb, hCb, apMap)) == OK)
  975. {
  976. }
  977. return rc;
  978. }
  979. static int whal_hwInfoElemMemoryMapPrintCb (TI_HANDLE hHwMboxConfig, TI_STATUS status, void *pData)
  980. {
  981. #ifdef TI_DBG
  982. HwMboxConfig_T *pHwMboxConfig = (HwMboxConfig_T *)hHwMboxConfig;
  983. MemoryMap_t *pMemMap = &pHwMboxConfig->MemMap;
  984. /* Print the memory map */
  985. WLAN_OS_REPORT (("whal_hwInfoElemMemoryMapPrint:\n"));
  986. WLAN_OS_REPORT (("\tCode (0x%08x, 0x%08x)\n\tWep (0x%08x, 0x%08x)\n\tTmpl (0x%08x, 0x%08x)\n "
  987. "\tQueue (0x%08x, 0x%08x)\n\tPool (0x%08x, 0x%08x)\n\tTraceBuffer (A = 0x%08x, B = 0x%08x)\n",
  988. pMemMap->codeStart, pMemMap->codeEnd,
  989. pMemMap->wepDefaultKeyStart, pMemMap->wepDefaultKeyEnd,
  990. pMemMap->packetTemplateStart, pMemMap->packetTemplateEnd,
  991. pMemMap->queueMemoryStart, pMemMap->queueMemoryEnd,
  992. pMemMap->packetMemoryPoolStart, pMemMap->packetMemoryPoolEnd,
  993. pMemMap->debugBuffer1Start, pMemMap->debugBuffer2Start));
  994. #endif /* TI_DBG */
  995. return OK;
  996. }
  997. /****************************************************************************
  998. * whal_hwInfoElemMemoryMapPrint ()
  999. ****************************************************************************
  1000. * DESCRIPTION: Print some of the MemoryMap information element fields
  1001. *
  1002. * INPUTS:
  1003. * HwMboxConfig_T* pHwMboxConfig pointer to the acx mailbox
  1004. *
  1005. * OUTPUT: None
  1006. *
  1007. * RETURNS: None
  1008. ****************************************************************************/
  1009. void whal_hwInfoElemMemoryMapPrint (HwMboxConfig_T* pHwMboxConfig)
  1010. {
  1011. whal_hwInfoElemMemoryMapGet (pHwMboxConfig,
  1012. &pHwMboxConfig->MemMap,
  1013. (void *)whal_hwInfoElemMemoryMapPrintCb,
  1014. (TI_HANDLE)pHwMboxConfig);
  1015. }
  1016. /****************************************************************************
  1017. * whal_hwInfoElemConfigOptionsRead ()
  1018. ****************************************************************************
  1019. * DESCRIPTION: Read ConfigOption information element from the wlan hardware.
  1020. * This is a special case where the data is already in the mailbox
  1021. * after wlan hardware reset and no interrogate command should be sent.
  1022. * This read-only IE provides information stored in the adaptor’s
  1023. * non-volatile memory to host.
  1024. *
  1025. * INPUTS: None
  1026. *
  1027. * OUTPUT: None
  1028. *
  1029. * RETURNS: OK or NOK
  1030. *
  1031. * NOTE : This function is not in use and must be reexamined (especially the Fw-Driver API)
  1032. *
  1033. ****************************************************************************/
  1034. int whal_hwInfoElemConfigOptionsRead (HwMboxConfig_T* pHwMboxConfig, void* pElm)
  1035. {
  1036. WLAN_OS_REPORT(("%s not implemented\n",__FUNCTION__));
  1037. /* The ConfigOptions information element is ready after reset on the mailbox */
  1038. return 0;
  1039. }
  1040. /****************************************************************************
  1041. * whal_hwInfoElemAcxRevisionGet()
  1042. ****************************************************************************
  1043. * DESCRIPTION: Configure/Interrogate the ACX revision (FW and HW version)
  1044. *
  1045. * INPUTS: None
  1046. *
  1047. * OUTPUT: None
  1048. *
  1049. * RETURNS: OK or NOK
  1050. ****************************************************************************/
  1051. int whal_hwInfoElemAcxRevisionGet
  1052. (
  1053. HwMboxConfig_T *pHwMboxConfig,
  1054. void *fCb,
  1055. TI_HANDLE hCb,
  1056. void *pCb
  1057. )
  1058. {
  1059. ACXRevision_t aElm;
  1060. ACXRevision_t *apElm = &aElm;
  1061. int rc;
  1062. /* Set information element header */
  1063. apElm->EleHdr.id = ACX_FW_REV;
  1064. apElm->EleHdr.len = sizeof(*apElm) - sizeof(EleHdrStruct);
  1065. /* Send the command*/
  1066. rc = CmdQueue_CmdInterrogateWithCb (pHwMboxConfig->hCmdMboxQueue, apElm, sizeof(*apElm), fCb, hCb, pCb);
  1067. return rc;
  1068. }
  1069. /****************************************************************************
  1070. * whal_hwInfoElemWepDefaultKeyIdSet()
  1071. ****************************************************************************
  1072. * DESCRIPTION: Configure/Interrogate The default Key Id
  1073. *
  1074. * INPUTS:
  1075. * UINT8* Key The default key id to use
  1076. *
  1077. * OUTPUT: None
  1078. *
  1079. * RETURNS: OK or NOK
  1080. ****************************************************************************/
  1081. int whal_hwInfoElemWepDefaultKeyIdSet (HwMboxConfig_T* pHwMboxConfig, UINT8* apKeyVal,
  1082. void *CB_Func, TI_HANDLE CB_handle)
  1083. {
  1084. int rc;
  1085. dot11WEPDefaultKeyId_t WlanElm_WepDefaultKeyId;
  1086. dot11WEPDefaultKeyId_t *pCfg = &WlanElm_WepDefaultKeyId;
  1087. /* Set information element header*/
  1088. pCfg->EleHdr.id = DOT11_DEFAULT_KEY;
  1089. pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
  1090. /* Send the command */
  1091. pCfg->DefaultKeyId = *apKeyVal;
  1092. /* Send the configuration command */
  1093. rc = CmdQueue_CmdConfigureWithCb (pHwMboxConfig->hCmdMboxQueue, pCfg, sizeof(*pCfg), CB_Func, CB_handle);
  1094. return rc;
  1095. }
  1096. /****************************************************************************
  1097. * whal_hwInfoElemWepDefaultKeyIdGet()
  1098. ****************************************************************************
  1099. * DESCRIPTION: Configure/Interrogate The default Key Id
  1100. *
  1101. * INPUTS:
  1102. * UINT8* Key The default key id to use
  1103. *
  1104. * OUTPUT: None
  1105. *
  1106. * RETURNS: OK or NOK
  1107. ****************************************************************************/
  1108. int whal_hwInfoElemWepDefaultKeyIdGet (HwMboxConfig_T* pHwMboxConfig, UINT8* apKeyVal,
  1109. void *CB_Func, TI_HANDLE CB_handle)
  1110. {
  1111. int rc = OK;
  1112. dot11WEPDefaultKeyId_t WlanElm_WepDefaultKeyId;
  1113. dot11WEPDefaultKeyId_t *pCfg = &WlanElm_WepDefaultKeyId;
  1114. /* Set information element header */
  1115. pCfg->EleHdr.id = DOT11_DEFAULT_KEY;
  1116. pCfg->EleHdr.len…

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