1981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/*
2981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * SoftGemini.c
3981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *
4981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved.
5981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * All rights reserved.
6981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *
7981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * Redistribution and use in source and binary forms, with or without
8981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * modification, are permitted provided that the following conditions
9981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * are met:
10981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *
11981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *  * Redistributions of source code must retain the above copyright
12981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *    notice, this list of conditions and the following disclaimer.
13981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *  * Redistributions in binary form must reproduce the above copyright
14981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *    notice, this list of conditions and the following disclaimer in
15981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *    the documentation and/or other materials provided with the
16981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *    distribution.
17981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *  * Neither the name Texas Instruments nor the names of its
18981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *    contributors may be used to endorse or promote products derived
19981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *    from this software without specific prior written permission.
20981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *
21981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt */
33981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
34981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/** \file softGemini.c
35981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *  \brief BlueTooth-Wlan coexistence module interface
36981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *
37981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *  \see softGemini.h
38981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt */
39981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
40981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/****************************************************************************************************
41981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*																									*
42981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*		MODULE:		softGemini.c																	*
43981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*		PURPOSE:	BlueTooth-Wlan coexistence module interface.							*
44981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*					This module handles all data base (and Fw setting accordingly)					*
45981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*					for Bluetooth-Wlan coexistence implementation.									*
46981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*																						 			*
47981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt****************************************************************************************************/
48981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
49981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#define __FILE_ID__  FILE_ID_5
50981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#include "report.h"
51981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#include "osApi.h"
52981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#include "SoftGemini.h"
53981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#include "DataCtrl_Api.h"
54981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#include "scrApi.h"
55981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#include "PowerMgr_API.h"
56981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#include "ScanCncn.h"
57981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#include "currBss.h"
58981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#include "CmdDispatcher.h"
59981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#include "TWDriver.h"
60981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#include "DrvMainModules.h"
61981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#include "bssTypes.h"
62981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#include "sme.h"
63981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
64981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
65981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#define SENSE_MODE_ENABLE		0x01
66981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#define SENSE_MODE_DISABLE		0x00
67981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#define PROTECTIVE_MODE_ON		0x01
68981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#define PROTECTIVE_MODE_OFF		0x00
69981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
70981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/********************************************************************************/
71981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/*						Internal functions prototypes.							*/
72981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/********************************************************************************/
73981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
74981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic TI_STATUS SoftGemini_setEnableParam(TI_HANDLE hSoftGemini, ESoftGeminiEnableModes SoftGeminiEnable, TI_BOOL recovery);
75981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic TI_STATUS SoftGemini_setParamsToFW(TI_HANDLE hSoftGemini, TSoftGeminiParams *SoftGeminiParam);
76981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic TI_STATUS SoftGemini_EnableDriver(TI_HANDLE hSoftGemini);
77981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic TI_STATUS SoftGemini_DisableDriver(TI_HANDLE hSoftGemini);
78981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic TI_STATUS SoftGemini_SetPS(SoftGemini_t	 *pSoftGemini);
79981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic TI_STATUS SoftGemini_unSetPS(SoftGemini_t *pSoftGemini);
80981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic void SoftGemini_RemoveProtectiveModeParameters(TI_HANDLE hSoftGemini);
81981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic void SoftGemini_setConfigParam(TI_HANDLE hSoftGemini, TI_UINT32 *param);
82981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic void SoftGemini_EnableProtectiveMode(TI_HANDLE hSoftGemini);
83981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic void SoftGemini_DisableProtectiveMode(TI_HANDLE hSoftGemini);
84981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#ifdef REPORT_LOG
85981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic char* SoftGemini_ConvertModeToString(ESoftGeminiEnableModes SoftGeminiEnable);
86981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#endif
87981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
88981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/********************************************************************************/
89981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/*						Interface functions Implementation.						*/
90981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/********************************************************************************/
91981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/************************************************************************
92981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *                        SoftGemini_SetPSmode									*
93981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ************************************************************************
94981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtDESCRIPTION: SoftGemini module, called by the conn_Infra on connection
95981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt				performs the following:
96981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt				-	Enables SG if needed
97981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                                -       Enables the SG power mode
98981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtINPUT:      hSoftGemini -		Handle to SoftGemini
99981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
100981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtOUTPUT:
101981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
102981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtRETURN:
103981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
104981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt************************************************************************/
105981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtvoid SoftGemini_SetPSmode(TI_HANDLE hSoftGemini)
106981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
107981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	SoftGemini_t *pSoftGemini = (SoftGemini_t *)hSoftGemini;
108981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
109981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	if (pSoftGemini)
110981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	{
111981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		if (pSoftGemini->bDriverEnabled)
112981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		{
113981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt			/* Check if coexAutoPsMode is enabled to enter/exit P.S */
114653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt			if ( pSoftGemini->SoftGeminiParam.coexParams[SOFT_GEMINI_AUTO_PS_MODE])
115981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt			{
116981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt				SoftGemini_SetPS(pSoftGemini);
117981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt			}
118981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		}
119981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		if (pSoftGemini->bProtectiveMode)
120981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		{
121981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt			SoftGemini_EnableProtectiveMode(hSoftGemini);
122981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		}
123981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	}
124981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	else
125981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
126981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt          TRACE0(pSoftGemini->hReport, REPORT_SEVERITY_ERROR, "  SoftGemini_SetPSmode() - Error hSoftGemini= NULL \n");
127981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
128981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
129981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
130981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/************************************************************************
131981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *                        SoftGemini_unSetPSmode									*
132981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ************************************************************************
133981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtDESCRIPTION: SoftGemini module, called by the conn_Infra after disconnecting
134981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt				performs the following:
135981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt				-	Disables the SG
136981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                                -       Disables the SG power mode
137981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtINPUT:      hSoftGemini -		Handle to SoftGemini
138981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
139981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtOUTPUT:
140981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
141981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtRETURN:
142981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
143981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt************************************************************************/
144981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtvoid SoftGemini_unSetPSmode(TI_HANDLE hSoftGemini)
145981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
146981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	SoftGemini_t *pSoftGemini = (SoftGemini_t *)hSoftGemini;
147981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
148981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if (pSoftGemini)
149981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	{
150981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		if (pSoftGemini->bDriverEnabled)
151981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		{
152981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt			/* Check if coexAutoPsMode is enabled to enter/exit P.S */
153653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt			if ( pSoftGemini->SoftGeminiParam.coexParams[SOFT_GEMINI_AUTO_PS_MODE])
154981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt			{
155981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt				SoftGemini_unSetPS(pSoftGemini);
156981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt			}
157981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		}
158981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		if (pSoftGemini->bProtectiveMode)
159981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		{
160981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt			SoftGemini_RemoveProtectiveModeParameters(hSoftGemini);
161981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		}
162981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	}
163981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    else
164981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
165981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		TRACE0(pSoftGemini->hReport, REPORT_SEVERITY_ERROR, " SoftGemini_unSetPSmode() - Error hSoftGemini= NULL \n");
166981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
167981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
168981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
169981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/************************************************************************
170981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *                        SoftGemini_create									*
171981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ************************************************************************
172981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtDESCRIPTION: SoftGemini module creation function, called by the config mgr in creation phase
173981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt				performs the following:
174981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt				-	Allocate the SoftGemini handle
175981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
176981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtINPUT:      hOs -			Handle to OS
177981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
178981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
179981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtOUTPUT:
180981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
181981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtRETURN:     Handle to the SoftGemini module on success, NULL otherwise
182981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
183981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt************************************************************************/
184981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTI_HANDLE SoftGemini_create(TI_HANDLE hOs)
185981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
186981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	SoftGemini_t			*pSoftGemini = NULL;
187981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
188981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	/* allocating the SoftGemini object */
189981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	pSoftGemini = os_memoryAlloc(hOs,sizeof(SoftGemini_t));
190981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
191981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	if (pSoftGemini == NULL)
192981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		return NULL;
193981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
194981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	pSoftGemini->hOs = hOs;
195981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
196981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	return pSoftGemini;
197981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
198981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
199981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/************************************************************************
200981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *                        SoftGemini_config						*
201981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ************************************************************************
202981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtDESCRIPTION: SoftGemini module init function, called by the rvMain in init phase
203981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt				performs the following:
204981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt				-	Init local variables
205981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt				-	Init the handles to be used by the module
206981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
207981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtINPUT:       pStadHandles  - The driver modules handles
208981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
209981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtOUTPUT:
210981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
211981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtRETURN:      void
212981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt************************************************************************/
213981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtvoid SoftGemini_init (TStadHandlesList *pStadHandles)
214981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
215981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	SoftGemini_t *pSoftGemini = (SoftGemini_t *)(pStadHandles->hSoftGemini);
216981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
217981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	pSoftGemini->hCtrlData    = pStadHandles->hCtrlData;
218981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	pSoftGemini->hTWD	      = pStadHandles->hTWD;
219981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	pSoftGemini->hReport	  = pStadHandles->hReport;
220981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	pSoftGemini->hSCR         = pStadHandles->hSCR;
221981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	pSoftGemini->hPowerMgr    = pStadHandles->hPowerMgr;
222981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	pSoftGemini->hCmdDispatch = pStadHandles->hCmdDispatch;
223981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	pSoftGemini->hScanCncn    = pStadHandles->hScanCncn;
224981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	pSoftGemini->hCurrBss	  = pStadHandles->hCurrBss;
225981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pSoftGemini->hSme         = pStadHandles->hSme;
226981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
227981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
228981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
229981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTI_STATUS SoftGemini_SetDefaults (TI_HANDLE hSoftGemini, SoftGeminiInitParams_t *pSoftGeminiInitParams)
230981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
231981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	SoftGemini_t *pSoftGemini = (SoftGemini_t *)hSoftGemini;
232653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt	TI_UINT8 i =0;
233981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	TI_STATUS status;
234981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	/*************************************/
235981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	/* Getting SoftGemini init Params */
236981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	/***********************************/
237981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
238653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt	pSoftGemini->SoftGeminiEnable = pSoftGeminiInitParams->SoftGeminiEnable;
239653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt
240653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt	for (i =0; i< SOFT_GEMINI_PARAMS_MAX ; i++)
241653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt	{
242653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt		pSoftGemini->SoftGeminiParam.coexParams[i] = pSoftGeminiInitParams->coexParams[i];
243653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt	}
244653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt
245653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt	pSoftGemini->SoftGeminiParam.paramIdx = 0xFF; /* signals to FW to config all the paramters */
246981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
247981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
248981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* Send the configuration to the FW */
249981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	status = SoftGemini_setParamsToFW(hSoftGemini, &pSoftGemini->SoftGeminiParam);
250981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
251981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	/*******************************/
252981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* register Indication interrupts  */
253981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	/*****************************/
254981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
255981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    TWD_RegisterEvent (pSoftGemini->hTWD,
256981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                       TWD_OWN_EVENT_SOFT_GEMINI_SENSE,
257981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                       (void *)SoftGemini_SenseIndicationCB,
258981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                       hSoftGemini);
259981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	TWD_RegisterEvent (pSoftGemini->hTWD,
260981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                       TWD_OWN_EVENT_SOFT_GEMINI_PREDIC,
261981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                       (void *)SoftGemini_ProtectiveIndicationCB,
262981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                       hSoftGemini);
263981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
264981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    TWD_EnableEvent (pSoftGemini->hTWD, TWD_OWN_EVENT_SOFT_GEMINI_SENSE);
265981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	TWD_EnableEvent (pSoftGemini->hTWD, TWD_OWN_EVENT_SOFT_GEMINI_PREDIC);
266981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
267981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	/* On system initialization SG is disabled but later calls to SoftGemini_setEnableParam() */
268981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	pSoftGemini->bProtectiveMode = TI_FALSE;
269981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	pSoftGemini->SoftGeminiEnable = SG_DISABLE;
270981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	pSoftGemini->bDriverEnabled = TI_FALSE;
271981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pSoftGemini->bPsPollFailureActive = TI_FALSE;
272981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
273981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	if ((TI_OK == status) && (pSoftGeminiInitParams->SoftGeminiEnable != SG_DISABLE))
274981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	{	/* called only if different than SG_DISABLE */
275981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		status = SoftGemini_setEnableParam(hSoftGemini, pSoftGeminiInitParams->SoftGeminiEnable, TI_FALSE);
276981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	}
277981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
278981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	if (status == TI_OK)
279981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	{
280981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTRACE0(pSoftGemini->hReport, REPORT_SEVERITY_INIT, "  SoftGemini_config() - configured successfully\n");
281981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	}
282981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	else
283981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	{
284981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTRACE0(pSoftGemini->hReport, REPORT_SEVERITY_ERROR, "  SoftGemini_config() - Error configuring module \n");
285981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	}
286981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
287981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	return status;
288981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
289981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
290981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/************************************************************************
291981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *                        SoftGemini_destroy							*
292981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ************************************************************************
293981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtDESCRIPTION: SoftGemini module destroy function, called by the config mgr in the destroy phase
294981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt				performs the following:
295981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt				-	Free all memory aloocated by the module
296981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
297981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtINPUT:      hSoftGemini	-	SoftGemini handle.
298981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
299981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
300981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtOUTPUT:
301981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
302981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtRETURN:     TI_OK on success, TI_NOK otherwise
303981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
304981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt************************************************************************/
305981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTI_STATUS SoftGemini_destroy(TI_HANDLE hSoftGemini)
306981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
307981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	SoftGemini_t	*pSoftGemini = (SoftGemini_t *)hSoftGemini;
308981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
309981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	if (pSoftGemini != NULL)
310981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	{
311981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		os_memoryFree( pSoftGemini->hOs, (TI_HANDLE)pSoftGemini , sizeof(SoftGemini_t));
312981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	}
313981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
314981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	return TI_OK;
315981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
316981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
317981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
318981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/***********************************************************************
319981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *                        SoftGemini_setParam
320981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ***********************************************************************
321981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtDESCRIPTION: SoftGemini set param function, called by the following:
322981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt			-	config mgr in order to set a parameter receiving from the OS abstraction layer.
323981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt			-	From inside the driver
324981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
325981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtINPUT:      hSoftGemini	-	SoftGemini handle.
326981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt			pParam	-	Pointer to the parameter
327981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
328981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtOUTPUT:
329981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
330981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtRETURN:     TI_OK on success, TI_NOK otherwise
331981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
332981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt************************************************************************/
333981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTI_STATUS SoftGemini_setParam(TI_HANDLE	hSoftGemini,
334981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt											paramInfo_t	*pParam)
335981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
336981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	SoftGemini_t *pSoftGemini = (SoftGemini_t *)hSoftGemini;
337981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	TI_STATUS return_value = TI_OK;
338981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
339981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTRACE1(pSoftGemini->hReport, REPORT_SEVERITY_INFORMATION, "  SoftGemini_setParam() (0x%x)\n", pParam->paramType);
340981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
341981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	switch(pParam->paramType)
342981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	{
343981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
344981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	case SOFT_GEMINI_SET_ENABLE:
345981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
346981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		return_value = SoftGemini_setEnableParam(hSoftGemini,pParam->content.SoftGeminiEnable, TI_FALSE);
347981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		break;
348981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
349981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	case SOFT_GEMINI_SET_CONFIG:
350981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
351981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		/* copy new params to SoftGemini module */
352981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		SoftGemini_setConfigParam(hSoftGemini,pParam->content.SoftGeminiParamArray);
353653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt
354981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		/* set new params to FW */
355981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		return_value = SoftGemini_setParamsToFW(hSoftGemini, &(pSoftGemini->SoftGeminiParam));
356981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
357981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		if (pSoftGemini->bProtectiveMode == TI_TRUE)
358981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		{
359981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt			/* set new configurations of scan to scancncn */
360653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt			scanCncn_SGconfigureScanParams(pSoftGemini->hScanCncn,TI_TRUE,
361653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt										   (TI_UINT8)pSoftGemini->SoftGeminiParam.coexParams[SOFT_GEMINI_AUTO_SCAN_PROBE_REQ],
362653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt										   pSoftGemini->SoftGeminiParam.coexParams[SOFT_GEMINI_AUTO_SCAN_COMPENSATION_MAX_TIME],
363653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt										   pSoftGemini->SoftGeminiParam.coexParams[SOFT_GEMINI_AUTO_SCAN_WINDOW]);
364981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		}
365981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		break;
366981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
367981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	default:
368981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTRACE1(pSoftGemini->hReport, REPORT_SEVERITY_ERROR, "  SoftGemini_setParam(), Params is not supported, %d\n\n", pParam->paramType);
369981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		return PARAM_NOT_SUPPORTED;
370981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	}
371981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
372981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	return return_value;
373981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
374981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
375981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/***********************************************************************
376981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *			      SoftGemini_getParam
377981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ***********************************************************************
378981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtDESCRIPTION: SoftGemini get param function, called by the following:
379981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt			-	config mgr in order to get a parameter from the OS abstraction layer.
380981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt			-	From inside the dirver
381981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
382981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtINPUT:      hSoftGemini	-	SoftGemini handle.
383981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
384981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
385981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtOUTPUT:		pParam	-	Pointer to the parameter
386981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
387981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtRETURN:     TI_OK on success, TI_NOK otherwise
388981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
389981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt************************************************************************/
390981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTI_STATUS SoftGemini_getParam(TI_HANDLE		hSoftGemini,
391981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt											paramInfo_t	*pParam)
392981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
393653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt		switch (pParam->paramType)
394653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt		{
395653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt			case SOFT_GEMINI_GET_CONFIG:
396653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt				SoftGemini_printParams(hSoftGemini);
397653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt				break;
398653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt		}
399653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt
400981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	return TI_OK;
401981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
402981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
403981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
404981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
405981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/***************************************************************************
406981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*					SoftGemini_setEnableParam					    	       *
407981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt****************************************************************************
408981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* DESCRIPTION:	The function sets the  appropriate Enable value,
409981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*				configures SCR , POWER MGR , DATA CTRL , FW.
410981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*
411981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* INPUTS:		pSoftGemini - the object
412981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt***************************************************************************/
413981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic TI_STATUS SoftGemini_setEnableParam(TI_HANDLE hSoftGemini, ESoftGeminiEnableModes SoftGeminiEnable, TI_BOOL recovery)
414981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
415981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	SoftGemini_t *pSoftGemini = (SoftGemini_t *)hSoftGemini;
416981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	TTwdParamInfo	param;
417981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	TI_STATUS return_value = TI_OK;
418981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
419981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTRACE0(pSoftGemini->hReport, REPORT_SEVERITY_INFORMATION, "  setSoftGeminiEnableParam() - Old value = , New value = \n");
420981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
421981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
422981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /*
423981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt     * PsPoll work around is active. Just save the value and configure it later
424981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt     */
425981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if ( pSoftGemini->bPsPollFailureActive )
426981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
427981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        TRACE0(pSoftGemini->hReport, REPORT_SEVERITY_INFORMATION, "  setSoftGeminiEnableParam() - while PsPollFailure is active\n");
428981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
429981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pSoftGemini->PsPollFailureLastEnableValue = SoftGeminiEnable;
430981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return TI_OK;
431981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
432981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
433981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	/**********************************/
434981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	/* Sanity check on enable values */
435981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	/********************************/
436981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
437981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	/*				Old Value						New Value		    */
438981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	/*					|							    |			    */
439981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	/*			  	   \|/							   \|/			    */
440981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
441981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	if ((pSoftGemini->SoftGeminiEnable == SoftGeminiEnable) && !recovery)
442981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	{
443981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTRACE0(pSoftGemini->hReport, REPORT_SEVERITY_ERROR, "   - setting same value \n");
444981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		return TI_NOK;
445981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	}
446981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
447981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	/*******************************/
448981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	/* Make the necessary actions */
449981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	/*****************************/
450981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
451981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	switch (SoftGeminiEnable)
452981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	{
453981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	case SG_PROTECTIVE:
454981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	case SG_OPPORTUNISTIC:
455981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
456981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		/* set FW with SG_ENABLE */
457981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		param.paramType = TWD_SG_ENABLE_PARAM_ID;
458981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		param.content.SoftGeminiEnable = SoftGeminiEnable;
459981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		return_value = TWD_SetParam (pSoftGemini->hTWD, &param);
460981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
461981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		break;
462981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
463981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	case SG_DISABLE:
464981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
465981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		/* set FW with SG_DISABLE */
466981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		param.paramType = TWD_SG_ENABLE_PARAM_ID;
467981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		param.content.SoftGeminiEnable = SG_DISABLE;
468981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		return_value = TWD_SetParam (pSoftGemini->hTWD, &param);
469981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
470981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		if (pSoftGemini->bDriverEnabled)
471981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		{
472981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt			SoftGemini_DisableDriver(hSoftGemini);
473981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		}
474981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
475981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		break;
476981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
477981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	default:
478981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTRACE1(pSoftGemini->hReport, REPORT_SEVERITY_ERROR, " defualt :%d\n",SoftGeminiEnable);
479981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		return TI_NOK;
480981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	}
481981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
482981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	/* Pass to the new enable state */
483981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	pSoftGemini->SoftGeminiEnable = SoftGeminiEnable;
484981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
485981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	if (TI_OK != return_value)
486981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	{
487981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTRACE0(pSoftGemini->hReport, REPORT_SEVERITY_ERROR, " can't configure enable param to FW :\n");
488981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	}
489981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
490981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	return return_value;
491981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
492981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
493981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/***************************************************************************
494981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*					SoftGemini_setConfigParam				    	       *
495981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt****************************************************************************
496981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* DESCRIPTION:	The function sets params
497981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*
498981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* INPUTS:		pSoftGemini - the object
499981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*				param       - params to be configured
500981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt***************************************************************************/
501981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic void SoftGemini_setConfigParam(TI_HANDLE hSoftGemini, TI_UINT32 *param)
502981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
503981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	SoftGemini_t *pSoftGemini = (SoftGemini_t *)hSoftGemini;
504653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt
505653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt	/* param[0] - SG parameter index, param[1] - SG parameter value */
506653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt	pSoftGemini->SoftGeminiParam.coexParams[(TI_UINT8)param[0]] = (TI_UINT32)param[1];
507653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt	pSoftGemini->SoftGeminiParam.paramIdx = (TI_UINT8)param[0];
508981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
509981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
510981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/***************************************************************************
511981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*					SoftGemini_printParams					    	       *
512981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt****************************************************************************
513981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* DESCRIPTION:	Print SG Parameters.
514981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*
515981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* INPUTS:		pSoftGemini - the object
516981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt***************************************************************************/
517981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtvoid SoftGemini_printParams(TI_HANDLE hSoftGemini)
518981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
519981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#ifdef REPORT_LOG
520981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
521981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	SoftGemini_t *pSoftGemini = (SoftGemini_t *)hSoftGemini;
522981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	TSoftGeminiParams *SoftGeminiParam = &pSoftGemini->SoftGeminiParam;
523981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
524653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt	WLAN_OS_REPORT(("[0]:  coexBtPerThreshold = %d\n", SoftGeminiParam->coexParams[SOFT_GEMINI_BT_PER_THRESHOLD]));
525653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt	WLAN_OS_REPORT(("[1]:  coexAutoScanCompensationMaxTime = %d (usec)\n", SoftGeminiParam->coexParams[SOFT_GEMINI_AUTO_SCAN_COMPENSATION_MAX_TIME]));
526653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt	WLAN_OS_REPORT(("[2]:  coexBtNfsSampleInterval = %d (msec)\n", SoftGeminiParam->coexParams[SOFT_GEMINI_BT_NFS_SAMPLE_INTERVAL]));
527653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt	WLAN_OS_REPORT(("[3]:  coexBtLoadRatio = %d (%)\n", SoftGeminiParam->coexParams[SOFT_GEMINI_BT_LOAD_RATIO]));
528653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt	WLAN_OS_REPORT(("[4]:  coexAutoPsMode = %s \n", (SoftGeminiParam->coexParams[SOFT_GEMINI_AUTO_PS_MODE]?"Enabled":"Disabled")));
529653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt	WLAN_OS_REPORT(("[5]:  coexAutoScanEnlargedNumOfProbeReqPercent = %d (%)\n", SoftGeminiParam->coexParams[SOFT_GEMINI_AUTO_SCAN_PROBE_REQ]));
530653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt	WLAN_OS_REPORT(("[6]:  coexAutoScanEnlargedScanWindowPercent = %d (%)\n", SoftGeminiParam->coexParams[SOFT_GEMINI_AUTO_SCAN_WINDOW]));
531653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt	WLAN_OS_REPORT(("[7]:  coexAntennaConfiguration = %s (0 = Single, 1 = Dual) \n", (SoftGeminiParam->coexParams[SOFT_GEMINI_ANTENNA_CONFIGURATION]?"Dual":"Single")));
532653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt	WLAN_OS_REPORT(("[8]:  coexMaxConsecutiveBeaconMissPrecent = %d (%)\n", SoftGeminiParam->coexParams[SOFT_GEMINI_BEACON_MISS_PERCENT]));
533653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt	WLAN_OS_REPORT(("[9]:  coexAPRateAdapationThr = %d\n", SoftGeminiParam->coexParams[SOFT_GEMINI_RATE_ADAPT_THRESH]));
534653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt	WLAN_OS_REPORT(("[10]: coexAPRateAdapationSnr = %d\n", SoftGeminiParam->coexParams[SOFT_GEMINI_RATE_ADAPT_SNR]));
535ed6a25120881135f25d9173223306e9232bb2564Dmitry Shmidt	WLAN_OS_REPORT(("[11]: coexWlanPsBtAclMasterMinBR = %d (msec)\n", SoftGeminiParam->coexParams[SOFT_GEMINI_WLAN_PS_BT_ACL_MASTER_MIN_BR]));
536ed6a25120881135f25d9173223306e9232bb2564Dmitry Shmidt	WLAN_OS_REPORT(("[12]: coexWlanPsBtAclMasterMaxBR = %d (msec)\n", SoftGeminiParam->coexParams[SOFT_GEMINI_WLAN_PS_BT_ACL_MASTER_MAX_BR]));
537ed6a25120881135f25d9173223306e9232bb2564Dmitry Shmidt	WLAN_OS_REPORT(("[13]: coexWlanPsMaxBtAclMasterBR = %d (msec)\n", SoftGeminiParam->coexParams[SOFT_GEMINI_WLAN_PS_MAX_BT_ACL_MASTER_BR]));
538ed6a25120881135f25d9173223306e9232bb2564Dmitry Shmidt    WLAN_OS_REPORT(("[14]: coexWlanPsBtAclSlaveMinBR = %d (msec)\n", SoftGeminiParam->coexParams[SOFT_GEMINI_WLAN_PS_BT_ACL_SLAVE_MIN_BR]));
539ed6a25120881135f25d9173223306e9232bb2564Dmitry Shmidt    WLAN_OS_REPORT(("[15]: coexWlanPsBtAclSlaveMaxBR = %d (msec)\n", SoftGeminiParam->coexParams[SOFT_GEMINI_WLAN_PS_BT_ACL_SLAVE_MAX_BR]));
540ed6a25120881135f25d9173223306e9232bb2564Dmitry Shmidt    WLAN_OS_REPORT(("[16]: coexWlanPsMaxBtAclSlaveBR = %d (msec)\n", SoftGeminiParam->coexParams[SOFT_GEMINI_WLAN_PS_MAX_BT_ACL_SLAVE_BR]));
541ed6a25120881135f25d9173223306e9232bb2564Dmitry Shmidt    WLAN_OS_REPORT(("[17]: coexWlanPsBtAclMasterMinEDR = %d (msec)\n", SoftGeminiParam->coexParams[SOFT_GEMINI_WLAN_PS_BT_ACL_MASTER_MIN_EDR]));
542ed6a25120881135f25d9173223306e9232bb2564Dmitry Shmidt    WLAN_OS_REPORT(("[18]: coexWlanPsBtAclMasterMaxEDR = %d (msec)\n", SoftGeminiParam->coexParams[SOFT_GEMINI_WLAN_PS_BT_ACL_MASTER_MAX_EDR]));
543ed6a25120881135f25d9173223306e9232bb2564Dmitry Shmidt    WLAN_OS_REPORT(("[19]: coexWlanPsMaxBtAclMasterEDR = %d (msec)\n", SoftGeminiParam->coexParams[SOFT_GEMINI_WLAN_PS_MAX_BT_ACL_MASTER_EDR]));
544ed6a25120881135f25d9173223306e9232bb2564Dmitry Shmidt    WLAN_OS_REPORT(("[20]: coexWlanPsBtAclSlaveMinEDR = %d (msec)\n", SoftGeminiParam->coexParams[SOFT_GEMINI_WLAN_PS_BT_ACL_SLAVE_MIN_EDR]));
545ed6a25120881135f25d9173223306e9232bb2564Dmitry Shmidt    WLAN_OS_REPORT(("[21]: coexWlanPsBtAclSlaveMaxEDR = %d (msec)\n", SoftGeminiParam->coexParams[SOFT_GEMINI_WLAN_PS_BT_ACL_SLAVE_MAX_EDR]));
546ed6a25120881135f25d9173223306e9232bb2564Dmitry Shmidt    WLAN_OS_REPORT(("[22]: coexWlanPsMaxBtAclSlaveEDR = %d (msec)\n", SoftGeminiParam->coexParams[SOFT_GEMINI_WLAN_PS_MAX_BT_ACL_SLAVE_EDR]));
547ed6a25120881135f25d9173223306e9232bb2564Dmitry Shmidt	WLAN_OS_REPORT(("[23]: coexRxt = %d (usec)\n", SoftGeminiParam->coexParams[SOFT_GEMINI_RXT]));
548ed6a25120881135f25d9173223306e9232bb2564Dmitry Shmidt	WLAN_OS_REPORT(("[24]: coexTxt = %d (usec)\n", SoftGeminiParam->coexParams[SOFT_GEMINI_TXT]));
549ed6a25120881135f25d9173223306e9232bb2564Dmitry Shmidt	WLAN_OS_REPORT(("[25]: coexAdaptiveRxtTxt = %s \n", (SoftGeminiParam->coexParams[SOFT_GEMINI_ADAPTIVE_RXT_TXT]?"Enabled":"Disabled")));
550ed6a25120881135f25d9173223306e9232bb2564Dmitry Shmidt	WLAN_OS_REPORT(("[26]: coexPsPollTimeout = %d (msec)\n", SoftGeminiParam->coexParams[SOFT_GEMINI_PS_POLL_TIMEOUT]));
551ed6a25120881135f25d9173223306e9232bb2564Dmitry Shmidt	WLAN_OS_REPORT(("[27]: coexUpsdTimeout = %d (msec) \n", SoftGeminiParam->coexParams[SOFT_GEMINI_UPSD_TIMEOUT]));
552ed6a25120881135f25d9173223306e9232bb2564Dmitry Shmidt	WLAN_OS_REPORT(("[28]: coexWlanActiveBtAclMasterMinEDR = %d (msec)\n", SoftGeminiParam->coexParams[SOFT_GEMINI_WLAN_ACTIVE_BT_ACL_MASTER_MIN_EDR]));
553ed6a25120881135f25d9173223306e9232bb2564Dmitry Shmidt	WLAN_OS_REPORT(("[29]: coexWlanActiveBtAclMasterMaxEDR = %d (msec)\n", SoftGeminiParam->coexParams[SOFT_GEMINI_WLAN_ACTIVE_BT_ACL_MASTER_MAX_EDR]));
554ed6a25120881135f25d9173223306e9232bb2564Dmitry Shmidt	WLAN_OS_REPORT(("[30]: coexWlanActiveMaxBtAclMasterEDR = %d (msec)\n", SoftGeminiParam->coexParams[SOFT_GEMINI_WLAN_ACTIVE_MAX_BT_ACL_MASTER_EDR]));
555ed6a25120881135f25d9173223306e9232bb2564Dmitry Shmidt    WLAN_OS_REPORT(("[31]: coexWlanActiveBtAclSlaveMinEDR = %d (msec)\n", SoftGeminiParam->coexParams[SOFT_GEMINI_WLAN_ACTIVE_BT_ACL_SLAVE_MIN_EDR]));
556ed6a25120881135f25d9173223306e9232bb2564Dmitry Shmidt	WLAN_OS_REPORT(("[32]: coexWlanActiveBtAclSlaveMaxEDR = %d (msec)\n", SoftGeminiParam->coexParams[SOFT_GEMINI_WLAN_ACTIVE_BT_ACL_SLAVE_MAX_EDR]));
557ed6a25120881135f25d9173223306e9232bb2564Dmitry Shmidt    WLAN_OS_REPORT(("[33]: coexWlanActiveMaxBtAclSlaveEDR = %d (msec)\n", SoftGeminiParam->coexParams[SOFT_GEMINI_WLAN_ACTIVE_MAX_BT_ACL_SLAVE_EDR]));
558ed6a25120881135f25d9173223306e9232bb2564Dmitry Shmidt    WLAN_OS_REPORT(("[34]: coexWlanActiveBtAclMinBR = %d (msec)\n", SoftGeminiParam->coexParams[SOFT_GEMINI_WLAN_ACTIVE_BT_ACL_SLAVE_MIN_BR]));
559ed6a25120881135f25d9173223306e9232bb2564Dmitry Shmidt    WLAN_OS_REPORT(("[35]: coexWlanActiveBtAclMaxBR = %d (msec)\n", SoftGeminiParam->coexParams[SOFT_GEMINI_WLAN_ACTIVE_BT_ACL_SLAVE_MAX_BR]));
560ed6a25120881135f25d9173223306e9232bb2564Dmitry Shmidt    WLAN_OS_REPORT(("[36]: coexWlanActiveMaxBtAclBR = %d (msec)\n", SoftGeminiParam->coexParams[SOFT_GEMINI_WLAN_ACTIVE_MAX_BT_ACL_SLAVE_BR]));
561ed6a25120881135f25d9173223306e9232bb2564Dmitry Shmidt    WLAN_OS_REPORT(("[37]: coexTempParam1 = %d \n", SoftGeminiParam->coexParams[SOFT_GEMINI_TEMP_PARAM_1]));
562ed6a25120881135f25d9173223306e9232bb2564Dmitry Shmidt    WLAN_OS_REPORT(("[38]: coexTempParam2 = %d \n", SoftGeminiParam->coexParams[SOFT_GEMINI_TEMP_PARAM_2]));
563ed6a25120881135f25d9173223306e9232bb2564Dmitry Shmidt    WLAN_OS_REPORT(("[39]: coexTempParam3 = %d \n", SoftGeminiParam->coexParams[SOFT_GEMINI_TEMP_PARAM_3]));
564ed6a25120881135f25d9173223306e9232bb2564Dmitry Shmidt    WLAN_OS_REPORT(("[40]: coexTempParam4 = %d \n", SoftGeminiParam->coexParams[SOFT_GEMINI_TEMP_PARAM_4]));
565ed6a25120881135f25d9173223306e9232bb2564Dmitry Shmidt    WLAN_OS_REPORT(("[41]: coexTempParam5 = %d \n", SoftGeminiParam->coexParams[SOFT_GEMINI_TEMP_PARAM_5]));
566981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	WLAN_OS_REPORT(("Enable mode : %s\n", SoftGemini_ConvertModeToString(pSoftGemini->SoftGeminiEnable)));
567981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	WLAN_OS_REPORT(("Driver Enabled : %s\n",(pSoftGemini->bDriverEnabled ? "YES" : "NO")));
568981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	WLAN_OS_REPORT(("Protective mode : %s\n", (pSoftGemini->bProtectiveMode ? "ON" : "OFF")));
569981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    WLAN_OS_REPORT(("PsPoll failure active : %s\n", (pSoftGemini->bPsPollFailureActive ? "YES" : "NO")));
570981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
571981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#endif
572981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
573981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
574981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/***************************************************************************
575981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*					SoftGemini_setParamsToFW					    	       *
576981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt****************************************************************************
577981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* DESCRIPTION:	The function sets the FW with the appropriate parameters set.
578981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*
579981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* INPUTS:		pSoftGemini - the object
580981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*
581981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*
582981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* OUTPUT:
583981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*
584981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* RETURNS:
585981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt***************************************************************************/
586653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidtstatic TI_STATUS SoftGemini_setParamsToFW(TI_HANDLE hSoftGemini, TSoftGeminiParams *softGeminiParams)
587981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
588981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	SoftGemini_t *pSoftGemini = (SoftGemini_t *)hSoftGemini;
589981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	TTwdParamInfo param;
590653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt
591653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt	os_memoryCopy(pSoftGemini->hOs,&param.content.SoftGeminiParam, softGeminiParams, sizeof(TSoftGeminiParams));
592981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	param.paramType = TWD_SG_CONFIG_PARAM_ID;
593981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	return TWD_SetParam (pSoftGemini->hTWD, &param);
594981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
595981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
596981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
597981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/***************************************************************************
598981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*					SoftGemini_EnableDriver  		    	       *
599981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt****************************************************************************
600981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* DESCRIPTION:	Activated when SG is enabled (after CLI or FW command)
601981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*
602981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* INPUTS:		pSoftGemini - the object
603981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*
604981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt***************************************************************************/
605981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic TI_STATUS SoftGemini_EnableDriver(TI_HANDLE hSoftGemini)
606981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
607981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	SoftGemini_t	*pSoftGemini = (SoftGemini_t *)hSoftGemini;
608981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	TI_STATUS return_value = TI_OK;
609981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
610981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTRACE0(pSoftGemini->hReport, REPORT_SEVERITY_INFORMATION, "\n");
611981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
612981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	pSoftGemini->bDriverEnabled = TI_TRUE;
613981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
614981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	/* Check if coexAutoPsMode - Co-ex is enabled to enter/exit P.S */
615653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt	if ( pSoftGemini->SoftGeminiParam.coexParams[SOFT_GEMINI_AUTO_PS_MODE])
616981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	{
617981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		SoftGemini_SetPS(pSoftGemini);
618981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	}
619981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
620981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	scr_setMode(pSoftGemini->hSCR, SCR_MID_SG);
621981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
622981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	return return_value;
623981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
624981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
625981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/***************************************************************************
626981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*					SoftGemini_DisableDriver  		    	       *
627981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt****************************************************************************
628981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* DESCRIPTION:	Activated when SG is disabled (after CLI or FW command)
629981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*
630981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* INPUTS:		pSoftGemini - the object
631981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*
632981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt***************************************************************************/
633981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic TI_STATUS SoftGemini_DisableDriver(TI_HANDLE hSoftGemini)
634981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
635981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	SoftGemini_t	*pSoftGemini = (SoftGemini_t *)hSoftGemini;
636981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	TI_STATUS return_value = TI_OK;
637981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
638981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTRACE0(pSoftGemini->hReport, REPORT_SEVERITY_INFORMATION, "\n");
639981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
640981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	pSoftGemini->bDriverEnabled = TI_FALSE;
641981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
642981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	scr_setMode(pSoftGemini->hSCR, SCR_MID_NORMAL);
643981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
644981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
645981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	/* Check if coexAutoPsMode - Co-ex is enabled to enter/exit P.S */
646653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt	if ( pSoftGemini->SoftGeminiParam.coexParams[SOFT_GEMINI_AUTO_PS_MODE])
647981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	{
648981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		SoftGemini_unSetPS(pSoftGemini);
649981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	}
650981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
651981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	/* Undo the changes that were made when Protective mode was on */
652981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	if (pSoftGemini->bProtectiveMode)
653981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	{
654981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		SoftGemini_DisableProtectiveMode(hSoftGemini);
655981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	}
656981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
657981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	return return_value;
658981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
659981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
660981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/***************************************************************************
661981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*					SoftGemini_SetPS  		    						   *
662981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt****************************************************************************
663981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* DESCRIPTION:	Set Always PS to PowerMgr
664981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*
665981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* INPUTS:		pSoftGemini - the object
666981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*
667981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt***************************************************************************/
668981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic TI_STATUS SoftGemini_SetPS(SoftGemini_t	*pSoftGemini)
669981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
670981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	paramInfo_t param;
671981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	bssEntry_t *pBssInfo=NULL;
672981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
673981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if (pSoftGemini->hCurrBss)
674981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	{
675981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		pBssInfo = currBSS_getBssInfo(pSoftGemini->hCurrBss);
676981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	}
677981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    else
678981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
679981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		TRACE0(pSoftGemini->hReport, REPORT_SEVERITY_ERROR, "SoftGemini_SetPS: hCurrBss = NULL!!!\n");
680981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
681981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
682981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    TRACE0(pSoftGemini->hReport, REPORT_SEVERITY_INFORMATION, "\n");
683981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
684981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	if (pBssInfo)
685981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	{
686981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		if ((pBssInfo->band == RADIO_BAND_2_4_GHZ))
687981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		{
688981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            TRACE0(pSoftGemini->hReport, REPORT_SEVERITY_INFORMATION, " SG-setPS: band == RADIO_BAND_2_4_GHZ");
689981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
690981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	        /* Set Params to Power Mgr for SG priority */
691981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	        param.paramType = POWER_MGR_POWER_MODE;
692981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	        param.content.powerMngPowerMode.PowerMode = POWER_MODE_PS_ONLY;
693981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	        param.content.powerMngPowerMode.PowerMngPriority = POWER_MANAGER_SG_PRIORITY;
694981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	        powerMgr_setParam(pSoftGemini->hPowerMgr,&param);
695981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
696981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	        /* enable SG priority for Power Mgr */
697981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	        param.paramType = POWER_MGR_ENABLE_PRIORITY;
698981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	        param.content.powerMngPriority = POWER_MANAGER_SG_PRIORITY;
699981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	        return powerMgr_setParam(pSoftGemini->hPowerMgr,&param);
700981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
701981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        else
702981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
703981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            TRACE0(pSoftGemini->hReport, REPORT_SEVERITY_INFORMATION, " SG-setPS: band == RADIO_BAND_5_GHZ");
704981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
705981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	}
706981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	return TI_OK;
707981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
708981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
709981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/***************************************************************************
710981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*					SoftGemini_unSetPS  		    						   *
711981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt****************************************************************************
712981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* DESCRIPTION:	unSet Always PS to PowerMgr
713981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*
714981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* INPUTS:		pSoftGemini - the object
715981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*
716981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt***************************************************************************/
717981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic TI_STATUS SoftGemini_unSetPS(SoftGemini_t	*pSoftGemini)
718981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
719981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	paramInfo_t param;
720981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
721981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTRACE0(pSoftGemini->hReport, REPORT_SEVERITY_INFORMATION, ", SG-unSetPS \n");
722981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
723981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	/* disable SG priority for Power Mgr*/
724981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	param.paramType = POWER_MGR_DISABLE_PRIORITY;
725981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	param.content.powerMngPriority = POWER_MANAGER_SG_PRIORITY;
726981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	return powerMgr_setParam(pSoftGemini->hPowerMgr,&param);
727981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
728981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
729981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
730981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/***************************************************************************
731981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*					SoftGemini_EnableProtectiveMode  		    	       *
732981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt****************************************************************************
733981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* DESCRIPTION:	Activated when FW inform us that protective mode is ON
734981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*
735981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*
736981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* INPUTS:		pSoftGemini - the object
737981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*
738981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt***************************************************************************/
739981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtvoid SoftGemini_EnableProtectiveMode(TI_HANDLE hSoftGemini)
740981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
741981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	SoftGemini_t	*pSoftGemini = (SoftGemini_t *)hSoftGemini;
742981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	paramInfo_t 	param;
743981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
744981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	pSoftGemini->bProtectiveMode = TI_TRUE;
745981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
746981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	/* set new configurations of SG roaming parameters */
747981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
748981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	/* This code should be removed on SG stage 2 integration
749981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	 currBSS_SGconfigureBSSLoss(pSoftGemini->hCurrBss,pSoftGemini->BSSLossCompensationPercent,TI_TRUE); */
750981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
751981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	/* set new configurations of scan to scancncn */
752653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt    scanCncn_SGconfigureScanParams(pSoftGemini->hScanCncn,TI_TRUE,
753653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt								   (TI_UINT8)pSoftGemini->SoftGeminiParam.coexParams[SOFT_GEMINI_AUTO_SCAN_PROBE_REQ],
754653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt								   pSoftGemini->SoftGeminiParam.coexParams[SOFT_GEMINI_AUTO_SCAN_COMPENSATION_MAX_TIME],
755653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt								   pSoftGemini->SoftGeminiParam.coexParams[SOFT_GEMINI_AUTO_SCAN_WINDOW]);
756981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
757981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* Call the power manager to enter short doze */
758981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTRACE0(pSoftGemini->hReport, REPORT_SEVERITY_INFORMATION, " SoftGemini_EnableProtectiveMode set SD");
759981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
760981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	/* Set Params to Power Mgr for SG priority */
761981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	param.paramType = POWER_MGR_POWER_MODE;
762981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	param.content.powerMngPowerMode.PowerMode = POWER_MODE_SHORT_DOZE;
763981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	param.content.powerMngPowerMode.PowerMngPriority = POWER_MANAGER_SG_PRIORITY;
764981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	powerMgr_setParam(pSoftGemini->hPowerMgr,&param);
765981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
766981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
767981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/***************************************************************************
768981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*					SoftGemini_DisableProtectiveMode  		    	       *
769981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt****************************************************************************
770981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* DESCRIPTION:	Activated when FW inform us that protective mode is OFF or SG is disabled
771981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*
772981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* INPUTS:		pSoftGemini - the object
773981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*
774981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt***************************************************************************/
775981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtvoid SoftGemini_DisableProtectiveMode(TI_HANDLE hSoftGemini)
776981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
777981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	SoftGemini_t	*pSoftGemini = (SoftGemini_t *)hSoftGemini;
778981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
779981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTRACE0(pSoftGemini->hReport, REPORT_SEVERITY_INFORMATION, "\n");
780981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
781981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	pSoftGemini->bProtectiveMode = TI_FALSE;
782981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
783981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	SoftGemini_RemoveProtectiveModeParameters(hSoftGemini);
784981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
785981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
786981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/***************************************************************************
787981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*					SoftGemini_DisableProtectiveMode  		    	       *
788981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt****************************************************************************
789981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* DESCRIPTION:	Called from SoftGemini_DisableProtectiveMode() when FW inform
790981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*				us that protective mode is OFF or SG is disabled, or from
791981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*				SoftGemini_unSetPSmode() when driver disconnects from AP.
792981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*
793981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* INPUTS:		pSoftGemini - the object
794981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*
795981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt***************************************************************************/
796981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
797981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtvoid SoftGemini_RemoveProtectiveModeParameters(TI_HANDLE hSoftGemini)
798981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
799981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	SoftGemini_t	*pSoftGemini = (SoftGemini_t *)hSoftGemini;
800981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	paramInfo_t  	param;
801981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
802981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTRACE0(pSoftGemini->hReport, REPORT_SEVERITY_INFORMATION, "\n");
803981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
804981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	/* don't use the SG roaming parameters */
805981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	currBSS_SGconfigureBSSLoss(pSoftGemini->hCurrBss,0,TI_FALSE);
806981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
807981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	/* don't use the SG scan parameters */
808981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    scanCncn_SGconfigureScanParams(pSoftGemini->hScanCncn,TI_FALSE,0,0,0);
809981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
810981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* Call the power manager to exit short doze */
811981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	/* Set Params to Power Mgr for SG priority */
812981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	param.paramType = POWER_MGR_POWER_MODE;
813981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	param.content.powerMngPowerMode.PowerMode = POWER_MODE_PS_ONLY;
814981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	param.content.powerMngPowerMode.PowerMngPriority = POWER_MANAGER_SG_PRIORITY;
815981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	powerMgr_setParam(pSoftGemini->hPowerMgr,&param);
816981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
817981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
818981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/***************************************************************************
819981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*					SoftGemini_SenseIndicationCB  		    	       *
820981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt****************************************************************************
821981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* DESCRIPTION:	This is the the function which is called for sense mode indication from FW
822981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*				(i.e. we are in SENSE mode and FW detects BT activity )
823981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*				SENSE_MODE_ENABLE - Indicates that FW detected BT activity
824981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*				SENSE_MODE_DISABLE - Indicates that FW doesn't detect BT activity for a period of time
825981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*
826981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* INPUTS:		pSoftGemini - the object
827981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* NOTE			This function is located in the API for debug purposes
828981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt***************************************************************************/
829981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
830981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtvoid SoftGemini_SenseIndicationCB( TI_HANDLE hSoftGemini, char* str, TI_UINT32 strLen )
831981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
832981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	SoftGemini_t	*pSoftGemini = (SoftGemini_t *)hSoftGemini;
833981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
834981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	if (pSoftGemini->SoftGeminiEnable == SG_DISABLE) {
835981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTRACE0(pSoftGemini->hReport, REPORT_SEVERITY_WARNING, ": SG is disabled, existing");
836981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		return;
837981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	}
838981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
839981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	if ( (SENSE_MODE_ENABLE == *str) && (!pSoftGemini->bDriverEnabled) )
840981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	{
841981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt			SoftGemini_EnableDriver(hSoftGemini);
842981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	}
843981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	else if ( (SENSE_MODE_DISABLE == *str) && (pSoftGemini->bDriverEnabled) )
844981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	{
845981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt			SoftGemini_DisableDriver(hSoftGemini);
846981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	}
847981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
848981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
849981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/***************************************************************************
850981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*					SoftGemini_ProtectiveIndicationCB  		    	       *
851981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt****************************************************************************
852981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* DESCRIPTION:	This is the the function which is called when FW starts Protective mode (i.e BT voice)
853981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*
854981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*				PROTECTIVE_MODE_ON - FW is activated on protective mode (BT voice is running)
855981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*				PROTECTIVE_MODE_OFF - FW is not activated on protective mode
856981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*
857981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* INPUTS:		pSoftGemini - the object
858981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* NOTE			This function is located in the API for debug purposes
859981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt***************************************************************************/
860981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
861981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtvoid SoftGemini_ProtectiveIndicationCB( TI_HANDLE hSoftGemini, char* str, TI_UINT32 strLen )
862981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
863981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	SoftGemini_t	*pSoftGemini = (SoftGemini_t *)hSoftGemini;
864981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
865981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTRACE1(pSoftGemini->hReport, REPORT_SEVERITY_INFORMATION, " with 0x%x\n",*str);
866981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
867981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	if (SG_DISABLE != pSoftGemini->SoftGeminiEnable)
868981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	{
869981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		if ((!pSoftGemini->bProtectiveMode) && (PROTECTIVE_MODE_ON == *str))
870981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		{
871981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt			SoftGemini_EnableProtectiveMode(hSoftGemini);
872981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		}
873981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		else if ((pSoftGemini->bProtectiveMode) && (PROTECTIVE_MODE_OFF == *str))
874981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		{
875981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt			SoftGemini_DisableProtectiveMode(hSoftGemini);
876981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		}
877981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		else
878981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		{
879981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTRACE0(pSoftGemini->hReport, REPORT_SEVERITY_INFORMATION, " : Protective mode  called when Protective mode is  \n");
880981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		}
881981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	}
882981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	else
883981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	{
884981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTRACE0(pSoftGemini->hReport, REPORT_SEVERITY_WARNING, " : Protective mode  called when SG mode is  ? \n");
885981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	}
886981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
887981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
888981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/***************************************************************************
889981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*					SoftGemini_ConvertModeToString  		    	       *
890981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt****************************************************************************/
891981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#ifdef REPORT_LOG
892981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
893981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtchar* SoftGemini_ConvertModeToString(ESoftGeminiEnableModes SoftGeminiEnable)
894981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
895981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	switch(SoftGeminiEnable)
896981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	{
897981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	case SG_PROTECTIVE:				return "SG_PROTECTIVE";
898981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	case SG_DISABLE:			    return "SG_DISABLE";
899981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	case SG_OPPORTUNISTIC:     return "SG_OPPORTUNISTIC";
900981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	default:
901981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		return "ERROR";
902981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	}
903981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
904981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
905981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#endif
906981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
907981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/***************************************************************************
908981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*					SoftGemini_getSGMode						  		    	       *
909981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt****************************************************************************/
910981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtESoftGeminiEnableModes SoftGemini_getSGMode(TI_HANDLE hSoftGemini)
911981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
912981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	SoftGemini_t	*pSoftGemini = (SoftGemini_t *)hSoftGemini;
913981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	return pSoftGemini->SoftGeminiEnable;
914981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
915981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
916981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/***************************************************************************
917981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*					SoftGemini_handleRecovery					    	       *
918981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt****************************************************************************
919981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* DESCRIPTION:	The function reconfigures WHAL with the SG parameters.
920981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*
921981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* INPUTS:		pSoftGemini - the object
922981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt***************************************************************************/
923981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTI_STATUS SoftGemini_handleRecovery(TI_HANDLE hSoftGemini)
924981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
925981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	SoftGemini_t	*pSoftGemini = (SoftGemini_t *)hSoftGemini;
926981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	ESoftGeminiEnableModes       realSoftGeminiEnableMode;
927981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
928981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	realSoftGeminiEnableMode = pSoftGemini->SoftGeminiEnable;
929981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* Disable the SG */
930981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    SoftGemini_setEnableParam(hSoftGemini, SG_DISABLE, TI_TRUE);
931981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    TRACE0(pSoftGemini->hReport, REPORT_SEVERITY_INFORMATION, "Disable SG \n");
932981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
933981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	pSoftGemini->SoftGeminiEnable = realSoftGeminiEnableMode;
934981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	/* Set enable param */
935981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
936981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	SoftGemini_setEnableParam(hSoftGemini, pSoftGemini->SoftGeminiEnable, TI_TRUE);
937981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    TRACE1(pSoftGemini->hReport, REPORT_SEVERITY_INFORMATION, "Set SG to-%d\n", pSoftGemini->SoftGeminiEnable);
938981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
939981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	/* Config the params to FW */
940653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt
941981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	SoftGemini_setParamsToFW(hSoftGemini, &pSoftGemini->SoftGeminiParam);
942981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	/*SoftGemini_printParams(hSoftGemini);*/
943981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	return TI_OK;
944981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
945981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/***************************************************************************
946981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*					SoftGemini_startPsPollFailure					       *
947981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt****************************************************************************
948981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* DESCRIPTION:	After Ps-Poll failure we disable the SG
949981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*
950981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* INPUTS:		pSoftGemini - the object
951981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt***************************************************************************/
952981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtvoid SoftGemini_startPsPollFailure(TI_HANDLE hSoftGemini)
953981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	{
954981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    SoftGemini_t	*pSoftGemini = (SoftGemini_t *)hSoftGemini;
955981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
956981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    TRACE0(pSoftGemini->hReport, REPORT_SEVERITY_INFORMATION, "\n");
957981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
958653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt    if ( (!pSoftGemini->bPsPollFailureActive) && (pSoftGemini->SoftGeminiParam.coexParams[SOFT_GEMINI_AUTO_PS_MODE] == TI_TRUE) )
959981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
960981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pSoftGemini->PsPollFailureLastEnableValue = pSoftGemini->SoftGeminiEnable;
961981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
962981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        /* Disable SG if needed */
963981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if ( pSoftGemini->SoftGeminiEnable != SG_DISABLE )
964981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
965981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            SoftGemini_setEnableParam(hSoftGemini, SG_DISABLE, TI_FALSE);
966981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	}
967981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
968981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pSoftGemini->bPsPollFailureActive = TI_TRUE;
969981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
970981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    else /* Calling SoftGemini_startPsPollFailure twice ? */
971981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	{
972981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        TRACE0(pSoftGemini->hReport, REPORT_SEVERITY_WARNING, "Calling  SoftGemini_startPsPollFailure while bPsPollFailureActive is TRUE\n");
973981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
974981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	}
975981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
976981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/***************************************************************************
977981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*					SoftGemini_endPsPollFailure					    	   *
978981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt****************************************************************************
979981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* DESCRIPTION:	Return to normal behavior after the PsPoll failure
980981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*
981981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* INPUTS:		pSoftGemini - the object
982981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt***************************************************************************/
983981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtvoid SoftGemini_endPsPollFailure(TI_HANDLE hSoftGemini)
984981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
985981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    SoftGemini_t	*pSoftGemini = (SoftGemini_t *)hSoftGemini;
986981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
987981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    TRACE0(pSoftGemini->hReport, REPORT_SEVERITY_INFORMATION, "\n");
988981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
989981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if ( pSoftGemini->bPsPollFailureActive )
990981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
991981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pSoftGemini->bPsPollFailureActive = TI_FALSE;
992981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
993981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        /* return to previous value */
994981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if ( pSoftGemini->PsPollFailureLastEnableValue != SG_DISABLE )
995981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
996981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt			SoftGemini_setEnableParam(hSoftGemini, pSoftGemini->PsPollFailureLastEnableValue, TI_FALSE);
997981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
998981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
999981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    else /* Calling SoftGemini_endPsPollFailure twice ? */
1000981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
1001981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        TRACE0(pSoftGemini->hReport, REPORT_SEVERITY_WARNING, "Calling  SoftGemini_endPsPollFailure while bPsPollFailureActive is FALSE\n");
1002981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
1003981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
1004981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1005981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1006