1/* 2 * TWDriverCtrl.c 3 * 4 * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved. 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 11 * * Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * * Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in 15 * the documentation and/or other materials provided with the 16 * distribution. 17 * * Neither the name Texas Instruments nor the names of its 18 * contributors may be used to endorse or promote products derived 19 * from this software without specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 */ 33 34 35/** \file TWDriver.c 36 * \brief TI WLAN Hardware Access Driver, Parameters control 37 * 38 * \see TWDriver.h 39 */ 40 41#define __FILE_ID__ FILE_ID_118 42#include "TWDriver.h" 43#include "tidef.h" 44#include "report.h" 45#include "txHwQueue_api.h" 46#include "txXfer_api.h" 47#include "txResult_api.h" 48#include "eventMbox_api.h" 49#include "TWDriver.h" 50#include "TWDriverInternal.h" 51#include "FwEvent_api.h" 52#include "CmdBld.h" 53#include "RxQueue_api.h" 54 55 56TI_STATUS TWD_SetParam (TI_HANDLE hTWD, TTwdParamInfo *pParamInfo) 57{ 58 TTwd *pTWD = (TTwd *)hTWD; 59 TWlanParams *pWlanParams = &DB_WLAN(pTWD->hCmdBld); 60 61 TRACE1(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_SetParam: paramType=0x%X\n", pParamInfo->paramType); 62 63 switch (pParamInfo->paramType) 64 { 65 case TWD_RTS_THRESHOLD_PARAM_ID: 66 67 if (pParamInfo->content.halCtrlRtsThreshold > TWD_RTS_THRESHOLD_MAX) 68 { 69 TRACE1(pTWD->hReport, REPORT_SEVERITY_ERROR, "TWD########TWD_RTS_THRESHOLD_PARAM: Value out of permitted range 0x%x\n", pParamInfo->content.halCtrlRtsThreshold); 70 return (PARAM_VALUE_NOT_VALID); 71 } 72 73 if (cmdBld_CfgRtsThreshold (pTWD->hCmdBld, pParamInfo->content.halCtrlRtsThreshold, NULL, NULL) == TI_OK) 74 { 75 TRACE1(pTWD->hReport, REPORT_SEVERITY_INFORMATION, "TWD########TWD_RTS_THRESHOLD_PARAM 0x%x\n", pParamInfo->content.halCtrlRtsThreshold); 76 pWlanParams->RtsThreshold = pParamInfo->content.halCtrlRtsThreshold; 77 } 78 break; 79 80 case TWD_CTS_TO_SELF_PARAM_ID: 81 return cmdBld_CfgCtsProtection (pTWD->hCmdBld, pParamInfo->content.halCtrlCtsToSelf, NULL, NULL); 82 83 case TWD_RX_TIME_OUT_PARAM_ID: 84 if (cmdBld_CfgServicePeriodTimeout (pTWD->hCmdBld, &pParamInfo->content.halCtrlRxTimeOut, NULL, NULL) == TI_OK) 85 { 86 pWlanParams->rxTimeOut.psPoll = pParamInfo->content.halCtrlRxTimeOut.psPoll; 87 pWlanParams->rxTimeOut.UPSD = pParamInfo->content.halCtrlRxTimeOut.UPSD; 88 } 89 break; 90 91 case TWD_FRAG_THRESHOLD_PARAM_ID: 92 if (pParamInfo->content.halCtrlFragThreshold < TWD_FRAG_THRESHOLD_MIN || 93 pParamInfo->content.halCtrlFragThreshold > TWD_FRAG_THRESHOLD_MAX) 94 return PARAM_VALUE_NOT_VALID; 95 96 cmdBld_CfgFragmentThreshold (pTWD->hCmdBld, pParamInfo->content.halCtrlFragThreshold, NULL, NULL); 97 break; 98 99 case TWD_MAX_RX_MSDU_LIFE_TIME_PARAM_ID: 100 cmdBld_CfgRxMsduLifeTime (pTWD->hCmdBld, pParamInfo->content.halCtrlMaxRxMsduLifetime, NULL, NULL); 101 break; 102 103 case TWD_ACX_STATISTICS_PARAM_ID: 104 if (cmdBld_CfgStatisitics (pTWD->hCmdBld, NULL, NULL) != TI_OK) 105 return TI_NOK; 106 break; 107 108 case TWD_LISTEN_INTERVAL_PARAM_ID: 109 if (pParamInfo->content.halCtrlListenInterval < TWD_LISTEN_INTERVAL_MIN || 110 pParamInfo->content.halCtrlListenInterval > TWD_LISTEN_INTERVAL_MAX) 111 return PARAM_VALUE_NOT_VALID; 112 113 pWlanParams->ListenInterval = (TI_UINT8)pParamInfo->content.halCtrlListenInterval; 114 break; 115 116 case TWD_AID_PARAM_ID: 117 pWlanParams->Aid = pParamInfo->content.halCtrlAid; 118 119 /* Configure the ACXAID info element*/ 120 if (cmdBld_CfgAid (pTWD->hCmdBld, pParamInfo->content.halCtrlAid, NULL, NULL) != TI_OK) 121 return TI_NOK; 122 break; 123 124 case TWD_RSN_HW_ENC_DEC_ENABLE_PARAM_ID: 125 TRACE1(pTWD->hReport, REPORT_SEVERITY_INFORMATION, "TWD########HW_ENC_DEC_ENABLE %d\n", pParamInfo->content.rsnHwEncDecrEnable); 126 127 /* Set the Encryption/Decryption on the HW*/ 128 if (cmdBld_CfgHwEncDecEnable (pTWD->hCmdBld, pParamInfo->content.rsnHwEncDecrEnable, NULL, NULL) != TI_OK) 129 return (TI_NOK); 130 break; 131 132 case TWD_RSN_KEY_ADD_PARAM_ID: 133 TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION, "TWD########KEY_ADD\n"); 134 135 if (cmdBld_CmdAddKey (pTWD->hCmdBld, 136 (TSecurityKeys *) pParamInfo->content.configureCmdCBParams.pCb, 137 TI_FALSE, 138 pParamInfo->content.configureCmdCBParams.fCb, 139 pParamInfo->content.configureCmdCBParams.hCb) != TI_OK) 140 return TI_NOK; 141 break; 142 143 case TWD_RSN_KEY_REMOVE_PARAM_ID: 144 TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION, "TWD########KEY_REMOVE\n"); 145 146 if (cmdBld_CmdRemoveKey (pTWD->hCmdBld, 147 (TSecurityKeys *) pParamInfo->content.configureCmdCBParams.pCb, 148 pParamInfo->content.configureCmdCBParams.fCb, 149 pParamInfo->content.configureCmdCBParams.hCb) != TI_OK) 150 return TI_NOK; 151 break; 152 153 case TWD_RSN_DEFAULT_KEY_ID_PARAM_ID: 154 if (*((TI_UINT8 *)pParamInfo->content.configureCmdCBParams.pCb) > MAX_DEFAULT_KEY_ID) 155 return PARAM_VALUE_NOT_VALID; 156 157 TRACE1(pTWD->hReport, REPORT_SEVERITY_INFORMATION, "TWD########DEFAULT_KEY_ID %d\n", (TI_UINT8)pParamInfo->content.rsnDefaultKeyID); 158 159 if (cmdBld_CmdSetWepDefaultKeyId (pTWD->hCmdBld, 160 *((TI_UINT8 *)pParamInfo->content.interogateCmdCBParams.pCb), 161 pParamInfo->content.interogateCmdCBParams.fCb, 162 pParamInfo->content.interogateCmdCBParams.hCb) != TI_OK) 163 return TI_NOK; 164 165 break; 166 167 case TWD_RSN_SECURITY_MODE_PARAM_ID: 168 TRACE1(pTWD->hReport, REPORT_SEVERITY_INFORMATION, "TWD########SECURITY_MODE_SET %d\n", pParamInfo->content.rsnEncryptionStatus); 169 if (cmdBld_CfgSecureMode (pTWD->hCmdBld, (ECipherSuite)pParamInfo->content.rsnEncryptionStatus, NULL, NULL) != TI_OK) 170 return TI_NOK; 171 break; 172 173#ifdef XCC_MODULE_INCLUDED 174 case TWD_RSN_XCC_SW_ENC_ENABLE_PARAM_ID: 175 176 TRACE1(pTWD->hReport, REPORT_SEVERITY_INFORMATION, "TWD: XCC_SW_ENC_ENABLE %d\n", pParamInfo->content.rsnXCCSwEncFlag); 177 178 /* when SW encryption is ON, HW encryption should be turned OFF and vice versa */ 179 180 TRACE1(pTWD->hReport, REPORT_SEVERITY_INFORMATION, "TWD: Set HwEncDecrEnable to %d\n", !pParamInfo->content.rsnXCCSwEncFlag); 181 182 /* Set the Encryption/Decryption on the HW*/ 183 if (cmdBld_CfgHwEncDecEnable (pTWD->hCmdBld, !pParamInfo->content.rsnXCCSwEncFlag, NULL, NULL) != TI_OK) 184 return TI_NOK; 185 break; 186 /* not supported - CKIP*/ 187 case TWD_RSN_XCC_MIC_FIELD_ENABLE_PARAM_ID: 188 break; 189#endif /* XCC_MODULE_INCLUDED*/ 190 191 case TWD_TX_POWER_PARAM_ID: 192 193 TRACE1(pTWD->hReport, REPORT_SEVERITY_INFORMATION, "TWD_TX_POWER_PARAM_ID %d\n", pParamInfo->content.halCtrlTxPowerDbm); 194 195 pWlanParams->TxPowerDbm = pParamInfo->content.halCtrlTxPowerDbm; 196 197 /* Configure the wlan hardware */ 198 if (cmdBld_CfgTxPowerDbm (pTWD->hCmdBld, pWlanParams->TxPowerDbm, NULL, NULL) != TI_OK) 199 return TI_NOK; 200 break; 201 202 case TWD_SG_ENABLE_PARAM_ID: 203 return cmdBld_CfgSgEnable (pTWD->hCmdBld, 204 (ESoftGeminiEnableModes)pParamInfo->content.SoftGeminiEnable, 205 NULL, 206 NULL); 207 208 case TWD_SG_CONFIG_PARAM_ID: 209 return cmdBld_CfgSg (pTWD->hCmdBld, &pParamInfo->content.SoftGeminiParam, NULL, NULL); 210 211 case TWD_FM_COEX_PARAM_ID: 212 return cmdBld_CfgFmCoex (pTWD->hCmdBld, &pParamInfo->content.tFmCoexParams, NULL, NULL); 213 214 /* 215 * TX Parameters 216 */ 217 218 case TWD_TX_RATE_CLASS_PARAM_ID: 219 return cmdBld_CfgTxRatePolicy (pTWD->hCmdBld, pParamInfo->content.pTxRatePlicy, NULL, NULL); 220 221 case TWD_QUEUES_PARAM_ID: 222 return cmdBld_CfgTid (pTWD->hCmdBld, pParamInfo->content.pQueueTrafficParams, NULL, NULL); 223 224 case TWD_CLK_RUN_ENABLE_PARAM_ID: 225 TRACE1(pTWD->hReport, REPORT_SEVERITY_INFORMATION, "TWD_SetParam: CLK_RUN_ENABLE %d\n", pParamInfo->content.halCtrlClkRunEnable); 226 227 /* Set the Encryption/Decryption on the HW*/ 228 if (cmdBld_CfgClkRun (pTWD->hCmdBld, pParamInfo->content.halCtrlClkRunEnable, NULL, NULL) != TI_OK) 229 return TI_NOK; 230 break; 231 232 case TWD_COEX_ACTIVITY_PARAM_ID: 233 cmdBld_CfgCoexActivity (pTWD->hCmdBld, &pParamInfo->content.tTwdParamsCoexActivity, NULL, NULL); 234 break; 235 236 case TWD_DCO_ITRIM_PARAMS_ID: 237 cmdBld_CfgDcoItrimParams (pTWD->hCmdBld, pParamInfo->content.tDcoItrimParams.enable, 238 pParamInfo->content.tDcoItrimParams.moderationTimeoutUsec, NULL, NULL); 239 break; 240 241 default: 242 TRACE1(pTWD->hReport, REPORT_SEVERITY_ERROR, "TWD_SetParam - ERROR - Param is not supported, 0x%x\n", pParamInfo->paramType); 243 return PARAM_NOT_SUPPORTED; 244 } 245 246 return TI_OK; 247} 248 249TI_STATUS TWD_GetParam (TI_HANDLE hTWD, TTwdParamInfo *pParamInfo) 250{ 251 TTwd *pTWD = (TTwd *)hTWD; 252 253 TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_GetParam: called\n"); 254 255 return cmdBld_GetParam (pTWD->hCmdBld, pParamInfo); 256} 257 258TI_STATUS TWD_CfgRx (TI_HANDLE hTWD, TI_UINT32 uRxConfigOption, TI_UINT32 uRxFilterOption) 259{ 260 TTwd *pTWD = (TTwd *)hTWD; 261 262 TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CfgRx: called\n"); 263 264 return cmdBld_CfgRx (pTWD->hCmdBld, uRxConfigOption, uRxFilterOption, NULL, NULL); 265} 266 267TI_STATUS TWD_CfgArpIpAddrTable (TI_HANDLE hTWD, TIpAddr tIpAddr, EArpFilterType filterType, EIpVer eIpVer) 268{ 269 TTwd *pTWD = (TTwd *)hTWD; 270 271 TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CfgArpIpAddrTable: called\n"); 272 273 return cmdBld_CfgArpIpAddrTable (pTWD->hCmdBld, tIpAddr, (TI_UINT8)filterType, eIpVer, NULL, NULL); 274} 275 276/** @ingroup Misc 277 * \brief Configure ARP IP Filter 278 * 279 * \param hTWD - TWD module object handle 280 * \param bEnabled - Indicates if ARP filtering is Enabled (1) or Disabled (0) 281 * \return TI_OK on success or TI_NOK on failure 282 * 283 * \par Description 284 * 285 * \sa 286 */ 287TI_STATUS TWD_CfgArpIpFilter (TI_HANDLE hTWD, TIpAddr staIp) 288{ 289 TTwd *pTWD = (TTwd *)hTWD; 290 291 TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CfgArpIpFilter: called\n"); 292 293 return cmdBld_CfgArpIpFilter (pTWD->hCmdBld, staIp, NULL, NULL); 294} 295 296TI_STATUS TWD_CmdSetSplitScanTimeOut ( TI_HANDLE hTWD, TI_UINT32 uTimeOut ) 297{ 298 TTwd *pTWD = (TTwd *)hTWD; 299 300 TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CmdSetSplitScanTimeOut: called\n"); 301 302 return cmdBld_CmdSetSplitScanTimeOut (pTWD->hCmdBld, uTimeOut); 303} 304 305TI_STATUS TWD_CmdJoinBss (TI_HANDLE hTWD, TJoinBss *pJoinBssParams) 306{ 307 TTwd *pTWD = (TTwd *)hTWD; 308 309 TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CmdJoinBss: called\n"); 310 311 return cmdBld_CmdJoinBss (pTWD->hCmdBld, pJoinBssParams, NULL, NULL); 312} 313 314TI_STATUS TWD_CfgKeepAlive (TI_HANDLE hTWD, TKeepAliveParams *pKeepAliveParams) 315{ 316 TTwd *pTWD = (TTwd *)hTWD; 317 318 TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CfgKeepAlive: called\n"); 319 320 return cmdBld_CfgKeepAlive (pTWD->hCmdBld, pKeepAliveParams, NULL, NULL); 321} 322 323TI_STATUS TWD_CfgKeepAliveEnaDis(TI_HANDLE hTWD, TI_UINT8 enaDisFlag) 324{ 325 TTwd *pTWD = (TTwd *)hTWD; 326 327 TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CfgKeepAliveEnaDis: called\n"); 328 329 return cmdBld_CfgKeepAliveEnaDis (pTWD->hCmdBld, enaDisFlag, NULL, NULL); 330} 331 332TI_STATUS TWD_CmdTemplate (TI_HANDLE hTWD, TSetTemplate *pTemplateParams, void *fCb, TI_HANDLE hCb) 333{ 334 TTwd *pTWD = (TTwd *)hTWD; 335 336 TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CmdTemplate: called\n"); 337 338 return cmdBld_CmdTemplate (pTWD->hCmdBld, pTemplateParams, fCb, hCb); 339} 340 341TI_STATUS TWD_CfgSlotTime (TI_HANDLE hTWD, ESlotTime eSlotTimeVal) 342{ 343 TTwd *pTWD = (TTwd *)hTWD; 344 345 TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CfgSlotTime: called\n"); 346 347 return cmdBld_CfgSlotTime (pTWD->hCmdBld, eSlotTimeVal, NULL, NULL); 348} 349 350TI_STATUS TWD_CfgPreamble (TI_HANDLE hTWD, EPreamble ePreamble) 351{ 352 TTwd *pTWD = (TTwd *)hTWD; 353 354 TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CfgPreamble: called\n"); 355 356 return cmdBld_CfgPreamble (pTWD->hCmdBld, (Preamble_e)ePreamble, NULL, NULL); 357} 358 359TI_STATUS TWD_CfgPacketDetectionThreshold (TI_HANDLE hTWD, TI_UINT32 threshold) 360{ 361 TTwd *pTWD = (TTwd *)hTWD; 362 363 TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CfgPacketDetectionThreshold: called\n"); 364 365 return cmdBld_CfgPacketDetectionThreshold (pTWD->hCmdBld, threshold, NULL, NULL); 366} 367 368TI_STATUS TWD_CmdDisableTx (TI_HANDLE hTWD) 369{ 370 TTwd *pTWD = (TTwd *)hTWD; 371 372 TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CmdDisableTx: called\n"); 373 374 return cmdBld_CmdDisableTx (pTWD->hCmdBld, NULL, NULL); 375} 376 377TI_STATUS TWD_CmdEnableTx (TI_HANDLE hTWD, TI_UINT8 channel) 378{ 379 TTwd *pTWD = (TTwd *)hTWD; 380 381 TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CmdEnableTx: called\n"); 382 383 return cmdBld_CmdEnableTx (pTWD->hCmdBld, channel, NULL, NULL); 384} 385 386TI_STATUS TWD_CmdSetStaState (TI_HANDLE hTWD, TI_UINT8 staState, void *fCb, TI_HANDLE hCb) 387{ 388 TTwd *pTWD = (TTwd *)hTWD; 389 390 TRACE1(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_SetStaState: %d\n", staState); 391 392 return cmdBld_CmdSetStaState (pTWD->hCmdBld, staState, fCb, hCb); 393} 394 395TI_STATUS TWD_ItrRoammingStatisitics (TI_HANDLE hTWD, void *fCb, TI_HANDLE hCb, void * pCb) 396{ 397 TTwd *pTWD = (TTwd *)hTWD; 398 399 TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_ItrRoammingStatisitics: called\n"); 400 401 return cmdBld_ItrRoamimgStatisitics (pTWD->hCmdBld, fCb, hCb, pCb); 402} 403 404/** @ingroup UnKnown 405 * \brief Interrogate Error Count 406 * 407 * \param hTWD - TWD module object handle 408 * \param fCb - Pointer to Command CB Function 409 * \param hCb - Handle to Command CB Function Obj Parameters 410 * \param pCb - Pointer to read parameters 411 * \return TI_OK on success or TI_NOK on failure 412 * 413 * \par Description 414 * Interrogate ACX Error counter 415 * 416 * \sa 417 */ 418TI_STATUS TWD_ItrErrorCnt (TI_HANDLE hTWD, void *fCb, TI_HANDLE hCb, void *pCb) 419{ 420 TTwd *pTWD = (TTwd *)hTWD; 421 422 TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_ItrErrorCnt: called\n"); 423 424 return cmdBld_ItrErrorCnt (pTWD->hCmdBld, fCb, hCb, pCb); 425} 426 427TI_STATUS TWD_CmdNoiseHistogram (TI_HANDLE hTWD, TNoiseHistogram *pNoiseHistParams) 428{ 429 TTwd *pTWD = (TTwd *)hTWD; 430 431 TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CmdNoiseHistogram: called\n"); 432 433 return cmdBld_CmdNoiseHistogram (pTWD->hCmdBld, pNoiseHistParams, NULL, NULL); 434} 435 436TI_STATUS TWD_CfgBeaconFilterOpt (TI_HANDLE hTWD, TI_UINT8 uBeaconFilteringStatus, TI_UINT8 uNumOfBeaconsToBuffer) 437{ 438 TTwd *pTWD = (TTwd *)hTWD; 439 440 TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CfgBeaconFilterOpt: called\n"); 441 442 return cmdBld_CfgBeaconFilterOpt (pTWD->hCmdBld, uBeaconFilteringStatus, uNumOfBeaconsToBuffer, NULL, NULL); 443} 444 445TI_STATUS TWD_SetRateMngDebug(TI_HANDLE hTWD, RateMangeParams_t *pRateMngParams) 446{ 447 TTwd *pTWD = (TTwd *)hTWD; 448 449 TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_SetRateMngDebug: called\n"); 450 451 return cmdBld_CfgRateMngDbg (pTWD->hCmdBld, pRateMngParams, NULL, NULL); 452} 453 454TI_STATUS TWD_CfgBeaconFilterTable (TI_HANDLE hTWD, TI_UINT8 uNumOfIe, TI_UINT8 *pIeTable, TI_UINT8 uIeTableSize) 455{ 456 TTwd *pTWD = (TTwd *)hTWD; 457 458 TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CfgBeaconFilterTable: called\n"); 459 460 return cmdBld_CfgBeaconFilterTable (pTWD->hCmdBld, uNumOfIe, pIeTable, uIeTableSize, NULL, NULL); 461} 462 463TI_STATUS TWD_CfgWakeUpCondition (TI_HANDLE hTWD, TPowerMgmtConfig *pPowerMgmtConfig) 464{ 465 TTwd *pTWD = (TTwd *)hTWD; 466 467 TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CfgWakeUpCondition: called\n"); 468 469 return cmdBld_CfgWakeUpCondition (pTWD->hCmdBld, pPowerMgmtConfig, NULL, NULL); 470} 471 472TI_STATUS TWD_CfgBcnBrcOptions (TI_HANDLE hTWD, TPowerMgmtConfig *pPowerMgmtConfig) 473{ 474 TTwd *pTWD = (TTwd *)hTWD; 475 476 TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CfgBcnBrcOptions: called\n"); 477 478 return cmdBld_CfgBcnBrcOptions (pTWD->hCmdBld, pPowerMgmtConfig, NULL, NULL); 479} 480 481TFwInfo * TWD_GetFWInfo (TI_HANDLE hTWD) 482{ 483 TTwd *pTWD = (TTwd *)hTWD; 484 485 TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_GetFWInfo: called\n"); 486 487 return cmdBld_GetFWInfo (pTWD->hCmdBld); 488} 489 490TI_STATUS TWD_CmdSwitchChannel (TI_HANDLE hTWD, TSwitchChannelParams *pSwitchChannelCmd) 491{ 492 TTwd *pTWD = (TTwd *)hTWD; 493 494 TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CmdSwitchChannel: called\n"); 495 496 return cmdBld_CmdSwitchChannel (pTWD->hCmdBld, pSwitchChannelCmd, NULL, NULL); 497} 498 499TI_STATUS TWD_CmdSwitchChannelCancel (TI_HANDLE hTWD, TI_UINT8 channel) 500{ 501 TTwd *pTWD = (TTwd *)hTWD; 502 503 TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CmdSwitchChannelCancel: called\n"); 504 505 return cmdBld_CmdSwitchChannelCancel (pTWD->hCmdBld, channel, NULL, NULL); 506} 507 508TI_STATUS TWD_CfgMaxTxRetry (TI_HANDLE hTWD, TRroamingTriggerParams *pRoamingTriggerCmd) 509{ 510 TTwd *pTWD = (TTwd *)hTWD; 511 512 TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CfgMaxTxRetry: called\n"); 513 514 return cmdBld_CfgMaxTxRetry (pTWD->hCmdBld, pRoamingTriggerCmd, NULL, NULL); 515} 516 517TI_STATUS TWD_CfgConnMonitParams (TI_HANDLE hTWD, TRroamingTriggerParams *pRoamingTriggerCmd) 518{ 519 TTwd *pTWD = (TTwd *)hTWD; 520 521 TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CfgConnMonitParams: called\n"); 522 523 return cmdBld_CfgConnMonitParams (pTWD->hCmdBld, pRoamingTriggerCmd, NULL, NULL); 524} 525 526TI_STATUS TWD_ItrRSSI (TI_HANDLE hTWD, void *fCb, TI_HANDLE hCb, void *pCb) 527{ 528 TTwd *pTWD = (TTwd *)hTWD; 529 530 TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_ItrRSSI: called\n"); 531 532 return cmdBld_ItrRSSI (pTWD->hCmdBld, fCb, hCb, pCb); 533} 534 535TI_STATUS TWD_CmdFwDisconnect (TI_HANDLE hTWD, DisconnectType_e uDisconType, TI_UINT16 uDisconReason) 536{ 537 TTwd *pTWD = (TTwd *)hTWD; 538 539 return cmdBld_CmdFwDisconnect (pTWD->hCmdBld, 540 RX_CONFIG_OPTION_MY_DST_MY_BSS, 541 RX_FILTER_OPTION_FILTER_ALL, 542 uDisconType, 543 uDisconReason, 544 NULL, 545 NULL); 546} 547 548TI_STATUS TWD_CmdMeasurement (TI_HANDLE hTWD, 549 TMeasurementParams *pMeasurementParams, 550 void *fCommandResponseCb, 551 TI_HANDLE hCb) 552{ 553 TTwd *pTWD = (TTwd *)hTWD; 554 555 TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CmdMeasurement: called\n"); 556 557 return cmdBld_CmdMeasurement (pTWD->hCmdBld, pMeasurementParams, fCommandResponseCb, hCb); 558} 559 560TI_STATUS TWD_CmdMeasurementStop (TI_HANDLE hTWD, void* fCb, TI_HANDLE hCb) 561{ 562 TTwd *pTWD = (TTwd *)hTWD; 563 564 TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CmdMeasurementStop: called\n"); 565 566 return cmdBld_CmdMeasurementStop (pTWD->hCmdBld, fCb, hCb); 567} 568 569TI_STATUS TWD_CmdApDiscovery (TI_HANDLE hTWD, TApDiscoveryParams *pApDiscoveryParams) 570{ 571 TTwd *pTWD = (TTwd *)hTWD; 572 573 TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CmdApDiscovery: called\n"); 574 575 return cmdBld_CmdApDiscovery (pTWD->hCmdBld, pApDiscoveryParams, NULL, NULL); 576} 577 578TI_STATUS TWD_CmdApDiscoveryStop (TI_HANDLE hTWD) 579{ 580 TTwd *pTWD = (TTwd *)hTWD; 581 582 TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CmdApDiscoveryStop: called\n"); 583 584 return cmdBld_CmdApDiscoveryStop (pTWD->hCmdBld, NULL, NULL); 585} 586 587TI_STATUS TWD_CfgGroupAddressTable (TI_HANDLE hTWD, 588 TI_UINT8 uNumGroupAddrs, 589 TMacAddr *pGroupAddr, 590 TI_BOOL bEnabled) 591{ 592 TTwd *pTWD = (TTwd *)hTWD; 593 594 TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CfgGroupAddressTable: called\n"); 595 596 return cmdBld_CfgGroupAddressTable (pTWD->hCmdBld, uNumGroupAddrs, pGroupAddr, bEnabled, NULL, NULL); 597} 598 599TI_STATUS TWD_GetGroupAddressTable (TI_HANDLE hTWD, TI_UINT8* pEnabled, TI_UINT8* pNumGroupAddrs, TMacAddr *pGroupAddr) 600{ 601 TTwd *pTWD = (TTwd *)hTWD; 602 603 TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_GetGroupAddressTable: called\n"); 604 605 return cmdBld_GetGroupAddressTable (pTWD->hCmdBld, pEnabled, pNumGroupAddrs, pGroupAddr); 606} 607 608TI_STATUS TWD_SetRadioBand (TI_HANDLE hTWD, ERadioBand eRadioBand) 609{ 610 TTwd *pTWD = (TTwd *)hTWD; 611 612 TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_SetRadioBand: called\n"); 613 614 return cmdBld_SetRadioBand (pTWD->hCmdBld, eRadioBand); 615} 616 617TI_STATUS TWD_CfgSleepAuth (TI_HANDLE hTWD, EPowerPolicy eMinPowerPolicy) 618{ 619 TTwd *pTWD = (TTwd *)hTWD; 620 621 TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CfgSleepAuth: called\n"); 622 623 /* Configure the new power policy to the FW */ 624 cmdBld_CfgSleepAuth (pTWD->hCmdBld, eMinPowerPolicy, NULL, NULL); 625 626 return TI_OK; 627} 628 629TI_STATUS TWD_CfgBurstMode (TI_HANDLE hTWD, TI_BOOL bEnabled) 630{ 631 TTwd *pTWD = (TTwd *)hTWD; 632 633 TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "cmdBld_CfgBurstMode: called\n"); 634 635 /* Configure the burst mode to the FW */ 636 cmdBld_CfgBurstMode (pTWD->hCmdBld, bEnabled, NULL, NULL); 637 638 return TI_OK; 639} 640 641 642 643TI_STATUS TWD_CmdHealthCheck (TI_HANDLE hTWD) 644{ 645 TTwd *pTWD = (TTwd *)hTWD; 646 647 TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CmdHealthCheck: called\n"); 648 649 return cmdBld_CmdHealthCheck (pTWD->hCmdBld, NULL, NULL); 650} 651 652TI_STATUS TWD_CfgMacClock (TI_HANDLE hTWD, TI_UINT32 uMacClock) 653{ 654 TTwd *pTWD = (TTwd *)hTWD; 655 656 TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CfgMacClock: called\n"); 657 658 return cmdBld_CfgMacClock (pTWD->hCmdBld, uMacClock, NULL, NULL); 659} 660 661TI_STATUS TWD_CfgArmClock (TI_HANDLE hTWD, TI_UINT32 uArmClock) 662{ 663 TTwd *pTWD = (TTwd *)hTWD; 664 665 TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CfgArmClock: called\n"); 666 667 return cmdBld_CfgArmClock (pTWD->hCmdBld, uArmClock, NULL, NULL); 668} 669 670TI_STATUS TWD_ItrMemoryMap (TI_HANDLE hTWD, MemoryMap_t *pMap, void *fCb, TI_HANDLE hCb) 671{ 672 TTwd *pTWD = (TTwd *)hTWD; 673 674 TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_ItrMemoryMap: called\n"); 675 676 return cmdBld_ItrMemoryMap (pTWD->hCmdBld, pMap, fCb, hCb); 677} 678 679TI_STATUS TWD_ItrStatistics (TI_HANDLE hTWD, void *fCb, TI_HANDLE hCb, void *pCb) 680{ 681 TTwd *pTWD = (TTwd *)hTWD; 682 683 TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_ItrStatistics: called\n"); 684 685 return cmdBld_ItrStatistics (pTWD->hCmdBld, fCb, hCb, pCb); 686} 687 688TI_STATUS TWD_ItrDataFilterStatistics (TI_HANDLE hTWD, void *fCb, TI_HANDLE hCb, void *pCb) 689{ 690 TTwd *pTWD = (TTwd *)hTWD; 691 692 TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_ItrDataFilterStatistics: called\n"); 693 694 return cmdBld_ItrDataFilterStatistics (pTWD->hCmdBld, fCb, hCb, pCb); 695} 696 697TI_STATUS TWD_CfgEnableRxDataFilter (TI_HANDLE hTWD, TI_BOOL bEnabled, filter_e eDefaultAction) 698{ 699 TTwd *pTWD = (TTwd *)hTWD; 700 701 TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CfgEnableRxDataFilter: called\n"); 702 703 return cmdBld_CfgEnableRxDataFilter (pTWD->hCmdBld, bEnabled, eDefaultAction, NULL, NULL); 704} 705 706TI_STATUS TWD_CfgRxDataFilter (TI_HANDLE hTWD, 707 TI_UINT8 index, 708 TI_UINT8 command, 709 filter_e eAction, 710 TI_UINT8 uNumFieldPatterns, 711 TI_UINT8 uLenFieldPatterns, 712 TI_UINT8 *pFieldPatterns) 713{ 714 TTwd *pTWD = (TTwd *)hTWD; 715 716 TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CfgRxDataFilter: called\n"); 717 718 return cmdBld_CfgRxDataFilter (pTWD->hCmdBld, 719 index, 720 command, 721 eAction, 722 uNumFieldPatterns, 723 uLenFieldPatterns, 724 pFieldPatterns, 725 NULL, 726 NULL); 727} 728 729TI_STATUS TWD_CfgRssiSnrTrigger (TI_HANDLE hTWD, RssiSnrTriggerCfg_t* pRssiSnrTrigger) 730{ 731 TTwd *pTWD = (TTwd *)hTWD; 732 733 TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CfgRssiSnrTrigger: called\n"); 734 735 return cmdBld_CfgRssiSnrTrigger (pTWD->hCmdBld, pRssiSnrTrigger, NULL, NULL); 736} 737 738TI_STATUS TWD_CfgAcParams (TI_HANDLE hTWD, TAcQosParams *pAcQosParams, void *fCb, TI_HANDLE hCb) 739{ 740 TTwd *pTWD = (TTwd *)hTWD; 741 742 TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CfgAcParams: called\n"); 743 744 return cmdBld_CfgAcParams (pTWD->hCmdBld, pAcQosParams, fCb, hCb); 745} 746 747TI_STATUS TWD_CfgPsRxStreaming (TI_HANDLE hTWD, TPsRxStreaming *pPsRxStreaming, void *fCb, TI_HANDLE hCb) 748{ 749 TTwd *pTWD = (TTwd *)hTWD; 750 751 TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CfgPsRxStreaming: called\n"); 752 753 return cmdBld_CfgPsRxStreaming (pTWD->hCmdBld, pPsRxStreaming, fCb, hCb); 754} 755 756TI_STATUS TWD_CfgBet (TI_HANDLE hTWD, TI_UINT8 Enable, TI_UINT8 MaximumConsecutiveET) 757{ 758 TTwd *pTWD = (TTwd *)hTWD; 759 760 TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CfgBet: called\n"); 761 762 return cmdBld_CfgBet (pTWD->hCmdBld, Enable, MaximumConsecutiveET, NULL, NULL); 763} 764 765TI_STATUS TWD_SetSecuritySeqNum (TI_HANDLE hTWD, TI_UINT8 securitySeqNumLsByte) 766{ 767 TTwd *pTWD = (TTwd *)hTWD; 768 769 TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_SetSecuritySeqNum: called\n"); 770 771 return cmdBld_SetSecuritySeqNum (pTWD->hCmdBld, securitySeqNumLsByte); 772} 773 774TI_STATUS TWD_CfgSetFwHtCapabilities (TI_HANDLE hTWD, 775 Tdot11HtCapabilitiesUnparse *pHtCapabilitiesIe, 776 TI_BOOL bAllowHtOperation) 777{ 778 TTwd *pTWD = (TTwd *)hTWD; 779 TI_UINT32 uHtCapabilites; 780 TI_UINT8 uAmpduMaxLeng = 0; 781 TI_UINT8 uAmpduMinSpac = 0; 782 TI_UINT16 uHtCapabilitesField; 783 784 /* Note, currently this value will be set to FFFFFFFFFFFF to indicate it is relevant for all peers 785 since we only support HT in infrastructure mode. Later on this field will be relevant to IBSS/DLS operation */ 786 TMacAddr tMacAddress = {0xff,0xff,0xff,0xff,0xff,0xff}; 787 788 TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CfgSetFwHtCapabilities: called\n"); 789 790 /* Allow HT Operation ? */ 791 if (bAllowHtOperation == TI_TRUE) 792 { 793 /* get date from HT capabilities field */ 794 /* Handle endian for the field */ 795 COPY_WLAN_WORD(&uHtCapabilitesField, pHtCapabilitiesIe->aHtCapabilitiesIe); 796 uHtCapabilites = FW_CAP_BIT_MASK_HT_OPERATION | 797 ((uHtCapabilitesField & HT_CAP_GREENFIELD_FRAME_FORMAT_BITMASK) ? FW_CAP_BIT_MASK_GREENFIELD_FRAME_FORMAT : 0) | 798 ((uHtCapabilitesField & HT_CAP_SHORT_GI_FOR_20MHZ_BITMASK) ? FW_CAP_BIT_MASK_SHORT_GI_FOR_20MHZ_PACKETS : 0) | 799 ((uHtCapabilitesField & HT_CAP_LSIG_TXOP_PROTECTION_BITMASK) ? FW_CAP_BIT_MASK_LSIG_TXOP_PROTECTION : 0); 800 801 /* get date from HT capabilities field */ 802 uHtCapabilites |= ((uHtCapabilitesField & HT_EXT_HT_CONTROL_FIELDS_BITMASK) ? FW_CAP_BIT_MASK_HT_CONTROL_FIELDS : 0) | 803 ((uHtCapabilitesField & HT_EXT_RD_INITIATION_BITMASK) ? FW_CAP_BIT_MASK_RD_INITIATION : 0); 804 805 /* get date from A-MPDU parameters field */ 806 uAmpduMaxLeng = pHtCapabilitiesIe->aHtCapabilitiesIe[HT_CAP_AMPDU_PARAMETERS_FIELD_OFFSET] & HT_CAP_AMPDU_MAX_RX_FACTOR_BITMASK; 807 uAmpduMinSpac = (pHtCapabilitiesIe->aHtCapabilitiesIe[HT_CAP_AMPDU_PARAMETERS_FIELD_OFFSET] >> 2) & HT_CAP_AMPDU_MIN_START_SPACING_BITMASK; 808 } 809 /* not Allow HT Operation */ 810 else 811 { 812 uHtCapabilites = 0; 813 } 814 815 return cmdBld_CfgSetFwHtCapabilities (pTWD->hCmdBld, 816 uHtCapabilites, 817 tMacAddress, 818 uAmpduMaxLeng, 819 uAmpduMinSpac, 820 NULL, 821 NULL); 822} 823 824TI_STATUS TWD_CfgSetFwHtInformation (TI_HANDLE hTWD, Tdot11HtInformationUnparse *pHtInformationIe) 825{ 826 TTwd *pTWD = (TTwd *)hTWD; 827 TI_UINT8 uRifsMode; 828 TI_UINT8 uHtProtection; 829 TI_UINT8 uGfProtection; 830 TI_UINT8 uHtTxBurstLimit; 831 TI_UINT8 uDualCtsProtection; 832 833 TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CfgSetFwHtInformation: called\n"); 834 835 uRifsMode = (pHtInformationIe->aHtInformationIe[1] & HT_INF_RIFS_MOD_BITMASK) >> 3; 836 837 uHtProtection = (pHtInformationIe->aHtInformationIe[2] & HT_INF_OPERATION_MOD_BITMASK); 838 839 uGfProtection = (pHtInformationIe->aHtInformationIe[2] & HT_INF_NON_GF_PRES_BITMASK) >> 2; 840 841 uHtTxBurstLimit = 0; /* not in use */ 842 843 uDualCtsProtection = (pHtInformationIe->aHtInformationIe[4] & HT_INF_DUAL_CTS_PROTECTION_BITMASK) >> 7; 844 845 return cmdBld_CfgSetFwHtInformation (pTWD->hCmdBld, 846 uRifsMode, 847 uHtProtection, 848 uGfProtection, 849 uHtTxBurstLimit, 850 uDualCtsProtection, 851 NULL, 852 NULL); 853} 854 855TI_STATUS TWD_CfgSetBaInitiator (TI_HANDLE hTWD, 856 TI_UINT8 uTid, 857 TI_UINT8 uState, 858 TMacAddr tRa, 859 TI_UINT16 uWinSize, 860 TI_UINT16 uInactivityTimeout) 861 862{ 863 TTwd *pTWD = (TTwd *)hTWD; 864 865 TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CfgSetBaInitiator: called\n"); 866 867 return cmdBld_CfgSetBaSession (pTWD->hCmdBld, 868 ACX_BA_SESSION_INITIATOR_POLICY, 869 uTid, 870 uState, 871 tRa, 872 uWinSize, 873 uInactivityTimeout, 874 NULL, 875 NULL); 876} 877 878TI_STATUS TWD_CfgSetBaReceiver (TI_HANDLE hTWD, 879 TI_UINT8 uTid, 880 TI_UINT8 uState, 881 TMacAddr tRa, 882 TI_UINT16 uWinSize) 883{ 884 TTwd *pTWD = (TTwd *)hTWD; 885 886 TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CfgSetBaReceiver: called\n"); 887 888 return cmdBld_CfgSetBaSession (pTWD->hCmdBld, 889 ACX_BA_SESSION_RESPONDER_POLICY, 890 uTid, 891 uState, 892 tRa, 893 uWinSize, 894 0, 895 (void *)NULL, 896 (TI_HANDLE)NULL); 897} 898 899void TWD_CloseAllBaSessions(TI_HANDLE hTWD) 900{ 901 TTwd *pTWD = (TTwd *)hTWD; 902 TI_UINT32 i; 903 904 TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CloseAllBaSessions: called\n"); 905 906 /* close all BA sessions */ 907 for(i=0; i <MAX_NUM_OF_802_1d_TAGS; ++i) 908 { 909 RxQueue_CloseBaSession(pTWD->hRxQueue, i); 910 } 911} 912 913ETxnStatus TWD_WdExpireEvent(TI_HANDLE hTWD) 914{ 915 TTwd *pTWD = (TTwd*)hTWD; 916 917 if ((pTWD->fFailureEventCb != NULL) && (pTWD->hFailureEventCb != NULL)) 918 { 919 pTWD->fFailureEventCb(pTWD->hFailureEventCb, HW_WD_EXPIRE); 920 } 921 922 return TXN_STATUS_COMPLETE; 923} 924