164064216a8433360745f69edddce19a606659163The Android Open Source Project/** \file softGemini.c
264064216a8433360745f69edddce19a606659163The Android Open Source Project *  \brief BlueTooth-Wlan coexistence module interface
364064216a8433360745f69edddce19a606659163The Android Open Source Project *
464064216a8433360745f69edddce19a606659163The Android Open Source Project *  \see softGemini.h
564064216a8433360745f69edddce19a606659163The Android Open Source Project */
664064216a8433360745f69edddce19a606659163The Android Open Source Project/****************************************************************************
764064216a8433360745f69edddce19a606659163The Android Open Source Project**+-----------------------------------------------------------------------+**
864064216a8433360745f69edddce19a606659163The Android Open Source Project**|                                                                       |**
964064216a8433360745f69edddce19a606659163The Android Open Source Project**| Copyright(c) 1998 - 2008 Texas Instruments. All rights reserved.      |**
1064064216a8433360745f69edddce19a606659163The Android Open Source Project**| All rights reserved.                                                  |**
1164064216a8433360745f69edddce19a606659163The Android Open Source Project**|                                                                       |**
1264064216a8433360745f69edddce19a606659163The Android Open Source Project**| Redistribution and use in source and binary forms, with or without    |**
1364064216a8433360745f69edddce19a606659163The Android Open Source Project**| modification, are permitted provided that the following conditions    |**
1464064216a8433360745f69edddce19a606659163The Android Open Source Project**| are met:                                                              |**
1564064216a8433360745f69edddce19a606659163The Android Open Source Project**|                                                                       |**
1664064216a8433360745f69edddce19a606659163The Android Open Source Project**|  * Redistributions of source code must retain the above copyright     |**
1764064216a8433360745f69edddce19a606659163The Android Open Source Project**|    notice, this list of conditions and the following disclaimer.      |**
1864064216a8433360745f69edddce19a606659163The Android Open Source Project**|  * Redistributions in binary form must reproduce the above copyright  |**
1964064216a8433360745f69edddce19a606659163The Android Open Source Project**|    notice, this list of conditions and the following disclaimer in    |**
2064064216a8433360745f69edddce19a606659163The Android Open Source Project**|    the documentation and/or other materials provided with the         |**
2164064216a8433360745f69edddce19a606659163The Android Open Source Project**|    distribution.                                                      |**
2264064216a8433360745f69edddce19a606659163The Android Open Source Project**|  * Neither the name Texas Instruments nor the names of its            |**
2364064216a8433360745f69edddce19a606659163The Android Open Source Project**|    contributors may be used to endorse or promote products derived    |**
2464064216a8433360745f69edddce19a606659163The Android Open Source Project**|    from this software without specific prior written permission.      |**
2564064216a8433360745f69edddce19a606659163The Android Open Source Project**|                                                                       |**
2664064216a8433360745f69edddce19a606659163The Android Open Source Project**| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS   |**
2764064216a8433360745f69edddce19a606659163The Android Open Source Project**| "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT     |**
2864064216a8433360745f69edddce19a606659163The Android Open Source Project**| LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |**
2964064216a8433360745f69edddce19a606659163The Android Open Source Project**| A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT  |**
3064064216a8433360745f69edddce19a606659163The Android Open Source Project**| OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |**
3164064216a8433360745f69edddce19a606659163The Android Open Source Project**| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT      |**
3264064216a8433360745f69edddce19a606659163The Android Open Source Project**| LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |**
3364064216a8433360745f69edddce19a606659163The Android Open Source Project**| DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |**
3464064216a8433360745f69edddce19a606659163The Android Open Source Project**| THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT   |**
3564064216a8433360745f69edddce19a606659163The Android Open Source Project**| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |**
3664064216a8433360745f69edddce19a606659163The Android Open Source Project**| OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  |**
3764064216a8433360745f69edddce19a606659163The Android Open Source Project**|                                                                       |**
3864064216a8433360745f69edddce19a606659163The Android Open Source Project**+-----------------------------------------------------------------------+**
3964064216a8433360745f69edddce19a606659163The Android Open Source Project****************************************************************************/
4064064216a8433360745f69edddce19a606659163The Android Open Source Project
4164064216a8433360745f69edddce19a606659163The Android Open Source Project/****************************************************************************************************
4264064216a8433360745f69edddce19a606659163The Android Open Source Project*																									*
4364064216a8433360745f69edddce19a606659163The Android Open Source Project*		MODULE:		softGemini.c																	*
4464064216a8433360745f69edddce19a606659163The Android Open Source Project*		PURPOSE:	BlueTooth-Wlan coexistence module interface.							*
4564064216a8433360745f69edddce19a606659163The Android Open Source Project*					This module handles all data base (and Fw setting accordingly)					*
4664064216a8433360745f69edddce19a606659163The Android Open Source Project*					for Bluetooth-Wlan coexistence implementation.									*
4764064216a8433360745f69edddce19a606659163The Android Open Source Project*																						 			*
4864064216a8433360745f69edddce19a606659163The Android Open Source Project****************************************************************************************************/
4964064216a8433360745f69edddce19a606659163The Android Open Source Project
5064064216a8433360745f69edddce19a606659163The Android Open Source Project#include "report.h"
5164064216a8433360745f69edddce19a606659163The Android Open Source Project#include "osApi.h"
5264064216a8433360745f69edddce19a606659163The Android Open Source Project#include "SoftGemini.h"
5364064216a8433360745f69edddce19a606659163The Android Open Source Project#include "whalCtrl_api.h"
5464064216a8433360745f69edddce19a606659163The Android Open Source Project#include "DataCtrl_Api.h"
5564064216a8433360745f69edddce19a606659163The Android Open Source Project#include "scrApi.h"
5664064216a8433360745f69edddce19a606659163The Android Open Source Project#include "PowerMgr_API.h"
5764064216a8433360745f69edddce19a606659163The Android Open Source Project#include "srcApi.h"
5864064216a8433360745f69edddce19a606659163The Android Open Source Project#include "ScanCncnApi.h"
5964064216a8433360745f69edddce19a606659163The Android Open Source Project#include "currBss.h"
6064064216a8433360745f69edddce19a606659163The Android Open Source Project#include "bssTypes.h"
6164064216a8433360745f69edddce19a606659163The Android Open Source Project#include "EvHandler.h"
6264064216a8433360745f69edddce19a606659163The Android Open Source Project
6364064216a8433360745f69edddce19a606659163The Android Open Source Project
6464064216a8433360745f69edddce19a606659163The Android Open Source Project#define SENSE_MODE_ENABLE		0x01
6564064216a8433360745f69edddce19a606659163The Android Open Source Project#define SENSE_MODE_DISABLE		0x00
6664064216a8433360745f69edddce19a606659163The Android Open Source Project#define PROTECTIVE_MODE_ON		0x01
6764064216a8433360745f69edddce19a606659163The Android Open Source Project#define PROTECTIVE_MODE_OFF		0x00
6864064216a8433360745f69edddce19a606659163The Android Open Source Project
6964064216a8433360745f69edddce19a606659163The Android Open Source Project/********************************************************************************/
7064064216a8433360745f69edddce19a606659163The Android Open Source Project/*						Internal functions prototypes.							*/
7164064216a8433360745f69edddce19a606659163The Android Open Source Project/********************************************************************************/
7264064216a8433360745f69edddce19a606659163The Android Open Source Project
7364064216a8433360745f69edddce19a606659163The Android Open Source Projectstatic TI_STATUS SoftGemini_setEnableParam(TI_HANDLE hSoftGemini, SoftGeminiEnableModes_e SoftGeminiEnable, BOOL recovery);
7464064216a8433360745f69edddce19a606659163The Android Open Source Projectstatic TI_STATUS SoftGemini_setRateParam(TI_HANDLE hSoftGemini, UINT8 *pRates);
7564064216a8433360745f69edddce19a606659163The Android Open Source Projectstatic TI_STATUS SoftGemini_setParamsToFW(TI_HANDLE hSoftGemini, SoftGeminiParam_t *SoftGeminiParam);
7664064216a8433360745f69edddce19a606659163The Android Open Source Projectstatic void SoftGemini_setConfigParam(TI_HANDLE hSoftGemini, UINT32 *param);
7764064216a8433360745f69edddce19a606659163The Android Open Source Projectstatic TI_STATUS SoftGemini_EnableDriver(TI_HANDLE hSoftGemini);
7864064216a8433360745f69edddce19a606659163The Android Open Source Projectstatic TI_STATUS SoftGemini_DisableDriver(TI_HANDLE hSoftGemini);
7964064216a8433360745f69edddce19a606659163The Android Open Source Projectstatic void SoftGemini_EnableProtectiveMode(TI_HANDLE hSoftGemini);
8064064216a8433360745f69edddce19a606659163The Android Open Source Projectstatic void SoftGemini_DisableProtectiveMode(TI_HANDLE hSoftGemini);
8164064216a8433360745f69edddce19a606659163The Android Open Source Projectstatic void SoftGemini_RemoveProtectiveModeParameters(TI_HANDLE hSoftGemini);
8264064216a8433360745f69edddce19a606659163The Android Open Source Projectstatic void SoftGemini_reconnect(TI_HANDLE hSoftGemini);
8364064216a8433360745f69edddce19a606659163The Android Open Source Projectstatic TI_STATUS SoftGemini_SetPS(SoftGemini_t	*pSoftGemini);
8464064216a8433360745f69edddce19a606659163The Android Open Source Projectstatic TI_STATUS SoftGemini_unSetPS(SoftGemini_t	*pSoftGemini);
8564064216a8433360745f69edddce19a606659163The Android Open Source Project
8664064216a8433360745f69edddce19a606659163The Android Open Source Project#ifdef REPORT_LOG
8764064216a8433360745f69edddce19a606659163The Android Open Source Projectstatic char* SoftGemini_ConvertModeToString(SoftGeminiEnableModes_e SoftGeminiEnable);
8864064216a8433360745f69edddce19a606659163The Android Open Source Project#endif
8964064216a8433360745f69edddce19a606659163The Android Open Source Project
9064064216a8433360745f69edddce19a606659163The Android Open Source Project/********************************************************************************/
9164064216a8433360745f69edddce19a606659163The Android Open Source Project/*						Interface functions Implementation.						*/
9264064216a8433360745f69edddce19a606659163The Android Open Source Project/********************************************************************************/
9364064216a8433360745f69edddce19a606659163The Android Open Source Project
9464064216a8433360745f69edddce19a606659163The Android Open Source Project/************************************************************************
9564064216a8433360745f69edddce19a606659163The Android Open Source Project *                        SoftGemini_SetPSmode									*
9664064216a8433360745f69edddce19a606659163The Android Open Source Project ************************************************************************
9764064216a8433360745f69edddce19a606659163The Android Open Source ProjectDESCRIPTION: SoftGemini module, called by the conn_Infra on connection
9864064216a8433360745f69edddce19a606659163The Android Open Source Project				performs the following:
9964064216a8433360745f69edddce19a606659163The Android Open Source Project				-	Enables SG if needed
10064064216a8433360745f69edddce19a606659163The Android Open Source Project                                -       Enables the SG power mode
10164064216a8433360745f69edddce19a606659163The Android Open Source ProjectINPUT:      hSoftGemini -		Handle to SoftGemini
10264064216a8433360745f69edddce19a606659163The Android Open Source Project
10364064216a8433360745f69edddce19a606659163The Android Open Source ProjectOUTPUT:
10464064216a8433360745f69edddce19a606659163The Android Open Source Project
10564064216a8433360745f69edddce19a606659163The Android Open Source ProjectRETURN:
10664064216a8433360745f69edddce19a606659163The Android Open Source Project
10764064216a8433360745f69edddce19a606659163The Android Open Source Project************************************************************************/
10864064216a8433360745f69edddce19a606659163The Android Open Source Projectvoid SoftGemini_SetPSmode(TI_HANDLE hSoftGemini)
10964064216a8433360745f69edddce19a606659163The Android Open Source Project{
11064064216a8433360745f69edddce19a606659163The Android Open Source Project	SoftGemini_t *pSoftGemini = (SoftGemini_t *)hSoftGemini;
11164064216a8433360745f69edddce19a606659163The Android Open Source Project
11264064216a8433360745f69edddce19a606659163The Android Open Source Project	if (pSoftGemini)
11364064216a8433360745f69edddce19a606659163The Android Open Source Project	{
11464064216a8433360745f69edddce19a606659163The Android Open Source Project		if (pSoftGemini->bDriverEnabled)
11564064216a8433360745f69edddce19a606659163The Android Open Source Project		{
11664064216a8433360745f69edddce19a606659163The Android Open Source Project			SoftGemini_SetPS(pSoftGemini);
11764064216a8433360745f69edddce19a606659163The Android Open Source Project		}
11864064216a8433360745f69edddce19a606659163The Android Open Source Project		if (pSoftGemini->bProtectiveMode)
11964064216a8433360745f69edddce19a606659163The Android Open Source Project		{
12064064216a8433360745f69edddce19a606659163The Android Open Source Project			SoftGemini_EnableProtectiveMode(hSoftGemini);
12164064216a8433360745f69edddce19a606659163The Android Open Source Project		}
12264064216a8433360745f69edddce19a606659163The Android Open Source Project	}
12364064216a8433360745f69edddce19a606659163The Android Open Source Project	else WLAN_REPORT_ERROR(pSoftGemini->hReport, SOFT_GEMINI_MODULE_LOG,  ("  SoftGemini_SetPSmode() - Error hSoftGemini= NULL \n"));
12464064216a8433360745f69edddce19a606659163The Android Open Source Project}
12564064216a8433360745f69edddce19a606659163The Android Open Source Project
12664064216a8433360745f69edddce19a606659163The Android Open Source Project/************************************************************************
12764064216a8433360745f69edddce19a606659163The Android Open Source Project *                        SoftGemini_unSetPSmode									*
12864064216a8433360745f69edddce19a606659163The Android Open Source Project ************************************************************************
12964064216a8433360745f69edddce19a606659163The Android Open Source ProjectDESCRIPTION: SoftGemini module, called by the conn_Infra after disconnecting
13064064216a8433360745f69edddce19a606659163The Android Open Source Project				performs the following:
13164064216a8433360745f69edddce19a606659163The Android Open Source Project				-	Disables the SG
13264064216a8433360745f69edddce19a606659163The Android Open Source Project                                -       Disables the SG power mode
13364064216a8433360745f69edddce19a606659163The Android Open Source ProjectINPUT:      hSoftGemini -		Handle to SoftGemini
13464064216a8433360745f69edddce19a606659163The Android Open Source Project
13564064216a8433360745f69edddce19a606659163The Android Open Source ProjectOUTPUT:
13664064216a8433360745f69edddce19a606659163The Android Open Source Project
13764064216a8433360745f69edddce19a606659163The Android Open Source ProjectRETURN:
13864064216a8433360745f69edddce19a606659163The Android Open Source Project
13964064216a8433360745f69edddce19a606659163The Android Open Source Project************************************************************************/
14064064216a8433360745f69edddce19a606659163The Android Open Source Projectvoid SoftGemini_unSetPSmode(TI_HANDLE hSoftGemini)
14164064216a8433360745f69edddce19a606659163The Android Open Source Project{
14264064216a8433360745f69edddce19a606659163The Android Open Source Project	SoftGemini_t *pSoftGemini = (SoftGemini_t *)hSoftGemini;
14364064216a8433360745f69edddce19a606659163The Android Open Source Project
14464064216a8433360745f69edddce19a606659163The Android Open Source Project    if (pSoftGemini)
14564064216a8433360745f69edddce19a606659163The Android Open Source Project	{
14664064216a8433360745f69edddce19a606659163The Android Open Source Project		if (pSoftGemini->bDriverEnabled)
14764064216a8433360745f69edddce19a606659163The Android Open Source Project		{
14864064216a8433360745f69edddce19a606659163The Android Open Source Project			SoftGemini_unSetPS(pSoftGemini);
14964064216a8433360745f69edddce19a606659163The Android Open Source Project		}
15064064216a8433360745f69edddce19a606659163The Android Open Source Project	}
15164064216a8433360745f69edddce19a606659163The Android Open Source Project	else WLAN_REPORT_ERROR(pSoftGemini->hReport, SOFT_GEMINI_MODULE_LOG,  (" SoftGemini_unSetPSmode() - Error hSoftGemini= NULL \n"));
15264064216a8433360745f69edddce19a606659163The Android Open Source Project}
15364064216a8433360745f69edddce19a606659163The Android Open Source Project
15464064216a8433360745f69edddce19a606659163The Android Open Source Project/************************************************************************
15564064216a8433360745f69edddce19a606659163The Android Open Source Project *                        SoftGemini_create									*
15664064216a8433360745f69edddce19a606659163The Android Open Source Project ************************************************************************
15764064216a8433360745f69edddce19a606659163The Android Open Source ProjectDESCRIPTION: SoftGemini module creation function, called by the config mgr in creation phase
15864064216a8433360745f69edddce19a606659163The Android Open Source Project				performs the following:
15964064216a8433360745f69edddce19a606659163The Android Open Source Project				-	Allocate the SoftGemini handle
16064064216a8433360745f69edddce19a606659163The Android Open Source Project
16164064216a8433360745f69edddce19a606659163The Android Open Source ProjectINPUT:      hOs -			Handle to OS
16264064216a8433360745f69edddce19a606659163The Android Open Source Project
16364064216a8433360745f69edddce19a606659163The Android Open Source Project
16464064216a8433360745f69edddce19a606659163The Android Open Source ProjectOUTPUT:
16564064216a8433360745f69edddce19a606659163The Android Open Source Project
16664064216a8433360745f69edddce19a606659163The Android Open Source ProjectRETURN:     Handle to the SoftGemini module on success, NULL otherwise
16764064216a8433360745f69edddce19a606659163The Android Open Source Project
16864064216a8433360745f69edddce19a606659163The Android Open Source Project************************************************************************/
16964064216a8433360745f69edddce19a606659163The Android Open Source ProjectTI_HANDLE SoftGemini_create(TI_HANDLE hOs)
17064064216a8433360745f69edddce19a606659163The Android Open Source Project{
17164064216a8433360745f69edddce19a606659163The Android Open Source Project	SoftGemini_t			*pSoftGemini = NULL;
17264064216a8433360745f69edddce19a606659163The Android Open Source Project
17364064216a8433360745f69edddce19a606659163The Android Open Source Project	/* allocating the SoftGemini object */
17464064216a8433360745f69edddce19a606659163The Android Open Source Project	pSoftGemini = os_memoryAlloc(hOs,sizeof(SoftGemini_t));
17564064216a8433360745f69edddce19a606659163The Android Open Source Project
17664064216a8433360745f69edddce19a606659163The Android Open Source Project	if (pSoftGemini == NULL)
17764064216a8433360745f69edddce19a606659163The Android Open Source Project		return NULL;
17864064216a8433360745f69edddce19a606659163The Android Open Source Project
17964064216a8433360745f69edddce19a606659163The Android Open Source Project	pSoftGemini->hOs = hOs;
18064064216a8433360745f69edddce19a606659163The Android Open Source Project
18164064216a8433360745f69edddce19a606659163The Android Open Source Project	return pSoftGemini;
18264064216a8433360745f69edddce19a606659163The Android Open Source Project}
18364064216a8433360745f69edddce19a606659163The Android Open Source Project
18464064216a8433360745f69edddce19a606659163The Android Open Source Project/************************************************************************
18564064216a8433360745f69edddce19a606659163The Android Open Source Project *                        SoftGemini_config						*
18664064216a8433360745f69edddce19a606659163The Android Open Source Project ************************************************************************
18764064216a8433360745f69edddce19a606659163The Android Open Source ProjectDESCRIPTION: SoftGemini module configuration function, called by the config mgr in configuration phase
18864064216a8433360745f69edddce19a606659163The Android Open Source Project				performs the following:
18964064216a8433360745f69edddce19a606659163The Android Open Source Project				-	Reset & initializes local variables
19064064216a8433360745f69edddce19a606659163The Android Open Source Project				-	Init the handles to be used by the module
19164064216a8433360745f69edddce19a606659163The Android Open Source Project
19264064216a8433360745f69edddce19a606659163The Android Open Source ProjectINPUT:      hSoftGemini	-	SoftGemini handle
19364064216a8433360745f69edddce19a606659163The Android Open Source Project			List of handles to be used by the module
19464064216a8433360745f69edddce19a606659163The Android Open Source Project			pSoftGeminiInitParams	-	Init table of the module.
19564064216a8433360745f69edddce19a606659163The Android Open Source Project
19664064216a8433360745f69edddce19a606659163The Android Open Source Project
19764064216a8433360745f69edddce19a606659163The Android Open Source ProjectOUTPUT:
19864064216a8433360745f69edddce19a606659163The Android Open Source Project
19964064216a8433360745f69edddce19a606659163The Android Open Source ProjectRETURN:     OK on success, NOK otherwise
20064064216a8433360745f69edddce19a606659163The Android Open Source Project
20164064216a8433360745f69edddce19a606659163The Android Open Source Project************************************************************************/
20264064216a8433360745f69edddce19a606659163The Android Open Source Project
20364064216a8433360745f69edddce19a606659163The Android Open Source ProjectTI_STATUS SoftGemini_config(	TI_HANDLE		hSoftGemini,
20464064216a8433360745f69edddce19a606659163The Android Open Source Project								TI_HANDLE		hCtrlData,
20564064216a8433360745f69edddce19a606659163The Android Open Source Project					  			TI_HANDLE		hHalCtrl,
20664064216a8433360745f69edddce19a606659163The Android Open Source Project								TI_HANDLE		hReport,
20764064216a8433360745f69edddce19a606659163The Android Open Source Project								TI_HANDLE		hSCR,
20864064216a8433360745f69edddce19a606659163The Android Open Source Project								TI_HANDLE		hPowerMgr,
20964064216a8433360745f69edddce19a606659163The Android Open Source Project								TI_HANDLE		hConfigMgr,
21064064216a8433360745f69edddce19a606659163The Android Open Source Project								TI_HANDLE		hScanCncn,
21164064216a8433360745f69edddce19a606659163The Android Open Source Project								TI_HANDLE		hCurrBss,
21264064216a8433360745f69edddce19a606659163The Android Open Source Project								TI_HANDLE		hEvHandler,
21364064216a8433360745f69edddce19a606659163The Android Open Source Project								SoftGeminiInitParams_t *pSoftGeminiInitParams)
21464064216a8433360745f69edddce19a606659163The Android Open Source Project{
21564064216a8433360745f69edddce19a606659163The Android Open Source Project	SoftGemini_t *pSoftGemini = (SoftGemini_t *)hSoftGemini;
21664064216a8433360745f69edddce19a606659163The Android Open Source Project	TI_STATUS status;
21764064216a8433360745f69edddce19a606659163The Android Open Source Project
21864064216a8433360745f69edddce19a606659163The Android Open Source Project	/*******************/
21964064216a8433360745f69edddce19a606659163The Android Open Source Project	/* init Handles */
22064064216a8433360745f69edddce19a606659163The Android Open Source Project	/*****************/
22164064216a8433360745f69edddce19a606659163The Android Open Source Project
22264064216a8433360745f69edddce19a606659163The Android Open Source Project	pSoftGemini->hCtrlData  = hCtrlData;
22364064216a8433360745f69edddce19a606659163The Android Open Source Project	pSoftGemini->hHalCtrl	= hHalCtrl;
22464064216a8433360745f69edddce19a606659163The Android Open Source Project	pSoftGemini->hReport	= hReport;
22564064216a8433360745f69edddce19a606659163The Android Open Source Project	pSoftGemini->hSCR       = hSCR;
22664064216a8433360745f69edddce19a606659163The Android Open Source Project	pSoftGemini->hPowerMgr  = hPowerMgr;
22764064216a8433360745f69edddce19a606659163The Android Open Source Project	pSoftGemini->hConfigMgr = hConfigMgr;
22864064216a8433360745f69edddce19a606659163The Android Open Source Project	pSoftGemini->hScanCncn  = hScanCncn;
22964064216a8433360745f69edddce19a606659163The Android Open Source Project	pSoftGemini->hCurrBss	= hCurrBss;
23064064216a8433360745f69edddce19a606659163The Android Open Source Project	pSoftGemini->hEvHandler= hEvHandler;
23164064216a8433360745f69edddce19a606659163The Android Open Source Project
23264064216a8433360745f69edddce19a606659163The Android Open Source Project	/*************************************/
23364064216a8433360745f69edddce19a606659163The Android Open Source Project	/* Getting SoftGemini init Params */
23464064216a8433360745f69edddce19a606659163The Android Open Source Project	/***********************************/
23564064216a8433360745f69edddce19a606659163The Android Open Source Project
23664064216a8433360745f69edddce19a606659163The Android Open Source Project	SoftGemini_setRateParam(hSoftGemini,pSoftGeminiInitParams->SoftGeminiRate);
23764064216a8433360745f69edddce19a606659163The Android Open Source Project
23864064216a8433360745f69edddce19a606659163The Android Open Source Project	/* read parameters for scan but no need to use them yet, only used when we enable/disable driver */
23964064216a8433360745f69edddce19a606659163The Android Open Source Project	pSoftGemini->scanNumOfProbeRequest   = pSoftGeminiInitParams->scanNumOfProbeRequest;
24064064216a8433360745f69edddce19a606659163The Android Open Source Project	pSoftGemini->scanCompensationPercent = pSoftGeminiInitParams->scanCompensationPercent;
24164064216a8433360745f69edddce19a606659163The Android Open Source Project	pSoftGemini->scanCompensationMaxTime = pSoftGeminiInitParams->scanCompensationMaxTime;
24264064216a8433360745f69edddce19a606659163The Android Open Source Project	pSoftGemini->BSSLossCompensationPercent = pSoftGeminiInitParams->BSSLossCompensationPercent;
24364064216a8433360745f69edddce19a606659163The Android Open Source Project
24464064216a8433360745f69edddce19a606659163The Android Open Source Project	os_memoryCopy(hSoftGemini,&pSoftGemini->SoftGeminiParam,&pSoftGeminiInitParams->SoftGeminiParam,sizeof(SoftGeminiParam_t));
24564064216a8433360745f69edddce19a606659163The Android Open Source Project	/* Send the configuration to the FW */
24664064216a8433360745f69edddce19a606659163The Android Open Source Project	status = SoftGemini_setParamsToFW(hSoftGemini, &pSoftGemini->SoftGeminiParam);
24764064216a8433360745f69edddce19a606659163The Android Open Source Project
24864064216a8433360745f69edddce19a606659163The Android Open Source Project	/*******************************/
24964064216a8433360745f69edddce19a606659163The Android Open Source Project    /* register Indication interrupts  */
25064064216a8433360745f69edddce19a606659163The Android Open Source Project	/*****************************/
25164064216a8433360745f69edddce19a606659163The Android Open Source Project
25264064216a8433360745f69edddce19a606659163The Android Open Source Project    whalCtrl_EventMbox_RegisterForEvent( pSoftGemini->hHalCtrl,
25364064216a8433360745f69edddce19a606659163The Android Open Source Project                                         HAL_EVENT_SOFT_GEMINI_SENSE,
25464064216a8433360745f69edddce19a606659163The Android Open Source Project                                         (void *)SoftGemini_SenseIndicationCB,
25564064216a8433360745f69edddce19a606659163The Android Open Source Project                                         hSoftGemini );
25664064216a8433360745f69edddce19a606659163The Android Open Source Project	whalCtrl_EventMbox_RegisterForEvent( pSoftGemini->hHalCtrl,
25764064216a8433360745f69edddce19a606659163The Android Open Source Project                                         HAL_EVENT_SOFT_GEMINI_PREDICTION,
25864064216a8433360745f69edddce19a606659163The Android Open Source Project                                         (void *)SoftGemini_ProtectiveIndicationCB,
25964064216a8433360745f69edddce19a606659163The Android Open Source Project                                         hSoftGemini );
26064064216a8433360745f69edddce19a606659163The Android Open Source Project
26164064216a8433360745f69edddce19a606659163The Android Open Source Project	whalCtrl_EventMbox_RegisterForEvent( pSoftGemini->hHalCtrl,
26264064216a8433360745f69edddce19a606659163The Android Open Source Project                                         HAL_EVENT_SOFT_GEMINI_AVALANCHE,
26364064216a8433360745f69edddce19a606659163The Android Open Source Project                                         (void *)SoftGemini_AvalancheIndicationCB,
26464064216a8433360745f69edddce19a606659163The Android Open Source Project                                         hSoftGemini );
26564064216a8433360745f69edddce19a606659163The Android Open Source Project
26664064216a8433360745f69edddce19a606659163The Android Open Source Project    whalCtrl_EventMbox_Enable( pSoftGemini->hHalCtrl, HAL_EVENT_SOFT_GEMINI_SENSE );
26764064216a8433360745f69edddce19a606659163The Android Open Source Project
26864064216a8433360745f69edddce19a606659163The Android Open Source Project	whalCtrl_EventMbox_Enable( pSoftGemini->hHalCtrl, HAL_EVENT_SOFT_GEMINI_PREDICTION );
26964064216a8433360745f69edddce19a606659163The Android Open Source Project
27064064216a8433360745f69edddce19a606659163The Android Open Source Project	whalCtrl_EventMbox_Enable( pSoftGemini->hHalCtrl, HAL_EVENT_SOFT_GEMINI_AVALANCHE );
27164064216a8433360745f69edddce19a606659163The Android Open Source Project
27264064216a8433360745f69edddce19a606659163The Android Open Source Project	/* On system initialization SG is disabled but later calls to SoftGemini_setEnableParam() */
27364064216a8433360745f69edddce19a606659163The Android Open Source Project	pSoftGemini->bProtectiveMode = FALSE;
27464064216a8433360745f69edddce19a606659163The Android Open Source Project	pSoftGemini->SoftGeminiEnable = SG_DISABLE;
27564064216a8433360745f69edddce19a606659163The Android Open Source Project	pSoftGemini->bDriverEnabled = FALSE;
27664064216a8433360745f69edddce19a606659163The Android Open Source Project    pSoftGemini->bPsPollFailureActive = FALSE;
27764064216a8433360745f69edddce19a606659163The Android Open Source Project
27864064216a8433360745f69edddce19a606659163The Android Open Source Project	if ((OK == status) && (pSoftGeminiInitParams->SoftGeminiEnable != SG_DISABLE))
27964064216a8433360745f69edddce19a606659163The Android Open Source Project	{	/* called only if different than SG_DISABLE */
28064064216a8433360745f69edddce19a606659163The Android Open Source Project		status = SoftGemini_setEnableParam(hSoftGemini, pSoftGeminiInitParams->SoftGeminiEnable, FALSE);
28164064216a8433360745f69edddce19a606659163The Android Open Source Project	}
28264064216a8433360745f69edddce19a606659163The Android Open Source Project
28364064216a8433360745f69edddce19a606659163The Android Open Source Project	if (status == OK)
28464064216a8433360745f69edddce19a606659163The Android Open Source Project	{
28564064216a8433360745f69edddce19a606659163The Android Open Source Project		WLAN_REPORT_INIT(pSoftGemini->hReport, SOFT_GEMINI_MODULE_LOG,  ("  SoftGemini_config() - configured successfully\n"));
28664064216a8433360745f69edddce19a606659163The Android Open Source Project	}
28764064216a8433360745f69edddce19a606659163The Android Open Source Project	else
28864064216a8433360745f69edddce19a606659163The Android Open Source Project	{
28964064216a8433360745f69edddce19a606659163The Android Open Source Project		WLAN_REPORT_ERROR(pSoftGemini->hReport, SOFT_GEMINI_MODULE_LOG,  ("  SoftGemini_config() - Error configuring module \n"));
29064064216a8433360745f69edddce19a606659163The Android Open Source Project	}
29164064216a8433360745f69edddce19a606659163The Android Open Source Project
29264064216a8433360745f69edddce19a606659163The Android Open Source Project	return status;
29364064216a8433360745f69edddce19a606659163The Android Open Source Project}
29464064216a8433360745f69edddce19a606659163The Android Open Source Project
29564064216a8433360745f69edddce19a606659163The Android Open Source Project/************************************************************************
29664064216a8433360745f69edddce19a606659163The Android Open Source Project *                        SoftGemini_destroy							*
29764064216a8433360745f69edddce19a606659163The Android Open Source Project ************************************************************************
29864064216a8433360745f69edddce19a606659163The Android Open Source ProjectDESCRIPTION: SoftGemini module destroy function, called by the config mgr in the destroy phase
29964064216a8433360745f69edddce19a606659163The Android Open Source Project				performs the following:
30064064216a8433360745f69edddce19a606659163The Android Open Source Project				-	Free all memory aloocated by the module
30164064216a8433360745f69edddce19a606659163The Android Open Source Project
30264064216a8433360745f69edddce19a606659163The Android Open Source ProjectINPUT:      hSoftGemini	-	SoftGemini handle.
30364064216a8433360745f69edddce19a606659163The Android Open Source Project
30464064216a8433360745f69edddce19a606659163The Android Open Source Project
30564064216a8433360745f69edddce19a606659163The Android Open Source ProjectOUTPUT:
30664064216a8433360745f69edddce19a606659163The Android Open Source Project
30764064216a8433360745f69edddce19a606659163The Android Open Source ProjectRETURN:     OK on success, NOK otherwise
30864064216a8433360745f69edddce19a606659163The Android Open Source Project
30964064216a8433360745f69edddce19a606659163The Android Open Source Project************************************************************************/
31064064216a8433360745f69edddce19a606659163The Android Open Source ProjectTI_STATUS SoftGemini_destroy(TI_HANDLE hSoftGemini)
31164064216a8433360745f69edddce19a606659163The Android Open Source Project{
31264064216a8433360745f69edddce19a606659163The Android Open Source Project	SoftGemini_t	*pSoftGemini = (SoftGemini_t *)hSoftGemini;
31364064216a8433360745f69edddce19a606659163The Android Open Source Project
31464064216a8433360745f69edddce19a606659163The Android Open Source Project	if (pSoftGemini != NULL)
31564064216a8433360745f69edddce19a606659163The Android Open Source Project	{
31664064216a8433360745f69edddce19a606659163The Android Open Source Project		os_memoryFree( pSoftGemini->hOs, (TI_HANDLE)pSoftGemini , sizeof(SoftGemini_t));
31764064216a8433360745f69edddce19a606659163The Android Open Source Project	}
31864064216a8433360745f69edddce19a606659163The Android Open Source Project
31964064216a8433360745f69edddce19a606659163The Android Open Source Project	return OK;
32064064216a8433360745f69edddce19a606659163The Android Open Source Project}
32164064216a8433360745f69edddce19a606659163The Android Open Source Project
32264064216a8433360745f69edddce19a606659163The Android Open Source Project
32364064216a8433360745f69edddce19a606659163The Android Open Source Project/***********************************************************************
32464064216a8433360745f69edddce19a606659163The Android Open Source Project *                        SoftGemini_setParam
32564064216a8433360745f69edddce19a606659163The Android Open Source Project ***********************************************************************
32664064216a8433360745f69edddce19a606659163The Android Open Source ProjectDESCRIPTION: SoftGemini set param function, called by the following:
32764064216a8433360745f69edddce19a606659163The Android Open Source Project			-	config mgr in order to set a parameter receiving from the OS abstraction layer.
32864064216a8433360745f69edddce19a606659163The Android Open Source Project			-	From inside the driver
32964064216a8433360745f69edddce19a606659163The Android Open Source Project
33064064216a8433360745f69edddce19a606659163The Android Open Source ProjectINPUT:      hSoftGemini	-	SoftGemini handle.
33164064216a8433360745f69edddce19a606659163The Android Open Source Project			pParam	-	Pointer to the parameter
33264064216a8433360745f69edddce19a606659163The Android Open Source Project
33364064216a8433360745f69edddce19a606659163The Android Open Source ProjectOUTPUT:
33464064216a8433360745f69edddce19a606659163The Android Open Source Project
33564064216a8433360745f69edddce19a606659163The Android Open Source ProjectRETURN:     OK on success, NOK otherwise
33664064216a8433360745f69edddce19a606659163The Android Open Source Project
33764064216a8433360745f69edddce19a606659163The Android Open Source Project************************************************************************/
33864064216a8433360745f69edddce19a606659163The Android Open Source ProjectTI_STATUS SoftGemini_setParam(TI_HANDLE	hSoftGemini,
33964064216a8433360745f69edddce19a606659163The Android Open Source Project											paramInfo_t	*pParam)
34064064216a8433360745f69edddce19a606659163The Android Open Source Project{
34164064216a8433360745f69edddce19a606659163The Android Open Source Project	SoftGemini_t *pSoftGemini = (SoftGemini_t *)hSoftGemini;
34264064216a8433360745f69edddce19a606659163The Android Open Source Project	TI_STATUS return_value = OK;
34364064216a8433360745f69edddce19a606659163The Android Open Source Project
34464064216a8433360745f69edddce19a606659163The Android Open Source Project	WLAN_REPORT_INFORMATION(pSoftGemini->hReport, SOFT_GEMINI_MODULE_LOG, ("  SoftGemini_setParam() (0x%x)\n", pParam->paramType));
34564064216a8433360745f69edddce19a606659163The Android Open Source Project
34664064216a8433360745f69edddce19a606659163The Android Open Source Project	switch(pParam->paramType)
34764064216a8433360745f69edddce19a606659163The Android Open Source Project	{
34864064216a8433360745f69edddce19a606659163The Android Open Source Project
34964064216a8433360745f69edddce19a606659163The Android Open Source Project	case SOFT_GEMINI_SET_ENABLE:
35064064216a8433360745f69edddce19a606659163The Android Open Source Project
35164064216a8433360745f69edddce19a606659163The Android Open Source Project		return_value = SoftGemini_setEnableParam(hSoftGemini,pParam->content.SoftGeminiEnable, FALSE);
35264064216a8433360745f69edddce19a606659163The Android Open Source Project		break;
35364064216a8433360745f69edddce19a606659163The Android Open Source Project
35464064216a8433360745f69edddce19a606659163The Android Open Source Project	case SOFT_GEMINI_SET_RATE:
35564064216a8433360745f69edddce19a606659163The Android Open Source Project
35664064216a8433360745f69edddce19a606659163The Android Open Source Project		return_value = SoftGemini_setRateParam(hSoftGemini, pParam->content.SoftGeminiRate);
35764064216a8433360745f69edddce19a606659163The Android Open Source Project		break;
35864064216a8433360745f69edddce19a606659163The Android Open Source Project
35964064216a8433360745f69edddce19a606659163The Android Open Source Project	case SOFT_GEMINI_SET_CONFIG:
36064064216a8433360745f69edddce19a606659163The Android Open Source Project
36164064216a8433360745f69edddce19a606659163The Android Open Source Project		/* copy new params to SoftGemini module */
36264064216a8433360745f69edddce19a606659163The Android Open Source Project		SoftGemini_setConfigParam(hSoftGemini,pParam->content.SoftGeminiParamArray);
36364064216a8433360745f69edddce19a606659163The Android Open Source Project
36464064216a8433360745f69edddce19a606659163The Android Open Source Project		/* set new params to FW */
36564064216a8433360745f69edddce19a606659163The Android Open Source Project		return_value = SoftGemini_setParamsToFW(hSoftGemini, &(pSoftGemini->SoftGeminiParam));
36664064216a8433360745f69edddce19a606659163The Android Open Source Project		break;
36764064216a8433360745f69edddce19a606659163The Android Open Source Project
36864064216a8433360745f69edddce19a606659163The Android Open Source Project	default:
36964064216a8433360745f69edddce19a606659163The Android Open Source Project		WLAN_REPORT_ERROR(pSoftGemini->hReport, SOFT_GEMINI_MODULE_LOG, ("  SoftGemini_setParam(), Params is not supported, %d\n\n", pParam->paramType));
37064064216a8433360745f69edddce19a606659163The Android Open Source Project		return PARAM_NOT_SUPPORTED;
37164064216a8433360745f69edddce19a606659163The Android Open Source Project	}
37264064216a8433360745f69edddce19a606659163The Android Open Source Project
37364064216a8433360745f69edddce19a606659163The Android Open Source Project	return return_value;
37464064216a8433360745f69edddce19a606659163The Android Open Source Project}
37564064216a8433360745f69edddce19a606659163The Android Open Source Project
37664064216a8433360745f69edddce19a606659163The Android Open Source Project/***********************************************************************
37764064216a8433360745f69edddce19a606659163The Android Open Source Project *			      SoftGemini_getParam
37864064216a8433360745f69edddce19a606659163The Android Open Source Project ***********************************************************************
37964064216a8433360745f69edddce19a606659163The Android Open Source ProjectDESCRIPTION: SoftGemini get param function, called by the following:
38064064216a8433360745f69edddce19a606659163The Android Open Source Project			-	config mgr in order to get a parameter from the OS abstraction layer.
38164064216a8433360745f69edddce19a606659163The Android Open Source Project			-	From inside the dirver
38264064216a8433360745f69edddce19a606659163The Android Open Source Project
38364064216a8433360745f69edddce19a606659163The Android Open Source ProjectINPUT:      hSoftGemini	-	SoftGemini handle.
38464064216a8433360745f69edddce19a606659163The Android Open Source Project
38564064216a8433360745f69edddce19a606659163The Android Open Source Project
38664064216a8433360745f69edddce19a606659163The Android Open Source ProjectOUTPUT:		pParam	-	Pointer to the parameter
38764064216a8433360745f69edddce19a606659163The Android Open Source Project
38864064216a8433360745f69edddce19a606659163The Android Open Source ProjectRETURN:     OK on success, NOK otherwise
38964064216a8433360745f69edddce19a606659163The Android Open Source Project
39064064216a8433360745f69edddce19a606659163The Android Open Source Project************************************************************************/
39164064216a8433360745f69edddce19a606659163The Android Open Source ProjectTI_STATUS SoftGemini_getParam(TI_HANDLE		hSoftGemini,
39264064216a8433360745f69edddce19a606659163The Android Open Source Project											paramInfo_t	*pParam)
39364064216a8433360745f69edddce19a606659163The Android Open Source Project{
39464064216a8433360745f69edddce19a606659163The Android Open Source Project	SoftGemini_printParams(hSoftGemini);
39564064216a8433360745f69edddce19a606659163The Android Open Source Project
39664064216a8433360745f69edddce19a606659163The Android Open Source Project	return OK;
39764064216a8433360745f69edddce19a606659163The Android Open Source Project}
39864064216a8433360745f69edddce19a606659163The Android Open Source Project
39964064216a8433360745f69edddce19a606659163The Android Open Source Project
40064064216a8433360745f69edddce19a606659163The Android Open Source Project
40164064216a8433360745f69edddce19a606659163The Android Open Source Project/***************************************************************************
40264064216a8433360745f69edddce19a606659163The Android Open Source Project*					SoftGemini_setEnableParam					    	       *
40364064216a8433360745f69edddce19a606659163The Android Open Source Project****************************************************************************
40464064216a8433360745f69edddce19a606659163The Android Open Source Project* DESCRIPTION:	The function sets the  appropriate Enable value,
40564064216a8433360745f69edddce19a606659163The Android Open Source Project*				configures SCR , POWER MGR , DATA CTRL , FW.
40664064216a8433360745f69edddce19a606659163The Android Open Source Project*
40764064216a8433360745f69edddce19a606659163The Android Open Source Project* INPUTS:		pSoftGemini - the object
40864064216a8433360745f69edddce19a606659163The Android Open Source Project***************************************************************************/
40964064216a8433360745f69edddce19a606659163The Android Open Source Projectstatic TI_STATUS SoftGemini_setEnableParam(TI_HANDLE hSoftGemini, SoftGeminiEnableModes_e SoftGeminiEnable, BOOL recovery)
41064064216a8433360745f69edddce19a606659163The Android Open Source Project{
41164064216a8433360745f69edddce19a606659163The Android Open Source Project	SoftGemini_t *pSoftGemini = (SoftGemini_t *)hSoftGemini;
41264064216a8433360745f69edddce19a606659163The Android Open Source Project	whalParamInfo_t	param;
41364064216a8433360745f69edddce19a606659163The Android Open Source Project	TI_STATUS return_value = OK;
41464064216a8433360745f69edddce19a606659163The Android Open Source Project
41564064216a8433360745f69edddce19a606659163The Android Open Source Project	WLAN_REPORT_INFORMATION(pSoftGemini->hReport, SOFT_GEMINI_MODULE_LOG, ("  setSoftGeminiEnableParam() - Old value = %s, New value = %s\n",
41664064216a8433360745f69edddce19a606659163The Android Open Source Project		SoftGemini_ConvertModeToString(pSoftGemini->SoftGeminiEnable),SoftGemini_ConvertModeToString(SoftGeminiEnable)));
41764064216a8433360745f69edddce19a606659163The Android Open Source Project
41864064216a8433360745f69edddce19a606659163The Android Open Source Project
41964064216a8433360745f69edddce19a606659163The Android Open Source Project    /*
42064064216a8433360745f69edddce19a606659163The Android Open Source Project     * PsPoll work around is active. Just save the value and configure it later
42164064216a8433360745f69edddce19a606659163The Android Open Source Project     */
42264064216a8433360745f69edddce19a606659163The Android Open Source Project    if ( pSoftGemini->bPsPollFailureActive )
42364064216a8433360745f69edddce19a606659163The Android Open Source Project    {
42464064216a8433360745f69edddce19a606659163The Android Open Source Project        WLAN_REPORT_INFORMATION(pSoftGemini->hReport, SOFT_GEMINI_MODULE_LOG,
42564064216a8433360745f69edddce19a606659163The Android Open Source Project            ("  setSoftGeminiEnableParam() - while PsPollFailure is active\n"));
42664064216a8433360745f69edddce19a606659163The Android Open Source Project
42764064216a8433360745f69edddce19a606659163The Android Open Source Project        pSoftGemini->PsPollFailureLastEnableValue = SoftGeminiEnable;
42864064216a8433360745f69edddce19a606659163The Android Open Source Project        return OK;
42964064216a8433360745f69edddce19a606659163The Android Open Source Project    }
43064064216a8433360745f69edddce19a606659163The Android Open Source Project
43164064216a8433360745f69edddce19a606659163The Android Open Source Project	/**********************************/
43264064216a8433360745f69edddce19a606659163The Android Open Source Project	/* Sanity check on enable values */
43364064216a8433360745f69edddce19a606659163The Android Open Source Project	/********************************/
43464064216a8433360745f69edddce19a606659163The Android Open Source Project
43564064216a8433360745f69edddce19a606659163The Android Open Source Project	/*				Old Value						New Value		    */
43664064216a8433360745f69edddce19a606659163The Android Open Source Project	/*					|							    |			    */
43764064216a8433360745f69edddce19a606659163The Android Open Source Project	/*			  	   \|/							   \|/			    */
43864064216a8433360745f69edddce19a606659163The Android Open Source Project
43964064216a8433360745f69edddce19a606659163The Android Open Source Project	if ((pSoftGemini->SoftGeminiEnable == SoftGeminiEnable) && !recovery)
44064064216a8433360745f69edddce19a606659163The Android Open Source Project	{
44164064216a8433360745f69edddce19a606659163The Android Open Source Project		WLAN_REPORT_ERROR(pSoftGemini->hReport, SOFT_GEMINI_MODULE_LOG, ("  %s - setting same value \n",__FUNCTION__));
44264064216a8433360745f69edddce19a606659163The Android Open Source Project		return NOK;
44364064216a8433360745f69edddce19a606659163The Android Open Source Project	}
44464064216a8433360745f69edddce19a606659163The Android Open Source Project
44564064216a8433360745f69edddce19a606659163The Android Open Source Project
44664064216a8433360745f69edddce19a606659163The Android Open Source Project	/*******************************/
44764064216a8433360745f69edddce19a606659163The Android Open Source Project	/* Make the necessary actions */
44864064216a8433360745f69edddce19a606659163The Android Open Source Project	/*****************************/
44964064216a8433360745f69edddce19a606659163The Android Open Source Project
45064064216a8433360745f69edddce19a606659163The Android Open Source Project	switch (SoftGeminiEnable)
45164064216a8433360745f69edddce19a606659163The Android Open Source Project	{
45264064216a8433360745f69edddce19a606659163The Android Open Source Project	case SG_ENABLE:
45364064216a8433360745f69edddce19a606659163The Android Open Source Project
45464064216a8433360745f69edddce19a606659163The Android Open Source Project		if (!pSoftGemini->bDriverEnabled)
45564064216a8433360745f69edddce19a606659163The Android Open Source Project		{
45664064216a8433360745f69edddce19a606659163The Android Open Source Project			SoftGemini_EnableDriver(hSoftGemini);
45764064216a8433360745f69edddce19a606659163The Android Open Source Project		}
45864064216a8433360745f69edddce19a606659163The Android Open Source Project		/* set FW with SG_ENABLE */
45964064216a8433360745f69edddce19a606659163The Android Open Source Project		param.paramType = HAL_CTRL_SG_ENABLE_PARAM;
46064064216a8433360745f69edddce19a606659163The Android Open Source Project		param.content.SoftGeminiEnable = SG_ENABLE;
46164064216a8433360745f69edddce19a606659163The Android Open Source Project		return_value = whalCtrl_SetParam(pSoftGemini->hHalCtrl, &param);
46264064216a8433360745f69edddce19a606659163The Android Open Source Project
46364064216a8433360745f69edddce19a606659163The Android Open Source Project		/* Set SG status for the IPC_EVENT_BT_COEX_MODE event */
46464064216a8433360745f69edddce19a606659163The Android Open Source Project		pSoftGemini->btCoexStatus.state = TRUE;
46564064216a8433360745f69edddce19a606659163The Android Open Source Project
46664064216a8433360745f69edddce19a606659163The Android Open Source Project		break;
46764064216a8433360745f69edddce19a606659163The Android Open Source Project
46864064216a8433360745f69edddce19a606659163The Android Open Source Project	case SG_DISABLE:
46964064216a8433360745f69edddce19a606659163The Android Open Source Project
47064064216a8433360745f69edddce19a606659163The Android Open Source Project		/* set FW with SG_DISABLE */
47164064216a8433360745f69edddce19a606659163The Android Open Source Project		param.paramType = HAL_CTRL_SG_ENABLE_PARAM;
47264064216a8433360745f69edddce19a606659163The Android Open Source Project		param.content.SoftGeminiEnable = SG_DISABLE;
47364064216a8433360745f69edddce19a606659163The Android Open Source Project		return_value = whalCtrl_SetParam(pSoftGemini->hHalCtrl, &param);
47464064216a8433360745f69edddce19a606659163The Android Open Source Project
47564064216a8433360745f69edddce19a606659163The Android Open Source Project		if (pSoftGemini->bDriverEnabled)
47664064216a8433360745f69edddce19a606659163The Android Open Source Project		{
47764064216a8433360745f69edddce19a606659163The Android Open Source Project			SoftGemini_DisableDriver(hSoftGemini);
47864064216a8433360745f69edddce19a606659163The Android Open Source Project		}
47964064216a8433360745f69edddce19a606659163The Android Open Source Project
48064064216a8433360745f69edddce19a606659163The Android Open Source Project		/* Set SG status for the IPC_EVENT_BT_COEX_MODE event */
48164064216a8433360745f69edddce19a606659163The Android Open Source Project		pSoftGemini->btCoexStatus.state = FALSE;
48264064216a8433360745f69edddce19a606659163The Android Open Source Project
48364064216a8433360745f69edddce19a606659163The Android Open Source Project		break;
48464064216a8433360745f69edddce19a606659163The Android Open Source Project
48564064216a8433360745f69edddce19a606659163The Android Open Source Project	case SG_SENSE_NO_ACTIVITY:
48664064216a8433360745f69edddce19a606659163The Android Open Source Project
48764064216a8433360745f69edddce19a606659163The Android Open Source Project		/* set FW with SG_SENSE_NO_ACTIVITY */
48864064216a8433360745f69edddce19a606659163The Android Open Source Project		param.paramType = HAL_CTRL_SG_ENABLE_PARAM;
48964064216a8433360745f69edddce19a606659163The Android Open Source Project		param.content.SoftGeminiEnable = SG_SENSE_NO_ACTIVITY;
49064064216a8433360745f69edddce19a606659163The Android Open Source Project		return_value = whalCtrl_SetParam(pSoftGemini->hHalCtrl, &param);
49164064216a8433360745f69edddce19a606659163The Android Open Source Project
49264064216a8433360745f69edddce19a606659163The Android Open Source Project		if (pSoftGemini->bDriverEnabled)
49364064216a8433360745f69edddce19a606659163The Android Open Source Project		{
49464064216a8433360745f69edddce19a606659163The Android Open Source Project			SoftGemini_DisableDriver(hSoftGemini);
49564064216a8433360745f69edddce19a606659163The Android Open Source Project		}
49664064216a8433360745f69edddce19a606659163The Android Open Source Project
49764064216a8433360745f69edddce19a606659163The Android Open Source Project		/* Set SG status for the IPC_EVENT_BT_COEX_MODE event */
49864064216a8433360745f69edddce19a606659163The Android Open Source Project		pSoftGemini->btCoexStatus.state = FALSE;
49964064216a8433360745f69edddce19a606659163The Android Open Source Project
50064064216a8433360745f69edddce19a606659163The Android Open Source Project		break;
50164064216a8433360745f69edddce19a606659163The Android Open Source Project
50264064216a8433360745f69edddce19a606659163The Android Open Source Project	case SG_SENSE_ACTIVE:
50364064216a8433360745f69edddce19a606659163The Android Open Source Project
50464064216a8433360745f69edddce19a606659163The Android Open Source Project		if (!pSoftGemini->bDriverEnabled)
50564064216a8433360745f69edddce19a606659163The Android Open Source Project		{
50664064216a8433360745f69edddce19a606659163The Android Open Source Project			SoftGemini_EnableDriver(hSoftGemini);
50764064216a8433360745f69edddce19a606659163The Android Open Source Project		}
50864064216a8433360745f69edddce19a606659163The Android Open Source Project		/* set FW with SG_SENSE_ACTIVE */
50964064216a8433360745f69edddce19a606659163The Android Open Source Project		param.paramType = HAL_CTRL_SG_ENABLE_PARAM;
51064064216a8433360745f69edddce19a606659163The Android Open Source Project		param.content.SoftGeminiEnable = SG_SENSE_ACTIVE;
51164064216a8433360745f69edddce19a606659163The Android Open Source Project		return_value = whalCtrl_SetParam(pSoftGemini->hHalCtrl, &param);
51264064216a8433360745f69edddce19a606659163The Android Open Source Project
51364064216a8433360745f69edddce19a606659163The Android Open Source Project		/* Set SG status for the IPC_EVENT_BT_COEX_MODE event */
51464064216a8433360745f69edddce19a606659163The Android Open Source Project		pSoftGemini->btCoexStatus.state = TRUE;
51564064216a8433360745f69edddce19a606659163The Android Open Source Project
51664064216a8433360745f69edddce19a606659163The Android Open Source Project		break;
51764064216a8433360745f69edddce19a606659163The Android Open Source Project
51864064216a8433360745f69edddce19a606659163The Android Open Source Project	default:
51964064216a8433360745f69edddce19a606659163The Android Open Source Project		WLAN_REPORT_ERROR(pSoftGemini->hReport, SOFT_GEMINI_MODULE_LOG,  ("%s defualt :%d\n",__FUNCTION__,SoftGeminiEnable));
52064064216a8433360745f69edddce19a606659163The Android Open Source Project		return NOK;
52164064216a8433360745f69edddce19a606659163The Android Open Source Project/*		break; - unreachable*/
52264064216a8433360745f69edddce19a606659163The Android Open Source Project	}
52364064216a8433360745f69edddce19a606659163The Android Open Source Project
52464064216a8433360745f69edddce19a606659163The Android Open Source Project	/* Pass to the new enable state */
52564064216a8433360745f69edddce19a606659163The Android Open Source Project	pSoftGemini->SoftGeminiEnable = SoftGeminiEnable;
52664064216a8433360745f69edddce19a606659163The Android Open Source Project
52764064216a8433360745f69edddce19a606659163The Android Open Source Project	if (OK != return_value)
52864064216a8433360745f69edddce19a606659163The Android Open Source Project	{
52964064216a8433360745f69edddce19a606659163The Android Open Source Project		WLAN_REPORT_ERROR(pSoftGemini->hReport, SOFT_GEMINI_MODULE_LOG,
53064064216a8433360745f69edddce19a606659163The Android Open Source Project			("%s can't configure enable param to FW :%s\n",__FUNCTION__,SoftGemini_ConvertModeToString(SoftGeminiEnable)));
53164064216a8433360745f69edddce19a606659163The Android Open Source Project	}
53264064216a8433360745f69edddce19a606659163The Android Open Source Project	else
53364064216a8433360745f69edddce19a606659163The Android Open Source Project	{
53464064216a8433360745f69edddce19a606659163The Android Open Source Project		EvHandlerSendEvent(pSoftGemini->hEvHandler, IPC_EVENT_BT_COEX_MODE, (UINT8*)&pSoftGemini->btCoexStatus, sizeof(btCoexStatus_t));
53564064216a8433360745f69edddce19a606659163The Android Open Source Project	}
53664064216a8433360745f69edddce19a606659163The Android Open Source Project
53764064216a8433360745f69edddce19a606659163The Android Open Source Project	return return_value;
53864064216a8433360745f69edddce19a606659163The Android Open Source Project}
53964064216a8433360745f69edddce19a606659163The Android Open Source Project
54064064216a8433360745f69edddce19a606659163The Android Open Source Project/***************************************************************************
54164064216a8433360745f69edddce19a606659163The Android Open Source Project*					SoftGemini_setConfigParam				    	       *
54264064216a8433360745f69edddce19a606659163The Android Open Source Project****************************************************************************
54364064216a8433360745f69edddce19a606659163The Android Open Source Project* DESCRIPTION:	The function sets params
54464064216a8433360745f69edddce19a606659163The Android Open Source Project*
54564064216a8433360745f69edddce19a606659163The Android Open Source Project* INPUTS:		pSoftGemini - the object
54664064216a8433360745f69edddce19a606659163The Android Open Source Project*				param       - params to be configured
54764064216a8433360745f69edddce19a606659163The Android Open Source Project***************************************************************************/
54864064216a8433360745f69edddce19a606659163The Android Open Source Projectstatic void SoftGemini_setConfigParam(TI_HANDLE hSoftGemini, UINT32 *param)
54964064216a8433360745f69edddce19a606659163The Android Open Source Project{
55064064216a8433360745f69edddce19a606659163The Android Open Source Project	SoftGemini_t *pSoftGemini = (SoftGemini_t *)hSoftGemini;
55164064216a8433360745f69edddce19a606659163The Android Open Source Project	UINT32 i = 0;
55264064216a8433360745f69edddce19a606659163The Android Open Source Project
55364064216a8433360745f69edddce19a606659163The Android Open Source Project	pSoftGemini->SoftGeminiParam.wlanRxMinRateToRespectBtHp		= (UINT32)param[i++];
55464064216a8433360745f69edddce19a606659163The Android Open Source Project	pSoftGemini->SoftGeminiParam.btHpMaxTime					= (UINT16)param[i++];
55564064216a8433360745f69edddce19a606659163The Android Open Source Project	pSoftGemini->SoftGeminiParam.wlanHpMaxTime					= (UINT16)param[i++];
55664064216a8433360745f69edddce19a606659163The Android Open Source Project	pSoftGemini->SoftGeminiParam.senseDisableTimer				= (UINT16)param[i++];
55764064216a8433360745f69edddce19a606659163The Android Open Source Project	pSoftGemini->SoftGeminiParam.protectiveRxTimeBeforeBtHp		= (UINT16)param[i++];
55864064216a8433360745f69edddce19a606659163The Android Open Source Project	pSoftGemini->SoftGeminiParam.protectiveTxTimeBeforeBtHp		= (UINT16)param[i++];
55964064216a8433360745f69edddce19a606659163The Android Open Source Project	pSoftGemini->SoftGeminiParam.protectiveRxTimeBeforeBtHpFastAp = (UINT16)param[i++];
56064064216a8433360745f69edddce19a606659163The Android Open Source Project	pSoftGemini->SoftGeminiParam.protectiveTxTimeBeforeBtHpFastAp = (UINT16)param[i++];
56164064216a8433360745f69edddce19a606659163The Android Open Source Project	pSoftGemini->SoftGeminiParam.protectiveWlanCycleTimeForFastAp = (UINT16)param[i++];
56264064216a8433360745f69edddce19a606659163The Android Open Source Project    pSoftGemini->SoftGeminiParam.btAntiStarvationPeriod			  = (UINT16)param[i++];
56364064216a8433360745f69edddce19a606659163The Android Open Source Project    pSoftGemini->SoftGeminiParam.timeoutNextBtLpPacket            = (UINT16)param[i++];
56464064216a8433360745f69edddce19a606659163The Android Open Source Project	pSoftGemini->SoftGeminiParam.wakeUpTimeBeforeBeacon           = (UINT16)param[i++];
56564064216a8433360745f69edddce19a606659163The Android Open Source Project	pSoftGemini->SoftGeminiParam.hpdmMaxGuardTime				 = (UINT16)param[i++];
56664064216a8433360745f69edddce19a606659163The Android Open Source Project	pSoftGemini->SoftGeminiParam.timeoutNextWlanPacket           = (UINT16)param[i++];
56764064216a8433360745f69edddce19a606659163The Android Open Source Project	pSoftGemini->SoftGeminiParam.sgAntennaType					= (UINT8)param[i++];
56864064216a8433360745f69edddce19a606659163The Android Open Source Project	pSoftGemini->SoftGeminiParam.signalingType					= (UINT8)param[i++];
56964064216a8433360745f69edddce19a606659163The Android Open Source Project	pSoftGemini->SoftGeminiParam.afhLeverageOn					= (UINT8)param[i++];
57064064216a8433360745f69edddce19a606659163The Android Open Source Project	pSoftGemini->SoftGeminiParam.numberQuietCycle				= (UINT8)param[i++];
57164064216a8433360745f69edddce19a606659163The Android Open Source Project	pSoftGemini->SoftGeminiParam.maxNumCts						= (UINT8)param[i++];
57264064216a8433360745f69edddce19a606659163The Android Open Source Project	pSoftGemini->SoftGeminiParam.numberOfWlanPackets			= (UINT8)param[i++];
57364064216a8433360745f69edddce19a606659163The Android Open Source Project	pSoftGemini->SoftGeminiParam.numberOfBtPackets				= (UINT8)param[i++];
57464064216a8433360745f69edddce19a606659163The Android Open Source Project	pSoftGemini->SoftGeminiParam.numberOfMissedRxForAvalancheTrigger = (UINT8)param[i++];
57564064216a8433360745f69edddce19a606659163The Android Open Source Project	pSoftGemini->SoftGeminiParam.wlanElpHpSupport				= (UINT8)param[i++];
57664064216a8433360745f69edddce19a606659163The Android Open Source Project	pSoftGemini->SoftGeminiParam.btAntiStarvationNumberOfCyclesWithinThePeriod  = (UINT8)param[i++];
57764064216a8433360745f69edddce19a606659163The Android Open Source Project    pSoftGemini->SoftGeminiParam.ackModeDuringBtLpInDualAnt     = (UINT8)param[i++];
57864064216a8433360745f69edddce19a606659163The Android Open Source Project    pSoftGemini->SoftGeminiParam.allowPaSdToggleDuringBtActivityEnable = (UINT8)param[i++];
57964064216a8433360745f69edddce19a606659163The Android Open Source Project	/*
58064064216a8433360745f69edddce19a606659163The Android Open Source Project	 * Check if SG is Active and sgAutoModeNoCts was changed on the fly.
58164064216a8433360745f69edddce19a606659163The Android Open Source Project	 *  If so - update powerMgr.
58264064216a8433360745f69edddce19a606659163The Android Open Source Project	 */
58364064216a8433360745f69edddce19a606659163The Android Open Source Project	pSoftGemini->SoftGeminiParam.sgAutoModeNoCts = (UINT8)param[i++];
58464064216a8433360745f69edddce19a606659163The Android Open Source Project
58564064216a8433360745f69edddce19a606659163The Android Open Source Project    if ( pSoftGemini->SoftGeminiEnable == SG_SENSE_ACTIVE || pSoftGemini->SoftGeminiEnable == SG_ENABLE )
58664064216a8433360745f69edddce19a606659163The Android Open Source Project	{
58764064216a8433360745f69edddce19a606659163The Android Open Source Project        if (pSoftGemini->SoftGeminiParam.sgAutoModeNoCts)
58864064216a8433360745f69edddce19a606659163The Android Open Source Project		{
58964064216a8433360745f69edddce19a606659163The Android Open Source Project			/* Exit "Always PS" mode */
59064064216a8433360745f69edddce19a606659163The Android Open Source Project			SoftGemini_unSetPS(pSoftGemini);
59164064216a8433360745f69edddce19a606659163The Android Open Source Project		}
59264064216a8433360745f69edddce19a606659163The Android Open Source Project		else /* Normal behavior - enter PS */
59364064216a8433360745f69edddce19a606659163The Android Open Source Project		{
59464064216a8433360745f69edddce19a606659163The Android Open Source Project			SoftGemini_SetPS(pSoftGemini);
59564064216a8433360745f69edddce19a606659163The Android Open Source Project		}
59664064216a8433360745f69edddce19a606659163The Android Open Source Project	}
59764064216a8433360745f69edddce19a606659163The Android Open Source Project
59864064216a8433360745f69edddce19a606659163The Android Open Source Project	pSoftGemini->SoftGeminiParam.numOfBtHpRespectedReq = (UINT8)param[i++];
59964064216a8433360745f69edddce19a606659163The Android Open Source Project
60064064216a8433360745f69edddce19a606659163The Android Open Source Project}
60164064216a8433360745f69edddce19a606659163The Android Open Source Project
60264064216a8433360745f69edddce19a606659163The Android Open Source Project/***************************************************************************
60364064216a8433360745f69edddce19a606659163The Android Open Source Project*					setSoftGeminiRateParam				    	    	       *
60464064216a8433360745f69edddce19a606659163The Android Open Source Project****************************************************************************
60564064216a8433360745f69edddce19a606659163The Android Open Source Project* DESCRIPTION:	The function sets the Ctrl Data with the appropriate Rate value
60664064216a8433360745f69edddce19a606659163The Android Open Source Project*
60764064216a8433360745f69edddce19a606659163The Android Open Source Project* INPUTS:		pSoftGemini - the object
60864064216a8433360745f69edddce19a606659163The Android Open Source Project***************************************************************************/
60964064216a8433360745f69edddce19a606659163The Android Open Source Projectstatic TI_STATUS SoftGemini_setRateParam(TI_HANDLE hSoftGemini, UINT8 *pRates)
61064064216a8433360745f69edddce19a606659163The Android Open Source Project{
61164064216a8433360745f69edddce19a606659163The Android Open Source Project	SoftGemini_t *pSoftGemini = (SoftGemini_t *)hSoftGemini;
61264064216a8433360745f69edddce19a606659163The Android Open Source Project	int i;
61364064216a8433360745f69edddce19a606659163The Android Open Source Project	UINT32 supportedRates = 0;
61464064216a8433360745f69edddce19a606659163The Android Open Source Project	paramInfo_t param;
61564064216a8433360745f69edddce19a606659163The Android Open Source Project	rateMask_e supportedRatesArray[NUM_OF_RATES_IN_SG] =
61664064216a8433360745f69edddce19a606659163The Android Open Source Project	{DRV_RATE_MASK_1_BARKER,DRV_RATE_MASK_2_BARKER,DRV_RATE_MASK_5_5_CCK,DRV_RATE_MASK_6_OFDM,
61764064216a8433360745f69edddce19a606659163The Android Open Source Project	DRV_RATE_MASK_9_OFDM,DRV_RATE_MASK_11_CCK,DRV_RATE_MASK_12_OFDM,DRV_RATE_MASK_18_OFDM,
61864064216a8433360745f69edddce19a606659163The Android Open Source Project	DRV_RATE_MASK_22_PBCC,DRV_RATE_MASK_24_OFDM,DRV_RATE_MASK_36_OFDM,DRV_RATE_MASK_48_OFDM,DRV_RATE_MASK_54_OFDM};
61964064216a8433360745f69edddce19a606659163The Android Open Source Project
62064064216a8433360745f69edddce19a606659163The Android Open Source Project	/* loop on all rates and mark the corresponding bit if the rate is enabled */
62164064216a8433360745f69edddce19a606659163The Android Open Source Project	for (i = 0 ; i < NUM_OF_RATES_IN_SG ; i++)
62264064216a8433360745f69edddce19a606659163The Android Open Source Project	{
62364064216a8433360745f69edddce19a606659163The Android Open Source Project		WLAN_REPORT_INFORMATION(pSoftGemini->hReport, SOFT_GEMINI_MODULE_LOG,
62464064216a8433360745f69edddce19a606659163The Android Open Source Project			(" %s rate %u = %u \n", __FUNCTION__, i,pRates[i]));
62564064216a8433360745f69edddce19a606659163The Android Open Source Project		pSoftGemini->SoftGeminiRate[i] = pRates[i];
62664064216a8433360745f69edddce19a606659163The Android Open Source Project
62764064216a8433360745f69edddce19a606659163The Android Open Source Project		if (pRates[i] > 0)
62864064216a8433360745f69edddce19a606659163The Android Open Source Project		{
62964064216a8433360745f69edddce19a606659163The Android Open Source Project			/* Store the minTxRate */
63064064216a8433360745f69edddce19a606659163The Android Open Source Project			if (!supportedRates)
63164064216a8433360745f69edddce19a606659163The Android Open Source Project			{
63264064216a8433360745f69edddce19a606659163The Android Open Source Project				pSoftGemini->btCoexStatus.minTxRate = (UINT8)supportedRatesArray[i];
63364064216a8433360745f69edddce19a606659163The Android Open Source Project			}
63464064216a8433360745f69edddce19a606659163The Android Open Source Project
63564064216a8433360745f69edddce19a606659163The Android Open Source Project			supportedRates |= supportedRatesArray[i];
63664064216a8433360745f69edddce19a606659163The Android Open Source Project		}
63764064216a8433360745f69edddce19a606659163The Android Open Source Project	}
63864064216a8433360745f69edddce19a606659163The Android Open Source Project
63964064216a8433360745f69edddce19a606659163The Android Open Source Project	if ((supportedRates & DRV_RATE_MASK_1_BARKER) || (supportedRates & DRV_RATE_MASK_2_BARKER))
64064064216a8433360745f69edddce19a606659163The Android Open Source Project	{
64164064216a8433360745f69edddce19a606659163The Android Open Source Project		WLAN_REPORT_ERROR(pSoftGemini->hReport, SOFT_GEMINI_MODULE_LOG,
64264064216a8433360745f69edddce19a606659163The Android Open Source Project			(" %s Using rates 1 or 2 in Soft Gemini is not recommended !!!\n", __FUNCTION__));
64364064216a8433360745f69edddce19a606659163The Android Open Source Project	}
64464064216a8433360745f69edddce19a606659163The Android Open Source Project
64564064216a8433360745f69edddce19a606659163The Android Open Source Project	WLAN_REPORT_INFORMATION(pSoftGemini->hReport, SOFT_GEMINI_MODULE_LOG,
64664064216a8433360745f69edddce19a606659163The Android Open Source Project		(" %s rateMask = 0x%x \n", __FUNCTION__,supportedRates));
64764064216a8433360745f69edddce19a606659163The Android Open Source Project
64864064216a8433360745f69edddce19a606659163The Android Open Source Project	param.paramType = CTRL_DATA_NEXT_RATE_MASK_FOR_CLIENT;
64964064216a8433360745f69edddce19a606659163The Android Open Source Project	param.content.ctrlDataRateClassMask.clientID = SG_RATE_CLASS;
65064064216a8433360745f69edddce19a606659163The Android Open Source Project	param.content.ctrlDataRateClassMask.clientRateMask = supportedRates;
65164064216a8433360745f69edddce19a606659163The Android Open Source Project	ctrlData_setParam(pSoftGemini->hCtrlData,&param);
65264064216a8433360745f69edddce19a606659163The Android Open Source Project
65364064216a8433360745f69edddce19a606659163The Android Open Source Project	return OK;
65464064216a8433360745f69edddce19a606659163The Android Open Source Project}
65564064216a8433360745f69edddce19a606659163The Android Open Source Project
65664064216a8433360745f69edddce19a606659163The Android Open Source Project/***************************************************************************
65764064216a8433360745f69edddce19a606659163The Android Open Source Project*					SoftGemini_printParams					    	       *
65864064216a8433360745f69edddce19a606659163The Android Open Source Project****************************************************************************
65964064216a8433360745f69edddce19a606659163The Android Open Source Project* DESCRIPTION:	Print SG Parameters.
66064064216a8433360745f69edddce19a606659163The Android Open Source Project*
66164064216a8433360745f69edddce19a606659163The Android Open Source Project* INPUTS:		pSoftGemini - the object
66264064216a8433360745f69edddce19a606659163The Android Open Source Project***************************************************************************/
66364064216a8433360745f69edddce19a606659163The Android Open Source Projectvoid SoftGemini_printParams(TI_HANDLE hSoftGemini)
66464064216a8433360745f69edddce19a606659163The Android Open Source Project{
66564064216a8433360745f69edddce19a606659163The Android Open Source Project#ifdef REPORT_LOG
66664064216a8433360745f69edddce19a606659163The Android Open Source Project
66764064216a8433360745f69edddce19a606659163The Android Open Source Project	SoftGemini_t *pSoftGemini = (SoftGemini_t *)hSoftGemini;
66864064216a8433360745f69edddce19a606659163The Android Open Source Project	SoftGeminiParam_t *SoftGeminiParam = &pSoftGemini->SoftGeminiParam;
66964064216a8433360745f69edddce19a606659163The Android Open Source Project	int i;
67064064216a8433360745f69edddce19a606659163The Android Open Source Project
67164064216a8433360745f69edddce19a606659163The Android Open Source Project	WLAN_OS_REPORT(("Rates starting from 1 to 54: \n"));
67264064216a8433360745f69edddce19a606659163The Android Open Source Project
67364064216a8433360745f69edddce19a606659163The Android Open Source Project	for (i = 0 ; i < NUM_OF_RATES_IN_SG ; i++)
67464064216a8433360745f69edddce19a606659163The Android Open Source Project	{
67564064216a8433360745f69edddce19a606659163The Android Open Source Project		WLAN_OS_REPORT((" rate[%u] = %u \n", i,pSoftGemini->SoftGeminiRate[i]));
67664064216a8433360745f69edddce19a606659163The Android Open Source Project	}
67764064216a8433360745f69edddce19a606659163The Android Open Source Project
67864064216a8433360745f69edddce19a606659163The Android Open Source Project	WLAN_OS_REPORT(("  wlanRxMinRateToRespectBtHp = %d\n", SoftGeminiParam->wlanRxMinRateToRespectBtHp));
67964064216a8433360745f69edddce19a606659163The Android Open Source Project	WLAN_OS_REPORT(("  btHpMaxTime = %d\n", SoftGeminiParam->btHpMaxTime));
68064064216a8433360745f69edddce19a606659163The Android Open Source Project	WLAN_OS_REPORT(("  wlanHpMaxTime = %d\n", SoftGeminiParam->wlanHpMaxTime));
68164064216a8433360745f69edddce19a606659163The Android Open Source Project	WLAN_OS_REPORT(("  senseDisableTimer = %d\n", SoftGeminiParam->senseDisableTimer));
68264064216a8433360745f69edddce19a606659163The Android Open Source Project	WLAN_OS_REPORT(("  protectiveRxTimeBeforeBtHp = %d\n", SoftGeminiParam->protectiveRxTimeBeforeBtHp));
68364064216a8433360745f69edddce19a606659163The Android Open Source Project	WLAN_OS_REPORT(("  protectiveTxTimeBeforeBtHp = %d\n", SoftGeminiParam->protectiveTxTimeBeforeBtHp));
68464064216a8433360745f69edddce19a606659163The Android Open Source Project	WLAN_OS_REPORT(("  protectiveRxTimeBeforeBtHpFastAp = %d\n", SoftGeminiParam->protectiveRxTimeBeforeBtHpFastAp));
68564064216a8433360745f69edddce19a606659163The Android Open Source Project	WLAN_OS_REPORT(("  protectiveTxTimeBeforeBtHpFastAp = %d\n", SoftGeminiParam->protectiveTxTimeBeforeBtHpFastAp));
68664064216a8433360745f69edddce19a606659163The Android Open Source Project	WLAN_OS_REPORT(("  protectiveWlanCycleTimeForFastAp = %d\n", SoftGeminiParam->protectiveWlanCycleTimeForFastAp));
68764064216a8433360745f69edddce19a606659163The Android Open Source Project    WLAN_OS_REPORT(("  btAntiStarvationPeriod  = %d\n", SoftGeminiParam->btAntiStarvationPeriod));
68864064216a8433360745f69edddce19a606659163The Android Open Source Project	WLAN_OS_REPORT(("  timeoutNextBtLpPacket = %d\n", SoftGeminiParam->timeoutNextBtLpPacket));
68964064216a8433360745f69edddce19a606659163The Android Open Source Project    WLAN_OS_REPORT(("  wakeUpTimeBeforeBeacon = %d\n", SoftGeminiParam->wakeUpTimeBeforeBeacon));
69064064216a8433360745f69edddce19a606659163The Android Open Source Project	WLAN_OS_REPORT(("  hpdmMaxGuardTime = %d\n", SoftGeminiParam->hpdmMaxGuardTime));
69164064216a8433360745f69edddce19a606659163The Android Open Source Project	WLAN_OS_REPORT(("  timeoutNextWlanPacket = %d\n", SoftGeminiParam->timeoutNextWlanPacket));
69264064216a8433360745f69edddce19a606659163The Android Open Source Project    WLAN_OS_REPORT(("  sgAntennaType = %d\n", SoftGeminiParam->sgAntennaType));
69364064216a8433360745f69edddce19a606659163The Android Open Source Project    WLAN_OS_REPORT(("  signalingType = %d\n", SoftGeminiParam->signalingType));
69464064216a8433360745f69edddce19a606659163The Android Open Source Project	WLAN_OS_REPORT(("  afhLeverageOn = %d\n", SoftGeminiParam->afhLeverageOn));
69564064216a8433360745f69edddce19a606659163The Android Open Source Project    WLAN_OS_REPORT(("  numberQuietCycle = %d\n", SoftGeminiParam->numberQuietCycle));
69664064216a8433360745f69edddce19a606659163The Android Open Source Project	WLAN_OS_REPORT(("  maxNumCts = %d\n", SoftGeminiParam->maxNumCts));
69764064216a8433360745f69edddce19a606659163The Android Open Source Project	WLAN_OS_REPORT(("  numberOfWlanPackets = %d\n", SoftGeminiParam->numberOfWlanPackets));
69864064216a8433360745f69edddce19a606659163The Android Open Source Project	WLAN_OS_REPORT(("  numberOfBtPackets = %d\n", SoftGeminiParam->numberOfBtPackets));
69964064216a8433360745f69edddce19a606659163The Android Open Source Project	WLAN_OS_REPORT(("  numberOfMissedRxForAvalancheTrigger = %d\n", SoftGeminiParam->numberOfMissedRxForAvalancheTrigger));
70064064216a8433360745f69edddce19a606659163The Android Open Source Project	WLAN_OS_REPORT(("  wlanElpHpSupport = %d\n", SoftGeminiParam->wlanElpHpSupport));
70164064216a8433360745f69edddce19a606659163The Android Open Source Project	WLAN_OS_REPORT(("  btAntiStarvationNumberOfCyclesWithinThePeriod = %d\n", SoftGeminiParam->btAntiStarvationNumberOfCyclesWithinThePeriod));
70264064216a8433360745f69edddce19a606659163The Android Open Source Project    WLAN_OS_REPORT(("  ackModeDuringBtLpInDualAnt = %d\n", SoftGeminiParam->ackModeDuringBtLpInDualAnt));
70364064216a8433360745f69edddce19a606659163The Android Open Source Project    WLAN_OS_REPORT(("  allowPaSdToggleDuringBtActivityEnable = %d\n", SoftGeminiParam->allowPaSdToggleDuringBtActivityEnable));
70464064216a8433360745f69edddce19a606659163The Android Open Source Project	WLAN_OS_REPORT(("  sgAutoModeNoCts = %d\n", SoftGeminiParam->sgAutoModeNoCts));
70564064216a8433360745f69edddce19a606659163The Android Open Source Project	WLAN_OS_REPORT(("  numOfBtHpRespectedReq = %d\n\n", SoftGeminiParam->numOfBtHpRespectedReq));
70664064216a8433360745f69edddce19a606659163The Android Open Source Project
70764064216a8433360745f69edddce19a606659163The Android Open Source Project	WLAN_OS_REPORT(("  Enable mode : %s\n", SoftGemini_ConvertModeToString(pSoftGemini->SoftGeminiEnable)));
70864064216a8433360745f69edddce19a606659163The Android Open Source Project	WLAN_OS_REPORT(("  Driver Enabled : %s\n",(pSoftGemini->bDriverEnabled ? "YES" : "NO")));
70964064216a8433360745f69edddce19a606659163The Android Open Source Project	WLAN_OS_REPORT(("  Protective mode : %s\n", (pSoftGemini->bProtectiveMode ? "ON" : "OFF")));
71064064216a8433360745f69edddce19a606659163The Android Open Source Project    WLAN_OS_REPORT(("  PsPoll failure active : %s\n", (pSoftGemini->bPsPollFailureActive ? "YES" : "NO")));
71164064216a8433360745f69edddce19a606659163The Android Open Source Project
71264064216a8433360745f69edddce19a606659163The Android Open Source Project#endif
71364064216a8433360745f69edddce19a606659163The Android Open Source Project}
71464064216a8433360745f69edddce19a606659163The Android Open Source Project
71564064216a8433360745f69edddce19a606659163The Android Open Source Project/***********************************************************************
71664064216a8433360745f69edddce19a606659163The Android Open Source Project *                        SoftGemini_reconnect
71764064216a8433360745f69edddce19a606659163The Android Open Source Project ***********************************************************************
71864064216a8433360745f69edddce19a606659163The Android Open Source ProjectDESCRIPTION: causes driver to disconnect and reconnect to current AP
71964064216a8433360745f69edddce19a606659163The Android Open Source Project
72064064216a8433360745f69edddce19a606659163The Android Open Source ProjectINPUT:      hSoftGemini	-	SoftGemini handle.
72164064216a8433360745f69edddce19a606659163The Android Open Source Project
72264064216a8433360745f69edddce19a606659163The Android Open Source Project************************************************************************/
72364064216a8433360745f69edddce19a606659163The Android Open Source Project
72464064216a8433360745f69edddce19a606659163The Android Open Source Projectvoid SoftGemini_reconnect(TI_HANDLE hSoftGemini)
72564064216a8433360745f69edddce19a606659163The Android Open Source Project{
72664064216a8433360745f69edddce19a606659163The Android Open Source Project	SoftGemini_t *pSoftGemini = (SoftGemini_t *)hSoftGemini;
72764064216a8433360745f69edddce19a606659163The Android Open Source Project	paramInfo_t	ssidParam;
72864064216a8433360745f69edddce19a606659163The Android Open Source Project	paramInfo_t	param;
72964064216a8433360745f69edddce19a606659163The Android Open Source Project	TI_STATUS	status;
73064064216a8433360745f69edddce19a606659163The Android Open Source Project
73164064216a8433360745f69edddce19a606659163The Android Open Source Project	/* Get current SSID; if we are not connected, there is nothing to do, return */
73264064216a8433360745f69edddce19a606659163The Android Open Source Project	ssidParam.paramType = SITE_MGR_CURRENT_SSID_PARAM;
73364064216a8433360745f69edddce19a606659163The Android Open Source Project	status =  configMgr_getParam(pSoftGemini->hConfigMgr, &ssidParam);
73464064216a8433360745f69edddce19a606659163The Android Open Source Project	if (status != OK)
73564064216a8433360745f69edddce19a606659163The Android Open Source Project	{
73664064216a8433360745f69edddce19a606659163The Android Open Source Project		return;
73764064216a8433360745f69edddce19a606659163The Android Open Source Project	}
73864064216a8433360745f69edddce19a606659163The Android Open Source Project
73964064216a8433360745f69edddce19a606659163The Android Open Source Project	/* Take care of scan enabled SME parameter: if is set to TRUE, set it to SKIP_ONCE */
74064064216a8433360745f69edddce19a606659163The Android Open Source Project	param.paramType = SME_SCAN_ENABLED_PARAM;
74164064216a8433360745f69edddce19a606659163The Android Open Source Project	configMgr_getParam(pSoftGemini->hConfigMgr, &param);
74264064216a8433360745f69edddce19a606659163The Android Open Source Project
74364064216a8433360745f69edddce19a606659163The Android Open Source Project	if (param.content.smeSMScanEnabled == SCAN_ENABLED)
74464064216a8433360745f69edddce19a606659163The Android Open Source Project	{
74564064216a8433360745f69edddce19a606659163The Android Open Source Project		param.content.smeSMScanEnabled = SKIP_NEXT_SCAN;
74664064216a8433360745f69edddce19a606659163The Android Open Source Project		configMgr_setParam(pSoftGemini->hConfigMgr, &param);
74764064216a8433360745f69edddce19a606659163The Android Open Source Project	}
74864064216a8433360745f69edddce19a606659163The Android Open Source Project
74964064216a8433360745f69edddce19a606659163The Android Open Source Project	WLAN_REPORT_INFORMATION(pSoftGemini->hReport, SOFT_GEMINI_MODULE_LOG,  ("%s - reconnecting !!!\n",__FUNCTION__));
75064064216a8433360745f69edddce19a606659163The Android Open Source Project
75164064216a8433360745f69edddce19a606659163The Android Open Source Project	/* Re-set desired SSID */
75264064216a8433360745f69edddce19a606659163The Android Open Source Project	ssidParam.paramType = SITE_MGR_DESIRED_SSID_PARAM;
75364064216a8433360745f69edddce19a606659163The Android Open Source Project	configMgr_setParam(pSoftGemini->hConfigMgr, &ssidParam);
75464064216a8433360745f69edddce19a606659163The Android Open Source Project}
75564064216a8433360745f69edddce19a606659163The Android Open Source Project
75664064216a8433360745f69edddce19a606659163The Android Open Source Project/***************************************************************************
75764064216a8433360745f69edddce19a606659163The Android Open Source Project*					SoftGemini_setParamsToFW					    	       *
75864064216a8433360745f69edddce19a606659163The Android Open Source Project****************************************************************************
75964064216a8433360745f69edddce19a606659163The Android Open Source Project* DESCRIPTION:	The function sets the FW with the appropriate parameters set.
76064064216a8433360745f69edddce19a606659163The Android Open Source Project*
76164064216a8433360745f69edddce19a606659163The Android Open Source Project* INPUTS:		pSoftGemini - the object
76264064216a8433360745f69edddce19a606659163The Android Open Source Project*
76364064216a8433360745f69edddce19a606659163The Android Open Source Project*
76464064216a8433360745f69edddce19a606659163The Android Open Source Project* OUTPUT:
76564064216a8433360745f69edddce19a606659163The Android Open Source Project*
76664064216a8433360745f69edddce19a606659163The Android Open Source Project* RETURNS:
76764064216a8433360745f69edddce19a606659163The Android Open Source Project***************************************************************************/
76864064216a8433360745f69edddce19a606659163The Android Open Source Projectstatic TI_STATUS SoftGemini_setParamsToFW(TI_HANDLE hSoftGemini, SoftGeminiParam_t *SoftGeminiParam)
76964064216a8433360745f69edddce19a606659163The Android Open Source Project{
77064064216a8433360745f69edddce19a606659163The Android Open Source Project	SoftGemini_t *pSoftGemini = (SoftGemini_t *)hSoftGemini;
77164064216a8433360745f69edddce19a606659163The Android Open Source Project	whalParamInfo_t	whalParam;
77264064216a8433360745f69edddce19a606659163The Android Open Source Project
77364064216a8433360745f69edddce19a606659163The Android Open Source Project	os_memoryCopy(pSoftGemini->hOs,&whalParam.content.SoftGeminiParam, SoftGeminiParam, sizeof(SoftGeminiParam_t));
77464064216a8433360745f69edddce19a606659163The Android Open Source Project	whalParam.paramType = HAL_CTRL_SG_CONFIG_PARAM;
77564064216a8433360745f69edddce19a606659163The Android Open Source Project	return whalCtrl_SetParam(pSoftGemini->hHalCtrl,&whalParam);
77664064216a8433360745f69edddce19a606659163The Android Open Source Project}
77764064216a8433360745f69edddce19a606659163The Android Open Source Project
77864064216a8433360745f69edddce19a606659163The Android Open Source Project
77964064216a8433360745f69edddce19a606659163The Android Open Source Project/***************************************************************************
78064064216a8433360745f69edddce19a606659163The Android Open Source Project*					SoftGemini_EnableDriver  		    	       *
78164064216a8433360745f69edddce19a606659163The Android Open Source Project****************************************************************************
78264064216a8433360745f69edddce19a606659163The Android Open Source Project* DESCRIPTION:	Activated when SG is enabled (after CLI or FW command)
78364064216a8433360745f69edddce19a606659163The Android Open Source Project*
78464064216a8433360745f69edddce19a606659163The Android Open Source Project* INPUTS:		pSoftGemini - the object
78564064216a8433360745f69edddce19a606659163The Android Open Source Project*
78664064216a8433360745f69edddce19a606659163The Android Open Source Project***************************************************************************/
78764064216a8433360745f69edddce19a606659163The Android Open Source Projectstatic TI_STATUS SoftGemini_EnableDriver(TI_HANDLE hSoftGemini)
78864064216a8433360745f69edddce19a606659163The Android Open Source Project{
78964064216a8433360745f69edddce19a606659163The Android Open Source Project	SoftGemini_t	*pSoftGemini = (SoftGemini_t *)hSoftGemini;
79064064216a8433360745f69edddce19a606659163The Android Open Source Project	TI_STATUS return_value = OK;
79164064216a8433360745f69edddce19a606659163The Android Open Source Project	paramInfo_t param;
79264064216a8433360745f69edddce19a606659163The Android Open Source Project
79364064216a8433360745f69edddce19a606659163The Android Open Source Project	WLAN_REPORT_INFORMATION(pSoftGemini->hReport, SOFT_GEMINI_MODULE_LOG,  ("%s\n",__FUNCTION__));
79464064216a8433360745f69edddce19a606659163The Android Open Source Project
79564064216a8433360745f69edddce19a606659163The Android Open Source Project	pSoftGemini->bDriverEnabled = TRUE;
79664064216a8433360745f69edddce19a606659163The Android Open Source Project
79764064216a8433360745f69edddce19a606659163The Android Open Source Project	/* Set Always PS only if sgAutoModeNoCts is FALSE, i.e. normal operation */
79864064216a8433360745f69edddce19a606659163The Android Open Source Project	if ( !pSoftGemini->SoftGeminiParam.sgAutoModeNoCts )
79964064216a8433360745f69edddce19a606659163The Android Open Source Project	{
80064064216a8433360745f69edddce19a606659163The Android Open Source Project		SoftGemini_SetPS(pSoftGemini);
80164064216a8433360745f69edddce19a606659163The Android Open Source Project	}
80264064216a8433360745f69edddce19a606659163The Android Open Source Project
80364064216a8433360745f69edddce19a606659163The Android Open Source Project	/* set ctrlData to use SG rates */
80464064216a8433360745f69edddce19a606659163The Android Open Source Project	param.paramType = CTRL_DATA_CURRENT_RATE_CLASS_CLIENT;
80564064216a8433360745f69edddce19a606659163The Android Open Source Project	param.content.ctrlDataRateClassID = SG_RATE_CLASS;
80664064216a8433360745f69edddce19a606659163The Android Open Source Project	ctrlData_setParam(pSoftGemini->hCtrlData,&param);
80764064216a8433360745f69edddce19a606659163The Android Open Source Project
80864064216a8433360745f69edddce19a606659163The Android Open Source Project	scr_setMode(pSoftGemini->hSCR, SCR_MID_SG);
80964064216a8433360745f69edddce19a606659163The Android Open Source Project
81064064216a8433360745f69edddce19a606659163The Android Open Source Project	return return_value;
81164064216a8433360745f69edddce19a606659163The Android Open Source Project}
81264064216a8433360745f69edddce19a606659163The Android Open Source Project
81364064216a8433360745f69edddce19a606659163The Android Open Source Project/***************************************************************************
81464064216a8433360745f69edddce19a606659163The Android Open Source Project*					SoftGemini_DisableDriver  		    	       *
81564064216a8433360745f69edddce19a606659163The Android Open Source Project****************************************************************************
81664064216a8433360745f69edddce19a606659163The Android Open Source Project* DESCRIPTION:	Activated when SG is disabled (after CLI or FW command)
81764064216a8433360745f69edddce19a606659163The Android Open Source Project*
81864064216a8433360745f69edddce19a606659163The Android Open Source Project* INPUTS:		pSoftGemini - the object
81964064216a8433360745f69edddce19a606659163The Android Open Source Project*
82064064216a8433360745f69edddce19a606659163The Android Open Source Project***************************************************************************/
82164064216a8433360745f69edddce19a606659163The Android Open Source Projectstatic TI_STATUS SoftGemini_DisableDriver(TI_HANDLE hSoftGemini)
82264064216a8433360745f69edddce19a606659163The Android Open Source Project{
82364064216a8433360745f69edddce19a606659163The Android Open Source Project	SoftGemini_t	*pSoftGemini = (SoftGemini_t *)hSoftGemini;
82464064216a8433360745f69edddce19a606659163The Android Open Source Project	TI_STATUS return_value = OK;
82564064216a8433360745f69edddce19a606659163The Android Open Source Project	paramInfo_t param;
82664064216a8433360745f69edddce19a606659163The Android Open Source Project
82764064216a8433360745f69edddce19a606659163The Android Open Source Project	WLAN_REPORT_INFORMATION(pSoftGemini->hReport, SOFT_GEMINI_MODULE_LOG,  ("%s\n",__FUNCTION__));
82864064216a8433360745f69edddce19a606659163The Android Open Source Project
82964064216a8433360745f69edddce19a606659163The Android Open Source Project	pSoftGemini->bDriverEnabled = FALSE;
83064064216a8433360745f69edddce19a606659163The Android Open Source Project
83164064216a8433360745f69edddce19a606659163The Android Open Source Project	/* set ctrlData to use default rates */
83264064216a8433360745f69edddce19a606659163The Android Open Source Project	param.paramType = CTRL_DATA_CURRENT_RATE_CLASS_CLIENT;
83364064216a8433360745f69edddce19a606659163The Android Open Source Project	param.content.ctrlDataRateClassID = USER_RATE_CLASS;
83464064216a8433360745f69edddce19a606659163The Android Open Source Project	ctrlData_setParam(pSoftGemini->hCtrlData,&param);
83564064216a8433360745f69edddce19a606659163The Android Open Source Project
83664064216a8433360745f69edddce19a606659163The Android Open Source Project	scr_setMode(pSoftGemini->hSCR, SCR_MID_NORMAL);
83764064216a8433360745f69edddce19a606659163The Android Open Source Project
83864064216a8433360745f69edddce19a606659163The Android Open Source Project	/* unSet Always PS only if sgAutoModeNoCts is FALSE, i.e. normal operation */
83964064216a8433360745f69edddce19a606659163The Android Open Source Project	if ( !pSoftGemini->SoftGeminiParam.sgAutoModeNoCts )
84064064216a8433360745f69edddce19a606659163The Android Open Source Project	{
84164064216a8433360745f69edddce19a606659163The Android Open Source Project		SoftGemini_unSetPS(pSoftGemini);
84264064216a8433360745f69edddce19a606659163The Android Open Source Project	}
84364064216a8433360745f69edddce19a606659163The Android Open Source Project
84464064216a8433360745f69edddce19a606659163The Android Open Source Project	/* Undo the changes that were made when Protective mode was on */
84564064216a8433360745f69edddce19a606659163The Android Open Source Project	if (pSoftGemini->bProtectiveMode)
84664064216a8433360745f69edddce19a606659163The Android Open Source Project	{
84764064216a8433360745f69edddce19a606659163The Android Open Source Project		SoftGemini_DisableProtectiveMode(hSoftGemini);
84864064216a8433360745f69edddce19a606659163The Android Open Source Project	}
84964064216a8433360745f69edddce19a606659163The Android Open Source Project
85064064216a8433360745f69edddce19a606659163The Android Open Source Project	return return_value;
85164064216a8433360745f69edddce19a606659163The Android Open Source Project
85264064216a8433360745f69edddce19a606659163The Android Open Source Project}
85364064216a8433360745f69edddce19a606659163The Android Open Source Project
85464064216a8433360745f69edddce19a606659163The Android Open Source Project/***************************************************************************
85564064216a8433360745f69edddce19a606659163The Android Open Source Project*					SoftGemini_SetPS  		    						   *
85664064216a8433360745f69edddce19a606659163The Android Open Source Project****************************************************************************
85764064216a8433360745f69edddce19a606659163The Android Open Source Project* DESCRIPTION:	Set Always PS to PowerMgr
85864064216a8433360745f69edddce19a606659163The Android Open Source Project*
85964064216a8433360745f69edddce19a606659163The Android Open Source Project* INPUTS:		pSoftGemini - the object
86064064216a8433360745f69edddce19a606659163The Android Open Source Project*
86164064216a8433360745f69edddce19a606659163The Android Open Source Project***************************************************************************/
86264064216a8433360745f69edddce19a606659163The Android Open Source Projectstatic TI_STATUS SoftGemini_SetPS(SoftGemini_t	*pSoftGemini)
86364064216a8433360745f69edddce19a606659163The Android Open Source Project{
86464064216a8433360745f69edddce19a606659163The Android Open Source Project	paramInfo_t param;
86564064216a8433360745f69edddce19a606659163The Android Open Source Project	bssEntry_t *pBssInfo=NULL;
86664064216a8433360745f69edddce19a606659163The Android Open Source Project
86764064216a8433360745f69edddce19a606659163The Android Open Source Project    if (pSoftGemini->hCurrBss)
86864064216a8433360745f69edddce19a606659163The Android Open Source Project	{
86964064216a8433360745f69edddce19a606659163The Android Open Source Project		pBssInfo = currBSS_getBssInfo(pSoftGemini->hCurrBss);
87064064216a8433360745f69edddce19a606659163The Android Open Source Project	}
87164064216a8433360745f69edddce19a606659163The Android Open Source Project	else WLAN_REPORT_ERROR(pSoftGemini->hReport, SOFT_GEMINI_MODULE_LOG,  ("SoftGemini_SetPS: hCurrBss = NULL!!!\n"));
87264064216a8433360745f69edddce19a606659163The Android Open Source Project
87364064216a8433360745f69edddce19a606659163The Android Open Source Project
87464064216a8433360745f69edddce19a606659163The Android Open Source Project	WLAN_REPORT_INFORMATION(pSoftGemini->hReport, SOFT_GEMINI_MODULE_LOG,  ("%s\n",__FUNCTION__));
87564064216a8433360745f69edddce19a606659163The Android Open Source Project
87664064216a8433360745f69edddce19a606659163The Android Open Source Project	if (pBssInfo)
87764064216a8433360745f69edddce19a606659163The Android Open Source Project	{
87864064216a8433360745f69edddce19a606659163The Android Open Source Project		if ((pBssInfo->band == RADIO_BAND_2_4_GHZ) && (!pSoftGemini->SoftGeminiParam.sgAutoModeNoCts))
87964064216a8433360745f69edddce19a606659163The Android Open Source Project		{
88064064216a8433360745f69edddce19a606659163The Android Open Source Project			WLAN_REPORT_INFORMATION(pSoftGemini->hReport, SOFT_GEMINI_MODULE_LOG, (" SG-setPS: band == RADIO_BAND_2_4_GHZ"));
88164064216a8433360745f69edddce19a606659163The Android Open Source Project
88264064216a8433360745f69edddce19a606659163The Android Open Source Project			/* Set Params to Power Mgr for SG priority */
88364064216a8433360745f69edddce19a606659163The Android Open Source Project			param.paramType = POWER_MGR_POWER_MODE;
88464064216a8433360745f69edddce19a606659163The Android Open Source Project			param.content.powerMngPowerMode.PowerMode = POWER_MODE_PS_ONLY;
88564064216a8433360745f69edddce19a606659163The Android Open Source Project			param.content.powerMngPowerMode.powerMngPriority = POWER_MANAGER_SG_PRIORITY;
88664064216a8433360745f69edddce19a606659163The Android Open Source Project			powerMgr_setParam(pSoftGemini->hPowerMgr,&param);
88764064216a8433360745f69edddce19a606659163The Android Open Source Project
88864064216a8433360745f69edddce19a606659163The Android Open Source Project			/* enable SG priority for Power Mgr */
88964064216a8433360745f69edddce19a606659163The Android Open Source Project			param.paramType = POWER_MGR_ENABLE_PRIORITY;
89064064216a8433360745f69edddce19a606659163The Android Open Source Project			param.content.powerMngPriority = POWER_MANAGER_SG_PRIORITY;
89164064216a8433360745f69edddce19a606659163The Android Open Source Project			return powerMgr_setParam(pSoftGemini->hPowerMgr,&param);
89264064216a8433360745f69edddce19a606659163The Android Open Source Project		}
89364064216a8433360745f69edddce19a606659163The Android Open Source Project		else WLAN_REPORT_INFORMATION(pSoftGemini->hReport, SOFT_GEMINI_MODULE_LOG, (" SG-setPS: band == RADIO_BAND_5_GHZ"));
89464064216a8433360745f69edddce19a606659163The Android Open Source Project	}
89564064216a8433360745f69edddce19a606659163The Android Open Source Project	return OK;
89664064216a8433360745f69edddce19a606659163The Android Open Source Project}
89764064216a8433360745f69edddce19a606659163The Android Open Source Project
89864064216a8433360745f69edddce19a606659163The Android Open Source Project/***************************************************************************
89964064216a8433360745f69edddce19a606659163The Android Open Source Project*					SoftGemini_unSetPS  		    						   *
90064064216a8433360745f69edddce19a606659163The Android Open Source Project****************************************************************************
90164064216a8433360745f69edddce19a606659163The Android Open Source Project* DESCRIPTION:	unSet Always PS to PowerMgr
90264064216a8433360745f69edddce19a606659163The Android Open Source Project*
90364064216a8433360745f69edddce19a606659163The Android Open Source Project* INPUTS:		pSoftGemini - the object
90464064216a8433360745f69edddce19a606659163The Android Open Source Project*
90564064216a8433360745f69edddce19a606659163The Android Open Source Project***************************************************************************/
90664064216a8433360745f69edddce19a606659163The Android Open Source Projectstatic TI_STATUS SoftGemini_unSetPS(SoftGemini_t	*pSoftGemini)
90764064216a8433360745f69edddce19a606659163The Android Open Source Project{
90864064216a8433360745f69edddce19a606659163The Android Open Source Project	paramInfo_t param;
90964064216a8433360745f69edddce19a606659163The Android Open Source Project
91064064216a8433360745f69edddce19a606659163The Android Open Source Project	WLAN_REPORT_INFORMATION(pSoftGemini->hReport, SOFT_GEMINI_MODULE_LOG,  ("%s, SG-unSetPS \n",__FUNCTION__));
91164064216a8433360745f69edddce19a606659163The Android Open Source Project
91264064216a8433360745f69edddce19a606659163The Android Open Source Project     /* disable SG priority for Power Mgr*/
91364064216a8433360745f69edddce19a606659163The Android Open Source Project	param.paramType = POWER_MGR_DISABLE_PRIORITY;
91464064216a8433360745f69edddce19a606659163The Android Open Source Project	param.content.powerMngPriority = POWER_MANAGER_SG_PRIORITY;
91564064216a8433360745f69edddce19a606659163The Android Open Source Project	return powerMgr_setParam(pSoftGemini->hPowerMgr,&param);
91664064216a8433360745f69edddce19a606659163The Android Open Source Project
91764064216a8433360745f69edddce19a606659163The Android Open Source Project}
91864064216a8433360745f69edddce19a606659163The Android Open Source Project
91964064216a8433360745f69edddce19a606659163The Android Open Source Project/***************************************************************************
92064064216a8433360745f69edddce19a606659163The Android Open Source Project*					SoftGemini_EnableProtectiveMode  		    	       *
92164064216a8433360745f69edddce19a606659163The Android Open Source Project****************************************************************************
92264064216a8433360745f69edddce19a606659163The Android Open Source Project* DESCRIPTION:	Activated when FW inform us that protective mode is ON
92364064216a8433360745f69edddce19a606659163The Android Open Source Project*
92464064216a8433360745f69edddce19a606659163The Android Open Source Project*
92564064216a8433360745f69edddce19a606659163The Android Open Source Project* INPUTS:		pSoftGemini - the object
92664064216a8433360745f69edddce19a606659163The Android Open Source Project*
92764064216a8433360745f69edddce19a606659163The Android Open Source Project***************************************************************************/
92864064216a8433360745f69edddce19a606659163The Android Open Source Projectvoid SoftGemini_EnableProtectiveMode(TI_HANDLE hSoftGemini)
92964064216a8433360745f69edddce19a606659163The Android Open Source Project{
93064064216a8433360745f69edddce19a606659163The Android Open Source Project	SoftGemini_t	*pSoftGemini = (SoftGemini_t *)hSoftGemini;
93164064216a8433360745f69edddce19a606659163The Android Open Source Project	paramInfo_t 	param;
93264064216a8433360745f69edddce19a606659163The Android Open Source Project
93364064216a8433360745f69edddce19a606659163The Android Open Source Project	WLAN_REPORT_INFORMATION(pSoftGemini->hReport, SOFT_GEMINI_MODULE_LOG,  ("%s\n",__FUNCTION__));
93464064216a8433360745f69edddce19a606659163The Android Open Source Project
93564064216a8433360745f69edddce19a606659163The Android Open Source Project	pSoftGemini->bProtectiveMode = TRUE;
93664064216a8433360745f69edddce19a606659163The Android Open Source Project
93764064216a8433360745f69edddce19a606659163The Android Open Source Project	/* set new configurations of SG roaming parameters */
93864064216a8433360745f69edddce19a606659163The Android Open Source Project	currBSS_SGconfigureBSSLoss(pSoftGemini->hCurrBss,pSoftGemini->BSSLossCompensationPercent,TRUE);
93964064216a8433360745f69edddce19a606659163The Android Open Source Project
94064064216a8433360745f69edddce19a606659163The Android Open Source Project	/* set new configurations of scan to scancncn */
94164064216a8433360745f69edddce19a606659163The Android Open Source Project	scanConcentrator_SGconfigureScanParams(pSoftGemini->hScanCncn,TRUE,pSoftGemini->scanNumOfProbeRequest,
94264064216a8433360745f69edddce19a606659163The Android Open Source Project		pSoftGemini->scanCompensationMaxTime,pSoftGemini->scanCompensationPercent);
94364064216a8433360745f69edddce19a606659163The Android Open Source Project
94464064216a8433360745f69edddce19a606659163The Android Open Source Project    /* Call the power manager to enter short doze */
94564064216a8433360745f69edddce19a606659163The Android Open Source Project	WLAN_REPORT_INFORMATION(pSoftGemini->hReport, SOFT_GEMINI_MODULE_LOG, (" SoftGemini_EnableProtectiveMode set SD"));
94664064216a8433360745f69edddce19a606659163The Android Open Source Project
94764064216a8433360745f69edddce19a606659163The Android Open Source Project	/* Set Params to Power Mgr for SG priority */
94864064216a8433360745f69edddce19a606659163The Android Open Source Project	param.paramType = POWER_MGR_POWER_MODE;
94964064216a8433360745f69edddce19a606659163The Android Open Source Project	param.content.powerMngPowerMode.PowerMode = POWER_MODE_SHORT_DOZE;
95064064216a8433360745f69edddce19a606659163The Android Open Source Project	param.content.powerMngPowerMode.powerMngPriority = POWER_MANAGER_SG_PRIORITY;
95164064216a8433360745f69edddce19a606659163The Android Open Source Project	powerMgr_setParam(pSoftGemini->hPowerMgr,&param);
95264064216a8433360745f69edddce19a606659163The Android Open Source Project}
95364064216a8433360745f69edddce19a606659163The Android Open Source Project
95464064216a8433360745f69edddce19a606659163The Android Open Source Project/***************************************************************************
95564064216a8433360745f69edddce19a606659163The Android Open Source Project*					SoftGemini_DisableProtectiveMode  		    	       *
95664064216a8433360745f69edddce19a606659163The Android Open Source Project****************************************************************************
95764064216a8433360745f69edddce19a606659163The Android Open Source Project* DESCRIPTION:	Activated when FW inform us that protective mode is OFF or SG is disabled
95864064216a8433360745f69edddce19a606659163The Android Open Source Project*
95964064216a8433360745f69edddce19a606659163The Android Open Source Project* INPUTS:		pSoftGemini - the object
96064064216a8433360745f69edddce19a606659163The Android Open Source Project*
96164064216a8433360745f69edddce19a606659163The Android Open Source Project***************************************************************************/
96264064216a8433360745f69edddce19a606659163The Android Open Source Projectvoid SoftGemini_DisableProtectiveMode(TI_HANDLE hSoftGemini)
96364064216a8433360745f69edddce19a606659163The Android Open Source Project{
96464064216a8433360745f69edddce19a606659163The Android Open Source Project	SoftGemini_t	*pSoftGemini = (SoftGemini_t *)hSoftGemini;
96564064216a8433360745f69edddce19a606659163The Android Open Source Project
96664064216a8433360745f69edddce19a606659163The Android Open Source Project	WLAN_REPORT_INFORMATION(pSoftGemini->hReport, SOFT_GEMINI_MODULE_LOG,  ("%s\n",__FUNCTION__));
96764064216a8433360745f69edddce19a606659163The Android Open Source Project
96864064216a8433360745f69edddce19a606659163The Android Open Source Project	pSoftGemini->bProtectiveMode = FALSE;
96964064216a8433360745f69edddce19a606659163The Android Open Source Project
97064064216a8433360745f69edddce19a606659163The Android Open Source Project	SoftGemini_RemoveProtectiveModeParameters(hSoftGemini);
97164064216a8433360745f69edddce19a606659163The Android Open Source Project}
97264064216a8433360745f69edddce19a606659163The Android Open Source Project
97364064216a8433360745f69edddce19a606659163The Android Open Source Project/***************************************************************************
97464064216a8433360745f69edddce19a606659163The Android Open Source Project*					SoftGemini_DisableProtectiveMode  		    	       *
97564064216a8433360745f69edddce19a606659163The Android Open Source Project****************************************************************************
97664064216a8433360745f69edddce19a606659163The Android Open Source Project* DESCRIPTION:	Called from SoftGemini_DisableProtectiveMode() when FW inform
97764064216a8433360745f69edddce19a606659163The Android Open Source Project*				us that protective mode is OFF or SG is disabled, or from
97864064216a8433360745f69edddce19a606659163The Android Open Source Project*				SoftGemini_unSetPSmode() when driver disconnects from AP.
97964064216a8433360745f69edddce19a606659163The Android Open Source Project*
98064064216a8433360745f69edddce19a606659163The Android Open Source Project* INPUTS:		pSoftGemini - the object
98164064216a8433360745f69edddce19a606659163The Android Open Source Project*
98264064216a8433360745f69edddce19a606659163The Android Open Source Project***************************************************************************/
98364064216a8433360745f69edddce19a606659163The Android Open Source Project
98464064216a8433360745f69edddce19a606659163The Android Open Source Projectvoid SoftGemini_RemoveProtectiveModeParameters(TI_HANDLE hSoftGemini)
98564064216a8433360745f69edddce19a606659163The Android Open Source Project{
98664064216a8433360745f69edddce19a606659163The Android Open Source Project	SoftGemini_t	*pSoftGemini = (SoftGemini_t *)hSoftGemini;
98764064216a8433360745f69edddce19a606659163The Android Open Source Project	paramInfo_t  	param;
98864064216a8433360745f69edddce19a606659163The Android Open Source Project
98964064216a8433360745f69edddce19a606659163The Android Open Source Project	WLAN_REPORT_INFORMATION(pSoftGemini->hReport, SOFT_GEMINI_MODULE_LOG,  ("%s\n",__FUNCTION__));
99064064216a8433360745f69edddce19a606659163The Android Open Source Project
99164064216a8433360745f69edddce19a606659163The Android Open Source Project	/* don't use the SG roaming parameters */
99264064216a8433360745f69edddce19a606659163The Android Open Source Project	currBSS_SGconfigureBSSLoss(pSoftGemini->hCurrBss,0,FALSE);
99364064216a8433360745f69edddce19a606659163The Android Open Source Project
99464064216a8433360745f69edddce19a606659163The Android Open Source Project	/* don't use the SG scan parameters */
99564064216a8433360745f69edddce19a606659163The Android Open Source Project	scanConcentrator_SGconfigureScanParams(pSoftGemini->hScanCncn,FALSE,0,0,0);
99664064216a8433360745f69edddce19a606659163The Android Open Source Project
99764064216a8433360745f69edddce19a606659163The Android Open Source Project    /* Call the power manager to exit short doze */
99864064216a8433360745f69edddce19a606659163The Android Open Source Project	/* Set Params to Power Mgr for SG priority */
99964064216a8433360745f69edddce19a606659163The Android Open Source Project	param.paramType = POWER_MGR_POWER_MODE;
100064064216a8433360745f69edddce19a606659163The Android Open Source Project	param.content.powerMngPowerMode.PowerMode = POWER_MODE_PS_ONLY;
100164064216a8433360745f69edddce19a606659163The Android Open Source Project	param.content.powerMngPowerMode.powerMngPriority = POWER_MANAGER_SG_PRIORITY;
100264064216a8433360745f69edddce19a606659163The Android Open Source Project	powerMgr_setParam(pSoftGemini->hPowerMgr,&param);
100364064216a8433360745f69edddce19a606659163The Android Open Source Project}
100464064216a8433360745f69edddce19a606659163The Android Open Source Project
100564064216a8433360745f69edddce19a606659163The Android Open Source Project/***************************************************************************
100664064216a8433360745f69edddce19a606659163The Android Open Source Project*					SoftGemini_SenseIndicationCB  		    	       *
100764064216a8433360745f69edddce19a606659163The Android Open Source Project****************************************************************************
100864064216a8433360745f69edddce19a606659163The Android Open Source Project* DESCRIPTION:	This is the the function which is called for sense mode indication from FW
100964064216a8433360745f69edddce19a606659163The Android Open Source Project*				(i.e. we are in SENSE mode and FW detects BT activity )
101064064216a8433360745f69edddce19a606659163The Android Open Source Project*				SENSE_MODE_ENABLE - Indicates that FW detected BT activity
101164064216a8433360745f69edddce19a606659163The Android Open Source Project*				SENSE_MODE_DISABLE - Indicates that FW doesn't detect BT activity for a period of time
101264064216a8433360745f69edddce19a606659163The Android Open Source Project*
101364064216a8433360745f69edddce19a606659163The Android Open Source Project* INPUTS:		pSoftGemini - the object
101464064216a8433360745f69edddce19a606659163The Android Open Source Project* NOTE			This function is located in the API for debug purposes
101564064216a8433360745f69edddce19a606659163The Android Open Source Project***************************************************************************/
101664064216a8433360745f69edddce19a606659163The Android Open Source Project
101764064216a8433360745f69edddce19a606659163The Android Open Source Projectvoid SoftGemini_SenseIndicationCB( TI_HANDLE hSoftGemini, char* str, UINT32 strLen )
101864064216a8433360745f69edddce19a606659163The Android Open Source Project{
101964064216a8433360745f69edddce19a606659163The Android Open Source Project	SoftGemini_t	*pSoftGemini = (SoftGemini_t *)hSoftGemini;
102064064216a8433360745f69edddce19a606659163The Android Open Source Project
102164064216a8433360745f69edddce19a606659163The Android Open Source Project	WLAN_REPORT_INFORMATION(pSoftGemini->hReport, SOFT_GEMINI_MODULE_LOG,  ("%s with 0x%x\n",__FUNCTION__,*str));
102264064216a8433360745f69edddce19a606659163The Android Open Source Project
102364064216a8433360745f69edddce19a606659163The Android Open Source Project	if ((SG_SENSE_NO_ACTIVITY == pSoftGemini->SoftGeminiEnable) && (SENSE_MODE_ENABLE == *str))
102464064216a8433360745f69edddce19a606659163The Android Open Source Project	{
102564064216a8433360745f69edddce19a606659163The Android Open Source Project		SoftGemini_setEnableParam(hSoftGemini, SG_SENSE_ACTIVE, FALSE);
102664064216a8433360745f69edddce19a606659163The Android Open Source Project	}
102764064216a8433360745f69edddce19a606659163The Android Open Source Project	else if ((SG_SENSE_ACTIVE == pSoftGemini->SoftGeminiEnable) && (SENSE_MODE_DISABLE == *str))
102864064216a8433360745f69edddce19a606659163The Android Open Source Project	{
102964064216a8433360745f69edddce19a606659163The Android Open Source Project		SoftGemini_setEnableParam(hSoftGemini, SG_SENSE_NO_ACTIVITY, FALSE);
103064064216a8433360745f69edddce19a606659163The Android Open Source Project	}
103164064216a8433360745f69edddce19a606659163The Android Open Source Project	else
103264064216a8433360745f69edddce19a606659163The Android Open Source Project	{
103364064216a8433360745f69edddce19a606659163The Android Open Source Project			WLAN_REPORT_WARNING(pSoftGemini->hReport, SOFT_GEMINI_MODULE_LOG,  ("%s : %s called when SG mode is %s ? \n",
103464064216a8433360745f69edddce19a606659163The Android Open Source Project				__FUNCTION__,SoftGemini_ConvertModeToString(((SENSE_MODE_ENABLE == *str) ? SG_SENSE_ACTIVE : SG_SENSE_NO_ACTIVITY))
103564064216a8433360745f69edddce19a606659163The Android Open Source Project				,SoftGemini_ConvertModeToString(pSoftGemini->SoftGeminiEnable)));
103664064216a8433360745f69edddce19a606659163The Android Open Source Project	}
103764064216a8433360745f69edddce19a606659163The Android Open Source Project}
103864064216a8433360745f69edddce19a606659163The Android Open Source Project
103964064216a8433360745f69edddce19a606659163The Android Open Source Project/***************************************************************************
104064064216a8433360745f69edddce19a606659163The Android Open Source Project*					SoftGemini_ProtectiveIndicationCB  		    	       *
104164064216a8433360745f69edddce19a606659163The Android Open Source Project****************************************************************************
104264064216a8433360745f69edddce19a606659163The Android Open Source Project* DESCRIPTION:	This is the the function which is called when FW starts Protective mode (i.e BT voice)
104364064216a8433360745f69edddce19a606659163The Android Open Source Project*
104464064216a8433360745f69edddce19a606659163The Android Open Source Project*				PROTECTIVE_MODE_ON - FW is activated on protective mode (BT voice is running)
104564064216a8433360745f69edddce19a606659163The Android Open Source Project*				PROTECTIVE_MODE_OFF - FW is not activated on protective mode
104664064216a8433360745f69edddce19a606659163The Android Open Source Project*
104764064216a8433360745f69edddce19a606659163The Android Open Source Project* INPUTS:		pSoftGemini - the object
104864064216a8433360745f69edddce19a606659163The Android Open Source Project* NOTE			This function is located in the API for debug purposes
104964064216a8433360745f69edddce19a606659163The Android Open Source Project***************************************************************************/
105064064216a8433360745f69edddce19a606659163The Android Open Source Project
105164064216a8433360745f69edddce19a606659163The Android Open Source Projectvoid SoftGemini_ProtectiveIndicationCB( TI_HANDLE hSoftGemini, char* str, UINT32 strLen )
105264064216a8433360745f69edddce19a606659163The Android Open Source Project{
105364064216a8433360745f69edddce19a606659163The Android Open Source Project	SoftGemini_t	*pSoftGemini = (SoftGemini_t *)hSoftGemini;
105464064216a8433360745f69edddce19a606659163The Android Open Source Project
105564064216a8433360745f69edddce19a606659163The Android Open Source Project	WLAN_REPORT_INFORMATION(pSoftGemini->hReport, SOFT_GEMINI_MODULE_LOG,  ("%s with 0x%x\n",__FUNCTION__,*str));
105664064216a8433360745f69edddce19a606659163The Android Open Source Project
105764064216a8433360745f69edddce19a606659163The Android Open Source Project	if ((SG_ENABLE == pSoftGemini->SoftGeminiEnable) ||
105864064216a8433360745f69edddce19a606659163The Android Open Source Project		(SG_SENSE_ACTIVE == pSoftGemini->SoftGeminiEnable))
105964064216a8433360745f69edddce19a606659163The Android Open Source Project	{
106064064216a8433360745f69edddce19a606659163The Android Open Source Project		if ((!pSoftGemini->bProtectiveMode) && (PROTECTIVE_MODE_ON == *str))
106164064216a8433360745f69edddce19a606659163The Android Open Source Project		{
106264064216a8433360745f69edddce19a606659163The Android Open Source Project			SoftGemini_EnableProtectiveMode(hSoftGemini);
106364064216a8433360745f69edddce19a606659163The Android Open Source Project		}
106464064216a8433360745f69edddce19a606659163The Android Open Source Project		else if ((pSoftGemini->bProtectiveMode) && (PROTECTIVE_MODE_OFF == *str))
106564064216a8433360745f69edddce19a606659163The Android Open Source Project		{
106664064216a8433360745f69edddce19a606659163The Android Open Source Project			SoftGemini_DisableProtectiveMode(hSoftGemini);
106764064216a8433360745f69edddce19a606659163The Android Open Source Project		}
106864064216a8433360745f69edddce19a606659163The Android Open Source Project		else
106964064216a8433360745f69edddce19a606659163The Android Open Source Project		{
107064064216a8433360745f69edddce19a606659163The Android Open Source Project			WLAN_REPORT_INFORMATION(pSoftGemini->hReport, SOFT_GEMINI_MODULE_LOG,  ("%s : Protective mode %s called when Protective mode is %s \n",
107164064216a8433360745f69edddce19a606659163The Android Open Source Project			__FUNCTION__,((PROTECTIVE_MODE_ON == *str) ? "ON" : "OFF"),((pSoftGemini->bProtectiveMode) ? "ON" : "OFF")));
107264064216a8433360745f69edddce19a606659163The Android Open Source Project		}
107364064216a8433360745f69edddce19a606659163The Android Open Source Project	}
107464064216a8433360745f69edddce19a606659163The Android Open Source Project	else
107564064216a8433360745f69edddce19a606659163The Android Open Source Project	{
107664064216a8433360745f69edddce19a606659163The Android Open Source Project		WLAN_REPORT_WARNING(pSoftGemini->hReport, SOFT_GEMINI_MODULE_LOG,  ("%s : Protective mode %s called when SG mode is %s ? \n",
107764064216a8433360745f69edddce19a606659163The Android Open Source Project			__FUNCTION__,((PROTECTIVE_MODE_ON == *str) ? "ON" : "OFF"),SoftGemini_ConvertModeToString(pSoftGemini->SoftGeminiEnable)));
107864064216a8433360745f69edddce19a606659163The Android Open Source Project	}
107964064216a8433360745f69edddce19a606659163The Android Open Source Project}
108064064216a8433360745f69edddce19a606659163The Android Open Source Project
108164064216a8433360745f69edddce19a606659163The Android Open Source Project/***************************************************************************
108264064216a8433360745f69edddce19a606659163The Android Open Source Project*					SoftGemini_AvalancheIndicationCB  		    	       *
108364064216a8433360745f69edddce19a606659163The Android Open Source Project****************************************************************************
108464064216a8433360745f69edddce19a606659163The Android Open Source Project* DESCRIPTION:	This is the the function which is called when
108564064216a8433360745f69edddce19a606659163The Android Open Source Project*				FW detect that our current connection quality is reducing
108664064216a8433360745f69edddce19a606659163The Android Open Source Project*				(AP decrease his rates with his rate adaptation mechanism because
108764064216a8433360745f69edddce19a606659163The Android Open Source Project*				of BT activity) the solution is reconnect to the same AP
108864064216a8433360745f69edddce19a606659163The Android Open Source Project*
108964064216a8433360745f69edddce19a606659163The Android Open Source Project* INPUTS:		pSoftGemini - the object
109064064216a8433360745f69edddce19a606659163The Android Open Source Project* NOTE			This function is located in the API for debug purposes
109164064216a8433360745f69edddce19a606659163The Android Open Source Project***************************************************************************/
109264064216a8433360745f69edddce19a606659163The Android Open Source Project
109364064216a8433360745f69edddce19a606659163The Android Open Source Projectvoid SoftGemini_AvalancheIndicationCB( TI_HANDLE hSoftGemini, char* str, UINT32 strLen )
109464064216a8433360745f69edddce19a606659163The Android Open Source Project{
109564064216a8433360745f69edddce19a606659163The Android Open Source Project	SoftGemini_t	*pSoftGemini = (SoftGemini_t *)hSoftGemini;
109664064216a8433360745f69edddce19a606659163The Android Open Source Project
109764064216a8433360745f69edddce19a606659163The Android Open Source Project	WLAN_REPORT_INFORMATION(pSoftGemini->hReport, SOFT_GEMINI_MODULE_LOG,  ("%s \n",__FUNCTION__));
109864064216a8433360745f69edddce19a606659163The Android Open Source Project
109964064216a8433360745f69edddce19a606659163The Android Open Source Project	if ((SG_ENABLE == pSoftGemini->SoftGeminiEnable) ||
110064064216a8433360745f69edddce19a606659163The Android Open Source Project		(SG_SENSE_ACTIVE == pSoftGemini->SoftGeminiEnable))
110164064216a8433360745f69edddce19a606659163The Android Open Source Project	{
110264064216a8433360745f69edddce19a606659163The Android Open Source Project		SoftGemini_reconnect(hSoftGemini);
110364064216a8433360745f69edddce19a606659163The Android Open Source Project	}
110464064216a8433360745f69edddce19a606659163The Android Open Source Project	else
110564064216a8433360745f69edddce19a606659163The Android Open Source Project	{
110664064216a8433360745f69edddce19a606659163The Android Open Source Project		WLAN_REPORT_WARNING(pSoftGemini->hReport, SOFT_GEMINI_MODULE_LOG,
110764064216a8433360745f69edddce19a606659163The Android Open Source Project			("%s : Avalanche Avoidance called when SG mode is %s \n",
110864064216a8433360745f69edddce19a606659163The Android Open Source Project			__FUNCTION__,SoftGemini_ConvertModeToString(pSoftGemini->SoftGeminiEnable)));
110964064216a8433360745f69edddce19a606659163The Android Open Source Project	}
111064064216a8433360745f69edddce19a606659163The Android Open Source Project
111164064216a8433360745f69edddce19a606659163The Android Open Source Project}
111264064216a8433360745f69edddce19a606659163The Android Open Source Project
111364064216a8433360745f69edddce19a606659163The Android Open Source Project/***************************************************************************
111464064216a8433360745f69edddce19a606659163The Android Open Source Project*					SoftGemini_ConvertModeToString  		    	       *
111564064216a8433360745f69edddce19a606659163The Android Open Source Project****************************************************************************/
111664064216a8433360745f69edddce19a606659163The Android Open Source Project#ifdef REPORT_LOG
111764064216a8433360745f69edddce19a606659163The Android Open Source Project
111864064216a8433360745f69edddce19a606659163The Android Open Source Projectchar* SoftGemini_ConvertModeToString(SoftGeminiEnableModes_e SoftGeminiEnable)
111964064216a8433360745f69edddce19a606659163The Android Open Source Project{
112064064216a8433360745f69edddce19a606659163The Android Open Source Project	switch(SoftGeminiEnable)
112164064216a8433360745f69edddce19a606659163The Android Open Source Project	{
112264064216a8433360745f69edddce19a606659163The Android Open Source Project	case SG_ENABLE:				return "SG_ENABLE";
112364064216a8433360745f69edddce19a606659163The Android Open Source Project	case SG_DISABLE:			return "SG_DISABLE";
112464064216a8433360745f69edddce19a606659163The Android Open Source Project	case SG_SENSE_NO_ACTIVITY:  return "SG_SENSE_NO_ACTIVITY";
112564064216a8433360745f69edddce19a606659163The Android Open Source Project	case SG_SENSE_ACTIVE:		return "SG_SENSE_ACTIVE";
112664064216a8433360745f69edddce19a606659163The Android Open Source Project	default:
112764064216a8433360745f69edddce19a606659163The Android Open Source Project		return "ERROR";
112864064216a8433360745f69edddce19a606659163The Android Open Source Project	}
112964064216a8433360745f69edddce19a606659163The Android Open Source Project}
113064064216a8433360745f69edddce19a606659163The Android Open Source Project
113164064216a8433360745f69edddce19a606659163The Android Open Source Project#endif
113264064216a8433360745f69edddce19a606659163The Android Open Source Project
113364064216a8433360745f69edddce19a606659163The Android Open Source Project/***************************************************************************
113464064216a8433360745f69edddce19a606659163The Android Open Source Project*					SoftGemini_getSGMode						  		    	       *
113564064216a8433360745f69edddce19a606659163The Android Open Source Project****************************************************************************/
113664064216a8433360745f69edddce19a606659163The Android Open Source ProjectSoftGeminiEnableModes_e SoftGemini_getSGMode(TI_HANDLE hSoftGemini)
113764064216a8433360745f69edddce19a606659163The Android Open Source Project{
113864064216a8433360745f69edddce19a606659163The Android Open Source Project	SoftGemini_t	*pSoftGemini = (SoftGemini_t *)hSoftGemini;
113964064216a8433360745f69edddce19a606659163The Android Open Source Project	return pSoftGemini->SoftGeminiEnable;
114064064216a8433360745f69edddce19a606659163The Android Open Source Project}
114164064216a8433360745f69edddce19a606659163The Android Open Source Project
114264064216a8433360745f69edddce19a606659163The Android Open Source Project/***************************************************************************
114364064216a8433360745f69edddce19a606659163The Android Open Source Project*					SoftGemini_handleRecovery					    	       *
114464064216a8433360745f69edddce19a606659163The Android Open Source Project****************************************************************************
114564064216a8433360745f69edddce19a606659163The Android Open Source Project* DESCRIPTION:	The function reconfigures WHAL with the SG parameters.
114664064216a8433360745f69edddce19a606659163The Android Open Source Project*
114764064216a8433360745f69edddce19a606659163The Android Open Source Project* INPUTS:		pSoftGemini - the object
114864064216a8433360745f69edddce19a606659163The Android Open Source Project***************************************************************************/
114964064216a8433360745f69edddce19a606659163The Android Open Source ProjectTI_STATUS SoftGemini_handleRecovery(TI_HANDLE hSoftGemini)
115064064216a8433360745f69edddce19a606659163The Android Open Source Project{
115164064216a8433360745f69edddce19a606659163The Android Open Source Project	SoftGemini_t	*pSoftGemini = (SoftGemini_t *)hSoftGemini;
115264064216a8433360745f69edddce19a606659163The Android Open Source Project	SoftGeminiEnableModes_e       realSoftGeminiEnableMode;
115364064216a8433360745f69edddce19a606659163The Android Open Source Project
115464064216a8433360745f69edddce19a606659163The Android Open Source Project	realSoftGeminiEnableMode = pSoftGemini->SoftGeminiEnable;
115564064216a8433360745f69edddce19a606659163The Android Open Source Project    /* Disable the SG */
115664064216a8433360745f69edddce19a606659163The Android Open Source Project    SoftGemini_setEnableParam(hSoftGemini, SG_DISABLE, TRUE);
115764064216a8433360745f69edddce19a606659163The Android Open Source Project    WLAN_REPORT_INFORMATION(pSoftGemini->hReport, SOFT_GEMINI_MODULE_LOG,  ("Disable SG \n"));
115864064216a8433360745f69edddce19a606659163The Android Open Source Project
115964064216a8433360745f69edddce19a606659163The Android Open Source Project	pSoftGemini->SoftGeminiEnable = realSoftGeminiEnableMode;
116064064216a8433360745f69edddce19a606659163The Android Open Source Project	/* Set enable param */
116164064216a8433360745f69edddce19a606659163The Android Open Source Project	if (pSoftGemini->SoftGeminiEnable == SG_SENSE_ACTIVE)
116264064216a8433360745f69edddce19a606659163The Android Open Source Project	{
116364064216a8433360745f69edddce19a606659163The Android Open Source Project		pSoftGemini->SoftGeminiEnable = SG_SENSE_NO_ACTIVITY;
116464064216a8433360745f69edddce19a606659163The Android Open Source Project	}
116564064216a8433360745f69edddce19a606659163The Android Open Source Project    SoftGemini_setEnableParam(hSoftGemini, pSoftGemini->SoftGeminiEnable, TRUE);
116664064216a8433360745f69edddce19a606659163The Android Open Source Project    WLAN_REPORT_INFORMATION(pSoftGemini->hReport, SOFT_GEMINI_MODULE_LOG,  ("Set SG to-%d\n", pSoftGemini->SoftGeminiEnable));
116764064216a8433360745f69edddce19a606659163The Android Open Source Project
116864064216a8433360745f69edddce19a606659163The Android Open Source Project	/* Config the params to FW */
116964064216a8433360745f69edddce19a606659163The Android Open Source Project	SoftGemini_setParamsToFW(hSoftGemini, &pSoftGemini->SoftGeminiParam);
117064064216a8433360745f69edddce19a606659163The Android Open Source Project	/*SoftGemini_printParams(hSoftGemini);*/
117164064216a8433360745f69edddce19a606659163The Android Open Source Project	return OK;
117264064216a8433360745f69edddce19a606659163The Android Open Source Project}
117364064216a8433360745f69edddce19a606659163The Android Open Source Project/***************************************************************************
117464064216a8433360745f69edddce19a606659163The Android Open Source Project*					SoftGemini_startPsPollFailure					       *
117564064216a8433360745f69edddce19a606659163The Android Open Source Project****************************************************************************
117664064216a8433360745f69edddce19a606659163The Android Open Source Project* DESCRIPTION:	After Ps-Poll failure we disable the SG
117764064216a8433360745f69edddce19a606659163The Android Open Source Project*
117864064216a8433360745f69edddce19a606659163The Android Open Source Project* INPUTS:		pSoftGemini - the object
117964064216a8433360745f69edddce19a606659163The Android Open Source Project***************************************************************************/
118064064216a8433360745f69edddce19a606659163The Android Open Source Projectvoid SoftGemini_startPsPollFailure(TI_HANDLE hSoftGemini)
118164064216a8433360745f69edddce19a606659163The Android Open Source Project{
118264064216a8433360745f69edddce19a606659163The Android Open Source Project    SoftGemini_t	*pSoftGemini = (SoftGemini_t *)hSoftGemini;
118364064216a8433360745f69edddce19a606659163The Android Open Source Project
118464064216a8433360745f69edddce19a606659163The Android Open Source Project    WLAN_REPORT_INFORMATION(pSoftGemini->hReport, SOFT_GEMINI_MODULE_LOG, ("%s\n",__FUNCTION__));
118564064216a8433360745f69edddce19a606659163The Android Open Source Project
118664064216a8433360745f69edddce19a606659163The Android Open Source Project    if ( !pSoftGemini->bPsPollFailureActive && !pSoftGemini->SoftGeminiParam.sgAutoModeNoCts)
118764064216a8433360745f69edddce19a606659163The Android Open Source Project    {
118864064216a8433360745f69edddce19a606659163The Android Open Source Project        pSoftGemini->PsPollFailureLastEnableValue = pSoftGemini->SoftGeminiEnable;
118964064216a8433360745f69edddce19a606659163The Android Open Source Project
119064064216a8433360745f69edddce19a606659163The Android Open Source Project        /* Disable SG if needed */
119164064216a8433360745f69edddce19a606659163The Android Open Source Project        if ( pSoftGemini->SoftGeminiEnable != SG_DISABLE )
119264064216a8433360745f69edddce19a606659163The Android Open Source Project        {
119364064216a8433360745f69edddce19a606659163The Android Open Source Project            SoftGemini_setEnableParam(hSoftGemini, SG_DISABLE, FALSE);
119464064216a8433360745f69edddce19a606659163The Android Open Source Project        }
119564064216a8433360745f69edddce19a606659163The Android Open Source Project
119664064216a8433360745f69edddce19a606659163The Android Open Source Project        pSoftGemini->bPsPollFailureActive = TRUE;
119764064216a8433360745f69edddce19a606659163The Android Open Source Project    }
119864064216a8433360745f69edddce19a606659163The Android Open Source Project    else /* Calling SoftGemini_startPsPollFailure twice ? */
119964064216a8433360745f69edddce19a606659163The Android Open Source Project    {
120064064216a8433360745f69edddce19a606659163The Android Open Source Project        WLAN_REPORT_WARNING(pSoftGemini->hReport, SOFT_GEMINI_MODULE_LOG,
120164064216a8433360745f69edddce19a606659163The Android Open Source Project            ("Calling  SoftGemini_startPsPollFailure while bPsPollFailureActive is TRUE\n"));
120264064216a8433360745f69edddce19a606659163The Android Open Source Project    }
120364064216a8433360745f69edddce19a606659163The Android Open Source Project}
120464064216a8433360745f69edddce19a606659163The Android Open Source Project
120564064216a8433360745f69edddce19a606659163The Android Open Source Project/***************************************************************************
120664064216a8433360745f69edddce19a606659163The Android Open Source Project*					SoftGemini_endPsPollFailure					    	   *
120764064216a8433360745f69edddce19a606659163The Android Open Source Project****************************************************************************
120864064216a8433360745f69edddce19a606659163The Android Open Source Project* DESCRIPTION:	Return to normal behavior after the PsPoll failure
120964064216a8433360745f69edddce19a606659163The Android Open Source Project*
121064064216a8433360745f69edddce19a606659163The Android Open Source Project* INPUTS:		pSoftGemini - the object
121164064216a8433360745f69edddce19a606659163The Android Open Source Project***************************************************************************/
121264064216a8433360745f69edddce19a606659163The Android Open Source Projectvoid SoftGemini_endPsPollFailure(TI_HANDLE hSoftGemini)
121364064216a8433360745f69edddce19a606659163The Android Open Source Project{
121464064216a8433360745f69edddce19a606659163The Android Open Source Project    SoftGemini_t	*pSoftGemini = (SoftGemini_t *)hSoftGemini;
121564064216a8433360745f69edddce19a606659163The Android Open Source Project
121664064216a8433360745f69edddce19a606659163The Android Open Source Project    WLAN_REPORT_INFORMATION(pSoftGemini->hReport, SOFT_GEMINI_MODULE_LOG, ("%s\n",__FUNCTION__));
121764064216a8433360745f69edddce19a606659163The Android Open Source Project
121864064216a8433360745f69edddce19a606659163The Android Open Source Project    if ( pSoftGemini->bPsPollFailureActive )
121964064216a8433360745f69edddce19a606659163The Android Open Source Project    {
122064064216a8433360745f69edddce19a606659163The Android Open Source Project        pSoftGemini->bPsPollFailureActive = FALSE;
122164064216a8433360745f69edddce19a606659163The Android Open Source Project
122264064216a8433360745f69edddce19a606659163The Android Open Source Project        /* return to previous value */
122364064216a8433360745f69edddce19a606659163The Android Open Source Project        if ( pSoftGemini->PsPollFailureLastEnableValue != SG_DISABLE )
122464064216a8433360745f69edddce19a606659163The Android Open Source Project        {
122564064216a8433360745f69edddce19a606659163The Android Open Source Project            if ( pSoftGemini->PsPollFailureLastEnableValue == SG_SENSE_ACTIVE)
122664064216a8433360745f69edddce19a606659163The Android Open Source Project            {
122764064216a8433360745f69edddce19a606659163The Android Open Source Project                /* In this case Fw must get SG_SENSE_NO_ACTIVITY to start sensing again */
122864064216a8433360745f69edddce19a606659163The Android Open Source Project                pSoftGemini->PsPollFailureLastEnableValue = SG_SENSE_NO_ACTIVITY;
122964064216a8433360745f69edddce19a606659163The Android Open Source Project            }
123064064216a8433360745f69edddce19a606659163The Android Open Source Project
123164064216a8433360745f69edddce19a606659163The Android Open Source Project            SoftGemini_setEnableParam(hSoftGemini, pSoftGemini->PsPollFailureLastEnableValue, FALSE);
123264064216a8433360745f69edddce19a606659163The Android Open Source Project        }
123364064216a8433360745f69edddce19a606659163The Android Open Source Project    }
123464064216a8433360745f69edddce19a606659163The Android Open Source Project    else /* Calling SoftGemini_endPsPollFailure twice ? */
123564064216a8433360745f69edddce19a606659163The Android Open Source Project    {
123664064216a8433360745f69edddce19a606659163The Android Open Source Project        WLAN_REPORT_WARNING(pSoftGemini->hReport, SOFT_GEMINI_MODULE_LOG,
123764064216a8433360745f69edddce19a606659163The Android Open Source Project            ("Calling  SoftGemini_endPsPollFailure while bPsPollFailureActive is FALSE\n"));
123864064216a8433360745f69edddce19a606659163The Android Open Source Project    }
123964064216a8433360745f69edddce19a606659163The Android Open Source Project}
124064064216a8433360745f69edddce19a606659163The Android Open Source Project
124164064216a8433360745f69edddce19a606659163The Android Open Source Project
1242