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 * 38 * MODULE: whalHwCtrl.c 39 * PURPOSE: Implements action on the wlan hardware card (Reset, Run, SendCmd, Sw Download) 40 * 41 ****************************************************************************/ 42 43 #include "802_11Defs.h" 44 #include "Ethernet.h" 45 #include "whalCommon.h" 46 47 #include "whalCtrl_api.h" 48 #include "whalHwDefs.h" 49 #include "whalHwCtrl.h" 50 #include "whalHwMboxCmd.h" 51 #include "whalHwMboxConfig.h" 52 #include "eventMbox_api.h" 53 #include "whalParams.h" 54 #include "commonTypes.h" 55 #include "txResult_api.h" 56 #include "TNETW_Driver_api.h" 57 #include "TNETW_Driver.h" 58 #include "whalSecurity.h" 59 60 61 #define ACX_POWER_MGMT_OPTIONS_STRUCT_DEBUG 0 62 63 int whal_hwCtrl_ConfigTemplates(HwCtrl_T *pHwCtrl); 64 int whal_hwCtrl_ConfigQueues(HwCtrl_T *pHwCtrl, UINT32 MemoryStart); 65 void whal_hwCtrl_OverridePhyRegsDefaults(HwCtrl_T *pHwCtrl); 66 67 68 #define CF_FORM_FACTOR 3 /* Compact Flash*/ 69 70 #define CB_FORM_FACTOR 1 /* Card Bus */ 71 72 /**************************************************************************** 73 * whal_hwCtrl_Create() 74 **************************************************************************** 75 * DESCRIPTION: Create the wlan hardware control object 76 * 77 * INPUTS: 78 * 79 * OUTPUT: None 80 * 81 * RETURNS: The Created object 82 ****************************************************************************/ 83 HwCtrl_T *whal_hwCtrl_Create(TI_HANDLE hOs, WhalParams_T *pWhalParams) 84 { 85 HwCtrl_T *pHwCtrl; 86 87 pHwCtrl = os_memoryAlloc(hOs, sizeof(HwCtrl_T)); 88 if (pHwCtrl == NULL) 89 return NULL; 90 91 os_memoryZero(hOs, (void*)pHwCtrl, sizeof(HwCtrl_T)); 92 93 pHwCtrl->hOs = hOs; 94 pHwCtrl->pWhalParams = pWhalParams; 95 pHwCtrl->pHwMboxCmd = whal_hwMboxCmd_Create(hOs, pHwCtrl->pWhalParams); 96 pHwCtrl->pHwMboxCmdBit = whal_hwMboxCmdBit_Create(hOs); 97 pHwCtrl->pHwMboxConfig = whal_hwMboxConfig_Create(hOs); 98 pHwCtrl->hWhalBus = whalBus_Create(hOs); 99 100 if ( (!pHwCtrl->pHwMboxCmd) || (!pHwCtrl->pHwMboxConfig) || (!pHwCtrl->hWhalBus) ) 101 { 102 whal_hwCtrl_Destroy(pHwCtrl); 103 return NULL; 104 } 105 106 return(pHwCtrl); 107 } 108 109 /**************************************************************************** 110 * whal_hwCtrl_Destroy() 111 **************************************************************************** 112 * DESCRIPTION: Destroy the object 113 * 114 * INPUTS: 115 * pHwCtrl The object to free 116 * 117 * OUTPUT: None 118 * 119 * RETURNS: OK or NOK 120 ****************************************************************************/ 121 int whal_hwCtrl_Destroy(HwCtrl_T *pHwCtrl) 122 { 123 if (pHwCtrl == NULL) 124 return OK; 125 126 whal_hwMboxCmd_Destroy(pHwCtrl->pHwMboxCmd); 127 whal_hwMboxCmdBit_Destroy(pHwCtrl->pHwMboxCmdBit); 128 whal_hwMboxConfig_Destroy(pHwCtrl->pHwMboxConfig); 129 whalBus_Destroy(pHwCtrl->hWhalBus); 130 131 os_memoryFree(pHwCtrl->hOs, pHwCtrl, sizeof(HwCtrl_T)); 132 return OK; 133 } 134 135 136 /**************************************************************************** 137 * whal_hwCtrl_GetTnentwifHandle() 138 **************************************************************************** 139 * DESCRIPTION: Return TNETWIF handle 140 * 141 * INPUTS: 142 * pHwCtrl The object to free 143 * 144 * OUTPUT: None 145 * 146 * RETURNS: TNETWIF handle 147 ****************************************************************************/ 148 TI_HANDLE whal_hwCtrl_GetTnentwifHandle (HwCtrl_T *pHwCtrl) 149 { 150 return whalBus_GetTnentwifHandle (pHwCtrl->hWhalBus); 151 } 152 153 154 /**************************************************************************** 155 * whal_hwCtrl_StartJoin() 156 **************************************************************************** 157 * DESCRIPTION: Enable Rx/Tx and send Start/Join command 158 * 159 * INPUTS: None 160 * 161 * OUTPUT: None 162 * 163 * RETURNS: OK or NOK 164 ****************************************************************************/ 165 int whal_hwCtrl_StartJoin(HwCtrl_T *pHwCtrl, bssType_e BssType, void *JoinCompleteCB, TI_HANDLE CB_handle) 166 { 167 HwMboxCmd_T *pHwMboxCmd = pHwCtrl->pHwMboxCmd; 168 UINT8 HwBssType; 169 #ifdef TI_DBG 170 UINT8 *pBssId = whal_ParamsGetBssId(pHwCtrl->pWhalParams); 171 172 WLAN_REPORT_INIT(pHwCtrl->hReport, HAL_HW_CTRL_MODULE_LOG, 173 ("whal_hwCtrl_StartJoin: Enable Tx, Rx and Start the Bss, type=%d\n", BssType)); 174 WLAN_REPORT_INIT(pHwCtrl->hReport, HAL_HW_CTRL_MODULE_LOG, 175 ("------------------------------------------------------------\n")); 176 WLAN_REPORT_INIT(pHwCtrl->hReport, HAL_HW_CTRL_MODULE_LOG, 177 ("START/JOIN, SSID=%s, BSSID=%02X-%02X-%02X-%02X-%02X-%02X, Chan=%d\n", whal_ParamsGetElm_Ssid(pHwCtrl->pWhalParams)->serviceSetId, pBssId[0], pBssId[1], pBssId[2], pBssId[3], pBssId[4], pBssId[5], whal_ParamsGetRadioChannel(pHwCtrl->pWhalParams))); 178 WLAN_REPORT_INIT(pHwCtrl->hReport, HAL_HW_CTRL_MODULE_LOG, 179 ("------------------------------------------------------------\n")); 180 #endif /* TI_DBG */ 181 182 /* 183 * Set frame rates according to the values previously configured: 184 * Driver join -> as configured to whalCtrl_JoinBss() 185 * GWSI join -> as configured to the template framed before, or default values 186 * Recovery -> Saved parameters from last Join command 187 */ 188 whal_hwCtrl_SetFrameRate(pHwCtrl, 189 pHwCtrl->pWhalParams->BssInfoParams.txCtrlFrmRate, 190 pHwCtrl->pWhalParams->BssInfoParams.txCtrlFrmModulation, 191 pHwCtrl->pWhalParams->BssInfoParams.txMgmtFrmRate, 192 pHwCtrl->pWhalParams->BssInfoParams.txMgmtFrmModulation); 193 /* 194 * set RxFilter (but don't write it to the FW, this is done in the join command), 195 * Configure templates content, ... 196 */ 197 whal_hwCtrl_SetBssType(pHwCtrl, BssType, &HwBssType); 198 199 return whal_hwMboxCmd_StartBss(pHwMboxCmd, HwBssType, JoinCompleteCB, CB_handle); 200 201 } 202 203 204 /**************************************************************************** 205 * whal_hwCtrl_switchChannel() 206 **************************************************************************** 207 * DESCRIPTION: Switching the serving channel 208 * 209 * INPUTS: channel - new channel number 210 * 211 * OUTPUT: None 212 * 213 * RETURNS: OK or NOK 214 ****************************************************************************/ 215 int whal_hwCtrl_switchChannel(HwCtrl_T *pHwCtrl,UINT8 channel) 216 { 217 HwMboxCmd_T *pHwMboxCmd = pHwCtrl->pHwMboxCmd; 218 219 return whal_hwMboxCmd_EnableTx(pHwMboxCmd,channel); 220 } 221 222 223 /**************************************************************************** 224 * whal_hwCtrl_DisableTx() 225 **************************************************************************** 226 * DESCRIPTION: Disable Tx path. 227 * 228 * INPUTS: None 229 * 230 * OUTPUT: None 231 * 232 * RETURNS: OK or NOK 233 ****************************************************************************/ 234 int whal_hwCtrl_DisableTx(HwCtrl_T *pHwCtrl) 235 { 236 HwMboxCmd_T *pHwMboxCmd = pHwCtrl->pHwMboxCmd; 237 238 return whal_hwMboxCmd_DisableTx(pHwMboxCmd); 239 } 240 241 /**************************************************************************** 242 * whal_hwCtrl_EnableTx() 243 **************************************************************************** 244 * DESCRIPTION: Disable Tx path. 245 * 246 * INPUTS: channel - new channel number 247 * 248 * OUTPUT: None 249 * 250 * RETURNS: OK or NOK 251 ****************************************************************************/ 252 int whal_hwCtrl_EnableTx(HwCtrl_T *pHwCtrl, int channel) 253 { 254 HwMboxCmd_T *pHwMboxCmd = pHwCtrl->pHwMboxCmd; 255 256 return whal_hwMboxCmd_EnableTx(pHwMboxCmd, (UINT8)channel); 257 } 258 259 260 /**************************************************************************** 261 * whal_hwCtrl_EnableDataPath() 262 **************************************************************************** 263 * DESCRIPTION: Enable Rx/Tx and send Start/Join command 264 * 265 * INPUTS: None 266 * 267 * OUTPUT: None 268 * 269 * RETURNS: OK or NOK 270 ****************************************************************************/ 271 int whal_hwCtrl_EnableDataPath(HwCtrl_T *pHwCtrl) 272 { 273 HwMboxCmd_T *pHwMboxCmd = pHwCtrl->pHwMboxCmd; 274 275 whal_hwMboxCmd_EnableRx(pHwMboxCmd); 276 whal_hwMboxCmd_EnableTx(pHwMboxCmd, whal_ParamsGetDefaultChannel(pHwCtrl->pWhalParams)); 277 278 279 #ifdef WDBG_POLLING /* (!!!) ONLY FOR DEBUG WHEN THERE ARE NO INTERRUPTS */ 280 281 /* allocate OS timer memory */ 282 hal_timer = os_timerCreate(pHwCtrl->hOs, whal_hwCtrl_RxPollingTimeout, (TI_HANDLE) pHwCtrl); 283 if (!hal_timer) 284 return NOK; 285 286 os_timerStart(pHwCtrl->hOs, hal_timer, 20, FALSE); 287 #endif 288 289 return OK; 290 } 291 292 /**************************************************************************** 293 * whal_hwCtrl_EnableDataPath() 294 **************************************************************************** 295 * DESCRIPTION: Enable Rx/Tx and send Start/Join command 296 * 297 * INPUTS: None 298 * 299 * OUTPUT: None 300 * 301 * RETURNS: OK or NOK 302 ****************************************************************************/ 303 int whal_hwCtrl_DisableDataPath(HwCtrl_T *pHwCtrl) 304 { 305 #if 0 306 HwMboxCmd_T *pHwMboxCmd = pHwCtrl->pHwMboxCmd; 307 /* 308 * L.M. removed because of two reasons: 309 * 1. When the FW is dead, it only adds delay to recovery. 310 * 2. WSP does not have it. 311 */ 312 313 whal_hwMboxCmd_DisableTx(pHwMboxCmd); 314 whal_hwMboxCmd_DisableRx(pHwMboxCmd); 315 316 317 /* use FwEvent ... whalBus_hwIntr_Disable(pHwCtrl->hWhalBus, HAL_ALL_INTERRUPTS); */ 318 #endif 319 320 return OK; 321 } 322 323 /**************************************************************************** 324 * whal_hwCtrl_SetBssType() 325 **************************************************************************** 326 * DESCRIPTION: Set Bss type, set RxFilter 327 * 328 * INPUTS: None 329 * 330 * OUTPUT: None 331 * 332 * RETURNS: OK or NOK 333 ****************************************************************************/ 334 int whal_hwCtrl_SetBssType(HwCtrl_T *pHwCtrl, bssType_e BssType, UINT8 *HwBssType) 335 { 336 switch (BssType) 337 { 338 case BSS_AP: 339 whal_ParamsSetBssType(pHwCtrl->pWhalParams, BSS_TYPE_AP_BSS); 340 whal_ParamsSetRxFilter(pHwCtrl->pWhalParams, RX_CONFIG_OPTION_ANY_DST_MY_BSS, RX_FILTER_OPTION_DEF); 341 break; 342 343 case BSS_INFRASTRUCTURE: 344 whal_ParamsSetBssType(pHwCtrl->pWhalParams, BSS_TYPE_STA_BSS); 345 whal_ParamsSetRxFilter(pHwCtrl->pWhalParams, RX_CONFIG_OPTION_FOR_JOIN, RX_FILTER_OPTION_JOIN); 346 break; 347 348 case BSS_INDEPENDENT: 349 whal_ParamsSetBssType(pHwCtrl->pWhalParams, BSS_TYPE_IBSS); 350 #ifdef GWSI_LIB 351 /* In GWSI we filter with SSID. This is not done in the full driver because of RTP version. 352 * In the future leave only GWSI option for both cases. 353 */ 354 whal_ParamsSetRxFilter(pHwCtrl->pWhalParams, RX_CONFIG_OPTION_FOR_IBSS_JOIN, RX_FILTER_OPTION_DEF); 355 #else 356 whal_ParamsSetRxFilter(pHwCtrl->pWhalParams, RX_CONFIG_OPTION_FOR_JOIN, RX_FILTER_OPTION_DEF); 357 #endif 358 break; 359 360 default: 361 WLAN_REPORT_FATAL_ERROR(pHwCtrl->hReport, HAL_HW_CTRL_MODULE_LOG, 362 ("whal_hwCtrl_SetBssType: FATAL_ERROR, unknown BssType %d\n", BssType)); 363 return NOK; 364 } 365 366 *HwBssType = whal_ParamsGetBssType(pHwCtrl->pWhalParams); 367 368 return OK; 369 } 370 371 372 /**************************************************************************** 373 * whal_hwCtrl_setRxFilters() 374 **************************************************************************** 375 * DESCRIPTION: Sets the filters according to the given configuration. 376 * 377 * INPUTS: RxConfigOption - The given Rx filters configuration 378 * RxFilterOption - The given Rx filters options 379 * 380 * OUTPUT: None 381 * 382 * RETURNS: OK or NOK 383 ****************************************************************************/ 384 int whal_hwCtrl_setRxFilters(HwCtrl_T *pHwCtrl, UINT32 RxConfigOption, UINT32 RxFilterOption) 385 { 386 whal_ParamsSetRxFilter(pHwCtrl->pWhalParams, RxConfigOption, RxFilterOption); 387 388 return whal_hwInfoElemRxConfigSet (pHwCtrl->pHwMboxConfig, 389 &pHwCtrl->pWhalParams->WlanParams.RxConfigOption, 390 &pHwCtrl->pWhalParams->WlanParams.RxFilterOption); 391 } 392 393 394 /**************************************************************************** 395 * whal_hwCtrl_GetRxFilters() 396 **************************************************************************** 397 * DESCRIPTION: Sets the filters according to the given configuration. 398 * 399 * INPUTS: RxConfigOption - The given Rx filters configuration 400 * RxFilterOption - The given Rx filters options 401 * 402 * OUTPUT: None 403 * 404 * RETURNS: OK or NOK 405 ****************************************************************************/ 406 int whal_hwCtrl_GetRxFilters(HwCtrl_T *pHwCtrl, UINT32* pRxConfigOption, UINT32* pRxFilterOption) 407 { 408 whal_ParamsGetRxFilter(pHwCtrl->pWhalParams, pRxConfigOption, pRxFilterOption); 409 410 return OK; 411 } 412 413 414 /**************************************************************************** 415 * whal_hwCtrl_setRxDataFiltersParams() 416 **************************************************************************** 417 * DESCRIPTION: Enables or disables Rx data filtering. 418 * 419 * INPUTS: enabled - 0 to disable data filtering, any other value to enable. 420 * defaultAction - The default action to take on non-matching packets. 421 * 422 * OUTPUT: None 423 * 424 * RETURNS: OK or NOK 425 ****************************************************************************/ 426 int whal_hwCtrl_setRxDataFiltersParams(HwCtrl_T * pHwCtrl, BOOL enabled, filter_e defaultAction) 427 { 428 return whal_hwInfoElemSetRxDataFiltersParams(pHwCtrl->pHwMboxConfig, enabled, defaultAction); 429 } 430 431 432 /**************************************************************************** 433 * whal_hwCtrl_setRxDataFilter() 434 **************************************************************************** 435 * DESCRIPTION: Sets the filters according to the given configuration. 436 * 437 * INPUTS: index - Index of the Rx Data filter 438 * command - Add or remove the filter 439 * action - Action to take on packets matching the pattern 440 * numFieldPatterns - Number of field patterns in the filter 441 * lenFieldPatterns - Length of the field pattern series 442 * fieldPatterns - Series of field patterns 443 * 444 * OUTPUT: None 445 * 446 * RETURNS: OK or NOK 447 ****************************************************************************/ 448 int whal_hwCtrl_setRxDataFilter(HwCtrl_T * pHwCtrl, UINT8 index, UINT8 command, filter_e action, UINT8 numFieldPatterns, UINT8 lenFieldPatterns, UINT8 * fieldPatterns) 449 { 450 return whal_hwInfoElemSetRxDataFilter(pHwCtrl->pHwMboxConfig, 451 index, command, action, numFieldPatterns, lenFieldPatterns, fieldPatterns); 452 } 453 454 455 /**************************************************************************** 456 * whal_hwCtrl_SetarpIpAddressesTable() 457 **************************************************************************** 458 * DESCRIPTION: Sets the ARP IP table according to the given configuration. 459 * 460 * OUTPUT: None 461 * 462 * RETURNS: OK or NOK 463 ****************************************************************************/ 464 int whal_hwCtrl_SetarpIpAddressesTable (HwCtrl_T *pHwCtrl, IpAddress_t *IP_addr, UINT8 isEnabled , IPver_e IP_ver) 465 { 466 if ( NULL == IP_addr ) 467 { 468 WLAN_REPORT_ERROR(pHwCtrl->hReport, HAL_HW_CTRL_MODULE_LOG, 469 ("whal_hwCtrl_SetarpIpAddressesTable: Ip Addr ptr = NULL !!!\n")); 470 471 return PARAM_VALUE_NOT_VALID ; 472 } 473 474 whal_ParamsSetarpIpAddressesTable(pHwCtrl->pWhalParams, IP_addr, IP_ver); 475 whal_ParamsSetarpIpFilterEnabled(pHwCtrl->pWhalParams, isEnabled); 476 477 WLAN_REPORT_DEBUG_CONTROL (pHwCtrl->hReport, 478 ("\n whal_hwCtrl_SetarpIpAddressesTable - ip filtering : %d.%d.%d.%d \n" , IP_addr->addr[0] , IP_addr->addr[1] , IP_addr->addr[2] , IP_addr->addr[3] )) ; 479 480 /* Set the new ip with the current state (e/d) */ 481 return whal_hwInfoElemarpIpAddressesTableSet (pHwCtrl->pHwMboxConfig, 482 IP_addr, 483 (UINT32)isEnabled); 484 } 485 486 /**************************************************************************** 487 * whalCtrl_GetArpIpAddressesTable() 488 **************************************************************************** 489 * DESCRIPTION: Sets the Group table according to the given configuration. 490 * 491 * OUTPUT: None 492 * 493 * RETURNS: OK or NOK 494 ****************************************************************************/ 495 int whalCtrl_GetArpIpAddressesTable (HwCtrl_T *pHwCtrl, IpAddress_t *IP_addr, UINT8* pisEnabled , IPver_e* pIP_ver) 496 { 497 if ( NULL == pHwCtrl ) 498 { 499 WLAN_REPORT_ERROR(pHwCtrl->hReport, HAL_HW_CTRL_MODULE_LOG, 500 ("whalCtrl_GetArpIpAddressesTable = pHwCtrl NULL !!!\n")); 501 502 return PARAM_VALUE_NOT_VALID ; 503 } 504 505 if ( NULL == pHwCtrl->pWhalParams ) 506 { 507 WLAN_REPORT_ERROR(pHwCtrl->hReport, HAL_HW_CTRL_MODULE_LOG, 508 ("whalCtrl_GetArpIpAddressesTable = pHwCtrl->pWhalParams NULL !!!\n")); 509 510 return PARAM_VALUE_NOT_VALID ; 511 512 } 513 514 whal_ParamsGetarpIpAddressesTable(pHwCtrl->pWhalParams, IP_addr, pIP_ver); 515 whal_ParamsGetarpIpFilterEnabled(pHwCtrl->pWhalParams, pisEnabled); 516 return OK; 517 } 518 519 /**************************************************************************** 520 * whal_hwCtrl_SetarpIpFilterEnabled() 521 **************************************************************************** 522 * DESCRIPTION: Enable\Disable the ARP filter 523 * 524 * OUTPUT: None 525 * 526 * RETURNS: OK or NOK 527 ****************************************************************************/ 528 int whal_hwCtrl_SetarpIpFilterEnabled(HwCtrl_T *pHwCtrl, UINT8 isEnabled ) 529 { 530 IpAddress_t *IP_addr = &(pHwCtrl->pWhalParams->WlanParams.arp_IP_addr) ; 531 if ( NULL == pHwCtrl ) 532 { 533 WLAN_REPORT_ERROR(pHwCtrl->hReport, HAL_HW_CTRL_MODULE_LOG, 534 ("whal_hwCtrl_SetarpIpFilterEnabled = pHwCtrl NULL !!!\n")); 535 536 return PARAM_VALUE_NOT_VALID ; 537 } 538 539 /* set the current ip address with the new state (e/d) */ 540 whal_ParamsSetarpIpFilterEnabled(pHwCtrl->pWhalParams, isEnabled); 541 return whal_hwInfoElemarpIpAddressesTableSet (pHwCtrl->pHwMboxConfig, 542 IP_addr, 543 (UINT32)isEnabled); 544 } 545 546 /**************************************************************************** 547 * whal_hwCtrl_SetGroupAddressesTable() 548 **************************************************************************** 549 * DESCRIPTION: Sets the Group table according to the given configuration. 550 * 551 * OUTPUT: None 552 * 553 * RETURNS: OK or NOK 554 ****************************************************************************/ 555 int whal_hwCtrl_SetGroupAddressesTable (HwCtrl_T *pHwCtrl, 556 UINT8 numGroupAddrs, 557 macAddress_t *Group_addr, 558 UINT8 isEnabled) 559 { 560 if ( NULL == pHwCtrl ) 561 { 562 return PARAM_VALUE_NOT_VALID; 563 } 564 565 if ( NULL == Group_addr) 566 { 567 WLAN_REPORT_ERROR(pHwCtrl->hReport, HAL_HW_CTRL_MODULE_LOG, 568 ("whal_hwCtrl_SetGroupAddressesTable: numGroupAddrs=%d Group_addr=0x%x !!!\n", numGroupAddrs , Group_addr)); 569 return PARAM_VALUE_NOT_VALID; 570 } 571 572 /* Keeps the parameters in the whal */ 573 whal_ParamsSetGroupAddressesTable(pHwCtrl->pWhalParams, isEnabled, numGroupAddrs, Group_addr); 574 575 /* Keeps the parameters in the whal for recovery */ 576 return whal_hwInfoElemGroupAdressesTableSet (pHwCtrl->pHwMboxConfig, 577 &numGroupAddrs, 578 Group_addr, 579 &isEnabled); 580 } 581 582 /**************************************************************************** 583 * whal_hwCtrl_SetRtsThreshold() 584 **************************************************************************** 585 * DESCRIPTION: Sets the Rts Threshold. 586 * 587 * OUTPUT: None 588 * 589 * RETURNS: OK or NOK pWlanParams->RtsThreshold 590 ****************************************************************************/ 591 int whal_hwCtrl_SetRtsThreshold (HwCtrl_T *pHwCtrl,UINT16 RtsThreshold) 592 { 593 return whal_hwInfoElemRtsThresholdSet (pHwCtrl->pHwMboxConfig, RtsThreshold); 594 } 595 596 /**************************************************************************** 597 * whal_hwCtrl_ConfigCb() 598 **************************************************************************** 599 * DESCRIPTION: Config the object 600 * 601 * INPUTS: 602 * 603 * OUTPUT: None 604 * 605 * RETURNS: OK or NOK 606 ****************************************************************************/ 607 static void whal_hwCtrl_ConfigCb (TI_HANDLE hHwCtrl, TI_STATUS status) 608 { 609 HwCtrl_T *pHwCtrl = (HwCtrl_T*)hHwCtrl; 610 WHAL_CTRL *pWhalCtrl = (WHAL_CTRL *)pHwCtrl->hWhalCtrl; 611 612 whal_hwMboxCmd_Config(pHwCtrl->pHwMboxCmd, ((TnetwDrv_t*)pWhalCtrl->hTNETW_Driver)->hCmdQueue, pHwCtrl->hReport); 613 CmdQueue_Config(((TnetwDrv_t*)pWhalCtrl->hTNETW_Driver)->hCmdQueue, 614 ((TnetwDrv_t*)pWhalCtrl->hTNETW_Driver)->hCmdMBox, pHwCtrl->hReport); 615 whal_hwMboxCmdBit_Config(pHwCtrl->hWhalCtrl, pHwCtrl->pHwMboxCmdBit, ((TnetwDrv_t*)pWhalCtrl->hTNETW_Driver)->hCmdQueue, pHwCtrl->hReport); 616 whal_hwMboxConfig_Config(pHwCtrl->pHwMboxConfig, ((TnetwDrv_t*)pWhalCtrl->hTNETW_Driver)->hCmdQueue, pHwCtrl->hReport); 617 618 /* This will initiate the download to the FW */ 619 status = whal_hwCtrl_Initiate (pHwCtrl); 620 if (status == TNETWIF_ERROR) 621 { 622 WLAN_REPORT_ERROR (pHwCtrl->hReport, HAL_HW_CTRL_MODULE_LOG, 623 ("whal_hwCtrl_Config: failed to initialize\n")); 624 } 625 } 626 627 /**************************************************************************** 628 * whal_hwCtrl_GetGroupAddressesTable() 629 **************************************************************************** 630 * DESCRIPTION: Sets the Group table according to the given configuration. 631 * 632 * OUTPUT: None 633 * 634 * RETURNS: OK or NOK 635 ****************************************************************************/ 636 int whal_hwCtrl_GetGroupAddressesTable (HwCtrl_T *pHwCtrl, 637 UINT8* pisEnabled, UINT8* pnumGroupAddrs, macAddress_t *Group_addr) 638 { 639 if ( NULL == pHwCtrl ) 640 { 641 return PARAM_VALUE_NOT_VALID; 642 } 643 644 if ( (NULL == pisEnabled) || (NULL == pnumGroupAddrs) || (NULL == Group_addr)) 645 { 646 WLAN_REPORT_ERROR(pHwCtrl->hReport, HAL_HW_CTRL_MODULE_LOG, 647 ("whal_hwCtrl_GetGroupAddressesTable: pisEnabled=0x%p pnumGroupAddrs=0x%p Group_addr=0x%p !!!\n", pisEnabled , pnumGroupAddrs, Group_addr)); 648 return PARAM_VALUE_NOT_VALID; 649 } 650 651 whal_ParamsGetGroupAddressesTable(pHwCtrl->pWhalParams, pisEnabled, pnumGroupAddrs, Group_addr); 652 return OK; 653 } 654 655 656 /**************************************************************************** 657 * whal_hwCtrl_Config() 658 **************************************************************************** 659 * DESCRIPTION: Config the object 660 * 661 * INPUTS: 662 * 663 * OUTPUT: None 664 * 665 * RETURNS: OK or NOK 666 ****************************************************************************/ 667 TI_STATUS whal_hwCtrl_Config 668 ( 669 HwCtrl_T *pHwCtrl, 670 TI_HANDLE hWhalCtrl, 671 UINT8 AccessMode, 672 UINT32 AcxRegAddr, 673 UINT32 AcxMemAddr, 674 TI_HANDLE hReport, 675 TI_HANDLE hMemMgr, 676 UINT32 *pFWImage, 677 TI_HANDLE hEventMbox 678 ) 679 { 680 pHwCtrl->hReport = hReport; 681 pHwCtrl->hWhalCtrl = hWhalCtrl; 682 pHwCtrl->hEventMbox = hEventMbox; 683 684 /* 685 * NOTE: Save firmware image parameters before the 1st TNETWIF call. 686 * These parameters are passed from the user application and 687 * may be lost in a case TNETWIF call is asynchronous. 688 */ 689 pHwCtrl->uFwBuf = pFWImage[0]; 690 pHwCtrl->uFwAddr = pFWImage[1]; 691 pHwCtrl->uEEEPROMBuf = pFWImage[2]; 692 pHwCtrl->uEEEPROMLen = pFWImage[3]; 693 694 return whalBus_Config (pHwCtrl->hWhalBus, 695 hWhalCtrl, 696 AccessMode, 697 AcxRegAddr, 698 AcxMemAddr, 699 hReport, 700 hMemMgr, 701 whal_hwCtrl_ConfigCb, 702 pHwCtrl); 703 } 704 705 706 /**************************************************************************** 707 * whal_hwCtrl_FinalizeDownloadCb2() 708 **************************************************************************** 709 * DESCRIPTION: Finalize all the remaining initialization after the download has finished 710 * 711 * INPUTS: 712 * 713 * OUTPUT: None 714 * 715 * RETURNS: OK or NOK 716 ****************************************************************************/ 717 static void whal_hwCtrl_FinalizeDownloadCb2 (TI_HANDLE hHwCtrl, TI_STATUS status, void *pData) 718 { 719 HwCtrl_T *pHwCtrl = (HwCtrl_T *)hHwCtrl; 720 whalCtrl_antennaDiversityOptions_t antennaDiversityOptions; 721 722 /* Print firmware version */ 723 whal_ParamsPrintFwVersion (pHwCtrl->pWhalParams); 724 725 /* 726 * Configure antenna diversity parameters, same for both radio types. 727 * (the only difference between DCR and WBR is the antennas number, which is 728 * hard-coded in the mbox config function per radio type 729 */ 730 antennaDiversityOptions.enableRxDiversity = FALSE; 731 antennaDiversityOptions.rxSelectedAntenna = DIVS_RX_START_ANT2; 732 antennaDiversityOptions.enableTxDiversity = FALSE; 733 antennaDiversityOptions.txSelectedAntenna = DIVS_TX_START_ANT2; 734 antennaDiversityOptions.rxTxSharedAnts = TRUE; 735 whal_hwCtrl_SaveAntennaDiversityOptions (pHwCtrl, &antennaDiversityOptions); 736 737 whalCtrl_FinalizeDownload (pHwCtrl->hWhalCtrl); 738 } 739 740 741 /**************************************************************************** 742 * whal_hwCtrl_FinalizeDownloadCb1() 743 **************************************************************************** 744 * DESCRIPTION: Finalize all the remaining initialization after the download has finished 745 * 746 * INPUTS: 747 * 748 * OUTPUT: None 749 * 750 * RETURNS: OK or NOK 751 ****************************************************************************/ 752 static void whal_hwCtrl_FinalizeDownloadCb1 (TI_HANDLE hHwCtrl, TI_STATUS status, void *pData) 753 { 754 HwCtrl_T *pHwCtrl = (HwCtrl_T *)hHwCtrl; 755 ACXRevision_t *pACXRevision = whal_ParamsGetAcxVersion (pHwCtrl->pWhalParams); 756 UINT8 *pStationId = ((dot11StationIDStruct*)pData)->dot11StationID; 757 UINT32 i; 758 759 /* Swap bytes of the station id */ 760 for (i = 0; i < 3; i++) 761 { 762 UINT8 uTmp = pStationId[i]; 763 pStationId[i] = pStationId[5 - i]; 764 pStationId[5 - i] = uTmp; 765 } 766 767 whal_ParamsSetSrcMac (pHwCtrl->pWhalParams, (char*)pStationId); 768 769 /* Get firmware version */ 770 whal_hwInfoElemAcxRevisionGet (pHwCtrl->pHwMboxConfig, 771 (void *)whal_hwCtrl_FinalizeDownloadCb2, 772 hHwCtrl, 773 pACXRevision); 774 } 775 776 777 /**************************************************************************** 778 * whal_hwCtrl_FinalizeDownload() 779 **************************************************************************** 780 * DESCRIPTION: Finalize all the remaining initialization after the download has finished 781 * 782 * INPUTS: 783 * 784 * OUTPUT: None 785 * 786 * RETURNS: OK or NOK 787 ****************************************************************************/ 788 TI_STATUS whal_hwCtrl_FinalizeDownload (TI_HANDLE hHwCtrl, BootAttr_T *pBootAttr) 789 { 790 HwCtrl_T *pHwCtrl= (HwCtrl_T *)hHwCtrl; 791 792 /* 793 * Just comment it since we may need it in future version when we will read from the NVS the 794 * Configure options (for example power levels) 795 */ 796 WlanParams_T *pWlanParams = whal_ParamsGetWlanParams (pHwCtrl->pWhalParams); 797 798 /* Read NVS version */ 799 pWlanParams->radioType = pBootAttr->radioType; 800 pWlanParams->minorE2Ver = pBootAttr->minorE2Ver; 801 pWlanParams->majorE2Ver = pBootAttr->majorE2Ver; 802 pWlanParams->bugfixE2Ver = pBootAttr->bugfixE2Ver; 803 804 /* 805 * Read config options (WLAN hardware EEPROM). Must be before any configuration 806 * because the WLAN hardware put the data in the mbox after running the FW 807 * Not used by now but keep it in code since the data may be requested later on when the 808 * NVS data will be read from the driver and not from the INI: 809 * For example the number of power level 810 * whal_hwInfoElemConfigOptionsRead(pHwCtrl->pHwMboxConfig, pConfigOptions); 811 */ 812 if (whal_hwInfoElemStationIdGet (pHwCtrl->pHwMboxConfig, 813 (void *)whal_hwCtrl_FinalizeDownloadCb1, 814 hHwCtrl, 815 &pHwCtrl->mbox) != OK) 816 { 817 WLAN_REPORT_ERROR (pHwCtrl->hReport, HAL_HW_CTRL_MODULE_LOG, 818 ("whal_hwCtrl_Config: Error on whal_hwInfoElemStationIdGet\n")); 819 /* For driver debug only, don't return error */ 820 /* return NOK; */ 821 } 822 823 return OK; 824 } 825 826 827 /**************************************************************************** 828 * whal_hwCtrl_FinalizeOnFailure() 829 **************************************************************************** 830 * DESCRIPTION: Finalize all the initialization upon failure 831 * 832 * INPUTS: 833 * 834 * OUTPUT: None 835 * 836 * RETURNS: OK or NOK 837 ****************************************************************************/ 838 TI_STATUS whal_hwCtrl_FinalizeOnFailure (TI_HANDLE hHwCtrl) 839 { 840 HwCtrl_T *pHwCtrl= (HwCtrl_T *)hHwCtrl; 841 842 return whalCtrl_FinalizeOnFailure (pHwCtrl->hWhalCtrl); 843 } 844 845 846 847 848 849 typedef int (*fcallback_t) (TI_HANDLE, TI_STATUS); 850 851 852 /**************************************************************************** 853 * whal_hwCtrl_ConfigHwCb2() 854 **************************************************************************** 855 * DESCRIPTION: Configure the WLAN hardware 856 * 857 * INPUTS: None 858 * 859 * OUTPUT: None 860 * 861 * RETURNS: OK or NOK 862 ****************************************************************************/ 863 static int whal_hwCtrl_ConfigHwCb2 (HwCtrl_T *pHwCtrl, TI_STATUS status, void *pData) 864 { 865 WlanParams_T *pWlanParams = whal_ParamsGetWlanParams (pHwCtrl->pWhalParams); 866 UINT8 *pSrcMacAddr = whal_ParamsGetSrcMac (pHwCtrl->pWhalParams); 867 UINT32 acID; 868 whalCtrl_powerMgmtConfig_t powerMgmtConfig; 869 870 /* Arrived from callback */ 871 if (pData) 872 { 873 ACXDataPathParamsResp_t *pCfg = &pHwCtrl->DataPathParams; 874 875 WLAN_REPORT_INIT (pHwCtrl->hReport, HAL_HW_CTRL_MODULE_LOG, 876 ("%s: rxPacketRingChunkSize = 0x%x,txPacketRingChunkSize = 0x%x,rxPacketRingAddr = 0x%x\n", 877 __FUNCTION__,pCfg->rxPacketRingChunkSize,pCfg->txPacketRingChunkSize,pCfg->rxPacketRingAddr)); 878 879 WLAN_REPORT_INIT (pHwCtrl->hReport, HAL_HW_CTRL_MODULE_LOG, 880 ("(cont')%s: txPacketRingAddr = 0x%x,rxControlAddr = 0x%x,txControlAddr = 0x%x,txCompleteAddr = 0x%x\n", 881 __FUNCTION__,pCfg->txPacketRingAddr,pCfg->rxControlAddr,pCfg->txControlAddr,pCfg->txCompleteAddr)); 882 883 pCfg->rxPacketRingChunkSize = ENDIAN_HANDLE_WORD(pCfg->rxPacketRingChunkSize); 884 pCfg->txPacketRingChunkSize = ENDIAN_HANDLE_WORD(pCfg->txPacketRingChunkSize); 885 pCfg->rxPacketRingAddr = ENDIAN_HANDLE_LONG(pCfg->rxPacketRingAddr); 886 pCfg->txPacketRingAddr = ENDIAN_HANDLE_LONG(pCfg->txPacketRingAddr); 887 pCfg->rxControlAddr = ENDIAN_HANDLE_LONG(pCfg->rxControlAddr); 888 pCfg->txControlAddr = ENDIAN_HANDLE_LONG(pCfg->txControlAddr); 889 pCfg->txCompleteAddr = ENDIAN_HANDLE_LONG(pCfg->txCompleteAddr); 890 } 891 892 /* Configure WEP maximum space */ 893 WLAN_REPORT_INIT (pHwCtrl->hReport, HAL_HW_CTRL_MODULE_LOG, ("whal_hwCtrl_Configure: WEP cache - none\n")); 894 895 #ifdef CORE_5_0 896 whal_hwInfoElemMemoryMapPrint (pHwCtrl->pHwMboxConfig); 897 #endif 898 899 /* Override WLAN hardware defaults */ 900 whal_hwInfoElemStationIdSet (pHwCtrl->pHwMboxConfig, pSrcMacAddr); 901 /* Configure the Rx Msdu Life Time (expiry time of de-fragmentation in FW) */ 902 whal_hwInfoElemRxMsduLifeTimeSet (pHwCtrl->pHwMboxConfig, pWlanParams->MaxRxMsduLifetime); 903 whal_hwInfoElemRxConfigSet (pHwCtrl->pHwMboxConfig, &pWlanParams->RxConfigOption, &pWlanParams->RxFilterOption); 904 905 #if 0 906 /* Use firmware default parameters for ant. which is ant 2 for both TX and RX */ 907 whal_hwCtrl_CurrentAntennaDiversitySendCmd (pHwCtrl); 908 #endif 909 910 for (acID = 0; acID < MAX_NUM_OF_AC; acID++) 911 { 912 whal_hwCtrl_QueueConf (pHwCtrl, &pWlanParams->acQueuesParams[acID]); 913 914 /* 915 * NOTE: Set following parameters only if they were configured. 916 * Otherwise, they contain garbage. 917 */ 918 919 if (pHwCtrl->pWhalParams->AcParams.isAcConfigured[acID]) 920 { 921 configureCmdCBParams_t configureCmdAc = {NULL,NULL,NULL}; 922 923 configureCmdAc.CB_buf = (UINT8*)&pHwCtrl->pWhalParams->AcParams.ac[acID]; 924 whal_hwCtrl_AcParamsConf (pHwCtrl, &configureCmdAc); 925 } 926 927 if (pHwCtrl->pWhalParams->QueuesParams.isQueueConfigured[acID]) 928 { 929 whal_hwCtrl_TrafficConf (pHwCtrl, &pHwCtrl->pWhalParams->QueuesParams.queues[acID]); 930 } 931 } 932 933 whal_hwCtrl_PacketDetectionThreshold (pHwCtrl, &pHwCtrl->pWhalParams->WlanParams.PacketDetectionThreshold); 934 whal_hwCtrl_SetSlotTime (pHwCtrl, (slotTime_e )pWlanParams->SlotTime); 935 whal_hwCtrl_SetarpIpAddressesTable (pHwCtrl, 936 &pWlanParams->arp_IP_addr, 937 pWlanParams->isArpIpFilteringEnabled, 938 IP_VER_4); 939 whal_hwCtrl_SetGroupAddressesTable (pHwCtrl, 940 pWlanParams->numGroupAddrs, 941 pWlanParams->Group_addr, 942 pWlanParams->isMacAddrFilteringnabled); 943 whal_hwInfoElemRxTimeOutSet (pHwCtrl->pHwMboxConfig, &pWlanParams->rxTimeOut); 944 whal_hwCtrl_SetRtsThreshold (pHwCtrl, pWlanParams->RtsThreshold); 945 946 /* Set The Beacon Filter in HAL */ 947 whal_hwCtrl_SetBeaconFiltering (pHwCtrl, 948 pWlanParams->beaconFilterParams.desiredState, 949 pWlanParams->beaconFilterParams.numOfElements); 950 whal_hwCtrl_SetBeaconFilterIETable (pHwCtrl, 951 &pWlanParams->beaconFilterIETable.numberOfIEs, 952 pWlanParams->beaconFilterIETable.IETable, 953 &pWlanParams->beaconFilterIETable.IETableSize); 954 955 /* Set SG Params only in Init Phase. */ 956 /* In recovery it will be handled in SoftGemini_hanfleRecovery() */ 957 if (pData) 958 { 959 WLAN_REPORT_INIT (pHwCtrl->hReport, HAL_HW_CTRL_MODULE_LOG, ("whal_hwCtrl_Configure: Setting the Soft Gemini state\n")); 960 961 /* Set the Soft Gemini state */ 962 if (pWlanParams->SoftGeminiEnable == SG_SENSE_ACTIVE) 963 { 964 whal_hwCtrl_SoftGeminiEnable (pHwCtrl, SG_SENSE_NO_ACTIVITY); 965 } 966 else 967 { 968 whal_hwCtrl_SoftGeminiEnable (pHwCtrl, pWlanParams->SoftGeminiEnable); 969 } 970 971 /* Set the Soft Gemini params */ 972 whal_hwCtrl_SetSoftGeminiParams (pHwCtrl, &pWlanParams->SoftGeminiParams); 973 } 974 975 /* For recovery decision */ 976 eventMbox_EvUnMask (pHwCtrl->hEventMbox, HAL_EVENT_HEALTH_REPORT); 977 whal_hwCtrl_OverridePhyRegsDefaults (pHwCtrl); 978 #ifdef TNETW1150 979 whal_hwCtrl_SetACIConfiguration (pHwCtrl, 980 pWlanParams->ACIMode, 981 pWlanParams->inputCCA, 982 pWlanParams->qualifiedCCA, 983 pWlanParams->stompForRx, 984 pWlanParams->stompForTx, 985 pWlanParams->txCCA); 986 #endif/*TNETW1150*/ 987 988 /* Beacon broadcast options */ 989 powerMgmtConfig.BcnBrcOptions = pWlanParams->BcnBrcOptions; 990 powerMgmtConfig.ConsecutivePsPollDeliveryFailureThreshold = pWlanParams->ConsecutivePsPollDeliveryFailureThreshold; 991 whal_hwCtrl_BcnBrcOptions (pHwCtrl, &powerMgmtConfig); 992 993 /* Enable rx/tx path on the hardware */ 994 if (whal_hwCtrl_EnableDataPath (pHwCtrl) != OK) 995 return NOK; 996 997 /* ACX for a work around for Wi-Fi test */ 998 whal_hwInfoElemWiFiWmmPSWASet (pHwCtrl->pHwMboxConfig, pWlanParams->WiFiWmmPS); 999 1000 /* Enable the scan complete interrupt source */ 1001 eventMbox_EvUnMask (pHwCtrl->hEventMbox, HAL_EVENT_SCAN_CMPLT); 1002 eventMbox_EvUnMask (pHwCtrl->hEventMbox, HAL_EVENT_SPS_SCAN_CMPLT); 1003 1004 /* Call the upper layer callback */ 1005 return (*((fcallback_t)pHwCtrl->fCb)) (pHwCtrl->hCb, OK); 1006 } 1007 1008 1009 /**************************************************************************** 1010 * whal_hwCtrl_ConfigHwCb1() 1011 **************************************************************************** 1012 * DESCRIPTION: Configure the WLAN hardware 1013 * 1014 * INPUTS: None 1015 * 1016 * OUTPUT: None 1017 * 1018 * RETURNS: OK or NOK 1019 ****************************************************************************/ 1020 static int whal_hwCtrl_ConfigHwCb1 (HwCtrl_T *pHwCtrl, TI_STATUS status, void *pData) 1021 { 1022 MemoryMap_t *pMemMap = &pHwCtrl->MemMap; 1023 DmaParams_T *pDmaParams = whal_ParamsGetDmaParams (pHwCtrl->pWhalParams); 1024 WlanParams_T *pWlanParams = whal_ParamsGetWlanParams (pHwCtrl->pWhalParams); 1025 1026 /* Arrived from callback */ 1027 if (pData) 1028 { 1029 UINT32 *pSwap, i; 1030 1031 /* Solve endian problem (all fields are 32 bit) */ 1032 pSwap = (UINT32* )&(pMemMap->codeStart); 1033 for (i = 0; i < MEM_MAP_NUM_FIELDS; i++) 1034 pSwap[i] = ENDIAN_HANDLE_LONG(pSwap[i]); 1035 } 1036 1037 /* Save number of TX blocks */ 1038 pDmaParams->NumTxBlocks = pMemMap->numTxMemBlks; 1039 1040 /* 1041 * Configure DataPath parameters to default 1042 * values and Read the Addresses of the FW data path buffers 1043 */ 1044 1045 /* Set Data path parameters to constant value to emulate the original double buffer*/ 1046 whal_hwInfoElemDataPathParamsSet (pHwCtrl->pHwMboxConfig, 1047 DP_RX_PACKET_RING_CHUNK_SIZE, 1048 DP_TX_PACKET_RING_CHUNK_SIZE, 1049 DP_RX_PACKET_RING_CHUNK_NUM, 1050 DP_TX_PACKET_RING_CHUNK_NUM, 1051 pWlanParams->TxCompleteThreshold, 1052 FW_TX_CMPLT_BLOCK_SIZE, 1053 DP_TX_COMPLETE_TIME_OUT); 1054 1055 /* Arrived from callback */ 1056 if (pData) 1057 { 1058 /* Get the double buffers and registers address values */ 1059 return whal_hwInfoElemDataPathParamsGet (pHwCtrl->pHwMboxConfig, 1060 &pHwCtrl->DataPathParams, 1061 (void *)whal_hwCtrl_ConfigHwCb2, 1062 pHwCtrl); 1063 } 1064 1065 /* Called directly */ 1066 else 1067 { 1068 return whal_hwCtrl_ConfigHwCb2 (pHwCtrl, OK, NULL); 1069 } 1070 } 1071 1072 1073 /**************************************************************************** 1074 * whal_hwCtrl_ConfigHw() 1075 **************************************************************************** 1076 * DESCRIPTION: Configure the WLAN hardware 1077 * 1078 * INPUTS: None 1079 * 1080 * OUTPUT: None 1081 * 1082 * RETURNS: OK or NOK 1083 ****************************************************************************/ 1084 int whal_hwCtrl_ConfigHw (HwCtrl_T *pHwCtrl, void *fCb, TI_HANDLE hCb, BOOL bRecovery) 1085 { 1086 MemoryMap_t *pMemMap = &pHwCtrl->MemMap; 1087 1088 /* 1089 * The addresses of the Double buffer, The Tx Path Status, 1090 * Rx Path Status, Tx Path Control, Rx Path Control 1091 */ 1092 /* ACXDataPathParamsResp_t *DataPathParam = &pHwCtrl->DataPathParams; */ 1093 1094 /* 1095 * The DmaParams_T is the same struct as the halTxRxQueueGlobalsParams_t struct 1096 * but is defined in the whalBus_Defs.h and not in the paramOut.h as done by BCIL 1097 */ 1098 DmaParams_T *pDmaParams = whal_ParamsGetDmaParams (pHwCtrl->pWhalParams); 1099 1100 pHwCtrl->fCb = fCb; 1101 pHwCtrl->hCb = hCb; 1102 1103 /* Configure the WLAN hardware memory (WEP, Templates, Queue, Buffers) */ 1104 1105 /* Configure packet templates */ 1106 WLAN_REPORT_INIT (pHwCtrl->hReport, HAL_HW_CTRL_MODULE_LOG, ("whal_hwCtrl_Configure: templates \n")); 1107 whal_hwCtrl_ConfigTemplates (pHwCtrl); 1108 1109 /* Configure RX/TX queues */ 1110 WLAN_REPORT_INIT (pHwCtrl->hReport, HAL_HW_CTRL_MODULE_LOG, ("whal_hwCtrl_Configure: queues\n")); 1111 1112 /* Configure the weight among the different hardware queues */ 1113 whal_hwInfoElemConfigMemorySet (pHwCtrl->pHwMboxConfig, pDmaParams); 1114 1115 /* Extract total number of blocks in the pool */ 1116 if (bRecovery) 1117 return whal_hwCtrl_ConfigHwCb1 (pHwCtrl, OK, NULL); 1118 else 1119 return whal_hwInfoElemMemoryMapGet (pHwCtrl->pHwMboxConfig, 1120 pMemMap, 1121 (void *)whal_hwCtrl_ConfigHwCb1, 1122 pHwCtrl); 1123 } 1124 1125 1126 #ifdef TNETW1150 1127 /**************************************************************************** 1128 * whal_hwCtrl_SetACIConfiguration() 1129 **************************************************************************** 1130 * DESCRIPTION: Set the hardware ACI configuration 1131 * 1132 * INPUTS: None 1133 * 1134 * OUTPUT: None 1135 * 1136 * RETURNS: OK or NOK 1137 ****************************************************************************/ 1138 int whal_hwCtrl_SetACIConfiguration (HwCtrl_T *pHwCtrl, UINT8 ACIMode, 1139 UINT8 inputCCA, UINT8 qualifiedCCA, 1140 UINT8 stompForRx, UINT8 stompForTx, 1141 UINT8 txCCA) 1142 { 1143 return (whal_hwInfoElemACIConfigurationSet (pHwCtrl->pHwMboxConfig, ACIMode, 1144 inputCCA, qualifiedCCA, stompForRx, 1145 stompForTx, txCCA)); 1146 } 1147 #endif/*TNETW1150*/ 1148 1149 /**************************************************************************** 1150 * whal_hwCtrl_SetMacAddress() 1151 **************************************************************************** 1152 * DESCRIPTION: 1153 * 1154 * INPUTS: None 1155 * 1156 * OUTPUT: None 1157 * 1158 * RETURNS: OK or NOK 1159 ****************************************************************************/ 1160 int whal_hwCtrl_SetMacAddress(HwCtrl_T *pHwCtrl, macAddress_t *macAddr) 1161 { 1162 whal_ParamsSetSrcMac(pHwCtrl->pWhalParams, (char*)macAddr->addr); 1163 1164 return whal_hwInfoElemStationIdSet (pHwCtrl->pHwMboxConfig, (UINT8*)macAddr->addr); 1165 } 1166 1167 1168 /**************************************************************************** 1169 * whal_hwCtrl_ConfigTemplates() 1170 **************************************************************************** 1171 * DESCRIPTION: Configure the packet templates 1172 * 1173 * AP - beacon, probe response, tim 1174 * STA (INFRA) - probe request 1175 * STA (IBSS) - beacon, probe response, probe request 1176 * know yet the bss type 1177 * 1178 * INPUTS: 1179 * 1180 * OUTPUT: None 1181 * 1182 * RETURNS: OK or NOK 1183 ****************************************************************************/ 1184 int whal_hwCtrl_ConfigTemplates(HwCtrl_T *pHwCtrl) 1185 { 1186 UINT8 PartialVirtualBmap[DOT11_PARTIAL_VIRTUAL_BITMAP_MAX]; 1187 UINT8 BmapControl; 1188 WlanParams_T *pWlanParams = whal_ParamsGetWlanParams(pHwCtrl->pWhalParams); 1189 1190 /* 1191 * Probe request template 1192 */ 1193 whal_hwMboxCmd_ConfigureTemplateFrame(pHwCtrl->pHwMboxCmd, NULL, pWlanParams->probeRequestTemplateSize, 1194 CMD_PROBE_REQ,NULL,NULL); 1195 1196 /* 1197 * Null Data template 1198 */ 1199 whal_hwMboxCmd_ConfigureTemplateFrame(pHwCtrl->pHwMboxCmd, NULL, pWlanParams->nullTemplateSize, 1200 CMD_NULL_DATA,NULL,NULL); 1201 1202 /* 1203 * Ps Poll template 1204 */ 1205 whal_hwMboxCmd_ConfigureTemplateFrame(pHwCtrl->pHwMboxCmd, NULL, pWlanParams->PsPollTemplateSize, 1206 CMD_PS_POLL,NULL,NULL); 1207 1208 /* 1209 * Qos Null Data template 1210 */ 1211 whal_hwMboxCmd_ConfigureTemplateFrame(pHwCtrl->pHwMboxCmd, NULL, pWlanParams->qosNullDataTemplateSize, 1212 CMD_QOS_NULL_DATA,NULL,NULL); 1213 1214 /* 1215 * Probe response template 1216 */ 1217 whal_hwMboxCmd_ConfigureTemplateFrame(pHwCtrl->pHwMboxCmd, NULL, pWlanParams->probeResponseTemplateSize, 1218 CMD_PROBE_RESP,NULL,NULL); 1219 /* 1220 * Beacon template 1221 */ 1222 whal_hwMboxCmd_ConfigureTemplateFrame(pHwCtrl->pHwMboxCmd, NULL, pWlanParams->beaconTemplateSize, 1223 CMD_BEACON,NULL,NULL); 1224 1225 /* 1226 * Tim template, first reserve space (len=MAX), second init to empty 1227 */ 1228 BmapControl = 0; 1229 os_memoryZero(pHwCtrl->hOs, (void*)PartialVirtualBmap, DOT11_PARTIAL_VIRTUAL_BITMAP_MAX); 1230 whal_hwMboxCmd_TimTemplate(pHwCtrl->pHwMboxCmd, BmapControl, (char*)PartialVirtualBmap, DOT11_PARTIAL_VIRTUAL_BITMAP_MAX); 1231 whal_hwMboxCmd_TimTemplate(pHwCtrl->pHwMboxCmd, BmapControl, (char*)PartialVirtualBmap, 1); 1232 1233 return OK; 1234 } 1235 1236 1237 /**************************************************************************** 1238 * whal_hwCtrl_SetSlotTime() 1239 **************************************************************************** 1240 * DESCRIPTION: Set the Slot field in ACM_IFS_CFG1 hardware register 1241 * 1242 * INPUTS: 1243 * SlotTimeVal The Short SlotTime bit value in the Capabilities 1244 * 1245 * OUTPUT: None 1246 * 1247 * RETURNS: None 1248 ****************************************************************************/ 1249 int whal_hwCtrl_SetSlotTime(HwCtrl_T *pHwCtrl, slotTime_e SlotTimeVal) 1250 { 1251 UINT8 slotTime; 1252 1253 WLAN_REPORT_DEBUG_CONTROL(pHwCtrl->hReport,(" whal_hwCtrl_SetSlotTime: SlotTimeVal = 0x%x\n",SlotTimeVal)); 1254 1255 if (SlotTimeVal == SLOT_TIME_LONG) 1256 slotTime = (UINT8) SLOT_TIME_LONG; 1257 else 1258 slotTime = (UINT8) SLOT_TIME_SHORT; 1259 1260 return whal_hwInfoElemSlotTimeSet (pHwCtrl->pHwMboxConfig, &slotTime); 1261 1262 } 1263 1264 1265 /**************************************************************************** 1266 * whal_hwCtrl_SetPreamble() 1267 **************************************************************************** 1268 * DESCRIPTION: Set the preamble in ?????? hardware register 1269 * 1270 * INPUTS: 1271 * preambleVal 1272 * 1273 * OUTPUT: None 1274 * 1275 * RETURNS: None 1276 ****************************************************************************/ 1277 int whal_hwCtrl_SetPreamble(HwCtrl_T *pHwCtrl, Preamble_e preambleVal) 1278 { 1279 UINT8 preamble; 1280 1281 preamble = (UINT8)preambleVal; 1282 1283 return whal_hwInfoElemPreambleSet (pHwCtrl->pHwMboxConfig, &preamble); 1284 } 1285 1286 /**************************************************************************** 1287 * whal_hwCtrl_SetFrameRate() 1288 **************************************************************************** 1289 * DESCRIPTION: Set the Frame Rate to HW 1290 * 1291 * INPUTS: 1292 * Rate_e txCtrlFrmRate; 1293 * Mod_e txCtrlFrmMod; 1294 * Rate_e txMgmtFrmRate; 1295 * Mod_e txMgmtFrmMod; 1296 * 1297 * OUTPUT: None 1298 * 1299 * RETURNS: None 1300 ****************************************************************************/ 1301 int whal_hwCtrl_SetFrameRate (HwCtrl_T *pHwCtrl, 1302 UINT8 txCtrlFrmRateVal, 1303 UINT8 txCtrlFrmModVal, 1304 UINT8 txMgmtFrmRateVal, 1305 UINT8 txMgmtFrmModVal) 1306 { 1307 UINT8 txCtrlFrmRate; 1308 UINT8 txCtrlFrmMod; 1309 UINT8 txMgmtFrmRate; 1310 UINT8 txMgmtFrmMod; 1311 1312 txCtrlFrmRate = txCtrlFrmRateVal; 1313 txCtrlFrmMod = txCtrlFrmModVal; 1314 txMgmtFrmRate = txMgmtFrmRateVal; 1315 txMgmtFrmMod = txMgmtFrmModVal; 1316 1317 1318 return whal_hwInfoElemGeneratedFrameRateSet (pHwCtrl->pHwMboxConfig, 1319 &txCtrlFrmRate, 1320 &txCtrlFrmMod, 1321 &txMgmtFrmRate, 1322 &txMgmtFrmMod); 1323 1324 } 1325 1326 /**************************************************************************** 1327 * whal_hwCtrl_PMConfig() 1328 **************************************************************************** 1329 * DESCRIPTION: Configure the wlan hardware 1330 * 1331 * INPUTS: None 1332 * 1333 * OUTPUT: None 1334 * 1335 * RETURNS: OK or NOK 1336 ****************************************************************************/ 1337 int whal_hwCtrl_PMConfig(HwCtrl_T *pHwCtrl, whalCtrl_powerMgmtConfig_t *pPMConfig) 1338 { 1339 1340 ACXConfigPM_t AcxElm_PMConfig; 1341 ACXConfigPM_t *pCfg = &AcxElm_PMConfig; 1342 1343 1344 pCfg->BBWakeUpTime = pPMConfig->BBWakeUpTime; 1345 1346 pCfg->ELPEnable = pPMConfig->ELPEnable; 1347 1348 pCfg->PLLlockTime = pPMConfig->PLLlockTime; 1349 1350 WLAN_REPORT_INFORMATION(pHwCtrl->hReport, 1351 HAL_HW_CTRL_MODULE_LOG, 1352 (" whal_hwCtrl_PMConfig BBWakeUpTime=%d ELPEnable=%d PLLlockTime=%d WakeOnGPIOenable=0x%x\n" 1353 ,pCfg->BBWakeUpTime,pCfg->ELPEnable,pCfg->PLLlockTime,pCfg->WakeOnGPIOenable)); 1354 1355 /* 1356 * Set the desired features 1357 */ 1358 return whal_hwInfoElemAcxPMConfigSet (pHwCtrl->pHwMboxConfig, pCfg); 1359 } 1360 1361 /**************************************************************************** 1362 * whal_hwCtrl_BcnBrcOptions() 1363 **************************************************************************** 1364 * DESCRIPTION: Configure the wlan hardware 1365 * 1366 * INPUTS: None 1367 * 1368 * OUTPUT: None 1369 * 1370 * RETURNS: OK or NOK 1371 ****************************************************************************/ 1372 int whal_hwCtrl_BcnBrcOptions(HwCtrl_T *pHwCtrl, whalCtrl_powerMgmtConfig_t *pPMConfig) 1373 { 1374 ACXBeaconAndBroadcastOptions_t AcxElm_BcnBrcOptions; 1375 ACXBeaconAndBroadcastOptions_t *pCfg = &AcxElm_BcnBrcOptions; 1376 1377 1378 pCfg->beaconRxTimeOut = pPMConfig->BcnBrcOptions.BeaconRxTimeout; 1379 1380 pCfg->broadcastTimeOut = pPMConfig->BcnBrcOptions.BroadcastRxTimeout; 1381 1382 pCfg->rxBroadcastInPS = pPMConfig->BcnBrcOptions.RxBroadcastInPs; 1383 1384 pCfg->consecutivePsPollDeliveryFailureThr = pPMConfig->ConsecutivePsPollDeliveryFailureThreshold; 1385 1386 WLAN_REPORT_INFORMATION(pHwCtrl->hReport, 1387 HAL_HW_CTRL_MODULE_LOG, 1388 (" whal_hwCtrl_BcnBrcOptions BeaconRxTimeout=%d BroadcastRxTimeout=%d RxBroadcastInPs=0x%x ConsecutivePsPoll = %d\n" 1389 ,pCfg->beaconRxTimeOut,pCfg->broadcastTimeOut,pCfg->rxBroadcastInPS,pCfg->consecutivePsPollDeliveryFailureThr)); 1390 /* 1391 * Set the desired features 1392 */ 1393 return whal_hwInfoElemAcxBcnBrcOptionsSet (pHwCtrl->pHwMboxConfig, pCfg); 1394 } 1395 1396 /**************************************************************************** 1397 * whal_hwCtrl_wakeUpCondition() 1398 **************************************************************************** 1399 * DESCRIPTION: Configure the wlan hardware 1400 * 1401 * INPUTS: None 1402 * 1403 * OUTPUT: None 1404 * 1405 * RETURNS: OK or NOK 1406 ****************************************************************************/ 1407 int whal_hwCtrl_wakeUpCondition(HwCtrl_T *pHwCtrl, whalCtrl_powerMgmtConfig_t *pPMConfig) 1408 { 1409 WakeUpCondition_t AcxElm_WakeUpCondition; 1410 WakeUpCondition_t *pCfg = &AcxElm_WakeUpCondition; 1411 1412 1413 switch (pPMConfig->tnetWakeupOn) 1414 { 1415 case TNET_WAKE_ON_BEACON: 1416 pCfg->wakeUpConditionBitmap = WAKE_UP_EVENT_BEACON_BITMAP; 1417 break; 1418 case TNET_WAKE_ON_DTIM: 1419 pCfg->wakeUpConditionBitmap = WAKE_UP_EVENT_DTIM_BITMAP; 1420 break; 1421 case TNET_WAKE_ON_N_BEACON: 1422 pCfg->wakeUpConditionBitmap = WAKE_UP_EVENT_N_BEACONS_BITMAP; 1423 break; 1424 case TNET_WAKE_ON_N_DTIM: 1425 pCfg->wakeUpConditionBitmap = WAKE_UP_EVENT_N_DTIM_BITMAP; 1426 break; 1427 default: 1428 pCfg->wakeUpConditionBitmap = WAKE_UP_EVENT_BEACON_BITMAP; 1429 break; 1430 } 1431 1432 pCfg->listenInterval = pPMConfig->listenInterval; 1433 1434 WLAN_REPORT_INFORMATION(pHwCtrl->hReport, 1435 HAL_HW_CTRL_MODULE_LOG, 1436 (" whal_hwCtrl_wakeUpCondition tnetWakeupOn=0x%x listenInterval=%d\n",pCfg->wakeUpConditionBitmap,pCfg->listenInterval)); 1437 /* 1438 * Set the desired features 1439 */ 1440 return whal_hwInfoElemAcxwakeUpConditionSet (pHwCtrl->pHwMboxConfig, pCfg); 1441 } 1442 1443 /**************************************************************************** 1444 * whal_hwCtrl_PowerMgmtConfigurationSet () 1445 **************************************************************************** 1446 * DESCRIPTION: Set the ACX power management option IE 1447 * 1448 * INPUTS: whalHwCtrl_powerMgmtOptionsConfig 1449 * 1450 * OUTPUT: 1451 * 1452 * RETURNS: OK or NOK 1453 ****************************************************************************/ 1454 int whal_hwCtrl_PowerMgmtConfigurationSet (HwCtrl_T *pHwCtrl, 1455 whalCtrl_powerSaveParams_t* powerSaveParams) 1456 1457 /*whalCtrl_powerMgmtConfig_t *thePowerMgmtOptionsConfig)*/ 1458 { 1459 whalCtrl_powerSaveParams_t AcxElm_PowerMgmtConfiguration; 1460 whalCtrl_powerSaveParams_t *pCfg = &AcxElm_PowerMgmtConfiguration; 1461 1462 1463 pCfg->ps802_11Enable = powerSaveParams->ps802_11Enable; 1464 pCfg->hangOverPeriod = powerSaveParams->hangOverPeriod; 1465 pCfg->needToSendNullData = powerSaveParams->needToSendNullData; 1466 pCfg->numNullPktRetries = powerSaveParams->numNullPktRetries; 1467 pCfg->powerSaveCBObject = powerSaveParams->powerSaveCBObject; 1468 pCfg->powerSavecmdResponseCB = powerSaveParams->powerSavecmdResponseCB; 1469 /* Rate conversion is done in the HAL */ 1470 whalUtils_ConvertAppRatesBitmap(powerSaveParams->NullPktRateModulation, 0, &(pCfg->NullPktRateModulation)); 1471 1472 1473 WLAN_REPORT_INFORMATION(pHwCtrl->hReport, 1474 HAL_HW_CTRL_MODULE_LOG, 1475 (" whal_hwCtrl_PowerMgmtConfigurationSet ps802_11Enable=0x%x hangOverPeriod=%d needToSendNullData=0x%x numNullPktRetries=%d NullPktRateModulation=0x%x\n" 1476 ,pCfg->ps802_11Enable,pCfg->hangOverPeriod,pCfg->needToSendNullData,pCfg->numNullPktRetries,pCfg->NullPktRateModulation)); 1477 1478 return(whal_hwMboxCmd_PowerMgmtConfiguration (pHwCtrl->pHwMboxCmd,pCfg)); 1479 } 1480 1481 1482 /**************************************************************************** 1483 * whal_hwCtrl_MinPowerLevelSet () 1484 **************************************************************************** 1485 * DESCRIPTION: Set the min power level 1486 * 1487 * INPUTS: 1488 * 1489 * OUTPUT: 1490 * 1491 * RETURNS: OK or NOK 1492 ****************************************************************************/ 1493 int whal_hwCtrl_MinPowerLevelSet (HwCtrl_T *pHwCtrl, 1494 powerAutho_PowerPolicy_e minPowerLevel) 1495 { 1496 ACXSleepAuth_t AcxElm_SleepAuth; 1497 ACXSleepAuth_t *pCfg = &AcxElm_SleepAuth; 1498 1499 /* in the info element the enums are in reverse */ 1500 switch(minPowerLevel) 1501 { 1502 case POWERAUTHO_POLICY_ELP: 1503 pCfg->sleepAuth = 2; 1504 break; 1505 case POWERAUTHO_POLICY_AWAKE: 1506 pCfg->sleepAuth = 0; 1507 break; 1508 default: 1509 pCfg->sleepAuth = minPowerLevel; 1510 } 1511 1512 WLAN_REPORT_INFORMATION(pHwCtrl->hReport, 1513 HAL_HW_CTRL_MODULE_LOG, 1514 (" whal_hwCtrl_MinPowerLevelSet sleepAuth=%d\n", 1515 minPowerLevel)); 1516 1517 /* 1518 * Set the desired min power level 1519 */ 1520 return whal_hwInfoElemAcxSleepAuthoSet (pHwCtrl->pHwMboxConfig, pCfg); 1521 } 1522 1523 1524 /**************************************************************************** 1525 * whal_hwCtrl_PowerMgmtOptionsPrint () 1526 **************************************************************************** 1527 * DESCRIPTION: Print the ACX power management option 1528 * 1529 * INPUTS: 1530 * 1531 * OUTPUT: 1532 * 1533 * RETURNS: OK or NOK 1534 ****************************************************************************/ 1535 int whal_hwCtrl_PowerMgmtOptionsPrint (HwCtrl_T *pHwCtrl) 1536 { 1537 int Stt1, Stt2; 1538 1539 ACXBeaconAndBroadcastOptions_t AcxElm_BcnBrcOptions; 1540 ACXBeaconAndBroadcastOptions_t *pCfgBcnBrcOptions = &AcxElm_BcnBrcOptions; 1541 1542 ACXDtimPeriodCfg_t AcxElm_TbttAndDtim; 1543 ACXDtimPeriodCfg_t *pCfgTbttAndDtim = &AcxElm_TbttAndDtim; 1544 1545 Stt1 = whal_hwInfoElemAcxBcnBrcOptionsGet (pHwCtrl->pHwMboxConfig, pCfgBcnBrcOptions); 1546 1547 WLAN_REPORT_INFORMATION(pHwCtrl->hReport, HAL_HW_CTRL_MODULE_LOG, 1548 ("BeaconRxTimeout=0x%X\n", pCfgBcnBrcOptions->beaconRxTimeOut)); 1549 1550 WLAN_REPORT_INFORMATION(pHwCtrl->hReport, HAL_HW_CTRL_MODULE_LOG, 1551 ("BroadcastRxTimeout=0x%X\n", pCfgBcnBrcOptions->broadcastTimeOut)); 1552 1553 WLAN_REPORT_INFORMATION(pHwCtrl->hReport, HAL_HW_CTRL_MODULE_LOG, 1554 ("RxBroadcastInPs=0x%X\n", pCfgBcnBrcOptions->rxBroadcastInPS)); 1555 1556 1557 Stt2 = whal_hwInfoElemDtimPeriodGet (pHwCtrl->pHwMboxConfig, 1558 &(pCfgTbttAndDtim->dtimInterval), 1559 &(pCfgTbttAndDtim->tbtt)); 1560 1561 WLAN_REPORT_INFORMATION(pHwCtrl->hReport, HAL_HW_CTRL_MODULE_LOG, 1562 ("Time Between Beacon(TBTT)=NOT IMPLEMENTED\n")); 1563 1564 WLAN_REPORT_INFORMATION(pHwCtrl->hReport, HAL_HW_CTRL_MODULE_LOG, 1565 ("dtimPeriod=NOT IMPLEMENTED\n")); 1566 1567 if ((Stt1 == OK) && (Stt2 == OK)) 1568 return(OK); 1569 else 1570 return(NOK); 1571 } 1572 1573 /**************************************************************************** 1574 * whal_hwCtrl_SetFeatureOptions() 1575 **************************************************************************** 1576 * DESCRIPTION: Configure the wlan hardware 1577 * 1578 * INPUTS: None 1579 * 1580 * OUTPUT: None 1581 * 1582 * RETURNS: OK or NOK 1583 ****************************************************************************/ 1584 int whal_hwCtrl_SetEnergyDetection(HwCtrl_T *pHwCtrl, BOOL energyDetection) 1585 { 1586 WlanParams_T *pWlanParams = whal_ParamsGetWlanParams(pHwCtrl->pWhalParams); 1587 UINT16 ccaThreshold = 0xefff; 1588 1589 pWlanParams->RxEnergyDetection = energyDetection; 1590 1591 if (energyDetection) 1592 ccaThreshold = ACX_PHI_CCA_THRSH_ENABLE_ENERGY_D; /* enable energy detect */ 1593 else 1594 ccaThreshold = ACX_PHI_CCA_THRSH_DISABLE_ENERGY_D; /* disable energy detect */ 1595 1596 whal_hwInfoElemCcaThresholdSet (pHwCtrl->pHwMboxConfig, &ccaThreshold, pWlanParams->TxEnergyDetection); 1597 1598 return OK; 1599 } 1600 1601 1602 #if defined(TNETW1150) 1603 /**************************************************************************** 1604 * whal_hwCtrl_ArmClockSet() 1605 **************************************************************************** 1606 * DESCRIPTION: Configure the arm clock 1607 * !!! Note that the firmware will set the slot time according to the new clock 1608 * 1609 * INPUTS: None 1610 * 1611 * OUTPUT: None 1612 * 1613 * RETURNS: OK or NOK 1614 ****************************************************************************/ 1615 int whal_hwCtrl_ArmClockSet (HwCtrl_T *pHwCtrl, UINT32 ArmClock) 1616 { 1617 WlanParams_T *pWlanParams = &pHwCtrl->pWhalParams->WlanParams; 1618 1619 pWlanParams->ArmClock = ArmClock; 1620 1621 WLAN_REPORT_REPLY(pHwCtrl->hReport, HAL_HW_CTRL_MODULE_LOG, 1622 ("whal_hwCtrl_ArmClockSet: Arm=%d (Mac=%d)\n", pWlanParams->ArmClock, pWlanParams->MacClock)); 1623 1624 /* Illegal combination Mac=80, Arm=40 ==> force setting 40/40*/ 1625 if ((pWlanParams->MacClock == HW_CLOCK_80_MHZ) && (pWlanParams->ArmClock == HW_CLOCK_40_MHZ)) 1626 { 1627 WLAN_REPORT_ERROR(pHwCtrl->hReport, HAL_HW_CTRL_MODULE_LOG, 1628 ("whal_hwCtrl_ArmClockSet: ---------- Illegal combination Mac=80, Arm=40 ==> force setting 40/40\n")); 1629 pWlanParams->MacClock = HW_CLOCK_40_MHZ; 1630 } 1631 1632 return whal_hwInfoElemFeatureConfigSet (pHwCtrl->pHwMboxConfig, pWlanParams->FeatureOptions, pWlanParams->FeatureDataFlowOptions); 1633 } 1634 #endif 1635 1636 /**************************************************************************** 1637 * whal_hwCtrl_MacClockSet() 1638 **************************************************************************** 1639 * DESCRIPTION: Configure the mac clock 1640 * !!! Note that the firmware will set the slot time according to the new clock 1641 * 1642 * INPUTS: None 1643 * 1644 * OUTPUT: None 1645 * 1646 * RETURNS: OK or NOK 1647 ****************************************************************************/ 1648 int whal_hwCtrl_MacClockSet (HwCtrl_T *pHwCtrl, UINT32 MacClock) 1649 { 1650 WlanParams_T *pWlanParams = &pHwCtrl->pWhalParams->WlanParams; 1651 1652 pWlanParams->MacClock = MacClock; 1653 1654 /* force same clock - for printing */ 1655 pWlanParams->ArmClock = MacClock; 1656 WLAN_REPORT_REPLY(pHwCtrl->hReport, HAL_HW_CTRL_MODULE_LOG, 1657 ("whal_hwCtrl_MacClockSet: Mac=%d (Arm=%d)\n", pWlanParams->MacClock, pWlanParams->ArmClock)); 1658 1659 /* Illegal combination Mac=80, Arm=40 ==> force setting 40/40*/ 1660 if ((pWlanParams->MacClock == HW_CLOCK_80_MHZ) && (pWlanParams->ArmClock == HW_CLOCK_40_MHZ)) 1661 { 1662 WLAN_REPORT_ERROR(pHwCtrl->hReport, HAL_HW_CTRL_MODULE_LOG, 1663 ("whal_hwCtrl_MacClockSet: ---------- Illegal combination Mac=80, Arm=40 ==> force setting 40/40\n")); 1664 pWlanParams->MacClock = HW_CLOCK_40_MHZ; 1665 } 1666 1667 return whal_hwInfoElemFeatureConfigSet (pHwCtrl->pHwMboxConfig, pWlanParams->FeatureOptions, pWlanParams->FeatureDataFlowOptions); 1668 } 1669 1670 /**************************************************************************** 1671 * whal_hwCtrl_WepDefaultKeyAdd() 1672 **************************************************************************** 1673 * DESCRIPTION: Set the actual default key 1674 * 1675 * INPUTS: 1676 * 1677 * OUTPUT: 1678 * 1679 * RETURNS: OK or NOK 1680 ****************************************************************************/ 1681 int whal_hwCtrl_WepDefaultKeyAdd (HwCtrl_T *pHwCtrl, securityKeys_t* aSecurityKey, void *CB_Func, TI_HANDLE CB_handle) 1682 { 1683 int Stt; 1684 1685 char MacAddr_Dummy[6]; 1686 1687 Stt = whal_hwMboxCmd_SetKey(pHwCtrl->pHwMboxCmd, KEY_ADD_OR_REPLACE, 1688 (char*)MacAddr_Dummy, 1689 aSecurityKey->encLen, KEY_WEP_DEFAULT, 1690 aSecurityKey->keyIndex, 1691 (char*)aSecurityKey->encKey, 0, 0, 1692 CB_Func, CB_handle); 1693 1694 WLAN_REPORT_INFORMATION(pHwCtrl->hReport, HAL_HW_CTRL_MODULE_LOG, 1695 ("whal_hwCtrl_WepDefaultKeyAdd: ## len=%d, id=%d encKey[5 entries]=0x %x %x %x %x %x\n", 1696 aSecurityKey->encLen, 1697 aSecurityKey->keyIndex, 1698 aSecurityKey->encKey[0], aSecurityKey->encKey[1], aSecurityKey->encKey[2], aSecurityKey->encKey[3], aSecurityKey->encKey[4] )); 1699 1700 return Stt; 1701 } 1702 1703 /**************************************************************************** 1704 * whal_hwCtrl_WepDefaultKeyRemove() 1705 **************************************************************************** 1706 * DESCRIPTION: Set the actual default key 1707 * 1708 * INPUTS: 1709 * 1710 * OUTPUT: 1711 * 1712 * RETURNS: OK or NOK 1713 ****************************************************************************/ 1714 int whal_hwCtrl_WepDefaultKeyRemove (HwCtrl_T *pHwCtrl, securityKeys_t* aSecurityKey, void *CB_Func, TI_HANDLE CB_handle) 1715 { 1716 int Stt; 1717 1718 char MacAddr_Dummy[6]; 1719 1720 Stt = whal_hwMboxCmd_SetKey(pHwCtrl->pHwMboxCmd, KEY_REMOVE, 1721 (char*)MacAddr_Dummy, 1722 aSecurityKey->encLen, KEY_WEP_DEFAULT, 1723 aSecurityKey->keyIndex, 1724 (char*)aSecurityKey->encKey, 0, 0, 1725 CB_Func, CB_handle); 1726 1727 WLAN_REPORT_INFORMATION(pHwCtrl->hReport, HAL_HW_CTRL_MODULE_LOG, 1728 ("whal_hwCtrl_WepDefaultKeyRemove: ## id=%d \n", 1729 aSecurityKey->keyIndex)); 1730 1731 return Stt; 1732 } 1733 1734 /**************************************************************************** 1735 * whal_hwCtrl_WepMappingKeyAdd() 1736 **************************************************************************** 1737 * DESCRIPTION: Set the actual mapping key 1738 * 1739 * INPUTS: 1740 * 1741 * OUTPUT: 1742 * 1743 * RETURNS: OK or NOK 1744 ****************************************************************************/ 1745 int whal_hwCtrl_WepMappingKeyAdd (HwCtrl_T *pHwCtrl, securityKeys_t* aSecurityKey, void *CB_Func, TI_HANDLE CB_handle) 1746 { 1747 int Stt; 1748 1749 Stt = whal_hwMboxCmd_SetKey(pHwCtrl->pHwMboxCmd, KEY_ADD_OR_REPLACE, 1750 (char*)aSecurityKey->macAddress.addr, 1751 aSecurityKey->encLen, KEY_WEP_ADDR, 1752 aSecurityKey->keyIndex, 1753 (char*)aSecurityKey->encKey, 0, 0, 1754 CB_Func, CB_handle); 1755 1756 WLAN_REPORT_INFORMATION(pHwCtrl->hReport, HAL_HW_CTRL_MODULE_LOG, 1757 ("whal_hwCtrl_WepMappingKeyAdd: ## len=%d, id=%d encKey[5 entries]=0x %x %x %x %x %x\n", 1758 aSecurityKey->encLen, 1759 aSecurityKey->keyIndex, 1760 aSecurityKey->encKey[0], aSecurityKey->encKey[1], aSecurityKey->encKey[2], aSecurityKey->encKey[3], aSecurityKey->encKey[4] )); 1761 1762 1763 return Stt; 1764 } 1765 1766 /**************************************************************************** 1767 * whal_hwCtrl_WepMappingKeyRemove() 1768 **************************************************************************** 1769 * DESCRIPTION: Set the actual mapping key 1770 * 1771 * INPUTS: 1772 * 1773 * OUTPUT: 1774 * 1775 * RETURNS: OK or NOK 1776 ****************************************************************************/ 1777 int whal_hwCtrl_WepMappingKeyRemove (HwCtrl_T *pHwCtrl, securityKeys_t* aSecurityKey, void *CB_Func, TI_HANDLE CB_handle) 1778 { 1779 int Stt; 1780 1781 Stt = whal_hwMboxCmd_SetKey(pHwCtrl->pHwMboxCmd, KEY_REMOVE, 1782 (char*)aSecurityKey->macAddress.addr, 1783 aSecurityKey->encLen, KEY_WEP_ADDR, 1784 aSecurityKey->keyIndex, 1785 (char*)aSecurityKey->encKey, 0, 0, 1786 CB_Func, CB_handle); 1787 1788 WLAN_REPORT_INFORMATION(pHwCtrl->hReport, HAL_HW_CTRL_MODULE_LOG, 1789 ("whal_hwCtrl_WepMappingKeyRemove: ## id=%d \n", 1790 aSecurityKey->keyIndex)); 1791 1792 return Stt; 1793 } 1794 1795 /**************************************************************************** 1796 * whal_hwCtrl_TkipMicMappingKeyAdd() 1797 **************************************************************************** 1798 * DESCRIPTION: Set the actual mapping key 1799 * 1800 * INPUTS: 1801 * 1802 * OUTPUT: 1803 * 1804 * RETURNS: OK or NOK 1805 ****************************************************************************/ 1806 int whal_hwCtrl_TkipMicMappingKeyAdd (HwCtrl_T *pHwCtrl, securityKeys_t* aSecurityKey, void *CB_Func, TI_HANDLE CB_handle) 1807 { 1808 int Stt = OK; 1809 1810 UINT8 keyType; 1811 UINT8 keyBuffer[KEY_SIZE_TKIP]; 1812 1813 keyType = (IsMacAddressGroup(&(aSecurityKey->macAddress))==1) ? KEY_TKIP_MIC_GROUP: KEY_TKIP_MIC_PAIRWISE; 1814 1815 os_memoryCopy(pHwCtrl->hOs, (PVOID)(&keyBuffer[0]), (PVOID)aSecurityKey->encKey, 16); 1816 os_memoryCopy(pHwCtrl->hOs, (PVOID)(&keyBuffer[16]), (PVOID)aSecurityKey->micRxKey, 8); 1817 os_memoryCopy(pHwCtrl->hOs, (PVOID)(&keyBuffer[24]), (PVOID)aSecurityKey->micTxKey, 8); 1818 1819 Stt = whal_hwMboxCmd_SetKey(pHwCtrl->pHwMboxCmd, KEY_ADD_OR_REPLACE, 1820 (char*)aSecurityKey->macAddress.addr, 1821 KEY_SIZE_TKIP, keyType, 1822 aSecurityKey->keyIndex , 1823 (char*)keyBuffer, pHwCtrl->SecuritySeqNumLow, pHwCtrl->SecuritySeqNumHigh, 1824 CB_Func, CB_handle); 1825 1826 return Stt; 1827 } 1828 1829 /**************************************************************************** 1830 * whal_hwCtrl_TkipMappingKeyAdd() 1831 **************************************************************************** 1832 * DESCRIPTION: Set the actual mapping key 1833 * 1834 * INPUTS: 1835 * 1836 * OUTPUT: 1837 * 1838 * RETURNS: OK or NOK 1839 ****************************************************************************/ 1840 int whal_hwCtrl_TkipMicMappingKeyRemove (HwCtrl_T *pHwCtrl, securityKeys_t* aSecurityKey, void *CB_Func, TI_HANDLE CB_handle) 1841 { 1842 int Stt; 1843 /* UINT8 bcast[6] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; */ 1844 1845 UINT8 keyType; 1846 1847 keyType = (IsMacAddressGroup(&(aSecurityKey->macAddress))==1) ? KEY_TKIP_MIC_GROUP: KEY_TKIP_MIC_PAIRWISE; 1848 1849 Stt = whal_hwMboxCmd_SetKey(pHwCtrl->pHwMboxCmd, KEY_REMOVE, 1850 (char*)aSecurityKey->macAddress.addr, 1851 aSecurityKey->encLen, keyType, 1852 aSecurityKey->keyIndex , 1853 (char*)aSecurityKey->encKey, 0, 0, 1854 CB_Func, CB_handle); 1855 1856 return Stt; 1857 } 1858 1859 /**************************************************************************** 1860 * whal_hwCtrl_AesMappingKeyAdd() 1861 **************************************************************************** 1862 * DESCRIPTION: Set the actual Aes mapping key 1863 * 1864 * INPUTS: 1865 * 1866 * OUTPUT: 1867 * 1868 * RETURNS: OK or NOK 1869 ****************************************************************************/ 1870 int whal_hwCtrl_AesMappingKeyAdd (HwCtrl_T *pHwCtrl, securityKeys_t* aSecurityKey, void *CB_Func, TI_HANDLE CB_handle) 1871 { 1872 int Stt; 1873 UINT8 keyType; 1874 1875 keyType = IsMacAddressGroup(&(aSecurityKey->macAddress)) ? 1876 KEY_AES_GROUP: KEY_AES_PAIRWISE; 1877 1878 Stt = whal_hwMboxCmd_SetKey(pHwCtrl->pHwMboxCmd, KEY_ADD_OR_REPLACE, 1879 (char*)aSecurityKey->macAddress.addr, 1880 aSecurityKey->encLen, keyType, 1881 aSecurityKey->keyIndex , 1882 (char*)aSecurityKey->encKey, pHwCtrl->SecuritySeqNumLow, pHwCtrl->SecuritySeqNumHigh, 1883 CB_Func, CB_handle); 1884 1885 WLAN_REPORT_INFORMATION(pHwCtrl->hReport, HAL_HW_CTRL_MODULE_LOG, 1886 ("whal_hwCtrl_AesMappingKeyAdd: SecuritySeqNumHigh=%ld, pHwCtrl->SecuritySeqNumLow=%ld \n", 1887 pHwCtrl->SecuritySeqNumHigh, pHwCtrl->SecuritySeqNumLow)); 1888 1889 1890 return Stt; 1891 1892 } 1893 1894 1895 /**************************************************************************** 1896 * whal_hwCtrl_AesMappingKeyRemove() 1897 **************************************************************************** 1898 * DESCRIPTION: Remove Aes mapping key 1899 * 1900 * INPUTS: 1901 * 1902 * OUTPUT: 1903 * 1904 * RETURNS: OK or NOK 1905 ****************************************************************************/ 1906 int whal_hwCtrl_AesMappingKeyRemove (HwCtrl_T *pHwCtrl, securityKeys_t* aSecurityKey, void *CB_Func, TI_HANDLE CB_handle) 1907 { 1908 int Stt; 1909 UINT8 keyType; 1910 1911 keyType = IsMacAddressGroup(&(aSecurityKey->macAddress)) ? 1912 KEY_AES_GROUP: KEY_AES_PAIRWISE; 1913 1914 Stt = whal_hwMboxCmd_SetKey(pHwCtrl->pHwMboxCmd, KEY_REMOVE, 1915 (char*)aSecurityKey->macAddress.addr, 1916 aSecurityKey->encLen, keyType, 1917 aSecurityKey->keyIndex , 1918 (char*)aSecurityKey->encKey, 0, 0, 1919 CB_Func, CB_handle); 1920 1921 return Stt; 1922 } 1923 1924 /**************************************************************************** 1925 * whal_hwCtrl_DefaultKeyIdSet() 1926 **************************************************************************** 1927 * DESCRIPTION: Set the default key ID 1928 * 1929 * INPUTS: 1930 * 1931 * OUTPUT: 1932 * 1933 * RETURNS: OK or NOK 1934 ****************************************************************************/ 1935 int whal_hwCtrl_DefaultKeyIdSet (HwCtrl_T *pHwCtrl, UINT8 aKeyIdVal, void *CB_Func, TI_HANDLE CB_handle) 1936 { 1937 WLAN_REPORT_INFORMATION(pHwCtrl->hReport, HAL_HW_CTRL_MODULE_LOG, 1938 ("whal_hwCtrl_DefaultKeyIdSet: ## Id=%d\n", aKeyIdVal)); 1939 1940 WLAN_REPORT_INFORMATION(pHwCtrl->hReport, HAL_HW_CTRL_MODULE_LOG, 1941 ("whal_hwCtrl_DefaultKeyIdSet: ## Id=%d\n", aKeyIdVal)); 1942 1943 /* Set the default key Id */ 1944 return whal_hwInfoElemWepDefaultKeyIdSet (pHwCtrl->pHwMboxConfig, &aKeyIdVal, CB_Func, CB_handle); 1945 } 1946 1947 /**************************************************************************** 1948 * whal_hwCtrl_DefaultKeyIdGet() 1949 **************************************************************************** 1950 * DESCRIPTION: Get the default key ID 1951 * 1952 * INPUTS: 1953 * 1954 * OUTPUT: 1955 * 1956 * RETURNS: OK or NOK 1957 ****************************************************************************/ 1958 int whal_hwCtrl_DefaultKeyIdGet (HwCtrl_T *pHwCtrl, UINT8 *pKeyIdVal) 1959 { 1960 /* Get the default key Id */ 1961 return whal_hwInfoElemWepDefaultKeyIdGet (pHwCtrl->pHwMboxConfig, pKeyIdVal, NULL, NULL); 1962 } 1963 1964 /**************************************************************************** 1965 * whal_hwCtrl_Initiate() 1966 **************************************************************************** 1967 * DESCRIPTION: Download firmware code to the Hardware and run it 1968 * 1969 * INPUTS: None 1970 * 1971 * OUTPUT: None 1972 * 1973 * RETURNS: OK or NOK 1974 ****************************************************************************/ 1975 TI_STATUS whal_hwCtrl_Initiate (HwCtrl_T *pHwCtrl) 1976 { 1977 WlanParams_T *pWlanParams = whal_ParamsGetWlanParams(pHwCtrl->pWhalParams); 1978 BootAttr_T BootAttr; 1979 TI_STATUS status; 1980 1981 BootAttr.MacClock = pWlanParams->MacClock; 1982 BootAttr.ArmClock = pWlanParams->ArmClock; 1983 1984 if ((status = whalBus_FwCtrl_Boot (pHwCtrl->hWhalBus, (TI_HANDLE)pHwCtrl, &BootAttr)) == TNETWIF_ERROR) 1985 { 1986 WLAN_REPORT_WARNING (pHwCtrl->hReport, HAL_HW_CTRL_MODULE_LOG, 1987 ("whal_hwCtrl_Initiate: whalBus_FwCtrl_Boot failure!!!\n")); 1988 } 1989 1990 return status; 1991 } 1992 1993 1994 1995 /**************************************************************************** 1996 * whal_hwCtrl_Stop() 1997 **************************************************************************** 1998 * DESCRIPTION: Stop the Hardware firmware 1999 * 2000 * INPUTS: None 2001 * 2002 * OUTPUT: None 2003 * 2004 * RETURNS: None 2005 ****************************************************************************/ 2006 void whal_hwCtrl_Stop(HwCtrl_T *pHwCtrl) 2007 { 2008 2009 #ifdef WDBG_POLLING /* (!!!) ONLY FOR DEBUG WHEN THERE ARE NO INTERRUPTS */ 2010 os_timerStop(pHwCtrl->hOs, hal_timer); 2011 #endif 2012 2013 /* 2014 * Stop Acx Cpu 2015 */ 2016 whalBus_FwCtrl_Halt(pHwCtrl->hWhalBus); 2017 return; 2018 } 2019 2020 /**************************************************************************** 2021 * whal_hwCtrl_GetBusHandle() 2022 **************************************************************************** 2023 * DESCRIPTION: Return the handle of the Bus object. 2024 * 2025 * INPUTS: 2026 * 2027 * OUTPUT: None 2028 * 2029 * RETURNS: handle of the HwIntr object 2030 ****************************************************************************/ 2031 TI_HANDLE whal_hwCtrl_GetBusHandle(HwCtrl_T *pHwCtrl) 2032 { 2033 return pHwCtrl->hWhalBus; 2034 } 2035 2036 /**************************************************************************** 2037 * whal_hwCtrl_GetMboxConfig() 2038 **************************************************************************** 2039 * DESCRIPTION: Return the handle of the MboxConfig object. 2040 * 2041 * INPUTS: 2042 * 2043 * OUTPUT: None 2044 * 2045 * RETURNS: handle of the MboxConfig object 2046 ****************************************************************************/ 2047 HwMboxConfig_T *whal_hwCtrl_GetMboxConfig(HwCtrl_T *pHwCtrl) 2048 { 2049 return pHwCtrl->pHwMboxConfig; 2050 } 2051 2052 /**************************************************************************** 2053 * whal_hwCtrl_GetMboxCmd() 2054 **************************************************************************** 2055 * DESCRIPTION: Return the handle of the MboxCmd object. 2056 * 2057 * INPUTS: 2058 * 2059 * OUTPUT: None 2060 * 2061 * RETURNS: handle of the MboxCmd object 2062 ****************************************************************************/ 2063 HwMboxCmd_T *whal_hwCtrl_GetMboxCmd(HwCtrl_T *pHwCtrl) 2064 { 2065 return pHwCtrl->pHwMboxCmd; 2066 } 2067 2068 /**************************************************************************** 2069 * whal_hwCtrl_StartScan() 2070 **************************************************************************** 2071 * DESCRIPTION: Send Start Scan command 2072 * 2073 * INPUTS: None 2074 * 2075 * OUTPUT: None 2076 * 2077 * RETURNS: OK or NOK 2078 ****************************************************************************/ 2079 int whal_hwCtrl_StartScan (HwCtrl_T *pHwCtrl, ScanParameters_t* pScanVals, void* ScanCommandResponseCB, TI_HANDLE CB_handle) 2080 { 2081 return (whal_hwMboxCmd_StartScan (pHwCtrl->pHwMboxCmd, pScanVals, ScanCommandResponseCB,CB_handle)); 2082 } 2083 2084 /**************************************************************************** 2085 * whal_hwCtrl_StartSPSScan() 2086 **************************************************************************** 2087 * DESCRIPTION: Send Start SPS Scan command 2088 * 2089 * INPUTS: None 2090 * 2091 * OUTPUT: None 2092 * 2093 * RETURNS: OK or NOK 2094 ****************************************************************************/ 2095 int whal_hwCtrl_StartSPSScan( HwCtrl_T *pHwCtrl, ScheduledScanParameters_t* pScanVals, void* ScanCommandResponseCB, TI_HANDLE CB_handle) 2096 { 2097 return (whal_hwMboxCmd_StartSPSScan (pHwCtrl->pHwMboxCmd, pScanVals, ScanCommandResponseCB, CB_handle)); 2098 } 2099 2100 /**************************************************************************** 2101 * whal_hwCtrl_StopScan() 2102 **************************************************************************** 2103 * DESCRIPTION: Send Stop Scan command 2104 * 2105 * INPUTS: None 2106 * 2107 * OUTPUT: None 2108 * 2109 * RETURNS: OK or NOK 2110 ****************************************************************************/ 2111 int whal_hwCtrl_StopScan (HwCtrl_T *pHwCtrl, void *ScanCommandResponseCB, TI_HANDLE CB_handle) 2112 { 2113 return(whal_hwMboxCmd_StopScan (pHwCtrl->pHwMboxCmd, ScanCommandResponseCB, CB_handle)); 2114 } 2115 2116 /**************************************************************************** 2117 * whal_hwCtrl_StopSPSScan() 2118 **************************************************************************** 2119 * DESCRIPTION: Send Stop SPS Scan command 2120 * 2121 * INPUTS: None 2122 * 2123 * OUTPUT: None 2124 * 2125 * RETURNS: OK or NOK 2126 ****************************************************************************/ 2127 int whal_hwCtrl_StopSPSScan (HwCtrl_T *pHwCtrl, void* ScanCommandResponseCB, TI_HANDLE CB_handle) 2128 { 2129 return(whal_hwMboxCmd_StopSPSScan (pHwCtrl->pHwMboxCmd, ScanCommandResponseCB, CB_handle)); 2130 } 2131 2132 /**************************************************************************** 2133 * whal_hwCtrl_GenCmd() 2134 **************************************************************************** 2135 * DESCRIPTION: Send any command to hw MB command 2136 * 2137 * INPUTS: None 2138 * 2139 * OUTPUT: None 2140 * 2141 * RETURNS: OK or NOK 2142 ****************************************************************************/ 2143 int whal_hwCtrl_GenCmd(HwCtrl_T *pHwCtrl, short CmdID, char* pBuf, UINT32 Length) 2144 { 2145 return (whal_hwMboxCmd_GenCmd(pHwCtrl->pHwMboxCmd, CmdID, pBuf, Length)); 2146 } 2147 2148 /**************************************************************************** 2149 * whal_hwCtrl_isElpSupported () 2150 **************************************************************************** 2151 * DESCRIPTION: Check if ELP feature is supported based on the HW device 2152 * 2153 * INPUTS: 2154 * 2155 * OUTPUT: 2156 * 2157 * RETURNS: ELP feature is supported/not 2158 ****************************************************************************/ 2159 BOOL whal_hwCtrl_isElpSupported (HwCtrl_T *pHwCtrl) 2160 { 2161 return TRUE; 2162 } 2163 2164 /**************************************************************************** 2165 * whal_hwCtrl_AidSet() 2166 **************************************************************************** 2167 * DESCRIPTION: Set the AID 2168 * 2169 * INPUTS: 2170 * 2171 * OUTPUT: 2172 * 2173 * RETURNS: OK or NOK 2174 ****************************************************************************/ 2175 int whal_hwCtrl_AidSet (HwCtrl_T *pHwCtrl, UINT16 aAidVal) 2176 { 2177 /* Set the Aid */ 2178 return whal_hwInfoElemAidSet (pHwCtrl->pHwMboxConfig, &aAidVal); 2179 } 2180 2181 2182 /**************************************************************************** 2183 * whal_hwCtrl_CurrentTxRxAntennaSendCmd() 2184 **************************************************************************** 2185 * DESCRIPTION: send Diversity command to F/W with the pre-stored antenna 2186 * diversity parameters 2187 * 2188 * INPUTS: 2189 * 2190 * OUTPUT: 2191 * 2192 * RETURNS: OK or NOK 2193 ****************************************************************************/ 2194 int whal_hwCtrl_CurrentAntennaDiversitySendCmd (HwCtrl_T *pHwCtrl) 2195 { 2196 int status; 2197 2198 WLAN_REPORT_INFORMATION(pHwCtrl->hReport, HAL_HW_CTRL_MODULE_LOG,("whal_hwCtrl_CurrentRxAntennaSet\n")); 2199 2200 /* Write the current antenna diversity values to the HW*/ 2201 if ( RADIO_RADIA_DCR_ID == pHwCtrl->pWhalParams->WlanParams.radioType ) 2202 { 2203 status = whal_hwInfoElemAntennaDiversitySet (pHwCtrl->pHwMboxConfig, 2204 &(pHwCtrl->pWhalParams->WlanParams.antennaDiversityOptions), 2205 1); 2206 } 2207 else 2208 { 2209 status = whal_hwInfoElemAntennaDiversitySet (pHwCtrl->pHwMboxConfig, 2210 &(pHwCtrl->pWhalParams->WlanParams.antennaDiversityOptions), 2211 2); 2212 } 2213 2214 return(status); 2215 } 2216 2217 /**************************************************************************** 2218 * whal_hwCtrl_SetTxAntenna() 2219 **************************************************************************** 2220 * DESCRIPTION: Save TX antenna 2221 * 2222 * INPUTS: 2223 * 2224 * OUTPUT: 2225 * 2226 * RETURNS: OK or NOK 2227 ****************************************************************************/ 2228 int whal_hwCtrl_SetTxAntenna (HwCtrl_T *pHwCtrl, UINT8 TxAntenna) 2229 { 2230 if (TxAntenna == 1) 2231 { 2232 pHwCtrl->pWhalParams->WlanParams.antennaDiversityOptions.txSelectedAntenna = DIVS_TX_START_ANT1; 2233 } 2234 else if (TxAntenna == 2) 2235 { 2236 pHwCtrl->pWhalParams->WlanParams.antennaDiversityOptions.txSelectedAntenna = DIVS_TX_START_ANT2; 2237 } 2238 else 2239 { 2240 WLAN_REPORT_ERROR(pHwCtrl->hReport, HAL_HW_CTRL_MODULE_LOG, 2241 ("whal_hwCtrl_SetTxAntenna: wrong antenna param %d\n", TxAntenna)); 2242 return PARAM_VALUE_NOT_VALID; 2243 } 2244 2245 return OK; 2246 } 2247 2248 /**************************************************************************** 2249 * whal_hwCtrl_GetTxAntenna() 2250 **************************************************************************** 2251 * DESCRIPTION: retrieve TX antenna 2252 * 2253 * INPUTS: 2254 * 2255 * OUTPUT: 2256 * 2257 * RETURNS: OK or NOK 2258 ****************************************************************************/ 2259 int whal_hwCtrl_GetTxAntenna (HwCtrl_T *pHwCtrl, UINT8* TxAntenna) 2260 { 2261 if (pHwCtrl->pWhalParams->WlanParams.antennaDiversityOptions.txSelectedAntenna == DIVS_RX_START_ANT1) 2262 { 2263 *TxAntenna = 1; 2264 } 2265 else if (pHwCtrl->pWhalParams->WlanParams.antennaDiversityOptions.txSelectedAntenna == DIVS_RX_START_ANT2) 2266 { 2267 *TxAntenna = 2; 2268 } 2269 else 2270 { 2271 WLAN_REPORT_ERROR(pHwCtrl->hReport, HAL_HW_CTRL_MODULE_LOG, 2272 ("whal_hwCtrl_GetTxAntenna: wrong configured antenna param %d\n", pHwCtrl->pWhalParams->WlanParams.antennaDiversityOptions.txSelectedAntenna)); 2273 return CONFIGURATION_NOT_VALID; 2274 } 2275 2276 return OK; 2277 } 2278 2279 /**************************************************************************** 2280 * whal_hwCtrl_SetRxAntenna() 2281 **************************************************************************** 2282 * DESCRIPTION: Save RX antenna 2283 * 2284 * INPUTS: 2285 * 2286 * OUTPUT: 2287 * 2288 * RETURNS: OK or NOK 2289 ****************************************************************************/ 2290 int whal_hwCtrl_SetRxAntenna (HwCtrl_T *pHwCtrl, UINT8 RxAntenna) 2291 { 2292 if (RxAntenna == 1) 2293 { 2294 pHwCtrl->pWhalParams->WlanParams.antennaDiversityOptions.rxSelectedAntenna = DIVS_RX_START_ANT1; 2295 } 2296 else if (RxAntenna == 2) 2297 { 2298 pHwCtrl->pWhalParams->WlanParams.antennaDiversityOptions.rxSelectedAntenna = DIVS_RX_START_ANT2; 2299 } 2300 else 2301 { 2302 WLAN_REPORT_ERROR(pHwCtrl->hReport, HAL_HW_CTRL_MODULE_LOG, 2303 ("whal_hwCtrl_SetRxAntenna: wrong antenna param %d\n", RxAntenna)); 2304 return PARAM_VALUE_NOT_VALID; 2305 } 2306 2307 return OK; 2308 } 2309 2310 /**************************************************************************** 2311 * whal_hwCtrl_GetRxAntenna() 2312 **************************************************************************** 2313 * DESCRIPTION: retrieve RX antenna 2314 * 2315 * INPUTS: 2316 * 2317 * OUTPUT: 2318 * 2319 * RETURNS: OK or NOK 2320 ****************************************************************************/ 2321 int whal_hwCtrl_GetRxAntenna (HwCtrl_T *pHwCtrl, UINT8* RxAntenna) 2322 { 2323 if (pHwCtrl->pWhalParams->WlanParams.antennaDiversityOptions.rxSelectedAntenna == DIVS_RX_START_ANT1) 2324 { 2325 *RxAntenna = 1; 2326 } 2327 else if (pHwCtrl->pWhalParams->WlanParams.antennaDiversityOptions.rxSelectedAntenna == DIVS_RX_START_ANT2) 2328 { 2329 *RxAntenna = 2; 2330 } 2331 else 2332 { 2333 WLAN_REPORT_ERROR(pHwCtrl->hReport, HAL_HW_CTRL_MODULE_LOG, 2334 ("whal_hwCtrl_GetRxAntenna: wrong configured antenna param %d\n", pHwCtrl->pWhalParams->WlanParams.antennaDiversityOptions.rxSelectedAntenna)); 2335 return CONFIGURATION_NOT_VALID; 2336 } 2337 2338 return OK; 2339 } 2340 2341 /**************************************************************************** 2342 * whal_hwCtrl_SaveAntennaDiversityOptions() 2343 **************************************************************************** 2344 * DESCRIPTION: Save antenna diversity parameters 2345 * 2346 * INPUTS: 2347 * 2348 * OUTPUT: 2349 * 2350 * RETURNS: OK or NOK 2351 ****************************************************************************/ 2352 int whal_hwCtrl_SaveAntennaDiversityOptions (HwCtrl_T *pHwCtrl, 2353 whalCtrl_antennaDiversityOptions_t* pAntennaDivresityOptions ) 2354 { 2355 os_memoryCopy( pHwCtrl->hOs, (void*)&(pHwCtrl->pWhalParams->WlanParams.antennaDiversityOptions), 2356 (void*)pAntennaDivresityOptions, sizeof( whalCtrl_antennaDiversityOptions_t ) ); 2357 whal_hwCtrl_SetTxAntenna(pHwCtrl, pAntennaDivresityOptions->txSelectedAntenna); 2358 whal_hwCtrl_SetRxAntenna(pHwCtrl, pAntennaDivresityOptions->rxSelectedAntenna); 2359 return OK; 2360 } 2361 2362 /**************************************************************************** 2363 * whal_hwCtrl_CurrentAssociationIdGet() 2364 **************************************************************************** 2365 * DESCRIPTION: Get the current TX antenna 2366 * 2367 * INPUTS: 2368 * 2369 * OUTPUT: 2370 * 2371 * RETURNS: OK or NOK 2372 ****************************************************************************/ 2373 int whal_hwCtrl_CurrentAssociationIdGet (HwCtrl_T *pHwCtrl, UINT16 *pAidVal) 2374 { 2375 *pAidVal = pHwCtrl->pWhalParams->WlanParams.Aid; 2376 return OK; 2377 } 2378 2379 /**************************************************************************** 2380 * whal_hwCtrl_OverridePhyRegsDefaults() 2381 **************************************************************************** 2382 * DESCRIPTION: Set phy register for short preamble problem 2383 * 2384 * INPUTS: 2385 * 2386 * OUTPUT: 2387 * 2388 * RETURNS: 2389 ****************************************************************************/ 2390 void whal_hwCtrl_OverridePhyRegsDefaults(HwCtrl_T *pHwCtrl) 2391 { 2392 /* 2393 * Configure the energy detection 2394 */ 2395 whal_hwCtrl_SetEnergyDetection(pHwCtrl, pHwCtrl->pWhalParams->WlanParams.RxEnergyDetection); 2396 2397 /* 2398 * Disable OFDM receiver in channel 14 (overcome FCS errors problem) 2399 */ 2400 /* moved to the firmware */ 2401 } 2402 2403 2404 int whal_hwCtrl_EncDecrSet (HwCtrl_T *pHwCtrl, BOOL aHwEncEnable, BOOL aHwDecEnable) 2405 { 2406 WlanParams_T *pWlanParams = &pHwCtrl->pWhalParams->WlanParams; 2407 2408 if (aHwEncEnable) 2409 pWlanParams->FeatureDataFlowOptions &= ~DF_ENCRYPTION_DISABLE; 2410 else 2411 pWlanParams->FeatureDataFlowOptions |= DF_ENCRYPTION_DISABLE; 2412 2413 /* Set bit DF_SNIFF_MODE_ENABLE to enable or prevent decryption in fw */ 2414 /* WARNING: Have to check how to control the decryption (which bit) and then set/reset 2415 the appropriate bit*/ 2416 if (aHwDecEnable) 2417 pWlanParams->FeatureDataFlowOptions &= ~DF_SNIFF_MODE_ENABLE; 2418 else 2419 pWlanParams->FeatureDataFlowOptions |= DF_SNIFF_MODE_ENABLE; 2420 2421 return whal_hwInfoElemFeatureConfigSet (pHwCtrl->pHwMboxConfig, pWlanParams->FeatureOptions, pWlanParams->FeatureDataFlowOptions); 2422 } 2423 2424 int whal_hwCtrl_ClkRunEnableSet (HwCtrl_T *pHwCtrl, BOOL aClkRunEnable) 2425 { 2426 WlanParams_T *pWlanParams = &pHwCtrl->pWhalParams->WlanParams; 2427 2428 if (aClkRunEnable) 2429 pWlanParams->FeatureDataFlowOptions |= FEAT_PCI_CLK_RUN_ENABLE; 2430 else 2431 pWlanParams->FeatureDataFlowOptions &= ~FEAT_PCI_CLK_RUN_ENABLE; 2432 2433 return whal_hwInfoElemFeatureConfigSet (pHwCtrl->pHwMboxConfig, pWlanParams->FeatureOptions, pWlanParams->FeatureDataFlowOptions); 2434 } 2435 2436 int whal_hwCtrl_RxMsduFormatSet (HwCtrl_T *pHwCtrl, BOOL aRxMsduForamtEnable) 2437 { 2438 #if 1 2439 /* WARNING: Have to check how to control the Rx Frame format select (which bit) 2440 and then access the HW*/ 2441 return(OK); 2442 #else 2443 WlanParams_T *pWlanParams = &pHwCtrl->pWhalParams->WlanParams; 2444 if (aRxMsduForamtEnable) 2445 pWlanParams->FeatureDataFlowOptions |= DATA_FLOW_RX_MSDU_FRAME; 2446 else 2447 pWlanParams->FeatureDataFlowOptions &= ~DATA_FLOW_RX_MSDU_FRAME; 2448 2449 return whal_hwInfoElemFeatureConfigSet (pHwCtrl->pHwMboxConfig, pWlanParams->FeatureOptions, pWlanParams->FeatureDataFlowOptions); 2450 #endif 2451 } 2452 2453 /**************************************************************************** 2454 * whal_hwCtrl_getTsf() 2455 **************************************************************************** 2456 * DESCRIPTION: Get the current time stamp from the FW 2457 * 2458 * INPUTS: hwHalCtrl handle, pTsf container for the FW mac timer 2459 * 2460 * OUTPUT: pTsf FW mac timer 2461 * 2462 * RETURNS: OK, NOK 2463 * 2464 * NOTES: The time will be in usec 2465 ****************************************************************************/ 2466 2467 int whal_hwCtrl_getTsf(HwCtrl_T *pHwCtrl, UINT32 *pTsf) 2468 { 2469 /* for debug only - Not implemented as direct access to register */ 2470 return(OK); 2471 } 2472 2473 2474 /**************************************************************************** 2475 * whal_hwCtrl_NoiseHistogramCmd() 2476 **************************************************************************** 2477 * DESCRIPTION: Send Noise Histogram command 2478 * 2479 * INPUTS: None 2480 * 2481 * OUTPUT: None 2482 * 2483 * RETURNS: OK or NOK 2484 ****************************************************************************/ 2485 int whal_hwCtrl_NoiseHistogramCmd (HwCtrl_T *pHwCtrl, whalCtrl_noiseHistogram_t* pNoiseHistParams) 2486 { 2487 return (whal_hwMboxCmd_NoiseHistogramCmd (pHwCtrl->pHwMboxCmd, pNoiseHistParams)); 2488 } 2489 2490 /**************************************************************************** 2491 * whal_hwCtrl_TrafficConf() 2492 **************************************************************************** 2493 * DESCRIPTION: configure Queue traffic params 2494 * 2495 * INPUTS: None 2496 * 2497 * OUTPUT: None 2498 * 2499 * RETURNS: OK or NOK 2500 ****************************************************************************/ 2501 int whal_hwCtrl_TrafficConf(TI_HANDLE hHwCtrl, queueTrafficParams_t *pQtrafficParams) 2502 { 2503 TI_STATUS status; 2504 HwCtrl_T *pHwCtrl = (HwCtrl_T*)hHwCtrl; 2505 2506 2507 WLAN_REPORT_DEBUG_CONTROL(pHwCtrl->hReport,(" whal_hwCtrl_TrafficConf: pQtrafficParams->aQueueId = 0x%x , pQtrafficParams->channelType %x pQtrafficParams->tsid %d pQtrafficParams->dot11EDCATableMSDULifeTime %d \n", 2508 pQtrafficParams->queueID,pQtrafficParams->channelType,pQtrafficParams->tsid,pQtrafficParams->dot11EDCATableMSDULifeTime)); 2509 2510 WLAN_REPORT_DEBUG_CONTROL(pHwCtrl->hReport,("whal_hwCtrl_TrafficConf : psScheme = 0x%x , ackPolicy %d APSDConf[0] = 0x%x ,APSDConf[1] = 0x%x\n",pQtrafficParams->psScheme,pQtrafficParams->ackPolicy,pQtrafficParams->APSDConf[0],pQtrafficParams->APSDConf[1])); 2511 2512 2513 /* Setting the queue configuration into the HW */ 2514 status = (TI_STATUS)whal_hwInfoElemQueueConfigurationSet (pHwCtrl->pHwMboxConfig,pQtrafficParams); 2515 2516 /* Set the queue param object database fields according to the succeded configuration (for recovery) */ 2517 if (status == OK) 2518 whal_ParamsSetQueueParams(pHwCtrl->pWhalParams,pQtrafficParams); 2519 2520 return status; 2521 } 2522 /**************************************************************************** 2523 * whal_hwCtrl_AcParamsConf() 2524 **************************************************************************** 2525 * DESCRIPTION: configure AC params 2526 * 2527 * INPUTS: None 2528 * 2529 * OUTPUT: None 2530 * 2531 * RETURNS: OK or NOK 2532 ****************************************************************************/ 2533 2534 int whal_hwCtrl_AcParamsConf(TI_HANDLE hHwCtrl,configureCmdCBParams_t *pConfigureCommand) 2535 { 2536 2537 TI_STATUS status; 2538 HwCtrl_T *pHwCtrl = (HwCtrl_T*)hHwCtrl; 2539 acQosParams_t *pAcQosParams = (acQosParams_t*)(pConfigureCommand->CB_buf); 2540 2541 WLAN_REPORT_DEBUG_CONTROL(pHwCtrl->hReport,(" whal_hwCtrl_AcParamsConf: Index = 0x%x, aCwMin = 0x%x, aCwMax = 0x%x, aAIFS = 0x%x, aTxOpLimit = 0x%x\n", 2542 pAcQosParams->ac,pAcQosParams->cwMin,pAcQosParams->cwMax,pAcQosParams->aifsn,pAcQosParams->txopLimit)); 2543 2544 /* Setting the AC configuration into the HW */ 2545 2546 if (pConfigureCommand->CB_Func == NULL) 2547 status = (TI_STATUS)whal_hwInfoElemAcParamsConfigurationSet (pHwCtrl->pHwMboxConfig,pConfigureCommand); 2548 else 2549 status = (TI_STATUS)whal_hwInfoElemAcParamsConfigurationGet (pHwCtrl->pHwMboxConfig,pConfigureCommand); 2550 2551 /* Set the AC param object database fields according to the succeeded configuration (for recovery) */ 2552 if (status == OK) 2553 whal_ParamsSetAcParams(pHwCtrl->pWhalParams,pAcQosParams); 2554 2555 return status; 2556 2557 } 2558 /**************************************************************************** 2559 * whal_hwCtrl_AccessCategoryConf() 2560 **************************************************************************** 2561 * DESCRIPTION: Send Access Category Configuration 2562 * 2563 * INPUTS: None 2564 * 2565 * OUTPUT: None 2566 * 2567 * RETURNS: OK or NOK 2568 ****************************************************************************/ 2569 int whal_hwCtrl_QueueConf(TI_HANDLE hHwCtrl, acQueuesParams_t* pAcQueuesParams) 2570 { 2571 TI_STATUS status; 2572 HwCtrl_T *pHwCtrl = (HwCtrl_T*)hHwCtrl; 2573 2574 /* Setting the queue configuration into the HW */ 2575 status = (TI_STATUS)whal_hwInfoElemTxQueueCfgSet (pHwCtrl->pHwMboxConfig, 2576 pAcQueuesParams, 2577 pHwCtrl->MemMap.numTxMemBlks); 2578 2579 /* Set the queue param object database fields according to the succeeds configuration (for recovery) */ 2580 if (status == OK) 2581 whal_ParamsSetAccessCategoryParams(pHwCtrl->pWhalParams, pAcQueuesParams); 2582 2583 return status; 2584 } 2585 2586 /**************************************************************************** 2587 * whal_hwCtrl_PacketDetectionThreshold() 2588 **************************************************************************** 2589 * DESCRIPTION: Send Noise Histogram command 2590 * 2591 * INPUTS: None 2592 * 2593 * OUTPUT: None 2594 * 2595 * RETURNS: OK or NOK 2596 ****************************************************************************/ 2597 int whal_hwCtrl_PacketDetectionThreshold (TI_HANDLE hHwCtrl, UINT8* pPdThreshold) 2598 { 2599 TI_STATUS status; 2600 HwCtrl_T *pHwCtrl = (HwCtrl_T*)hHwCtrl; 2601 UINT32 packetDetection = *pPdThreshold; 2602 2603 /* Setting the queue configuration into the HW */ 2604 status = (TI_STATUS)whal_hwInfoElemPacketDetectionThresholdSet (pHwCtrl->pHwMboxConfig, &packetDetection); 2605 2606 return status; 2607 } 2608 2609 2610 2611 /**************************************************************************** 2612 * whal_hwCtrl_SetBeaconFiltering 2613 **************************************************************************** 2614 * DESCRIPTION: Sets Beacon filtering state 2615 * 2616 * INPUTS: None 2617 * 2618 * OUTPUT: None 2619 * 2620 * RETURNS: OK or NOK 2621 ****************************************************************************/ 2622 int whal_hwCtrl_SetBeaconFiltering(HwCtrl_T *pHwCtrl, UINT8 beaconFilteringStatus, UINT8 numOfBeaconsToBuffer) 2623 { 2624 ACXBeaconFilterOptions_t AcxElm_BeaconFilterOptions; 2625 ACXBeaconFilterOptions_t *pCfg = &AcxElm_BeaconFilterOptions; 2626 2627 pCfg->enable = beaconFilteringStatus; 2628 pCfg->maxNumOfBeaconsStored = numOfBeaconsToBuffer; 2629 2630 WLAN_REPORT_DEBUG_CONTROL(pHwCtrl->hReport , ("Set beacon filter to %d" , beaconFilteringStatus) ) ; 2631 2632 return whal_hwInfoElemAcxBeaconFilterOptionsSet (pHwCtrl->pHwMboxConfig, pCfg); 2633 } 2634 2635 2636 /**************************************************************************** 2637 * whal_hwCtrl_SetBeaconFilterIETable 2638 **************************************************************************** 2639 * DESCRIPTION: Sets Beacon filtering state 2640 * 2641 * INPUTS: None 2642 * 2643 * OUTPUT: None 2644 * 2645 * RETURNS: OK or NOK 2646 ****************************************************************************/ 2647 int whal_hwCtrl_SetBeaconFilterIETable(HwCtrl_T *pHwCtrl, UINT8* numberOfIEs, UINT8 * IETable, UINT8* IETableSize) 2648 { 2649 int counter = 0 ; 2650 if ( NULL == pHwCtrl) 2651 { 2652 return PARAM_VALUE_NOT_VALID ; 2653 } 2654 2655 WLAN_REPORT_DEBUG_CONTROL(pHwCtrl->hReport, 2656 ("\n whal_hwCtrl_SetBeaconFilterIETable Beacon IE Table:\n")); 2657 2658 for ( counter = 0 ; counter < * IETableSize ; counter++) 2659 { 2660 WLAN_REPORT_DEBUG_CONTROL(pHwCtrl->hReport, 2661 ("%2.x " , IETable[counter])); 2662 } 2663 2664 WLAN_REPORT_DEBUG_CONTROL(pHwCtrl->hReport, 2665 ("\n ")); 2666 2667 2668 return whal_hwInfoElemAcxBeaconFilterIETableSet (pHwCtrl->pHwMboxConfig, 2669 numberOfIEs, 2670 IETable, 2671 IETableSize); 2672 } 2673 2674 2675 /**************************************************************************** 2676 * whal_HwCtrl_enableMboxAsyncMode() 2677 **************************************************************************** 2678 * DESCRIPTION: 2679 * 2680 * INPUTS: 2681 * 2682 * OUTPUT: 2683 * 2684 * RETURNS: OK, NOK 2685 * 2686 * NOTES: 2687 ****************************************************************************/ 2688 int whal_HwCtrl_enableMboxAsyncMode(HwCtrl_T *pHwCtrl) 2689 { 2690 eventMbox_InitComplete(pHwCtrl->hEventMbox); 2691 return OK; 2692 } 2693 2694 /**************************************************************************** 2695 * whal_HwCtrl_resetMacRx() 2696 **************************************************************************** 2697 * DESCRIPTION: Reset the Rx Max module 2698 * 2699 * INPUTS: 2700 * 2701 * OUTPUT: 2702 * 2703 * RETURNS: OK, NOK 2704 * 2705 * NOTES: 2706 ****************************************************************************/ 2707 int whal_HwCtrl_resetMacRx(HwCtrl_T *pHwCtrl) 2708 { 2709 return whal_hwMboxCmd_RxReset(pHwCtrl->pHwMboxCmd); 2710 } 2711 2712 /**************************************************************************** 2713 * whal_HwCtrl_LNAControl() 2714 **************************************************************************** 2715 * DESCRIPTION: Control the LNA (On <-> Off) 2716 * 2717 * INPUTS: 2718 * 2719 * OUTPUT: 2720 * 2721 * RETURNS: OK, NOK 2722 * 2723 * NOTES: 2724 ****************************************************************************/ 2725 int whal_HwCtrl_LNAControl(HwCtrl_T *pHwCtrl, UINT8 LNAControlField) 2726 { 2727 return whal_hwMboxCmd_LNAControl(pHwCtrl->pHwMboxCmd, LNAControlField); 2728 } 2729 2730 /**************************************************************************** 2731 * whal_hwCtrl_SwitchChannelCmd() 2732 **************************************************************************** 2733 * DESCRIPTION: Send Switch Channel command 2734 * 2735 * INPUTS: None 2736 * 2737 * OUTPUT: None 2738 * 2739 * RETURNS: OK or NOK 2740 ****************************************************************************/ 2741 int whal_hwCtrl_SwitchChannelCmd (HwCtrl_T *pHwCtrl, whalCtrl_switchChannelCmd_t* pSwitchChannelCmd) 2742 { 2743 WLAN_REPORT_INFORMATION(pHwCtrl->hReport, HAL_HW_CTRL_MODULE_LOG, 2744 ("whal_hwCtrl_SwitchChannelCmd\n")); 2745 return (whal_hwMboxCmd_SwitchChannelCmd (pHwCtrl->pHwMboxCmd, pSwitchChannelCmd)); 2746 } 2747 2748 /**************************************************************************** 2749 * whal_hwCtrl_SwitchChannelCmd() 2750 **************************************************************************** 2751 * DESCRIPTION: Send Switch Channel command 2752 * 2753 * INPUTS: None 2754 * 2755 * OUTPUT: None 2756 * 2757 * RETURNS: OK or NOK 2758 ****************************************************************************/ 2759 int whal_hwCtrl_SwitchChannelCancelCmd (HwCtrl_T *pHwCtrl) 2760 { 2761 WLAN_REPORT_INFORMATION(pHwCtrl->hReport, HAL_HW_CTRL_MODULE_LOG, 2762 ("whal_hwCtrl_SwitchChannelCmd\n")); 2763 return (whal_hwMboxCmd_SwitchChannelCancelCmd (pHwCtrl->pHwMboxCmd)); 2764 } 2765 2766 2767 /*----------------------------------------*/ 2768 /* Roaming Trigger Configuration Commands */ 2769 /*----------------------------------------*/ 2770 2771 /**************************************************************************** 2772 * whal_hwCtrl_SetSNRParameters() 2773 **************************************************************************** 2774 * DESCRIPTION: Set SNR parameters. 2775 * 2776 * INPUTS: 2777 * 2778 * OUTPUT: None 2779 * 2780 * RETURNS: None 2781 ****************************************************************************/ 2782 int whal_hwCtrl_SetSNRParams(HwCtrl_T *pHwCtrl, whalCtrl_roamingTriggerCmd_t* pRoamingTriggerCmd) 2783 { 2784 ACXLowSNRTriggerParameters_t AcxElm_LowThresholdOptions; 2785 AcxElm_LowThresholdOptions.SNRThreshold = pRoamingTriggerCmd->snrThreshold ; 2786 AcxElm_LowThresholdOptions.SNRFilterWeight = pRoamingTriggerCmd->snrFilterWeight ; 2787 AcxElm_LowThresholdOptions.SNRFilterDepth = pRoamingTriggerCmd->snrFilterDepth ; 2788 AcxElm_LowThresholdOptions.LowSNREventType = pRoamingTriggerCmd->lowSNREventType; 2789 2790 2791 return whal_hwInfoElemAcxLowSNRThresholdSet (pHwCtrl->pHwMboxConfig, &AcxElm_LowThresholdOptions); 2792 } 2793 2794 /**************************************************************************** 2795 * whal_hwCtrl_SetRSSIParameters() 2796 **************************************************************************** 2797 * DESCRIPTION: Set RSSI parameters used by the TNET for its calulation 2798 * that is used for generating of RSSI cross threshold interrupts. 2799 * 2800 * INPUTS: 2801 * 2802 * OUTPUT: None 2803 * 2804 * RETURNS: None 2805 ****************************************************************************/ 2806 int whal_hwCtrl_SetRSSIParams(HwCtrl_T *pHwCtrl, whalCtrl_roamingTriggerCmd_t* pRoamingTriggerCmd) 2807 { 2808 ACXLowRSSITriggerParameters_t AcxElm_LowRSSIThresholdOptions; 2809 ACXLowRSSITriggerParameters_t *pCfg = &AcxElm_LowRSSIThresholdOptions; 2810 2811 pCfg->rssiFilterDepth = pRoamingTriggerCmd->rssiFilterDepth; 2812 pCfg->rssiFilterWeight = pRoamingTriggerCmd->rssiFilterWeight; 2813 pCfg->rssiThreshold = pRoamingTriggerCmd->rssiThreshold; 2814 pCfg->LowRSSIEventType = pRoamingTriggerCmd->lowRSSIEventType; 2815 2816 return whal_hwInfoElemAcxLowRSSIThresholdSet (pHwCtrl->pHwMboxConfig, pCfg); 2817 } 2818 2819 /**************************************************************************** 2820 * whal_hwCtrl_SetMaxTxRetryParameters() 2821 **************************************************************************** 2822 * DESCRIPTION: Set Max Tx retry parmaters. 2823 * 2824 * INPUTS: 2825 * maxTxRetry max Tx Retry 2826 * 2827 * OUTPUT: None 2828 * 2829 * RETURNS: None 2830 ****************************************************************************/ 2831 int whal_hwCtrl_SetMaxTxRetryParams(HwCtrl_T *pHwCtrl, whalCtrl_roamingTriggerCmd_t* pRoamingTriggerCmd) 2832 { 2833 ACXConsTxFailureTriggerParameters_t AcxElm_MaxTxRetry; 2834 ACXConsTxFailureTriggerParameters_t *pCfg = &AcxElm_MaxTxRetry; 2835 2836 pCfg->maxTxRetry = pRoamingTriggerCmd->maxTxRetry; 2837 2838 return whal_hwInfoElemAcxSetMaxTxRetrySet (pHwCtrl->pHwMboxConfig, pCfg); 2839 } 2840 2841 2842 /**************************************************************************** 2843 * whal_hwCtrl_GetAsynRSSI () 2844 **************************************************************************** 2845 * DESCRIPTION: Get the Average RSSI 2846 * 2847 * INPUTS: 2848 * 2849 * OUTPUT: 2850 * 2851 * RETURNS: OK or NOK 2852 ****************************************************************************/ 2853 int whal_hwCtrl_GetAsynRSSI (HwCtrl_T *pHwCtrl,void *CB_Func, TI_HANDLE CB_handle, PUINT8 CB_Buf) 2854 { 2855 int Stt; 2856 2857 Stt = whal_hwInfoElemRSSIGet (pHwCtrl->pHwMboxConfig, CB_Func, CB_handle, CB_Buf); 2858 2859 return Stt; 2860 } 2861 2862 2863 2864 /**************************************************************************** 2865 * whal_hwCtrl_SetBssLossTsfThresholdParams() 2866 **************************************************************************** 2867 * DESCRIPTION: 2868 * 2869 * 2870 * 2871 * INPUTS: 2872 * 2873 * OUTPUT: None 2874 * 2875 * RETURNS: None 2876 ****************************************************************************/ 2877 int whal_hwCtrl_SetBssLossTsfThresholdParams( HwCtrl_T *pHwCtrl,whalCtrl_roamingTriggerCmd_t* pRoamingTriggerCmd) 2878 { 2879 AcxConnectionMonitorOptions AcxElm_BssLossTsfSynchronize; 2880 AcxConnectionMonitorOptions *pCfg = &AcxElm_BssLossTsfSynchronize; 2881 2882 pCfg->BSSLossTimeout = pRoamingTriggerCmd->BssLossTimeout; 2883 pCfg->TSFMissedThreshold = pRoamingTriggerCmd->TsfMissThreshold; 2884 2885 return whal_hwInfoElemAcxBssLossTsfThresholdSet (pHwCtrl->pHwMboxConfig, pCfg); 2886 } 2887 2888 /**************************************************************************** 2889 * whal_hwCtrl_FwDisconnect() 2890 **************************************************************************** 2891 * DESCRIPTION: Disconnect. 2892 * 2893 * INPUTS: None 2894 * 2895 * OUTPUT: None 2896 * 2897 * RETURNS: OK or NOK 2898 ****************************************************************************/ 2899 int whal_hwCtrl_FwDisconnect(HwCtrl_T *pHwCtrl, uint32 ConfigOptions, uint32 FilterOptions) 2900 { 2901 HwMboxCmd_T *pHwMboxCmd = pHwCtrl->pHwMboxCmd; 2902 2903 return whal_hwMboxCmd_FwDisconnect(pHwMboxCmd, ConfigOptions, FilterOptions); 2904 2905 } /* whal_hwCtrl_FwDisconnect()*/ 2906 2907 2908 2909 2910 /**************************************************************************** 2911 * whal_hwCtrl_measurementParams() 2912 **************************************************************************** 2913 * DESCRIPTION: send Command for measurement configuration 2914 * to the mailbox 2915 * 2916 * INPUTS: None 2917 * 2918 * OUTPUT: None 2919 * 2920 * RETURNS: OK or NOK 2921 ****************************************************************************/ 2922 int whal_hwCtrl_measurement (HwCtrl_T *pHwCtrl, whalCtrl_MeasurementParameters_t* pMeasurementParams, 2923 void* MeasureCommandResponseCB, TI_HANDLE CB_handle) 2924 { 2925 WLAN_REPORT_INFORMATION(pHwCtrl->hReport, HAL_HW_CTRL_MODULE_LOG, 2926 ("whal_hwCtrl_measurementParams\n")); 2927 return whal_hwMboxCmd_measurement (pHwCtrl->pHwMboxCmd, pMeasurementParams, 2928 MeasureCommandResponseCB, CB_handle); 2929 } 2930 2931 2932 /**************************************************************************** 2933 * whal_hwCtrl_measurementStop() 2934 **************************************************************************** 2935 * DESCRIPTION: send Command for stoping measurement 2936 * 2937 * INPUTS: None 2938 * 2939 * OUTPUT: None 2940 * 2941 * RETURNS: OK or NOK 2942 ****************************************************************************/ 2943 int whal_hwCtrl_measurementStop (HwCtrl_T *pHwCtrl, void* MeasureCommandResponseCB, TI_HANDLE CB_handle) 2944 { 2945 WLAN_REPORT_INFORMATION(pHwCtrl->hReport, HAL_HW_CTRL_MODULE_LOG, 2946 ("whal_hwCtrl_measurementStop\n")); 2947 2948 return whal_hwMboxCmd_measurementStop (pHwCtrl->pHwMboxCmd, MeasureCommandResponseCB, CB_handle); 2949 } 2950 2951 /**************************************************************************** 2952 * whal_hwCtrl_ApDiscovery() 2953 **************************************************************************** 2954 * DESCRIPTION: send Command for AP Discovery 2955 * to the mailbox 2956 * 2957 * INPUTS: None 2958 * 2959 * OUTPUT: None 2960 * 2961 * RETURNS: OK or NOK 2962 ****************************************************************************/ 2963 int whal_hwCtrl_ApDiscovery (HwCtrl_T *pHwCtrl, whalCtrl_ApDiscoveryParameters_t* pApDiscoveryParams) 2964 2965 { 2966 WLAN_REPORT_INFORMATION(pHwCtrl->hReport, HAL_HW_CTRL_MODULE_LOG, 2967 ("whal_hwCtrl_ApDiscovery\n")); 2968 2969 return( whal_hwMboxCmd_ApDiscovery (pHwCtrl->pHwMboxCmd, pApDiscoveryParams)); 2970 2971 } 2972 /**************************************************************************** 2973 * whal_hwCtrl_ApDiscoveryStop() 2974 **************************************************************************** 2975 * DESCRIPTION: send Command for stoping AP Discovery 2976 * 2977 * INPUTS: None 2978 * 2979 * OUTPUT: None 2980 * 2981 * RETURNS: OK or NOK 2982 ****************************************************************************/ 2983 int whal_hwCtrl_ApDiscoveryStop (HwCtrl_T *pHwCtrl) 2984 2985 2986 { 2987 WLAN_REPORT_INFORMATION(pHwCtrl->hReport, HAL_HW_CTRL_MODULE_LOG, 2988 ("whal_hwCtrl_ApDiscoveryStop\n")); 2989 2990 return(whal_hwMboxCmd_ApDiscoveryStop (pHwCtrl->pHwMboxCmd)); 2991 } 2992 2993 /**************************************************************************** 2994 * whal_hwCtrl_healthCheck() 2995 **************************************************************************** 2996 * DESCRIPTION: 2997 * 2998 * INPUTS: 2999 * 3000 * OUTPUT: 3001 * 3002 * RETURNS: 3003 ****************************************************************************/ 3004 int whal_hwCtrl_healthCheck (HwCtrl_T *pHwCtrl) 3005 { 3006 WLAN_REPORT_INFORMATION(pHwCtrl->hReport, HAL_HW_CTRL_MODULE_LOG, 3007 ("whal_hwMboxCmd_HealthCheck\n")); 3008 3009 return(whal_hwMboxCmd_HealthCheck(pHwCtrl->pHwMboxCmd)); 3010 } 3011 3012 3013 /**************************************************************************** 3014 * whal_hwCtrl_SoftGeminiEnable() 3015 **************************************************************************** 3016 * DESCRIPTION: Save Soft Gemini enable parameter 3017 * 3018 * INPUTS: 3019 * 3020 * OUTPUT: 3021 * 3022 * RETURNS: OK or NOK 3023 ****************************************************************************/ 3024 int whal_hwCtrl_SoftGeminiEnable (HwCtrl_T *pHwCtrl, 3025 SoftGeminiEnableModes_e SgEnable ) 3026 { 3027 /* copy params for recovery */ 3028 pHwCtrl->pWhalParams->WlanParams.SoftGeminiEnable = SgEnable; 3029 3030 return whal_hwInfoElemSoftGeminiEnableSet (pHwCtrl->pHwMboxConfig, SgEnable); 3031 } 3032 3033 /**************************************************************************** 3034 * whal_hwCtrl_SetSoftGeminiParams() 3035 **************************************************************************** 3036 * DESCRIPTION: Save Soft Gemini config parameter 3037 * 3038 * INPUTS: 3039 * 3040 * OUTPUT: 3041 * 3042 * RETURNS: OK or NOK 3043 ****************************************************************************/ 3044 int whal_hwCtrl_SetSoftGeminiParams (HwCtrl_T *pHwCtrl, 3045 SoftGeminiParam_t *SgParam ) 3046 { 3047 /* copy params for recovery */ 3048 os_memoryCopy(pHwCtrl->hOs,(void*)&pHwCtrl->pWhalParams->WlanParams.SoftGeminiParams, 3049 (void*)SgParam,sizeof(SoftGeminiParam_t)); 3050 3051 return whal_hwInfoElemSoftGeminiParamsSet (pHwCtrl->pHwMboxConfig,SgParam); 3052 } 3053 3054 /**************************************************************************** 3055 * whal_hwCtrl_GetSoftGeminiParams() 3056 **************************************************************************** 3057 * DESCRIPTION: Get Soft Gemini config parameter 3058 * 3059 * INPUTS: 3060 * 3061 * OUTPUT: 3062 * 3063 * RETURNS: OK or NOK 3064 ****************************************************************************/ 3065 int whal_hwCtrl_GetSoftGeminiParams (HwCtrl_T *pHwCtrl, void *CB_Func, TI_HANDLE CB_handle, void* CB_Buf) 3066 { 3067 return whal_hwInfoElemSoftGeminiParamsGet (pHwCtrl->pHwMboxConfig, CB_Func, CB_handle, CB_Buf); 3068 } 3069 /**************************************************************************** 3070 * whal_hwCtrl_GxRatePolicy() 3071 **************************************************************************** 3072 * DESCRIPTION: Get TxRatePolicy params 3073 * 3074 * INPUTS: None 3075 * 3076 * OUTPUT: None 3077 * 3078 * RETURNS: txRatePolicy_t* - the TX rate policy 3079 ****************************************************************************/ 3080 3081 txRatePolicy_t* whal_hwCtrl_GetTxRatePolicy(TI_HANDLE hHwCtrl) 3082 { 3083 HwCtrl_T *pHwCtrl = (HwCtrl_T*)hHwCtrl; 3084 return whal_ParamsGetTxRateClassParams(pHwCtrl->pWhalParams); 3085 } 3086 3087 3088 /**************************************************************************** 3089 * whal_hwCtrl_TxRatePolicy() 3090 **************************************************************************** 3091 * DESCRIPTION: configure TxRatePolicy params 3092 * 3093 * INPUTS: None 3094 * 3095 * OUTPUT: None 3096 * 3097 * RETURNS: OK or NOK 3098 ****************************************************************************/ 3099 3100 int whal_hwCtrl_TxRatePolicy(TI_HANDLE hHwCtrl,txRatePolicy_t *pTxRatePolicy) 3101 { 3102 TI_STATUS status = NOK; 3103 HwCtrl_T *pHwCtrl = (HwCtrl_T*)hHwCtrl; 3104 3105 UINT8 index; 3106 txRateClass_t *pTxRateClass = pTxRatePolicy->rateClass; 3107 3108 WLAN_REPORT_DEBUG_CONTROL(pHwCtrl->hReport, 3109 ("%s_1, Num of classes = 0x%x\n",__FUNCTION__, pTxRatePolicy->numOfRateClasses)); 3110 3111 for(index = 0; index < pTxRatePolicy->numOfRateClasses; index++, pTxRateClass++) 3112 { 3113 WLAN_REPORT_DEBUG_CONTROL(pHwCtrl->hReport, 3114 ("%s_2loop, Index = %d, Short R = 0x%x, Long R = 0x%x, Flags = 0x%x Rates(HexDump) = \n", 3115 __FUNCTION__, index, 3116 pTxRateClass->shortRetryLimit, pTxRateClass->longRetryLimit, pTxRateClass->flags)); 3117 3118 WLAN_REPORT_HEX_INFORMATION(pHwCtrl->hReport, 3119 HAL_HW_CTRL_MODULE_LOG, 3120 (PUINT8)pTxRateClass->txRate, sizeof(pTxRateClass->txRate)); 3121 } 3122 3123 /* Setting Rate Policy configuration into the HW */ 3124 status = (TI_STATUS)whal_hwInfoElemTxRatePolicyConfigurationSet (pHwCtrl->pHwMboxConfig, pTxRatePolicy); 3125 3126 /* Set the Policy param object database fields according to the succeeded configuration (for recovery) */ 3127 if (status == OK) 3128 { 3129 whal_ParamsSetTxRateClassParams(pHwCtrl->pWhalParams,(txRatePolicy_t *)pTxRatePolicy); 3130 } 3131 3132 return status; 3133 } 3134 3135 3136 /**************************************************************************** 3137 * whal_hwCtrl_ReJoinBss() 3138 **************************************************************************** 3139 * DESCRIPTION: 3140 * 3141 * INPUTS: None 3142 * 3143 * OUTPUT: None 3144 * 3145 * RETURNS: OK or NOK 3146 ****************************************************************************/ 3147 int whal_hwCtrl_ReJoinBss (TI_HANDLE hHwCtrl) 3148 { 3149 HwCtrl_T *pHwCtrl = (HwCtrl_T*)hHwCtrl; 3150 BssInfoParams_T *pBssInfoParams = &pHwCtrl->pWhalParams->BssInfoParams; 3151 TemplateListParams_T *pWhalTemplates = &pHwCtrl->pWhalParams->TemplateList; 3152 HwMboxCmd_T *pHwCmd = whal_hwCtrl_GetMboxCmd (pHwCtrl); 3153 3154 /* 3155 * Set the templates 3156 */ 3157 if (pWhalTemplates->Beacon.Size != 0) 3158 whal_hwMboxCmd_ConfigureTemplateFrame (pHwCmd, 3159 pWhalTemplates->Beacon.Buffer, 3160 (UINT16)pWhalTemplates->Beacon.Size, 3161 CMD_BEACON, 3162 NULL, 3163 NULL); 3164 3165 if (pWhalTemplates->ProbeResp.Size != 0) 3166 whal_hwMboxCmd_ConfigureTemplateFrame (pHwCmd, 3167 pWhalTemplates->ProbeResp.Buffer, 3168 (UINT16)pWhalTemplates->ProbeResp.Size, 3169 CMD_PROBE_RESP, 3170 NULL, 3171 NULL); 3172 3173 if (pWhalTemplates->ProbeReq.Size != 0) 3174 whal_hwMboxCmd_ConfigureTemplateFrame (pHwCmd, 3175 pWhalTemplates->ProbeReq.Buffer, 3176 (UINT16)pWhalTemplates->ProbeReq.Size, 3177 CMD_PROBE_REQ, 3178 NULL, 3179 NULL); 3180 3181 if (pWhalTemplates->NullData.Size != 0) 3182 whal_hwMboxCmd_ConfigureTemplateFrame (pHwCmd, 3183 pWhalTemplates->NullData.Buffer, 3184 (UINT16)pWhalTemplates->NullData.Size, 3185 CMD_NULL_DATA, 3186 NULL, 3187 NULL); 3188 3189 if (pWhalTemplates->PsPoll.Size != 0) 3190 whal_hwMboxCmd_ConfigureTemplateFrame (pHwCmd, 3191 pWhalTemplates->PsPoll.Buffer, 3192 (UINT16)pWhalTemplates->PsPoll.Size, 3193 CMD_PS_POLL, 3194 NULL, 3195 NULL); 3196 3197 /* 3198 * Call the hardware to start/join the BSS 3199 */ 3200 return whal_hwCtrl_StartJoin (pHwCtrl, (bssType_e)pBssInfoParams->ReqBssType, NULL, NULL); 3201 } 3202 3203 /**************************************************************************** 3204 * whal_hwCtrl_setBetParams() 3205 **************************************************************************** 3206 * DESCRIPTION: Configures Beacon Early Termination information element. 3207 * 3208 * Input : enabled - 0 to disable BET, 0 to disable BET 3209 * MaximumConsecutiveET - Max number of consecutive beacons 3210 * that may be early terminated. 3211 * OUTPUT: None 3212 * 3213 * RETURNS: OK or NOK 3214 ****************************************************************************/ 3215 int whal_hwCtrl_setBetParams(HwCtrl_T * pHwCtrl, UINT8 Enable, UINT8 MaximumConsecutiveET) 3216 { 3217 return whal_hwInfoElemBETSet(pHwCtrl->pHwMboxConfig, Enable, MaximumConsecutiveET); 3218 } 3219 3220 3221