initial commit
This commit is contained in:
commit
6b2045b110
418 changed files with 346424 additions and 0 deletions
183
hal/HalPwrSeqCmd.c
Normal file
183
hal/HalPwrSeqCmd.c
Normal file
|
|
@ -0,0 +1,183 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
/*++
|
||||
Copyright (c) Realtek Semiconductor Corp. All rights reserved.
|
||||
|
||||
Module Name:
|
||||
HalPwrSeqCmd.c
|
||||
|
||||
Abstract:
|
||||
Implement HW Power sequence configuration CMD handling routine for Realtek devices.
|
||||
|
||||
Major Change History:
|
||||
When Who What
|
||||
---------- --------------- -------------------------------
|
||||
2011-10-26 Lucas Modify to be compatible with SD4-CE driver.
|
||||
2011-07-07 Roger Create.
|
||||
|
||||
--*/
|
||||
#include <HalPwrSeqCmd.h>
|
||||
|
||||
|
||||
//
|
||||
// Description:
|
||||
// This routine deal with the Power Configuration CMDs parsing for RTL8723/RTL8188E Series IC.
|
||||
//
|
||||
// Assumption:
|
||||
// We should follow specific format which was released from HW SD.
|
||||
//
|
||||
// 2011.07.07, added by Roger.
|
||||
//
|
||||
u8 HalPwrSeqCmdParsing(
|
||||
PADAPTER padapter,
|
||||
u8 CutVersion,
|
||||
u8 FabVersion,
|
||||
u8 InterfaceType,
|
||||
WLAN_PWR_CFG PwrSeqCmd[])
|
||||
{
|
||||
WLAN_PWR_CFG PwrCfgCmd = {0};
|
||||
u8 bPollingBit = _FALSE;
|
||||
u32 AryIdx = 0;
|
||||
u8 value = 0;
|
||||
u32 offset = 0;
|
||||
u32 pollingCount = 0; // polling autoload done.
|
||||
u32 maxPollingCnt = 5000;
|
||||
|
||||
do {
|
||||
PwrCfgCmd = PwrSeqCmd[AryIdx];
|
||||
|
||||
RT_TRACE(_module_hal_init_c_ , _drv_info_,
|
||||
("HalPwrSeqCmdParsing: offset(%#x) cut_msk(%#x) fab_msk(%#x) interface_msk(%#x) base(%#x) cmd(%#x) msk(%#x) value(%#x)\n",
|
||||
GET_PWR_CFG_OFFSET(PwrCfgCmd),
|
||||
GET_PWR_CFG_CUT_MASK(PwrCfgCmd),
|
||||
GET_PWR_CFG_FAB_MASK(PwrCfgCmd),
|
||||
GET_PWR_CFG_INTF_MASK(PwrCfgCmd),
|
||||
GET_PWR_CFG_BASE(PwrCfgCmd),
|
||||
GET_PWR_CFG_CMD(PwrCfgCmd),
|
||||
GET_PWR_CFG_MASK(PwrCfgCmd),
|
||||
GET_PWR_CFG_VALUE(PwrCfgCmd)));
|
||||
|
||||
//2 Only Handle the command whose FAB, CUT, and Interface are matched
|
||||
if ((GET_PWR_CFG_FAB_MASK(PwrCfgCmd) & FabVersion) &&
|
||||
(GET_PWR_CFG_CUT_MASK(PwrCfgCmd) & CutVersion) &&
|
||||
(GET_PWR_CFG_INTF_MASK(PwrCfgCmd) & InterfaceType))
|
||||
{
|
||||
switch (GET_PWR_CFG_CMD(PwrCfgCmd))
|
||||
{
|
||||
case PWR_CMD_READ:
|
||||
RT_TRACE(_module_hal_init_c_ , _drv_info_, ("HalPwrSeqCmdParsing: PWR_CMD_READ\n"));
|
||||
break;
|
||||
|
||||
case PWR_CMD_WRITE:
|
||||
RT_TRACE(_module_hal_init_c_ , _drv_info_, ("HalPwrSeqCmdParsing: PWR_CMD_WRITE\n"));
|
||||
offset = GET_PWR_CFG_OFFSET(PwrCfgCmd);
|
||||
|
||||
#ifdef CONFIG_SDIO_HCI
|
||||
//
|
||||
// <Roger_Notes> We should deal with interface specific address mapping for some interfaces, e.g., SDIO interface
|
||||
// 2011.07.07.
|
||||
//
|
||||
if (GET_PWR_CFG_BASE(PwrCfgCmd) == PWR_BASEADDR_SDIO)
|
||||
{
|
||||
// Read Back SDIO Local value
|
||||
value = SdioLocalCmd52Read1Byte(padapter, offset);
|
||||
|
||||
value &= ~(GET_PWR_CFG_MASK(PwrCfgCmd));
|
||||
value |= (GET_PWR_CFG_VALUE(PwrCfgCmd) & GET_PWR_CFG_MASK(PwrCfgCmd));
|
||||
|
||||
// Write Back SDIO Local value
|
||||
SdioLocalCmd52Write1Byte(padapter, offset, value);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
#ifdef CONFIG_GSPI_HCI
|
||||
if (GET_PWR_CFG_BASE(PwrCfgCmd) == PWR_BASEADDR_SDIO)
|
||||
offset = SPI_LOCAL_OFFSET | offset;
|
||||
#endif
|
||||
// Read the value from system register
|
||||
value = rtw_read8(padapter, offset);
|
||||
|
||||
value=value&(~(GET_PWR_CFG_MASK(PwrCfgCmd)));
|
||||
value=value|(GET_PWR_CFG_VALUE(PwrCfgCmd)&GET_PWR_CFG_MASK(PwrCfgCmd));
|
||||
|
||||
// Write the value back to sytem register
|
||||
rtw_write8(padapter, offset, value);
|
||||
}
|
||||
break;
|
||||
|
||||
case PWR_CMD_POLLING:
|
||||
RT_TRACE(_module_hal_init_c_ , _drv_info_, ("HalPwrSeqCmdParsing: PWR_CMD_POLLING\n"));
|
||||
|
||||
bPollingBit = _FALSE;
|
||||
offset = GET_PWR_CFG_OFFSET(PwrCfgCmd);
|
||||
#ifdef CONFIG_GSPI_HCI
|
||||
if (GET_PWR_CFG_BASE(PwrCfgCmd) == PWR_BASEADDR_SDIO)
|
||||
offset = SPI_LOCAL_OFFSET | offset;
|
||||
#endif
|
||||
do {
|
||||
#ifdef CONFIG_SDIO_HCI
|
||||
if (GET_PWR_CFG_BASE(PwrCfgCmd) == PWR_BASEADDR_SDIO)
|
||||
value = SdioLocalCmd52Read1Byte(padapter, offset);
|
||||
else
|
||||
#endif
|
||||
value = rtw_read8(padapter, offset);
|
||||
|
||||
value=value&GET_PWR_CFG_MASK(PwrCfgCmd);
|
||||
if (value == (GET_PWR_CFG_VALUE(PwrCfgCmd) & GET_PWR_CFG_MASK(PwrCfgCmd)))
|
||||
bPollingBit = _TRUE;
|
||||
else
|
||||
rtw_udelay_os(10);
|
||||
|
||||
if (pollingCount++ > maxPollingCnt) {
|
||||
DBG_871X_LEVEL(_drv_err_, "HalPwrSeqCmdParsing: Fail to polling Offset[%#x]=%02x\n", offset, value);
|
||||
return _FALSE;
|
||||
}
|
||||
} while (!bPollingBit);
|
||||
|
||||
break;
|
||||
|
||||
case PWR_CMD_DELAY:
|
||||
RT_TRACE(_module_hal_init_c_ , _drv_info_, ("HalPwrSeqCmdParsing: PWR_CMD_DELAY\n"));
|
||||
if (GET_PWR_CFG_VALUE(PwrCfgCmd) == PWRSEQ_DELAY_US)
|
||||
rtw_udelay_os(GET_PWR_CFG_OFFSET(PwrCfgCmd));
|
||||
else
|
||||
rtw_udelay_os(GET_PWR_CFG_OFFSET(PwrCfgCmd)*1000);
|
||||
break;
|
||||
|
||||
case PWR_CMD_END:
|
||||
// When this command is parsed, end the process
|
||||
RT_TRACE(_module_hal_init_c_ , _drv_info_, ("HalPwrSeqCmdParsing: PWR_CMD_END\n"));
|
||||
return _TRUE;
|
||||
break;
|
||||
|
||||
default:
|
||||
RT_TRACE(_module_hal_init_c_ , _drv_err_, ("HalPwrSeqCmdParsing: Unknown CMD!!\n"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
AryIdx++;//Add Array Index
|
||||
}while(1);
|
||||
|
||||
return _TRUE;
|
||||
}
|
||||
|
||||
|
||||
1987
hal/btc/HalBtc8188c2Ant.c
Normal file
1987
hal/btc/HalBtc8188c2Ant.c
Normal file
File diff suppressed because it is too large
Load diff
149
hal/btc/HalBtc8188c2Ant.h
Normal file
149
hal/btc/HalBtc8188c2Ant.h
Normal file
|
|
@ -0,0 +1,149 @@
|
|||
//===========================================
|
||||
// The following is for 8188C 2Ant BT Co-exist definition
|
||||
//===========================================
|
||||
#define BTC_RSSI_COEX_THRESH_TOL_8188C_2ANT 6
|
||||
|
||||
typedef enum _BT_INFO_SRC_8188C_2ANT{
|
||||
BT_INFO_SRC_8188C_2ANT_WIFI_FW = 0x0,
|
||||
BT_INFO_SRC_8188C_2ANT_BT_RSP = 0x1,
|
||||
BT_INFO_SRC_8188C_2ANT_BT_ACTIVE_SEND = 0x2,
|
||||
BT_INFO_SRC_8188C_2ANT_MAX
|
||||
}BT_INFO_SRC_8188C_2ANT,*PBT_INFO_SRC_8188C_2ANT;
|
||||
|
||||
typedef enum _BT_8188C_2ANT_BT_STATUS{
|
||||
BT_8188C_2ANT_BT_STATUS_IDLE = 0x0,
|
||||
BT_8188C_2ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
|
||||
BT_8188C_2ANT_BT_STATUS_NON_IDLE = 0x2,
|
||||
BT_8188C_2ANT_BT_STATUS_MAX
|
||||
}BT_8188C_2ANT_BT_STATUS,*PBT_8188C_2ANT_BT_STATUS;
|
||||
|
||||
typedef enum _BT_8188C_2ANT_COEX_ALGO{
|
||||
BT_8188C_2ANT_COEX_ALGO_UNDEFINED = 0x0,
|
||||
BT_8188C_2ANT_COEX_ALGO_SCO = 0x1,
|
||||
BT_8188C_2ANT_COEX_ALGO_HID = 0x2,
|
||||
BT_8188C_2ANT_COEX_ALGO_A2DP = 0x3,
|
||||
BT_8188C_2ANT_COEX_ALGO_PAN = 0x4,
|
||||
BT_8188C_2ANT_COEX_ALGO_HID_A2DP = 0x5,
|
||||
BT_8188C_2ANT_COEX_ALGO_HID_PAN = 0x6,
|
||||
BT_8188C_2ANT_COEX_ALGO_PAN_A2DP = 0x7,
|
||||
BT_8188C_2ANT_COEX_ALGO_MAX
|
||||
}BT_8188C_2ANT_COEX_ALGO,*PBT_8188C_2ANT_COEX_ALGO;
|
||||
|
||||
typedef struct _COEX_DM_8188C_2ANT{
|
||||
// fw mechanism
|
||||
BOOLEAN bPreBalanceOn;
|
||||
BOOLEAN bCurBalanceOn;
|
||||
|
||||
// diminishWifi
|
||||
BOOLEAN bPreDacOn;
|
||||
BOOLEAN bCurDacOn;
|
||||
BOOLEAN bPreInterruptOn;
|
||||
BOOLEAN bCurInterruptOn;
|
||||
u1Byte preFwDacSwingLvl;
|
||||
u1Byte curFwDacSwingLvl;
|
||||
BOOLEAN bPreNavOn;
|
||||
BOOLEAN bCurNavOn;
|
||||
|
||||
// sw mechanism
|
||||
BOOLEAN bPreRfRxLpfShrink;
|
||||
BOOLEAN bCurRfRxLpfShrink;
|
||||
u4Byte btRf0x1eBackup;
|
||||
BOOLEAN bPreLowPenaltyRa;
|
||||
BOOLEAN bCurLowPenaltyRa;
|
||||
BOOLEAN bPreDacSwingOn;
|
||||
u4Byte preDacSwingLvl;
|
||||
BOOLEAN bCurDacSwingOn;
|
||||
u4Byte curDacSwingLvl;
|
||||
BOOLEAN bPreAdcBackOff;
|
||||
BOOLEAN bCurAdcBackOff;
|
||||
BOOLEAN bPreAgcTableEn;
|
||||
BOOLEAN bCurAgcTableEn;
|
||||
//u4Byte preVal0x6c0;
|
||||
//u4Byte curVal0x6c0;
|
||||
u4Byte preVal0x6c4;
|
||||
u4Byte curVal0x6c4;
|
||||
u4Byte preVal0x6c8;
|
||||
u4Byte curVal0x6c8;
|
||||
u4Byte preVal0x6cc;
|
||||
u4Byte curVal0x6cc;
|
||||
//BOOLEAN bLimitedDig;
|
||||
|
||||
// algorithm related
|
||||
u1Byte preAlgorithm;
|
||||
u1Byte curAlgorithm;
|
||||
//u1Byte btStatus;
|
||||
//u1Byte wifiChnlInfo[3];
|
||||
} COEX_DM_8188C_2ANT, *PCOEX_DM_8188C_2ANT;
|
||||
|
||||
typedef struct _COEX_STA_8188C_2ANT{
|
||||
u1Byte preWifiRssiState[4];
|
||||
BOOLEAN bBtBusy;
|
||||
BOOLEAN bBtUplink;
|
||||
BOOLEAN bBtDownLink;
|
||||
BOOLEAN bA2dpBusy;
|
||||
}COEX_STA_8188C_2ANT, *PCOEX_STA_8188C_2ANT;
|
||||
|
||||
//===========================================
|
||||
// The following is interface which will notify coex module.
|
||||
//===========================================
|
||||
VOID
|
||||
EXhalbtc8188c2ant_PowerOnSetting(
|
||||
IN PBTC_COEXIST pBtCoexist
|
||||
);
|
||||
VOID
|
||||
EXhalbtc8188c2ant_InitHwConfig(
|
||||
IN PBTC_COEXIST pBtCoexist,
|
||||
IN BOOLEAN bWifiOnly
|
||||
);
|
||||
VOID
|
||||
EXhalbtc8188c2ant_InitCoexDm(
|
||||
IN PBTC_COEXIST pBtCoexist
|
||||
);
|
||||
VOID
|
||||
EXhalbtc8188c2ant_IpsNotify(
|
||||
IN PBTC_COEXIST pBtCoexist,
|
||||
IN u1Byte type
|
||||
);
|
||||
VOID
|
||||
EXhalbtc8188c2ant_LpsNotify(
|
||||
IN PBTC_COEXIST pBtCoexist,
|
||||
IN u1Byte type
|
||||
);
|
||||
VOID
|
||||
EXhalbtc8188c2ant_ScanNotify(
|
||||
IN PBTC_COEXIST pBtCoexist,
|
||||
IN u1Byte type
|
||||
);
|
||||
VOID
|
||||
EXhalbtc8188c2ant_ConnectNotify(
|
||||
IN PBTC_COEXIST pBtCoexist,
|
||||
IN u1Byte type
|
||||
);
|
||||
VOID
|
||||
EXhalbtc8188c2ant_MediaStatusNotify(
|
||||
IN PBTC_COEXIST pBtCoexist,
|
||||
IN u1Byte type
|
||||
);
|
||||
VOID
|
||||
EXhalbtc8188c2ant_SpecialPacketNotify(
|
||||
IN PBTC_COEXIST pBtCoexist,
|
||||
IN u1Byte type
|
||||
);
|
||||
VOID
|
||||
EXhalbtc8188c2ant_HaltNotify(
|
||||
IN PBTC_COEXIST pBtCoexist
|
||||
);
|
||||
VOID
|
||||
EXhalbtc8188c2ant_Periodical(
|
||||
IN PBTC_COEXIST pBtCoexist
|
||||
);
|
||||
VOID
|
||||
EXhalbtc8188c2ant_BtInfoNotify(
|
||||
IN PBTC_COEXIST pBtCoexist,
|
||||
IN pu1Byte tmpBuf,
|
||||
IN u1Byte length
|
||||
);
|
||||
VOID
|
||||
EXhalbtc8188c2ant_DisplayCoexInfo(
|
||||
IN PBTC_COEXIST pBtCoexist
|
||||
);
|
||||
1992
hal/btc/HalBtc8192d2Ant.c
Normal file
1992
hal/btc/HalBtc8192d2Ant.c
Normal file
File diff suppressed because it is too large
Load diff
170
hal/btc/HalBtc8192d2Ant.h
Normal file
170
hal/btc/HalBtc8192d2Ant.h
Normal file
|
|
@ -0,0 +1,170 @@
|
|||
//===========================================
|
||||
// The following is for 8192D 2Ant BT Co-exist definition
|
||||
//===========================================
|
||||
#define BTC_RSSI_COEX_THRESH_TOL_8192D_2ANT 6
|
||||
|
||||
typedef enum _BT_INFO_SRC_8192D_2ANT{
|
||||
BT_INFO_SRC_8192D_2ANT_WIFI_FW = 0x0,
|
||||
BT_INFO_SRC_8192D_2ANT_BT_RSP = 0x1,
|
||||
BT_INFO_SRC_8192D_2ANT_BT_ACTIVE_SEND = 0x2,
|
||||
BT_INFO_SRC_8192D_2ANT_MAX
|
||||
}BT_INFO_SRC_8192D_2ANT,*PBT_INFO_SRC_8192D_2ANT;
|
||||
|
||||
typedef enum _BT_8192D_2ANT_BT_STATUS{
|
||||
BT_8192D_2ANT_BT_STATUS_IDLE = 0x0,
|
||||
BT_8192D_2ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
|
||||
BT_8192D_2ANT_BT_STATUS_NON_IDLE = 0x2,
|
||||
BT_8192D_2ANT_BT_STATUS_MAX
|
||||
}BT_8192D_2ANT_BT_STATUS,*PBT_8192D_2ANT_BT_STATUS;
|
||||
|
||||
typedef enum _BT_8192D_2ANT_COEX_ALGO{
|
||||
BT_8192D_2ANT_COEX_ALGO_UNDEFINED = 0x0,
|
||||
BT_8192D_2ANT_COEX_ALGO_SCO = 0x1,
|
||||
BT_8192D_2ANT_COEX_ALGO_HID = 0x2,
|
||||
BT_8192D_2ANT_COEX_ALGO_A2DP = 0x3,
|
||||
BT_8192D_2ANT_COEX_ALGO_PAN = 0x4,
|
||||
BT_8192D_2ANT_COEX_ALGO_HID_A2DP = 0x5,
|
||||
BT_8192D_2ANT_COEX_ALGO_HID_PAN = 0x6,
|
||||
BT_8192D_2ANT_COEX_ALGO_PAN_A2DP = 0x7,
|
||||
BT_8192D_2ANT_COEX_ALGO_MAX
|
||||
}BT_8192D_2ANT_COEX_ALGO,*PBT_8192D_2ANT_COEX_ALGO;
|
||||
|
||||
typedef struct _COEX_DM_8192D_2ANT{
|
||||
// fw mechanism
|
||||
BOOLEAN bPreBalanceOn;
|
||||
BOOLEAN bCurBalanceOn;
|
||||
|
||||
// diminishWifi
|
||||
BOOLEAN bPreDacOn;
|
||||
BOOLEAN bCurDacOn;
|
||||
BOOLEAN bPreInterruptOn;
|
||||
BOOLEAN bCurInterruptOn;
|
||||
u1Byte preFwDacSwingLvl;
|
||||
u1Byte curFwDacSwingLvl;
|
||||
BOOLEAN bPreNavOn;
|
||||
BOOLEAN bCurNavOn;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//BOOLEAN bPreDecBtPwr;
|
||||
//BOOLEAN bCurDecBtPwr;
|
||||
|
||||
//u1Byte preFwDacSwingLvl;
|
||||
//u1Byte curFwDacSwingLvl;
|
||||
//BOOLEAN bCurIgnoreWlanAct;
|
||||
//BOOLEAN bPreIgnoreWlanAct;
|
||||
//u1Byte prePsTdma;
|
||||
//u1Byte curPsTdma;
|
||||
//u1Byte psTdmaPara[5];
|
||||
//u1Byte psTdmaDuAdjType;
|
||||
//BOOLEAN bResetTdmaAdjust;
|
||||
//BOOLEAN bPrePsTdmaOn;
|
||||
//BOOLEAN bCurPsTdmaOn;
|
||||
//BOOLEAN bPreBtAutoReport;
|
||||
//BOOLEAN bCurBtAutoReport;
|
||||
|
||||
// sw mechanism
|
||||
BOOLEAN bPreRfRxLpfShrink;
|
||||
BOOLEAN bCurRfRxLpfShrink;
|
||||
u4Byte btRf0x1eBackup;
|
||||
BOOLEAN bPreLowPenaltyRa;
|
||||
BOOLEAN bCurLowPenaltyRa;
|
||||
BOOLEAN bPreDacSwingOn;
|
||||
u4Byte preDacSwingLvl;
|
||||
BOOLEAN bCurDacSwingOn;
|
||||
u4Byte curDacSwingLvl;
|
||||
BOOLEAN bPreAdcBackOff;
|
||||
BOOLEAN bCurAdcBackOff;
|
||||
BOOLEAN bPreAgcTableEn;
|
||||
BOOLEAN bCurAgcTableEn;
|
||||
//u4Byte preVal0x6c0;
|
||||
//u4Byte curVal0x6c0;
|
||||
u4Byte preVal0x6c4;
|
||||
u4Byte curVal0x6c4;
|
||||
u4Byte preVal0x6c8;
|
||||
u4Byte curVal0x6c8;
|
||||
u4Byte preVal0x6cc;
|
||||
u4Byte curVal0x6cc;
|
||||
//BOOLEAN bLimitedDig;
|
||||
|
||||
// algorithm related
|
||||
u1Byte preAlgorithm;
|
||||
u1Byte curAlgorithm;
|
||||
//u1Byte btStatus;
|
||||
//u1Byte wifiChnlInfo[3];
|
||||
} COEX_DM_8192D_2ANT, *PCOEX_DM_8192D_2ANT;
|
||||
|
||||
typedef struct _COEX_STA_8192D_2ANT{
|
||||
u1Byte preWifiRssiState[4];
|
||||
BOOLEAN bBtBusy;
|
||||
BOOLEAN bBtUplink;
|
||||
BOOLEAN bBtDownLink;
|
||||
BOOLEAN bA2dpBusy;
|
||||
}COEX_STA_8192D_2ANT, *PCOEX_STA_8192D_2ANT;
|
||||
|
||||
//===========================================
|
||||
// The following is interface which will notify coex module.
|
||||
//===========================================
|
||||
VOID
|
||||
EXhalbtc8192d2ant_PowerOnSetting(
|
||||
IN PBTC_COEXIST pBtCoexist
|
||||
);
|
||||
VOID
|
||||
EXhalbtc8192d2ant_InitHwConfig(
|
||||
IN PBTC_COEXIST pBtCoexist,
|
||||
IN BOOLEAN bWifiOnly
|
||||
);
|
||||
VOID
|
||||
EXhalbtc8192d2ant_InitCoexDm(
|
||||
IN PBTC_COEXIST pBtCoexist
|
||||
);
|
||||
VOID
|
||||
EXhalbtc8192d2ant_IpsNotify(
|
||||
IN PBTC_COEXIST pBtCoexist,
|
||||
IN u1Byte type
|
||||
);
|
||||
VOID
|
||||
EXhalbtc8192d2ant_LpsNotify(
|
||||
IN PBTC_COEXIST pBtCoexist,
|
||||
IN u1Byte type
|
||||
);
|
||||
VOID
|
||||
EXhalbtc8192d2ant_ScanNotify(
|
||||
IN PBTC_COEXIST pBtCoexist,
|
||||
IN u1Byte type
|
||||
);
|
||||
VOID
|
||||
EXhalbtc8192d2ant_ConnectNotify(
|
||||
IN PBTC_COEXIST pBtCoexist,
|
||||
IN u1Byte type
|
||||
);
|
||||
VOID
|
||||
EXhalbtc8192d2ant_MediaStatusNotify(
|
||||
IN PBTC_COEXIST pBtCoexist,
|
||||
IN u1Byte type
|
||||
);
|
||||
VOID
|
||||
EXhalbtc8192d2ant_SpecialPacketNotify(
|
||||
IN PBTC_COEXIST pBtCoexist,
|
||||
IN u1Byte type
|
||||
);
|
||||
VOID
|
||||
EXhalbtc8192d2ant_HaltNotify(
|
||||
IN PBTC_COEXIST pBtCoexist
|
||||
);
|
||||
VOID
|
||||
EXhalbtc8192d2ant_Periodical(
|
||||
IN PBTC_COEXIST pBtCoexist
|
||||
);
|
||||
VOID
|
||||
EXhalbtc8192d2ant_BtInfoNotify(
|
||||
IN PBTC_COEXIST pBtCoexist,
|
||||
IN pu1Byte tmpBuf,
|
||||
IN u1Byte length
|
||||
);
|
||||
VOID
|
||||
EXhalbtc8192d2ant_DisplayCoexInfo(
|
||||
IN PBTC_COEXIST pBtCoexist
|
||||
);
|
||||
3417
hal/btc/HalBtc8192e1Ant.c
Normal file
3417
hal/btc/HalBtc8192e1Ant.c
Normal file
File diff suppressed because it is too large
Load diff
226
hal/btc/HalBtc8192e1Ant.h
Normal file
226
hal/btc/HalBtc8192e1Ant.h
Normal file
|
|
@ -0,0 +1,226 @@
|
|||
|
||||
#if (BT_SUPPORT == 1 && COEX_SUPPORT == 1)
|
||||
|
||||
#if (RTL8192E_SUPPORT == 1)
|
||||
|
||||
/* *******************************************
|
||||
* The following is for 8192E 1ANT BT Co-exist definition
|
||||
* ******************************************* */
|
||||
#define BT_AUTO_REPORT_ONLY_8192E_1ANT 1
|
||||
|
||||
#define BT_INFO_8192E_1ANT_B_FTP BIT(7)
|
||||
#define BT_INFO_8192E_1ANT_B_A2DP BIT(6)
|
||||
#define BT_INFO_8192E_1ANT_B_HID BIT(5)
|
||||
#define BT_INFO_8192E_1ANT_B_SCO_BUSY BIT(4)
|
||||
#define BT_INFO_8192E_1ANT_B_ACL_BUSY BIT(3)
|
||||
#define BT_INFO_8192E_1ANT_B_INQ_PAGE BIT(2)
|
||||
#define BT_INFO_8192E_1ANT_B_SCO_ESCO BIT(1)
|
||||
#define BT_INFO_8192E_1ANT_B_CONNECTION BIT(0)
|
||||
|
||||
#define BT_INFO_8192E_1ANT_A2DP_BASIC_RATE(_BT_INFO_EXT_) \
|
||||
(((_BT_INFO_EXT_&BIT(0))) ? true : false)
|
||||
|
||||
#define BTC_RSSI_COEX_THRESH_TOL_8192E_1ANT 2
|
||||
|
||||
#define BT_8192E_1ANT_WIFI_NOISY_THRESH 30 /* max: 255 */
|
||||
|
||||
enum bt_info_src_8192e_1ant {
|
||||
BT_INFO_SRC_8192E_1ANT_WIFI_FW = 0x0,
|
||||
BT_INFO_SRC_8192E_1ANT_BT_RSP = 0x1,
|
||||
BT_INFO_SRC_8192E_1ANT_BT_ACTIVE_SEND = 0x2,
|
||||
BT_INFO_SRC_8192E_1ANT_MAX
|
||||
};
|
||||
|
||||
enum bt_8192e_1ant_bt_status {
|
||||
BT_8192E_1ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0,
|
||||
BT_8192E_1ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
|
||||
BT_8192E_1ANT_BT_STATUS_INQ_PAGE = 0x2,
|
||||
BT_8192E_1ANT_BT_STATUS_ACL_BUSY = 0x3,
|
||||
BT_8192E_1ANT_BT_STATUS_SCO_BUSY = 0x4,
|
||||
BT_8192E_1ANT_BT_STATUS_ACL_SCO_BUSY = 0x5,
|
||||
BT_8192E_1ANT_BT_STATUS_MAX
|
||||
};
|
||||
|
||||
enum bt_8192e_1ant_wifi_status {
|
||||
BT_8192E_1ANT_WIFI_STATUS_NON_CONNECTED_IDLE = 0x0,
|
||||
BT_8192E_1ANT_WIFI_STATUS_NON_CONNECTED_ASSO_AUTH_SCAN = 0x1,
|
||||
BT_8192E_1ANT_WIFI_STATUS_CONNECTED_SCAN = 0x2,
|
||||
BT_8192E_1ANT_WIFI_STATUS_CONNECTED_SPECIFIC_PKT = 0x3,
|
||||
BT_8192E_1ANT_WIFI_STATUS_CONNECTED_IDLE = 0x4,
|
||||
BT_8192E_1ANT_WIFI_STATUS_CONNECTED_BUSY = 0x5,
|
||||
BT_8192E_1ANT_WIFI_STATUS_MAX
|
||||
};
|
||||
|
||||
enum bt_8192e_1ant_coex_algo {
|
||||
BT_8192E_1ANT_COEX_ALGO_UNDEFINED = 0x0,
|
||||
BT_8192E_1ANT_COEX_ALGO_SCO = 0x1,
|
||||
BT_8192E_1ANT_COEX_ALGO_HID = 0x2,
|
||||
BT_8192E_1ANT_COEX_ALGO_A2DP = 0x3,
|
||||
BT_8192E_1ANT_COEX_ALGO_A2DP_PANHS = 0x4,
|
||||
BT_8192E_1ANT_COEX_ALGO_PANEDR = 0x5,
|
||||
BT_8192E_1ANT_COEX_ALGO_PANHS = 0x6,
|
||||
BT_8192E_1ANT_COEX_ALGO_PANEDR_A2DP = 0x7,
|
||||
BT_8192E_1ANT_COEX_ALGO_PANEDR_HID = 0x8,
|
||||
BT_8192E_1ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x9,
|
||||
BT_8192E_1ANT_COEX_ALGO_HID_A2DP = 0xa,
|
||||
BT_8192E_1ANT_COEX_ALGO_MAX = 0xb,
|
||||
};
|
||||
|
||||
struct coex_dm_8192e_1ant {
|
||||
/* fw mechanism */
|
||||
boolean cur_ignore_wlan_act;
|
||||
boolean pre_ignore_wlan_act;
|
||||
u8 pre_ps_tdma;
|
||||
u8 cur_ps_tdma;
|
||||
u8 ps_tdma_para[5];
|
||||
u8 ps_tdma_du_adj_type;
|
||||
boolean auto_tdma_adjust;
|
||||
boolean pre_ps_tdma_on;
|
||||
boolean cur_ps_tdma_on;
|
||||
boolean pre_bt_auto_report;
|
||||
boolean cur_bt_auto_report;
|
||||
u8 pre_lps;
|
||||
u8 cur_lps;
|
||||
u8 pre_rpwm;
|
||||
u8 cur_rpwm;
|
||||
|
||||
/* sw mechanism */
|
||||
boolean pre_low_penalty_ra;
|
||||
boolean cur_low_penalty_ra;
|
||||
u32 pre_val0x6c0;
|
||||
u32 cur_val0x6c0;
|
||||
u32 pre_val0x6c4;
|
||||
u32 cur_val0x6c4;
|
||||
u32 pre_val0x6c8;
|
||||
u32 cur_val0x6c8;
|
||||
u8 pre_val0x6cc;
|
||||
u8 cur_val0x6cc;
|
||||
boolean limited_dig;
|
||||
|
||||
u32 backup_arfr_cnt1; /* Auto Rate Fallback Retry cnt */
|
||||
u32 backup_arfr_cnt2; /* Auto Rate Fallback Retry cnt */
|
||||
u16 backup_retry_limit;
|
||||
u8 backup_ampdu_max_time;
|
||||
|
||||
/* algorithm related */
|
||||
u8 pre_algorithm;
|
||||
u8 cur_algorithm;
|
||||
u8 bt_status;
|
||||
u8 wifi_chnl_info[3];
|
||||
|
||||
u32 pre_ra_mask;
|
||||
u32 cur_ra_mask;
|
||||
u8 pre_arfr_type;
|
||||
u8 cur_arfr_type;
|
||||
u8 pre_retry_limit_type;
|
||||
u8 cur_retry_limit_type;
|
||||
u8 pre_ampdu_time_type;
|
||||
u8 cur_ampdu_time_type;
|
||||
u32 arp_cnt;
|
||||
|
||||
u8 error_condition;
|
||||
};
|
||||
|
||||
struct coex_sta_8192e_1ant {
|
||||
boolean bt_disabled;
|
||||
boolean bt_link_exist;
|
||||
boolean sco_exist;
|
||||
boolean a2dp_exist;
|
||||
boolean hid_exist;
|
||||
boolean pan_exist;
|
||||
|
||||
boolean under_lps;
|
||||
boolean under_ips;
|
||||
u32 specific_pkt_period_cnt;
|
||||
u32 high_priority_tx;
|
||||
u32 high_priority_rx;
|
||||
u32 low_priority_tx;
|
||||
u32 low_priority_rx;
|
||||
s8 bt_rssi;
|
||||
boolean bt_tx_rx_mask;
|
||||
u8 pre_bt_rssi_state;
|
||||
u8 pre_wifi_rssi_state[4];
|
||||
boolean c2h_bt_info_req_sent;
|
||||
u8 bt_info_c2h[BT_INFO_SRC_8192E_1ANT_MAX][10];
|
||||
u32 bt_info_c2h_cnt[BT_INFO_SRC_8192E_1ANT_MAX];
|
||||
boolean c2h_bt_inquiry_page;
|
||||
boolean c2h_bt_page; /* Add for win8.1 page out issue */
|
||||
boolean wifi_is_high_pri_task; /* Add for win8.1 page out issue */
|
||||
u8 bt_retry_cnt;
|
||||
u8 bt_info_ext;
|
||||
u32 pop_event_cnt;
|
||||
u8 scan_ap_num;
|
||||
|
||||
u32 crc_ok_cck;
|
||||
u32 crc_ok_11g;
|
||||
u32 crc_ok_11n;
|
||||
u32 crc_ok_11n_agg;
|
||||
|
||||
u32 crc_err_cck;
|
||||
u32 crc_err_11g;
|
||||
u32 crc_err_11n;
|
||||
u32 crc_err_11n_agg;
|
||||
|
||||
boolean cck_lock;
|
||||
boolean pre_ccklock;
|
||||
u8 coex_table_type;
|
||||
|
||||
boolean force_lps_on;
|
||||
};
|
||||
|
||||
/* *******************************************
|
||||
* The following is interface which will notify coex module.
|
||||
* ******************************************* */
|
||||
void ex_halbtc8192e1ant_power_on_setting(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8192e1ant_pre_load_firmware(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8192e1ant_init_hw_config(IN struct btc_coexist *btcoexist,
|
||||
IN boolean wifi_only);
|
||||
void ex_halbtc8192e1ant_init_coex_dm(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8192e1ant_ips_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8192e1ant_lps_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8192e1ant_scan_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8192e1ant_connect_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8192e1ant_media_status_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8192e1ant_specific_packet_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8192e1ant_bt_info_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 *tmp_buf, IN u8 length);
|
||||
void ex_halbtc8192e1ant_rf_status_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8192e1ant_halt_notify(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8192e1ant_pnp_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 pnp_state);
|
||||
void ex_halbtc8192e1ant_coex_dm_reset(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8192e1ant_periodical(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8192e1ant_display_coex_info(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8192e1ant_dbg_control(IN struct btc_coexist *btcoexist,
|
||||
IN u8 op_code, IN u8 op_len, IN u8 *pdata);
|
||||
|
||||
#else /* #if (RTL8192E_SUPPORT == 1) */
|
||||
#define ex_halbtc8192e1ant_power_on_setting(btcoexist)
|
||||
#define ex_halbtc8192e1ant_pre_load_firmware(btcoexist)
|
||||
#define ex_halbtc8192e1ant_init_hw_config(btcoexist, wifi_only)
|
||||
#define ex_halbtc8192e1ant_init_coex_dm(btcoexist)
|
||||
#define ex_halbtc8192e1ant_ips_notify(btcoexist, type)
|
||||
#define ex_halbtc8192e1ant_lps_notify(btcoexist, type)
|
||||
#define ex_halbtc8192e1ant_scan_notify(btcoexist, type)
|
||||
#define ex_halbtc8192e1ant_connect_notify(btcoexist, type)
|
||||
#define ex_halbtc8192e1ant_media_status_notify(btcoexist, type)
|
||||
#define ex_halbtc8192e1ant_specific_packet_notify(btcoexist, type)
|
||||
#define ex_halbtc8192e1ant_bt_info_notify(btcoexist, tmp_buf, length)
|
||||
#define ex_halbtc8192e1ant_rf_status_notify(btcoexist, type)
|
||||
#define ex_halbtc8192e1ant_halt_notify(btcoexist)
|
||||
#define ex_halbtc8192e1ant_pnp_notify(btcoexist, pnp_state)
|
||||
#define ex_halbtc8192e1ant_coex_dm_reset(btcoexist)
|
||||
#define ex_halbtc8192e1ant_periodical(btcoexist)
|
||||
#define ex_halbtc8192e1ant_display_coex_info(btcoexist)
|
||||
#define ex_halbtc8192e1ant_dbg_control(btcoexist, op_code, op_len, pdata)
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
3949
hal/btc/HalBtc8192e2Ant.c
Normal file
3949
hal/btc/HalBtc8192e2Ant.c
Normal file
File diff suppressed because it is too large
Load diff
190
hal/btc/HalBtc8192e2Ant.h
Normal file
190
hal/btc/HalBtc8192e2Ant.h
Normal file
|
|
@ -0,0 +1,190 @@
|
|||
|
||||
#if (BT_SUPPORT == 1 && COEX_SUPPORT == 1)
|
||||
|
||||
#if (RTL8192E_SUPPORT == 1)
|
||||
/* *******************************************
|
||||
* The following is for 8192E 2Ant BT Co-exist definition
|
||||
* ******************************************* */
|
||||
#define BT_AUTO_REPORT_ONLY_8192E_2ANT 0
|
||||
|
||||
#define BT_INFO_8192E_2ANT_B_FTP BIT(7)
|
||||
#define BT_INFO_8192E_2ANT_B_A2DP BIT(6)
|
||||
#define BT_INFO_8192E_2ANT_B_HID BIT(5)
|
||||
#define BT_INFO_8192E_2ANT_B_SCO_BUSY BIT(4)
|
||||
#define BT_INFO_8192E_2ANT_B_ACL_BUSY BIT(3)
|
||||
#define BT_INFO_8192E_2ANT_B_INQ_PAGE BIT(2)
|
||||
#define BT_INFO_8192E_2ANT_B_SCO_ESCO BIT(1)
|
||||
#define BT_INFO_8192E_2ANT_B_CONNECTION BIT(0)
|
||||
|
||||
#define BTC_RSSI_COEX_THRESH_TOL_8192E_2ANT 2
|
||||
|
||||
enum bt_info_src_8192e_2ant {
|
||||
BT_INFO_SRC_8192E_2ANT_WIFI_FW = 0x0,
|
||||
BT_INFO_SRC_8192E_2ANT_BT_RSP = 0x1,
|
||||
BT_INFO_SRC_8192E_2ANT_BT_ACTIVE_SEND = 0x2,
|
||||
BT_INFO_SRC_8192E_2ANT_MAX
|
||||
};
|
||||
|
||||
enum bt_8192e_2ant_bt_status {
|
||||
BT_8192E_2ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0,
|
||||
BT_8192E_2ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
|
||||
BT_8192E_2ANT_BT_STATUS_INQ_PAGE = 0x2,
|
||||
BT_8192E_2ANT_BT_STATUS_ACL_BUSY = 0x3,
|
||||
BT_8192E_2ANT_BT_STATUS_SCO_BUSY = 0x4,
|
||||
BT_8192E_2ANT_BT_STATUS_ACL_SCO_BUSY = 0x5,
|
||||
BT_8192E_2ANT_BT_STATUS_MAX
|
||||
};
|
||||
|
||||
enum bt_8192e_2ant_coex_algo {
|
||||
BT_8192E_2ANT_COEX_ALGO_UNDEFINED = 0x0,
|
||||
BT_8192E_2ANT_COEX_ALGO_SCO = 0x1,
|
||||
BT_8192E_2ANT_COEX_ALGO_SCO_PAN = 0x2,
|
||||
BT_8192E_2ANT_COEX_ALGO_HID = 0x3,
|
||||
BT_8192E_2ANT_COEX_ALGO_A2DP = 0x4,
|
||||
BT_8192E_2ANT_COEX_ALGO_A2DP_PANHS = 0x5,
|
||||
BT_8192E_2ANT_COEX_ALGO_PANEDR = 0x6,
|
||||
BT_8192E_2ANT_COEX_ALGO_PANHS = 0x7,
|
||||
BT_8192E_2ANT_COEX_ALGO_PANEDR_A2DP = 0x8,
|
||||
BT_8192E_2ANT_COEX_ALGO_PANEDR_HID = 0x9,
|
||||
BT_8192E_2ANT_COEX_ALGO_HID_A2DP_PANEDR = 0xa,
|
||||
BT_8192E_2ANT_COEX_ALGO_HID_A2DP = 0xb,
|
||||
BT_8192E_2ANT_COEX_ALGO_MAX = 0xc
|
||||
};
|
||||
|
||||
struct coex_dm_8192e_2ant {
|
||||
/* fw mechanism */
|
||||
u8 pre_bt_dec_pwr_lvl;
|
||||
u8 cur_bt_dec_pwr_lvl;
|
||||
u8 pre_fw_dac_swing_lvl;
|
||||
u8 cur_fw_dac_swing_lvl;
|
||||
boolean cur_ignore_wlan_act;
|
||||
boolean pre_ignore_wlan_act;
|
||||
u8 pre_ps_tdma;
|
||||
u8 cur_ps_tdma;
|
||||
u8 ps_tdma_para[5];
|
||||
u8 ps_tdma_du_adj_type;
|
||||
boolean reset_tdma_adjust;
|
||||
boolean auto_tdma_adjust;
|
||||
boolean pre_ps_tdma_on;
|
||||
boolean cur_ps_tdma_on;
|
||||
boolean pre_bt_auto_report;
|
||||
boolean cur_bt_auto_report;
|
||||
|
||||
/* sw mechanism */
|
||||
boolean pre_rf_rx_lpf_shrink;
|
||||
boolean cur_rf_rx_lpf_shrink;
|
||||
u32 bt_rf_0x1e_backup;
|
||||
boolean pre_low_penalty_ra;
|
||||
boolean cur_low_penalty_ra;
|
||||
boolean pre_dac_swing_on;
|
||||
u32 pre_dac_swing_lvl;
|
||||
boolean cur_dac_swing_on;
|
||||
u32 cur_dac_swing_lvl;
|
||||
boolean pre_adc_back_off;
|
||||
boolean cur_adc_back_off;
|
||||
boolean pre_agc_table_en;
|
||||
boolean cur_agc_table_en;
|
||||
u32 pre_val0x6c0;
|
||||
u32 cur_val0x6c0;
|
||||
u32 pre_val0x6c4;
|
||||
u32 cur_val0x6c4;
|
||||
u32 pre_val0x6c8;
|
||||
u32 cur_val0x6c8;
|
||||
u8 pre_val0x6cc;
|
||||
u8 cur_val0x6cc;
|
||||
boolean limited_dig;
|
||||
|
||||
u32 backup_arfr_cnt1; /* Auto Rate Fallback Retry cnt */
|
||||
u32 backup_arfr_cnt2; /* Auto Rate Fallback Retry cnt */
|
||||
u16 backup_retry_limit;
|
||||
u8 backup_ampdu_max_time;
|
||||
|
||||
/* algorithm related */
|
||||
u8 pre_algorithm;
|
||||
u8 cur_algorithm;
|
||||
u8 bt_status;
|
||||
u8 wifi_chnl_info[3];
|
||||
|
||||
u8 pre_ss_type;
|
||||
u8 cur_ss_type;
|
||||
|
||||
u32 pre_ra_mask;
|
||||
u32 cur_ra_mask;
|
||||
u8 cur_ra_mask_type;
|
||||
u8 pre_arfr_type;
|
||||
u8 cur_arfr_type;
|
||||
u8 pre_retry_limit_type;
|
||||
u8 cur_retry_limit_type;
|
||||
u8 pre_ampdu_time_type;
|
||||
u8 cur_ampdu_time_type;
|
||||
};
|
||||
|
||||
struct coex_sta_8192e_2ant {
|
||||
boolean bt_disabled;
|
||||
boolean bt_link_exist;
|
||||
boolean sco_exist;
|
||||
boolean a2dp_exist;
|
||||
boolean hid_exist;
|
||||
boolean pan_exist;
|
||||
|
||||
boolean under_lps;
|
||||
boolean under_ips;
|
||||
u32 high_priority_tx;
|
||||
u32 high_priority_rx;
|
||||
u32 low_priority_tx;
|
||||
u32 low_priority_rx;
|
||||
u8 bt_rssi;
|
||||
u8 pre_bt_rssi_state;
|
||||
u8 pre_wifi_rssi_state[4];
|
||||
boolean c2h_bt_info_req_sent;
|
||||
u8 bt_info_c2h[BT_INFO_SRC_8192E_2ANT_MAX][10];
|
||||
u32 bt_info_c2h_cnt[BT_INFO_SRC_8192E_2ANT_MAX];
|
||||
boolean c2h_bt_inquiry_page;
|
||||
u8 bt_retry_cnt;
|
||||
u8 bt_info_ext;
|
||||
};
|
||||
|
||||
/* *******************************************
|
||||
* The following is interface which will notify coex module.
|
||||
* ******************************************* */
|
||||
void ex_halbtc8192e2ant_power_on_setting(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8192e2ant_init_hw_config(IN struct btc_coexist *btcoexist,
|
||||
IN boolean wifi_only);
|
||||
void ex_halbtc8192e2ant_init_coex_dm(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8192e2ant_ips_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8192e2ant_lps_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8192e2ant_scan_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8192e2ant_connect_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8192e2ant_media_status_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8192e2ant_specific_packet_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8192e2ant_bt_info_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 *tmp_buf, IN u8 length);
|
||||
void ex_halbtc8192e2ant_halt_notify(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8192e2ant_periodical(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8192e2ant_display_coex_info(IN struct btc_coexist *btcoexist);
|
||||
|
||||
#else /* #if (RTL8192E_SUPPORT == 1) */
|
||||
#define ex_halbtc8192e2ant_power_on_setting(btcoexist)
|
||||
#define ex_halbtc8192e2ant_init_hw_config(btcoexist, wifi_only)
|
||||
#define ex_halbtc8192e2ant_init_coex_dm(btcoexist)
|
||||
#define ex_halbtc8192e2ant_ips_notify(btcoexist, type)
|
||||
#define ex_halbtc8192e2ant_lps_notify(btcoexist, type)
|
||||
#define ex_halbtc8192e2ant_scan_notify(btcoexist, type)
|
||||
#define ex_halbtc8192e2ant_connect_notify(btcoexist, type)
|
||||
#define ex_halbtc8192e2ant_media_status_notify(btcoexist, type)
|
||||
#define ex_halbtc8192e2ant_specific_packet_notify(btcoexist, type)
|
||||
#define ex_halbtc8192e2ant_bt_info_notify(btcoexist, tmp_buf, length)
|
||||
#define ex_halbtc8192e2ant_halt_notify(btcoexist)
|
||||
#define ex_halbtc8192e2ant_periodical(btcoexist)
|
||||
#define ex_halbtc8192e2ant_display_coex_info(btcoexist)
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
4623
hal/btc/HalBtc8703b1Ant.c
Normal file
4623
hal/btc/HalBtc8703b1Ant.c
Normal file
File diff suppressed because it is too large
Load diff
343
hal/btc/HalBtc8703b1Ant.h
Normal file
343
hal/btc/HalBtc8703b1Ant.h
Normal file
|
|
@ -0,0 +1,343 @@
|
|||
|
||||
#if (BT_SUPPORT == 1 && COEX_SUPPORT == 1)
|
||||
|
||||
#if (RTL8703B_SUPPORT == 1)
|
||||
/* *******************************************
|
||||
* The following is for 8703B 1ANT BT Co-exist definition
|
||||
* ******************************************* */
|
||||
#define BT_AUTO_REPORT_ONLY_8703B_1ANT 1
|
||||
#define BT_8703B_1ANT_ENABLE_GNTBT_TO_GPIO14 0
|
||||
|
||||
#define BT_INFO_8703B_1ANT_B_FTP BIT(7)
|
||||
#define BT_INFO_8703B_1ANT_B_A2DP BIT(6)
|
||||
#define BT_INFO_8703B_1ANT_B_HID BIT(5)
|
||||
#define BT_INFO_8703B_1ANT_B_SCO_BUSY BIT(4)
|
||||
#define BT_INFO_8703B_1ANT_B_ACL_BUSY BIT(3)
|
||||
#define BT_INFO_8703B_1ANT_B_INQ_PAGE BIT(2)
|
||||
#define BT_INFO_8703B_1ANT_B_SCO_ESCO BIT(1)
|
||||
#define BT_INFO_8703B_1ANT_B_CONNECTION BIT(0)
|
||||
|
||||
#define BT_INFO_8703B_1ANT_A2DP_BASIC_RATE(_BT_INFO_EXT_) \
|
||||
(((_BT_INFO_EXT_&BIT(0))) ? true : false)
|
||||
|
||||
#define BTC_RSSI_COEX_THRESH_TOL_8703B_1ANT 2
|
||||
|
||||
#define BT_8703B_1ANT_WIFI_NOISY_THRESH 50 /* max: 255 */
|
||||
|
||||
/* for Antenna detection */
|
||||
#define BT_8703B_1ANT_ANTDET_PSDTHRES_BACKGROUND 50
|
||||
#define BT_8703B_1ANT_ANTDET_PSDTHRES_2ANT_BADISOLATION 70
|
||||
#define BT_8703B_1ANT_ANTDET_PSDTHRES_2ANT_GOODISOLATION 55
|
||||
#define BT_8703B_1ANT_ANTDET_PSDTHRES_1ANT 35
|
||||
#define BT_8703B_1ANT_ANTDET_RETRY_INTERVAL 10 /* retry timer if ant det is fail, unit: second */
|
||||
#define BT_8703B_1ANT_ANTDET_ENABLE 0
|
||||
#define BT_8703B_1ANT_ANTDET_COEXMECHANISMSWITCH_ENABLE 0
|
||||
|
||||
#define BT_8703B_1ANT_LTECOEX_INDIRECTREG_ACCESS_TIMEOUT 30000
|
||||
|
||||
enum bt_8703b_1ant_signal_state {
|
||||
BT_8703B_1ANT_SIG_STA_SET_TO_LOW = 0x0,
|
||||
BT_8703B_1ANT_SIG_STA_SET_BY_HW = 0x0,
|
||||
BT_8703B_1ANT_SIG_STA_SET_TO_HIGH = 0x1,
|
||||
BT_8703B_1ANT_SIG_STA_MAX
|
||||
};
|
||||
|
||||
enum bt_8703b_1ant_path_ctrl_owner {
|
||||
BT_8703B_1ANT_PCO_BTSIDE = 0x0,
|
||||
BT_8703B_1ANT_PCO_WLSIDE = 0x1,
|
||||
BT_8703B_1ANT_PCO_MAX
|
||||
};
|
||||
|
||||
enum bt_8703b_1ant_gnt_ctrl_type {
|
||||
BT_8703B_1ANT_GNT_TYPE_CTRL_BY_PTA = 0x0,
|
||||
BT_8703B_1ANT_GNT_TYPE_CTRL_BY_SW = 0x1,
|
||||
BT_8703B_1ANT_GNT_TYPE_MAX
|
||||
};
|
||||
|
||||
enum bt_8703b_1ant_gnt_ctrl_block {
|
||||
BT_8703B_1ANT_GNT_BLOCK_RFC_BB = 0x0,
|
||||
BT_8703B_1ANT_GNT_BLOCK_RFC = 0x1,
|
||||
BT_8703B_1ANT_GNT_BLOCK_BB = 0x2,
|
||||
BT_8703B_1ANT_GNT_BLOCK_MAX
|
||||
};
|
||||
|
||||
enum bt_8703b_1ant_lte_coex_table_type {
|
||||
BT_8703B_1ANT_CTT_WL_VS_LTE = 0x0,
|
||||
BT_8703B_1ANT_CTT_BT_VS_LTE = 0x1,
|
||||
BT_8703B_1ANT_CTT_MAX
|
||||
};
|
||||
|
||||
enum bt_8703b_1ant_lte_break_table_type {
|
||||
BT_8703B_1ANT_LBTT_WL_BREAK_LTE = 0x0,
|
||||
BT_8703B_1ANT_LBTT_BT_BREAK_LTE = 0x1,
|
||||
BT_8703B_1ANT_LBTT_LTE_BREAK_WL = 0x2,
|
||||
BT_8703B_1ANT_LBTT_LTE_BREAK_BT = 0x3,
|
||||
BT_8703B_1ANT_LBTT_MAX
|
||||
};
|
||||
|
||||
enum bt_info_src_8703b_1ant {
|
||||
BT_INFO_SRC_8703B_1ANT_WIFI_FW = 0x0,
|
||||
BT_INFO_SRC_8703B_1ANT_BT_RSP = 0x1,
|
||||
BT_INFO_SRC_8703B_1ANT_BT_ACTIVE_SEND = 0x2,
|
||||
BT_INFO_SRC_8703B_1ANT_MAX
|
||||
};
|
||||
|
||||
enum bt_8703b_1ant_bt_status {
|
||||
BT_8703B_1ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0,
|
||||
BT_8703B_1ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
|
||||
BT_8703B_1ANT_BT_STATUS_INQ_PAGE = 0x2,
|
||||
BT_8703B_1ANT_BT_STATUS_ACL_BUSY = 0x3,
|
||||
BT_8703B_1ANT_BT_STATUS_SCO_BUSY = 0x4,
|
||||
BT_8703B_1ANT_BT_STATUS_ACL_SCO_BUSY = 0x5,
|
||||
BT_8703B_1ANT_BT_STATUS_MAX
|
||||
};
|
||||
|
||||
enum bt_8703b_1ant_wifi_status {
|
||||
BT_8703B_1ANT_WIFI_STATUS_NON_CONNECTED_IDLE = 0x0,
|
||||
BT_8703B_1ANT_WIFI_STATUS_NON_CONNECTED_ASSO_AUTH_SCAN = 0x1,
|
||||
BT_8703B_1ANT_WIFI_STATUS_CONNECTED_SCAN = 0x2,
|
||||
BT_8703B_1ANT_WIFI_STATUS_CONNECTED_SPECIFIC_PKT = 0x3,
|
||||
BT_8703B_1ANT_WIFI_STATUS_CONNECTED_IDLE = 0x4,
|
||||
BT_8703B_1ANT_WIFI_STATUS_CONNECTED_BUSY = 0x5,
|
||||
BT_8703B_1ANT_WIFI_STATUS_MAX
|
||||
};
|
||||
|
||||
enum bt_8703b_1ant_coex_algo {
|
||||
BT_8703B_1ANT_COEX_ALGO_UNDEFINED = 0x0,
|
||||
BT_8703B_1ANT_COEX_ALGO_SCO = 0x1,
|
||||
BT_8703B_1ANT_COEX_ALGO_HID = 0x2,
|
||||
BT_8703B_1ANT_COEX_ALGO_A2DP = 0x3,
|
||||
BT_8703B_1ANT_COEX_ALGO_A2DP_PANHS = 0x4,
|
||||
BT_8703B_1ANT_COEX_ALGO_PANEDR = 0x5,
|
||||
BT_8703B_1ANT_COEX_ALGO_PANHS = 0x6,
|
||||
BT_8703B_1ANT_COEX_ALGO_PANEDR_A2DP = 0x7,
|
||||
BT_8703B_1ANT_COEX_ALGO_PANEDR_HID = 0x8,
|
||||
BT_8703B_1ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x9,
|
||||
BT_8703B_1ANT_COEX_ALGO_HID_A2DP = 0xa,
|
||||
BT_8703B_1ANT_COEX_ALGO_MAX = 0xb,
|
||||
};
|
||||
|
||||
struct coex_dm_8703b_1ant {
|
||||
/* hw setting */
|
||||
u8 pre_ant_pos_type;
|
||||
u8 cur_ant_pos_type;
|
||||
/* fw mechanism */
|
||||
boolean cur_ignore_wlan_act;
|
||||
boolean pre_ignore_wlan_act;
|
||||
u8 pre_ps_tdma;
|
||||
u8 cur_ps_tdma;
|
||||
u8 ps_tdma_para[5];
|
||||
u8 ps_tdma_du_adj_type;
|
||||
boolean auto_tdma_adjust;
|
||||
boolean pre_ps_tdma_on;
|
||||
boolean cur_ps_tdma_on;
|
||||
boolean pre_bt_auto_report;
|
||||
boolean cur_bt_auto_report;
|
||||
u8 pre_lps;
|
||||
u8 cur_lps;
|
||||
u8 pre_rpwm;
|
||||
u8 cur_rpwm;
|
||||
|
||||
/* sw mechanism */
|
||||
boolean pre_low_penalty_ra;
|
||||
boolean cur_low_penalty_ra;
|
||||
u32 pre_val0x6c0;
|
||||
u32 cur_val0x6c0;
|
||||
u32 pre_val0x6c4;
|
||||
u32 cur_val0x6c4;
|
||||
u32 pre_val0x6c8;
|
||||
u32 cur_val0x6c8;
|
||||
u8 pre_val0x6cc;
|
||||
u8 cur_val0x6cc;
|
||||
boolean limited_dig;
|
||||
|
||||
u32 backup_arfr_cnt1; /* Auto Rate Fallback Retry cnt */
|
||||
u32 backup_arfr_cnt2; /* Auto Rate Fallback Retry cnt */
|
||||
u16 backup_retry_limit;
|
||||
u8 backup_ampdu_max_time;
|
||||
|
||||
/* algorithm related */
|
||||
u8 pre_algorithm;
|
||||
u8 cur_algorithm;
|
||||
u8 bt_status;
|
||||
u8 wifi_chnl_info[3];
|
||||
|
||||
u32 pre_ra_mask;
|
||||
u32 cur_ra_mask;
|
||||
u8 pre_arfr_type;
|
||||
u8 cur_arfr_type;
|
||||
u8 pre_retry_limit_type;
|
||||
u8 cur_retry_limit_type;
|
||||
u8 pre_ampdu_time_type;
|
||||
u8 cur_ampdu_time_type;
|
||||
u32 arp_cnt;
|
||||
|
||||
u8 error_condition;
|
||||
};
|
||||
|
||||
struct coex_sta_8703b_1ant {
|
||||
boolean bt_disabled;
|
||||
boolean bt_link_exist;
|
||||
boolean sco_exist;
|
||||
boolean a2dp_exist;
|
||||
boolean hid_exist;
|
||||
boolean pan_exist;
|
||||
boolean bt_hi_pri_link_exist;
|
||||
u8 num_of_profile;
|
||||
|
||||
boolean under_lps;
|
||||
boolean under_ips;
|
||||
u32 specific_pkt_period_cnt;
|
||||
u32 high_priority_tx;
|
||||
u32 high_priority_rx;
|
||||
u32 low_priority_tx;
|
||||
u32 low_priority_rx;
|
||||
s8 bt_rssi;
|
||||
boolean bt_tx_rx_mask;
|
||||
u8 pre_bt_rssi_state;
|
||||
u8 pre_wifi_rssi_state[4];
|
||||
boolean c2h_bt_info_req_sent;
|
||||
u8 bt_info_c2h[BT_INFO_SRC_8703B_1ANT_MAX][10];
|
||||
u32 bt_info_c2h_cnt[BT_INFO_SRC_8703B_1ANT_MAX];
|
||||
boolean bt_whck_test;
|
||||
boolean c2h_bt_inquiry_page;
|
||||
boolean c2h_bt_page; /* Add for win8.1 page out issue */
|
||||
boolean wifi_is_high_pri_task; /* Add for win8.1 page out issue */
|
||||
u8 bt_retry_cnt;
|
||||
u8 bt_info_ext;
|
||||
u32 pop_event_cnt;
|
||||
u8 scan_ap_num;
|
||||
|
||||
u32 crc_ok_cck;
|
||||
u32 crc_ok_11g;
|
||||
u32 crc_ok_11n;
|
||||
u32 crc_ok_11n_agg;
|
||||
|
||||
u32 crc_err_cck;
|
||||
u32 crc_err_11g;
|
||||
u32 crc_err_11n;
|
||||
u32 crc_err_11n_agg;
|
||||
|
||||
boolean cck_lock;
|
||||
boolean pre_ccklock;
|
||||
boolean cck_ever_lock;
|
||||
u8 coex_table_type;
|
||||
|
||||
boolean force_lps_on;
|
||||
u32 wrong_profile_notification;
|
||||
|
||||
boolean concurrent_rx_mode_on;
|
||||
|
||||
u16 score_board;
|
||||
};
|
||||
|
||||
#define BT_8703B_1ANT_ANTDET_PSD_POINTS 256 /* MAX:1024 */
|
||||
#define BT_8703B_1ANT_ANTDET_PSD_AVGNUM 1 /* MAX:3 */
|
||||
#define BT_8703B_1ANT_ANTDET_BUF_LEN 16
|
||||
|
||||
struct psdscan_sta_8703b_1ant {
|
||||
|
||||
u32 ant_det_bt_le_channel; /* BT LE Channel ex:2412 */
|
||||
u32 ant_det_bt_tx_time;
|
||||
u32 ant_det_pre_psdscan_peak_val;
|
||||
boolean ant_det_is_ant_det_available;
|
||||
u32 ant_det_psd_scan_peak_val;
|
||||
boolean ant_det_is_btreply_available;
|
||||
u32 ant_det_psd_scan_peak_freq;
|
||||
|
||||
u8 ant_det_result;
|
||||
u8 ant_det_peak_val[BT_8703B_1ANT_ANTDET_BUF_LEN];
|
||||
u8 ant_det_peak_freq[BT_8703B_1ANT_ANTDET_BUF_LEN];
|
||||
u32 ant_det_try_count;
|
||||
u32 ant_det_fail_count;
|
||||
u32 ant_det_inteval_count;
|
||||
u32 ant_det_thres_offset;
|
||||
|
||||
u32 real_cent_freq;
|
||||
s32 real_offset;
|
||||
u32 real_span;
|
||||
|
||||
u32 psd_band_width; /* unit: Hz */
|
||||
u32 psd_point; /* 128/256/512/1024 */
|
||||
u32 psd_report[1024]; /* unit:dB (20logx), 0~255 */
|
||||
u32 psd_report_max_hold[1024]; /* unit:dB (20logx), 0~255 */
|
||||
u32 psd_start_point;
|
||||
u32 psd_stop_point;
|
||||
u32 psd_max_value_point;
|
||||
u32 psd_max_value;
|
||||
u32 psd_start_base;
|
||||
u32 psd_avg_num; /* 1/8/16/32 */
|
||||
u32 psd_gen_count;
|
||||
boolean is_psd_running;
|
||||
boolean is_psd_show_max_only;
|
||||
};
|
||||
|
||||
/* *******************************************
|
||||
* The following is interface which will notify coex module.
|
||||
* ******************************************* */
|
||||
void ex_halbtc8703b1ant_power_on_setting(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8703b1ant_pre_load_firmware(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8703b1ant_init_hw_config(IN struct btc_coexist *btcoexist,
|
||||
IN boolean wifi_only);
|
||||
void ex_halbtc8703b1ant_init_coex_dm(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8703b1ant_ips_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8703b1ant_lps_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8703b1ant_scan_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8703b1ant_connect_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8703b1ant_media_status_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8703b1ant_specific_packet_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8703b1ant_bt_info_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 *tmp_buf, IN u8 length);
|
||||
void ex_halbtc8703b1ant_rf_status_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8703b1ant_halt_notify(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8703b1ant_pnp_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 pnp_state);
|
||||
void ex_halbtc8703b1ant_ScoreBoardStatusNotify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 *tmp_buf, IN u8 length);
|
||||
void ex_halbtc8703b1ant_coex_dm_reset(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8703b1ant_periodical(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8703b1ant_display_coex_info(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8703b1ant_antenna_detection(IN struct btc_coexist *btcoexist,
|
||||
IN u32 cent_freq, IN u32 offset, IN u32 span, IN u32 seconds);
|
||||
void ex_halbtc8703b1ant_antenna_isolation(IN struct btc_coexist *btcoexist,
|
||||
IN u32 cent_freq, IN u32 offset, IN u32 span, IN u32 seconds);
|
||||
|
||||
void ex_halbtc8703b1ant_psd_scan(IN struct btc_coexist *btcoexist,
|
||||
IN u32 cent_freq, IN u32 offset, IN u32 span, IN u32 seconds);
|
||||
void ex_halbtc8703b1ant_display_ant_detection(IN struct btc_coexist *btcoexist);
|
||||
|
||||
#else
|
||||
#define ex_halbtc8703b1ant_power_on_setting(btcoexist)
|
||||
#define ex_halbtc8703b1ant_pre_load_firmware(btcoexist)
|
||||
#define ex_halbtc8703b1ant_init_hw_config(btcoexist, wifi_only)
|
||||
#define ex_halbtc8703b1ant_init_coex_dm(btcoexist)
|
||||
#define ex_halbtc8703b1ant_ips_notify(btcoexist, type)
|
||||
#define ex_halbtc8703b1ant_lps_notify(btcoexist, type)
|
||||
#define ex_halbtc8703b1ant_scan_notify(btcoexist, type)
|
||||
#define ex_halbtc8703b1ant_connect_notify(btcoexist, type)
|
||||
#define ex_halbtc8703b1ant_media_status_notify(btcoexist, type)
|
||||
#define ex_halbtc8703b1ant_specific_packet_notify(btcoexist, type)
|
||||
#define ex_halbtc8703b1ant_bt_info_notify(btcoexist, tmp_buf, length)
|
||||
#define ex_halbtc8703b1ant_rf_status_notify(btcoexist, type)
|
||||
#define ex_halbtc8703b1ant_halt_notify(btcoexist)
|
||||
#define ex_halbtc8703b1ant_pnp_notify(btcoexist, pnp_state)
|
||||
#define ex_halbtc8703b1ant_ScoreBoardStatusNotify(btcoexist, tmp_buf, length)
|
||||
#define ex_halbtc8703b1ant_coex_dm_reset(btcoexist)
|
||||
#define ex_halbtc8703b1ant_periodical(btcoexist)
|
||||
#define ex_halbtc8703b1ant_display_coex_info(btcoexist)
|
||||
#define ex_halbtc8703b1ant_antenna_detection(btcoexist, cent_freq, offset, span, seconds)
|
||||
#define ex_halbtc8703b1ant_antenna_isolation(btcoexist, cent_freq, offset, span, seconds)
|
||||
#define ex_halbtc8703b1ant_psd_scan(btcoexist, cent_freq, offset, span, seconds)
|
||||
#define ex_halbtc8703b1ant_display_ant_detection(btcoexist)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
4864
hal/btc/HalBtc8703b2Ant.c
Normal file
4864
hal/btc/HalBtc8703b2Ant.c
Normal file
File diff suppressed because it is too large
Load diff
228
hal/btc/HalBtc8703b2Ant.h
Normal file
228
hal/btc/HalBtc8703b2Ant.h
Normal file
|
|
@ -0,0 +1,228 @@
|
|||
//===========================================
|
||||
// The following is for 8703B 2Ant BT Co-exist definition
|
||||
//===========================================
|
||||
#define BT_AUTO_REPORT_ONLY_8703B_2ANT 1
|
||||
|
||||
|
||||
#define BT_INFO_8703B_2ANT_B_FTP BIT7
|
||||
#define BT_INFO_8703B_2ANT_B_A2DP BIT6
|
||||
#define BT_INFO_8703B_2ANT_B_HID BIT5
|
||||
#define BT_INFO_8703B_2ANT_B_SCO_BUSY BIT4
|
||||
#define BT_INFO_8703B_2ANT_B_ACL_BUSY BIT3
|
||||
#define BT_INFO_8703B_2ANT_B_INQ_PAGE BIT2
|
||||
#define BT_INFO_8703B_2ANT_B_SCO_ESCO BIT1
|
||||
#define BT_INFO_8703B_2ANT_B_CONNECTION BIT0
|
||||
|
||||
#define BTC_RSSI_COEX_THRESH_TOL_8703B_2ANT 2
|
||||
|
||||
|
||||
#define BT_8703B_2ANT_WIFI_RSSI_COEXSWITCH_THRES 42 //WiFi RSSI Threshold for 2-Ant TDMA/1-Ant PS-TDMA translation
|
||||
#define BT_8703B_2ANT_BT_RSSI_COEXSWITCH_THRES 46 //BT RSSI Threshold for 2-Ant TDMA/1-Ant PS-TDMA translation
|
||||
|
||||
typedef enum _BT_INFO_SRC_8703B_2ANT{
|
||||
BT_INFO_SRC_8703B_2ANT_WIFI_FW = 0x0,
|
||||
BT_INFO_SRC_8703B_2ANT_BT_RSP = 0x1,
|
||||
BT_INFO_SRC_8703B_2ANT_BT_ACTIVE_SEND = 0x2,
|
||||
BT_INFO_SRC_8703B_2ANT_MAX
|
||||
}BT_INFO_SRC_8703B_2ANT,*PBT_INFO_SRC_8703B_2ANT;
|
||||
|
||||
typedef enum _BT_8703B_2ANT_BT_STATUS{
|
||||
BT_8703B_2ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0,
|
||||
BT_8703B_2ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
|
||||
BT_8703B_2ANT_BT_STATUS_INQ_PAGE = 0x2,
|
||||
BT_8703B_2ANT_BT_STATUS_ACL_BUSY = 0x3,
|
||||
BT_8703B_2ANT_BT_STATUS_SCO_BUSY = 0x4,
|
||||
BT_8703B_2ANT_BT_STATUS_ACL_SCO_BUSY = 0x5,
|
||||
BT_8703B_2ANT_BT_STATUS_MAX
|
||||
}BT_8703B_2ANT_BT_STATUS,*PBT_8703B_2ANT_BT_STATUS;
|
||||
|
||||
typedef enum _BT_8703B_2ANT_COEX_ALGO{
|
||||
BT_8703B_2ANT_COEX_ALGO_UNDEFINED = 0x0,
|
||||
BT_8703B_2ANT_COEX_ALGO_SCO = 0x1,
|
||||
BT_8703B_2ANT_COEX_ALGO_HID = 0x2,
|
||||
BT_8703B_2ANT_COEX_ALGO_A2DP = 0x3,
|
||||
BT_8703B_2ANT_COEX_ALGO_A2DP_PANHS = 0x4,
|
||||
BT_8703B_2ANT_COEX_ALGO_PANEDR = 0x5,
|
||||
BT_8703B_2ANT_COEX_ALGO_PANHS = 0x6,
|
||||
BT_8703B_2ANT_COEX_ALGO_PANEDR_A2DP = 0x7,
|
||||
BT_8703B_2ANT_COEX_ALGO_PANEDR_HID = 0x8,
|
||||
BT_8703B_2ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x9,
|
||||
BT_8703B_2ANT_COEX_ALGO_HID_A2DP = 0xa,
|
||||
BT_8703B_2ANT_COEX_ALGO_MAX = 0xb,
|
||||
}BT_8703B_2ANT_COEX_ALGO,*PBT_8703B_2ANT_COEX_ALGO;
|
||||
|
||||
typedef struct _COEX_DM_8703B_2ANT{
|
||||
// fw mechanism
|
||||
u1Byte preBtDecPwrLvl;
|
||||
u1Byte curBtDecPwrLvl;
|
||||
u1Byte preFwDacSwingLvl;
|
||||
u1Byte curFwDacSwingLvl;
|
||||
BOOLEAN bCurIgnoreWlanAct;
|
||||
BOOLEAN bPreIgnoreWlanAct;
|
||||
u1Byte prePsTdma;
|
||||
u1Byte curPsTdma;
|
||||
u1Byte psTdmaPara[5];
|
||||
u1Byte psTdmaDuAdjType;
|
||||
BOOLEAN bResetTdmaAdjust;
|
||||
BOOLEAN bAutoTdmaAdjust;
|
||||
BOOLEAN bPrePsTdmaOn;
|
||||
BOOLEAN bCurPsTdmaOn;
|
||||
BOOLEAN bPreBtAutoReport;
|
||||
BOOLEAN bCurBtAutoReport;
|
||||
|
||||
// sw mechanism
|
||||
BOOLEAN bPreRfRxLpfShrink;
|
||||
BOOLEAN bCurRfRxLpfShrink;
|
||||
u4Byte btRf0x1eBackup;
|
||||
BOOLEAN bPreLowPenaltyRa;
|
||||
BOOLEAN bCurLowPenaltyRa;
|
||||
BOOLEAN bPreDacSwingOn;
|
||||
u4Byte preDacSwingLvl;
|
||||
BOOLEAN bCurDacSwingOn;
|
||||
u4Byte curDacSwingLvl;
|
||||
BOOLEAN bPreAdcBackOff;
|
||||
BOOLEAN bCurAdcBackOff;
|
||||
BOOLEAN bPreAgcTableEn;
|
||||
BOOLEAN bCurAgcTableEn;
|
||||
u4Byte preVal0x6c0;
|
||||
u4Byte curVal0x6c0;
|
||||
u4Byte preVal0x6c4;
|
||||
u4Byte curVal0x6c4;
|
||||
u4Byte preVal0x6c8;
|
||||
u4Byte curVal0x6c8;
|
||||
u1Byte preVal0x6cc;
|
||||
u1Byte curVal0x6cc;
|
||||
BOOLEAN bLimitedDig;
|
||||
|
||||
// algorithm related
|
||||
u1Byte preAlgorithm;
|
||||
u1Byte curAlgorithm;
|
||||
u1Byte btStatus;
|
||||
u1Byte wifiChnlInfo[3];
|
||||
|
||||
BOOLEAN bNeedRecover0x948;
|
||||
u4Byte backup0x948;
|
||||
|
||||
u1Byte preLps;
|
||||
u1Byte curLps;
|
||||
u1Byte preRpwm;
|
||||
u1Byte curRpwm;
|
||||
|
||||
BOOLEAN bIsSwitchTo1dot5Ant;
|
||||
} COEX_DM_8703B_2ANT, *PCOEX_DM_8703B_2ANT;
|
||||
|
||||
typedef struct _COEX_STA_8703B_2ANT{
|
||||
BOOLEAN bBtLinkExist;
|
||||
BOOLEAN bScoExist;
|
||||
BOOLEAN bA2dpExist;
|
||||
BOOLEAN bHidExist;
|
||||
BOOLEAN bPanExist;
|
||||
|
||||
BOOLEAN bUnderLps;
|
||||
BOOLEAN bUnderIps;
|
||||
u4Byte highPriorityTx;
|
||||
u4Byte highPriorityRx;
|
||||
u4Byte lowPriorityTx;
|
||||
u4Byte lowPriorityRx;
|
||||
u1Byte btRssi;
|
||||
BOOLEAN bBtTxRxMask;
|
||||
u1Byte preBtRssiState;
|
||||
u1Byte preWifiRssiState[4];
|
||||
BOOLEAN bC2hBtInfoReqSent;
|
||||
u1Byte btInfoC2h[BT_INFO_SRC_8703B_2ANT_MAX][10];
|
||||
u4Byte btInfoC2hCnt[BT_INFO_SRC_8703B_2ANT_MAX];
|
||||
BOOLEAN bBtWhckTest;
|
||||
BOOLEAN bC2hBtInquiryPage;
|
||||
u1Byte btRetryCnt;
|
||||
u1Byte btInfoExt;
|
||||
|
||||
u4Byte nCRCOK_CCK;
|
||||
u4Byte nCRCOK_11g;
|
||||
u4Byte nCRCOK_11n;
|
||||
u4Byte nCRCOK_11nAgg;
|
||||
|
||||
u4Byte nCRCErr_CCK;
|
||||
u4Byte nCRCErr_11g;
|
||||
u4Byte nCRCErr_11n;
|
||||
u4Byte nCRCErr_11nAgg;
|
||||
|
||||
u1Byte nCoexTableType;
|
||||
BOOLEAN bForceLpsOn;
|
||||
|
||||
u1Byte disVerInfoCnt;
|
||||
}COEX_STA_8703B_2ANT, *PCOEX_STA_8703B_2ANT;
|
||||
|
||||
//===========================================
|
||||
// The following is interface which will notify coex module.
|
||||
//===========================================
|
||||
VOID
|
||||
EXhalbtc8703b2ant_PowerOnSetting(
|
||||
IN PBTC_COEXIST pBtCoexist
|
||||
);
|
||||
VOID
|
||||
EXhalbtc8703b2ant_PreLoadFirmware(
|
||||
IN PBTC_COEXIST pBtCoexist
|
||||
);
|
||||
VOID
|
||||
EXhalbtc8703b2ant_InitHwConfig(
|
||||
IN PBTC_COEXIST pBtCoexist,
|
||||
IN BOOLEAN bWifiOnly
|
||||
);
|
||||
VOID
|
||||
EXhalbtc8703b2ant_InitCoexDm(
|
||||
IN PBTC_COEXIST pBtCoexist
|
||||
);
|
||||
VOID
|
||||
EXhalbtc8703b2ant_IpsNotify(
|
||||
IN PBTC_COEXIST pBtCoexist,
|
||||
IN u1Byte type
|
||||
);
|
||||
VOID
|
||||
EXhalbtc8703b2ant_LpsNotify(
|
||||
IN PBTC_COEXIST pBtCoexist,
|
||||
IN u1Byte type
|
||||
);
|
||||
VOID
|
||||
EXhalbtc8703b2ant_ScanNotify(
|
||||
IN PBTC_COEXIST pBtCoexist,
|
||||
IN u1Byte type
|
||||
);
|
||||
VOID
|
||||
EXhalbtc8703b2ant_ConnectNotify(
|
||||
IN PBTC_COEXIST pBtCoexist,
|
||||
IN u1Byte type
|
||||
);
|
||||
VOID
|
||||
EXhalbtc8703b2ant_MediaStatusNotify(
|
||||
IN PBTC_COEXIST pBtCoexist,
|
||||
IN u1Byte type
|
||||
);
|
||||
VOID
|
||||
EXhalbtc8703b2ant_SpecialPacketNotify(
|
||||
IN PBTC_COEXIST pBtCoexist,
|
||||
IN u1Byte type
|
||||
);
|
||||
VOID
|
||||
EXhalbtc8703b2ant_BtInfoNotify(
|
||||
IN PBTC_COEXIST pBtCoexist,
|
||||
IN pu1Byte tmpBuf,
|
||||
IN u1Byte length
|
||||
);
|
||||
VOID
|
||||
EXhalbtc8703b2ant_HaltNotify(
|
||||
IN PBTC_COEXIST pBtCoexist
|
||||
);
|
||||
VOID
|
||||
EXhalbtc8703b2ant_PnpNotify(
|
||||
IN PBTC_COEXIST pBtCoexist,
|
||||
IN u1Byte pnpState
|
||||
);
|
||||
VOID
|
||||
EXhalbtc8703b2ant_Periodical(
|
||||
IN PBTC_COEXIST pBtCoexist
|
||||
);
|
||||
VOID
|
||||
EXhalbtc8703b2ant_DisplayCoexInfo(
|
||||
IN PBTC_COEXIST pBtCoexist
|
||||
);
|
||||
|
||||
1544
hal/btc/HalBtc8723a1Ant.c
Normal file
1544
hal/btc/HalBtc8723a1Ant.c
Normal file
File diff suppressed because it is too large
Load diff
171
hal/btc/HalBtc8723a1Ant.h
Normal file
171
hal/btc/HalBtc8723a1Ant.h
Normal file
|
|
@ -0,0 +1,171 @@
|
|||
//===========================================
|
||||
// The following is for 8723A 1Ant BT Co-exist definition
|
||||
//===========================================
|
||||
#define BT_INFO_8723A_1ANT_B_FTP BIT7
|
||||
#define BT_INFO_8723A_1ANT_B_A2DP BIT6
|
||||
#define BT_INFO_8723A_1ANT_B_HID BIT5
|
||||
#define BT_INFO_8723A_1ANT_B_SCO_BUSY BIT4
|
||||
#define BT_INFO_8723A_1ANT_B_ACL_BUSY BIT3
|
||||
#define BT_INFO_8723A_1ANT_B_INQ_PAGE BIT2
|
||||
#define BT_INFO_8723A_1ANT_B_SCO_ESCO BIT1
|
||||
#define BT_INFO_8723A_1ANT_B_CONNECTION BIT0
|
||||
|
||||
typedef enum _BT_STATE_8723A_1ANT{
|
||||
BT_STATE_8723A_1ANT_DISABLED = 0,
|
||||
BT_STATE_8723A_1ANT_NO_CONNECTION = 1,
|
||||
BT_STATE_8723A_1ANT_CONNECT_IDLE = 2,
|
||||
BT_STATE_8723A_1ANT_INQ_OR_PAG = 3,
|
||||
BT_STATE_8723A_1ANT_ACL_ONLY_BUSY = 4,
|
||||
BT_STATE_8723A_1ANT_SCO_ONLY_BUSY = 5,
|
||||
BT_STATE_8723A_1ANT_ACL_SCO_BUSY = 6,
|
||||
BT_STATE_8723A_1ANT_HID_BUSY = 7,
|
||||
BT_STATE_8723A_1ANT_HID_SCO_BUSY = 8,
|
||||
BT_STATE_8723A_1ANT_MAX
|
||||
}BT_STATE_8723A_1ANT, *PBT_STATE_8723A_1ANT;
|
||||
|
||||
#define BTC_RSSI_COEX_THRESH_TOL_8723A_1ANT 2
|
||||
|
||||
typedef enum _BT_INFO_SRC_8723A_1ANT{
|
||||
BT_INFO_SRC_8723A_1ANT_WIFI_FW = 0x0,
|
||||
BT_INFO_SRC_8723A_1ANT_BT_RSP = 0x1,
|
||||
BT_INFO_SRC_8723A_1ANT_BT_ACTIVE_SEND = 0x2,
|
||||
BT_INFO_SRC_8723A_1ANT_MAX
|
||||
}BT_INFO_SRC_8723A_1ANT,*PBT_INFO_SRC_8723A_1ANT;
|
||||
|
||||
typedef enum _BT_8723A_1ANT_BT_STATUS{
|
||||
BT_8723A_1ANT_BT_STATUS_IDLE = 0x0,
|
||||
BT_8723A_1ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
|
||||
BT_8723A_1ANT_BT_STATUS_NON_IDLE = 0x2,
|
||||
BT_8723A_1ANT_BT_STATUS_MAX
|
||||
}BT_8723A_1ANT_BT_STATUS,*PBT_8723A_1ANT_BT_STATUS;
|
||||
|
||||
typedef enum _BT_8723A_1ANT_COEX_ALGO{
|
||||
BT_8723A_1ANT_COEX_ALGO_UNDEFINED = 0x0,
|
||||
BT_8723A_1ANT_COEX_ALGO_SCO = 0x1,
|
||||
BT_8723A_1ANT_COEX_ALGO_HID = 0x2,
|
||||
BT_8723A_1ANT_COEX_ALGO_A2DP = 0x3,
|
||||
BT_8723A_1ANT_COEX_ALGO_PANEDR = 0x4,
|
||||
BT_8723A_1ANT_COEX_ALGO_PANHS = 0x5,
|
||||
BT_8723A_1ANT_COEX_ALGO_PANEDR_A2DP = 0x6,
|
||||
BT_8723A_1ANT_COEX_ALGO_PANEDR_HID = 0x7,
|
||||
BT_8723A_1ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x8,
|
||||
BT_8723A_1ANT_COEX_ALGO_HID_A2DP = 0x9,
|
||||
BT_8723A_1ANT_COEX_ALGO_MAX
|
||||
}BT_8723A_1ANT_COEX_ALGO,*PBT_8723A_1ANT_COEX_ALGO;
|
||||
|
||||
typedef struct _COEX_DM_8723A_1ANT{
|
||||
// fw mechanism
|
||||
BOOLEAN bCurIgnoreWlanAct;
|
||||
BOOLEAN bPreIgnoreWlanAct;
|
||||
u1Byte prePsTdma;
|
||||
u1Byte curPsTdma;
|
||||
u1Byte psTdmaPara[5];
|
||||
u1Byte psTdmaDuAdjType;
|
||||
u4Byte psTdmaMonitorCnt;
|
||||
u4Byte psTdmaGlobalCnt;
|
||||
BOOLEAN bResetTdmaAdjust;
|
||||
BOOLEAN bPrePsTdmaOn;
|
||||
BOOLEAN bCurPsTdmaOn;
|
||||
|
||||
// sw mechanism
|
||||
BOOLEAN bPreRfRxLpfShrink;
|
||||
BOOLEAN bCurRfRxLpfShrink;
|
||||
u4Byte btRf0x1eBackup;
|
||||
BOOLEAN bPreLowPenaltyRa;
|
||||
BOOLEAN bCurLowPenaltyRa;
|
||||
u4Byte preVal0x6c0;
|
||||
u4Byte curVal0x6c0;
|
||||
u4Byte preVal0x6c8;
|
||||
u4Byte curVal0x6c8;
|
||||
u1Byte preVal0x6cc;
|
||||
u1Byte curVal0x6cc;
|
||||
BOOLEAN bLimitedDig;
|
||||
|
||||
// algorithm related
|
||||
u1Byte preAlgorithm;
|
||||
u1Byte curAlgorithm;
|
||||
u1Byte btStatus;
|
||||
u1Byte wifiChnlInfo[3];
|
||||
} COEX_DM_8723A_1ANT, *PCOEX_DM_8723A_1ANT;
|
||||
|
||||
typedef struct _COEX_STA_8723A_1ANT{
|
||||
u4Byte highPriorityTx;
|
||||
u4Byte highPriorityRx;
|
||||
u4Byte lowPriorityTx;
|
||||
u4Byte lowPriorityRx;
|
||||
u1Byte btRssi;
|
||||
u1Byte preBtRssiState;
|
||||
u1Byte preBtRssiState1;
|
||||
u1Byte preWifiRssiState[4];
|
||||
BOOLEAN bC2hBtInfoReqSent;
|
||||
u1Byte btInfoC2h[BT_INFO_SRC_8723A_1ANT_MAX][10];
|
||||
u4Byte btInfoC2hCnt[BT_INFO_SRC_8723A_1ANT_MAX];
|
||||
BOOLEAN bC2hBtInquiryPage;
|
||||
u1Byte btRetryCnt;
|
||||
u1Byte btInfoExt;
|
||||
//BOOLEAN bHoldForStackOperation;
|
||||
//u1Byte bHoldPeriodCnt;
|
||||
// this is for c2h hang work-around
|
||||
u4Byte c2hHangDetectCnt;
|
||||
}COEX_STA_8723A_1ANT, *PCOEX_STA_8723A_1ANT;
|
||||
|
||||
//===========================================
|
||||
// The following is interface which will notify coex module.
|
||||
//===========================================
|
||||
VOID
|
||||
EXhalbtc8723a1ant_InitHwConfig(
|
||||
IN PBTC_COEXIST pBtCoexist
|
||||
);
|
||||
VOID
|
||||
EXhalbtc8723a1ant_InitCoexDm(
|
||||
IN PBTC_COEXIST pBtCoexist
|
||||
);
|
||||
VOID
|
||||
EXhalbtc8723a1ant_IpsNotify(
|
||||
IN PBTC_COEXIST pBtCoexist,
|
||||
IN u1Byte type
|
||||
);
|
||||
VOID
|
||||
EXhalbtc8723a1ant_LpsNotify(
|
||||
IN PBTC_COEXIST pBtCoexist,
|
||||
IN u1Byte type
|
||||
);
|
||||
VOID
|
||||
EXhalbtc8723a1ant_ScanNotify(
|
||||
IN PBTC_COEXIST pBtCoexist,
|
||||
IN u1Byte type
|
||||
);
|
||||
VOID
|
||||
EXhalbtc8723a1ant_ConnectNotify(
|
||||
IN PBTC_COEXIST pBtCoexist,
|
||||
IN u1Byte type
|
||||
);
|
||||
VOID
|
||||
EXhalbtc8723a1ant_MediaStatusNotify(
|
||||
IN PBTC_COEXIST pBtCoexist,
|
||||
IN u1Byte type
|
||||
);
|
||||
VOID
|
||||
EXhalbtc8723a1ant_SpecialPacketNotify(
|
||||
IN PBTC_COEXIST pBtCoexist,
|
||||
IN u1Byte type
|
||||
);
|
||||
VOID
|
||||
EXhalbtc8723a1ant_BtInfoNotify(
|
||||
IN PBTC_COEXIST pBtCoexist,
|
||||
IN pu1Byte tmpBuf,
|
||||
IN u1Byte length
|
||||
);
|
||||
VOID
|
||||
EXhalbtc8723a1ant_HaltNotify(
|
||||
IN PBTC_COEXIST pBtCoexist
|
||||
);
|
||||
VOID
|
||||
EXhalbtc8723a1ant_Periodical(
|
||||
IN PBTC_COEXIST pBtCoexist
|
||||
);
|
||||
VOID
|
||||
EXhalbtc8723a1ant_DisplayCoexInfo(
|
||||
IN PBTC_COEXIST pBtCoexist
|
||||
);
|
||||
|
||||
3746
hal/btc/HalBtc8723a2Ant.c
Normal file
3746
hal/btc/HalBtc8723a2Ant.c
Normal file
File diff suppressed because it is too large
Load diff
184
hal/btc/HalBtc8723a2Ant.h
Normal file
184
hal/btc/HalBtc8723a2Ant.h
Normal file
|
|
@ -0,0 +1,184 @@
|
|||
//===========================================
|
||||
// The following is for 8723A 2Ant BT Co-exist definition
|
||||
//===========================================
|
||||
#define BT_INFO_8723A_2ANT_B_FTP BIT7
|
||||
#define BT_INFO_8723A_2ANT_B_A2DP BIT6
|
||||
#define BT_INFO_8723A_2ANT_B_HID BIT5
|
||||
#define BT_INFO_8723A_2ANT_B_SCO_BUSY BIT4
|
||||
#define BT_INFO_8723A_2ANT_B_ACL_BUSY BIT3
|
||||
#define BT_INFO_8723A_2ANT_B_INQ_PAGE BIT2
|
||||
#define BT_INFO_8723A_2ANT_B_SCO_ESCO BIT1
|
||||
#define BT_INFO_8723A_2ANT_B_CONNECTION BIT0
|
||||
|
||||
#define BTC_RSSI_COEX_THRESH_TOL_8723A_2ANT 2
|
||||
|
||||
typedef enum _BT_INFO_SRC_8723A_2ANT{
|
||||
BT_INFO_SRC_8723A_2ANT_WIFI_FW = 0x0,
|
||||
BT_INFO_SRC_8723A_2ANT_BT_RSP = 0x1,
|
||||
BT_INFO_SRC_8723A_2ANT_BT_ACTIVE_SEND = 0x2,
|
||||
BT_INFO_SRC_8723A_2ANT_MAX
|
||||
}BT_INFO_SRC_8723A_2ANT,*PBT_INFO_SRC_8723A_2ANT;
|
||||
|
||||
typedef enum _BT_8723A_2ANT_BT_STATUS{
|
||||
BT_8723A_2ANT_BT_STATUS_IDLE = 0x0,
|
||||
BT_8723A_2ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
|
||||
BT_8723A_2ANT_BT_STATUS_NON_IDLE = 0x2,
|
||||
BT_8723A_2ANT_BT_STATUS_MAX
|
||||
}BT_8723A_2ANT_BT_STATUS,*PBT_8723A_2ANT_BT_STATUS;
|
||||
|
||||
typedef enum _BT_8723A_2ANT_COEX_ALGO{
|
||||
BT_8723A_2ANT_COEX_ALGO_UNDEFINED = 0x0,
|
||||
BT_8723A_2ANT_COEX_ALGO_SCO = 0x1,
|
||||
BT_8723A_2ANT_COEX_ALGO_HID = 0x2,
|
||||
BT_8723A_2ANT_COEX_ALGO_A2DP = 0x3,
|
||||
BT_8723A_2ANT_COEX_ALGO_PANEDR = 0x4,
|
||||
BT_8723A_2ANT_COEX_ALGO_PANHS = 0x5,
|
||||
BT_8723A_2ANT_COEX_ALGO_PANEDR_A2DP = 0x6,
|
||||
BT_8723A_2ANT_COEX_ALGO_PANEDR_HID = 0x7,
|
||||
BT_8723A_2ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x8,
|
||||
BT_8723A_2ANT_COEX_ALGO_HID_A2DP = 0x9,
|
||||
BT_8723A_2ANT_COEX_ALGO_MAX
|
||||
}BT_8723A_2ANT_COEX_ALGO,*PBT_8723A_2ANT_COEX_ALGO;
|
||||
|
||||
typedef struct _COEX_DM_8723A_2ANT{
|
||||
// fw mechanism
|
||||
BOOLEAN bPreDecBtPwr;
|
||||
BOOLEAN bCurDecBtPwr;
|
||||
//BOOLEAN bPreBtLnaConstrain;
|
||||
//BOOLEAN bCurBtLnaConstrain;
|
||||
//u1Byte bPreBtPsdMode;
|
||||
//u1Byte bCurBtPsdMode;
|
||||
u1Byte preFwDacSwingLvl;
|
||||
u1Byte curFwDacSwingLvl;
|
||||
BOOLEAN bCurIgnoreWlanAct;
|
||||
BOOLEAN bPreIgnoreWlanAct;
|
||||
u1Byte prePsTdma;
|
||||
u1Byte curPsTdma;
|
||||
u1Byte psTdmaPara[5];
|
||||
u1Byte psTdmaDuAdjType;
|
||||
BOOLEAN bResetTdmaAdjust;
|
||||
BOOLEAN bPrePsTdmaOn;
|
||||
BOOLEAN bCurPsTdmaOn;
|
||||
//BOOLEAN bPreBtAutoReport;
|
||||
//BOOLEAN bCurBtAutoReport;
|
||||
|
||||
// sw mechanism
|
||||
BOOLEAN bPreRfRxLpfShrink;
|
||||
BOOLEAN bCurRfRxLpfShrink;
|
||||
u4Byte btRf0x1eBackup;
|
||||
BOOLEAN bPreLowPenaltyRa;
|
||||
BOOLEAN bCurLowPenaltyRa;
|
||||
BOOLEAN bPreDacSwingOn;
|
||||
u4Byte preDacSwingLvl;
|
||||
BOOLEAN bCurDacSwingOn;
|
||||
u4Byte curDacSwingLvl;
|
||||
BOOLEAN bPreAdcBackOff;
|
||||
BOOLEAN bCurAdcBackOff;
|
||||
BOOLEAN bPreAgcTableEn;
|
||||
BOOLEAN bCurAgcTableEn;
|
||||
u4Byte preVal0x6c0;
|
||||
u4Byte curVal0x6c0;
|
||||
u4Byte preVal0x6c8;
|
||||
u4Byte curVal0x6c8;
|
||||
u1Byte preVal0x6cc;
|
||||
u1Byte curVal0x6cc;
|
||||
BOOLEAN bLimitedDig;
|
||||
|
||||
// algorithm related
|
||||
u1Byte preAlgorithm;
|
||||
u1Byte curAlgorithm;
|
||||
u1Byte btStatus;
|
||||
u1Byte wifiChnlInfo[3];
|
||||
} COEX_DM_8723A_2ANT, *PCOEX_DM_8723A_2ANT;
|
||||
|
||||
typedef struct _COEX_STA_8723A_2ANT{
|
||||
u4Byte highPriorityTx;
|
||||
u4Byte highPriorityRx;
|
||||
u4Byte lowPriorityTx;
|
||||
u4Byte lowPriorityRx;
|
||||
u1Byte btRssi;
|
||||
u1Byte preBtRssiState;
|
||||
u1Byte preBtRssiState1;
|
||||
u1Byte preWifiRssiState[4];
|
||||
BOOLEAN bC2hBtInfoReqSent;
|
||||
u1Byte btInfoC2h[BT_INFO_SRC_8723A_2ANT_MAX][10];
|
||||
u4Byte btInfoC2hCnt[BT_INFO_SRC_8723A_2ANT_MAX];
|
||||
BOOLEAN bC2hBtInquiryPage;
|
||||
u1Byte btRetryCnt;
|
||||
u1Byte btInfoExt;
|
||||
BOOLEAN bHoldForStackOperation;
|
||||
u1Byte bHoldPeriodCnt;
|
||||
// this is for c2h hang work-around
|
||||
u4Byte c2hHangDetectCnt;
|
||||
}COEX_STA_8723A_2ANT, *PCOEX_STA_8723A_2ANT;
|
||||
|
||||
//===========================================
|
||||
// The following is interface which will notify coex module.
|
||||
//===========================================
|
||||
VOID
|
||||
EXhalbtc8723a2ant_PowerOnSetting(
|
||||
IN PBTC_COEXIST pBtCoexist
|
||||
);
|
||||
VOID
|
||||
EXhalbtc8723a2ant_InitHwConfig(
|
||||
IN PBTC_COEXIST pBtCoexist,
|
||||
IN BOOLEAN bWifiOnly
|
||||
);
|
||||
VOID
|
||||
EXhalbtc8723a2ant_InitCoexDm(
|
||||
IN PBTC_COEXIST pBtCoexist
|
||||
);
|
||||
VOID
|
||||
EXhalbtc8723a2ant_IpsNotify(
|
||||
IN PBTC_COEXIST pBtCoexist,
|
||||
IN u1Byte type
|
||||
);
|
||||
VOID
|
||||
EXhalbtc8723a2ant_LpsNotify(
|
||||
IN PBTC_COEXIST pBtCoexist,
|
||||
IN u1Byte type
|
||||
);
|
||||
VOID
|
||||
EXhalbtc8723a2ant_ScanNotify(
|
||||
IN PBTC_COEXIST pBtCoexist,
|
||||
IN u1Byte type
|
||||
);
|
||||
VOID
|
||||
EXhalbtc8723a2ant_ConnectNotify(
|
||||
IN PBTC_COEXIST pBtCoexist,
|
||||
IN u1Byte type
|
||||
);
|
||||
VOID
|
||||
EXhalbtc8723a2ant_MediaStatusNotify(
|
||||
IN PBTC_COEXIST pBtCoexist,
|
||||
IN u1Byte type
|
||||
);
|
||||
VOID
|
||||
EXhalbtc8723a2ant_SpecialPacketNotify(
|
||||
IN PBTC_COEXIST pBtCoexist,
|
||||
IN u1Byte type
|
||||
);
|
||||
VOID
|
||||
EXhalbtc8723a2ant_HaltNotify(
|
||||
IN PBTC_COEXIST pBtCoexist
|
||||
);
|
||||
VOID
|
||||
EXhalbtc8723a2ant_Periodical(
|
||||
IN PBTC_COEXIST pBtCoexist
|
||||
);
|
||||
VOID
|
||||
EXhalbtc8723a2ant_BtInfoNotify(
|
||||
IN PBTC_COEXIST pBtCoexist,
|
||||
IN pu1Byte tmpBuf,
|
||||
IN u1Byte length
|
||||
);
|
||||
VOID
|
||||
EXhalbtc8723a2ant_StackOperationNotify(
|
||||
IN PBTC_COEXIST pBtCoexist,
|
||||
IN u1Byte type
|
||||
);
|
||||
VOID
|
||||
EXhalbtc8723a2ant_DisplayCoexInfo(
|
||||
IN PBTC_COEXIST pBtCoexist
|
||||
);
|
||||
|
||||
4845
hal/btc/HalBtc8723b1Ant.c
Normal file
4845
hal/btc/HalBtc8723b1Ant.c
Normal file
File diff suppressed because it is too large
Load diff
288
hal/btc/HalBtc8723b1Ant.h
Normal file
288
hal/btc/HalBtc8723b1Ant.h
Normal file
|
|
@ -0,0 +1,288 @@
|
|||
|
||||
#if (BT_SUPPORT == 1 && COEX_SUPPORT == 1)
|
||||
|
||||
#if (RTL8723B_SUPPORT == 1)
|
||||
/* *******************************************
|
||||
* The following is for 8723B 1ANT BT Co-exist definition
|
||||
* ******************************************* */
|
||||
#define BT_AUTO_REPORT_ONLY_8723B_1ANT 1
|
||||
|
||||
#define BT_INFO_8723B_1ANT_B_FTP BIT(7)
|
||||
#define BT_INFO_8723B_1ANT_B_A2DP BIT(6)
|
||||
#define BT_INFO_8723B_1ANT_B_HID BIT(5)
|
||||
#define BT_INFO_8723B_1ANT_B_SCO_BUSY BIT(4)
|
||||
#define BT_INFO_8723B_1ANT_B_ACL_BUSY BIT(3)
|
||||
#define BT_INFO_8723B_1ANT_B_INQ_PAGE BIT(2)
|
||||
#define BT_INFO_8723B_1ANT_B_SCO_ESCO BIT(1)
|
||||
#define BT_INFO_8723B_1ANT_B_CONNECTION BIT(0)
|
||||
|
||||
#define BT_INFO_8723B_1ANT_A2DP_BASIC_RATE(_BT_INFO_EXT_) \
|
||||
(((_BT_INFO_EXT_&BIT(0))) ? true : false)
|
||||
|
||||
#define BTC_RSSI_COEX_THRESH_TOL_8723B_1ANT 2
|
||||
|
||||
#define BT_8723B_1ANT_WIFI_NOISY_THRESH 50 /* 30 //max: 255 */
|
||||
|
||||
/* for Antenna detection */
|
||||
#define BT_8723B_1ANT_ANTDET_PSDTHRES_BACKGROUND 50
|
||||
#define BT_8723B_1ANT_ANTDET_PSDTHRES_2ANT_BADISOLATION 70
|
||||
#define BT_8723B_1ANT_ANTDET_PSDTHRES_2ANT_GOODISOLATION 55
|
||||
#define BT_8723B_1ANT_ANTDET_PSDTHRES_1ANT 32
|
||||
#define BT_8723B_1ANT_ANTDET_RETRY_INTERVAL 10 /* retry timer if ant det is fail, unit: second */
|
||||
#define BT_8723B_1ANT_ANTDET_SWEEPPOINT_DELAY 40000
|
||||
#define BT_8723B_1ANT_ANTDET_ENABLE 1
|
||||
#define BT_8723B_1ANT_ANTDET_COEXMECHANISMSWITCH_ENABLE 1
|
||||
#define BT_8723B_1ANT_ANTDET_BTTXTIME 100
|
||||
#define BT_8723B_1ANT_ANTDET_BTTXCHANNEL 39
|
||||
|
||||
enum bt_info_src_8723b_1ant {
|
||||
BT_INFO_SRC_8723B_1ANT_WIFI_FW = 0x0,
|
||||
BT_INFO_SRC_8723B_1ANT_BT_RSP = 0x1,
|
||||
BT_INFO_SRC_8723B_1ANT_BT_ACTIVE_SEND = 0x2,
|
||||
BT_INFO_SRC_8723B_1ANT_MAX
|
||||
};
|
||||
|
||||
enum bt_8723b_1ant_bt_status {
|
||||
BT_8723B_1ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0,
|
||||
BT_8723B_1ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
|
||||
BT_8723B_1ANT_BT_STATUS_INQ_PAGE = 0x2,
|
||||
BT_8723B_1ANT_BT_STATUS_ACL_BUSY = 0x3,
|
||||
BT_8723B_1ANT_BT_STATUS_SCO_BUSY = 0x4,
|
||||
BT_8723B_1ANT_BT_STATUS_ACL_SCO_BUSY = 0x5,
|
||||
BT_8723B_1ANT_BT_STATUS_MAX
|
||||
};
|
||||
|
||||
enum bt_8723b_1ant_wifi_status {
|
||||
BT_8723B_1ANT_WIFI_STATUS_NON_CONNECTED_IDLE = 0x0,
|
||||
BT_8723B_1ANT_WIFI_STATUS_NON_CONNECTED_ASSO_AUTH_SCAN = 0x1,
|
||||
BT_8723B_1ANT_WIFI_STATUS_CONNECTED_SCAN = 0x2,
|
||||
BT_8723B_1ANT_WIFI_STATUS_CONNECTED_SPECIFIC_PKT = 0x3,
|
||||
BT_8723B_1ANT_WIFI_STATUS_CONNECTED_IDLE = 0x4,
|
||||
BT_8723B_1ANT_WIFI_STATUS_CONNECTED_BUSY = 0x5,
|
||||
BT_8723B_1ANT_WIFI_STATUS_MAX
|
||||
};
|
||||
|
||||
enum bt_8723b_1ant_coex_algo {
|
||||
BT_8723B_1ANT_COEX_ALGO_UNDEFINED = 0x0,
|
||||
BT_8723B_1ANT_COEX_ALGO_SCO = 0x1,
|
||||
BT_8723B_1ANT_COEX_ALGO_HID = 0x2,
|
||||
BT_8723B_1ANT_COEX_ALGO_A2DP = 0x3,
|
||||
BT_8723B_1ANT_COEX_ALGO_A2DP_PANHS = 0x4,
|
||||
BT_8723B_1ANT_COEX_ALGO_PANEDR = 0x5,
|
||||
BT_8723B_1ANT_COEX_ALGO_PANHS = 0x6,
|
||||
BT_8723B_1ANT_COEX_ALGO_PANEDR_A2DP = 0x7,
|
||||
BT_8723B_1ANT_COEX_ALGO_PANEDR_HID = 0x8,
|
||||
BT_8723B_1ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x9,
|
||||
BT_8723B_1ANT_COEX_ALGO_HID_A2DP = 0xa,
|
||||
BT_8723B_1ANT_COEX_ALGO_MAX = 0xb,
|
||||
};
|
||||
|
||||
struct coex_dm_8723b_1ant {
|
||||
/* hw setting */
|
||||
u8 pre_ant_pos_type;
|
||||
u8 cur_ant_pos_type;
|
||||
/* fw mechanism */
|
||||
boolean cur_ignore_wlan_act;
|
||||
boolean pre_ignore_wlan_act;
|
||||
u8 pre_ps_tdma;
|
||||
u8 cur_ps_tdma;
|
||||
u8 ps_tdma_para[5];
|
||||
u8 ps_tdma_du_adj_type;
|
||||
boolean auto_tdma_adjust;
|
||||
boolean pre_ps_tdma_on;
|
||||
boolean cur_ps_tdma_on;
|
||||
boolean pre_bt_auto_report;
|
||||
boolean cur_bt_auto_report;
|
||||
u8 pre_lps;
|
||||
u8 cur_lps;
|
||||
u8 pre_rpwm;
|
||||
u8 cur_rpwm;
|
||||
|
||||
/* sw mechanism */
|
||||
boolean pre_low_penalty_ra;
|
||||
boolean cur_low_penalty_ra;
|
||||
u32 pre_val0x6c0;
|
||||
u32 cur_val0x6c0;
|
||||
u32 pre_val0x6c4;
|
||||
u32 cur_val0x6c4;
|
||||
u32 pre_val0x6c8;
|
||||
u32 cur_val0x6c8;
|
||||
u8 pre_val0x6cc;
|
||||
u8 cur_val0x6cc;
|
||||
|
||||
u32 backup_arfr_cnt1; /* Auto Rate Fallback Retry cnt */
|
||||
u32 backup_arfr_cnt2; /* Auto Rate Fallback Retry cnt */
|
||||
u16 backup_retry_limit;
|
||||
u8 backup_ampdu_max_time;
|
||||
|
||||
/* algorithm related */
|
||||
u8 bt_status;
|
||||
u8 wifi_chnl_info[3];
|
||||
|
||||
u32 pre_ra_mask;
|
||||
u32 cur_ra_mask;
|
||||
u8 pre_arfr_type;
|
||||
u8 cur_arfr_type;
|
||||
u8 pre_retry_limit_type;
|
||||
u8 cur_retry_limit_type;
|
||||
u8 pre_ampdu_time_type;
|
||||
u8 cur_ampdu_time_type;
|
||||
u32 arp_cnt;
|
||||
|
||||
u8 error_condition;
|
||||
};
|
||||
|
||||
struct coex_sta_8723b_1ant {
|
||||
boolean bt_disabled;
|
||||
boolean bt_link_exist;
|
||||
boolean sco_exist;
|
||||
boolean a2dp_exist;
|
||||
boolean hid_exist;
|
||||
boolean pan_exist;
|
||||
boolean bt_hi_pri_link_exist;
|
||||
u8 num_of_profile;
|
||||
boolean bt_abnormal_scan;
|
||||
|
||||
boolean under_lps;
|
||||
boolean under_ips;
|
||||
u32 specific_pkt_period_cnt;
|
||||
u32 high_priority_tx;
|
||||
u32 high_priority_rx;
|
||||
u32 low_priority_tx;
|
||||
u32 low_priority_rx;
|
||||
s8 bt_rssi;
|
||||
boolean bt_tx_rx_mask;
|
||||
boolean c2h_bt_info_req_sent;
|
||||
u8 bt_info_c2h[BT_INFO_SRC_8723B_1ANT_MAX][10];
|
||||
u32 bt_info_c2h_cnt[BT_INFO_SRC_8723B_1ANT_MAX];
|
||||
boolean bt_whck_test;
|
||||
boolean c2h_bt_inquiry_page;
|
||||
boolean c2h_bt_remote_name_req;
|
||||
boolean wifi_is_high_pri_task; /* Add for win8.1 page out issue */
|
||||
u8 bt_retry_cnt;
|
||||
u8 bt_info_ext;
|
||||
u32 pop_event_cnt;
|
||||
u8 scan_ap_num;
|
||||
|
||||
u32 crc_ok_cck;
|
||||
u32 crc_ok_11g;
|
||||
u32 crc_ok_11n;
|
||||
u32 crc_ok_11n_agg;
|
||||
|
||||
u32 crc_err_cck;
|
||||
u32 crc_err_11g;
|
||||
u32 crc_err_11n;
|
||||
u32 crc_err_11n_agg;
|
||||
|
||||
boolean cck_lock;
|
||||
boolean pre_ccklock;
|
||||
boolean cck_ever_lock;
|
||||
u8 coex_table_type;
|
||||
|
||||
boolean force_lps_on;
|
||||
u32 wrong_profile_notification;
|
||||
|
||||
u8 a2dp_bit_pool;
|
||||
u8 cut_version;
|
||||
};
|
||||
|
||||
#define BT_8723B_1ANT_ANTDET_PSD_POINTS 256 /* MAX:1024 */
|
||||
#define BT_8723B_1ANT_ANTDET_PSD_AVGNUM 1 /* MAX:3 */
|
||||
#define BT_8723B_1ANT_ANTDET_BUF_LEN 16
|
||||
|
||||
struct psdscan_sta_8723b_1ant {
|
||||
|
||||
u32 ant_det_bt_le_channel; /* BT LE Channel ex:2412 */
|
||||
u32 ant_det_bt_tx_time;
|
||||
u32 ant_det_pre_psdscan_peak_val;
|
||||
boolean ant_det_is_ant_det_available;
|
||||
u32 ant_det_psd_scan_peak_val;
|
||||
boolean ant_det_is_btreply_available;
|
||||
u32 ant_det_psd_scan_peak_freq;
|
||||
|
||||
u8 ant_det_result;
|
||||
u8 ant_det_peak_val[BT_8723B_1ANT_ANTDET_BUF_LEN];
|
||||
u8 ant_det_peak_freq[BT_8723B_1ANT_ANTDET_BUF_LEN];
|
||||
u32 ant_det_try_count;
|
||||
u32 ant_det_fail_count;
|
||||
u32 ant_det_inteval_count;
|
||||
u32 ant_det_thres_offset;
|
||||
|
||||
u32 real_cent_freq;
|
||||
s32 real_offset;
|
||||
u32 real_span;
|
||||
|
||||
u32 psd_band_width; /* unit: Hz */
|
||||
u32 psd_point; /* 128/256/512/1024 */
|
||||
u32 psd_report[1024]; /* unit:dB (20logx), 0~255 */
|
||||
u32 psd_report_max_hold[1024]; /* unit:dB (20logx), 0~255 */
|
||||
u32 psd_start_point;
|
||||
u32 psd_stop_point;
|
||||
u32 psd_max_value_point;
|
||||
u32 psd_max_value;
|
||||
u32 psd_start_base;
|
||||
u32 psd_avg_num; /* 1/8/16/32 */
|
||||
u32 psd_gen_count;
|
||||
boolean is_psd_running;
|
||||
boolean is_psd_show_max_only;
|
||||
};
|
||||
|
||||
/* *******************************************
|
||||
* The following is interface which will notify coex module.
|
||||
* ******************************************* */
|
||||
void ex_halbtc8723b1ant_power_on_setting(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8723b1ant_pre_load_firmware(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8723b1ant_init_hw_config(IN struct btc_coexist *btcoexist,
|
||||
IN boolean wifi_only);
|
||||
void ex_halbtc8723b1ant_init_coex_dm(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8723b1ant_ips_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8723b1ant_lps_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8723b1ant_scan_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8723b1ant_connect_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8723b1ant_media_status_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8723b1ant_specific_packet_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8723b1ant_bt_info_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 *tmp_buf, IN u8 length);
|
||||
void ex_halbtc8723b1ant_rf_status_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8723b1ant_halt_notify(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8723b1ant_pnp_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 pnp_state);
|
||||
void ex_halbtc8723b1ant_coex_dm_reset(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8723b1ant_periodical(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8723b1ant_display_coex_info(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8723b1ant_antenna_detection(IN struct btc_coexist *btcoexist,
|
||||
IN u32 cent_freq, IN u32 offset, IN u32 span, IN u32 seconds);
|
||||
|
||||
void ex_halbtc8723b1ant_display_ant_detection(IN struct btc_coexist *btcoexist);
|
||||
|
||||
#else
|
||||
#define ex_halbtc8723b1ant_power_on_setting(btcoexist)
|
||||
#define ex_halbtc8723b1ant_pre_load_firmware(btcoexist)
|
||||
#define ex_halbtc8723b1ant_init_hw_config(btcoexist, wifi_only)
|
||||
#define ex_halbtc8723b1ant_init_coex_dm(btcoexist)
|
||||
#define ex_halbtc8723b1ant_ips_notify(btcoexist, type)
|
||||
#define ex_halbtc8723b1ant_lps_notify(btcoexist, type)
|
||||
#define ex_halbtc8723b1ant_scan_notify(btcoexist, type)
|
||||
#define ex_halbtc8723b1ant_connect_notify(btcoexist, type)
|
||||
#define ex_halbtc8723b1ant_media_status_notify(btcoexist, type)
|
||||
#define ex_halbtc8723b1ant_specific_packet_notify(btcoexist, type)
|
||||
#define ex_halbtc8723b1ant_bt_info_notify(btcoexist, tmp_buf, length)
|
||||
#define ex_halbtc8723b1ant_rf_status_notify(btcoexist, type)
|
||||
#define ex_halbtc8723b1ant_halt_notify(btcoexist)
|
||||
#define ex_halbtc8723b1ant_pnp_notify(btcoexist, pnp_state)
|
||||
#define ex_halbtc8723b1ant_coex_dm_reset(btcoexist)
|
||||
#define ex_halbtc8723b1ant_periodical(btcoexist)
|
||||
#define ex_halbtc8723b1ant_display_coex_info(btcoexist)
|
||||
#define ex_halbtc8723b1ant_antenna_detection(btcoexist, cent_freq, offset, span, seconds)
|
||||
#define ex_halbtc8723b1ant_display_ant_detection(btcoexist)
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
4829
hal/btc/HalBtc8723b2Ant.c
Normal file
4829
hal/btc/HalBtc8723b2Ant.c
Normal file
File diff suppressed because it is too large
Load diff
214
hal/btc/HalBtc8723b2Ant.h
Normal file
214
hal/btc/HalBtc8723b2Ant.h
Normal file
|
|
@ -0,0 +1,214 @@
|
|||
|
||||
#if (BT_SUPPORT == 1 && COEX_SUPPORT == 1)
|
||||
|
||||
#if (RTL8723B_SUPPORT == 1)
|
||||
/* *******************************************
|
||||
* The following is for 8723B 2Ant BT Co-exist definition
|
||||
* ******************************************* */
|
||||
#define BT_AUTO_REPORT_ONLY_8723B_2ANT 1
|
||||
|
||||
|
||||
#define BT_INFO_8723B_2ANT_B_FTP BIT(7)
|
||||
#define BT_INFO_8723B_2ANT_B_A2DP BIT(6)
|
||||
#define BT_INFO_8723B_2ANT_B_HID BIT(5)
|
||||
#define BT_INFO_8723B_2ANT_B_SCO_BUSY BIT(4)
|
||||
#define BT_INFO_8723B_2ANT_B_ACL_BUSY BIT(3)
|
||||
#define BT_INFO_8723B_2ANT_B_INQ_PAGE BIT(2)
|
||||
#define BT_INFO_8723B_2ANT_B_SCO_ESCO BIT(1)
|
||||
#define BT_INFO_8723B_2ANT_B_CONNECTION BIT(0)
|
||||
|
||||
#define BTC_RSSI_COEX_THRESH_TOL_8723B_2ANT 2
|
||||
|
||||
|
||||
#define BT_8723B_2ANT_WIFI_RSSI_COEXSWITCH_THRES 42 /* WiFi RSSI Threshold for 2-Ant TDMA/1-Ant PS-TDMA translation */
|
||||
#define BT_8723B_2ANT_BT_RSSI_COEXSWITCH_THRES 46 /* BT RSSI Threshold for 2-Ant TDMA/1-Ant PS-TDMA translation */
|
||||
|
||||
enum bt_info_src_8723b_2ant {
|
||||
BT_INFO_SRC_8723B_2ANT_WIFI_FW = 0x0,
|
||||
BT_INFO_SRC_8723B_2ANT_BT_RSP = 0x1,
|
||||
BT_INFO_SRC_8723B_2ANT_BT_ACTIVE_SEND = 0x2,
|
||||
BT_INFO_SRC_8723B_2ANT_MAX
|
||||
};
|
||||
|
||||
enum bt_8723b_2ant_bt_status {
|
||||
BT_8723B_2ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0,
|
||||
BT_8723B_2ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
|
||||
BT_8723B_2ANT_BT_STATUS_INQ_PAGE = 0x2,
|
||||
BT_8723B_2ANT_BT_STATUS_ACL_BUSY = 0x3,
|
||||
BT_8723B_2ANT_BT_STATUS_SCO_BUSY = 0x4,
|
||||
BT_8723B_2ANT_BT_STATUS_ACL_SCO_BUSY = 0x5,
|
||||
BT_8723B_2ANT_BT_STATUS_MAX
|
||||
};
|
||||
|
||||
enum bt_8723b_2ant_coex_algo {
|
||||
BT_8723B_2ANT_COEX_ALGO_UNDEFINED = 0x0,
|
||||
BT_8723B_2ANT_COEX_ALGO_SCO = 0x1,
|
||||
BT_8723B_2ANT_COEX_ALGO_HID = 0x2,
|
||||
BT_8723B_2ANT_COEX_ALGO_A2DP = 0x3,
|
||||
BT_8723B_2ANT_COEX_ALGO_A2DP_PANHS = 0x4,
|
||||
BT_8723B_2ANT_COEX_ALGO_PANEDR = 0x5,
|
||||
BT_8723B_2ANT_COEX_ALGO_PANHS = 0x6,
|
||||
BT_8723B_2ANT_COEX_ALGO_PANEDR_A2DP = 0x7,
|
||||
BT_8723B_2ANT_COEX_ALGO_PANEDR_HID = 0x8,
|
||||
BT_8723B_2ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x9,
|
||||
BT_8723B_2ANT_COEX_ALGO_HID_A2DP = 0xa,
|
||||
BT_8723B_2ANT_COEX_ALGO_MAX = 0xb,
|
||||
};
|
||||
|
||||
struct coex_dm_8723b_2ant {
|
||||
/* fw mechanism */
|
||||
u8 pre_bt_dec_pwr_lvl;
|
||||
u8 cur_bt_dec_pwr_lvl;
|
||||
u8 pre_fw_dac_swing_lvl;
|
||||
u8 cur_fw_dac_swing_lvl;
|
||||
boolean cur_ignore_wlan_act;
|
||||
boolean pre_ignore_wlan_act;
|
||||
u8 pre_ps_tdma;
|
||||
u8 cur_ps_tdma;
|
||||
u8 ps_tdma_para[5];
|
||||
u8 ps_tdma_du_adj_type;
|
||||
boolean reset_tdma_adjust;
|
||||
boolean auto_tdma_adjust;
|
||||
boolean pre_ps_tdma_on;
|
||||
boolean cur_ps_tdma_on;
|
||||
boolean pre_bt_auto_report;
|
||||
boolean cur_bt_auto_report;
|
||||
|
||||
/* sw mechanism */
|
||||
boolean pre_rf_rx_lpf_shrink;
|
||||
boolean cur_rf_rx_lpf_shrink;
|
||||
u32 bt_rf_0x1e_backup;
|
||||
boolean pre_low_penalty_ra;
|
||||
boolean cur_low_penalty_ra;
|
||||
boolean pre_dac_swing_on;
|
||||
u32 pre_dac_swing_lvl;
|
||||
boolean cur_dac_swing_on;
|
||||
u32 cur_dac_swing_lvl;
|
||||
boolean pre_adc_back_off;
|
||||
boolean cur_adc_back_off;
|
||||
boolean pre_agc_table_en;
|
||||
boolean cur_agc_table_en;
|
||||
u32 pre_val0x6c0;
|
||||
u32 cur_val0x6c0;
|
||||
u32 pre_val0x6c4;
|
||||
u32 cur_val0x6c4;
|
||||
u32 pre_val0x6c8;
|
||||
u32 cur_val0x6c8;
|
||||
u8 pre_val0x6cc;
|
||||
u8 cur_val0x6cc;
|
||||
boolean limited_dig;
|
||||
|
||||
/* algorithm related */
|
||||
u8 pre_algorithm;
|
||||
u8 cur_algorithm;
|
||||
u8 bt_status;
|
||||
u8 wifi_chnl_info[3];
|
||||
|
||||
boolean need_recover0x948;
|
||||
u32 backup0x948;
|
||||
|
||||
u8 pre_lps;
|
||||
u8 cur_lps;
|
||||
u8 pre_rpwm;
|
||||
u8 cur_rpwm;
|
||||
|
||||
boolean is_switch_to_1dot5_ant;
|
||||
u8 switch_thres_offset;
|
||||
};
|
||||
|
||||
struct coex_sta_8723b_2ant {
|
||||
boolean bt_disabled;
|
||||
boolean bt_link_exist;
|
||||
boolean sco_exist;
|
||||
boolean a2dp_exist;
|
||||
boolean hid_exist;
|
||||
boolean pan_exist;
|
||||
boolean bt_abnormal_scan;
|
||||
boolean under_lps;
|
||||
boolean under_ips;
|
||||
u32 high_priority_tx;
|
||||
u32 high_priority_rx;
|
||||
u32 low_priority_tx;
|
||||
u32 low_priority_rx;
|
||||
u8 bt_rssi;
|
||||
boolean bt_tx_rx_mask;
|
||||
u8 pre_bt_rssi_state;
|
||||
u8 pre_wifi_rssi_state[4];
|
||||
boolean c2h_bt_info_req_sent;
|
||||
u8 bt_info_c2h[BT_INFO_SRC_8723B_2ANT_MAX][10];
|
||||
u32 bt_info_c2h_cnt[BT_INFO_SRC_8723B_2ANT_MAX];
|
||||
boolean bt_whck_test;
|
||||
boolean c2h_bt_inquiry_page;
|
||||
boolean c2h_bt_remote_name_req;
|
||||
u8 bt_retry_cnt;
|
||||
u8 bt_info_ext;
|
||||
u32 pop_event_cnt;
|
||||
u8 scan_ap_num;
|
||||
|
||||
u32 crc_ok_cck;
|
||||
u32 crc_ok_11g;
|
||||
u32 crc_ok_11n;
|
||||
u32 crc_ok_11n_agg;
|
||||
|
||||
u32 crc_err_cck;
|
||||
u32 crc_err_11g;
|
||||
u32 crc_err_11n;
|
||||
u32 crc_err_11n_agg;
|
||||
|
||||
u8 coex_table_type;
|
||||
boolean force_lps_on;
|
||||
|
||||
u8 dis_ver_info_cnt;
|
||||
|
||||
u8 a2dp_bit_pool;
|
||||
u8 cut_version;
|
||||
};
|
||||
|
||||
/* *******************************************
|
||||
* The following is interface which will notify coex module.
|
||||
* ******************************************* */
|
||||
void ex_halbtc8723b2ant_power_on_setting(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8723b2ant_pre_load_firmware(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8723b2ant_init_hw_config(IN struct btc_coexist *btcoexist,
|
||||
IN boolean wifi_only);
|
||||
void ex_halbtc8723b2ant_init_coex_dm(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8723b2ant_ips_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8723b2ant_lps_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8723b2ant_scan_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8723b2ant_connect_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8723b2ant_media_status_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8723b2ant_specific_packet_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8723b2ant_bt_info_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 *tmp_buf, IN u8 length);
|
||||
void ex_halbtc8723b2ant_halt_notify(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8723b2ant_pnp_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 pnp_state);
|
||||
void ex_halbtc8723b2ant_periodical(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8723b2ant_display_coex_info(IN struct btc_coexist *btcoexist);
|
||||
|
||||
#else
|
||||
#define ex_halbtc8723b2ant_power_on_setting(btcoexist)
|
||||
#define ex_halbtc8723b2ant_pre_load_firmware(btcoexist)
|
||||
#define ex_halbtc8723b2ant_init_hw_config(btcoexist, wifi_only)
|
||||
#define ex_halbtc8723b2ant_init_coex_dm(btcoexist)
|
||||
#define ex_halbtc8723b2ant_ips_notify(btcoexist, type)
|
||||
#define ex_halbtc8723b2ant_lps_notify(btcoexist, type)
|
||||
#define ex_halbtc8723b2ant_scan_notify(btcoexist, type)
|
||||
#define ex_halbtc8723b2ant_connect_notify(btcoexist, type)
|
||||
#define ex_halbtc8723b2ant_media_status_notify(btcoexist, type)
|
||||
#define ex_halbtc8723b2ant_specific_packet_notify(btcoexist, type)
|
||||
#define ex_halbtc8723b2ant_bt_info_notify(btcoexist, tmp_buf, length)
|
||||
#define ex_halbtc8723b2ant_halt_notify(btcoexist)
|
||||
#define ex_halbtc8723b2ant_pnp_notify(btcoexist, pnp_state)
|
||||
#define ex_halbtc8723b2ant_periodical(btcoexist)
|
||||
#define ex_halbtc8723b2ant_display_coex_info(btcoexist)
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
3457
hal/btc/HalBtc8812a1Ant.c
Normal file
3457
hal/btc/HalBtc8812a1Ant.c
Normal file
File diff suppressed because it is too large
Load diff
230
hal/btc/HalBtc8812a1Ant.h
Normal file
230
hal/btc/HalBtc8812a1Ant.h
Normal file
|
|
@ -0,0 +1,230 @@
|
|||
|
||||
#if (BT_SUPPORT == 1 && COEX_SUPPORT == 1)
|
||||
|
||||
#if (RTL8812A_SUPPORT == 1)
|
||||
|
||||
/* *******************************************
|
||||
* The following is for 8812A 1ANT BT Co-exist definition
|
||||
* ******************************************* */
|
||||
#define BT_AUTO_REPORT_ONLY_8812A_1ANT 1
|
||||
|
||||
#define BT_INFO_8812A_1ANT_B_FTP BIT(7)
|
||||
#define BT_INFO_8812A_1ANT_B_A2DP BIT(6)
|
||||
#define BT_INFO_8812A_1ANT_B_HID BIT(5)
|
||||
#define BT_INFO_8812A_1ANT_B_SCO_BUSY BIT(4)
|
||||
#define BT_INFO_8812A_1ANT_B_ACL_BUSY BIT(3)
|
||||
#define BT_INFO_8812A_1ANT_B_INQ_PAGE BIT(2)
|
||||
#define BT_INFO_8812A_1ANT_B_SCO_ESCO BIT(1)
|
||||
#define BT_INFO_8812A_1ANT_B_CONNECTION BIT(0)
|
||||
|
||||
#define BT_INFO_8812A_1ANT_A2DP_BASIC_RATE(_BT_INFO_EXT_) \
|
||||
(((_BT_INFO_EXT_&BIT(0))) ? true : false)
|
||||
|
||||
#define BTC_RSSI_COEX_THRESH_TOL_8812A_1ANT 2
|
||||
|
||||
#define BT_8812A_1ANT_WIFI_NOISY_THRESH 30 /* max: 255 */
|
||||
|
||||
enum bt_info_src_8812a_1ant {
|
||||
BT_INFO_SRC_8812A_1ANT_WIFI_FW = 0x0,
|
||||
BT_INFO_SRC_8812A_1ANT_BT_RSP = 0x1,
|
||||
BT_INFO_SRC_8812A_1ANT_BT_ACTIVE_SEND = 0x2,
|
||||
BT_INFO_SRC_8812A_1ANT_MAX
|
||||
};
|
||||
|
||||
enum bt_8812a_1ant_bt_status {
|
||||
BT_8812A_1ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0,
|
||||
BT_8812A_1ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
|
||||
BT_8812A_1ANT_BT_STATUS_INQ_PAGE = 0x2,
|
||||
BT_8812A_1ANT_BT_STATUS_ACL_BUSY = 0x3,
|
||||
BT_8812A_1ANT_BT_STATUS_SCO_BUSY = 0x4,
|
||||
BT_8812A_1ANT_BT_STATUS_ACL_SCO_BUSY = 0x5,
|
||||
BT_8812A_1ANT_BT_STATUS_MAX
|
||||
};
|
||||
|
||||
enum bt_8812a_1ant_wifi_status {
|
||||
BT_8812A_1ANT_WIFI_STATUS_NON_CONNECTED_IDLE = 0x0,
|
||||
BT_8812A_1ANT_WIFI_STATUS_NON_CONNECTED_ASSO_AUTH_SCAN = 0x1,
|
||||
BT_8812A_1ANT_WIFI_STATUS_CONNECTED_SCAN = 0x2,
|
||||
BT_8812A_1ANT_WIFI_STATUS_CONNECTED_SPECIFIC_PKT = 0x3,
|
||||
BT_8812A_1ANT_WIFI_STATUS_CONNECTED_IDLE = 0x4,
|
||||
BT_8812A_1ANT_WIFI_STATUS_CONNECTED_BUSY = 0x5,
|
||||
BT_8812A_1ANT_WIFI_STATUS_MAX
|
||||
};
|
||||
|
||||
enum bt_8812a_1ant_coex_algo {
|
||||
BT_8812A_1ANT_COEX_ALGO_UNDEFINED = 0x0,
|
||||
BT_8812A_1ANT_COEX_ALGO_SCO = 0x1,
|
||||
BT_8812A_1ANT_COEX_ALGO_HID = 0x2,
|
||||
BT_8812A_1ANT_COEX_ALGO_A2DP = 0x3,
|
||||
BT_8812A_1ANT_COEX_ALGO_A2DP_PANHS = 0x4,
|
||||
BT_8812A_1ANT_COEX_ALGO_PANEDR = 0x5,
|
||||
BT_8812A_1ANT_COEX_ALGO_PANHS = 0x6,
|
||||
BT_8812A_1ANT_COEX_ALGO_PANEDR_A2DP = 0x7,
|
||||
BT_8812A_1ANT_COEX_ALGO_PANEDR_HID = 0x8,
|
||||
BT_8812A_1ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x9,
|
||||
BT_8812A_1ANT_COEX_ALGO_HID_A2DP = 0xa,
|
||||
BT_8812A_1ANT_COEX_ALGO_MAX = 0xb,
|
||||
};
|
||||
|
||||
struct coex_dm_8812a_1ant {
|
||||
/* hw setting */
|
||||
u8 pre_ant_pos_type;
|
||||
u8 cur_ant_pos_type;
|
||||
/* fw mechanism */
|
||||
boolean cur_ignore_wlan_act;
|
||||
boolean pre_ignore_wlan_act;
|
||||
u8 pre_ps_tdma;
|
||||
u8 cur_ps_tdma;
|
||||
u8 ps_tdma_para[5];
|
||||
u8 ps_tdma_du_adj_type;
|
||||
boolean auto_tdma_adjust;
|
||||
boolean pre_ps_tdma_on;
|
||||
boolean cur_ps_tdma_on;
|
||||
boolean pre_bt_auto_report;
|
||||
boolean cur_bt_auto_report;
|
||||
u8 pre_lps;
|
||||
u8 cur_lps;
|
||||
u8 pre_rpwm;
|
||||
u8 cur_rpwm;
|
||||
|
||||
/* sw mechanism */
|
||||
boolean pre_low_penalty_ra;
|
||||
boolean cur_low_penalty_ra;
|
||||
u32 pre_val0x6c0;
|
||||
u32 cur_val0x6c0;
|
||||
u32 pre_val0x6c4;
|
||||
u32 cur_val0x6c4;
|
||||
u32 pre_val0x6c8;
|
||||
u32 cur_val0x6c8;
|
||||
u8 pre_val0x6cc;
|
||||
u8 cur_val0x6cc;
|
||||
boolean limited_dig;
|
||||
|
||||
u32 backup_arfr_cnt1; /* Auto Rate Fallback Retry cnt */
|
||||
u32 backup_arfr_cnt2; /* Auto Rate Fallback Retry cnt */
|
||||
u16 backup_retry_limit;
|
||||
u8 backup_ampdu_max_time;
|
||||
|
||||
/* algorithm related */
|
||||
u8 pre_algorithm;
|
||||
u8 cur_algorithm;
|
||||
u8 bt_status;
|
||||
u8 wifi_chnl_info[3];
|
||||
|
||||
u32 pre_ra_mask;
|
||||
u32 cur_ra_mask;
|
||||
u8 pre_arfr_type;
|
||||
u8 cur_arfr_type;
|
||||
u8 pre_retry_limit_type;
|
||||
u8 cur_retry_limit_type;
|
||||
u8 pre_ampdu_time_type;
|
||||
u8 cur_ampdu_time_type;
|
||||
u32 arp_cnt;
|
||||
|
||||
u8 error_condition;
|
||||
};
|
||||
|
||||
struct coex_sta_8812a_1ant {
|
||||
boolean bt_disabled;
|
||||
boolean bt_link_exist;
|
||||
boolean sco_exist;
|
||||
boolean a2dp_exist;
|
||||
boolean hid_exist;
|
||||
boolean pan_exist;
|
||||
|
||||
boolean under_lps;
|
||||
boolean under_ips;
|
||||
u32 specific_pkt_period_cnt;
|
||||
u32 high_priority_tx;
|
||||
u32 high_priority_rx;
|
||||
u32 low_priority_tx;
|
||||
u32 low_priority_rx;
|
||||
s8 bt_rssi;
|
||||
boolean bt_tx_rx_mask;
|
||||
u8 pre_bt_rssi_state;
|
||||
u8 pre_wifi_rssi_state[4];
|
||||
boolean c2h_bt_info_req_sent;
|
||||
u8 bt_info_c2h[BT_INFO_SRC_8812A_1ANT_MAX][10];
|
||||
u32 bt_info_c2h_cnt[BT_INFO_SRC_8812A_1ANT_MAX];
|
||||
u32 bt_info_query_cnt;
|
||||
boolean c2h_bt_inquiry_page;
|
||||
boolean c2h_bt_page; /* Add for win8.1 page out issue */
|
||||
boolean wifi_is_high_pri_task; /* Add for win8.1 page out issue */
|
||||
u8 bt_retry_cnt;
|
||||
u8 bt_info_ext;
|
||||
u32 pop_event_cnt;
|
||||
u8 scan_ap_num;
|
||||
|
||||
u32 crc_ok_cck;
|
||||
u32 crc_ok_11g;
|
||||
u32 crc_ok_11n;
|
||||
u32 crc_ok_11n_agg;
|
||||
|
||||
u32 crc_err_cck;
|
||||
u32 crc_err_11g;
|
||||
u32 crc_err_11n;
|
||||
u32 crc_err_11n_agg;
|
||||
|
||||
boolean cck_lock;
|
||||
boolean pre_ccklock;
|
||||
u8 coex_table_type;
|
||||
|
||||
boolean force_lps_on;
|
||||
};
|
||||
|
||||
/* *******************************************
|
||||
* The following is interface which will notify coex module.
|
||||
* ******************************************* */
|
||||
void ex_halbtc8812a1ant_power_on_setting(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8812a1ant_pre_load_firmware(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8812a1ant_init_hw_config(IN struct btc_coexist *btcoexist,
|
||||
IN boolean wifi_only);
|
||||
void ex_halbtc8812a1ant_init_coex_dm(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8812a1ant_ips_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8812a1ant_lps_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8812a1ant_scan_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8812a1ant_connect_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8812a1ant_media_status_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8812a1ant_specific_packet_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8812a1ant_bt_info_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 *tmp_buf, IN u8 length);
|
||||
void ex_halbtc8812a1ant_rf_status_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8812a1ant_halt_notify(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8812a1ant_pnp_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 pnp_state);
|
||||
void ex_halbtc8812a1ant_coex_dm_reset(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8812a1ant_periodical(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8812a1ant_dbg_control(IN struct btc_coexist *btcoexist,
|
||||
IN u8 op_code, IN u8 op_len, IN u8 *pdata);
|
||||
void ex_halbtc8812a1ant_display_coex_info(IN struct btc_coexist *btcoexist);
|
||||
|
||||
#else
|
||||
#define ex_halbtc8812a1ant_power_on_setting(btcoexist)
|
||||
#define ex_halbtc8812a1ant_pre_load_firmware(btcoexist)
|
||||
#define ex_halbtc8812a1ant_init_hw_config(btcoexist, wifi_only)
|
||||
#define ex_halbtc8812a1ant_init_coex_dm(btcoexist)
|
||||
#define ex_halbtc8812a1ant_ips_notify(btcoexist, type)
|
||||
#define ex_halbtc8812a1ant_lps_notify(btcoexist, type)
|
||||
#define ex_halbtc8812a1ant_scan_notify(btcoexist, type)
|
||||
#define ex_halbtc8812a1ant_connect_notify(btcoexist, type)
|
||||
#define ex_halbtc8812a1ant_media_status_notify(btcoexist, type)
|
||||
#define ex_halbtc8812a1ant_specific_packet_notify(btcoexist, type)
|
||||
#define ex_halbtc8812a1ant_bt_info_notify(btcoexist, tmp_buf, length)
|
||||
#define ex_halbtc8812a1ant_rf_status_notify(btcoexist, type)
|
||||
#define ex_halbtc8812a1ant_halt_notify(btcoexist)
|
||||
#define ex_halbtc8812a1ant_pnp_notify(btcoexist, pnp_state)
|
||||
#define ex_halbtc8812a1ant_coex_dm_reset(btcoexist)
|
||||
#define ex_halbtc8812a1ant_periodical(btcoexist)
|
||||
#define ex_halbtc8812a1ant_dbg_control(btcoexist, op_code, op_len, pdata)
|
||||
#define ex_halbtc8812a1ant_display_coex_info(btcoexist)
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
4782
hal/btc/HalBtc8812a2Ant.c
Normal file
4782
hal/btc/HalBtc8812a2Ant.c
Normal file
File diff suppressed because it is too large
Load diff
202
hal/btc/HalBtc8812a2Ant.h
Normal file
202
hal/btc/HalBtc8812a2Ant.h
Normal file
|
|
@ -0,0 +1,202 @@
|
|||
|
||||
#if (BT_SUPPORT == 1 && COEX_SUPPORT == 1)
|
||||
|
||||
#if (RTL8812A_SUPPORT == 1)
|
||||
|
||||
/* *******************************************
|
||||
* The following is for 8812A 2Ant BT Co-exist definition
|
||||
* ******************************************* */
|
||||
#define BT_AUTO_REPORT_ONLY_8812A_2ANT 0
|
||||
|
||||
#define BT_INFO_8812A_2ANT_B_FTP BIT(7)
|
||||
#define BT_INFO_8812A_2ANT_B_A2DP BIT(6)
|
||||
#define BT_INFO_8812A_2ANT_B_HID BIT(5)
|
||||
#define BT_INFO_8812A_2ANT_B_SCO_BUSY BIT(4)
|
||||
#define BT_INFO_8812A_2ANT_B_ACL_BUSY BIT(3)
|
||||
#define BT_INFO_8812A_2ANT_B_INQ_PAGE BIT(2)
|
||||
#define BT_INFO_8812A_2ANT_B_SCO_ESCO BIT(1)
|
||||
#define BT_INFO_8812A_2ANT_B_CONNECTION BIT(0)
|
||||
|
||||
#define BT_INFO_8812A_2ANT_A2DP_BASIC_RATE(_BT_INFO_EXT_) \
|
||||
(((_BT_INFO_EXT_&BIT(0))) ? true : false)
|
||||
|
||||
#define BTC_RSSI_COEX_THRESH_TOL_8812A_2ANT 2
|
||||
|
||||
enum bt_info_src_8812a_2ant {
|
||||
BT_INFO_SRC_8812A_2ANT_WIFI_FW = 0x0,
|
||||
BT_INFO_SRC_8812A_2ANT_BT_RSP = 0x1,
|
||||
BT_INFO_SRC_8812A_2ANT_BT_ACTIVE_SEND = 0x2,
|
||||
BT_INFO_SRC_8812A_2ANT_MAX
|
||||
};
|
||||
|
||||
enum bt_8812a_2ant_bt_status {
|
||||
BT_8812A_2ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0,
|
||||
BT_8812A_2ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
|
||||
BT_8812A_2ANT_BT_STATUS_INQ_PAGE = 0x2,
|
||||
BT_8812A_2ANT_BT_STATUS_ACL_BUSY = 0x3,
|
||||
BT_8812A_2ANT_BT_STATUS_SCO_BUSY = 0x4,
|
||||
BT_8812A_2ANT_BT_STATUS_ACL_SCO_BUSY = 0x5,
|
||||
BT_8812A_2ANT_BT_STATUS_MAX
|
||||
};
|
||||
|
||||
enum bt_8812a_2ant_coex_algo {
|
||||
BT_8812A_2ANT_COEX_ALGO_UNDEFINED = 0x0,
|
||||
BT_8812A_2ANT_COEX_ALGO_SCO = 0x1,
|
||||
BT_8812A_2ANT_COEX_ALGO_SCO_HID = 0x2,
|
||||
BT_8812A_2ANT_COEX_ALGO_HID = 0x3,
|
||||
BT_8812A_2ANT_COEX_ALGO_A2DP = 0x4,
|
||||
BT_8812A_2ANT_COEX_ALGO_A2DP_PANHS = 0x5,
|
||||
BT_8812A_2ANT_COEX_ALGO_PANEDR = 0x6,
|
||||
BT_8812A_2ANT_COEX_ALGO_PANHS = 0x7,
|
||||
BT_8812A_2ANT_COEX_ALGO_PANEDR_A2DP = 0x8,
|
||||
BT_8812A_2ANT_COEX_ALGO_PANEDR_HID = 0x9,
|
||||
BT_8812A_2ANT_COEX_ALGO_HID_A2DP_PANEDR = 0xa,
|
||||
BT_8812A_2ANT_COEX_ALGO_HID_A2DP_PANHS = 0xb,
|
||||
BT_8812A_2ANT_COEX_ALGO_HID_A2DP = 0xc,
|
||||
BT_8812A_2ANT_COEX_ALGO_MAX = 0xd
|
||||
};
|
||||
|
||||
struct coex_dm_8812a_2ant {
|
||||
/* fw mechanism */
|
||||
u8 pre_bt_dec_pwr_lvl;
|
||||
u8 cur_bt_dec_pwr_lvl;
|
||||
u8 pre_fw_dac_swing_lvl;
|
||||
u8 cur_fw_dac_swing_lvl;
|
||||
boolean cur_ignore_wlan_act;
|
||||
boolean pre_ignore_wlan_act;
|
||||
u8 pre_ps_tdma;
|
||||
u8 cur_ps_tdma;
|
||||
u8 ps_tdma_para[5];
|
||||
u8 ps_tdma_du_adj_type;
|
||||
boolean auto_tdma_adjust;
|
||||
boolean auto_tdma_adjust_low_rssi;
|
||||
boolean pre_ps_tdma_on;
|
||||
boolean cur_ps_tdma_on;
|
||||
boolean pre_bt_auto_report;
|
||||
boolean cur_bt_auto_report;
|
||||
u8 pre_lps;
|
||||
u8 cur_lps;
|
||||
u8 pre_rpwm;
|
||||
u8 cur_rpwm;
|
||||
|
||||
/* sw mechanism */
|
||||
boolean pre_rf_rx_lpf_shrink;
|
||||
boolean cur_rf_rx_lpf_shrink;
|
||||
u32 bt_rf_0x1e_backup;
|
||||
boolean pre_low_penalty_ra;
|
||||
boolean cur_low_penalty_ra;
|
||||
boolean pre_dac_swing_on;
|
||||
u32 pre_dac_swing_lvl;
|
||||
boolean cur_dac_swing_on;
|
||||
u32 cur_dac_swing_lvl;
|
||||
boolean pre_adc_back_off;
|
||||
boolean cur_adc_back_off;
|
||||
boolean pre_agc_table_en;
|
||||
boolean cur_agc_table_en;
|
||||
u32 pre_val0x6c0;
|
||||
u32 cur_val0x6c0;
|
||||
u32 pre_val0x6c4;
|
||||
u32 cur_val0x6c4;
|
||||
u32 pre_val0x6c8;
|
||||
u32 cur_val0x6c8;
|
||||
u8 pre_val0x6cc;
|
||||
u8 cur_val0x6cc;
|
||||
boolean limited_dig;
|
||||
u32 backup_arfr_cnt1; /* Auto Rate Fallback Retry cnt */
|
||||
u32 backup_arfr_cnt2; /* Auto Rate Fallback Retry cnt */
|
||||
u16 backup_retry_limit;
|
||||
u8 backup_ampdu_max_time;
|
||||
|
||||
/* algorithm related */
|
||||
u8 pre_algorithm;
|
||||
u8 cur_algorithm;
|
||||
u8 bt_status;
|
||||
u8 wifi_chnl_info[3];
|
||||
|
||||
u32 pre_ra_mask;
|
||||
u32 cur_ra_mask;
|
||||
u8 cur_ra_mask_type;
|
||||
u8 pre_arfr_type;
|
||||
u8 cur_arfr_type;
|
||||
u8 pre_retry_limit_type;
|
||||
u8 cur_retry_limit_type;
|
||||
u8 pre_ampdu_time_type;
|
||||
u8 cur_ampdu_time_type;
|
||||
};
|
||||
|
||||
struct coex_sta_8812a_2ant {
|
||||
boolean bt_disabled;
|
||||
boolean bt_link_exist;
|
||||
boolean sco_exist;
|
||||
boolean a2dp_exist;
|
||||
boolean hid_exist;
|
||||
boolean pan_exist;
|
||||
boolean acl_busy;
|
||||
|
||||
boolean under_lps;
|
||||
boolean under_ips;
|
||||
u32 high_priority_tx;
|
||||
u32 high_priority_rx;
|
||||
u32 low_priority_tx;
|
||||
u32 low_priority_rx;
|
||||
u8 bt_rssi;
|
||||
u8 pre_bt_rssi_state;
|
||||
u8 pre_wifi_rssi_state[4];
|
||||
boolean c2h_bt_info_req_sent;
|
||||
u8 bt_info_c2h[BT_INFO_SRC_8812A_2ANT_MAX][10];
|
||||
u32 bt_info_c2h_cnt[BT_INFO_SRC_8812A_2ANT_MAX];
|
||||
u32 bt_info_query_cnt;
|
||||
boolean c2h_bt_inquiry_page;
|
||||
u8 bt_retry_cnt;
|
||||
u8 bt_info_ext;
|
||||
};
|
||||
|
||||
/* *******************************************
|
||||
* The following is interface which will notify coex module.
|
||||
* ******************************************* */
|
||||
void ex_halbtc8812a2ant_power_on_setting(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8812a2ant_init_hw_config(IN struct btc_coexist *btcoexist,
|
||||
IN boolean wifi_only);
|
||||
void ex_halbtc8812a2ant_init_coex_dm(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8812a2ant_ips_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8812a2ant_lps_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8812a2ant_scan_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8812a2ant_connect_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8812a2ant_media_status_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8812a2ant_specific_packet_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8812a2ant_bt_info_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 *tmp_buf, IN u8 length);
|
||||
void ex_halbtc8812a2ant_rf_status_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
|
||||
void ex_halbtc8812a2ant_halt_notify(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8812a2ant_periodical(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8812a2ant_display_coex_info(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8812a2ant_dbg_control(IN struct btc_coexist *btcoexist,
|
||||
IN u8 op_code, IN u8 op_len, IN u8 *pdata);
|
||||
|
||||
#else
|
||||
#define ex_halbtc8812a2ant_power_on_setting(btcoexist)
|
||||
#define ex_halbtc8812a2ant_init_hw_config(btcoexist, wifi_only)
|
||||
#define ex_halbtc8812a2ant_init_coex_dm(btcoexist)
|
||||
#define ex_halbtc8812a2ant_ips_notify(btcoexist, type)
|
||||
#define ex_halbtc8812a2ant_lps_notify(btcoexist, type)
|
||||
#define ex_halbtc8812a2ant_scan_notify(btcoexist, type)
|
||||
#define ex_halbtc8812a2ant_connect_notify(btcoexist, type)
|
||||
#define ex_halbtc8812a2ant_media_status_notify(btcoexist, type)
|
||||
#define ex_halbtc8812a2ant_specific_packet_notify(btcoexist, type)
|
||||
#define ex_halbtc8812a2ant_bt_info_notify(btcoexist, tmp_buf, length)
|
||||
#define ex_halbtc8812a2ant_rf_status_notify(btcoexist, type)
|
||||
#define ex_halbtc8812a2ant_halt_notify(btcoexist)
|
||||
#define ex_halbtc8812a2ant_periodical(btcoexist)
|
||||
#define ex_halbtc8812a2ant_display_coex_info(btcoexist)
|
||||
#define ex_halbtc8812a2ant_dbg_control(btcoexist, op_code, op_len, pdata)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
3100
hal/btc/HalBtc8821a1Ant.c
Normal file
3100
hal/btc/HalBtc8821a1Ant.c
Normal file
File diff suppressed because it is too large
Load diff
197
hal/btc/HalBtc8821a1Ant.h
Normal file
197
hal/btc/HalBtc8821a1Ant.h
Normal file
|
|
@ -0,0 +1,197 @@
|
|||
|
||||
#if (BT_SUPPORT == 1 && COEX_SUPPORT == 1)
|
||||
|
||||
#if (RTL8821A_SUPPORT == 1)
|
||||
|
||||
/* *******************************************
|
||||
* The following is for 8821A 1ANT BT Co-exist definition
|
||||
* ******************************************* */
|
||||
#define BT_AUTO_REPORT_ONLY_8821A_1ANT 1
|
||||
|
||||
#define BT_INFO_8821A_1ANT_B_FTP BIT(7)
|
||||
#define BT_INFO_8821A_1ANT_B_A2DP BIT(6)
|
||||
#define BT_INFO_8821A_1ANT_B_HID BIT(5)
|
||||
#define BT_INFO_8821A_1ANT_B_SCO_BUSY BIT(4)
|
||||
#define BT_INFO_8821A_1ANT_B_ACL_BUSY BIT(3)
|
||||
#define BT_INFO_8821A_1ANT_B_INQ_PAGE BIT(2)
|
||||
#define BT_INFO_8821A_1ANT_B_SCO_ESCO BIT(1)
|
||||
#define BT_INFO_8821A_1ANT_B_CONNECTION BIT(0)
|
||||
|
||||
#define BT_INFO_8821A_1ANT_A2DP_BASIC_RATE(_BT_INFO_EXT_) \
|
||||
(((_BT_INFO_EXT_&BIT(0))) ? true : false)
|
||||
|
||||
#define BTC_RSSI_COEX_THRESH_TOL_8821A_1ANT 2
|
||||
|
||||
enum bt_info_src_8821a_1ant {
|
||||
BT_INFO_SRC_8821A_1ANT_WIFI_FW = 0x0,
|
||||
BT_INFO_SRC_8821A_1ANT_BT_RSP = 0x1,
|
||||
BT_INFO_SRC_8821A_1ANT_BT_ACTIVE_SEND = 0x2,
|
||||
BT_INFO_SRC_8821A_1ANT_MAX
|
||||
};
|
||||
|
||||
enum bt_8821a_1ant_bt_status {
|
||||
BT_8821A_1ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0,
|
||||
BT_8821A_1ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
|
||||
BT_8821A_1ANT_BT_STATUS_INQ_PAGE = 0x2,
|
||||
BT_8821A_1ANT_BT_STATUS_ACL_BUSY = 0x3,
|
||||
BT_8821A_1ANT_BT_STATUS_SCO_BUSY = 0x4,
|
||||
BT_8821A_1ANT_BT_STATUS_ACL_SCO_BUSY = 0x5,
|
||||
BT_8821A_1ANT_BT_STATUS_MAX
|
||||
};
|
||||
|
||||
enum bt_8821a_1ant_wifi_status {
|
||||
BT_8821A_1ANT_WIFI_STATUS_NON_CONNECTED_IDLE = 0x0,
|
||||
BT_8821A_1ANT_WIFI_STATUS_NON_CONNECTED_ASSO_AUTH_SCAN = 0x1,
|
||||
BT_8821A_1ANT_WIFI_STATUS_CONNECTED_SCAN = 0x2,
|
||||
BT_8821A_1ANT_WIFI_STATUS_CONNECTED_SPECIFIC_PKT = 0x3,
|
||||
BT_8821A_1ANT_WIFI_STATUS_CONNECTED_IDLE = 0x4,
|
||||
BT_8821A_1ANT_WIFI_STATUS_CONNECTED_BUSY = 0x5,
|
||||
BT_8821A_1ANT_WIFI_STATUS_MAX
|
||||
};
|
||||
|
||||
enum bt_8821a_1ant_coex_algo {
|
||||
BT_8821A_1ANT_COEX_ALGO_UNDEFINED = 0x0,
|
||||
BT_8821A_1ANT_COEX_ALGO_SCO = 0x1,
|
||||
BT_8821A_1ANT_COEX_ALGO_HID = 0x2,
|
||||
BT_8821A_1ANT_COEX_ALGO_A2DP = 0x3,
|
||||
BT_8821A_1ANT_COEX_ALGO_A2DP_PANHS = 0x4,
|
||||
BT_8821A_1ANT_COEX_ALGO_PANEDR = 0x5,
|
||||
BT_8821A_1ANT_COEX_ALGO_PANHS = 0x6,
|
||||
BT_8821A_1ANT_COEX_ALGO_PANEDR_A2DP = 0x7,
|
||||
BT_8821A_1ANT_COEX_ALGO_PANEDR_HID = 0x8,
|
||||
BT_8821A_1ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x9,
|
||||
BT_8821A_1ANT_COEX_ALGO_HID_A2DP = 0xa,
|
||||
BT_8821A_1ANT_COEX_ALGO_MAX = 0xb,
|
||||
};
|
||||
|
||||
struct coex_dm_8821a_1ant {
|
||||
/* fw mechanism */
|
||||
boolean cur_ignore_wlan_act;
|
||||
boolean pre_ignore_wlan_act;
|
||||
u8 pre_ps_tdma;
|
||||
u8 cur_ps_tdma;
|
||||
u8 ps_tdma_para[5];
|
||||
u8 ps_tdma_du_adj_type;
|
||||
boolean auto_tdma_adjust;
|
||||
boolean pre_ps_tdma_on;
|
||||
boolean cur_ps_tdma_on;
|
||||
boolean pre_bt_auto_report;
|
||||
boolean cur_bt_auto_report;
|
||||
u8 pre_lps;
|
||||
u8 cur_lps;
|
||||
u8 pre_rpwm;
|
||||
u8 cur_rpwm;
|
||||
|
||||
/* sw mechanism */
|
||||
boolean pre_low_penalty_ra;
|
||||
boolean cur_low_penalty_ra;
|
||||
u32 pre_val0x6c0;
|
||||
u32 cur_val0x6c0;
|
||||
u32 pre_val0x6c4;
|
||||
u32 cur_val0x6c4;
|
||||
u32 pre_val0x6c8;
|
||||
u32 cur_val0x6c8;
|
||||
u8 pre_val0x6cc;
|
||||
u8 cur_val0x6cc;
|
||||
|
||||
u32 backup_arfr_cnt1; /* Auto Rate Fallback Retry cnt */
|
||||
u32 backup_arfr_cnt2; /* Auto Rate Fallback Retry cnt */
|
||||
u16 backup_retry_limit;
|
||||
u8 backup_ampdu_max_time;
|
||||
|
||||
/* algorithm related */
|
||||
u8 pre_algorithm;
|
||||
u8 cur_algorithm;
|
||||
u8 bt_status;
|
||||
u8 wifi_chnl_info[3];
|
||||
|
||||
u32 pre_ra_mask;
|
||||
u32 cur_ra_mask;
|
||||
u8 pre_arfr_type;
|
||||
u8 cur_arfr_type;
|
||||
u8 pre_retry_limit_type;
|
||||
u8 cur_retry_limit_type;
|
||||
u8 pre_ampdu_time_type;
|
||||
u8 cur_ampdu_time_type;
|
||||
u32 arp_cnt;
|
||||
|
||||
u8 error_condition;
|
||||
};
|
||||
|
||||
struct coex_sta_8821a_1ant {
|
||||
boolean bt_disabled;
|
||||
boolean bt_link_exist;
|
||||
boolean sco_exist;
|
||||
boolean a2dp_exist;
|
||||
boolean hid_exist;
|
||||
boolean pan_exist;
|
||||
|
||||
boolean under_lps;
|
||||
boolean under_ips;
|
||||
u32 specific_pkt_period_cnt;
|
||||
u32 high_priority_tx;
|
||||
u32 high_priority_rx;
|
||||
u32 low_priority_tx;
|
||||
u32 low_priority_rx;
|
||||
u8 bt_rssi;
|
||||
boolean bt_tx_rx_mask;
|
||||
u8 pre_bt_rssi_state;
|
||||
u8 pre_wifi_rssi_state[4];
|
||||
boolean c2h_bt_info_req_sent;
|
||||
u8 bt_info_c2h[BT_INFO_SRC_8821A_1ANT_MAX][10];
|
||||
u32 bt_info_c2h_cnt[BT_INFO_SRC_8821A_1ANT_MAX];
|
||||
boolean c2h_bt_inquiry_page;
|
||||
boolean c2h_bt_page; /* Add for win8.1 page out issue */
|
||||
boolean wifi_is_high_pri_task; /* Add for win8.1 page out issue */
|
||||
u8 bt_retry_cnt;
|
||||
u8 bt_info_ext;
|
||||
boolean
|
||||
bt_whck_test; /* Add for ASUS WHQL TEST that enable wifi test bt */
|
||||
};
|
||||
|
||||
/* *******************************************
|
||||
* The following is interface which will notify coex module.
|
||||
* ******************************************* */
|
||||
void ex_halbtc8821a1ant_power_on_setting(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8821a1ant_init_hw_config(IN struct btc_coexist *btcoexist,
|
||||
IN boolean wifi_only);
|
||||
void ex_halbtc8821a1ant_init_coex_dm(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8821a1ant_ips_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8821a1ant_lps_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8821a1ant_scan_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8821a1ant_connect_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8821a1ant_media_status_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8821a1ant_specific_packet_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8821a1ant_bt_info_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 *tmp_buf, IN u8 length);
|
||||
void ex_halbtc8821a1ant_halt_notify(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8821a1ant_pnp_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 pnp_state);
|
||||
void ex_halbtc8821a1ant_periodical(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8821a1ant_display_coex_info(IN struct btc_coexist *btcoexist);
|
||||
|
||||
#else
|
||||
#define ex_halbtc8821a1ant_power_on_setting(btcoexist)
|
||||
#define ex_halbtc8821a1ant_init_hw_config(btcoexist, wifi_only)
|
||||
#define ex_halbtc8821a1ant_init_coex_dm(btcoexist)
|
||||
#define ex_halbtc8821a1ant_ips_notify(btcoexist, type)
|
||||
#define ex_halbtc8821a1ant_lps_notify(btcoexist, type)
|
||||
#define ex_halbtc8821a1ant_scan_notify(btcoexist, type)
|
||||
#define ex_halbtc8821a1ant_connect_notify(btcoexist, type)
|
||||
#define ex_halbtc8821a1ant_media_status_notify(btcoexist, type)
|
||||
#define ex_halbtc8821a1ant_specific_packet_notify(btcoexist, type)
|
||||
#define ex_halbtc8821a1ant_bt_info_notify(btcoexist, tmp_buf, length)
|
||||
#define ex_halbtc8821a1ant_halt_notify(btcoexist)
|
||||
#define ex_halbtc8821a1ant_pnp_notify(btcoexist, pnp_state)
|
||||
#define ex_halbtc8821a1ant_periodical(btcoexist)
|
||||
#define ex_halbtc8821a1ant_display_coex_info(btcoexist)
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
4560
hal/btc/HalBtc8821a2Ant.c
Normal file
4560
hal/btc/HalBtc8821a2Ant.c
Normal file
File diff suppressed because it is too large
Load diff
205
hal/btc/HalBtc8821a2Ant.h
Normal file
205
hal/btc/HalBtc8821a2Ant.h
Normal file
|
|
@ -0,0 +1,205 @@
|
|||
|
||||
#if (BT_SUPPORT == 1 && COEX_SUPPORT == 1)
|
||||
|
||||
#if (RTL8821A_SUPPORT == 1)
|
||||
|
||||
/* *******************************************
|
||||
* The following is for 8821A 2Ant BT Co-exist definition
|
||||
* ******************************************* */
|
||||
#define BT_AUTO_REPORT_ONLY_8821A_2ANT 1
|
||||
|
||||
|
||||
#define BT_INFO_8821A_2ANT_B_FTP BIT(7)
|
||||
#define BT_INFO_8821A_2ANT_B_A2DP BIT(6)
|
||||
#define BT_INFO_8821A_2ANT_B_HID BIT(5)
|
||||
#define BT_INFO_8821A_2ANT_B_SCO_BUSY BIT(4)
|
||||
#define BT_INFO_8821A_2ANT_B_ACL_BUSY BIT(3)
|
||||
#define BT_INFO_8821A_2ANT_B_INQ_PAGE BIT(2)
|
||||
#define BT_INFO_8821A_2ANT_B_SCO_ESCO BIT(1)
|
||||
#define BT_INFO_8821A_2ANT_B_CONNECTION BIT(0)
|
||||
|
||||
#define BTC_RSSI_COEX_THRESH_TOL_8821A_2ANT 2
|
||||
|
||||
|
||||
#define BT_8821A_2ANT_WIFI_RSSI_COEXSWITCH_THRES 42 /* WiFi RSSI Threshold for 2-Ant TDMA/1-Ant PS-TDMA translation */
|
||||
#define BT_8821A_2ANT_BT_RSSI_COEXSWITCH_THRES 46 /* BT RSSI Threshold for 2-Ant TDMA/1-Ant PS-TDMA translation */
|
||||
|
||||
enum bt_info_src_8821a_2ant {
|
||||
BT_INFO_SRC_8821A_2ANT_WIFI_FW = 0x0,
|
||||
BT_INFO_SRC_8821A_2ANT_BT_RSP = 0x1,
|
||||
BT_INFO_SRC_8821A_2ANT_BT_ACTIVE_SEND = 0x2,
|
||||
BT_INFO_SRC_8821A_2ANT_MAX
|
||||
};
|
||||
|
||||
enum bt_8821a_2ant_bt_status {
|
||||
BT_8821A_2ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0,
|
||||
BT_8821A_2ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
|
||||
BT_8821A_2ANT_BT_STATUS_INQ_PAGE = 0x2,
|
||||
BT_8821A_2ANT_BT_STATUS_ACL_BUSY = 0x3,
|
||||
BT_8821A_2ANT_BT_STATUS_SCO_BUSY = 0x4,
|
||||
BT_8821A_2ANT_BT_STATUS_ACL_SCO_BUSY = 0x5,
|
||||
BT_8821A_2ANT_BT_STATUS_MAX
|
||||
};
|
||||
|
||||
enum bt_8821a_2ant_coex_algo {
|
||||
BT_8821A_2ANT_COEX_ALGO_UNDEFINED = 0x0,
|
||||
BT_8821A_2ANT_COEX_ALGO_SCO = 0x1,
|
||||
BT_8821A_2ANT_COEX_ALGO_HID = 0x2,
|
||||
BT_8821A_2ANT_COEX_ALGO_A2DP = 0x3,
|
||||
BT_8821A_2ANT_COEX_ALGO_A2DP_PANHS = 0x4,
|
||||
BT_8821A_2ANT_COEX_ALGO_PANEDR = 0x5,
|
||||
BT_8821A_2ANT_COEX_ALGO_PANHS = 0x6,
|
||||
BT_8821A_2ANT_COEX_ALGO_PANEDR_A2DP = 0x7,
|
||||
BT_8821A_2ANT_COEX_ALGO_PANEDR_HID = 0x8,
|
||||
BT_8821A_2ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x9,
|
||||
BT_8821A_2ANT_COEX_ALGO_HID_A2DP = 0xa,
|
||||
BT_8821A_2ANT_COEX_ALGO_MAX = 0xb,
|
||||
};
|
||||
|
||||
struct coex_dm_8821a_2ant {
|
||||
/* fw mechanism */
|
||||
u8 pre_bt_dec_pwr_lvl;
|
||||
u8 cur_bt_dec_pwr_lvl;
|
||||
u8 pre_fw_dac_swing_lvl;
|
||||
u8 cur_fw_dac_swing_lvl;
|
||||
boolean cur_ignore_wlan_act;
|
||||
boolean pre_ignore_wlan_act;
|
||||
u8 pre_ps_tdma;
|
||||
u8 cur_ps_tdma;
|
||||
u8 ps_tdma_para[5];
|
||||
u8 ps_tdma_du_adj_type;
|
||||
boolean reset_tdma_adjust;
|
||||
boolean auto_tdma_adjust;
|
||||
boolean pre_ps_tdma_on;
|
||||
boolean cur_ps_tdma_on;
|
||||
boolean pre_bt_auto_report;
|
||||
boolean cur_bt_auto_report;
|
||||
|
||||
/* sw mechanism */
|
||||
boolean pre_rf_rx_lpf_shrink;
|
||||
boolean cur_rf_rx_lpf_shrink;
|
||||
u32 bt_rf_0x1e_backup;
|
||||
boolean pre_low_penalty_ra;
|
||||
boolean cur_low_penalty_ra;
|
||||
boolean pre_dac_swing_on;
|
||||
u32 pre_dac_swing_lvl;
|
||||
boolean cur_dac_swing_on;
|
||||
u32 cur_dac_swing_lvl;
|
||||
boolean pre_adc_back_off;
|
||||
boolean cur_adc_back_off;
|
||||
boolean pre_agc_table_en;
|
||||
boolean cur_agc_table_en;
|
||||
u32 pre_val0x6c0;
|
||||
u32 cur_val0x6c0;
|
||||
u32 pre_val0x6c4;
|
||||
u32 cur_val0x6c4;
|
||||
u32 pre_val0x6c8;
|
||||
u32 cur_val0x6c8;
|
||||
u8 pre_val0x6cc;
|
||||
u8 cur_val0x6cc;
|
||||
boolean limited_dig;
|
||||
|
||||
/* algorithm related */
|
||||
u8 pre_algorithm;
|
||||
u8 cur_algorithm;
|
||||
u8 bt_status;
|
||||
u8 wifi_chnl_info[3];
|
||||
|
||||
boolean need_recover0x948;
|
||||
u32 backup0x948;
|
||||
|
||||
u8 pre_lps;
|
||||
u8 cur_lps;
|
||||
u8 pre_rpwm;
|
||||
u8 cur_rpwm;
|
||||
};
|
||||
|
||||
struct coex_sta_8821a_2ant {
|
||||
boolean bt_disabled;
|
||||
boolean bt_link_exist;
|
||||
boolean sco_exist;
|
||||
boolean a2dp_exist;
|
||||
boolean hid_exist;
|
||||
boolean pan_exist;
|
||||
|
||||
boolean under_lps;
|
||||
boolean under_ips;
|
||||
u32 high_priority_tx;
|
||||
u32 high_priority_rx;
|
||||
u32 low_priority_tx;
|
||||
u32 low_priority_rx;
|
||||
u8 bt_rssi;
|
||||
boolean bt_tx_rx_mask;
|
||||
u8 pre_bt_rssi_state;
|
||||
u8 pre_wifi_rssi_state[4];
|
||||
boolean c2h_bt_info_req_sent;
|
||||
u8 bt_info_c2h[BT_INFO_SRC_8821A_2ANT_MAX][10];
|
||||
u32 bt_info_c2h_cnt[BT_INFO_SRC_8821A_2ANT_MAX];
|
||||
boolean bt_whck_test;
|
||||
boolean c2h_bt_inquiry_page;
|
||||
u8 bt_retry_cnt;
|
||||
u8 bt_info_ext;
|
||||
|
||||
u32 crc_ok_cck;
|
||||
u32 crc_ok_11g;
|
||||
u32 crc_ok_11n;
|
||||
u32 crc_ok_11n_agg;
|
||||
|
||||
u32 crc_err_cck;
|
||||
u32 crc_err_11g;
|
||||
u32 crc_err_11n;
|
||||
u32 crc_err_11n_agg;
|
||||
|
||||
u8 coex_table_type;
|
||||
boolean force_lps_on;
|
||||
|
||||
u8 dis_ver_info_cnt;
|
||||
};
|
||||
|
||||
/* *******************************************
|
||||
* The following is interface which will notify coex module.
|
||||
* ******************************************* */
|
||||
void ex_halbtc8821a2ant_power_on_setting(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8821a2ant_pre_load_firmware(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8821a2ant_init_hw_config(IN struct btc_coexist *btcoexist,
|
||||
IN boolean wifi_only);
|
||||
void ex_halbtc8821a2ant_init_coex_dm(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8821a2ant_ips_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8821a2ant_lps_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8821a2ant_scan_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8821a2ant_connect_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8821a2ant_media_status_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8821a2ant_specific_packet_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8821a2ant_bt_info_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 *tmp_buf, IN u8 length);
|
||||
void ex_halbtc8821a2ant_halt_notify(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8821a2ant_pnp_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 pnp_state);
|
||||
void ex_halbtc8821a2ant_periodical(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8821a2ant_display_coex_info(IN struct btc_coexist *btcoexist);
|
||||
|
||||
#else
|
||||
#define ex_halbtc8821a2ant_power_on_setting(btcoexist)
|
||||
#define ex_halbtc8821a2ant_pre_load_firmware(btcoexist)
|
||||
#define ex_halbtc8821a2ant_init_hw_config(btcoexist, wifi_only)
|
||||
#define ex_halbtc8821a2ant_init_coex_dm(btcoexist)
|
||||
#define ex_halbtc8821a2ant_ips_notify(btcoexist, type)
|
||||
#define ex_halbtc8821a2ant_lps_notify(btcoexist, type)
|
||||
#define ex_halbtc8821a2ant_scan_notify(btcoexist, type)
|
||||
#define ex_halbtc8821a2ant_connect_notify(btcoexist, type)
|
||||
#define ex_halbtc8821a2ant_media_status_notify(btcoexist, type)
|
||||
#define ex_halbtc8821a2ant_specific_packet_notify(btcoexist, type)
|
||||
#define ex_halbtc8821a2ant_bt_info_notify(btcoexist, tmp_buf, length)
|
||||
#define ex_halbtc8821a2ant_halt_notify(btcoexist)
|
||||
#define ex_halbtc8821a2ant_pnp_notify(btcoexist, pnp_state)
|
||||
#define ex_halbtc8821a2ant_periodical(btcoexist)
|
||||
#define ex_halbtc8821a2ant_display_coex_info(btcoexist)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
3997
hal/btc/HalBtc8821aCsr2Ant.c
Normal file
3997
hal/btc/HalBtc8821aCsr2Ant.c
Normal file
File diff suppressed because it is too large
Load diff
188
hal/btc/HalBtc8821aCsr2Ant.h
Normal file
188
hal/btc/HalBtc8821aCsr2Ant.h
Normal file
|
|
@ -0,0 +1,188 @@
|
|||
|
||||
#if (BT_SUPPORT == 1 && COEX_SUPPORT == 1)
|
||||
|
||||
#if (RTL8821A_SUPPORT == 1)
|
||||
|
||||
/* *******************************************
|
||||
* The following is for 8821A_CSR 2Ant BT Co-exist definition
|
||||
* ******************************************* */
|
||||
#define BT_INFO_8821A_CSR_2ANT_B_FTP BIT(7)
|
||||
#define BT_INFO_8821A_CSR_2ANT_B_A2DP BIT(6)
|
||||
#define BT_INFO_8821A_CSR_2ANT_B_HID BIT(5)
|
||||
#define BT_INFO_8821A_CSR_2ANT_B_SCO_BUSY BIT(4)
|
||||
#define BT_INFO_8821A_CSR_2ANT_B_ACL_BUSY BIT(3)
|
||||
#define BT_INFO_8821A_CSR_2ANT_B_INQ_PAGE BIT(2)
|
||||
#define BT_INFO_8821A_CSR_2ANT_B_SCO_ESCO BIT(1)
|
||||
#define BT_INFO_8821A_CSR_2ANT_B_CONNECTION BIT(0)
|
||||
|
||||
#define BTC_RSSI_COEX_THRESH_TOL_8821A_CSR_2ANT 2
|
||||
|
||||
enum bt_info_src_8821a_csr_2ant {
|
||||
BT_INFO_SRC_8821A_CSR_2ANT_WIFI_FW = 0x0,
|
||||
BT_INFO_SRC_8821A_CSR_2ANT_BT_RSP = 0x1,
|
||||
BT_INFO_SRC_8821A_CSR_2ANT_BT_ACTIVE_SEND = 0x2,
|
||||
BT_INFO_SRC_8821A_CSR_2ANT_MAX
|
||||
};
|
||||
|
||||
enum bt_8821a_csr_2ant_bt_status {
|
||||
BT_8821A_CSR_2ANT_BT_STATUS_IDLE = 0x0,
|
||||
BT_8821A_CSR_2ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
|
||||
BT_8821A_CSR_2ANT_BT_STATUS_NON_IDLE = 0x2,
|
||||
BT_8821A_CSR_2ANT_BT_STATUS_MAX
|
||||
};
|
||||
|
||||
enum bt_8821a_csr_2ant_coex_algo {
|
||||
BT_8821A_CSR_2ANT_COEX_ALGO_UNDEFINED = 0x0,
|
||||
BT_8821A_CSR_2ANT_COEX_ALGO_SCO = 0x1,
|
||||
BT_8821A_CSR_2ANT_COEX_ALGO_HID = 0x2,
|
||||
BT_8821A_CSR_2ANT_COEX_ALGO_A2DP = 0x3,
|
||||
BT_8821A_CSR_2ANT_COEX_ALGO_A2DP_PANHS = 0x4,
|
||||
BT_8821A_CSR_2ANT_COEX_ALGO_PANEDR = 0x5,
|
||||
BT_8821A_CSR_2ANT_COEX_ALGO_PANHS = 0x6,
|
||||
BT_8821A_CSR_2ANT_COEX_ALGO_PANEDR_A2DP = 0x7,
|
||||
BT_8821A_CSR_2ANT_COEX_ALGO_PANEDR_HID = 0x8,
|
||||
BT_8821A_CSR_2ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x9,
|
||||
BT_8821A_CSR_2ANT_COEX_ALGO_HID_A2DP = 0xa,
|
||||
BT_8821A_CSR_2ANT_COEX_ALGO_MAX = 0xb,
|
||||
};
|
||||
|
||||
struct coex_dm_8821a_csr_2ant {
|
||||
/* fw mechanism */
|
||||
boolean pre_dec_bt_pwr;
|
||||
boolean cur_dec_bt_pwr;
|
||||
u8 pre_fw_dac_swing_lvl;
|
||||
u8 cur_fw_dac_swing_lvl;
|
||||
boolean cur_ignore_wlan_act;
|
||||
boolean pre_ignore_wlan_act;
|
||||
u8 pre_ps_tdma;
|
||||
u8 cur_ps_tdma;
|
||||
u8 ps_tdma_para[6];
|
||||
u8 ps_tdma_du_adj_type;
|
||||
boolean reset_tdma_adjust;
|
||||
boolean pre_ps_tdma_on;
|
||||
boolean cur_ps_tdma_on;
|
||||
boolean pre_bt_auto_report;
|
||||
boolean cur_bt_auto_report;
|
||||
|
||||
/* sw mechanism */
|
||||
boolean pre_rf_rx_lpf_shrink;
|
||||
boolean cur_rf_rx_lpf_shrink;
|
||||
u32 bt_rf_0x1e_backup;
|
||||
boolean pre_low_penalty_ra;
|
||||
boolean cur_low_penalty_ra;
|
||||
boolean pre_dac_swing_on;
|
||||
u32 pre_dac_swing_lvl;
|
||||
boolean cur_dac_swing_on;
|
||||
u32 cur_dac_swing_lvl;
|
||||
boolean pre_adc_back_off;
|
||||
boolean cur_adc_back_off;
|
||||
boolean pre_agc_table_en;
|
||||
boolean cur_agc_table_en;
|
||||
u32 pre_val0x6c0;
|
||||
u32 cur_val0x6c0;
|
||||
u32 pre_val0x6c4;
|
||||
u32 cur_val0x6c4;
|
||||
u32 pre_val0x6c8;
|
||||
u32 cur_val0x6c8;
|
||||
u8 pre_val0x6cc;
|
||||
u8 cur_val0x6cc;
|
||||
boolean limited_dig;
|
||||
|
||||
u32 pre_ra_mask;
|
||||
u32 cur_ra_mask;
|
||||
|
||||
u8 cur_ampdu_num_type;
|
||||
u8 pre_ampdu_num_type;
|
||||
u16 backup_ampdu_max_num;
|
||||
|
||||
u8 cur_ampdu_time_type;
|
||||
u8 pre_ampdu_time_type;
|
||||
u8 backup_ampdu_max_time;
|
||||
|
||||
u8 cur_arfr_type;
|
||||
u8 pre_arfr_type;
|
||||
u32 backup_arfr_cnt1;
|
||||
u32 backup_arfr_cnt2;
|
||||
|
||||
u8 cur_retry_limit_type;
|
||||
u8 pre_retry_limit_type;
|
||||
u16 backup_retry_limit;
|
||||
|
||||
/* algorithm related */
|
||||
u8 pre_algorithm;
|
||||
u8 cur_algorithm;
|
||||
u8 bt_status;
|
||||
u8 wifi_chnl_info[3];
|
||||
};
|
||||
|
||||
struct coex_sta_8821a_csr_2ant {
|
||||
boolean bt_disabled;
|
||||
boolean bt_link_exist;
|
||||
boolean sco_exist;
|
||||
boolean a2dp_exist;
|
||||
boolean slave;
|
||||
boolean hid_exist;
|
||||
boolean pan_exist;
|
||||
|
||||
boolean under_lps;
|
||||
boolean under_ips;
|
||||
u32 high_priority_tx;
|
||||
u32 high_priority_rx;
|
||||
u32 low_priority_tx;
|
||||
u32 low_priority_rx;
|
||||
u8 bt_rssi;
|
||||
u8 pre_bt_rssi_state;
|
||||
u8 pre_wifi_rssi_state[4];
|
||||
boolean c2h_bt_info_req_sent;
|
||||
u8 bt_info_c2h[BT_INFO_SRC_8821A_CSR_2ANT_MAX][10];
|
||||
u32 bt_info_c2h_cnt[BT_INFO_SRC_8821A_CSR_2ANT_MAX];
|
||||
boolean c2h_bt_inquiry_page;
|
||||
u8 bt_retry_cnt;
|
||||
u8 bt_info_ext;
|
||||
};
|
||||
|
||||
/* *******************************************
|
||||
* The following is interface which will notify coex module.
|
||||
* ******************************************* */
|
||||
void ex_halbtc8821aCsr2ant_power_on_setting(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8821aCsr2ant_init_hw_config(IN struct btc_coexist *btcoexist,
|
||||
IN boolean wifi_only);
|
||||
void ex_halbtc8821aCsr2ant_init_coex_dm(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8821aCsr2ant_ips_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8821aCsr2ant_lps_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8821aCsr2ant_scan_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8821aCsr2ant_connect_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8821aCsr2ant_media_status_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8821aCsr2ant_specific_packet_notify(IN struct btc_coexist
|
||||
*btcoexist, IN u8 type);
|
||||
void ex_halbtc8821aCsr2ant_bt_info_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 *tmp_buf, IN u8 length);
|
||||
void ex_halbtc8821aCsr2ant_halt_notify(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8821aCsr2ant_pnp_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 pnp_state);
|
||||
void ex_halbtc8821aCsr2ant_periodical(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8821aCsr2ant_display_coex_info(IN struct btc_coexist *btcoexist);
|
||||
|
||||
#else
|
||||
#define ex_halbtc8821aCsr2ant_power_on_setting(btcoexist)
|
||||
#define ex_halbtc8821aCsr2ant_init_hw_config(btcoexist, wifi_only)
|
||||
#define ex_halbtc8821aCsr2ant_init_coex_dm(btcoexist)
|
||||
#define ex_halbtc8821aCsr2ant_ips_notify(btcoexist, type)
|
||||
#define ex_halbtc8821aCsr2ant_lps_notify(btcoexist, type)
|
||||
#define ex_halbtc8821aCsr2ant_scan_notify(btcoexist, type)
|
||||
#define ex_halbtc8821aCsr2ant_connect_notify(btcoexist, type)
|
||||
#define ex_halbtc8821aCsr2ant_media_status_notify(btcoexist, type)
|
||||
#define ex_halbtc8821aCsr2ant_specific_packet_notify(btcoexist, type)
|
||||
#define ex_halbtc8821aCsr2ant_bt_info_notify(btcoexist, tmp_buf, length)
|
||||
#define ex_halbtc8821aCsr2ant_halt_notify(btcoexist)
|
||||
#define ex_halbtc8821aCsr2ant_pnp_notify(btcoexist, pnp_state)
|
||||
#define ex_halbtc8821aCsr2ant_periodical(btcoexist)
|
||||
#define ex_halbtc8821aCsr2ant_display_coex_info(btcoexist)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
900
hal/btc/HalBtcOutSrc.h
Normal file
900
hal/btc/HalBtcOutSrc.h
Normal file
|
|
@ -0,0 +1,900 @@
|
|||
#ifndef __HALBTC_OUT_SRC_H__
|
||||
#define __HALBTC_OUT_SRC_H__
|
||||
|
||||
|
||||
#define BTC_COEX_OFFLOAD 0
|
||||
#define BTC_TMP_BUF_SHORT 20
|
||||
|
||||
extern u1Byte gl_btc_trace_buf[];
|
||||
#define BTC_SPRINTF rsprintf
|
||||
#define BTC_TRACE(_MSG_) RT_TRACE(COMP_COEX, DBG_LOUD, (_MSG_))
|
||||
#define BT_PrintData(adapter, _MSG_, len, data) RT_PRINT_DATA(COMP_COEX, DBG_LOUD, (_MSG_), data, len)
|
||||
|
||||
|
||||
#define NORMAL_EXEC FALSE
|
||||
#define FORCE_EXEC TRUE
|
||||
|
||||
#define BTC_RF_OFF 0x0
|
||||
#define BTC_RF_ON 0x1
|
||||
|
||||
#define BTC_RF_A 0x0
|
||||
#define BTC_RF_B 0x1
|
||||
#define BTC_RF_C 0x2
|
||||
#define BTC_RF_D 0x3
|
||||
|
||||
#define BTC_SMSP SINGLEMAC_SINGLEPHY
|
||||
#define BTC_DMDP DUALMAC_DUALPHY
|
||||
#define BTC_DMSP DUALMAC_SINGLEPHY
|
||||
#define BTC_MP_UNKNOWN 0xff
|
||||
|
||||
#define BT_COEX_ANT_TYPE_PG 0
|
||||
#define BT_COEX_ANT_TYPE_ANTDIV 1
|
||||
#define BT_COEX_ANT_TYPE_DETECTED 2
|
||||
|
||||
#define BTC_MIMO_PS_STATIC 0 // 1ss
|
||||
#define BTC_MIMO_PS_DYNAMIC 1 // 2ss
|
||||
|
||||
#define BTC_RATE_DISABLE 0
|
||||
#define BTC_RATE_ENABLE 1
|
||||
|
||||
// single Antenna definition
|
||||
#define BTC_ANT_PATH_WIFI 0
|
||||
#define BTC_ANT_PATH_BT 1
|
||||
#define BTC_ANT_PATH_PTA 2
|
||||
// dual Antenna definition
|
||||
#define BTC_ANT_WIFI_AT_MAIN 0
|
||||
#define BTC_ANT_WIFI_AT_AUX 1
|
||||
// coupler Antenna definition
|
||||
#define BTC_ANT_WIFI_AT_CPL_MAIN 0
|
||||
#define BTC_ANT_WIFI_AT_CPL_AUX 1
|
||||
|
||||
typedef enum _BTC_POWERSAVE_TYPE{
|
||||
BTC_PS_WIFI_NATIVE = 0, // wifi original power save behavior
|
||||
BTC_PS_LPS_ON = 1,
|
||||
BTC_PS_LPS_OFF = 2,
|
||||
BTC_PS_MAX
|
||||
} BTC_POWERSAVE_TYPE, *PBTC_POWERSAVE_TYPE;
|
||||
|
||||
typedef enum _BTC_BT_REG_TYPE{
|
||||
BTC_BT_REG_RF = 0,
|
||||
BTC_BT_REG_MODEM = 1,
|
||||
BTC_BT_REG_BLUEWIZE = 2,
|
||||
BTC_BT_REG_VENDOR = 3,
|
||||
BTC_BT_REG_LE = 4,
|
||||
BTC_BT_REG_MAX
|
||||
} BTC_BT_REG_TYPE, *PBTC_BT_REG_TYPE;
|
||||
|
||||
typedef enum _BTC_CHIP_INTERFACE{
|
||||
BTC_INTF_UNKNOWN = 0,
|
||||
BTC_INTF_PCI = 1,
|
||||
BTC_INTF_USB = 2,
|
||||
BTC_INTF_SDIO = 3,
|
||||
BTC_INTF_MAX
|
||||
} BTC_CHIP_INTERFACE, *PBTC_CHIP_INTERFACE;
|
||||
|
||||
typedef enum _BTC_CHIP_TYPE{
|
||||
BTC_CHIP_UNDEF = 0,
|
||||
BTC_CHIP_CSR_BC4 = 1,
|
||||
BTC_CHIP_CSR_BC8 = 2,
|
||||
BTC_CHIP_RTL8723A = 3,
|
||||
BTC_CHIP_RTL8821 = 4,
|
||||
BTC_CHIP_RTL8723B = 5,
|
||||
BTC_CHIP_MAX
|
||||
} BTC_CHIP_TYPE, *PBTC_CHIP_TYPE;
|
||||
|
||||
// following is for wifi link status
|
||||
#define WIFI_STA_CONNECTED BIT0
|
||||
#define WIFI_AP_CONNECTED BIT1
|
||||
#define WIFI_HS_CONNECTED BIT2
|
||||
#define WIFI_P2P_GO_CONNECTED BIT3
|
||||
#define WIFI_P2P_GC_CONNECTED BIT4
|
||||
|
||||
// following is for command line utility
|
||||
#define CL_SPRINTF rsprintf
|
||||
#define CL_PRINTF DCMD_Printf
|
||||
|
||||
struct btc_board_info{
|
||||
/* The following is some board information */
|
||||
u8 bt_chip_type;
|
||||
u8 pg_ant_num; /* pg ant number */
|
||||
u8 btdm_ant_num; /* ant number for btdm */
|
||||
u8 btdm_ant_num_by_ant_det; /* ant number for btdm after antenna detection */
|
||||
u8 btdm_ant_pos; /* Bryant Add to indicate Antenna Position for (pg_ant_num = 2) && (btdm_ant_num =1) (DPDT+1Ant case) */
|
||||
u8 single_ant_path; /* current used for 8723b only, 1=>s0, 0=>s1 */
|
||||
boolean tfbga_package; /* for Antenna detect threshold */
|
||||
boolean btdm_ant_det_finish;
|
||||
u8 ant_type;
|
||||
};
|
||||
|
||||
typedef enum _BTC_DBG_OPCODE{
|
||||
BTC_DBG_SET_COEX_NORMAL = 0x0,
|
||||
BTC_DBG_SET_COEX_WIFI_ONLY = 0x1,
|
||||
BTC_DBG_SET_COEX_BT_ONLY = 0x2,
|
||||
BTC_DBG_SET_COEX_DEC_BT_PWR = 0x3,
|
||||
BTC_DBG_SET_COEX_BT_AFH_MAP = 0x4,
|
||||
BTC_DBG_SET_COEX_BT_IGNORE_WLAN_ACT = 0x5,
|
||||
BTC_DBG_SET_COEX_MANUAL_CTRL = 0x6,
|
||||
BTC_DBG_MAX
|
||||
}BTC_DBG_OPCODE,*PBTC_DBG_OPCODE;
|
||||
|
||||
typedef enum _BTC_RSSI_STATE{
|
||||
BTC_RSSI_STATE_HIGH = 0x0,
|
||||
BTC_RSSI_STATE_MEDIUM = 0x1,
|
||||
BTC_RSSI_STATE_LOW = 0x2,
|
||||
BTC_RSSI_STATE_STAY_HIGH = 0x3,
|
||||
BTC_RSSI_STATE_STAY_MEDIUM = 0x4,
|
||||
BTC_RSSI_STATE_STAY_LOW = 0x5,
|
||||
BTC_RSSI_MAX
|
||||
}BTC_RSSI_STATE,*PBTC_RSSI_STATE;
|
||||
#define BTC_RSSI_HIGH(_rssi_) ((_rssi_==BTC_RSSI_STATE_HIGH||_rssi_==BTC_RSSI_STATE_STAY_HIGH)? TRUE:FALSE)
|
||||
#define BTC_RSSI_MEDIUM(_rssi_) ((_rssi_==BTC_RSSI_STATE_MEDIUM||_rssi_==BTC_RSSI_STATE_STAY_MEDIUM)? TRUE:FALSE)
|
||||
#define BTC_RSSI_LOW(_rssi_) ((_rssi_==BTC_RSSI_STATE_LOW||_rssi_==BTC_RSSI_STATE_STAY_LOW)? TRUE:FALSE)
|
||||
|
||||
typedef enum _BTC_WIFI_ROLE{
|
||||
BTC_ROLE_STATION = 0x0,
|
||||
BTC_ROLE_AP = 0x1,
|
||||
BTC_ROLE_IBSS = 0x2,
|
||||
BTC_ROLE_HS_MODE = 0x3,
|
||||
BTC_ROLE_MAX
|
||||
}BTC_WIFI_ROLE,*PBTC_WIFI_ROLE;
|
||||
|
||||
typedef enum _BTC_WIRELESS_FREQ{
|
||||
BTC_FREQ_2_4G = 0x0,
|
||||
BTC_FREQ_5G = 0x1,
|
||||
BTC_FREQ_MAX
|
||||
}BTC_WIRELESS_FREQ,*PBTC_WIRELESS_FREQ;
|
||||
|
||||
typedef enum _BTC_WIFI_BW_MODE{
|
||||
BTC_WIFI_BW_LEGACY = 0x0,
|
||||
BTC_WIFI_BW_HT20 = 0x1,
|
||||
BTC_WIFI_BW_HT40 = 0x2,
|
||||
BTC_WIFI_BW_HT80 = 0x3,
|
||||
BTC_WIFI_BW_HT160 = 0x4,
|
||||
BTC_WIFI_BW_MAX
|
||||
}BTC_WIFI_BW_MODE,*PBTC_WIFI_BW_MODE;
|
||||
|
||||
typedef enum _BTC_WIFI_TRAFFIC_DIR{
|
||||
BTC_WIFI_TRAFFIC_TX = 0x0,
|
||||
BTC_WIFI_TRAFFIC_RX = 0x1,
|
||||
BTC_WIFI_TRAFFIC_MAX
|
||||
}BTC_WIFI_TRAFFIC_DIR,*PBTC_WIFI_TRAFFIC_DIR;
|
||||
|
||||
typedef enum _BTC_WIFI_PNP{
|
||||
BTC_WIFI_PNP_WAKE_UP = 0x0,
|
||||
BTC_WIFI_PNP_SLEEP = 0x1,
|
||||
BTC_WIFI_PNP_MAX
|
||||
}BTC_WIFI_PNP,*PBTC_WIFI_PNP;
|
||||
|
||||
typedef enum _BTC_IOT_PEER
|
||||
{
|
||||
BTC_IOT_PEER_UNKNOWN = 0,
|
||||
BTC_IOT_PEER_REALTEK = 1,
|
||||
BTC_IOT_PEER_REALTEK_92SE = 2,
|
||||
BTC_IOT_PEER_BROADCOM = 3,
|
||||
BTC_IOT_PEER_RALINK = 4,
|
||||
BTC_IOT_PEER_ATHEROS = 5,
|
||||
BTC_IOT_PEER_CISCO = 6,
|
||||
BTC_IOT_PEER_MERU = 7,
|
||||
BTC_IOT_PEER_MARVELL = 8,
|
||||
BTC_IOT_PEER_REALTEK_SOFTAP = 9,// peer is RealTek SOFT_AP, by Bohn, 2009.12.17
|
||||
BTC_IOT_PEER_SELF_SOFTAP = 10, // Self is SoftAP
|
||||
BTC_IOT_PEER_AIRGO = 11,
|
||||
BTC_IOT_PEER_INTEL = 12,
|
||||
BTC_IOT_PEER_RTK_APCLIENT = 13,
|
||||
BTC_IOT_PEER_REALTEK_81XX = 14,
|
||||
BTC_IOT_PEER_REALTEK_WOW = 15,
|
||||
BTC_IOT_PEER_REALTEK_JAGUAR_BCUTAP = 16,
|
||||
BTC_IOT_PEER_REALTEK_JAGUAR_CCUTAP = 17,
|
||||
BTC_IOT_PEER_MAX,
|
||||
}BTC_IOT_PEER, *PBTC_IOT_PEER;
|
||||
|
||||
//for 8723b-d cut large current issue
|
||||
typedef enum _BTC_WIFI_COEX_STATE{
|
||||
BTC_WIFI_STAT_INIT,
|
||||
BTC_WIFI_STAT_IQK,
|
||||
BTC_WIFI_STAT_NORMAL_OFF,
|
||||
BTC_WIFI_STAT_MP_OFF,
|
||||
BTC_WIFI_STAT_NORMAL,
|
||||
BTC_WIFI_STAT_ANT_DIV,
|
||||
BTC_WIFI_STAT_MAX
|
||||
}BTC_WIFI_COEX_STATE,*PBTC_WIFI_COEX_STATE;
|
||||
|
||||
typedef enum _BTC_ANT_TYPE{
|
||||
BTC_ANT_TYPE_0,
|
||||
BTC_ANT_TYPE_1,
|
||||
BTC_ANT_TYPE_2,
|
||||
BTC_ANT_TYPE_3,
|
||||
BTC_ANT_TYPE_4,
|
||||
BTC_ANT_TYPE_MAX
|
||||
}BTC_ANT_TYPE,*PBTC_ANT_TYPE;
|
||||
|
||||
typedef enum _BTC_VENDOR{
|
||||
BTC_VENDOR_LENOVO,
|
||||
BTC_VENDOR_ASUS,
|
||||
BTC_VENDOR_OTHER
|
||||
}BTC_VENDOR,*PBTC_VENDOR;
|
||||
|
||||
|
||||
// defined for BFP_BTC_GET
|
||||
typedef enum _BTC_GET_TYPE{
|
||||
// type BOOLEAN
|
||||
BTC_GET_BL_HS_OPERATION,
|
||||
BTC_GET_BL_HS_CONNECTING,
|
||||
BTC_GET_BL_WIFI_CONNECTED,
|
||||
BTC_GET_BL_WIFI_BUSY,
|
||||
BTC_GET_BL_WIFI_SCAN,
|
||||
BTC_GET_BL_WIFI_LINK,
|
||||
BTC_GET_BL_WIFI_ROAM,
|
||||
BTC_GET_BL_WIFI_4_WAY_PROGRESS,
|
||||
BTC_GET_BL_WIFI_UNDER_5G,
|
||||
BTC_GET_BL_WIFI_AP_MODE_ENABLE,
|
||||
BTC_GET_BL_WIFI_ENABLE_ENCRYPTION,
|
||||
BTC_GET_BL_WIFI_UNDER_B_MODE,
|
||||
BTC_GET_BL_EXT_SWITCH,
|
||||
BTC_GET_BL_WIFI_IS_IN_MP_MODE,
|
||||
BTC_GET_BL_IS_ASUS_8723B,
|
||||
|
||||
// type s4Byte
|
||||
BTC_GET_S4_WIFI_RSSI,
|
||||
BTC_GET_S4_HS_RSSI,
|
||||
|
||||
// type u4Byte
|
||||
BTC_GET_U4_WIFI_BW,
|
||||
BTC_GET_U4_WIFI_TRAFFIC_DIRECTION,
|
||||
BTC_GET_U4_WIFI_FW_VER,
|
||||
BTC_GET_U4_WIFI_LINK_STATUS,
|
||||
BTC_GET_U4_BT_PATCH_VER,
|
||||
BTC_GET_U4_VENDOR,
|
||||
|
||||
// type u1Byte
|
||||
BTC_GET_U1_WIFI_DOT11_CHNL,
|
||||
BTC_GET_U1_WIFI_CENTRAL_CHNL,
|
||||
BTC_GET_U1_WIFI_HS_CHNL,
|
||||
BTC_GET_U1_MAC_PHY_MODE,
|
||||
BTC_GET_U1_AP_NUM,
|
||||
BTC_GET_U1_ANT_TYPE,
|
||||
BTC_GET_U1_IOT_PEER,
|
||||
|
||||
//===== for 1Ant ======
|
||||
BTC_GET_U1_LPS_MODE,
|
||||
|
||||
BTC_GET_MAX
|
||||
}BTC_GET_TYPE,*PBTC_GET_TYPE;
|
||||
|
||||
// defined for BFP_BTC_SET
|
||||
typedef enum _BTC_SET_TYPE{
|
||||
// type BOOLEAN
|
||||
BTC_SET_BL_BT_DISABLE,
|
||||
BTC_SET_BL_BT_TRAFFIC_BUSY,
|
||||
BTC_SET_BL_BT_LIMITED_DIG,
|
||||
BTC_SET_BL_FORCE_TO_ROAM,
|
||||
BTC_SET_BL_TO_REJ_AP_AGG_PKT,
|
||||
BTC_SET_BL_BT_CTRL_AGG_SIZE,
|
||||
BTC_SET_BL_INC_SCAN_DEV_NUM,
|
||||
BTC_SET_BL_BT_TX_RX_MASK,
|
||||
BTC_SET_BL_MIRACAST_PLUS_BT,
|
||||
|
||||
// type u1Byte
|
||||
BTC_SET_U1_RSSI_ADJ_VAL_FOR_AGC_TABLE_ON,
|
||||
BTC_SET_U1_AGG_BUF_SIZE,
|
||||
|
||||
// type trigger some action
|
||||
BTC_SET_ACT_GET_BT_RSSI,
|
||||
BTC_SET_ACT_AGGREGATE_CTRL,
|
||||
BTC_SET_ACT_ANTPOSREGRISTRY_CTRL,
|
||||
//===== for 1Ant ======
|
||||
// type BOOLEAN
|
||||
|
||||
// type u1Byte
|
||||
BTC_SET_U1_RSSI_ADJ_VAL_FOR_1ANT_COEX_TYPE,
|
||||
BTC_SET_U1_LPS_VAL,
|
||||
BTC_SET_U1_RPWM_VAL,
|
||||
// type trigger some action
|
||||
BTC_SET_ACT_LEAVE_LPS,
|
||||
BTC_SET_ACT_ENTER_LPS,
|
||||
BTC_SET_ACT_NORMAL_LPS,
|
||||
BTC_SET_ACT_DISABLE_LOW_POWER,
|
||||
BTC_SET_ACT_UPDATE_RAMASK,
|
||||
BTC_SET_ACT_SEND_MIMO_PS,
|
||||
// BT Coex related
|
||||
BTC_SET_ACT_CTRL_BT_INFO,
|
||||
BTC_SET_ACT_CTRL_BT_COEX,
|
||||
BTC_SET_ACT_CTRL_8723B_ANT,
|
||||
//=================
|
||||
BTC_SET_MAX
|
||||
}BTC_SET_TYPE,*PBTC_SET_TYPE;
|
||||
|
||||
typedef enum _BTC_DBG_DISP_TYPE{
|
||||
BTC_DBG_DISP_COEX_STATISTICS = 0x0,
|
||||
BTC_DBG_DISP_BT_LINK_INFO = 0x1,
|
||||
BTC_DBG_DISP_WIFI_STATUS = 0x2,
|
||||
BTC_DBG_DISP_MAX
|
||||
}BTC_DBG_DISP_TYPE,*PBTC_DBG_DISP_TYPE;
|
||||
|
||||
typedef enum _BTC_NOTIFY_TYPE_IPS{
|
||||
BTC_IPS_LEAVE = 0x0,
|
||||
BTC_IPS_ENTER = 0x1,
|
||||
BTC_IPS_MAX
|
||||
}BTC_NOTIFY_TYPE_IPS,*PBTC_NOTIFY_TYPE_IPS;
|
||||
typedef enum _BTC_NOTIFY_TYPE_LPS{
|
||||
BTC_LPS_DISABLE = 0x0,
|
||||
BTC_LPS_ENABLE = 0x1,
|
||||
BTC_LPS_MAX
|
||||
}BTC_NOTIFY_TYPE_LPS,*PBTC_NOTIFY_TYPE_LPS;
|
||||
typedef enum _BTC_NOTIFY_TYPE_SCAN{
|
||||
BTC_SCAN_FINISH = 0x0,
|
||||
BTC_SCAN_START = 0x1,
|
||||
BTC_SCAN_MAX
|
||||
}BTC_NOTIFY_TYPE_SCAN,*PBTC_NOTIFY_TYPE_SCAN;
|
||||
typedef enum _BTC_NOTIFY_TYPE_ASSOCIATE{
|
||||
BTC_ASSOCIATE_FINISH = 0x0,
|
||||
BTC_ASSOCIATE_START = 0x1,
|
||||
BTC_ASSOCIATE_MAX
|
||||
}BTC_NOTIFY_TYPE_ASSOCIATE,*PBTC_NOTIFY_TYPE_ASSOCIATE;
|
||||
typedef enum _BTC_NOTIFY_TYPE_MEDIA_STATUS{
|
||||
BTC_MEDIA_DISCONNECT = 0x0,
|
||||
BTC_MEDIA_CONNECT = 0x1,
|
||||
BTC_MEDIA_MAX
|
||||
}BTC_NOTIFY_TYPE_MEDIA_STATUS,*PBTC_NOTIFY_TYPE_MEDIA_STATUS;
|
||||
typedef enum _BTC_NOTIFY_TYPE_SPECIFIC_PACKET{
|
||||
BTC_PACKET_UNKNOWN = 0x0,
|
||||
BTC_PACKET_DHCP = 0x1,
|
||||
BTC_PACKET_ARP = 0x2,
|
||||
BTC_PACKET_EAPOL = 0x3,
|
||||
BTC_PACKET_MAX
|
||||
}BTC_NOTIFY_TYPE_SPECIFIC_PACKET,*PBTC_NOTIFY_TYPE_SPECIFIC_PACKET;
|
||||
typedef enum _BTC_NOTIFY_TYPE_STACK_OPERATION{
|
||||
BTC_STACK_OP_NONE = 0x0,
|
||||
BTC_STACK_OP_INQ_PAGE_PAIR_START = 0x1,
|
||||
BTC_STACK_OP_INQ_PAGE_PAIR_FINISH = 0x2,
|
||||
BTC_STACK_OP_MAX
|
||||
}BTC_NOTIFY_TYPE_STACK_OPERATION,*PBTC_NOTIFY_TYPE_STACK_OPERATION;
|
||||
|
||||
//Bryant Add
|
||||
typedef enum _BTC_ANTENNA_POS{
|
||||
BTC_ANTENNA_AT_MAIN_PORT = 0x1,
|
||||
BTC_ANTENNA_AT_AUX_PORT = 0x2,
|
||||
}BTC_ANTENNA_POS,*PBTC_ANTENNA_POS;
|
||||
|
||||
//Bryant Add
|
||||
typedef enum _BTC_BT_OFFON{
|
||||
BTC_BT_OFF = 0x0,
|
||||
BTC_BT_ON = 0x1,
|
||||
}BTC_BTOFFON,*PBTC_BT_OFFON;
|
||||
|
||||
//==================================================
|
||||
// For following block is for coex offload
|
||||
//==================================================
|
||||
typedef struct _COL_H2C{
|
||||
u1Byte opcode;
|
||||
u1Byte opcode_ver:4;
|
||||
u1Byte req_num:4;
|
||||
u1Byte buf[1];
|
||||
}COL_H2C, *PCOL_H2C;
|
||||
|
||||
#define COL_C2H_ACK_HDR_LEN 3
|
||||
typedef struct _COL_C2H_ACK{
|
||||
u1Byte status;
|
||||
u1Byte opcode_ver:4;
|
||||
u1Byte req_num:4;
|
||||
u1Byte ret_len;
|
||||
u1Byte buf[1];
|
||||
}COL_C2H_ACK, *PCOL_C2H_ACK;
|
||||
|
||||
#define COL_C2H_IND_HDR_LEN 3
|
||||
typedef struct _COL_C2H_IND{
|
||||
u1Byte type;
|
||||
u1Byte version;
|
||||
u1Byte length;
|
||||
u1Byte data[1];
|
||||
}COL_C2H_IND, *PCOL_C2H_IND;
|
||||
|
||||
//============================================
|
||||
// NOTE: for debug message, the following define should match
|
||||
// the strings in coexH2cResultString.
|
||||
//============================================
|
||||
typedef enum _COL_H2C_STATUS{
|
||||
// c2h status
|
||||
COL_STATUS_C2H_OK = 0x00, // Wifi received H2C request and check content ok.
|
||||
COL_STATUS_C2H_UNKNOWN = 0x01, // Not handled routine
|
||||
COL_STATUS_C2H_UNKNOWN_OPCODE = 0x02, // Invalid OP code, It means that wifi firmware received an undefiend OP code.
|
||||
COL_STATUS_C2H_OPCODE_VER_MISMATCH = 0x03, // Wifi firmware and wifi driver mismatch, need to update wifi driver or wifi or.
|
||||
COL_STATUS_C2H_PARAMETER_ERROR = 0x04, // Error paraneter.(ex: parameters = NULL but it should have values)
|
||||
COL_STATUS_C2H_PARAMETER_OUT_OF_RANGE = 0x05, // Wifi firmware needs to check the parameters from H2C request and return the status.(ex: ch = 500, it's wrong)
|
||||
// other COL status start from here
|
||||
COL_STATUS_C2H_REQ_NUM_MISMATCH , // c2h req_num mismatch, means this c2h is not we expected.
|
||||
COL_STATUS_H2C_HALMAC_FAIL , // HALMAC return fail.
|
||||
COL_STATUS_H2C_TIMTOUT , // not received the c2h response from fw
|
||||
COL_STATUS_INVALID_C2H_LEN , // invalid coex offload c2h ack length, must >= 3
|
||||
COL_STATUS_COEX_DATA_OVERFLOW , // coex returned length over the c2h ack length.
|
||||
COL_STATUS_MAX
|
||||
}COL_H2C_STATUS,*PCOL_H2C_STATUS;
|
||||
|
||||
#define COL_MAX_H2C_REQ_NUM 16
|
||||
|
||||
#define COL_H2C_BUF_LEN 20
|
||||
typedef enum _COL_OPCODE{
|
||||
COL_OP_WIFI_STATUS_NOTIFY = 0x0,
|
||||
COL_OP_WIFI_PROGRESS_NOTIFY = 0x1,
|
||||
COL_OP_WIFI_INFO_NOTIFY = 0x2,
|
||||
COL_OP_WIFI_POWER_STATE_NOTIFY = 0x3,
|
||||
COL_OP_SET_CONTROL = 0x4,
|
||||
COL_OP_GET_CONTROL = 0x5,
|
||||
COL_OP_WIFI_OPCODE_MAX
|
||||
}COL_OPCODE,*PCOL_OPCODE;
|
||||
|
||||
typedef enum _COL_IND_TYPE{
|
||||
COL_IND_BT_INFO = 0x0,
|
||||
COL_IND_PSTDMA = 0x1,
|
||||
COL_IND_LIMITED_TX_RX = 0x2,
|
||||
COL_IND_COEX_TABLE = 0x3,
|
||||
COL_IND_REQ = 0x4,
|
||||
COL_IND_MAX
|
||||
}COL_IND_TYPE,*PCOL_IND_TYPE;
|
||||
|
||||
typedef struct _COL_SINGLE_H2C_RECORD{
|
||||
u1Byte h2c_buf[COL_H2C_BUF_LEN]; // the latest sent h2c buffer
|
||||
u4Byte h2c_len;
|
||||
u1Byte c2h_ack_buf[COL_H2C_BUF_LEN]; // the latest received c2h buffer
|
||||
u4Byte c2h_ack_len;
|
||||
u4Byte count; // the total number of the sent h2c command
|
||||
u4Byte status[COL_STATUS_MAX]; // the c2h status for the sent h2c command
|
||||
} COL_SINGLE_H2C_RECORD, *PCOL_SINGLE_H2C_RECORD;
|
||||
|
||||
typedef struct _COL_SINGLE_C2H_IND_RECORD{
|
||||
u1Byte ind_buf[COL_H2C_BUF_LEN]; // the latest received c2h indication buffer
|
||||
u4Byte ind_len;
|
||||
u4Byte count; // the total number of the rcvd c2h indication
|
||||
u4Byte status[COL_STATUS_MAX]; // the c2h indication verified status
|
||||
} COL_SINGLE_C2H_IND_RECORD, *PCOL_SINGLE_C2H_IND_RECORD;
|
||||
|
||||
typedef struct _BTC_OFFLOAD{
|
||||
// H2C command related
|
||||
u1Byte h2c_req_num;
|
||||
u4Byte cnt_h2c_sent;
|
||||
COL_SINGLE_H2C_RECORD h2c_record[COL_OP_WIFI_OPCODE_MAX];
|
||||
|
||||
// C2H Ack related
|
||||
u4Byte cnt_c2h_ack;
|
||||
u4Byte status[COL_STATUS_MAX];
|
||||
struct completion c2h_event[COL_MAX_H2C_REQ_NUM]; // for req_num = 1~COL_MAX_H2C_REQ_NUM
|
||||
u1Byte c2h_ack_buf[COL_MAX_H2C_REQ_NUM][COL_H2C_BUF_LEN];
|
||||
u1Byte c2h_ack_len[COL_MAX_H2C_REQ_NUM];
|
||||
|
||||
// C2H Indication related
|
||||
u4Byte cnt_c2h_ind;
|
||||
COL_SINGLE_C2H_IND_RECORD c2h_ind_record[COL_IND_MAX];
|
||||
u4Byte c2h_ind_status[COL_STATUS_MAX];
|
||||
u1Byte c2h_ind_buf[COL_H2C_BUF_LEN];
|
||||
u1Byte c2h_ind_len;
|
||||
} BTC_OFFLOAD, *PBTC_OFFLOAD;
|
||||
extern BTC_OFFLOAD gl_coex_offload;
|
||||
//==================================================
|
||||
|
||||
typedef u1Byte
|
||||
(*BFP_BTC_R1)(
|
||||
IN PVOID pBtcContext,
|
||||
IN u4Byte RegAddr
|
||||
);
|
||||
typedef u2Byte
|
||||
(*BFP_BTC_R2)(
|
||||
IN PVOID pBtcContext,
|
||||
IN u4Byte RegAddr
|
||||
);
|
||||
typedef u4Byte
|
||||
(*BFP_BTC_R4)(
|
||||
IN PVOID pBtcContext,
|
||||
IN u4Byte RegAddr
|
||||
);
|
||||
typedef VOID
|
||||
(*BFP_BTC_W1)(
|
||||
IN PVOID pBtcContext,
|
||||
IN u4Byte RegAddr,
|
||||
IN u1Byte Data
|
||||
);
|
||||
typedef VOID
|
||||
(*BFP_BTC_W1_BIT_MASK)(
|
||||
IN PVOID pBtcContext,
|
||||
IN u4Byte regAddr,
|
||||
IN u1Byte bitMask,
|
||||
IN u1Byte data1b
|
||||
);
|
||||
typedef VOID
|
||||
(*BFP_BTC_W2)(
|
||||
IN PVOID pBtcContext,
|
||||
IN u4Byte RegAddr,
|
||||
IN u2Byte Data
|
||||
);
|
||||
typedef VOID
|
||||
(*BFP_BTC_W4)(
|
||||
IN PVOID pBtcContext,
|
||||
IN u4Byte RegAddr,
|
||||
IN u4Byte Data
|
||||
);
|
||||
typedef VOID
|
||||
(*BFP_BTC_LOCAL_REG_W1)(
|
||||
IN PVOID pBtcContext,
|
||||
IN u4Byte RegAddr,
|
||||
IN u1Byte Data
|
||||
);
|
||||
typedef VOID
|
||||
(*BFP_BTC_SET_BB_REG)(
|
||||
IN PVOID pBtcContext,
|
||||
IN u4Byte RegAddr,
|
||||
IN u4Byte BitMask,
|
||||
IN u4Byte Data
|
||||
);
|
||||
typedef u4Byte
|
||||
(*BFP_BTC_GET_BB_REG)(
|
||||
IN PVOID pBtcContext,
|
||||
IN u4Byte RegAddr,
|
||||
IN u4Byte BitMask
|
||||
);
|
||||
typedef VOID
|
||||
(*BFP_BTC_SET_RF_REG)(
|
||||
IN PVOID pBtcContext,
|
||||
IN u1Byte eRFPath,
|
||||
IN u4Byte RegAddr,
|
||||
IN u4Byte BitMask,
|
||||
IN u4Byte Data
|
||||
);
|
||||
typedef u4Byte
|
||||
(*BFP_BTC_GET_RF_REG)(
|
||||
IN PVOID pBtcContext,
|
||||
IN u1Byte eRFPath,
|
||||
IN u4Byte RegAddr,
|
||||
IN u4Byte BitMask
|
||||
);
|
||||
typedef VOID
|
||||
(*BFP_BTC_FILL_H2C)(
|
||||
IN PVOID pBtcContext,
|
||||
IN u1Byte elementId,
|
||||
IN u4Byte cmdLen,
|
||||
IN pu1Byte pCmdBuffer
|
||||
);
|
||||
|
||||
typedef BOOLEAN
|
||||
(*BFP_BTC_GET)(
|
||||
IN PVOID pBtCoexist,
|
||||
IN u1Byte getType,
|
||||
OUT PVOID pOutBuf
|
||||
);
|
||||
|
||||
typedef BOOLEAN
|
||||
(*BFP_BTC_SET)(
|
||||
IN PVOID pBtCoexist,
|
||||
IN u1Byte setType,
|
||||
OUT PVOID pInBuf
|
||||
);
|
||||
typedef u2Byte
|
||||
(*BFP_BTC_SET_BT_REG)(
|
||||
IN PVOID pBtcContext,
|
||||
IN u1Byte regType,
|
||||
IN u4Byte offset,
|
||||
IN u4Byte value
|
||||
);
|
||||
typedef BOOLEAN
|
||||
(*BFP_BTC_SET_BT_ANT_DETECTION)(
|
||||
IN PVOID pBtcContext,
|
||||
IN u1Byte txTime,
|
||||
IN u1Byte btChnl
|
||||
);
|
||||
typedef u2Byte
|
||||
(*BFP_BTC_GET_BT_REG)(
|
||||
IN PVOID pBtcContext,
|
||||
IN u1Byte regType,
|
||||
IN u4Byte offset,
|
||||
IN pu4Byte data
|
||||
);
|
||||
typedef VOID
|
||||
(*BFP_BTC_DISP_DBG_MSG)(
|
||||
IN PVOID pBtCoexist,
|
||||
IN u1Byte dispType
|
||||
);
|
||||
|
||||
typedef COL_H2C_STATUS
|
||||
(*BFP_BTC_COEX_H2C_PROCESS)(
|
||||
IN PVOID pBtCoexist,
|
||||
IN u1Byte opcode,
|
||||
IN u1Byte opcode_ver,
|
||||
IN pu1Byte ph2c_par,
|
||||
IN u1Byte h2c_par_len
|
||||
);
|
||||
|
||||
typedef struct _BTC_BT_INFO{
|
||||
BOOLEAN bBtDisabled;
|
||||
u1Byte rssiAdjustForAgcTableOn;
|
||||
u1Byte rssiAdjustFor1AntCoexType;
|
||||
BOOLEAN bPreBtCtrlAggBufSize;
|
||||
BOOLEAN bBtCtrlAggBufSize;
|
||||
BOOLEAN bPreRejectAggPkt;
|
||||
BOOLEAN bRejectAggPkt;
|
||||
BOOLEAN bIncreaseScanDevNum;
|
||||
BOOLEAN bBtTxRxMask;
|
||||
u1Byte preAggBufSize;
|
||||
u1Byte aggBufSize;
|
||||
BOOLEAN bBtBusy;
|
||||
BOOLEAN bLimitedDig;
|
||||
u2Byte btHciVer;
|
||||
u2Byte btRealFwVer;
|
||||
u1Byte btFwVer;
|
||||
u4Byte getBtFwVerCnt;
|
||||
BOOLEAN bMiracastPlusBt;
|
||||
|
||||
BOOLEAN bBtDisableLowPwr;
|
||||
|
||||
BOOLEAN bBtCtrlLps;
|
||||
BOOLEAN bBtLpsOn;
|
||||
BOOLEAN bForceToRoam; // for 1Ant solution
|
||||
u1Byte lpsVal;
|
||||
u1Byte rpwmVal;
|
||||
u4Byte raMask;
|
||||
} BTC_BT_INFO, *PBTC_BT_INFO;
|
||||
|
||||
struct btc_stack_info {
|
||||
boolean profile_notified;
|
||||
u16 hci_version; /* stack hci version */
|
||||
u8 num_of_link;
|
||||
boolean bt_link_exist;
|
||||
boolean sco_exist;
|
||||
boolean acl_exist;
|
||||
boolean a2dp_exist;
|
||||
boolean hid_exist;
|
||||
u8 num_of_hid;
|
||||
boolean pan_exist;
|
||||
boolean unknown_acl_exist;
|
||||
s8 min_bt_rssi;
|
||||
};
|
||||
|
||||
struct btc_bt_link_info {
|
||||
boolean bt_link_exist;
|
||||
boolean bt_hi_pri_link_exist;
|
||||
boolean sco_exist;
|
||||
boolean sco_only;
|
||||
boolean a2dp_exist;
|
||||
boolean a2dp_only;
|
||||
boolean hid_exist;
|
||||
boolean hid_only;
|
||||
boolean pan_exist;
|
||||
boolean pan_only;
|
||||
boolean slave_role;
|
||||
boolean acl_busy;
|
||||
};
|
||||
|
||||
typedef struct _BTC_STATISTICS{
|
||||
u4Byte cntBind;
|
||||
u4Byte cntPowerOn;
|
||||
u4Byte cntPreLoadFirmware;
|
||||
u4Byte cntInitHwConfig;
|
||||
u4Byte cntInitCoexDm;
|
||||
u4Byte cntIpsNotify;
|
||||
u4Byte cntLpsNotify;
|
||||
u4Byte cntScanNotify;
|
||||
u4Byte cntConnectNotify;
|
||||
u4Byte cntMediaStatusNotify;
|
||||
u4Byte cntSpecificPacketNotify;
|
||||
u4Byte cntBtInfoNotify;
|
||||
u4Byte cntRfStatusNotify;
|
||||
u4Byte cntPeriodical;
|
||||
u4Byte cntCoexDmSwitch;
|
||||
u4Byte cntStackOperationNotify;
|
||||
u4Byte cntDbgCtrl;
|
||||
} BTC_STATISTICS, *PBTC_STATISTICS;
|
||||
|
||||
struct btc_coexist{
|
||||
BOOLEAN bBinded; // make sure only one adapter can bind the data context
|
||||
PVOID Adapter; // default adapter
|
||||
struct btc_board_info board_info;
|
||||
BTC_BT_INFO btInfo; // some bt info referenced by non-bt module
|
||||
struct btc_stack_info stack_info;
|
||||
struct btc_bt_link_info bt_link_info;
|
||||
BTC_CHIP_INTERFACE chip_interface;
|
||||
|
||||
BOOLEAN initilized;
|
||||
BOOLEAN stop_coex_dm;
|
||||
BOOLEAN manual_control;
|
||||
pu1Byte cli_buf;
|
||||
BTC_STATISTICS statistics;
|
||||
u1Byte pwrModeVal[10];
|
||||
|
||||
// function pointers
|
||||
// io related
|
||||
BFP_BTC_R1 btc_read_1byte;
|
||||
BFP_BTC_W1 btc_write_1byte;
|
||||
BFP_BTC_W1_BIT_MASK btc_write_1byte_bitmask;
|
||||
BFP_BTC_R2 btc_read_2byte;
|
||||
BFP_BTC_W2 btc_write_2byte;
|
||||
BFP_BTC_R4 btc_read_4byte;
|
||||
BFP_BTC_W4 btc_write_4byte;
|
||||
BFP_BTC_LOCAL_REG_W1 btc_write_local_reg_1byte;
|
||||
// read/write bb related
|
||||
BFP_BTC_SET_BB_REG btc_set_bb_reg;
|
||||
BFP_BTC_GET_BB_REG btc_get_bb_reg;
|
||||
|
||||
// read/write rf related
|
||||
BFP_BTC_SET_RF_REG btc_set_rf_reg;
|
||||
BFP_BTC_GET_RF_REG btc_get_rf_reg;
|
||||
|
||||
// fill h2c related
|
||||
BFP_BTC_FILL_H2C btc_fill_h2c;
|
||||
// other
|
||||
BFP_BTC_DISP_DBG_MSG btc_disp_dbg_msg;
|
||||
// normal get/set related
|
||||
BFP_BTC_GET btc_get;
|
||||
BFP_BTC_SET btc_set;
|
||||
|
||||
BFP_BTC_GET_BT_REG btc_get_bt_reg;
|
||||
BFP_BTC_SET_BT_REG btc_set_bt_reg;
|
||||
|
||||
BFP_BTC_SET_BT_ANT_DETECTION btc_set_bt_ant_detection;
|
||||
|
||||
BFP_BTC_COEX_H2C_PROCESS btc_coex_h2c_process;
|
||||
};
|
||||
typedef struct btc_coexist *PBTC_COEXIST;
|
||||
|
||||
extern struct btc_coexist GLBtCoexist;
|
||||
|
||||
BOOLEAN
|
||||
EXhalbtcoutsrc_InitlizeVariables(
|
||||
IN PVOID Adapter
|
||||
);
|
||||
VOID
|
||||
EXhalbtcoutsrc_PowerOnSetting(
|
||||
IN PBTC_COEXIST pBtCoexist
|
||||
);
|
||||
VOID
|
||||
EXhalbtcoutsrc_PreLoadFirmware(
|
||||
IN PBTC_COEXIST pBtCoexist
|
||||
);
|
||||
VOID
|
||||
EXhalbtcoutsrc_InitHwConfig(
|
||||
IN PBTC_COEXIST pBtCoexist,
|
||||
IN BOOLEAN bWifiOnly
|
||||
);
|
||||
VOID
|
||||
EXhalbtcoutsrc_InitCoexDm(
|
||||
IN PBTC_COEXIST pBtCoexist
|
||||
);
|
||||
VOID
|
||||
EXhalbtcoutsrc_IpsNotify(
|
||||
IN PBTC_COEXIST pBtCoexist,
|
||||
IN u1Byte type
|
||||
);
|
||||
VOID
|
||||
EXhalbtcoutsrc_LpsNotify(
|
||||
IN PBTC_COEXIST pBtCoexist,
|
||||
IN u1Byte type
|
||||
);
|
||||
VOID
|
||||
EXhalbtcoutsrc_ScanNotify(
|
||||
IN PBTC_COEXIST pBtCoexist,
|
||||
IN u1Byte type
|
||||
);
|
||||
VOID
|
||||
EXhalbtcoutsrc_ConnectNotify(
|
||||
IN PBTC_COEXIST pBtCoexist,
|
||||
IN u1Byte action
|
||||
);
|
||||
VOID
|
||||
EXhalbtcoutsrc_MediaStatusNotify(
|
||||
IN PBTC_COEXIST pBtCoexist,
|
||||
IN RT_MEDIA_STATUS mediaStatus
|
||||
);
|
||||
VOID
|
||||
EXhalbtcoutsrc_SpecificPacketNotify(
|
||||
IN PBTC_COEXIST pBtCoexist,
|
||||
IN u1Byte pktType
|
||||
);
|
||||
VOID
|
||||
EXhalbtcoutsrc_BtInfoNotify(
|
||||
IN PBTC_COEXIST pBtCoexist,
|
||||
IN pu1Byte tmpBuf,
|
||||
IN u1Byte length
|
||||
);
|
||||
VOID
|
||||
EXhalbtcoutsrc_RfStatusNotify(
|
||||
IN PBTC_COEXIST pBtCoexist,
|
||||
IN u1Byte type
|
||||
);
|
||||
VOID
|
||||
EXhalbtcoutsrc_StackOperationNotify(
|
||||
IN PBTC_COEXIST pBtCoexist,
|
||||
IN u1Byte type
|
||||
);
|
||||
VOID
|
||||
EXhalbtcoutsrc_HaltNotify(
|
||||
IN PBTC_COEXIST pBtCoexist
|
||||
);
|
||||
VOID
|
||||
EXhalbtcoutsrc_PnpNotify(
|
||||
IN PBTC_COEXIST pBtCoexist,
|
||||
IN u1Byte pnpState
|
||||
);
|
||||
VOID
|
||||
EXhalbtcoutsrc_ScoreBoardStatusNotify(
|
||||
IN PBTC_COEXIST pBtCoexist,
|
||||
IN pu1Byte tmpBuf,
|
||||
IN u1Byte length
|
||||
);
|
||||
VOID
|
||||
EXhalbtcoutsrc_CoexDmSwitch(
|
||||
IN PBTC_COEXIST pBtCoexist
|
||||
);
|
||||
VOID
|
||||
EXhalbtcoutsrc_Periodical(
|
||||
IN PBTC_COEXIST pBtCoexist
|
||||
);
|
||||
VOID
|
||||
EXhalbtcoutsrc_DbgControl(
|
||||
IN PBTC_COEXIST pBtCoexist,
|
||||
IN u1Byte opCode,
|
||||
IN u1Byte opLen,
|
||||
IN pu1Byte pData
|
||||
);
|
||||
VOID
|
||||
EXhalbtcoutsrc_AntennaDetection(
|
||||
IN PBTC_COEXIST pBtCoexist,
|
||||
IN u4Byte centFreq,
|
||||
IN u4Byte offset,
|
||||
IN u4Byte span,
|
||||
IN u4Byte seconds
|
||||
);
|
||||
VOID
|
||||
EXhalbtcoutsrc_StackUpdateProfileInfo(
|
||||
VOID
|
||||
);
|
||||
VOID
|
||||
EXhalbtcoutsrc_SetHciVersion(
|
||||
IN u2Byte hciVersion
|
||||
);
|
||||
VOID
|
||||
EXhalbtcoutsrc_SetBtPatchVersion(
|
||||
IN u2Byte btHciVersion,
|
||||
IN u2Byte btPatchVersion
|
||||
);
|
||||
VOID
|
||||
EXhalbtcoutsrc_UpdateMinBtRssi(
|
||||
IN s1Byte btRssi
|
||||
);
|
||||
#if 0
|
||||
VOID
|
||||
EXhalbtcoutsrc_SetBtExist(
|
||||
IN BOOLEAN bBtExist
|
||||
);
|
||||
#endif
|
||||
VOID
|
||||
EXhalbtcoutsrc_SetChipType(
|
||||
IN u1Byte chipType
|
||||
);
|
||||
VOID
|
||||
EXhalbtcoutsrc_SetAntNum(
|
||||
IN u1Byte type,
|
||||
IN u1Byte antNum
|
||||
);
|
||||
VOID
|
||||
EXhalbtcoutsrc_SetSingleAntPath(
|
||||
IN u1Byte singleAntPath
|
||||
);
|
||||
VOID
|
||||
EXhalbtcoutsrc_DisplayBtCoexInfo(
|
||||
IN PBTC_COEXIST pBtCoexist
|
||||
);
|
||||
VOID
|
||||
EXhalbtcoutsrc_DisplayAntDetection(
|
||||
IN PBTC_COEXIST pBtCoexist
|
||||
);
|
||||
|
||||
|
||||
#define MASKBYTE0 0xff
|
||||
#define MASKBYTE1 0xff00
|
||||
#define MASKBYTE2 0xff0000
|
||||
#define MASKBYTE3 0xff000000
|
||||
#define MASKHWORD 0xffff0000
|
||||
#define MASKLWORD 0x0000ffff
|
||||
#define MASKDWORD 0xffffffff
|
||||
#define MASK12BITS 0xfff
|
||||
#define MASKH4BITS 0xf0000000
|
||||
#define MASKOFDM_D 0xffc00000
|
||||
#define MASKCCK 0x3f3f3f3f
|
||||
|
||||
#endif
|
||||
98
hal/btc/Mp_Precomp.h
Normal file
98
hal/btc/Mp_Precomp.h
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2013 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef __MP_PRECOMP_H__
|
||||
#define __MP_PRECOMP_H__
|
||||
|
||||
#include <drv_types.h>
|
||||
#include <hal_data.h>
|
||||
|
||||
#define BT_TMP_BUF_SIZE 100
|
||||
|
||||
#ifdef PLATFORM_LINUX
|
||||
#define rsprintf snprintf
|
||||
#elif defined(PLATFORM_WINDOWS)
|
||||
#define rsprintf sprintf_s
|
||||
#endif
|
||||
|
||||
#define DCMD_Printf DBG_BT_INFO
|
||||
|
||||
#define delay_ms(ms) rtw_mdelay_os(ms)
|
||||
|
||||
#ifdef bEnable
|
||||
#undef bEnable
|
||||
#endif
|
||||
|
||||
#define WPP_SOFTWARE_TRACE 0
|
||||
|
||||
typedef enum _BTC_MSG_COMP_TYPE{
|
||||
COMP_COEX = 0,
|
||||
COMP_MAX
|
||||
}BTC_MSG_COMP_TYPE;
|
||||
extern u4Byte GLBtcDbgType[];
|
||||
|
||||
#define DBG_OFF 0
|
||||
#define DBG_SEC 1
|
||||
#define DBG_SERIOUS 2
|
||||
#define DBG_WARNING 3
|
||||
#define DBG_LOUD 4
|
||||
#define DBG_TRACE 5
|
||||
|
||||
#if DBG
|
||||
#ifdef RT_TRACE
|
||||
#undef RT_TRACE
|
||||
#define RT_TRACE(dbgtype, dbgflag, printstr)\
|
||||
do {\
|
||||
if (GLBtcDbgType[dbgtype] & BIT(dbgflag))\
|
||||
{\
|
||||
DbgPrint printstr;\
|
||||
}\
|
||||
} while (0)
|
||||
#endif
|
||||
#else
|
||||
#define RT_TRACE(dbgtype, dbgflag, printstr)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BT_COEXIST
|
||||
#define BT_SUPPORT 1
|
||||
#define COEX_SUPPORT 1
|
||||
#define HS_SUPPORT 1
|
||||
#else
|
||||
#define BT_SUPPORT 0
|
||||
#define COEX_SUPPORT 0
|
||||
#define HS_SUPPORT 0
|
||||
#endif
|
||||
|
||||
#include "HalBtcOutSrc.h"
|
||||
#include "HalBtc8188c2Ant.h"
|
||||
#include "HalBtc8192d2Ant.h"
|
||||
#include "HalBtc8192e1Ant.h"
|
||||
#include "HalBtc8192e2Ant.h"
|
||||
#include "HalBtc8723a1Ant.h"
|
||||
#include "HalBtc8723a2Ant.h"
|
||||
#include "HalBtc8723b1Ant.h"
|
||||
#include "HalBtc8723b2Ant.h"
|
||||
#include "HalBtc8812a1Ant.h"
|
||||
#include "HalBtc8812a2Ant.h"
|
||||
#include "HalBtc8821a1Ant.h"
|
||||
#include "HalBtc8821a2Ant.h"
|
||||
#include "HalBtc8821aCsr2Ant.h"
|
||||
#include "HalBtc8703b1Ant.h"
|
||||
|
||||
#endif // __MP_PRECOMP_H__
|
||||
80
hal/efuse/efuse_mask.h
Normal file
80
hal/efuse/efuse_mask.h
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
|
||||
#if DEV_BUS_TYPE == RT_USB_INTERFACE
|
||||
|
||||
#if defined(CONFIG_RTL8188E)
|
||||
#include "rtl8188e/HalEfuseMask8188E_USB.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8812A)
|
||||
#include "rtl8812a/HalEfuseMask8812A_USB.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8821A)
|
||||
#include "rtl8812a/HalEfuseMask8821A_USB.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8192E)
|
||||
#include "rtl8192e/HalEfuseMask8192E_USB.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8723B)
|
||||
#include "rtl8723b/HalEfuseMask8723B_USB.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8814A)
|
||||
#include "rtl8814a/HalEfuseMask8814A_USB.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8703B)
|
||||
#include "rtl8703b/HalEfuseMask8703B_USB.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8188F)
|
||||
#include "rtl8188f/HalEfuseMask8188F_USB.h"
|
||||
#endif
|
||||
|
||||
#elif DEV_BUS_TYPE == RT_PCI_INTERFACE
|
||||
|
||||
#if defined(CONFIG_RTL8188E)
|
||||
#include "rtl8188e/HalEfuseMask8188E_PCIE.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8812A)
|
||||
#include "rtl8812a/HalEfuseMask8812A_PCIE.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8821A)
|
||||
#include "rtl8812a/HalEfuseMask8821A_PCIE.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8192E)
|
||||
#include "rtl8192e/HalEfuseMask8192E_PCIE.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8723B)
|
||||
#include "rtl8723b/HalEfuseMask8723B_PCIE.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8814A)
|
||||
#include "rtl8814a/HalEfuseMask8814A_PCIE.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8703B)
|
||||
#include "rtl8703b/HalEfuseMask8703B_PCIE.h"
|
||||
#endif
|
||||
|
||||
#elif DEV_BUS_TYPE == RT_SDIO_INTERFACE
|
||||
|
||||
#if defined(CONFIG_RTL8188E)
|
||||
#include "rtl8188e/HalEfuseMask8188E_SDIO.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8703B)
|
||||
#include "rtl8703b/HalEfuseMask8703B_SDIO.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8188F)
|
||||
#include "rtl8188f/HalEfuseMask8188F_SDIO.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
101
hal/efuse/rtl8703b/HalEfuseMask8703B_PCIE.c
Normal file
101
hal/efuse/rtl8703b/HalEfuseMask8703B_PCIE.c
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
//#include "Mp_Precomp.h"
|
||||
//#include "../odm_precomp.h"
|
||||
|
||||
#include <drv_types.h>
|
||||
#include "HalEfuseMask8703B_PCIE.h"
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* MPCIE.TXT
|
||||
******************************************************************************/
|
||||
|
||||
u1Byte Array_MP_8703B_MPCIE[] = {
|
||||
0xFF,
|
||||
0xF3,
|
||||
0x00,
|
||||
0x0E,
|
||||
0x70,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x07,
|
||||
0xF3,
|
||||
0xFF,
|
||||
0xFF,
|
||||
0xFF,
|
||||
0xFF,
|
||||
0xFF,
|
||||
0xF1,
|
||||
0x00,
|
||||
0x80,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
|
||||
};
|
||||
|
||||
u2Byte
|
||||
EFUSE_GetArrayLen_MP_8703B_MPCIE(VOID)
|
||||
{
|
||||
return sizeof(Array_MP_8703B_MPCIE)/sizeof(u1Byte);
|
||||
}
|
||||
|
||||
VOID
|
||||
EFUSE_GetMaskArray_MP_8703B_MPCIE(
|
||||
IN OUT pu1Byte Array
|
||||
)
|
||||
{
|
||||
u2Byte len = EFUSE_GetArrayLen_MP_8703B_MPCIE(), i = 0;
|
||||
|
||||
for (i = 0; i < len; ++i)
|
||||
Array[i] = Array_MP_8703B_MPCIE[i];
|
||||
}
|
||||
BOOLEAN
|
||||
EFUSE_IsAddressMasked_MP_8703B_MPCIE(
|
||||
IN u2Byte Offset
|
||||
)
|
||||
{
|
||||
int r = Offset/16;
|
||||
int c = (Offset%16) / 2;
|
||||
int result = 0;
|
||||
|
||||
if (c < 4) // Upper double word
|
||||
result = (Array_MP_8703B_MPCIE[r] & (0x10 << c));
|
||||
else
|
||||
result = (Array_MP_8703B_MPCIE[r] & (0x01 << (c-4)));
|
||||
|
||||
return (result > 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
|
||||
40
hal/efuse/rtl8703b/HalEfuseMask8703B_PCIE.h
Normal file
40
hal/efuse/rtl8703b/HalEfuseMask8703B_PCIE.h
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* MPCIE.TXT
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
u2Byte
|
||||
EFUSE_GetArrayLen_MP_8703B_MPCIE(VOID);
|
||||
|
||||
VOID
|
||||
EFUSE_GetMaskArray_MP_8703B_MPCIE(
|
||||
IN OUT pu1Byte Array
|
||||
);
|
||||
|
||||
BOOLEAN
|
||||
EFUSE_IsAddressMasked_MP_8703B_MPCIE( // TC: Test Chip, MP: MP Chip
|
||||
IN u2Byte Offset
|
||||
);
|
||||
|
||||
|
||||
102
hal/efuse/rtl8703b/HalEfuseMask8703B_SDIO.c
Normal file
102
hal/efuse/rtl8703b/HalEfuseMask8703B_SDIO.c
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
//#include "Mp_Precomp.h"
|
||||
//#include "../odm_precomp.h"
|
||||
|
||||
#include <drv_types.h>
|
||||
#include "HalEfuseMask8703B_SDIO.h"
|
||||
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* MSDIO.TXT
|
||||
******************************************************************************/
|
||||
|
||||
u1Byte Array_MP_8703B_MSDIO[] = {
|
||||
0xFF,
|
||||
0xF3,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x0F,
|
||||
0xF1,
|
||||
0xFF,
|
||||
0xFF,
|
||||
0xFF,
|
||||
0xFF,
|
||||
0xFF,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
|
||||
};
|
||||
|
||||
u2Byte
|
||||
EFUSE_GetArrayLen_MP_8703B_MSDIO(VOID)
|
||||
{
|
||||
return sizeof(Array_MP_8703B_MSDIO)/sizeof(u1Byte);
|
||||
}
|
||||
|
||||
VOID
|
||||
EFUSE_GetMaskArray_MP_8703B_MSDIO(
|
||||
IN OUT pu1Byte Array
|
||||
)
|
||||
{
|
||||
u2Byte len = EFUSE_GetArrayLen_MP_8703B_MSDIO(), i = 0;
|
||||
|
||||
for (i = 0; i < len; ++i)
|
||||
Array[i] = Array_MP_8703B_MSDIO[i];
|
||||
}
|
||||
BOOLEAN
|
||||
EFUSE_IsAddressMasked_MP_8703B_MSDIO(
|
||||
IN u2Byte Offset
|
||||
)
|
||||
{
|
||||
int r = Offset/16;
|
||||
int c = (Offset%16) / 2;
|
||||
int result = 0;
|
||||
|
||||
if (c < 4) // Upper double word
|
||||
result = (Array_MP_8703B_MSDIO[r] & (0x10 << c));
|
||||
else
|
||||
result = (Array_MP_8703B_MSDIO[r] & (0x01 << (c-4)));
|
||||
|
||||
return (result > 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
|
||||
41
hal/efuse/rtl8703b/HalEfuseMask8703B_SDIO.h
Normal file
41
hal/efuse/rtl8703b/HalEfuseMask8703B_SDIO.h
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* MSDIO.TXT
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
u2Byte
|
||||
EFUSE_GetArrayLen_MP_8703B_MSDIO(VOID);
|
||||
|
||||
VOID
|
||||
EFUSE_GetMaskArray_MP_8703B_MSDIO(
|
||||
IN OUT pu1Byte Array
|
||||
);
|
||||
|
||||
BOOLEAN
|
||||
EFUSE_IsAddressMasked_MP_8703B_MSDIO( // TC: Test Chip, MP: MP Chip
|
||||
IN u2Byte Offset
|
||||
);
|
||||
|
||||
|
||||
99
hal/efuse/rtl8703b/HalEfuseMask8703B_USB.c
Normal file
99
hal/efuse/rtl8703b/HalEfuseMask8703B_USB.c
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
//#include "Mp_Precomp.h"
|
||||
//#include "../odm_precomp.h"
|
||||
|
||||
#include <drv_types.h>
|
||||
#include "HalEfuseMask8703B_USB.h"
|
||||
/******************************************************************************
|
||||
* MUSB.TXT
|
||||
******************************************************************************/
|
||||
|
||||
u1Byte Array_MP_8703B_MUSB[] = {
|
||||
0xFF,
|
||||
0xF3,
|
||||
0x00,
|
||||
0x0E,
|
||||
0x70,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x07,
|
||||
0xF1,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0xFF,
|
||||
0xFF,
|
||||
0xFF,
|
||||
0xFF,
|
||||
0xB0,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
|
||||
};
|
||||
|
||||
u2Byte
|
||||
EFUSE_GetArrayLen_MP_8703B_MUSB(VOID)
|
||||
{
|
||||
return sizeof(Array_MP_8703B_MUSB)/sizeof(u1Byte);
|
||||
}
|
||||
|
||||
VOID
|
||||
EFUSE_GetMaskArray_MP_8703B_MUSB(
|
||||
IN OUT pu1Byte Array
|
||||
)
|
||||
{
|
||||
u2Byte len = EFUSE_GetArrayLen_MP_8703B_MUSB(), i = 0;
|
||||
|
||||
for (i = 0; i < len; ++i)
|
||||
Array[i] = Array_MP_8703B_MUSB[i];
|
||||
}
|
||||
BOOLEAN
|
||||
EFUSE_IsAddressMasked_MP_8703B_MUSB(
|
||||
IN u2Byte Offset
|
||||
)
|
||||
{
|
||||
int r = Offset/16;
|
||||
int c = (Offset%16) / 2;
|
||||
int result = 0;
|
||||
|
||||
if (c < 4) // Upper double word
|
||||
result = (Array_MP_8703B_MUSB[r] & (0x10 << c));
|
||||
else
|
||||
result = (Array_MP_8703B_MUSB[r] & (0x01 << (c-4)));
|
||||
|
||||
return (result > 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
|
||||
42
hal/efuse/rtl8703b/HalEfuseMask8703B_USB.h
Normal file
42
hal/efuse/rtl8703b/HalEfuseMask8703B_USB.h
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* MUSB.TXT
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
u2Byte
|
||||
EFUSE_GetArrayLen_MP_8703B_MUSB(VOID);
|
||||
|
||||
VOID
|
||||
EFUSE_GetMaskArray_MP_8703B_MUSB(
|
||||
IN OUT pu1Byte Array
|
||||
);
|
||||
|
||||
BOOLEAN
|
||||
EFUSE_IsAddressMasked_MP_8703B_MUSB( // TC: Test Chip, MP: MP Chip
|
||||
IN u2Byte Offset
|
||||
);
|
||||
|
||||
|
||||
|
||||
4044
hal/hal_btcoex.c
Normal file
4044
hal/hal_btcoex.c
Normal file
File diff suppressed because it is too large
Load diff
8102
hal/hal_com.c
Normal file
8102
hal/hal_com.c
Normal file
File diff suppressed because it is too large
Load diff
50
hal/hal_com_c2h.h
Normal file
50
hal/hal_com_c2h.h
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef __COMMON_C2H_H__
|
||||
#define __COMMON_C2H_H__
|
||||
|
||||
typedef enum _C2H_EVT {
|
||||
C2H_DBG = 0x00,
|
||||
C2H_LB = 0x01,
|
||||
C2H_TXBF = 0x02,
|
||||
C2H_CCX_TX_RPT = 0x03,
|
||||
C2H_BT_INFO = 0x09,
|
||||
C2H_BT_MP_INFO = 0x0B,
|
||||
C2H_RA_RPT = 0x0C,
|
||||
C2H_RA_PARA_RPT = 0x0E,
|
||||
C2H_FW_SWCHNL = 0x10,
|
||||
C2H_IQK_FINISH = 0x11,
|
||||
C2H_MAILBOX_STATUS = 0x15,
|
||||
C2H_P2P_RPORT = 0x16,
|
||||
C2H_MAC_HIDDEN_RPT = 0x19,
|
||||
C2H_BT_SCOREBOARD_STATUS = 0x20,
|
||||
C2H_EXTEND = 0xff,
|
||||
} C2H_EVT;
|
||||
|
||||
typedef enum _EXTEND_C2H_EVT {
|
||||
EXTEND_C2H_DBG_PRINT = 0
|
||||
} EXTEND_C2H_EVT;
|
||||
|
||||
#define MAC_HIDDEN_RPT_LEN 8
|
||||
int c2h_mac_hidden_rpt_hdl(_adapter *adapter, u8 *data, u8 len);
|
||||
int hal_read_mac_hidden_rpt(_adapter *adapter);
|
||||
|
||||
#endif /* __COMMON_C2H_H__ */
|
||||
|
||||
4440
hal/hal_com_phycfg.c
Normal file
4440
hal/hal_com_phycfg.c
Normal file
File diff suppressed because it is too large
Load diff
195
hal/hal_dm.c
Normal file
195
hal/hal_dm.c
Normal file
|
|
@ -0,0 +1,195 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2014 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#include <drv_types.h>
|
||||
#include <hal_data.h>
|
||||
|
||||
// A mapping from HalData to ODM.
|
||||
ODM_BOARD_TYPE_E boardType(u8 InterfaceSel)
|
||||
{
|
||||
ODM_BOARD_TYPE_E board = ODM_BOARD_DEFAULT;
|
||||
|
||||
#ifdef CONFIG_PCI_HCI
|
||||
INTERFACE_SELECT_PCIE pcie = (INTERFACE_SELECT_PCIE)InterfaceSel;
|
||||
switch (pcie)
|
||||
{
|
||||
case INTF_SEL0_SOLO_MINICARD:
|
||||
board |= ODM_BOARD_MINICARD;
|
||||
break;
|
||||
case INTF_SEL1_BT_COMBO_MINICARD:
|
||||
board |= ODM_BOARD_BT;
|
||||
board |= ODM_BOARD_MINICARD;
|
||||
break;
|
||||
default:
|
||||
board = ODM_BOARD_DEFAULT;
|
||||
break;
|
||||
}
|
||||
|
||||
#elif defined(CONFIG_USB_HCI)
|
||||
INTERFACE_SELECT_USB usb = (INTERFACE_SELECT_USB)InterfaceSel;
|
||||
switch (usb)
|
||||
{
|
||||
case INTF_SEL1_USB_High_Power:
|
||||
board |= ODM_BOARD_EXT_LNA;
|
||||
board |= ODM_BOARD_EXT_PA;
|
||||
break;
|
||||
case INTF_SEL2_MINICARD:
|
||||
board |= ODM_BOARD_MINICARD;
|
||||
break;
|
||||
case INTF_SEL4_USB_Combo:
|
||||
board |= ODM_BOARD_BT;
|
||||
break;
|
||||
case INTF_SEL5_USB_Combo_MF:
|
||||
board |= ODM_BOARD_BT;
|
||||
break;
|
||||
case INTF_SEL0_USB:
|
||||
case INTF_SEL3_USB_Solo:
|
||||
default:
|
||||
board = ODM_BOARD_DEFAULT;
|
||||
break;
|
||||
}
|
||||
|
||||
#endif
|
||||
//DBG_871X("===> boardType(): (pHalData->InterfaceSel, pDM_Odm->BoardType) = (%d, %d)\n", InterfaceSel, board);
|
||||
|
||||
return board;
|
||||
}
|
||||
|
||||
void Init_ODM_ComInfo(_adapter *adapter)
|
||||
{
|
||||
struct dvobj_priv *dvobj = adapter_to_dvobj(adapter);
|
||||
PHAL_DATA_TYPE pHalData = GET_HAL_DATA(adapter);
|
||||
PDM_ODM_T pDM_Odm = &(pHalData->odmpriv);
|
||||
struct mlme_ext_priv *pmlmeext = &adapter->mlmeextpriv;
|
||||
struct mlme_priv *pmlmepriv = &adapter->mlmepriv;
|
||||
struct pwrctrl_priv *pwrctl = adapter_to_pwrctl(adapter);
|
||||
int i;
|
||||
|
||||
_rtw_memset(pDM_Odm,0,sizeof(*pDM_Odm));
|
||||
|
||||
pDM_Odm->Adapter = adapter;
|
||||
|
||||
ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_PLATFORM, ODM_CE);
|
||||
|
||||
rtw_odm_init_ic_type(adapter);
|
||||
|
||||
if (rtw_get_intf_type(adapter) == RTW_GSPI)
|
||||
ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_INTERFACE, ODM_ITRF_SDIO);
|
||||
else
|
||||
ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_INTERFACE, rtw_get_intf_type(adapter));
|
||||
|
||||
ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_MP_TEST_CHIP, IS_NORMAL_CHIP(pHalData->VersionID));
|
||||
|
||||
ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_PATCH_ID, pHalData->CustomerID);
|
||||
|
||||
ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_BWIFI_TEST, adapter->registrypriv.wifi_spec);
|
||||
|
||||
|
||||
if (pHalData->rf_type == RF_1T1R)
|
||||
ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_RF_TYPE, ODM_1T1R);
|
||||
else if (pHalData->rf_type == RF_1T2R)
|
||||
ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_RF_TYPE, ODM_1T2R);
|
||||
else if (pHalData->rf_type == RF_2T2R)
|
||||
ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_RF_TYPE, ODM_2T2R);
|
||||
else if (pHalData->rf_type == RF_2T2R_GREEN)
|
||||
ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_RF_TYPE, ODM_2T2R_GREEN);
|
||||
else if (pHalData->rf_type == RF_2T3R)
|
||||
ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_RF_TYPE, ODM_2T3R);
|
||||
else if (pHalData->rf_type == RF_2T4R)
|
||||
ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_RF_TYPE, ODM_2T4R);
|
||||
else if (pHalData->rf_type == RF_3T3R)
|
||||
ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_RF_TYPE, ODM_3T3R);
|
||||
else if (pHalData->rf_type == RF_3T4R)
|
||||
ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_RF_TYPE, ODM_3T4R);
|
||||
else if (pHalData->rf_type == RF_4T4R)
|
||||
ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_RF_TYPE, ODM_4T4R);
|
||||
else
|
||||
ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_RF_TYPE, ODM_XTXR);
|
||||
|
||||
|
||||
{
|
||||
//1 ======= BoardType: ODM_CMNINFO_BOARD_TYPE =======
|
||||
u8 odm_board_type = ODM_BOARD_DEFAULT;
|
||||
|
||||
if (pHalData->ExternalLNA_2G != 0) {
|
||||
odm_board_type |= ODM_BOARD_EXT_LNA;
|
||||
ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_EXT_LNA, 1);
|
||||
}
|
||||
if (pHalData->ExternalLNA_5G != 0) {
|
||||
odm_board_type |= ODM_BOARD_EXT_LNA_5G;
|
||||
ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_5G_EXT_LNA, 1);
|
||||
}
|
||||
if (pHalData->ExternalPA_2G != 0) {
|
||||
odm_board_type |= ODM_BOARD_EXT_PA;
|
||||
ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_EXT_PA, 1);
|
||||
}
|
||||
if (pHalData->ExternalPA_5G != 0) {
|
||||
odm_board_type |= ODM_BOARD_EXT_PA_5G;
|
||||
ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_5G_EXT_PA, 1);
|
||||
}
|
||||
if (pHalData->EEPROMBluetoothCoexist)
|
||||
odm_board_type |= ODM_BOARD_BT;
|
||||
|
||||
ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_BOARD_TYPE, odm_board_type);
|
||||
//1 ============== End of BoardType ==============
|
||||
}
|
||||
|
||||
ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_DOMAIN_CODE_2G, pHalData->Regulation2_4G);
|
||||
ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_DOMAIN_CODE_5G, pHalData->Regulation5G);
|
||||
|
||||
ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_GPA, pHalData->TypeGPA);
|
||||
ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_APA, pHalData->TypeAPA);
|
||||
ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_GLNA, pHalData->TypeGLNA);
|
||||
ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_ALNA, pHalData->TypeALNA);
|
||||
|
||||
ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_RFE_TYPE, pHalData->RFEType);
|
||||
|
||||
ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_EXT_TRSW, 0);
|
||||
|
||||
/* Pointer reference */
|
||||
ODM_CmnInfoHook(pDM_Odm, ODM_CMNINFO_TX_UNI, &(dvobj->traffic_stat.tx_bytes));
|
||||
ODM_CmnInfoHook(pDM_Odm, ODM_CMNINFO_RX_UNI, &(dvobj->traffic_stat.rx_bytes));
|
||||
ODM_CmnInfoHook(pDM_Odm, ODM_CMNINFO_WM_MODE, &(pmlmeext->cur_wireless_mode));
|
||||
ODM_CmnInfoHook(pDM_Odm, ODM_CMNINFO_BAND, &(pHalData->CurrentBandType));
|
||||
ODM_CmnInfoHook(pDM_Odm, ODM_CMNINFO_FORCED_RATE, &(pHalData->ForcedDataRate));
|
||||
|
||||
ODM_CmnInfoHook(pDM_Odm, ODM_CMNINFO_SEC_CHNL_OFFSET, &(pHalData->nCur40MhzPrimeSC));
|
||||
ODM_CmnInfoHook(pDM_Odm, ODM_CMNINFO_SEC_MODE, &(adapter->securitypriv.dot11PrivacyAlgrthm));
|
||||
ODM_CmnInfoHook(pDM_Odm, ODM_CMNINFO_BW, &(pHalData->CurrentChannelBW));
|
||||
ODM_CmnInfoHook(pDM_Odm, ODM_CMNINFO_CHNL, &( pHalData->CurrentChannel));
|
||||
ODM_CmnInfoHook(pDM_Odm, ODM_CMNINFO_NET_CLOSED, &(adapter->net_closed));
|
||||
ODM_CmnInfoHook(pDM_Odm, ODM_CMNINFO_FORCED_IGI_LB, &(pHalData->u1ForcedIgiLb));
|
||||
|
||||
ODM_CmnInfoHook(pDM_Odm, ODM_CMNINFO_SCAN, &(pmlmepriv->bScanInProcess));
|
||||
ODM_CmnInfoHook(pDM_Odm, ODM_CMNINFO_POWER_SAVING, &(pwrctl->bpower_saving));
|
||||
/*Add by Yuchen for phydm beamforming*/
|
||||
ODM_CmnInfoHook(pDM_Odm, ODM_CMNINFO_TX_TP, &(dvobj->traffic_stat.cur_tx_tp));
|
||||
ODM_CmnInfoHook(pDM_Odm, ODM_CMNINFO_RX_TP, &(dvobj->traffic_stat.cur_rx_tp));
|
||||
#ifdef CONFIG_USB_HCI
|
||||
ODM_CmnInfoHook(pDM_Odm, ODM_CMNINFO_HUBUSBMODE, &(dvobj->usb_speed));
|
||||
#endif
|
||||
for(i=0; i<ODM_ASSOCIATE_ENTRY_NUM; i++)
|
||||
ODM_CmnInfoPtrArrayHook(pDM_Odm, ODM_CMNINFO_STA_STATUS, i, NULL);
|
||||
|
||||
/* TODO */
|
||||
//ODM_CmnInfoHook(pDM_Odm, ODM_CMNINFO_BT_OPERATION, _FALSE);
|
||||
//ODM_CmnInfoHook(pDM_Odm, ODM_CMNINFO_BT_DISABLE_EDCA, _FALSE);
|
||||
}
|
||||
|
||||
26
hal/hal_dm.h
Normal file
26
hal/hal_dm.h
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef __HAL_DM_H__
|
||||
#define __HAL_DM_H__
|
||||
|
||||
void Init_ODM_ComInfo(_adapter *adapter);
|
||||
|
||||
#endif /* __HAL_DM_H__ */
|
||||
|
||||
112
hal/hal_hci/hal_sdio.c
Normal file
112
hal/hal_hci/hal_sdio.c
Normal file
|
|
@ -0,0 +1,112 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
#define _HAL_SDIO_C_
|
||||
|
||||
#include <drv_types.h>
|
||||
#include <hal_data.h>
|
||||
|
||||
u8 rtw_hal_sdio_max_txoqt_free_space(_adapter *padapter)
|
||||
{
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
|
||||
|
||||
if(pHalData->SdioTxOQTMaxFreeSpace < 8 )
|
||||
pHalData->SdioTxOQTMaxFreeSpace = 8;
|
||||
|
||||
return pHalData->SdioTxOQTMaxFreeSpace;
|
||||
}
|
||||
|
||||
u8 rtw_hal_sdio_query_tx_freepage(_adapter *padapter, u8 PageIdx, u8 RequiredPageNum)
|
||||
{
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
|
||||
|
||||
if ((pHalData->SdioTxFIFOFreePage[PageIdx]+pHalData->SdioTxFIFOFreePage[PUBLIC_QUEUE_IDX]) >= (RequiredPageNum))
|
||||
return _TRUE;
|
||||
else
|
||||
return _FALSE;
|
||||
}
|
||||
|
||||
void rtw_hal_sdio_update_tx_freepage(_adapter *padapter, u8 PageIdx, u8 RequiredPageNum)
|
||||
{
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
|
||||
u8 DedicatedPgNum = 0;
|
||||
u8 RequiredPublicFreePgNum = 0;
|
||||
//_irqL irql;
|
||||
|
||||
//_enter_critical_bh(&pHalData->SdioTxFIFOFreePageLock, &irql);
|
||||
|
||||
DedicatedPgNum = pHalData->SdioTxFIFOFreePage[PageIdx];
|
||||
if (RequiredPageNum <= DedicatedPgNum) {
|
||||
pHalData->SdioTxFIFOFreePage[PageIdx] -= RequiredPageNum;
|
||||
} else {
|
||||
pHalData->SdioTxFIFOFreePage[PageIdx] = 0;
|
||||
RequiredPublicFreePgNum = RequiredPageNum - DedicatedPgNum;
|
||||
pHalData->SdioTxFIFOFreePage[PUBLIC_QUEUE_IDX] -= RequiredPublicFreePgNum;
|
||||
}
|
||||
|
||||
//_exit_critical_bh(&pHalData->SdioTxFIFOFreePageLock, &irql);
|
||||
}
|
||||
|
||||
void rtw_hal_set_sdio_tx_max_length(PADAPTER padapter, u8 numHQ, u8 numNQ, u8 numLQ, u8 numPubQ)
|
||||
{
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
|
||||
u32 page_size;
|
||||
u32 lenHQ, lenNQ, lenLQ;
|
||||
|
||||
rtw_hal_get_def_var(padapter, HAL_DEF_TX_PAGE_SIZE,&page_size);
|
||||
|
||||
lenHQ = ((numHQ + numPubQ) >> 1) * page_size;
|
||||
lenNQ = ((numNQ + numPubQ) >> 1) * page_size;
|
||||
lenLQ = ((numLQ + numPubQ) >> 1) * page_size;
|
||||
|
||||
pHalData->sdio_tx_max_len[HI_QUEUE_IDX] = (lenHQ > MAX_XMITBUF_SZ)? MAX_XMITBUF_SZ:lenHQ;
|
||||
pHalData->sdio_tx_max_len[MID_QUEUE_IDX] = (lenNQ > MAX_XMITBUF_SZ)? MAX_XMITBUF_SZ:lenNQ;
|
||||
pHalData->sdio_tx_max_len[LOW_QUEUE_IDX] = (lenLQ > MAX_XMITBUF_SZ)? MAX_XMITBUF_SZ:lenLQ;
|
||||
}
|
||||
|
||||
u32 rtw_hal_get_sdio_tx_max_length(PADAPTER padapter, u8 queue_idx)
|
||||
{
|
||||
struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter);
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
|
||||
u32 deviceId, max_len;
|
||||
|
||||
|
||||
deviceId = ffaddr2deviceId(pdvobjpriv, queue_idx);
|
||||
switch (deviceId) {
|
||||
case WLAN_TX_HIQ_DEVICE_ID:
|
||||
max_len = pHalData->sdio_tx_max_len[HI_QUEUE_IDX];
|
||||
break;
|
||||
|
||||
case WLAN_TX_MIQ_DEVICE_ID:
|
||||
max_len = pHalData->sdio_tx_max_len[MID_QUEUE_IDX];
|
||||
break;
|
||||
|
||||
case WLAN_TX_LOQ_DEVICE_ID:
|
||||
max_len = pHalData->sdio_tx_max_len[LOW_QUEUE_IDX];
|
||||
break;
|
||||
|
||||
default:
|
||||
max_len = pHalData->sdio_tx_max_len[MID_QUEUE_IDX];
|
||||
break;
|
||||
}
|
||||
|
||||
return max_len;
|
||||
}
|
||||
|
||||
|
||||
1128
hal/hal_intf.c
Normal file
1128
hal/hal_intf.c
Normal file
File diff suppressed because it is too large
Load diff
1799
hal/hal_mp.c
Normal file
1799
hal/hal_mp.c
Normal file
File diff suppressed because it is too large
Load diff
285
hal/hal_phy.c
Normal file
285
hal/hal_phy.c
Normal file
|
|
@ -0,0 +1,285 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
#define _HAL_PHY_C_
|
||||
|
||||
#include <drv_types.h>
|
||||
|
||||
//================================================================================
|
||||
// Constant.
|
||||
//================================================================================
|
||||
// 2008/11/20 MH For Debug only, RF
|
||||
static RF_SHADOW_T RF_Shadow[RF6052_MAX_PATH][RF6052_MAX_REG];
|
||||
|
||||
/**
|
||||
* Function: PHY_CalculateBitShift
|
||||
*
|
||||
* OverView: Get shifted position of the BitMask
|
||||
*
|
||||
* Input:
|
||||
* u4Byte BitMask,
|
||||
*
|
||||
* Output: none
|
||||
* Return: u4Byte Return the shift bit bit position of the mask
|
||||
*/
|
||||
u32
|
||||
PHY_CalculateBitShift(
|
||||
u32 BitMask
|
||||
)
|
||||
{
|
||||
u32 i;
|
||||
|
||||
for(i=0; i<=31; i++)
|
||||
{
|
||||
if ( ((BitMask>>i) & 0x1 ) == 1)
|
||||
break;
|
||||
}
|
||||
|
||||
return (i);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// ==> RF shadow Operation API Code Section!!!
|
||||
//
|
||||
/*-----------------------------------------------------------------------------
|
||||
* Function: PHY_RFShadowRead
|
||||
* PHY_RFShadowWrite
|
||||
* PHY_RFShadowCompare
|
||||
* PHY_RFShadowRecorver
|
||||
* PHY_RFShadowCompareAll
|
||||
* PHY_RFShadowRecorverAll
|
||||
* PHY_RFShadowCompareFlagSet
|
||||
* PHY_RFShadowRecorverFlagSet
|
||||
*
|
||||
* Overview: When we set RF register, we must write shadow at first.
|
||||
* When we are running, we must compare shadow abd locate error addr.
|
||||
* Decide to recorver or not.
|
||||
*
|
||||
* Input: NONE
|
||||
*
|
||||
* Output: NONE
|
||||
*
|
||||
* Return: NONE
|
||||
*
|
||||
* Revised History:
|
||||
* When Who Remark
|
||||
* 11/20/2008 MHC Create Version 0.
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
u32
|
||||
PHY_RFShadowRead(
|
||||
IN PADAPTER Adapter,
|
||||
IN u8 eRFPath,
|
||||
IN u32 Offset)
|
||||
{
|
||||
return RF_Shadow[eRFPath][Offset].Value;
|
||||
|
||||
} /* PHY_RFShadowRead */
|
||||
|
||||
|
||||
VOID
|
||||
PHY_RFShadowWrite(
|
||||
IN PADAPTER Adapter,
|
||||
IN u8 eRFPath,
|
||||
IN u32 Offset,
|
||||
IN u32 Data)
|
||||
{
|
||||
RF_Shadow[eRFPath][Offset].Value = (Data & bRFRegOffsetMask);
|
||||
RF_Shadow[eRFPath][Offset].Driver_Write = _TRUE;
|
||||
|
||||
} /* PHY_RFShadowWrite */
|
||||
|
||||
|
||||
BOOLEAN
|
||||
PHY_RFShadowCompare(
|
||||
IN PADAPTER Adapter,
|
||||
IN u8 eRFPath,
|
||||
IN u32 Offset)
|
||||
{
|
||||
u32 reg;
|
||||
// Check if we need to check the register
|
||||
if (RF_Shadow[eRFPath][Offset].Compare == _TRUE)
|
||||
{
|
||||
reg = rtw_hal_read_rfreg(Adapter, eRFPath, Offset, bRFRegOffsetMask);
|
||||
// Compare shadow and real rf register for 20bits!!
|
||||
if (RF_Shadow[eRFPath][Offset].Value != reg)
|
||||
{
|
||||
// Locate error position.
|
||||
RF_Shadow[eRFPath][Offset].ErrorOrNot = _TRUE;
|
||||
//RT_TRACE(COMP_INIT, DBG_LOUD,
|
||||
//("PHY_RFShadowCompare RF-%d Addr%02lx Err = %05lx\n",
|
||||
//eRFPath, Offset, reg));
|
||||
}
|
||||
return RF_Shadow[eRFPath][Offset].ErrorOrNot ;
|
||||
}
|
||||
return _FALSE;
|
||||
} /* PHY_RFShadowCompare */
|
||||
|
||||
|
||||
VOID
|
||||
PHY_RFShadowRecorver(
|
||||
IN PADAPTER Adapter,
|
||||
IN u8 eRFPath,
|
||||
IN u32 Offset)
|
||||
{
|
||||
// Check if the address is error
|
||||
if (RF_Shadow[eRFPath][Offset].ErrorOrNot == _TRUE)
|
||||
{
|
||||
// Check if we need to recorver the register.
|
||||
if (RF_Shadow[eRFPath][Offset].Recorver == _TRUE)
|
||||
{
|
||||
rtw_hal_write_rfreg(Adapter, eRFPath, Offset, bRFRegOffsetMask,
|
||||
RF_Shadow[eRFPath][Offset].Value);
|
||||
//RT_TRACE(COMP_INIT, DBG_LOUD,
|
||||
//("PHY_RFShadowRecorver RF-%d Addr%02lx=%05lx",
|
||||
//eRFPath, Offset, RF_Shadow[eRFPath][Offset].Value));
|
||||
}
|
||||
}
|
||||
|
||||
} /* PHY_RFShadowRecorver */
|
||||
|
||||
|
||||
VOID
|
||||
PHY_RFShadowCompareAll(
|
||||
IN PADAPTER Adapter)
|
||||
{
|
||||
u8 eRFPath = 0 ;
|
||||
u32 Offset = 0, maxReg= GET_RF6052_REAL_MAX_REG(Adapter);
|
||||
|
||||
for (eRFPath = 0; eRFPath < RF6052_MAX_PATH; eRFPath++)
|
||||
{
|
||||
for (Offset = 0; Offset < maxReg; Offset++)
|
||||
{
|
||||
PHY_RFShadowCompare(Adapter, eRFPath, Offset);
|
||||
}
|
||||
}
|
||||
|
||||
} /* PHY_RFShadowCompareAll */
|
||||
|
||||
|
||||
VOID
|
||||
PHY_RFShadowRecorverAll(
|
||||
IN PADAPTER Adapter)
|
||||
{
|
||||
u8 eRFPath =0;
|
||||
u32 Offset = 0, maxReg= GET_RF6052_REAL_MAX_REG(Adapter);
|
||||
|
||||
for (eRFPath = 0; eRFPath < RF6052_MAX_PATH; eRFPath++)
|
||||
{
|
||||
for (Offset = 0; Offset < maxReg; Offset++)
|
||||
{
|
||||
PHY_RFShadowRecorver(Adapter, eRFPath, Offset);
|
||||
}
|
||||
}
|
||||
|
||||
} /* PHY_RFShadowRecorverAll */
|
||||
|
||||
|
||||
VOID
|
||||
PHY_RFShadowCompareFlagSet(
|
||||
IN PADAPTER Adapter,
|
||||
IN u8 eRFPath,
|
||||
IN u32 Offset,
|
||||
IN u8 Type)
|
||||
{
|
||||
// Set True or False!!!
|
||||
RF_Shadow[eRFPath][Offset].Compare = Type;
|
||||
|
||||
} /* PHY_RFShadowCompareFlagSet */
|
||||
|
||||
|
||||
VOID
|
||||
PHY_RFShadowRecorverFlagSet(
|
||||
IN PADAPTER Adapter,
|
||||
IN u8 eRFPath,
|
||||
IN u32 Offset,
|
||||
IN u8 Type)
|
||||
{
|
||||
// Set True or False!!!
|
||||
RF_Shadow[eRFPath][Offset].Recorver= Type;
|
||||
|
||||
} /* PHY_RFShadowRecorverFlagSet */
|
||||
|
||||
|
||||
VOID
|
||||
PHY_RFShadowCompareFlagSetAll(
|
||||
IN PADAPTER Adapter)
|
||||
{
|
||||
u8 eRFPath = 0;
|
||||
u32 Offset = 0, maxReg= GET_RF6052_REAL_MAX_REG(Adapter);
|
||||
|
||||
for (eRFPath = 0; eRFPath < RF6052_MAX_PATH; eRFPath++)
|
||||
{
|
||||
for (Offset = 0; Offset < maxReg; Offset++)
|
||||
{
|
||||
// 2008/11/20 MH For S3S4 test, we only check reg 26/27 now!!!!
|
||||
if (Offset != 0x26 && Offset != 0x27)
|
||||
PHY_RFShadowCompareFlagSet(Adapter, eRFPath, Offset, _FALSE);
|
||||
else
|
||||
PHY_RFShadowCompareFlagSet(Adapter, eRFPath, Offset, _TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
} /* PHY_RFShadowCompareFlagSetAll */
|
||||
|
||||
|
||||
VOID
|
||||
PHY_RFShadowRecorverFlagSetAll(
|
||||
IN PADAPTER Adapter)
|
||||
{
|
||||
u8 eRFPath = 0;
|
||||
u32 Offset = 0, maxReg= GET_RF6052_REAL_MAX_REG(Adapter);
|
||||
|
||||
for (eRFPath = 0; eRFPath < RF6052_MAX_PATH; eRFPath++)
|
||||
{
|
||||
for (Offset = 0; Offset < maxReg; Offset++)
|
||||
{
|
||||
// 2008/11/20 MH For S3S4 test, we only check reg 26/27 now!!!!
|
||||
if (Offset != 0x26 && Offset != 0x27)
|
||||
PHY_RFShadowRecorverFlagSet(Adapter, eRFPath, Offset, _FALSE);
|
||||
else
|
||||
PHY_RFShadowRecorverFlagSet(Adapter, eRFPath, Offset, _TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
} /* PHY_RFShadowCompareFlagSetAll */
|
||||
|
||||
VOID
|
||||
PHY_RFShadowRefresh(
|
||||
IN PADAPTER Adapter)
|
||||
{
|
||||
u8 eRFPath = 0;
|
||||
u32 Offset = 0, maxReg= GET_RF6052_REAL_MAX_REG(Adapter);
|
||||
|
||||
for (eRFPath = 0; eRFPath < RF6052_MAX_PATH; eRFPath++)
|
||||
{
|
||||
for (Offset = 0; Offset < maxReg; Offset++)
|
||||
{
|
||||
RF_Shadow[eRFPath][Offset].Value = 0;
|
||||
RF_Shadow[eRFPath][Offset].Compare = _FALSE;
|
||||
RF_Shadow[eRFPath][Offset].Recorver = _FALSE;
|
||||
RF_Shadow[eRFPath][Offset].ErrorOrNot = _FALSE;
|
||||
RF_Shadow[eRFPath][Offset].Driver_Write = _FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
} /* PHY_RFShadowRead */
|
||||
|
||||
|
||||
2418
hal/led/hal_sdio_led.c
Normal file
2418
hal/led/hal_sdio_led.c
Normal file
File diff suppressed because it is too large
Load diff
123
hal/phydm/halhwimg.h
Normal file
123
hal/phydm/halhwimg.h
Normal file
|
|
@ -0,0 +1,123 @@
|
|||
#pragma once
|
||||
#ifndef __INC_HW_IMG_H
|
||||
#define __INC_HW_IMG_H
|
||||
|
||||
//
|
||||
// 2011/03/15 MH Add for different IC HW image file selection. code size consideration.
|
||||
//
|
||||
#if RT_PLATFORM == PLATFORM_LINUX
|
||||
|
||||
#if (DEV_BUS_TYPE == RT_PCI_INTERFACE)
|
||||
// For 92C
|
||||
#define RTL8192CE_HWIMG_SUPPORT 1
|
||||
#define RTL8192CE_TEST_HWIMG_SUPPORT 0
|
||||
#define RTL8192CU_HWIMG_SUPPORT 0
|
||||
#define RTL8192CU_TEST_HWIMG_SUPPORT 0
|
||||
|
||||
// For 92D
|
||||
#define RTL8192DE_HWIMG_SUPPORT 1
|
||||
#define RTL8192DE_TEST_HWIMG_SUPPORT 0
|
||||
#define RTL8192DU_HWIMG_SUPPORT 0
|
||||
#define RTL8192DU_TEST_HWIMG_SUPPORT 0
|
||||
|
||||
// For 8723
|
||||
#define RTL8723E_HWIMG_SUPPORT 1
|
||||
#define RTL8723U_HWIMG_SUPPORT 0
|
||||
#define RTL8723S_HWIMG_SUPPORT 0
|
||||
|
||||
//For 88E
|
||||
#define RTL8188EE_HWIMG_SUPPORT 0
|
||||
#define RTL8188EU_HWIMG_SUPPORT 0
|
||||
#define RTL8188ES_HWIMG_SUPPORT 0
|
||||
|
||||
#elif (DEV_BUS_TYPE == RT_USB_INTERFACE)
|
||||
// For 92C
|
||||
#define RTL8192CE_HWIMG_SUPPORT 0
|
||||
#define RTL8192CE_TEST_HWIMG_SUPPORT 0
|
||||
#define RTL8192CU_HWIMG_SUPPORT 1
|
||||
#define RTL8192CU_TEST_HWIMG_SUPPORT 0
|
||||
|
||||
//For 92D
|
||||
#define RTL8192DE_HWIMG_SUPPORT 0
|
||||
#define RTL8192DE_TEST_HWIMG_SUPPORT 0
|
||||
#define RTL8192DU_HWIMG_SUPPORT 1
|
||||
#define RTL8192DU_TEST_HWIMG_SUPPORT 0
|
||||
|
||||
// For 8723
|
||||
#define RTL8723E_HWIMG_SUPPORT 0
|
||||
#define RTL8723U_HWIMG_SUPPORT 1
|
||||
#define RTL8723S_HWIMG_SUPPORT 0
|
||||
|
||||
//For 88E
|
||||
#define RTL8188EE_HWIMG_SUPPORT 0
|
||||
#define RTL8188EU_HWIMG_SUPPORT 0
|
||||
#define RTL8188ES_HWIMG_SUPPORT 0
|
||||
|
||||
#elif (DEV_BUS_TYPE == RT_SDIO_INTERFACE)
|
||||
// For 92C
|
||||
#define RTL8192CE_HWIMG_SUPPORT 0
|
||||
#define RTL8192CE_TEST_HWIMG_SUPPORT 0
|
||||
#define RTL8192CU_HWIMG_SUPPORT 1
|
||||
#define RTL8192CU_TEST_HWIMG_SUPPORT 0
|
||||
|
||||
//For 92D
|
||||
#define RTL8192DE_HWIMG_SUPPORT 0
|
||||
#define RTL8192DE_TEST_HWIMG_SUPPORT 0
|
||||
#define RTL8192DU_HWIMG_SUPPORT 1
|
||||
#define RTL8192DU_TEST_HWIMG_SUPPORT 0
|
||||
|
||||
// For 8723
|
||||
#define RTL8723E_HWIMG_SUPPORT 0
|
||||
#define RTL8723U_HWIMG_SUPPORT 0
|
||||
#define RTL8723S_HWIMG_SUPPORT 1
|
||||
|
||||
//For 88E
|
||||
#define RTL8188EE_HWIMG_SUPPORT 0
|
||||
#define RTL8188EU_HWIMG_SUPPORT 0
|
||||
#define RTL8188ES_HWIMG_SUPPORT 0
|
||||
#endif
|
||||
|
||||
#else // PLATFORM_WINDOWS & MacOSX
|
||||
|
||||
//For 92C
|
||||
#define RTL8192CE_HWIMG_SUPPORT 1
|
||||
#define RTL8192CE_TEST_HWIMG_SUPPORT 1
|
||||
#define RTL8192CU_HWIMG_SUPPORT 1
|
||||
#define RTL8192CU_TEST_HWIMG_SUPPORT 1
|
||||
|
||||
// For 92D
|
||||
#define RTL8192DE_HWIMG_SUPPORT 1
|
||||
#define RTL8192DE_TEST_HWIMG_SUPPORT 1
|
||||
#define RTL8192DU_HWIMG_SUPPORT 1
|
||||
#define RTL8192DU_TEST_HWIMG_SUPPORT 1
|
||||
|
||||
#if defined(UNDER_CE)
|
||||
// For 8723
|
||||
#define RTL8723E_HWIMG_SUPPORT 0
|
||||
#define RTL8723U_HWIMG_SUPPORT 0
|
||||
#define RTL8723S_HWIMG_SUPPORT 1
|
||||
|
||||
// For 88E
|
||||
#define RTL8188EE_HWIMG_SUPPORT 0
|
||||
#define RTL8188EU_HWIMG_SUPPORT 0
|
||||
#define RTL8188ES_HWIMG_SUPPORT 0
|
||||
|
||||
#else
|
||||
|
||||
// For 8723
|
||||
#define RTL8723E_HWIMG_SUPPORT 1
|
||||
//#define RTL_8723E_TEST_HWIMG_SUPPORT 1
|
||||
#define RTL8723U_HWIMG_SUPPORT 1
|
||||
//#define RTL_8723U_TEST_HWIMG_SUPPORT 1
|
||||
#define RTL8723S_HWIMG_SUPPORT 1
|
||||
//#define RTL_8723S_TEST_HWIMG_SUPPORT 1
|
||||
|
||||
//For 88E
|
||||
#define RTL8188EE_HWIMG_SUPPORT 1
|
||||
#define RTL8188EU_HWIMG_SUPPORT 1
|
||||
#define RTL8188ES_HWIMG_SUPPORT 1
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif //__INC_HW_IMG_H
|
||||
2504
hal/phydm/halphyrf_ap.c
Normal file
2504
hal/phydm/halphyrf_ap.c
Normal file
File diff suppressed because it is too large
Load diff
162
hal/phydm/halphyrf_ap.h
Normal file
162
hal/phydm/halphyrf_ap.h
Normal file
|
|
@ -0,0 +1,162 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __HAL_PHY_RF_H__
|
||||
#define __HAL_PHY_RF_H__
|
||||
|
||||
#include "phydm_powertracking_ap.h"
|
||||
#if (RTL8814A_SUPPORT == 1)
|
||||
#include "rtl8814a/phydm_iqk_8814a.h"
|
||||
#endif
|
||||
|
||||
#if (RTL8822B_SUPPORT == 1)
|
||||
#include "rtl8822b/phydm_iqk_8822b.h"
|
||||
#endif
|
||||
|
||||
|
||||
typedef enum _PWRTRACK_CONTROL_METHOD {
|
||||
BBSWING,
|
||||
TXAGC,
|
||||
MIX_MODE,
|
||||
TSSI_MODE
|
||||
} PWRTRACK_METHOD;
|
||||
|
||||
typedef VOID (*FuncSetPwr)(PVOID, PWRTRACK_METHOD, u1Byte, u1Byte);
|
||||
typedef VOID(*FuncIQK)(PVOID, u1Byte, u1Byte, u1Byte);
|
||||
typedef VOID (*FuncLCK)(PVOID);
|
||||
//refine by YuChen for 8814A
|
||||
typedef VOID (*FuncSwing)(PVOID, pu1Byte*, pu1Byte*, pu1Byte*, pu1Byte*);
|
||||
typedef VOID (*FuncSwing8814only)(PVOID, pu1Byte*, pu1Byte*, pu1Byte*, pu1Byte*);
|
||||
|
||||
typedef struct _TXPWRTRACK_CFG {
|
||||
u1Byte SwingTableSize_CCK;
|
||||
u1Byte SwingTableSize_OFDM;
|
||||
u1Byte Threshold_IQK;
|
||||
u1Byte Threshold_DPK;
|
||||
u1Byte AverageThermalNum;
|
||||
u1Byte RfPathCount;
|
||||
u4Byte ThermalRegAddr;
|
||||
FuncSetPwr ODM_TxPwrTrackSetPwr;
|
||||
FuncIQK DoIQK;
|
||||
FuncLCK PHY_LCCalibrate;
|
||||
FuncSwing GetDeltaSwingTable;
|
||||
FuncSwing8814only GetDeltaSwingTable8814only;
|
||||
} TXPWRTRACK_CFG, *PTXPWRTRACK_CFG;
|
||||
|
||||
VOID
|
||||
ConfigureTxpowerTrack(
|
||||
IN PVOID pDM_VOID,
|
||||
OUT PTXPWRTRACK_CFG pConfig
|
||||
);
|
||||
|
||||
|
||||
VOID
|
||||
ODM_TXPowerTrackingCallback_ThermalMeter(
|
||||
#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
|
||||
IN PVOID pDM_VOID
|
||||
#else
|
||||
IN PADAPTER Adapter
|
||||
#endif
|
||||
);
|
||||
|
||||
#if (RTL8192E_SUPPORT==1)
|
||||
VOID
|
||||
ODM_TXPowerTrackingCallback_ThermalMeter_92E(
|
||||
#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
|
||||
IN PVOID pDM_VOID
|
||||
#else
|
||||
IN PADAPTER Adapter
|
||||
#endif
|
||||
);
|
||||
#endif
|
||||
|
||||
#if (RTL8814A_SUPPORT == 1)
|
||||
VOID
|
||||
ODM_TXPowerTrackingCallback_ThermalMeter_JaguarSeries2(
|
||||
#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
|
||||
IN PVOID pDM_VOID
|
||||
#else
|
||||
IN PADAPTER Adapter
|
||||
#endif
|
||||
);
|
||||
|
||||
#elif ODM_IC_11AC_SERIES_SUPPORT
|
||||
VOID
|
||||
ODM_TXPowerTrackingCallback_ThermalMeter_JaguarSeries(
|
||||
#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
|
||||
IN PVOID pDM_VOID
|
||||
#else
|
||||
IN PADAPTER Adapter
|
||||
#endif
|
||||
);
|
||||
#endif
|
||||
|
||||
#define IS_CCK_RATE(_rate) (ODM_MGN_1M == _rate || _rate == ODM_MGN_2M || _rate == ODM_MGN_5_5M || _rate == ODM_MGN_11M )
|
||||
|
||||
|
||||
#if(DM_ODM_SUPPORT_TYPE & ODM_WIN)
|
||||
#define MAX_TOLERANCE 5
|
||||
#define IQK_DELAY_TIME 1 //ms
|
||||
|
||||
//
|
||||
// BB/MAC/RF other monitor API
|
||||
//
|
||||
|
||||
void PHY_SetMonitorMode8192C(IN PADAPTER pAdapter,
|
||||
IN BOOLEAN bEnableMonitorMode );
|
||||
|
||||
//
|
||||
// IQ calibrate
|
||||
//
|
||||
void
|
||||
PHY_IQCalibrate_8192C( IN PADAPTER pAdapter,
|
||||
IN BOOLEAN bReCovery);
|
||||
|
||||
//
|
||||
// LC calibrate
|
||||
//
|
||||
void
|
||||
PHY_LCCalibrate_8192C( IN PADAPTER pAdapter);
|
||||
|
||||
//
|
||||
// AP calibrate
|
||||
//
|
||||
void
|
||||
PHY_APCalibrate_8192C( IN PADAPTER pAdapter,
|
||||
IN s1Byte delta);
|
||||
#endif
|
||||
|
||||
#define ODM_TARGET_CHNL_NUM_2G_5G 59
|
||||
|
||||
|
||||
VOID
|
||||
ODM_ResetIQKResult(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
u1Byte
|
||||
ODM_GetRightChnlPlaceforIQK(
|
||||
IN u1Byte chnl
|
||||
);
|
||||
|
||||
void phydm_rf_init(IN PVOID pDM_VOID);
|
||||
void phydm_rf_watchdog(IN PVOID pDM_VOID);
|
||||
|
||||
#endif // #ifndef __HAL_PHY_RF_H__
|
||||
|
||||
710
hal/phydm/halphyrf_ce.c
Normal file
710
hal/phydm/halphyrf_ce.c
Normal file
|
|
@ -0,0 +1,710 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#include "mp_precomp.h"
|
||||
#include "phydm_precomp.h"
|
||||
|
||||
|
||||
#define CALCULATE_SWINGTALBE_OFFSET(_offset, _direction, _size, _deltaThermal) \
|
||||
do {\
|
||||
for(_offset = 0; _offset < _size; _offset++)\
|
||||
{\
|
||||
if(_deltaThermal < thermalThreshold[_direction][_offset])\
|
||||
{\
|
||||
if(_offset != 0)\
|
||||
_offset--;\
|
||||
break;\
|
||||
}\
|
||||
} \
|
||||
if(_offset >= _size)\
|
||||
_offset = _size-1;\
|
||||
} while(0)
|
||||
|
||||
void ConfigureTxpowerTrack(
|
||||
IN PVOID pDM_VOID,
|
||||
OUT PTXPWRTRACK_CFG pConfig
|
||||
)
|
||||
{
|
||||
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
|
||||
|
||||
#if RTL8192E_SUPPORT
|
||||
if(pDM_Odm->SupportICType==ODM_RTL8192E)
|
||||
ConfigureTxpowerTrack_8192E(pConfig);
|
||||
#endif
|
||||
#if RTL8821A_SUPPORT
|
||||
if(pDM_Odm->SupportICType==ODM_RTL8821)
|
||||
ConfigureTxpowerTrack_8821A(pConfig);
|
||||
#endif
|
||||
#if RTL8812A_SUPPORT
|
||||
if(pDM_Odm->SupportICType==ODM_RTL8812)
|
||||
ConfigureTxpowerTrack_8812A(pConfig);
|
||||
#endif
|
||||
#if RTL8188E_SUPPORT
|
||||
if(pDM_Odm->SupportICType==ODM_RTL8188E)
|
||||
ConfigureTxpowerTrack_8188E(pConfig);
|
||||
#endif
|
||||
|
||||
#if RTL8723B_SUPPORT
|
||||
if(pDM_Odm->SupportICType==ODM_RTL8723B)
|
||||
ConfigureTxpowerTrack_8723B(pConfig);
|
||||
#endif
|
||||
|
||||
#if RTL8814A_SUPPORT
|
||||
if (pDM_Odm->SupportICType == ODM_RTL8814A)
|
||||
ConfigureTxpowerTrack_8814A(pConfig);
|
||||
#endif
|
||||
|
||||
#if RTL8703B_SUPPORT
|
||||
if(pDM_Odm->SupportICType==ODM_RTL8703B)
|
||||
ConfigureTxpowerTrack_8703B(pConfig);
|
||||
#endif
|
||||
|
||||
#if RTL8188F_SUPPORT
|
||||
if (pDM_Odm->SupportICType == ODM_RTL8188F)
|
||||
ConfigureTxpowerTrack_8188F(pConfig);
|
||||
#endif
|
||||
}
|
||||
|
||||
//======================================================================
|
||||
// <20121113, Kordan> This function should be called when TxAGC changed.
|
||||
// Otherwise the previous compensation is gone, because we record the
|
||||
// delta of temperature between two TxPowerTracking watch dogs.
|
||||
//
|
||||
// NOTE: If Tx BB swing or Tx scaling is varified during run-time, still
|
||||
// need to call this function.
|
||||
//======================================================================
|
||||
VOID
|
||||
ODM_ClearTxPowerTrackingState(
|
||||
IN PVOID pDM_VOID
|
||||
)
|
||||
{
|
||||
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
|
||||
PHAL_DATA_TYPE pHalData = GET_HAL_DATA(pDM_Odm->Adapter);
|
||||
u1Byte p = 0;
|
||||
PODM_RF_CAL_T pRFCalibrateInfo = &(pDM_Odm->RFCalibrateInfo);
|
||||
|
||||
pRFCalibrateInfo->BbSwingIdxCckBase = pRFCalibrateInfo->DefaultCckIndex;
|
||||
pRFCalibrateInfo->BbSwingIdxCck = pRFCalibrateInfo->DefaultCckIndex;
|
||||
pDM_Odm->RFCalibrateInfo.CCK_index = 0;
|
||||
|
||||
for (p = ODM_RF_PATH_A; p < MAX_RF_PATH; ++p)
|
||||
{
|
||||
pRFCalibrateInfo->BbSwingIdxOfdmBase[p] = pRFCalibrateInfo->DefaultOfdmIndex;
|
||||
pRFCalibrateInfo->BbSwingIdxOfdm[p] = pRFCalibrateInfo->DefaultOfdmIndex;
|
||||
pRFCalibrateInfo->OFDM_index[p] = pRFCalibrateInfo->DefaultOfdmIndex;
|
||||
|
||||
pRFCalibrateInfo->PowerIndexOffset[p] = 0;
|
||||
pRFCalibrateInfo->DeltaPowerIndex[p] = 0;
|
||||
pRFCalibrateInfo->DeltaPowerIndexLast[p] = 0;
|
||||
pRFCalibrateInfo->PowerIndexOffset[p] = 0;
|
||||
|
||||
pRFCalibrateInfo->Absolute_OFDMSwingIdx[p] = 0; /* Initial Mix mode power tracking*/
|
||||
pRFCalibrateInfo->Remnant_OFDMSwingIdx[p] = 0;
|
||||
pRFCalibrateInfo->KfreeOffset[p] = 0;
|
||||
}
|
||||
|
||||
pRFCalibrateInfo->Modify_TxAGC_Flag_PathA = FALSE; /*Initial at Modify Tx Scaling Mode*/
|
||||
pRFCalibrateInfo->Modify_TxAGC_Flag_PathB = FALSE; /*Initial at Modify Tx Scaling Mode*/
|
||||
pRFCalibrateInfo->Modify_TxAGC_Flag_PathC = FALSE; /*Initial at Modify Tx Scaling Mode*/
|
||||
pRFCalibrateInfo->Modify_TxAGC_Flag_PathD = FALSE; /*Initial at Modify Tx Scaling Mode*/
|
||||
pRFCalibrateInfo->Remnant_CCKSwingIdx = 0;
|
||||
pRFCalibrateInfo->ThermalValue = pHalData->EEPROMThermalMeter;
|
||||
|
||||
pRFCalibrateInfo->Modify_TxAGC_Value_CCK=0; //modify by Mingzhi.Guo
|
||||
pRFCalibrateInfo->Modify_TxAGC_Value_OFDM=0; //modify by Mingzhi.Guo
|
||||
}
|
||||
|
||||
VOID
|
||||
ODM_TXPowerTrackingCallback_ThermalMeter(
|
||||
#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
|
||||
IN PDM_ODM_T pDM_Odm
|
||||
#else
|
||||
IN PADAPTER Adapter
|
||||
#endif
|
||||
)
|
||||
{
|
||||
|
||||
#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
|
||||
PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc;
|
||||
#elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
|
||||
PDM_ODM_T pDM_Odm = &pHalData->odmpriv;
|
||||
#endif
|
||||
#endif
|
||||
PODM_RF_CAL_T pRFCalibrateInfo = &(pDM_Odm->RFCalibrateInfo);
|
||||
|
||||
u1Byte ThermalValue = 0, delta, delta_LCK, delta_IQK, p = 0, i = 0;
|
||||
s1Byte diff_DPK[4] = {0};
|
||||
u1Byte ThermalValue_AVG_count = 0;
|
||||
u4Byte ThermalValue_AVG = 0;
|
||||
|
||||
u1Byte OFDM_min_index = 0; // OFDM BB Swing should be less than +3.0dB, which is required by Arthur
|
||||
u1Byte Indexforchannel = 0; // GetRightChnlPlaceforIQK(pHalData->CurrentChannel)
|
||||
BOOLEAN bTSSIenable = FALSE;
|
||||
|
||||
TXPWRTRACK_CFG c;
|
||||
|
||||
//4 1. The following TWO tables decide the final index of OFDM/CCK swing table.
|
||||
pu1Byte deltaSwingTableIdx_TUP_A;
|
||||
pu1Byte deltaSwingTableIdx_TDOWN_A;
|
||||
pu1Byte deltaSwingTableIdx_TUP_B;
|
||||
pu1Byte deltaSwingTableIdx_TDOWN_B;
|
||||
/*for 8814 add by Yu Chen*/
|
||||
pu1Byte deltaSwingTableIdx_TUP_C;
|
||||
pu1Byte deltaSwingTableIdx_TDOWN_C;
|
||||
pu1Byte deltaSwingTableIdx_TUP_D;
|
||||
pu1Byte deltaSwingTableIdx_TDOWN_D;
|
||||
|
||||
//4 2. Initilization ( 7 steps in total )
|
||||
|
||||
ConfigureTxpowerTrack(pDM_Odm, &c);
|
||||
|
||||
(*c.GetDeltaSwingTable)(pDM_Odm, (pu1Byte*)&deltaSwingTableIdx_TUP_A, (pu1Byte*)&deltaSwingTableIdx_TDOWN_A,
|
||||
(pu1Byte*)&deltaSwingTableIdx_TUP_B, (pu1Byte*)&deltaSwingTableIdx_TDOWN_B);
|
||||
|
||||
if (pDM_Odm->SupportICType & ODM_RTL8814A) /*for 8814 path C & D*/
|
||||
(*c.GetDeltaSwingTable8814only)(pDM_Odm, (pu1Byte *)&deltaSwingTableIdx_TUP_C, (pu1Byte *)&deltaSwingTableIdx_TDOWN_C,
|
||||
(pu1Byte *)&deltaSwingTableIdx_TUP_D, (pu1Byte *)&deltaSwingTableIdx_TDOWN_D);
|
||||
|
||||
|
||||
pDM_Odm->RFCalibrateInfo.TXPowerTrackingCallbackCnt++; //cosa add for debug
|
||||
pDM_Odm->RFCalibrateInfo.bTXPowerTrackingInit = TRUE;
|
||||
|
||||
#if (MP_DRIVER == 1)
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
|
||||
pDM_Odm->RFCalibrateInfo.TxPowerTrackControl = pHalData->TxPowerTrackControl; // <Kordan> We should keep updating the control variable according to HalData.
|
||||
#endif
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_CE)
|
||||
if (pDM_Odm->mp_mode == TRUE)
|
||||
#endif
|
||||
// <Kordan> RFCalibrateInfo.RegA24 will be initialized when ODM HW configuring, but MP configures with para files.
|
||||
pDM_Odm->RFCalibrateInfo.RegA24 = 0x090e1317;
|
||||
#endif
|
||||
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("===>ODM_TXPowerTrackingCallback_ThermalMeter Start\n pRFCalibrateInfo->BbSwingIdxCckBase: %d, pRFCalibrateInfo->BbSwingIdxOfdmBase[A]: %d, pRFCalibrateInfo->DefaultOfdmIndex: %d\n",
|
||||
pRFCalibrateInfo->BbSwingIdxCckBase, pRFCalibrateInfo->BbSwingIdxOfdmBase[ODM_RF_PATH_A], pRFCalibrateInfo->DefaultOfdmIndex));
|
||||
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("pDM_Odm->RFCalibrateInfo.TxPowerTrackControl %d, pHalData->EEPROMThermalMeter %d\n", pDM_Odm->RFCalibrateInfo.TxPowerTrackControl, pHalData->EEPROMThermalMeter));
|
||||
ThermalValue = (u1Byte)ODM_GetRFReg(pDM_Odm, ODM_RF_PATH_A, c.ThermalRegAddr, 0xfc00); //0x42: RF Reg[15:10] 88E
|
||||
if( ! pDM_Odm->RFCalibrateInfo.TxPowerTrackControl || pHalData->EEPROMThermalMeter == 0 ||
|
||||
pHalData->EEPROMThermalMeter == 0xFF)
|
||||
return;
|
||||
|
||||
|
||||
//4 3. Initialize ThermalValues of RFCalibrateInfo
|
||||
|
||||
if(pDM_Odm->RFCalibrateInfo.bReloadtxpowerindex)
|
||||
{
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,("reload ofdm index for band switch\n"));
|
||||
}
|
||||
|
||||
//4 4. Calculate average thermal meter
|
||||
|
||||
pDM_Odm->RFCalibrateInfo.ThermalValue_AVG[pDM_Odm->RFCalibrateInfo.ThermalValue_AVG_index] = ThermalValue;
|
||||
pDM_Odm->RFCalibrateInfo.ThermalValue_AVG_index++;
|
||||
if(pDM_Odm->RFCalibrateInfo.ThermalValue_AVG_index == c.AverageThermalNum) //Average times = c.AverageThermalNum
|
||||
pDM_Odm->RFCalibrateInfo.ThermalValue_AVG_index = 0;
|
||||
|
||||
for(i = 0; i < c.AverageThermalNum; i++)
|
||||
{
|
||||
if(pDM_Odm->RFCalibrateInfo.ThermalValue_AVG[i])
|
||||
{
|
||||
ThermalValue_AVG += pDM_Odm->RFCalibrateInfo.ThermalValue_AVG[i];
|
||||
ThermalValue_AVG_count++;
|
||||
}
|
||||
}
|
||||
|
||||
if(ThermalValue_AVG_count) //Calculate Average ThermalValue after average enough times
|
||||
{
|
||||
ThermalValue = (u1Byte)(ThermalValue_AVG / ThermalValue_AVG_count);
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("AVG Thermal Meter = 0x%X, EFUSE Thermal Base = 0x%X\n", ThermalValue, pHalData->EEPROMThermalMeter));
|
||||
}
|
||||
|
||||
//4 5. Calculate delta, delta_LCK, delta_IQK.
|
||||
|
||||
//"delta" here is used to determine whether thermal value changes or not.
|
||||
delta = (ThermalValue > pDM_Odm->RFCalibrateInfo.ThermalValue)?(ThermalValue - pDM_Odm->RFCalibrateInfo.ThermalValue):(pDM_Odm->RFCalibrateInfo.ThermalValue - ThermalValue);
|
||||
delta_LCK = (ThermalValue > pDM_Odm->RFCalibrateInfo.ThermalValue_LCK)?(ThermalValue - pDM_Odm->RFCalibrateInfo.ThermalValue_LCK):(pDM_Odm->RFCalibrateInfo.ThermalValue_LCK - ThermalValue);
|
||||
delta_IQK = (ThermalValue > pDM_Odm->RFCalibrateInfo.ThermalValue_IQK)?(ThermalValue - pDM_Odm->RFCalibrateInfo.ThermalValue_IQK):(pDM_Odm->RFCalibrateInfo.ThermalValue_IQK - ThermalValue);
|
||||
|
||||
if (pDM_Odm->RFCalibrateInfo.ThermalValue_IQK == 0xff) { /*no PG, use thermal value for IQK*/
|
||||
pDM_Odm->RFCalibrateInfo.ThermalValue_IQK = ThermalValue;
|
||||
delta_IQK = (ThermalValue > pDM_Odm->RFCalibrateInfo.ThermalValue_IQK)?(ThermalValue - pDM_Odm->RFCalibrateInfo.ThermalValue_IQK):(pDM_Odm->RFCalibrateInfo.ThermalValue_IQK - ThermalValue);
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("no PG, use ThermalValue for IQK\n"));
|
||||
}
|
||||
|
||||
for (p = ODM_RF_PATH_A; p < c.RfPathCount; p++)
|
||||
diff_DPK[p] = (s1Byte)ThermalValue - (s1Byte)pDM_Odm->RFCalibrateInfo.DpkThermal[p];
|
||||
|
||||
/*4 6. If necessary, do LCK.*/
|
||||
if (!(pDM_Odm->SupportICType & ODM_RTL8821)) {
|
||||
|
||||
if (pDM_Odm->RFCalibrateInfo.ThermalValue_LCK == 0xff) {
|
||||
/*no PG , do LCK at initial status*/
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("no PG, do LCK\n"));
|
||||
pDM_Odm->RFCalibrateInfo.ThermalValue_LCK = ThermalValue;
|
||||
if (c.PHY_LCCalibrate)
|
||||
(*c.PHY_LCCalibrate)(pDM_Odm);
|
||||
delta_LCK = (ThermalValue > pDM_Odm->RFCalibrateInfo.ThermalValue_LCK)?(ThermalValue - pDM_Odm->RFCalibrateInfo.ThermalValue_LCK):(pDM_Odm->RFCalibrateInfo.ThermalValue_LCK - ThermalValue);
|
||||
}
|
||||
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("(delta, delta_LCK, delta_IQK) = (%d, %d, %d)\n", delta, delta_LCK, delta_IQK));
|
||||
/*DBG_871X("(delta, delta_LCK, delta_IQK) = (%d, %d, %d), %d\n", delta, delta_LCK, delta_IQK, c.Threshold_IQK);*/
|
||||
|
||||
/* 4 6. If necessary, do LCK.*/
|
||||
|
||||
if (delta_LCK >= c.Threshold_IQK) {
|
||||
/* Delta temperature is equal to or larger than 20 centigrade.*/
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("delta_LCK(%d) >= Threshold_IQK(%d)\n", delta_LCK, c.Threshold_IQK));
|
||||
pDM_Odm->RFCalibrateInfo.ThermalValue_LCK = ThermalValue;
|
||||
if (c.PHY_LCCalibrate)
|
||||
(*c.PHY_LCCalibrate)(pDM_Odm);
|
||||
}
|
||||
}
|
||||
//3 7. If necessary, move the index of swing table to adjust Tx power.
|
||||
|
||||
if (delta > 0 && pDM_Odm->RFCalibrateInfo.TxPowerTrackControl)
|
||||
{
|
||||
//"delta" here is used to record the absolute value of differrence.
|
||||
#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE))
|
||||
delta = ThermalValue > pHalData->EEPROMThermalMeter?(ThermalValue - pHalData->EEPROMThermalMeter):(pHalData->EEPROMThermalMeter - ThermalValue);
|
||||
#else
|
||||
delta = (ThermalValue > pDM_Odm->priv->pmib->dot11RFEntry.ther)?(ThermalValue - pDM_Odm->priv->pmib->dot11RFEntry.ther):(pDM_Odm->priv->pmib->dot11RFEntry.ther - ThermalValue);
|
||||
#endif
|
||||
if (delta >= TXPWR_TRACK_TABLE_SIZE)
|
||||
delta = TXPWR_TRACK_TABLE_SIZE - 1;
|
||||
|
||||
//4 7.1 The Final Power Index = BaseIndex + PowerIndexOffset
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE))
|
||||
if(ThermalValue > pHalData->EEPROMThermalMeter) {
|
||||
#else
|
||||
if(ThermalValue > pDM_Odm->priv->pmib->dot11RFEntry.ther) {
|
||||
#endif
|
||||
for (p = ODM_RF_PATH_A; p < c.RfPathCount; p++) {
|
||||
pDM_Odm->RFCalibrateInfo.DeltaPowerIndexLast[p] = pDM_Odm->RFCalibrateInfo.DeltaPowerIndex[p]; /* recording power index offset */
|
||||
switch (p) {
|
||||
case ODM_RF_PATH_B:
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("deltaSwingTableIdx_TUP_B[%d] = %d\n", delta, deltaSwingTableIdx_TUP_B[delta]));
|
||||
|
||||
pDM_Odm->RFCalibrateInfo.DeltaPowerIndex[p] = deltaSwingTableIdx_TUP_B[delta];
|
||||
pRFCalibrateInfo->Absolute_OFDMSwingIdx[p] = deltaSwingTableIdx_TUP_B[delta]; /* Record delta swing for mix mode power tracking */
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("******Temp is higher and pRFCalibrateInfo->Absolute_OFDMSwingIdx[ODM_RF_PATH_B] = %d\n", pRFCalibrateInfo->Absolute_OFDMSwingIdx[p]));
|
||||
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("******Temp is higher and pRFCalibrateInfo->Absolute_OFDMSwingIdx[ODM_RF_PATH_A] = %d\n", pRFCalibrateInfo->Absolute_OFDMSwingIdx[ODM_RF_PATH_A]));
|
||||
|
||||
|
||||
break;
|
||||
|
||||
case ODM_RF_PATH_C:
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("deltaSwingTableIdx_TUP_C[%d] = %d\n", delta, deltaSwingTableIdx_TUP_C[delta]));
|
||||
|
||||
pDM_Odm->RFCalibrateInfo.DeltaPowerIndex[p] = deltaSwingTableIdx_TUP_C[delta];
|
||||
pRFCalibrateInfo->Absolute_OFDMSwingIdx[p] = deltaSwingTableIdx_TUP_C[delta]; /* Record delta swing for mix mode power tracking */
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("******Temp is higher and pDM_Odm->Absolute_OFDMSwingIdx[ODM_RF_PATH_C] = %d\n", pRFCalibrateInfo->Absolute_OFDMSwingIdx[p]));
|
||||
break;
|
||||
|
||||
case ODM_RF_PATH_D:
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("deltaSwingTableIdx_TUP_D[%d] = %d\n", delta, deltaSwingTableIdx_TUP_D[delta]));
|
||||
|
||||
pDM_Odm->RFCalibrateInfo.DeltaPowerIndex[p] = deltaSwingTableIdx_TUP_D[delta];
|
||||
pRFCalibrateInfo->Absolute_OFDMSwingIdx[p] = deltaSwingTableIdx_TUP_D[delta]; /* Record delta swing for mix mode power tracking */
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("******Temp is higher and pRFCalibrateInfo->Absolute_OFDMSwingIdx[ODM_RF_PATH_D] = %d\n", pRFCalibrateInfo->Absolute_OFDMSwingIdx[p]));
|
||||
break;
|
||||
|
||||
default:
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("deltaSwingTableIdx_TUP_A[%d] = %d\n", delta, deltaSwingTableIdx_TUP_A[delta]));
|
||||
|
||||
pDM_Odm->RFCalibrateInfo.DeltaPowerIndex[p] = deltaSwingTableIdx_TUP_A[delta];
|
||||
pRFCalibrateInfo->Absolute_OFDMSwingIdx[p] = deltaSwingTableIdx_TUP_A[delta]; /* Record delta swing for mix mode power tracking */
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("******Temp is higher and pDM_Odm->Absolute_OFDMSwingIdx[ODM_RF_PATH_A] = %d\n", pRFCalibrateInfo->Absolute_OFDMSwingIdx[p]));
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (p = ODM_RF_PATH_A; p < c.RfPathCount; p++) {
|
||||
pDM_Odm->RFCalibrateInfo.DeltaPowerIndexLast[p] = pDM_Odm->RFCalibrateInfo.DeltaPowerIndex[p]; /* recording poer index offset */
|
||||
switch (p) {
|
||||
case ODM_RF_PATH_B:
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("deltaSwingTableIdx_TDOWN_B[%d] = %d\n", delta, deltaSwingTableIdx_TDOWN_B[delta]));
|
||||
pDM_Odm->RFCalibrateInfo.DeltaPowerIndex[p] = -1 * deltaSwingTableIdx_TDOWN_B[delta];
|
||||
pRFCalibrateInfo->Absolute_OFDMSwingIdx[p] = -1 * deltaSwingTableIdx_TDOWN_B[delta]; /* Record delta swing for mix mode power tracking */
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("******Temp is lower and pDM_Odm->Absolute_OFDMSwingIdx[ODM_RF_PATH_B] = %d\n", pRFCalibrateInfo->Absolute_OFDMSwingIdx[p]));
|
||||
break;
|
||||
|
||||
case ODM_RF_PATH_C:
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("deltaSwingTableIdx_TDOWN_C[%d] = %d\n", delta, deltaSwingTableIdx_TDOWN_C[delta]));
|
||||
pDM_Odm->RFCalibrateInfo.DeltaPowerIndex[p] = -1 * deltaSwingTableIdx_TDOWN_C[delta];
|
||||
pRFCalibrateInfo->Absolute_OFDMSwingIdx[p] = -1 * deltaSwingTableIdx_TDOWN_C[delta]; /* Record delta swing for mix mode power tracking */
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("******Temp is lower and pDM_Odm->Absolute_OFDMSwingIdx[ODM_RF_PATH_C] = %d\n", pRFCalibrateInfo->Absolute_OFDMSwingIdx[p]));
|
||||
break;
|
||||
|
||||
case ODM_RF_PATH_D:
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("deltaSwingTableIdx_TDOWN_D[%d] = %d\n", delta, deltaSwingTableIdx_TDOWN_D[delta]));
|
||||
pDM_Odm->RFCalibrateInfo.DeltaPowerIndex[p] = -1 * deltaSwingTableIdx_TDOWN_D[delta];
|
||||
pRFCalibrateInfo->Absolute_OFDMSwingIdx[p] = -1 * deltaSwingTableIdx_TDOWN_D[delta]; /* Record delta swing for mix mode power tracking */
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("******Temp is lower and pDM_Odm->Absolute_OFDMSwingIdx[ODM_RF_PATH_D] = %d\n", pRFCalibrateInfo->Absolute_OFDMSwingIdx[p]));
|
||||
break;
|
||||
|
||||
default:
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("deltaSwingTableIdx_TDOWN_A[%d] = %d\n", delta, deltaSwingTableIdx_TDOWN_A[delta]));
|
||||
pDM_Odm->RFCalibrateInfo.DeltaPowerIndex[p] = -1 * deltaSwingTableIdx_TDOWN_A[delta];
|
||||
pRFCalibrateInfo->Absolute_OFDMSwingIdx[p] = -1 * deltaSwingTableIdx_TDOWN_A[delta]; /* Record delta swing for mix mode power tracking */
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("******Temp is lower and pDM_Odm->Absolute_OFDMSwingIdx[ODM_RF_PATH_A] = %d\n", pRFCalibrateInfo->Absolute_OFDMSwingIdx[p]));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (p = ODM_RF_PATH_A; p < c.RfPathCount; p++) {
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("\n\n=========================== [Path-%d] Calculating PowerIndexOffset===========================\n", p));
|
||||
if (pDM_Odm->RFCalibrateInfo.DeltaPowerIndex[p] == pDM_Odm->RFCalibrateInfo.DeltaPowerIndexLast[p]) /* If Thermal value changes but lookup table value still the same */
|
||||
pDM_Odm->RFCalibrateInfo.PowerIndexOffset[p] = 0;
|
||||
else
|
||||
pDM_Odm->RFCalibrateInfo.PowerIndexOffset[p] = pDM_Odm->RFCalibrateInfo.DeltaPowerIndex[p] - pDM_Odm->RFCalibrateInfo.DeltaPowerIndexLast[p]; /* Power Index Diff between 2 times Power Tracking */
|
||||
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("[Path-%d] PowerIndexOffset(%d) = DeltaPowerIndex(%d) - DeltaPowerIndexLast(%d)\n", p, pDM_Odm->RFCalibrateInfo.PowerIndexOffset[p], pDM_Odm->RFCalibrateInfo.DeltaPowerIndex[p], pDM_Odm->RFCalibrateInfo.DeltaPowerIndexLast[p]));
|
||||
|
||||
pDM_Odm->RFCalibrateInfo.OFDM_index[p] = pRFCalibrateInfo->BbSwingIdxOfdmBase[p] + pDM_Odm->RFCalibrateInfo.PowerIndexOffset[p];
|
||||
pDM_Odm->RFCalibrateInfo.CCK_index = pRFCalibrateInfo->BbSwingIdxCckBase + pDM_Odm->RFCalibrateInfo.PowerIndexOffset[p];
|
||||
|
||||
pRFCalibrateInfo->BbSwingIdxCck = pDM_Odm->RFCalibrateInfo.CCK_index;
|
||||
pRFCalibrateInfo->BbSwingIdxOfdm[p] = pDM_Odm->RFCalibrateInfo.OFDM_index[p];
|
||||
|
||||
|
||||
|
||||
/* *************Print BB Swing Base and Index Offset************* */
|
||||
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("The 'CCK' final index(%d) = BaseIndex(%d) + PowerIndexOffset(%d)\n", pRFCalibrateInfo->BbSwingIdxCck, pRFCalibrateInfo->BbSwingIdxCckBase, pDM_Odm->RFCalibrateInfo.PowerIndexOffset[p]));
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("The 'OFDM' final index(%d) = BaseIndex[%d](%d) + PowerIndexOffset(%d)\n", pRFCalibrateInfo->BbSwingIdxOfdm[p], p, pRFCalibrateInfo->BbSwingIdxOfdmBase[p], pDM_Odm->RFCalibrateInfo.PowerIndexOffset[p]));
|
||||
|
||||
//4 7.1 Handle boundary conditions of index.
|
||||
|
||||
if(pDM_Odm->RFCalibrateInfo.OFDM_index[p] > c.SwingTableSize_OFDM-1)
|
||||
{
|
||||
pDM_Odm->RFCalibrateInfo.OFDM_index[p] = c.SwingTableSize_OFDM-1;
|
||||
}
|
||||
else if (pDM_Odm->RFCalibrateInfo.OFDM_index[p] < OFDM_min_index)
|
||||
{
|
||||
pDM_Odm->RFCalibrateInfo.OFDM_index[p] = OFDM_min_index;
|
||||
}
|
||||
}
|
||||
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("\n\n========================================================================================================\n"));
|
||||
if(pDM_Odm->RFCalibrateInfo.CCK_index > c.SwingTableSize_CCK-1)
|
||||
pDM_Odm->RFCalibrateInfo.CCK_index = c.SwingTableSize_CCK-1;
|
||||
else if (pDM_Odm->RFCalibrateInfo.CCK_index <= 0)
|
||||
pDM_Odm->RFCalibrateInfo.CCK_index = 0;
|
||||
} else {
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("The thermal meter is unchanged or TxPowerTracking OFF(%d): ThermalValue: %d , pDM_Odm->RFCalibrateInfo.ThermalValue: %d\n",
|
||||
pDM_Odm->RFCalibrateInfo.TxPowerTrackControl, ThermalValue, pDM_Odm->RFCalibrateInfo.ThermalValue));
|
||||
|
||||
for (p = ODM_RF_PATH_A; p < c.RfPathCount; p++)
|
||||
pDM_Odm->RFCalibrateInfo.PowerIndexOffset[p] = 0;
|
||||
}
|
||||
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("TxPowerTracking: [CCK] Swing Current Index: %d, Swing Base Index: %d\n",
|
||||
pDM_Odm->RFCalibrateInfo.CCK_index, pRFCalibrateInfo->BbSwingIdxCckBase)); /*Print Swing base & current*/
|
||||
|
||||
for (p = ODM_RF_PATH_A; p < c.RfPathCount; p++)
|
||||
{
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("TxPowerTracking: [OFDM] Swing Current Index: %d, Swing Base Index[%d]: %d\n",
|
||||
pDM_Odm->RFCalibrateInfo.OFDM_index[p], p, pRFCalibrateInfo->BbSwingIdxOfdmBase[p]));
|
||||
}
|
||||
|
||||
if ((pDM_Odm->RFCalibrateInfo.PowerIndexOffset[ODM_RF_PATH_A] != 0 ||
|
||||
pDM_Odm->RFCalibrateInfo.PowerIndexOffset[ODM_RF_PATH_B] != 0 ||
|
||||
pDM_Odm->RFCalibrateInfo.PowerIndexOffset[ODM_RF_PATH_C] != 0 ||
|
||||
pDM_Odm->RFCalibrateInfo.PowerIndexOffset[ODM_RF_PATH_D] != 0) &&
|
||||
pDM_Odm->RFCalibrateInfo.TxPowerTrackControl && (pHalData->EEPROMThermalMeter != 0xff))
|
||||
{
|
||||
//4 7.2 Configure the Swing Table to adjust Tx Power.
|
||||
|
||||
pDM_Odm->RFCalibrateInfo.bTxPowerChanged = TRUE; // Always TRUE after Tx Power is adjusted by power tracking.
|
||||
//
|
||||
// 2012/04/23 MH According to Luke's suggestion, we can not write BB digital
|
||||
// to increase TX power. Otherwise, EVM will be bad.
|
||||
//
|
||||
// 2012/04/25 MH Add for tx power tracking to set tx power in tx agc for 88E.
|
||||
if (ThermalValue > pDM_Odm->RFCalibrateInfo.ThermalValue)
|
||||
{
|
||||
for (p = ODM_RF_PATH_A; p < c.RfPathCount; p++) {
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("Temperature Increasing(%d): delta_pi: %d , delta_t: %d, Now_t: %d, EFUSE_t: %d, Last_t: %d\n",
|
||||
p, pDM_Odm->RFCalibrateInfo.PowerIndexOffset[p], delta, ThermalValue, pHalData->EEPROMThermalMeter, pDM_Odm->RFCalibrateInfo.ThermalValue));
|
||||
}
|
||||
}
|
||||
else if (ThermalValue < pDM_Odm->RFCalibrateInfo.ThermalValue)// Low temperature
|
||||
{
|
||||
for (p = ODM_RF_PATH_A; p < c.RfPathCount; p++) {
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("Temperature Decreasing(%d): delta_pi: %d , delta_t: %d, Now_t: %d, EFUSE_t: %d, Last_t: %d\n",
|
||||
p, pDM_Odm->RFCalibrateInfo.PowerIndexOffset[p], delta, ThermalValue, pHalData->EEPROMThermalMeter, pDM_Odm->RFCalibrateInfo.ThermalValue));
|
||||
}
|
||||
}
|
||||
|
||||
#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
|
||||
if (ThermalValue > pHalData->EEPROMThermalMeter)
|
||||
#else
|
||||
if (ThermalValue > pDM_Odm->priv->pmib->dot11RFEntry.ther)
|
||||
#endif
|
||||
{
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("Temperature(%d) higher than PG value(%d)\n", ThermalValue, pHalData->EEPROMThermalMeter));
|
||||
|
||||
if (pDM_Odm->SupportICType == ODM_RTL8188E || pDM_Odm->SupportICType == ODM_RTL8192E || pDM_Odm->SupportICType == ODM_RTL8821 ||
|
||||
pDM_Odm->SupportICType == ODM_RTL8812 || pDM_Odm->SupportICType == ODM_RTL8723B || pDM_Odm->SupportICType == ODM_RTL8814A ||
|
||||
pDM_Odm->SupportICType == ODM_RTL8822B || pDM_Odm->SupportICType == ODM_RTL8188F || pDM_Odm->SupportICType == ODM_RTL8703B) {
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("**********Enter POWER Tracking MIX_MODE**********\n"));
|
||||
for (p = ODM_RF_PATH_A; p < c.RfPathCount; p++)
|
||||
(*c.ODM_TxPwrTrackSetPwr)(pDM_Odm, MIX_MODE, p, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("**********Enter POWER Tracking BBSWING_MODE**********\n"));
|
||||
for (p = ODM_RF_PATH_A; p < c.RfPathCount; p++)
|
||||
(*c.ODM_TxPwrTrackSetPwr)(pDM_Odm, BBSWING, p, Indexforchannel);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("Temperature(%d) lower than PG value(%d)\n", ThermalValue, pHalData->EEPROMThermalMeter));
|
||||
|
||||
if (pDM_Odm->SupportICType == ODM_RTL8188E || pDM_Odm->SupportICType == ODM_RTL8192E || pDM_Odm->SupportICType == ODM_RTL8821 ||
|
||||
pDM_Odm->SupportICType == ODM_RTL8812 || pDM_Odm->SupportICType == ODM_RTL8723B || pDM_Odm->SupportICType == ODM_RTL8814A ||
|
||||
pDM_Odm->SupportICType == ODM_RTL8822B || pDM_Odm->SupportICType == ODM_RTL8188F || pDM_Odm->SupportICType == ODM_RTL8703B) {
|
||||
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("**********Enter POWER Tracking MIX_MODE**********\n"));
|
||||
for (p = ODM_RF_PATH_A; p < c.RfPathCount; p++)
|
||||
(*c.ODM_TxPwrTrackSetPwr)(pDM_Odm, MIX_MODE, p, Indexforchannel);
|
||||
}
|
||||
else
|
||||
{
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("**********Enter POWER Tracking BBSWING_MODE**********\n"));
|
||||
for (p = ODM_RF_PATH_A; p < c.RfPathCount; p++)
|
||||
(*c.ODM_TxPwrTrackSetPwr)(pDM_Odm, BBSWING, p, Indexforchannel);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
pRFCalibrateInfo->BbSwingIdxCckBase = pRFCalibrateInfo->BbSwingIdxCck; /*Record last time Power Tracking result as base.*/
|
||||
for (p = ODM_RF_PATH_A; p < c.RfPathCount; p++)
|
||||
pRFCalibrateInfo->BbSwingIdxOfdmBase[p] = pRFCalibrateInfo->BbSwingIdxOfdm[p];
|
||||
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("pDM_Odm->RFCalibrateInfo.ThermalValue = %d ThermalValue= %d\n", pDM_Odm->RFCalibrateInfo.ThermalValue, ThermalValue));
|
||||
|
||||
pDM_Odm->RFCalibrateInfo.ThermalValue = ThermalValue; /*Record last Power Tracking Thermal Value*/
|
||||
|
||||
}
|
||||
|
||||
#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
|
||||
|
||||
if (!IS_HARDWARE_TYPE_8723B(Adapter) && !IS_HARDWARE_TYPE_8192E(Adapter) && !IS_HARDWARE_TYPE_8703B(Adapter)) {
|
||||
/* Delta temperature is equal to or larger than 20 centigrade (When threshold is 8).*/
|
||||
if (delta_IQK >= c.Threshold_IQK) {
|
||||
if (!pDM_Odm->RFCalibrateInfo.bIQKInProgress)
|
||||
(*c.DoIQK)(pDM_Odm, delta_IQK, ThermalValue, 8);
|
||||
}
|
||||
}
|
||||
if (!(pDM_Odm->SupportICType & ODM_RTL8814A)) {
|
||||
if (pDM_Odm->RFCalibrateInfo.DpkThermal[ODM_RF_PATH_A] != 0) {
|
||||
if (diff_DPK[ODM_RF_PATH_A] >= c.Threshold_DPK) {
|
||||
ODM_SetBBReg(pDM_Odm, 0x82c, BIT(31), 0x1);
|
||||
ODM_SetBBReg(pDM_Odm, 0xcc4, BIT14|BIT13|BIT12|BIT11|BIT10, (diff_DPK[ODM_RF_PATH_A] / c.Threshold_DPK));
|
||||
ODM_SetBBReg(pDM_Odm, 0x82c, BIT(31), 0x0);
|
||||
} else if ((diff_DPK[ODM_RF_PATH_A] <= -1 * c.Threshold_DPK)) {
|
||||
s4Byte value = 0x20 + (diff_DPK[ODM_RF_PATH_A] / c.Threshold_DPK);
|
||||
|
||||
ODM_SetBBReg(pDM_Odm, 0x82c, BIT(31), 0x1);
|
||||
ODM_SetBBReg(pDM_Odm, 0xcc4, BIT14|BIT13|BIT12|BIT11|BIT10, value);
|
||||
ODM_SetBBReg(pDM_Odm, 0x82c, BIT(31), 0x0);
|
||||
} else {
|
||||
ODM_SetBBReg(pDM_Odm, 0x82c, BIT(31), 0x1);
|
||||
ODM_SetBBReg(pDM_Odm, 0xcc4, BIT14|BIT13|BIT12|BIT11|BIT10, 0);
|
||||
ODM_SetBBReg(pDM_Odm, 0x82c, BIT(31), 0x0);
|
||||
}
|
||||
}
|
||||
if (pDM_Odm->RFCalibrateInfo.DpkThermal[ODM_RF_PATH_B] != 0) {
|
||||
if (diff_DPK[ODM_RF_PATH_B] >= c.Threshold_DPK) {
|
||||
ODM_SetBBReg(pDM_Odm, 0x82c, BIT(31), 0x1);
|
||||
ODM_SetBBReg(pDM_Odm, 0xec4, BIT14|BIT13|BIT12|BIT11|BIT10, (diff_DPK[ODM_RF_PATH_B] / c.Threshold_DPK));
|
||||
ODM_SetBBReg(pDM_Odm, 0x82c, BIT(31), 0x0);
|
||||
} else if ((diff_DPK[ODM_RF_PATH_B] <= -1 * c.Threshold_DPK)) {
|
||||
s4Byte value = 0x20 + (diff_DPK[ODM_RF_PATH_B] / c.Threshold_DPK);
|
||||
|
||||
ODM_SetBBReg(pDM_Odm, 0x82c, BIT(31), 0x1);
|
||||
ODM_SetBBReg(pDM_Odm, 0xec4, BIT14|BIT13|BIT12|BIT11|BIT10, value);
|
||||
ODM_SetBBReg(pDM_Odm, 0x82c, BIT(31), 0x0);
|
||||
} else {
|
||||
ODM_SetBBReg(pDM_Odm, 0x82c, BIT(31), 0x1);
|
||||
ODM_SetBBReg(pDM_Odm, 0xec4, BIT14|BIT13|BIT12|BIT11|BIT10, 0);
|
||||
ODM_SetBBReg(pDM_Odm, 0x82c, BIT(31), 0x0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("<===ODM_TXPowerTrackingCallback_ThermalMeter End\n"));
|
||||
|
||||
pDM_Odm->RFCalibrateInfo.TXPowercount = 0;
|
||||
}
|
||||
|
||||
|
||||
//3============================================================
|
||||
//3 IQ Calibration
|
||||
//3============================================================
|
||||
|
||||
VOID
|
||||
ODM_ResetIQKResult(
|
||||
IN PVOID pDM_VOID
|
||||
)
|
||||
{
|
||||
return;
|
||||
|
||||
}
|
||||
#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
|
||||
u1Byte ODM_GetRightChnlPlaceforIQK(u1Byte chnl)
|
||||
{
|
||||
u1Byte channel_all[ODM_TARGET_CHNL_NUM_2G_5G] =
|
||||
{1,2,3,4,5,6,7,8,9,10,11,12,13,14,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,100,102,104,106,108,110,112,114,116,118,120,122,124,126,128,130,132,134,136,138,140,149,151,153,155,157,159,161,163,165};
|
||||
u1Byte place = chnl;
|
||||
|
||||
|
||||
if(chnl > 14)
|
||||
{
|
||||
for(place = 14; place<sizeof(channel_all); place++)
|
||||
{
|
||||
if(channel_all[place] == chnl)
|
||||
{
|
||||
return place-13;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
VOID
|
||||
odm_IQCalibrate(
|
||||
IN PDM_ODM_T pDM_Odm
|
||||
)
|
||||
{
|
||||
PADAPTER Adapter = pDM_Odm->Adapter;
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
|
||||
if (*pDM_Odm->pIsFcsModeEnable)
|
||||
return;
|
||||
#endif
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE))
|
||||
if (!IS_HARDWARE_TYPE_JAGUAR(Adapter))
|
||||
return;
|
||||
#if (DM_ODM_SUPPORT_TYPE & (ODM_CE))
|
||||
else if (IS_HARDWARE_TYPE_8812AU(Adapter))
|
||||
return;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if (RTL8821A_SUPPORT == 1)
|
||||
if (pDM_Odm->bLinked) {
|
||||
if ((*pDM_Odm->pChannel != pDM_Odm->preChannel) && (!*pDM_Odm->pbScanInProcess)) {
|
||||
pDM_Odm->preChannel = *pDM_Odm->pChannel;
|
||||
pDM_Odm->LinkedInterval = 0;
|
||||
}
|
||||
|
||||
if (pDM_Odm->LinkedInterval < 3)
|
||||
pDM_Odm->LinkedInterval++;
|
||||
|
||||
if (pDM_Odm->LinkedInterval == 2) {
|
||||
/*Mark out IQK flow to prevent tx stuck. by Maddest 20130306*/
|
||||
/*Open it verified by James 20130715*/
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_CE)
|
||||
PHY_IQCalibrate_8821A(pDM_Odm, FALSE);
|
||||
#elif (DM_ODM_SUPPORT_TYPE == ODM_WIN)
|
||||
PHY_IQCalibrate(Adapter, FALSE);
|
||||
#else
|
||||
PHY_IQCalibrate_8821A(Adapter, FALSE);
|
||||
#endif
|
||||
}
|
||||
} else
|
||||
pDM_Odm->LinkedInterval = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
void phydm_rf_init(IN PVOID pDM_VOID)
|
||||
{
|
||||
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
|
||||
odm_TXPowerTrackingInit(pDM_Odm);
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE))
|
||||
ODM_ClearTxPowerTrackingState(pDM_Odm);
|
||||
#endif
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
|
||||
#if (RTL8814A_SUPPORT == 1)
|
||||
if (pDM_Odm->SupportICType & ODM_RTL8814A)
|
||||
PHY_IQCalibrate_8814A_Init(pDM_Odm);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void phydm_rf_watchdog(IN PVOID pDM_VOID)
|
||||
{
|
||||
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
|
||||
#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE))
|
||||
ODM_TXPowerTrackingCheck(pDM_Odm);
|
||||
if (pDM_Odm->SupportICType & ODM_IC_11AC_SERIES)
|
||||
odm_IQCalibrate(pDM_Odm);
|
||||
#endif
|
||||
}
|
||||
106
hal/phydm/halphyrf_ce.h
Normal file
106
hal/phydm/halphyrf_ce.h
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __HAL_PHY_RF_H__
|
||||
#define __HAL_PHY_RF_H__
|
||||
|
||||
/*#include "phydm_kfree.h"*/
|
||||
#if (RTL8814A_SUPPORT == 1)
|
||||
#include "rtl8814a/phydm_iqk_8814a.h"
|
||||
#endif
|
||||
|
||||
#if (RTL8822B_SUPPORT == 1)
|
||||
#include "rtl8822b/phydm_iqk_8822b.h"
|
||||
#endif
|
||||
#include "phydm_powertracking_ce.h"
|
||||
|
||||
|
||||
typedef enum _SPUR_CAL_METHOD {
|
||||
PLL_RESET,
|
||||
AFE_PHASE_SEL
|
||||
} SPUR_CAL_METHOD;
|
||||
|
||||
typedef enum _PWRTRACK_CONTROL_METHOD {
|
||||
BBSWING,
|
||||
TXAGC,
|
||||
MIX_MODE,
|
||||
TSSI_MODE
|
||||
} PWRTRACK_METHOD;
|
||||
|
||||
typedef VOID (*FuncSetPwr)(PVOID, PWRTRACK_METHOD, u1Byte, u1Byte);
|
||||
typedef VOID(*FuncIQK)(PVOID, u1Byte, u1Byte, u1Byte);
|
||||
typedef VOID (*FuncLCK)(PVOID);
|
||||
typedef VOID (*FuncSwing)(PVOID, pu1Byte*, pu1Byte*, pu1Byte*, pu1Byte*);
|
||||
typedef VOID (*FuncSwing8814only)(PVOID, pu1Byte*, pu1Byte*, pu1Byte*, pu1Byte*);
|
||||
|
||||
typedef struct _TXPWRTRACK_CFG {
|
||||
u1Byte SwingTableSize_CCK;
|
||||
u1Byte SwingTableSize_OFDM;
|
||||
u1Byte Threshold_IQK;
|
||||
u1Byte Threshold_DPK;
|
||||
u1Byte AverageThermalNum;
|
||||
u1Byte RfPathCount;
|
||||
u4Byte ThermalRegAddr;
|
||||
FuncSetPwr ODM_TxPwrTrackSetPwr;
|
||||
FuncIQK DoIQK;
|
||||
FuncLCK PHY_LCCalibrate;
|
||||
FuncSwing GetDeltaSwingTable;
|
||||
FuncSwing8814only GetDeltaSwingTable8814only;
|
||||
} TXPWRTRACK_CFG, *PTXPWRTRACK_CFG;
|
||||
|
||||
void ConfigureTxpowerTrack(
|
||||
IN PVOID pDM_VOID,
|
||||
OUT PTXPWRTRACK_CFG pConfig
|
||||
);
|
||||
|
||||
|
||||
VOID
|
||||
ODM_ClearTxPowerTrackingState(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
ODM_TXPowerTrackingCallback_ThermalMeter(
|
||||
#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
|
||||
IN PVOID pDM_VOID
|
||||
#else
|
||||
IN PADAPTER Adapter
|
||||
#endif
|
||||
);
|
||||
|
||||
|
||||
|
||||
#define ODM_TARGET_CHNL_NUM_2G_5G 59
|
||||
|
||||
|
||||
VOID
|
||||
ODM_ResetIQKResult(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
u1Byte
|
||||
ODM_GetRightChnlPlaceforIQK(
|
||||
IN u1Byte chnl
|
||||
);
|
||||
|
||||
void phydm_rf_init( IN PVOID pDM_VOID);
|
||||
void phydm_rf_watchdog( IN PVOID pDM_VOID);
|
||||
|
||||
#endif // #ifndef __HAL_PHY_RF_H__
|
||||
|
||||
716
hal/phydm/halphyrf_win.c
Normal file
716
hal/phydm/halphyrf_win.c
Normal file
|
|
@ -0,0 +1,716 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#include "mp_precomp.h"
|
||||
#include "phydm_precomp.h"
|
||||
|
||||
//#if(DM_ODM_SUPPORT_TYPE & ODM_WIN)
|
||||
|
||||
#define CALCULATE_SWINGTALBE_OFFSET(_offset, _direction, _size, _deltaThermal) \
|
||||
do {\
|
||||
for(_offset = 0; _offset < _size; _offset++)\
|
||||
{\
|
||||
if(_deltaThermal < thermalThreshold[_direction][_offset])\
|
||||
{\
|
||||
if(_offset != 0)\
|
||||
_offset--;\
|
||||
break;\
|
||||
}\
|
||||
} \
|
||||
if(_offset >= _size)\
|
||||
_offset = _size-1;\
|
||||
} while(0)
|
||||
|
||||
|
||||
void ConfigureTxpowerTrack(
|
||||
IN PDM_ODM_T pDM_Odm,
|
||||
OUT PTXPWRTRACK_CFG pConfig
|
||||
)
|
||||
{
|
||||
#if RTL8192E_SUPPORT
|
||||
if(pDM_Odm->SupportICType==ODM_RTL8192E)
|
||||
ConfigureTxpowerTrack_8192E(pConfig);
|
||||
#endif
|
||||
#if RTL8821A_SUPPORT
|
||||
if(pDM_Odm->SupportICType==ODM_RTL8821)
|
||||
ConfigureTxpowerTrack_8821A(pConfig);
|
||||
#endif
|
||||
#if RTL8812A_SUPPORT
|
||||
if(pDM_Odm->SupportICType==ODM_RTL8812)
|
||||
ConfigureTxpowerTrack_8812A(pConfig);
|
||||
#endif
|
||||
#if RTL8188E_SUPPORT
|
||||
if(pDM_Odm->SupportICType==ODM_RTL8188E)
|
||||
ConfigureTxpowerTrack_8188E(pConfig);
|
||||
#endif
|
||||
|
||||
#if RTL8188F_SUPPORT
|
||||
if(pDM_Odm->SupportICType==ODM_RTL8188F)
|
||||
ConfigureTxpowerTrack_8188F(pConfig);
|
||||
#endif
|
||||
|
||||
#if RTL8723B_SUPPORT
|
||||
if(pDM_Odm->SupportICType==ODM_RTL8723B)
|
||||
ConfigureTxpowerTrack_8723B(pConfig);
|
||||
#endif
|
||||
|
||||
#if RTL8814A_SUPPORT
|
||||
if(pDM_Odm->SupportICType==ODM_RTL8814A)
|
||||
ConfigureTxpowerTrack_8814A(pConfig);
|
||||
#endif
|
||||
|
||||
#if RTL8821B_SUPPORT
|
||||
if(pDM_Odm->SupportICType==ODM_RTL8821B)
|
||||
ConfigureTxpowerTrack_8821B(pConfig);
|
||||
#endif
|
||||
|
||||
#if RTL8703B_SUPPORT
|
||||
if(pDM_Odm->SupportICType==ODM_RTL8703B)
|
||||
ConfigureTxpowerTrack_8703B(pConfig);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
//======================================================================
|
||||
// <20121113, Kordan> This function should be called when TxAGC changed.
|
||||
// Otherwise the previous compensation is gone, because we record the
|
||||
// delta of temperature between two TxPowerTracking watch dogs.
|
||||
//
|
||||
// NOTE: If Tx BB swing or Tx scaling is varified during run-time, still
|
||||
// need to call this function.
|
||||
//======================================================================
|
||||
VOID
|
||||
ODM_ClearTxPowerTrackingState(
|
||||
IN PDM_ODM_T pDM_Odm
|
||||
)
|
||||
{
|
||||
PHAL_DATA_TYPE pHalData = GET_HAL_DATA(pDM_Odm->Adapter);
|
||||
u1Byte p = 0;
|
||||
PODM_RF_CAL_T pRFCalibrateInfo = &(pDM_Odm->RFCalibrateInfo);
|
||||
|
||||
pRFCalibrateInfo->BbSwingIdxCckBase = pRFCalibrateInfo->DefaultCckIndex;
|
||||
pRFCalibrateInfo->BbSwingIdxCck = pRFCalibrateInfo->DefaultCckIndex;
|
||||
pRFCalibrateInfo->CCK_index = 0;
|
||||
|
||||
for (p = ODM_RF_PATH_A; p < MAX_RF_PATH; ++p)
|
||||
{
|
||||
pRFCalibrateInfo->BbSwingIdxOfdmBase[p] = pRFCalibrateInfo->DefaultOfdmIndex;
|
||||
pRFCalibrateInfo->BbSwingIdxOfdm[p] = pRFCalibrateInfo->DefaultOfdmIndex;
|
||||
pRFCalibrateInfo->OFDM_index[p] = pRFCalibrateInfo->DefaultOfdmIndex;
|
||||
|
||||
pRFCalibrateInfo->PowerIndexOffset[p] = 0;
|
||||
pRFCalibrateInfo->DeltaPowerIndex[p] = 0;
|
||||
pRFCalibrateInfo->DeltaPowerIndexLast[p] = 0;
|
||||
|
||||
pRFCalibrateInfo->Absolute_OFDMSwingIdx[p] = 0; // Initial Mix mode power tracking
|
||||
pRFCalibrateInfo->Remnant_OFDMSwingIdx[p] = 0;
|
||||
pRFCalibrateInfo->KfreeOffset[p] = 0;
|
||||
}
|
||||
|
||||
pRFCalibrateInfo->Modify_TxAGC_Flag_PathA= FALSE; //Initial at Modify Tx Scaling Mode
|
||||
pRFCalibrateInfo->Modify_TxAGC_Flag_PathB= FALSE; //Initial at Modify Tx Scaling Mode
|
||||
pRFCalibrateInfo->Modify_TxAGC_Flag_PathC= FALSE; //Initial at Modify Tx Scaling Mode
|
||||
pRFCalibrateInfo->Modify_TxAGC_Flag_PathD= FALSE; //Initial at Modify Tx Scaling Mode
|
||||
pRFCalibrateInfo->Remnant_CCKSwingIdx= 0;
|
||||
pRFCalibrateInfo->ThermalValue = pHalData->EEPROMThermalMeter;
|
||||
|
||||
pRFCalibrateInfo->Modify_TxAGC_Value_CCK=0; //modify by Mingzhi.Guo
|
||||
pRFCalibrateInfo->Modify_TxAGC_Value_OFDM=0; //modify by Mingzhi.Guo
|
||||
|
||||
}
|
||||
|
||||
VOID
|
||||
ODM_TXPowerTrackingCallback_ThermalMeter(
|
||||
#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
|
||||
IN PDM_ODM_T pDM_Odm
|
||||
#else
|
||||
IN PADAPTER Adapter
|
||||
#endif
|
||||
)
|
||||
{
|
||||
|
||||
#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
|
||||
PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc;
|
||||
#elif (DM_ODM_SUPPORT_TYPE == ODM_WIN)
|
||||
PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc;
|
||||
#else
|
||||
PDM_ODM_T pDM_Odm = &pHalData->odmpriv;
|
||||
#endif
|
||||
PODM_RF_CAL_T pRFCalibrateInfo = &(pDM_Odm->RFCalibrateInfo);
|
||||
|
||||
u1Byte ThermalValue = 0, delta, delta_LCK, delta_IQK, p = 0, i = 0, pathName = 0;
|
||||
s1Byte diff_DPK[4] = {0};
|
||||
u1Byte ThermalValue_AVG_count = 0;
|
||||
u4Byte ThermalValue_AVG = 0;
|
||||
|
||||
u1Byte OFDM_min_index = 0; // OFDM BB Swing should be less than +3.0dB, which is required by Arthur
|
||||
u1Byte Indexforchannel = 0; // GetRightChnlPlaceforIQK(pHalData->CurrentChannel)
|
||||
BOOLEAN bTSSIenable = FALSE;
|
||||
|
||||
TXPWRTRACK_CFG c;
|
||||
|
||||
//4 1. The following TWO tables decide the final index of OFDM/CCK swing table.
|
||||
pu1Byte deltaSwingTableIdx_TUP_A, deltaSwingTableIdx_TDOWN_A;
|
||||
pu1Byte deltaSwingTableIdx_TUP_B, deltaSwingTableIdx_TDOWN_B;
|
||||
//for 8814 add by Yu Chen
|
||||
pu1Byte deltaSwingTableIdx_TUP_C = NULL, deltaSwingTableIdx_TDOWN_C = NULL;
|
||||
pu1Byte deltaSwingTableIdx_TUP_D= NULL, deltaSwingTableIdx_TDOWN_D = NULL;
|
||||
|
||||
//4 2. Initilization ( 7 steps in total )
|
||||
|
||||
ConfigureTxpowerTrack(pDM_Odm, &c);
|
||||
|
||||
(*c.GetDeltaSwingTable)(pDM_Odm, (pu1Byte*)&deltaSwingTableIdx_TUP_A, (pu1Byte*)&deltaSwingTableIdx_TDOWN_A,
|
||||
(pu1Byte*)&deltaSwingTableIdx_TUP_B, (pu1Byte*)&deltaSwingTableIdx_TDOWN_B);
|
||||
|
||||
if(pDM_Odm->SupportICType & ODM_RTL8814A) // for 8814 path C & D
|
||||
(*c.GetDeltaSwingTable8814only)(pDM_Odm, (pu1Byte*)&deltaSwingTableIdx_TUP_C, (pu1Byte*)&deltaSwingTableIdx_TDOWN_C,
|
||||
(pu1Byte*)&deltaSwingTableIdx_TUP_D, (pu1Byte*)&deltaSwingTableIdx_TDOWN_D);
|
||||
|
||||
|
||||
pRFCalibrateInfo->TXPowerTrackingCallbackCnt++; //cosa add for debug
|
||||
pRFCalibrateInfo->bTXPowerTrackingInit = TRUE;
|
||||
|
||||
#if (MP_DRIVER == 1)
|
||||
/*pRFCalibrateInfo->TxPowerTrackControl = pHalData->TxPowerTrackControl;
|
||||
<Kordan> We should keep updating the control variable according to HalData.
|
||||
<Kordan> RFCalibrateInfo.RegA24 will be initialized when ODM HW configuring, but MP configures with para files. */
|
||||
pRFCalibrateInfo->RegA24 = 0x090e1317;
|
||||
#endif
|
||||
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("===>ODM_TXPowerTrackingCallback_ThermalMeter, \
|
||||
\n pRFCalibrateInfo->BbSwingIdxCckBase: %d, pRFCalibrateInfo->BbSwingIdxOfdmBase[A]: %d, pRFCalibrateInfo->DefaultOfdmIndex: %d\n",
|
||||
pRFCalibrateInfo->BbSwingIdxCckBase, pRFCalibrateInfo->BbSwingIdxOfdmBase[ODM_RF_PATH_A], pRFCalibrateInfo->DefaultOfdmIndex));
|
||||
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("pRFCalibrateInfo->TxPowerTrackControl %d, pHalData->EEPROMThermalMeter %d\n", pRFCalibrateInfo->TxPowerTrackControl, pHalData->EEPROMThermalMeter));
|
||||
ThermalValue = (u1Byte)ODM_GetRFReg(pDM_Odm, ODM_RF_PATH_A, c.ThermalRegAddr, 0xfc00); //0x42: RF Reg[15:10] 88E
|
||||
|
||||
|
||||
if( ! pRFCalibrateInfo->TxPowerTrackControl )
|
||||
return;
|
||||
|
||||
|
||||
//4 3. Initialize ThermalValues of RFCalibrateInfo
|
||||
|
||||
if(pRFCalibrateInfo->bReloadtxpowerindex)
|
||||
{
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,("reload ofdm index for band switch\n"));
|
||||
}
|
||||
|
||||
//4 4. Calculate average thermal meter
|
||||
|
||||
pRFCalibrateInfo->ThermalValue_AVG[pRFCalibrateInfo->ThermalValue_AVG_index] = ThermalValue;
|
||||
pRFCalibrateInfo->ThermalValue_AVG_index++;
|
||||
if(pRFCalibrateInfo->ThermalValue_AVG_index == c.AverageThermalNum) //Average times = c.AverageThermalNum
|
||||
pRFCalibrateInfo->ThermalValue_AVG_index = 0;
|
||||
|
||||
for(i = 0; i < c.AverageThermalNum; i++)
|
||||
{
|
||||
if(pRFCalibrateInfo->ThermalValue_AVG[i])
|
||||
{
|
||||
ThermalValue_AVG += pRFCalibrateInfo->ThermalValue_AVG[i];
|
||||
ThermalValue_AVG_count++;
|
||||
}
|
||||
}
|
||||
|
||||
if(ThermalValue_AVG_count) //Calculate Average ThermalValue after average enough times
|
||||
{
|
||||
ThermalValue = (u1Byte)(ThermalValue_AVG / ThermalValue_AVG_count);
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("AVG Thermal Meter = 0x%X, EFUSE Thermal Base = 0x%X\n", ThermalValue, pHalData->EEPROMThermalMeter));
|
||||
}
|
||||
|
||||
//4 5. Calculate delta, delta_LCK, delta_IQK.
|
||||
|
||||
//"delta" here is used to determine whether thermal value changes or not.
|
||||
delta = (ThermalValue > pRFCalibrateInfo->ThermalValue)?(ThermalValue - pRFCalibrateInfo->ThermalValue):(pRFCalibrateInfo->ThermalValue - ThermalValue);
|
||||
delta_LCK = (ThermalValue > pRFCalibrateInfo->ThermalValue_LCK)?(ThermalValue - pRFCalibrateInfo->ThermalValue_LCK):(pRFCalibrateInfo->ThermalValue_LCK - ThermalValue);
|
||||
delta_IQK = (ThermalValue > pRFCalibrateInfo->ThermalValue_IQK)?(ThermalValue - pRFCalibrateInfo->ThermalValue_IQK):(pRFCalibrateInfo->ThermalValue_IQK - ThermalValue);
|
||||
|
||||
if(pRFCalibrateInfo->ThermalValue_IQK == 0xff) //no PG, use thermal value for IQK
|
||||
{
|
||||
pRFCalibrateInfo->ThermalValue_IQK = ThermalValue;
|
||||
delta_IQK = (ThermalValue > pRFCalibrateInfo->ThermalValue_IQK)?(ThermalValue - pRFCalibrateInfo->ThermalValue_IQK):(pRFCalibrateInfo->ThermalValue_IQK - ThermalValue);
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("no PG, use ThermalValue for IQK\n"));
|
||||
}
|
||||
|
||||
for(p = ODM_RF_PATH_A; p < c.RfPathCount; p++)
|
||||
{
|
||||
diff_DPK[p] = (s1Byte)ThermalValue - (s1Byte)pRFCalibrateInfo->DpkThermal[p];
|
||||
}
|
||||
|
||||
//4 6. If necessary, do LCK.
|
||||
|
||||
if (!(pDM_Odm->SupportICType & ODM_RTL8821)) {
|
||||
/*no PG , do LCK at initial status*/
|
||||
if (pRFCalibrateInfo->ThermalValue_LCK == 0xff) {
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("no PG, do LCK\n"));
|
||||
pRFCalibrateInfo->ThermalValue_LCK = ThermalValue;
|
||||
if(c.PHY_LCCalibrate)
|
||||
(*c.PHY_LCCalibrate)(pDM_Odm);
|
||||
delta_LCK = (ThermalValue > pRFCalibrateInfo->ThermalValue_LCK)?(ThermalValue - pRFCalibrateInfo->ThermalValue_LCK):(pRFCalibrateInfo->ThermalValue_LCK - ThermalValue);
|
||||
}
|
||||
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("(delta, delta_LCK, delta_IQK) = (%d, %d, %d)\n", delta, delta_LCK, delta_IQK));
|
||||
|
||||
/* Delta temperature is equal to or larger than 20 centigrade.*/
|
||||
if (delta_LCK >= c.Threshold_IQK) {
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("delta_LCK(%d) >= Threshold_IQK(%d)\n", delta_LCK, c.Threshold_IQK));
|
||||
pRFCalibrateInfo->ThermalValue_LCK = ThermalValue;
|
||||
if(c.PHY_LCCalibrate)
|
||||
(*c.PHY_LCCalibrate)(pDM_Odm);
|
||||
}
|
||||
}
|
||||
|
||||
//3 7. If necessary, move the index of swing table to adjust Tx power.
|
||||
|
||||
if (delta > 0 && pRFCalibrateInfo->TxPowerTrackControl)
|
||||
{
|
||||
//"delta" here is used to record the absolute value of differrence.
|
||||
#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE))
|
||||
delta = ThermalValue > pHalData->EEPROMThermalMeter?(ThermalValue - pHalData->EEPROMThermalMeter):(pHalData->EEPROMThermalMeter - ThermalValue);
|
||||
#else
|
||||
delta = (ThermalValue > pDM_Odm->priv->pmib->dot11RFEntry.ther)?(ThermalValue - pDM_Odm->priv->pmib->dot11RFEntry.ther):(pDM_Odm->priv->pmib->dot11RFEntry.ther - ThermalValue);
|
||||
#endif
|
||||
if (delta >= TXPWR_TRACK_TABLE_SIZE)
|
||||
delta = TXPWR_TRACK_TABLE_SIZE - 1;
|
||||
|
||||
//4 7.1 The Final Power Index = BaseIndex + PowerIndexOffset
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE))
|
||||
if(ThermalValue > pHalData->EEPROMThermalMeter) {
|
||||
#else
|
||||
if(ThermalValue > pDM_Odm->priv->pmib->dot11RFEntry.ther) {
|
||||
#endif
|
||||
|
||||
for (p = ODM_RF_PATH_A; p < c.RfPathCount; p++)
|
||||
{
|
||||
pRFCalibrateInfo->DeltaPowerIndexLast[p] = pRFCalibrateInfo->DeltaPowerIndex[p]; //recording poer index offset
|
||||
switch(p)
|
||||
{
|
||||
case ODM_RF_PATH_B:
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("deltaSwingTableIdx_TUP_B[%d] = %d\n", delta, deltaSwingTableIdx_TUP_B[delta]));
|
||||
|
||||
pRFCalibrateInfo->DeltaPowerIndex[p] = deltaSwingTableIdx_TUP_B[delta];
|
||||
pRFCalibrateInfo->Absolute_OFDMSwingIdx[p] = deltaSwingTableIdx_TUP_B[delta]; // Record delta swing for mix mode power tracking
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("******Temp is higher and pRFCalibrateInfo->Absolute_OFDMSwingIdx[ODM_RF_PATH_B] = %d\n", pRFCalibrateInfo->Absolute_OFDMSwingIdx[p]));
|
||||
break;
|
||||
|
||||
case ODM_RF_PATH_C:
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("deltaSwingTableIdx_TUP_C[%d] = %d\n", delta, deltaSwingTableIdx_TUP_C[delta]));
|
||||
|
||||
pRFCalibrateInfo->DeltaPowerIndex[p] = deltaSwingTableIdx_TUP_C[delta];
|
||||
pRFCalibrateInfo->Absolute_OFDMSwingIdx[p] = deltaSwingTableIdx_TUP_C[delta]; // Record delta swing for mix mode power tracking
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("******Temp is higher and pRFCalibrateInfo->Absolute_OFDMSwingIdx[ODM_RF_PATH_C] = %d\n", pRFCalibrateInfo->Absolute_OFDMSwingIdx[p]));
|
||||
break;
|
||||
|
||||
case ODM_RF_PATH_D:
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("deltaSwingTableIdx_TUP_D[%d] = %d\n", delta, deltaSwingTableIdx_TUP_D[delta]));
|
||||
|
||||
pRFCalibrateInfo->DeltaPowerIndex[p] = deltaSwingTableIdx_TUP_D[delta];
|
||||
pRFCalibrateInfo->Absolute_OFDMSwingIdx[p] = deltaSwingTableIdx_TUP_D[delta]; // Record delta swing for mix mode power tracking
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("******Temp is higher and pRFCalibrateInfo->Absolute_OFDMSwingIdx[ODM_RF_PATH_D] = %d\n", pRFCalibrateInfo->Absolute_OFDMSwingIdx[p]));
|
||||
break;
|
||||
|
||||
default:
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("deltaSwingTableIdx_TUP_A[%d] = %d\n", delta, deltaSwingTableIdx_TUP_A[delta]));
|
||||
|
||||
pRFCalibrateInfo->DeltaPowerIndex[p] = deltaSwingTableIdx_TUP_A[delta];
|
||||
pRFCalibrateInfo->Absolute_OFDMSwingIdx[p] = deltaSwingTableIdx_TUP_A[delta]; // Record delta swing for mix mode power tracking
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("******Temp is higher and pRFCalibrateInfo->Absolute_OFDMSwingIdx[ODM_RF_PATH_A] = %d\n", pRFCalibrateInfo->Absolute_OFDMSwingIdx[p]));
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
for (p = ODM_RF_PATH_A; p < c.RfPathCount; p++)
|
||||
{
|
||||
pRFCalibrateInfo->DeltaPowerIndexLast[p] = pRFCalibrateInfo->DeltaPowerIndex[p]; //recording poer index offset
|
||||
switch(p)
|
||||
{
|
||||
case ODM_RF_PATH_B:
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("deltaSwingTableIdx_TDOWN_B[%d] = %d\n", delta, deltaSwingTableIdx_TDOWN_B[delta]));
|
||||
pRFCalibrateInfo->DeltaPowerIndex[p] = -1 * deltaSwingTableIdx_TDOWN_B[delta];
|
||||
pRFCalibrateInfo->Absolute_OFDMSwingIdx[p] = -1 * deltaSwingTableIdx_TDOWN_B[delta]; // Record delta swing for mix mode power tracking
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("******Temp is lower and pRFCalibrateInfo->Absolute_OFDMSwingIdx[ODM_RF_PATH_B] = %d\n", pRFCalibrateInfo->Absolute_OFDMSwingIdx[p]));
|
||||
break;
|
||||
|
||||
case ODM_RF_PATH_C:
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("deltaSwingTableIdx_TDOWN_C[%d] = %d\n", delta, deltaSwingTableIdx_TDOWN_C[delta]));
|
||||
pRFCalibrateInfo->DeltaPowerIndex[p] = -1 * deltaSwingTableIdx_TDOWN_C[delta];
|
||||
pRFCalibrateInfo->Absolute_OFDMSwingIdx[p] = -1 * deltaSwingTableIdx_TDOWN_C[delta]; // Record delta swing for mix mode power tracking
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("******Temp is lower and pRFCalibrateInfo->Absolute_OFDMSwingIdx[ODM_RF_PATH_C] = %d\n", pRFCalibrateInfo->Absolute_OFDMSwingIdx[p]));
|
||||
break;
|
||||
|
||||
case ODM_RF_PATH_D:
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("deltaSwingTableIdx_TDOWN_D[%d] = %d\n", delta, deltaSwingTableIdx_TDOWN_D[delta]));
|
||||
pRFCalibrateInfo->DeltaPowerIndex[p] = -1 * deltaSwingTableIdx_TDOWN_D[delta];
|
||||
pRFCalibrateInfo->Absolute_OFDMSwingIdx[p] = -1 * deltaSwingTableIdx_TDOWN_D[delta]; // Record delta swing for mix mode power tracking
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("******Temp is lower and pRFCalibrateInfo->Absolute_OFDMSwingIdx[ODM_RF_PATH_D] = %d\n", pRFCalibrateInfo->Absolute_OFDMSwingIdx[p]));
|
||||
break;
|
||||
|
||||
default:
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("deltaSwingTableIdx_TDOWN_A[%d] = %d\n", delta, deltaSwingTableIdx_TDOWN_A[delta]));
|
||||
pRFCalibrateInfo->DeltaPowerIndex[p] = -1 * deltaSwingTableIdx_TDOWN_A[delta];
|
||||
pRFCalibrateInfo->Absolute_OFDMSwingIdx[p] = -1 * deltaSwingTableIdx_TDOWN_A[delta]; // Record delta swing for mix mode power tracking
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("******Temp is lower and pRFCalibrateInfo->Absolute_OFDMSwingIdx[ODM_RF_PATH_A] = %d\n", pRFCalibrateInfo->Absolute_OFDMSwingIdx[p]));
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for (p = ODM_RF_PATH_A; p < c.RfPathCount; p++)
|
||||
{
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("\n\n=========================== [Path-%d] Calculating PowerIndexOffset===========================\n", p));
|
||||
|
||||
if(pRFCalibrateInfo->DeltaPowerIndex[p] == pRFCalibrateInfo->DeltaPowerIndexLast[p]) // If Thermal value changes but lookup table value still the same
|
||||
pRFCalibrateInfo->PowerIndexOffset[p] = 0;
|
||||
else
|
||||
pRFCalibrateInfo->PowerIndexOffset[p] = pRFCalibrateInfo->DeltaPowerIndex[p] - pRFCalibrateInfo->DeltaPowerIndexLast[p]; // Power Index Diff between 2 times Power Tracking
|
||||
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("[Path-%d] PowerIndexOffset(%d) = DeltaPowerIndex(%d) - DeltaPowerIndexLast(%d)\n", p, pRFCalibrateInfo->PowerIndexOffset[p], pRFCalibrateInfo->DeltaPowerIndex[p], pRFCalibrateInfo->DeltaPowerIndexLast[p]));
|
||||
|
||||
pRFCalibrateInfo->OFDM_index[p] = pRFCalibrateInfo->BbSwingIdxOfdmBase[p] + pRFCalibrateInfo->PowerIndexOffset[p];
|
||||
pRFCalibrateInfo->CCK_index = pRFCalibrateInfo->BbSwingIdxCckBase + pRFCalibrateInfo->PowerIndexOffset[p];
|
||||
|
||||
pRFCalibrateInfo->BbSwingIdxCck = pRFCalibrateInfo->CCK_index;
|
||||
pRFCalibrateInfo->BbSwingIdxOfdm[p] = pRFCalibrateInfo->OFDM_index[p];
|
||||
|
||||
// *************Print BB Swing Base and Index Offset*************
|
||||
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("The 'CCK' final index(%d) = BaseIndex(%d) + PowerIndexOffset(%d)\n", pRFCalibrateInfo->BbSwingIdxCck, pRFCalibrateInfo->BbSwingIdxCckBase, pRFCalibrateInfo->PowerIndexOffset[p]));
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("The 'OFDM' final index(%d) = BaseIndex[%d](%d) + PowerIndexOffset(%d)\n", pRFCalibrateInfo->BbSwingIdxOfdm[p], p, pRFCalibrateInfo->BbSwingIdxOfdmBase[p], pRFCalibrateInfo->PowerIndexOffset[p]));
|
||||
|
||||
//4 7.1 Handle boundary conditions of index.
|
||||
|
||||
if(pRFCalibrateInfo->OFDM_index[p] > c.SwingTableSize_OFDM-1)
|
||||
{
|
||||
pRFCalibrateInfo->OFDM_index[p] = c.SwingTableSize_OFDM-1;
|
||||
}
|
||||
else if (pRFCalibrateInfo->OFDM_index[p] <= OFDM_min_index)
|
||||
{
|
||||
pRFCalibrateInfo->OFDM_index[p] = OFDM_min_index;
|
||||
}
|
||||
}
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("\n\n========================================================================================================\n"));
|
||||
if(pRFCalibrateInfo->CCK_index > c.SwingTableSize_CCK-1)
|
||||
pRFCalibrateInfo->CCK_index = c.SwingTableSize_CCK-1;
|
||||
else if (pRFCalibrateInfo->CCK_index <= 0)
|
||||
pRFCalibrateInfo->CCK_index = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("The thermal meter is unchanged or TxPowerTracking OFF(%d): ThermalValue: %d , pRFCalibrateInfo->ThermalValue: %d\n",
|
||||
pRFCalibrateInfo->TxPowerTrackControl, ThermalValue, pRFCalibrateInfo->ThermalValue));
|
||||
|
||||
for (p = ODM_RF_PATH_A; p < c.RfPathCount; p++)
|
||||
pRFCalibrateInfo->PowerIndexOffset[p] = 0;
|
||||
}
|
||||
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("TxPowerTracking: [CCK] Swing Current Index: %d, Swing Base Index: %d\n",
|
||||
pRFCalibrateInfo->CCK_index, pRFCalibrateInfo->BbSwingIdxCckBase)); //Print Swing base & current
|
||||
|
||||
for (p = ODM_RF_PATH_A; p < c.RfPathCount; p++)
|
||||
{
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("TxPowerTracking: [OFDM] Swing Current Index: %d, Swing Base Index[%d]: %d\n",
|
||||
pRFCalibrateInfo->OFDM_index[p], p, pRFCalibrateInfo->BbSwingIdxOfdmBase[p]));
|
||||
}
|
||||
|
||||
if ((pRFCalibrateInfo->PowerIndexOffset[ODM_RF_PATH_A] != 0 ||
|
||||
pRFCalibrateInfo->PowerIndexOffset[ODM_RF_PATH_B] != 0 ||
|
||||
pRFCalibrateInfo->PowerIndexOffset[ODM_RF_PATH_C] != 0 ||
|
||||
pRFCalibrateInfo->PowerIndexOffset[ODM_RF_PATH_D] != 0) &&
|
||||
pRFCalibrateInfo->TxPowerTrackControl && (pHalData->EEPROMThermalMeter != 0xff))
|
||||
{
|
||||
//4 7.2 Configure the Swing Table to adjust Tx Power.
|
||||
|
||||
pRFCalibrateInfo->bTxPowerChanged = TRUE; // Always TRUE after Tx Power is adjusted by power tracking.
|
||||
//
|
||||
// 2012/04/23 MH According to Luke's suggestion, we can not write BB digital
|
||||
// to increase TX power. Otherwise, EVM will be bad.
|
||||
//
|
||||
// 2012/04/25 MH Add for tx power tracking to set tx power in tx agc for 88E.
|
||||
if (ThermalValue > pRFCalibrateInfo->ThermalValue)
|
||||
{
|
||||
for (p = ODM_RF_PATH_A; p < c.RfPathCount; p++)
|
||||
{
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("Temperature Increasing(%d): delta_pi: %d , delta_t: %d, Now_t: %d, EFUSE_t: %d, Last_t: %d\n",
|
||||
p, pRFCalibrateInfo->PowerIndexOffset[p], delta, ThermalValue, pHalData->EEPROMThermalMeter, pRFCalibrateInfo->ThermalValue));
|
||||
}
|
||||
}
|
||||
|
||||
else if (ThermalValue < pRFCalibrateInfo->ThermalValue)// Low temperature
|
||||
{
|
||||
for (p = ODM_RF_PATH_A; p < c.RfPathCount; p++)
|
||||
{
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("Temperature Decreasing(%d): delta_pi: %d , delta_t: %d, Now_t: %d, EFUSE_t: %d, Last_t: %d\n",
|
||||
p, pRFCalibrateInfo->PowerIndexOffset[p], delta, ThermalValue, pHalData->EEPROMThermalMeter, pRFCalibrateInfo->ThermalValue));
|
||||
}
|
||||
}
|
||||
|
||||
#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
|
||||
if (ThermalValue > pHalData->EEPROMThermalMeter)
|
||||
#else
|
||||
if (ThermalValue > pDM_Odm->priv->pmib->dot11RFEntry.ther)
|
||||
#endif
|
||||
{
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("Temperature(%d) higher than PG value(%d)\n", ThermalValue, pHalData->EEPROMThermalMeter));
|
||||
|
||||
if (pDM_Odm->SupportICType == ODM_RTL8188E || pDM_Odm->SupportICType == ODM_RTL8192E ||pDM_Odm->SupportICType == ODM_RTL8821 ||
|
||||
pDM_Odm->SupportICType == ODM_RTL8812 || pDM_Odm->SupportICType == ODM_RTL8723B || pDM_Odm->SupportICType == ODM_RTL8814A || pDM_Odm->SupportICType == ODM_RTL8703B || pDM_Odm->SupportICType == ODM_RTL8188F)
|
||||
{
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,("**********Enter POWER Tracking MIX_MODE**********\n"));
|
||||
for (p = ODM_RF_PATH_A; p < c.RfPathCount; p++)
|
||||
(*c.ODM_TxPwrTrackSetPwr)(pDM_Odm, MIX_MODE, p, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,("**********Enter POWER Tracking BBSWING_MODE**********\n"));
|
||||
for (p = ODM_RF_PATH_A; p < c.RfPathCount; p++)
|
||||
(*c.ODM_TxPwrTrackSetPwr)(pDM_Odm, BBSWING, p, Indexforchannel);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("Temperature(%d) lower than PG value(%d)\n", ThermalValue, pHalData->EEPROMThermalMeter));
|
||||
|
||||
if (pDM_Odm->SupportICType == ODM_RTL8188E || pDM_Odm->SupportICType == ODM_RTL8192E || pDM_Odm->SupportICType == ODM_RTL8821 ||
|
||||
pDM_Odm->SupportICType == ODM_RTL8812 || pDM_Odm->SupportICType == ODM_RTL8723B || pDM_Odm->SupportICType == ODM_RTL8814A || pDM_Odm->SupportICType == ODM_RTL8703B || pDM_Odm->SupportICType == ODM_RTL8188F)
|
||||
{
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,("**********Enter POWER Tracking MIX_MODE**********\n"));
|
||||
for (p = ODM_RF_PATH_A; p < c.RfPathCount; p++)
|
||||
(*c.ODM_TxPwrTrackSetPwr)(pDM_Odm, MIX_MODE, p, Indexforchannel);
|
||||
}
|
||||
else
|
||||
{
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,("**********Enter POWER Tracking BBSWING_MODE**********\n"));
|
||||
for (p = ODM_RF_PATH_A; p < c.RfPathCount; p++)
|
||||
(*c.ODM_TxPwrTrackSetPwr)(pDM_Odm, BBSWING, p, Indexforchannel);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
pRFCalibrateInfo->BbSwingIdxCckBase = pRFCalibrateInfo->BbSwingIdxCck; // Record last time Power Tracking result as base.
|
||||
for (p = ODM_RF_PATH_A; p < c.RfPathCount; p++)
|
||||
pRFCalibrateInfo->BbSwingIdxOfdmBase[p] = pRFCalibrateInfo->BbSwingIdxOfdm[p];
|
||||
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("pRFCalibrateInfo->ThermalValue = %d ThermalValue= %d\n", pRFCalibrateInfo->ThermalValue, ThermalValue));
|
||||
|
||||
pRFCalibrateInfo->ThermalValue = ThermalValue; //Record last Power Tracking Thermal Value
|
||||
|
||||
}
|
||||
|
||||
#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
|
||||
|
||||
if(!IS_HARDWARE_TYPE_8723B(Adapter))
|
||||
{
|
||||
// Delta temperature is equal to or larger than 20 centigrade (When threshold is 8).
|
||||
if ((delta_IQK >= c.Threshold_IQK)) {
|
||||
if ( ! pRFCalibrateInfo->bIQKInProgress)
|
||||
(*c.DoIQK)(pDM_Odm, delta_IQK, ThermalValue, 8);
|
||||
}
|
||||
}
|
||||
if (pRFCalibrateInfo->DpkThermal[ODM_RF_PATH_A] != 0) {
|
||||
if ((diff_DPK[ODM_RF_PATH_A] >= c.Threshold_DPK)) {
|
||||
ODM_SetBBReg(pDM_Odm, 0x82c, BIT(31), 0x1);
|
||||
ODM_SetBBReg(pDM_Odm, 0xcc4, BIT14|BIT13|BIT12|BIT11|BIT10, (diff_DPK[ODM_RF_PATH_A] / c.Threshold_DPK));
|
||||
ODM_SetBBReg(pDM_Odm, 0x82c, BIT(31), 0x0);
|
||||
} else if ((diff_DPK[ODM_RF_PATH_A] <= -1 * c.Threshold_DPK)) {
|
||||
s4Byte value = 0x20 + (diff_DPK[ODM_RF_PATH_A] / c.Threshold_DPK);
|
||||
ODM_SetBBReg(pDM_Odm, 0x82c, BIT(31), 0x1);
|
||||
ODM_SetBBReg(pDM_Odm, 0xcc4, BIT14|BIT13|BIT12|BIT11|BIT10, value);
|
||||
ODM_SetBBReg(pDM_Odm, 0x82c, BIT(31), 0x0);
|
||||
} else {
|
||||
ODM_SetBBReg(pDM_Odm, 0x82c, BIT(31), 0x1);
|
||||
ODM_SetBBReg(pDM_Odm, 0xcc4, BIT14|BIT13|BIT12|BIT11|BIT10, 0);
|
||||
ODM_SetBBReg(pDM_Odm, 0x82c, BIT(31), 0x0);
|
||||
}
|
||||
}
|
||||
if (pRFCalibrateInfo->DpkThermal[ODM_RF_PATH_B] != 0) {
|
||||
if ((diff_DPK[ODM_RF_PATH_B] >= c.Threshold_DPK)) {
|
||||
ODM_SetBBReg(pDM_Odm, 0x82c, BIT(31), 0x1);
|
||||
ODM_SetBBReg(pDM_Odm, 0xec4, BIT14|BIT13|BIT12|BIT11|BIT10, (diff_DPK[ODM_RF_PATH_B] / c.Threshold_DPK));
|
||||
ODM_SetBBReg(pDM_Odm, 0x82c, BIT(31), 0x0);
|
||||
} else if ((diff_DPK[ODM_RF_PATH_B] <= -1 * c.Threshold_DPK)) {
|
||||
s4Byte value = 0x20 + (diff_DPK[ODM_RF_PATH_B] / c.Threshold_DPK);
|
||||
ODM_SetBBReg(pDM_Odm, 0x82c, BIT(31), 0x1);
|
||||
ODM_SetBBReg(pDM_Odm, 0xec4, BIT14|BIT13|BIT12|BIT11|BIT10, value);
|
||||
ODM_SetBBReg(pDM_Odm, 0x82c, BIT(31), 0x0);
|
||||
} else {
|
||||
ODM_SetBBReg(pDM_Odm, 0x82c, BIT(31), 0x1);
|
||||
ODM_SetBBReg(pDM_Odm, 0xec4, BIT14|BIT13|BIT12|BIT11|BIT10, 0);
|
||||
ODM_SetBBReg(pDM_Odm, 0x82c, BIT(31), 0x0);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,("<===ODM_TXPowerTrackingCallback_ThermalMeter\n"));
|
||||
|
||||
pRFCalibrateInfo->TXPowercount = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//3============================================================
|
||||
//3 IQ Calibration
|
||||
//3============================================================
|
||||
|
||||
VOID
|
||||
ODM_ResetIQKResult(
|
||||
IN PDM_ODM_T pDM_Odm
|
||||
)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
|
||||
u1Byte ODM_GetRightChnlPlaceforIQK(u1Byte chnl)
|
||||
{
|
||||
u1Byte channel_all[ODM_TARGET_CHNL_NUM_2G_5G] =
|
||||
{1,2,3,4,5,6,7,8,9,10,11,12,13,14,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,100,102,104,106,108,110,112,114,116,118,120,122,124,126,128,130,132,134,136,138,140,149,151,153,155,157,159,161,163,165};
|
||||
u1Byte place = chnl;
|
||||
|
||||
|
||||
if(chnl > 14)
|
||||
{
|
||||
for(place = 14; place<sizeof(channel_all); place++)
|
||||
{
|
||||
if(channel_all[place] == chnl)
|
||||
{
|
||||
return place-13;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
VOID
|
||||
odm_IQCalibrate(
|
||||
IN PDM_ODM_T pDM_Odm
|
||||
)
|
||||
{
|
||||
PADAPTER Adapter = pDM_Odm->Adapter;
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
|
||||
if (*pDM_Odm->pIsFcsModeEnable)
|
||||
return;
|
||||
#endif
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE))
|
||||
if (!IS_HARDWARE_TYPE_JAGUAR(Adapter))
|
||||
return;
|
||||
#if (DM_ODM_SUPPORT_TYPE & (ODM_CE))
|
||||
else if (IS_HARDWARE_TYPE_8812AU(Adapter))
|
||||
return;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if (RTL8821A_SUPPORT == 1)
|
||||
if (pDM_Odm->bLinked) {
|
||||
if ((*pDM_Odm->pChannel != pDM_Odm->preChannel) && (!*pDM_Odm->pbScanInProcess)) {
|
||||
pDM_Odm->preChannel = *pDM_Odm->pChannel;
|
||||
pDM_Odm->LinkedInterval = 0;
|
||||
}
|
||||
|
||||
if (pDM_Odm->LinkedInterval < 3)
|
||||
pDM_Odm->LinkedInterval++;
|
||||
|
||||
if (pDM_Odm->LinkedInterval == 2) {
|
||||
/*Mark out IQK flow to prevent tx stuck. by Maddest 20130306*/
|
||||
/*Open it verified by James 20130715*/
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_CE)
|
||||
PHY_IQCalibrate_8821A(pDM_Odm, FALSE);
|
||||
#elif (DM_ODM_SUPPORT_TYPE == ODM_WIN)
|
||||
PHY_IQCalibrate(Adapter, FALSE);
|
||||
#else
|
||||
PHY_IQCalibrate_8821A(Adapter, FALSE);
|
||||
#endif
|
||||
}
|
||||
} else
|
||||
pDM_Odm->LinkedInterval = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
void phydm_rf_init(IN PDM_ODM_T pDM_Odm)
|
||||
{
|
||||
|
||||
odm_TXPowerTrackingInit(pDM_Odm);
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE))
|
||||
ODM_ClearTxPowerTrackingState(pDM_Odm);
|
||||
#endif
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
|
||||
#if (RTL8814A_SUPPORT == 1)
|
||||
if (pDM_Odm->SupportICType & ODM_RTL8814A)
|
||||
PHY_IQCalibrate_8814A_Init(pDM_Odm);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void phydm_rf_watchdog(IN PDM_ODM_T pDM_Odm)
|
||||
{
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE))
|
||||
ODM_TXPowerTrackingCheck(pDM_Odm);
|
||||
if (pDM_Odm->SupportICType & ODM_IC_11AC_SERIES)
|
||||
odm_IQCalibrate(pDM_Odm);
|
||||
#endif
|
||||
}
|
||||
108
hal/phydm/halphyrf_win.h
Normal file
108
hal/phydm/halphyrf_win.h
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __HAL_PHY_RF_H__
|
||||
#define __HAL_PHY_RF_H__
|
||||
|
||||
#include "phydm_kfree.h"
|
||||
#if (RTL8814A_SUPPORT == 1)
|
||||
#include "rtl8814a/phydm_iqk_8814a.h"
|
||||
#endif
|
||||
|
||||
#if (RTL8822B_SUPPORT == 1)
|
||||
#include "rtl8822b/phydm_iqk_8822b.h"
|
||||
#endif
|
||||
#include "phydm_powertracking_win.h"
|
||||
|
||||
typedef enum _SPUR_CAL_METHOD {
|
||||
PLL_RESET,
|
||||
AFE_PHASE_SEL
|
||||
} SPUR_CAL_METHOD;
|
||||
|
||||
typedef enum _PWRTRACK_CONTROL_METHOD {
|
||||
BBSWING,
|
||||
TXAGC,
|
||||
MIX_MODE,
|
||||
TSSI_MODE
|
||||
} PWRTRACK_METHOD;
|
||||
|
||||
typedef VOID (*FuncSetPwr)(PDM_ODM_T, PWRTRACK_METHOD, u1Byte, u1Byte);
|
||||
typedef VOID(*FuncIQK)(PVOID, u1Byte, u1Byte, u1Byte);
|
||||
typedef VOID (*FuncLCK)(PDM_ODM_T);
|
||||
//refine by YuChen for 8814A
|
||||
typedef VOID (*FuncSwing)(PDM_ODM_T, pu1Byte*, pu1Byte*, pu1Byte*, pu1Byte*);
|
||||
typedef VOID (*FuncSwing8814only)(PDM_ODM_T, pu1Byte*, pu1Byte*, pu1Byte*, pu1Byte*);
|
||||
|
||||
typedef struct _TXPWRTRACK_CFG {
|
||||
u1Byte SwingTableSize_CCK;
|
||||
u1Byte SwingTableSize_OFDM;
|
||||
u1Byte Threshold_IQK;
|
||||
u1Byte Threshold_DPK;
|
||||
u1Byte AverageThermalNum;
|
||||
u1Byte RfPathCount;
|
||||
u4Byte ThermalRegAddr;
|
||||
FuncSetPwr ODM_TxPwrTrackSetPwr;
|
||||
FuncIQK DoIQK;
|
||||
FuncLCK PHY_LCCalibrate;
|
||||
FuncSwing GetDeltaSwingTable;
|
||||
FuncSwing8814only GetDeltaSwingTable8814only;
|
||||
} TXPWRTRACK_CFG, *PTXPWRTRACK_CFG;
|
||||
|
||||
VOID
|
||||
ConfigureTxpowerTrack(
|
||||
IN PDM_ODM_T pDM_Odm,
|
||||
OUT PTXPWRTRACK_CFG pConfig
|
||||
);
|
||||
|
||||
|
||||
VOID
|
||||
ODM_ClearTxPowerTrackingState(
|
||||
IN PDM_ODM_T pDM_Odm
|
||||
);
|
||||
|
||||
VOID
|
||||
ODM_TXPowerTrackingCallback_ThermalMeter(
|
||||
#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
|
||||
IN PDM_ODM_T pDM_Odm
|
||||
#else
|
||||
IN PADAPTER Adapter
|
||||
#endif
|
||||
);
|
||||
|
||||
|
||||
|
||||
#define ODM_TARGET_CHNL_NUM_2G_5G 59
|
||||
|
||||
|
||||
VOID
|
||||
ODM_ResetIQKResult(
|
||||
IN PDM_ODM_T pDM_Odm
|
||||
);
|
||||
u1Byte
|
||||
ODM_GetRightChnlPlaceforIQK(
|
||||
IN u1Byte chnl
|
||||
);
|
||||
|
||||
VOID odm_IQCalibrate(IN PDM_ODM_T pDM_Odm);
|
||||
VOID phydm_rf_init( IN PDM_ODM_T pDM_Odm);
|
||||
VOID phydm_rf_watchdog( IN PDM_ODM_T pDM_Odm);
|
||||
|
||||
#endif // #ifndef __HAL_PHY_RF_H__
|
||||
|
||||
20
hal/phydm/mp_precomp.h
Normal file
20
hal/phydm/mp_precomp.h
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
2161
hal/phydm/phydm.c
Normal file
2161
hal/phydm/phydm.c
Normal file
File diff suppressed because it is too large
Load diff
1441
hal/phydm/phydm.h
Normal file
1441
hal/phydm/phydm.h
Normal file
File diff suppressed because it is too large
Load diff
1306
hal/phydm/phydm_acs.c
Normal file
1306
hal/phydm/phydm_acs.c
Normal file
File diff suppressed because it is too large
Load diff
129
hal/phydm/phydm_acs.h
Normal file
129
hal/phydm/phydm_acs.h
Normal file
|
|
@ -0,0 +1,129 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __PHYDMACS_H__
|
||||
#define __PHYDMACS_H__
|
||||
|
||||
#define ACS_VERSION "1.0"
|
||||
#define CLM_VERSION "1.0"
|
||||
|
||||
#define ODM_MAX_CHANNEL_2G 14
|
||||
#define ODM_MAX_CHANNEL_5G 24
|
||||
|
||||
// For phydm_AutoChannelSelectSettingAP()
|
||||
#define STORE_DEFAULT_NHM_SETTING 0
|
||||
#define RESTORE_DEFAULT_NHM_SETTING 1
|
||||
#define ACS_NHM_SETTING 2
|
||||
|
||||
typedef struct _ACS_
|
||||
{
|
||||
BOOLEAN bForceACSResult;
|
||||
u1Byte CleanChannel_2G;
|
||||
u1Byte CleanChannel_5G;
|
||||
u2Byte Channel_Info_2G[2][ODM_MAX_CHANNEL_2G]; //Channel_Info[1]: Channel Score, Channel_Info[2]:Channel_Scan_Times
|
||||
u2Byte Channel_Info_5G[2][ODM_MAX_CHANNEL_5G];
|
||||
|
||||
#if ( DM_ODM_SUPPORT_TYPE & ODM_AP )
|
||||
u1Byte ACS_Step;
|
||||
// NHM Count 0-11
|
||||
u1Byte NHM_Cnt[14][11];
|
||||
|
||||
// AC-Series, for storing previous setting
|
||||
u4Byte Reg0x990;
|
||||
u4Byte Reg0x994;
|
||||
u4Byte Reg0x998;
|
||||
u4Byte Reg0x99C;
|
||||
u1Byte Reg0x9A0; // u1Byte
|
||||
|
||||
// N-Series, for storing previous setting
|
||||
u4Byte Reg0x890;
|
||||
u4Byte Reg0x894;
|
||||
u4Byte Reg0x898;
|
||||
u4Byte Reg0x89C;
|
||||
u1Byte Reg0xE28; // u1Byte
|
||||
#endif
|
||||
|
||||
}ACS, *PACS;
|
||||
|
||||
|
||||
VOID
|
||||
odm_AutoChannelSelectInit(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
odm_AutoChannelSelectReset(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
odm_AutoChannelSelect(
|
||||
IN PVOID pDM_VOID,
|
||||
IN u1Byte Channel
|
||||
);
|
||||
|
||||
u1Byte
|
||||
ODM_GetAutoChannelSelectResult(
|
||||
IN PVOID pDM_VOID,
|
||||
IN u1Byte Band
|
||||
);
|
||||
|
||||
#if ( DM_ODM_SUPPORT_TYPE & ODM_AP )
|
||||
|
||||
VOID
|
||||
phydm_AutoChannelSelectSettingAP(
|
||||
IN PVOID pDM_VOID,
|
||||
IN u4Byte Setting, // 0: STORE_DEFAULT_NHM_SETTING; 1: RESTORE_DEFAULT_NHM_SETTING, 2: ACS_NHM_SETTING
|
||||
IN u4Byte acs_step
|
||||
);
|
||||
|
||||
VOID
|
||||
phydm_GetNHMStatisticsAP(
|
||||
IN PVOID pDM_VOID,
|
||||
IN u4Byte idx, // @ 2G, Real channel number = idx+1
|
||||
IN u4Byte acs_step
|
||||
);
|
||||
|
||||
#endif //#if ( DM_ODM_SUPPORT_TYPE & ODM_AP )
|
||||
|
||||
|
||||
VOID
|
||||
phydm_CLMInit(
|
||||
IN PVOID pDM_VOID,
|
||||
IN u2Byte sampleNum
|
||||
);
|
||||
|
||||
VOID
|
||||
phydm_CLMtrigger(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
BOOLEAN
|
||||
phydm_checkCLMready(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
u2Byte
|
||||
phydm_getCLMresult(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
|
||||
#endif //#ifndef __PHYDMACS_H__
|
||||
940
hal/phydm/phydm_adaptivity.c
Normal file
940
hal/phydm/phydm_adaptivity.c
Normal file
|
|
@ -0,0 +1,940 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
//============================================================
|
||||
// include files
|
||||
//============================================================
|
||||
#include "mp_precomp.h"
|
||||
#include "phydm_precomp.h"
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
|
||||
#if WPP_SOFTWARE_TRACE
|
||||
#include "PhyDM_Adaptivity.tmh"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
VOID
|
||||
Phydm_CheckAdaptivity(
|
||||
IN PVOID pDM_VOID
|
||||
)
|
||||
{
|
||||
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
|
||||
PADAPTIVITY_STATISTICS Adaptivity = (PADAPTIVITY_STATISTICS)PhyDM_Get_Structure(pDM_Odm, PHYDM_ADAPTIVITY);
|
||||
|
||||
if (pDM_Odm->SupportAbility & ODM_BB_ADAPTIVITY) {
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
|
||||
if (pDM_Odm->APTotalNum > Adaptivity->APNumTH) {
|
||||
pDM_Odm->Adaptivity_enable = FALSE;
|
||||
pDM_Odm->adaptivity_flag = FALSE;
|
||||
ODM_RT_TRACE(pDM_Odm, PHYDM_COMP_ADAPTIVITY, ODM_DBG_LOUD, ("AP total num > %d!!, disable adaptivity\n", Adaptivity->APNumTH));
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
if (Adaptivity->DynamicLinkAdaptivity == TRUE) {
|
||||
if (pDM_Odm->bLinked && Adaptivity->bCheck == FALSE) {
|
||||
Phydm_NHMCounterStatistics(pDM_Odm);
|
||||
Phydm_CheckEnvironment(pDM_Odm);
|
||||
} else if (!pDM_Odm->bLinked)
|
||||
Adaptivity->bCheck = FALSE;
|
||||
} else {
|
||||
pDM_Odm->Adaptivity_enable = TRUE;
|
||||
|
||||
if (pDM_Odm->SupportICType & (ODM_IC_11AC_GAIN_IDX_EDCCA | ODM_IC_11N_GAIN_IDX_EDCCA))
|
||||
pDM_Odm->adaptivity_flag = FALSE;
|
||||
else
|
||||
pDM_Odm->adaptivity_flag = TRUE;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
pDM_Odm->Adaptivity_enable = FALSE;
|
||||
pDM_Odm->adaptivity_flag = FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
|
||||
BOOLEAN
|
||||
Phydm_CheckChannelPlan(
|
||||
IN PVOID pDM_VOID
|
||||
)
|
||||
{
|
||||
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
|
||||
PADAPTER pAdapter = pDM_Odm->Adapter;
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
|
||||
PMGNT_INFO pMgntInfo = &(pAdapter->MgntInfo);
|
||||
|
||||
if (pMgntInfo->RegEnableAdaptivity == 2) {
|
||||
if (pDM_Odm->Carrier_Sense_enable == FALSE) { /*check domain Code for Adaptivity or CarrierSense*/
|
||||
if ((*pDM_Odm->pBandType == ODM_BAND_5G) &&
|
||||
!(pDM_Odm->odm_Regulation5G == REGULATION_ETSI || pDM_Odm->odm_Regulation5G == REGULATION_WW)) {
|
||||
ODM_RT_TRACE(pDM_Odm, PHYDM_COMP_ADAPTIVITY, ODM_DBG_LOUD, ("Adaptivity skip 5G domain code : %d\n", pDM_Odm->odm_Regulation5G));
|
||||
pDM_Odm->Adaptivity_enable = FALSE;
|
||||
pDM_Odm->adaptivity_flag = FALSE;
|
||||
return TRUE;
|
||||
} else if ((*pDM_Odm->pBandType == ODM_BAND_2_4G) &&
|
||||
!(pDM_Odm->odm_Regulation2_4G == REGULATION_ETSI || pDM_Odm->odm_Regulation2_4G == REGULATION_WW)) {
|
||||
ODM_RT_TRACE(pDM_Odm, PHYDM_COMP_ADAPTIVITY, ODM_DBG_LOUD, ("Adaptivity skip 2.4G domain code : %d\n", pDM_Odm->odm_Regulation2_4G));
|
||||
pDM_Odm->Adaptivity_enable = FALSE;
|
||||
pDM_Odm->adaptivity_flag = FALSE;
|
||||
return TRUE;
|
||||
|
||||
} else if ((*pDM_Odm->pBandType != ODM_BAND_2_4G) && (*pDM_Odm->pBandType != ODM_BAND_5G)) {
|
||||
ODM_RT_TRACE(pDM_Odm, PHYDM_COMP_ADAPTIVITY, ODM_DBG_LOUD, ("Adaptivity neither 2G nor 5G band, return\n"));
|
||||
pDM_Odm->Adaptivity_enable = FALSE;
|
||||
pDM_Odm->adaptivity_flag = FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
} else {
|
||||
if ((*pDM_Odm->pBandType == ODM_BAND_5G) &&
|
||||
!(pDM_Odm->odm_Regulation5G == REGULATION_MKK || pDM_Odm->odm_Regulation5G == REGULATION_WW)) {
|
||||
ODM_RT_TRACE(pDM_Odm, PHYDM_COMP_ADAPTIVITY, ODM_DBG_LOUD, ("CarrierSense skip 5G domain code : %d\n", pDM_Odm->odm_Regulation5G));
|
||||
pDM_Odm->Adaptivity_enable = FALSE;
|
||||
pDM_Odm->adaptivity_flag = FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
else if ((*pDM_Odm->pBandType == ODM_BAND_2_4G) &&
|
||||
!(pDM_Odm->odm_Regulation2_4G == REGULATION_MKK || pDM_Odm->odm_Regulation2_4G == REGULATION_WW)) {
|
||||
ODM_RT_TRACE(pDM_Odm, PHYDM_COMP_ADAPTIVITY, ODM_DBG_LOUD, ("CarrierSense skip 2.4G domain code : %d\n", pDM_Odm->odm_Regulation2_4G));
|
||||
pDM_Odm->Adaptivity_enable = FALSE;
|
||||
pDM_Odm->adaptivity_flag = FALSE;
|
||||
return TRUE;
|
||||
|
||||
} else if ((*pDM_Odm->pBandType != ODM_BAND_2_4G) && (*pDM_Odm->pBandType != ODM_BAND_5G)) {
|
||||
ODM_RT_TRACE(pDM_Odm, PHYDM_COMP_ADAPTIVITY, ODM_DBG_LOUD, ("CarrierSense neither 2G nor 5G band, return\n"));
|
||||
pDM_Odm->Adaptivity_enable = FALSE;
|
||||
pDM_Odm->adaptivity_flag = FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
VOID
|
||||
Phydm_NHMCounterStatisticsInit(
|
||||
IN PVOID pDM_VOID
|
||||
)
|
||||
{
|
||||
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
|
||||
|
||||
if (pDM_Odm->SupportICType & ODM_IC_11N_SERIES) {
|
||||
/*PHY parameters initialize for n series*/
|
||||
ODM_Write2Byte(pDM_Odm, ODM_REG_NHM_TIMER_11N + 2, 0xC350); /*0x894[31:16]=0x0xC350 Time duration for NHM unit: us, 0xc350=200ms*/
|
||||
ODM_Write2Byte(pDM_Odm, ODM_REG_NHM_TH9_TH10_11N + 2, 0xffff); /*0x890[31:16]=0xffff th_9, th_10*/
|
||||
ODM_Write4Byte(pDM_Odm, ODM_REG_NHM_TH3_TO_TH0_11N, 0xffffff50); /*0x898=0xffffff52 th_3, th_2, th_1, th_0*/
|
||||
ODM_Write4Byte(pDM_Odm, ODM_REG_NHM_TH7_TO_TH4_11N, 0xffffffff); /*0x89c=0xffffffff th_7, th_6, th_5, th_4*/
|
||||
ODM_SetBBReg(pDM_Odm, ODM_REG_FPGA0_IQK_11N, bMaskByte0, 0xff); /*0xe28[7:0]=0xff th_8*/
|
||||
ODM_SetBBReg(pDM_Odm, ODM_REG_NHM_TH9_TH10_11N, BIT10 | BIT9 | BIT8, 0x1); /*0x890[10:8]=1 ignoreCCA ignore PHYTXON enable CCX*/
|
||||
ODM_SetBBReg(pDM_Odm, ODM_REG_OFDM_FA_RSTC_11N, BIT7, 0x1); /*0xc0c[7]=1 max power among all RX ants*/
|
||||
}
|
||||
#if (RTL8195A_SUPPORT == 0)
|
||||
else if (pDM_Odm->SupportICType & ODM_IC_11AC_SERIES) {
|
||||
/*PHY parameters initialize for ac series*/
|
||||
ODM_Write2Byte(pDM_Odm, ODM_REG_NHM_TIMER_11AC + 2, 0xC350); /*0x990[31:16]=0xC350 Time duration for NHM unit: us, 0xc350=200ms*/
|
||||
ODM_Write2Byte(pDM_Odm, ODM_REG_NHM_TH9_TH10_11AC + 2, 0xffff); /*0x994[31:16]=0xffff th_9, th_10*/
|
||||
ODM_Write4Byte(pDM_Odm, ODM_REG_NHM_TH3_TO_TH0_11AC, 0xffffff50); /*0x998=0xffffff52 th_3, th_2, th_1, th_0*/
|
||||
ODM_Write4Byte(pDM_Odm, ODM_REG_NHM_TH7_TO_TH4_11AC, 0xffffffff); /*0x99c=0xffffffff th_7, th_6, th_5, th_4*/
|
||||
ODM_SetBBReg(pDM_Odm, ODM_REG_NHM_TH8_11AC, bMaskByte0, 0xff); /*0x9a0[7:0]=0xff th_8*/
|
||||
ODM_SetBBReg(pDM_Odm, ODM_REG_NHM_TH9_TH10_11AC, BIT8 | BIT9 | BIT10, 0x1); /*0x994[10:8]=1 ignoreCCA ignore PHYTXON enable CCX*/
|
||||
ODM_SetBBReg(pDM_Odm, ODM_REG_NHM_9E8_11AC, BIT0, 0x1); /*0x9e8[7]=1 max power among all RX ants*/
|
||||
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
VOID
|
||||
Phydm_NHMCounterStatistics(
|
||||
IN PVOID pDM_VOID
|
||||
)
|
||||
{
|
||||
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
|
||||
|
||||
if (!(pDM_Odm->SupportAbility & ODM_BB_NHM_CNT))
|
||||
return;
|
||||
|
||||
/*Get NHM report*/
|
||||
Phydm_GetNHMCounterStatistics(pDM_Odm);
|
||||
|
||||
/*Reset NHM counter*/
|
||||
Phydm_NHMCounterStatisticsReset(pDM_Odm);
|
||||
}
|
||||
|
||||
VOID
|
||||
Phydm_GetNHMCounterStatistics(
|
||||
IN PVOID pDM_VOID
|
||||
)
|
||||
{
|
||||
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
|
||||
u4Byte value32 = 0;
|
||||
#if (RTL8195A_SUPPORT == 0)
|
||||
if (pDM_Odm->SupportICType & ODM_IC_11AC_SERIES)
|
||||
value32 = ODM_GetBBReg(pDM_Odm, ODM_REG_NHM_CNT_11AC, bMaskDWord);
|
||||
else if (pDM_Odm->SupportICType & ODM_IC_11N_SERIES)
|
||||
#endif
|
||||
value32 = ODM_GetBBReg(pDM_Odm, ODM_REG_NHM_CNT_11N, bMaskDWord);
|
||||
|
||||
pDM_Odm->NHM_cnt_0 = (u1Byte)(value32 & bMaskByte0);
|
||||
pDM_Odm->NHM_cnt_1 = (u1Byte)((value32 & bMaskByte1) >> 8);
|
||||
|
||||
}
|
||||
|
||||
VOID
|
||||
Phydm_NHMCounterStatisticsReset(
|
||||
IN PVOID pDM_VOID
|
||||
)
|
||||
{
|
||||
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
|
||||
|
||||
if (pDM_Odm->SupportICType & ODM_IC_11N_SERIES) {
|
||||
ODM_SetBBReg(pDM_Odm, ODM_REG_NHM_TH9_TH10_11N, BIT1, 0);
|
||||
ODM_SetBBReg(pDM_Odm, ODM_REG_NHM_TH9_TH10_11N, BIT1, 1);
|
||||
}
|
||||
#if (RTL8195A_SUPPORT == 0)
|
||||
else if (pDM_Odm->SupportICType & ODM_IC_11AC_SERIES) {
|
||||
ODM_SetBBReg(pDM_Odm, ODM_REG_NHM_TH9_TH10_11AC, BIT1, 0);
|
||||
ODM_SetBBReg(pDM_Odm, ODM_REG_NHM_TH9_TH10_11AC, BIT1, 1);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
VOID
|
||||
Phydm_SetEDCCAThreshold(
|
||||
IN PVOID pDM_VOID,
|
||||
IN s1Byte H2L,
|
||||
IN s1Byte L2H
|
||||
)
|
||||
{
|
||||
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
|
||||
|
||||
if (pDM_Odm->SupportICType & ODM_IC_11N_SERIES)
|
||||
ODM_SetBBReg(pDM_Odm, rOFDM0_ECCAThreshold, bMaskByte2|bMaskByte0, (u4Byte)((u1Byte)L2H|(u1Byte)H2L<<16));
|
||||
#if (RTL8195A_SUPPORT == 0)
|
||||
else if (pDM_Odm->SupportICType & ODM_IC_11AC_SERIES)
|
||||
ODM_SetBBReg(pDM_Odm, rFPGA0_XB_LSSIReadBack, bMaskLWord, (u2Byte)((u1Byte)L2H|(u1Byte)H2L<<8));
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
VOID
|
||||
Phydm_SetLNA(
|
||||
IN PVOID pDM_VOID,
|
||||
IN PhyDM_set_LNA type
|
||||
)
|
||||
{
|
||||
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
|
||||
|
||||
if (pDM_Odm->SupportICType & (ODM_RTL8188E | ODM_RTL8192E)) {
|
||||
if (type == PhyDM_disable_LNA) {
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0xef, 0x80000, 0x1);
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x30, 0xfffff, 0x18000); /*select Rx mode*/
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x31, 0xfffff, 0x0000f);
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x32, 0xfffff, 0x37f82); /*disable LNA*/
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0xef, 0x80000, 0x0);
|
||||
if (pDM_Odm->RFType > ODM_1T1R) {
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, 0xef, 0x80000, 0x1);
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, 0x30, 0xfffff, 0x18000);
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, 0x31, 0xfffff, 0x0000f);
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, 0x32, 0xfffff, 0x37f82);
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, 0xef, 0x80000, 0x0);
|
||||
}
|
||||
} else if (type == PhyDM_enable_LNA) {
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0xef, 0x80000, 0x1);
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x30, 0xfffff, 0x18000); /*select Rx mode*/
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x31, 0xfffff, 0x0000f);
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x32, 0xfffff, 0x77f82); /*back to normal*/
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0xef, 0x80000, 0x0);
|
||||
if (pDM_Odm->RFType > ODM_1T1R) {
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, 0xef, 0x80000, 0x1);
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, 0x30, 0xfffff, 0x18000);
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, 0x31, 0xfffff, 0x0000f);
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, 0x32, 0xfffff, 0x77f82);
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, 0xef, 0x80000, 0x0);
|
||||
}
|
||||
}
|
||||
} else if (pDM_Odm->SupportICType & ODM_RTL8723B) {
|
||||
if (type == PhyDM_disable_LNA) {
|
||||
/*S0*/
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0xef, 0x80000, 0x1);
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x30, 0xfffff, 0x18000); /*select Rx mode*/
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x31, 0xfffff, 0x0001f);
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x32, 0xfffff, 0xe6137); /*disable LNA*/
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0xef, 0x80000, 0x0);
|
||||
/*S1*/
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0xed, 0x00020, 0x1);
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x43, 0xfffff, 0x3008d); /*select Rx mode and disable LNA*/
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0xed, 0x00020, 0x0);
|
||||
} else if (type == PhyDM_enable_LNA) {
|
||||
/*S0*/
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0xef, 0x80000, 0x1);
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x30, 0xfffff, 0x18000); /*select Rx mode*/
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x31, 0xfffff, 0x0001f);
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x32, 0xfffff, 0xe6177); /*disable LNA*/
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0xef, 0x80000, 0x0);
|
||||
/*S1*/
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0xed, 0x00020, 0x1);
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x43, 0xfffff, 0x300bd); /*select Rx mode and disable LNA*/
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0xed, 0x00020, 0x0);
|
||||
}
|
||||
|
||||
} else if (pDM_Odm->SupportICType & ODM_RTL8812) {
|
||||
if (type == PhyDM_disable_LNA) {
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0xef, 0x80000, 0x1);
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x30, 0xfffff, 0x18000); /*select Rx mode*/
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x31, 0xfffff, 0x3f7ff);
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x32, 0xfffff, 0xc22bf); /*disable LNA*/
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0xef, 0x80000, 0x0);
|
||||
if (pDM_Odm->RFType > ODM_1T1R) {
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, 0xef, 0x80000, 0x1);
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, 0x30, 0xfffff, 0x18000); /*select Rx mode*/
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, 0x31, 0xfffff, 0x3f7ff);
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, 0x32, 0xfffff, 0xc22bf); /*disable LNA*/
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, 0xef, 0x80000, 0x0);
|
||||
}
|
||||
} else if (type == PhyDM_enable_LNA) {
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0xef, 0x80000, 0x1);
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x30, 0xfffff, 0x18000); /*select Rx mode*/
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x31, 0xfffff, 0x3f7ff);
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x32, 0xfffff, 0xc26bf); /*disable LNA*/
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0xef, 0x80000, 0x0);
|
||||
if (pDM_Odm->RFType > ODM_1T1R) {
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, 0xef, 0x80000, 0x1);
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, 0x30, 0xfffff, 0x18000); /*select Rx mode*/
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, 0x31, 0xfffff, 0x3f7ff);
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, 0x32, 0xfffff, 0xc26bf); /*disable LNA*/
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, 0xef, 0x80000, 0x0);
|
||||
}
|
||||
}
|
||||
} else if (pDM_Odm->SupportICType & (ODM_RTL8821 | ODM_RTL8881A)) {
|
||||
if (type == PhyDM_disable_LNA) {
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0xef, 0x80000, 0x1);
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x30, 0xfffff, 0x18000); /*select Rx mode*/
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x31, 0xfffff, 0x0002f);
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x32, 0xfffff, 0xfb09b); /*disable LNA*/
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0xef, 0x80000, 0x0);
|
||||
} else if (type == PhyDM_enable_LNA) {
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0xef, 0x80000, 0x1);
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x30, 0xfffff, 0x18000); /*select Rx mode*/
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x31, 0xfffff, 0x0002f);
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x32, 0xfffff, 0xfb0bb); /*disable LNA*/
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0xef, 0x80000, 0x0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
Phydm_SetTRxMux(
|
||||
IN PVOID pDM_VOID,
|
||||
IN PhyDM_Trx_MUX_Type txMode,
|
||||
IN PhyDM_Trx_MUX_Type rxMode
|
||||
)
|
||||
{
|
||||
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
|
||||
|
||||
if (pDM_Odm->SupportICType & ODM_IC_11N_SERIES) {
|
||||
ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_RPT_FORMAT_11N, BIT3 | BIT2 | BIT1, txMode); /*set TXmod to standby mode to remove outside noise affect*/
|
||||
ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_RPT_FORMAT_11N, BIT22 | BIT21 | BIT20, rxMode); /*set RXmod to standby mode to remove outside noise affect*/
|
||||
if (pDM_Odm->RFType > ODM_1T1R) {
|
||||
ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_RPT_FORMAT_11N_B, BIT3 | BIT2 | BIT1, txMode); /*set TXmod to standby mode to remove outside noise affect*/
|
||||
ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_RPT_FORMAT_11N_B, BIT22 | BIT21 | BIT20, rxMode); /*set RXmod to standby mode to remove outside noise affect*/
|
||||
}
|
||||
}
|
||||
#if (RTL8195A_SUPPORT == 0)
|
||||
else if (pDM_Odm->SupportICType & ODM_IC_11AC_SERIES) {
|
||||
ODM_SetBBReg(pDM_Odm, ODM_REG_TRMUX_11AC, BIT11 | BIT10 | BIT9 | BIT8, txMode); /*set TXmod to standby mode to remove outside noise affect*/
|
||||
ODM_SetBBReg(pDM_Odm, ODM_REG_TRMUX_11AC, BIT7 | BIT6 | BIT5 | BIT4, rxMode); /*set RXmod to standby mode to remove outside noise affect*/
|
||||
if (pDM_Odm->RFType > ODM_1T1R) {
|
||||
ODM_SetBBReg(pDM_Odm, ODM_REG_TRMUX_11AC_B, BIT11 | BIT10 | BIT9 | BIT8, txMode); /*set TXmod to standby mode to remove outside noise affect*/
|
||||
ODM_SetBBReg(pDM_Odm, ODM_REG_TRMUX_11AC_B, BIT7 | BIT6 | BIT5 | BIT4, rxMode); /*set RXmod to standby mode to remove outside noise affect*/
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
VOID
|
||||
Phydm_MACEDCCAState(
|
||||
IN PVOID pDM_VOID,
|
||||
IN PhyDM_MACEDCCA_Type State
|
||||
)
|
||||
{
|
||||
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
|
||||
if (State == PhyDM_IGNORE_EDCCA) {
|
||||
ODM_SetMACReg(pDM_Odm, REG_TX_PTCL_CTRL, BIT15, 1); /*ignore EDCCA reg520[15]=1*/
|
||||
ODM_SetMACReg(pDM_Odm, REG_RD_CTRL, BIT11, 0); /*reg524[11]=0*/
|
||||
} else { /*don't set MAC ignore EDCCA signal*/
|
||||
ODM_SetMACReg(pDM_Odm, REG_TX_PTCL_CTRL, BIT15, 0); /*don't ignore EDCCA reg520[15]=0*/
|
||||
ODM_SetMACReg(pDM_Odm, REG_RD_CTRL, BIT11, 1); /*reg524[11]=1 */
|
||||
}
|
||||
ODM_RT_TRACE(pDM_Odm, PHYDM_COMP_ADAPTIVITY, ODM_DBG_LOUD, ("EDCCA enable State = %d\n", State));
|
||||
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
Phydm_CalNHMcnt(
|
||||
IN PVOID pDM_VOID
|
||||
)
|
||||
{
|
||||
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
|
||||
u2Byte Base = 0;
|
||||
|
||||
Base = pDM_Odm->NHM_cnt_0 + pDM_Odm->NHM_cnt_1;
|
||||
|
||||
if (Base != 0) {
|
||||
pDM_Odm->NHM_cnt_0 = ((pDM_Odm->NHM_cnt_0) << 8) / Base;
|
||||
pDM_Odm->NHM_cnt_1 = ((pDM_Odm->NHM_cnt_1) << 8) / Base;
|
||||
}
|
||||
if ((pDM_Odm->NHM_cnt_0 - pDM_Odm->NHM_cnt_1) >= 100)
|
||||
return TRUE; /*clean environment*/
|
||||
else
|
||||
return FALSE; /*noisy environment*/
|
||||
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
Phydm_CheckEnvironment(
|
||||
IN PVOID pDM_VOID
|
||||
)
|
||||
{
|
||||
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
|
||||
PADAPTIVITY_STATISTICS Adaptivity = (PADAPTIVITY_STATISTICS)PhyDM_Get_Structure(pDM_Odm, PHYDM_ADAPTIVITY);
|
||||
BOOLEAN isCleanEnvironment = FALSE;
|
||||
|
||||
if (Adaptivity->bFirstLink == TRUE) {
|
||||
if (pDM_Odm->SupportICType & (ODM_IC_11AC_GAIN_IDX_EDCCA | ODM_IC_11N_GAIN_IDX_EDCCA))
|
||||
pDM_Odm->adaptivity_flag = FALSE;
|
||||
else
|
||||
pDM_Odm->adaptivity_flag = TRUE;
|
||||
|
||||
Adaptivity->bFirstLink = FALSE;
|
||||
return;
|
||||
} else {
|
||||
if (Adaptivity->NHMWait < 3) { /*Start enter NHM after 4 NHMWait*/
|
||||
Adaptivity->NHMWait++;
|
||||
Phydm_NHMCounterStatistics(pDM_Odm);
|
||||
return;
|
||||
} else {
|
||||
Phydm_NHMCounterStatistics(pDM_Odm);
|
||||
isCleanEnvironment = Phydm_CalNHMcnt(pDM_Odm);
|
||||
if (isCleanEnvironment == TRUE) {
|
||||
pDM_Odm->TH_L2H_ini = Adaptivity->TH_L2H_ini_backup; /*adaptivity mode*/
|
||||
pDM_Odm->TH_EDCCA_HL_diff = Adaptivity->TH_EDCCA_HL_diff_backup;
|
||||
|
||||
pDM_Odm->Adaptivity_enable = TRUE;
|
||||
|
||||
if (pDM_Odm->SupportICType & (ODM_IC_11AC_GAIN_IDX_EDCCA | ODM_IC_11N_GAIN_IDX_EDCCA))
|
||||
pDM_Odm->adaptivity_flag = FALSE;
|
||||
else
|
||||
pDM_Odm->adaptivity_flag = TRUE;
|
||||
} else {
|
||||
pDM_Odm->TH_L2H_ini = pDM_Odm->TH_L2H_ini_mode2; /*mode2*/
|
||||
pDM_Odm->TH_EDCCA_HL_diff = pDM_Odm->TH_EDCCA_HL_diff_mode2;
|
||||
|
||||
pDM_Odm->adaptivity_flag = FALSE;
|
||||
pDM_Odm->Adaptivity_enable = FALSE;
|
||||
}
|
||||
Adaptivity->NHMWait = 0;
|
||||
Adaptivity->bFirstLink = TRUE;
|
||||
Adaptivity->bCheck = TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
VOID
|
||||
Phydm_SearchPwdBLowerBound(
|
||||
IN PVOID pDM_VOID
|
||||
)
|
||||
{
|
||||
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
|
||||
PADAPTIVITY_STATISTICS Adaptivity = (PADAPTIVITY_STATISTICS)PhyDM_Get_Structure(pDM_Odm, PHYDM_ADAPTIVITY);
|
||||
u4Byte value32 = 0;
|
||||
u1Byte cnt, IGI = 0x45; /*IGI = 0x50 for cal EDCCA lower bound*/
|
||||
u1Byte txEdcca1 = 0, txEdcca0 = 0;
|
||||
BOOLEAN bAdjust = TRUE;
|
||||
s1Byte TH_L2H_dmc, TH_H2L_dmc, IGI_target = 0x32;
|
||||
s1Byte Diff;
|
||||
|
||||
if (pDM_Odm->SupportICType & (ODM_RTL8723B | ODM_RTL8188E | ODM_RTL8192E | ODM_RTL8812 | ODM_RTL8821 | ODM_RTL8881A))
|
||||
Phydm_SetLNA(pDM_Odm, PhyDM_disable_LNA);
|
||||
else {
|
||||
Phydm_SetTRxMux(pDM_Odm, PhyDM_STANDBY_MODE, PhyDM_STANDBY_MODE);
|
||||
odm_PauseDIG(pDM_Odm, PHYDM_PAUSE, PHYDM_PAUSE_LEVEL_0, 0x7e);
|
||||
}
|
||||
|
||||
Diff = IGI_target - (s1Byte)IGI;
|
||||
TH_L2H_dmc = pDM_Odm->TH_L2H_ini + Diff;
|
||||
if (TH_L2H_dmc > 10)
|
||||
TH_L2H_dmc = 10;
|
||||
TH_H2L_dmc = TH_L2H_dmc - pDM_Odm->TH_EDCCA_HL_diff;
|
||||
|
||||
Phydm_SetEDCCAThreshold(pDM_Odm, TH_H2L_dmc, TH_L2H_dmc);
|
||||
ODM_delay_ms(5);
|
||||
|
||||
while (bAdjust) {
|
||||
for (cnt = 0; cnt < 20; cnt++) {
|
||||
if (pDM_Odm->SupportICType & ODM_IC_11N_SERIES)
|
||||
value32 = ODM_GetBBReg(pDM_Odm, ODM_REG_RPT_11N, bMaskDWord);
|
||||
#if (RTL8195A_SUPPORT == 0)
|
||||
else if (pDM_Odm->SupportICType & ODM_IC_11AC_SERIES)
|
||||
value32 = ODM_GetBBReg(pDM_Odm, ODM_REG_RPT_11AC, bMaskDWord);
|
||||
#endif
|
||||
if (value32 & BIT30 && (pDM_Odm->SupportICType & (ODM_RTL8723A | ODM_RTL8723B | ODM_RTL8188E)))
|
||||
txEdcca1 = txEdcca1 + 1;
|
||||
else if (value32 & BIT29)
|
||||
txEdcca1 = txEdcca1 + 1;
|
||||
else
|
||||
txEdcca0 = txEdcca0 + 1;
|
||||
}
|
||||
|
||||
if (txEdcca1 > 1) {
|
||||
IGI = IGI - 1;
|
||||
TH_L2H_dmc = TH_L2H_dmc + 1;
|
||||
if (TH_L2H_dmc > 10)
|
||||
TH_L2H_dmc = 10;
|
||||
TH_H2L_dmc = TH_L2H_dmc - pDM_Odm->TH_EDCCA_HL_diff;
|
||||
|
||||
Phydm_SetEDCCAThreshold(pDM_Odm, TH_H2L_dmc, TH_L2H_dmc);
|
||||
if (TH_L2H_dmc == 10) {
|
||||
bAdjust = FALSE;
|
||||
Adaptivity->H2L_lb = TH_H2L_dmc;
|
||||
Adaptivity->L2H_lb = TH_L2H_dmc;
|
||||
pDM_Odm->Adaptivity_IGI_upper = IGI;
|
||||
}
|
||||
|
||||
txEdcca1 = 0;
|
||||
txEdcca0 = 0;
|
||||
|
||||
} else {
|
||||
bAdjust = FALSE;
|
||||
Adaptivity->H2L_lb = TH_H2L_dmc;
|
||||
Adaptivity->L2H_lb = TH_L2H_dmc;
|
||||
pDM_Odm->Adaptivity_IGI_upper = IGI;
|
||||
txEdcca1 = 0;
|
||||
txEdcca0 = 0;
|
||||
}
|
||||
}
|
||||
|
||||
pDM_Odm->Adaptivity_IGI_upper = pDM_Odm->Adaptivity_IGI_upper - pDM_Odm->DCbackoff;
|
||||
Adaptivity->H2L_lb = Adaptivity->H2L_lb + pDM_Odm->DCbackoff;
|
||||
Adaptivity->L2H_lb = Adaptivity->L2H_lb + pDM_Odm->DCbackoff;
|
||||
|
||||
if (pDM_Odm->SupportICType & (ODM_RTL8723B | ODM_RTL8188E | ODM_RTL8192E | ODM_RTL8812 | ODM_RTL8821 | ODM_RTL8881A))
|
||||
Phydm_SetLNA(pDM_Odm, PhyDM_enable_LNA);
|
||||
else {
|
||||
Phydm_SetTRxMux(pDM_Odm, PhyDM_TX_MODE, PhyDM_RX_MODE);
|
||||
odm_PauseDIG(pDM_Odm, PHYDM_RESUME, PHYDM_PAUSE_LEVEL_0, NONE);
|
||||
}
|
||||
|
||||
Phydm_SetEDCCAThreshold(pDM_Odm, 0x7f, 0x7f); /*resume to no link state*/
|
||||
}
|
||||
|
||||
VOID
|
||||
Phydm_AdaptivityInit(
|
||||
IN PVOID pDM_VOID
|
||||
)
|
||||
{
|
||||
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
|
||||
PADAPTIVITY_STATISTICS Adaptivity = (PADAPTIVITY_STATISTICS)PhyDM_Get_Structure(pDM_Odm, PHYDM_ADAPTIVITY);
|
||||
s1Byte IGItarget = 0x32;
|
||||
#if(DM_ODM_SUPPORT_TYPE == ODM_WIN)
|
||||
PADAPTER pAdapter = pDM_Odm->Adapter;
|
||||
PMGNT_INFO pMgntInfo = &(pAdapter->MgntInfo);
|
||||
pDM_Odm->Carrier_Sense_enable = (BOOLEAN)pMgntInfo->RegEnableCarrierSense;
|
||||
pDM_Odm->DCbackoff = (u1Byte)pMgntInfo->RegDCbackoff;
|
||||
Adaptivity->DynamicLinkAdaptivity = (BOOLEAN)pMgntInfo->RegDmLinkAdaptivity;
|
||||
Adaptivity->APNumTH = (u1Byte)pMgntInfo->RegAPNumTH;
|
||||
#elif(DM_ODM_SUPPORT_TYPE == ODM_CE)
|
||||
pDM_Odm->Carrier_Sense_enable = (pDM_Odm->Adapter->registrypriv.adaptivity_mode != 0) ? TRUE : FALSE;
|
||||
pDM_Odm->DCbackoff = pDM_Odm->Adapter->registrypriv.adaptivity_dc_backoff;
|
||||
Adaptivity->DynamicLinkAdaptivity = (pDM_Odm->Adapter->registrypriv.adaptivity_dml != 0) ? TRUE : FALSE;
|
||||
#endif
|
||||
|
||||
|
||||
#if(DM_ODM_SUPPORT_TYPE & (ODM_CE|ODM_WIN))
|
||||
|
||||
if (pDM_Odm->Carrier_Sense_enable == FALSE) {
|
||||
#if(DM_ODM_SUPPORT_TYPE == ODM_WIN)
|
||||
if (pMgntInfo->RegL2HForAdaptivity != 0)
|
||||
pDM_Odm->TH_L2H_ini = pMgntInfo->RegL2HForAdaptivity;
|
||||
else
|
||||
#elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
|
||||
if (pDM_Odm->Adapter->registrypriv.adaptivity_th_l2h_ini != 0)
|
||||
pDM_Odm->TH_L2H_ini = pDM_Odm->Adapter->registrypriv.adaptivity_th_l2h_ini;
|
||||
else
|
||||
#endif
|
||||
pDM_Odm->TH_L2H_ini = 0xf5;
|
||||
} else
|
||||
pDM_Odm->TH_L2H_ini = 0xa;
|
||||
|
||||
#if(DM_ODM_SUPPORT_TYPE == ODM_WIN)
|
||||
if (pMgntInfo->RegHLDiffForAdaptivity != 0)
|
||||
pDM_Odm->TH_EDCCA_HL_diff = pMgntInfo->RegHLDiffForAdaptivity;
|
||||
else
|
||||
#elif(DM_ODM_SUPPORT_TYPE == ODM_CE)
|
||||
if (pDM_Odm->Adapter->registrypriv.adaptivity_th_edcca_hl_diff != 0)
|
||||
pDM_Odm->TH_EDCCA_HL_diff = pDM_Odm->Adapter->registrypriv.adaptivity_th_edcca_hl_diff;
|
||||
else
|
||||
#endif
|
||||
pDM_Odm->TH_EDCCA_HL_diff = 7;
|
||||
|
||||
Adaptivity->TH_L2H_ini_backup = pDM_Odm->TH_L2H_ini;
|
||||
Adaptivity->TH_EDCCA_HL_diff_backup = pDM_Odm->TH_EDCCA_HL_diff;
|
||||
|
||||
#elif (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
|
||||
prtl8192cd_priv priv = pDM_Odm->priv;
|
||||
|
||||
if (pDM_Odm->Carrier_Sense_enable) {
|
||||
pDM_Odm->TH_L2H_ini = 0xa;
|
||||
pDM_Odm->TH_EDCCA_HL_diff = 7;
|
||||
} else {
|
||||
Adaptivity->TH_L2H_ini_backup = pDM_Odm->TH_L2H_ini; /*set by mib*/
|
||||
pDM_Odm->TH_EDCCA_HL_diff = 7;
|
||||
}
|
||||
|
||||
Adaptivity->TH_EDCCA_HL_diff_backup = pDM_Odm->TH_EDCCA_HL_diff;
|
||||
if (priv->pshare->rf_ft_var.adaptivity_enable == 2)
|
||||
Adaptivity->DynamicLinkAdaptivity = TRUE;
|
||||
else
|
||||
Adaptivity->DynamicLinkAdaptivity = FALSE;
|
||||
|
||||
#endif
|
||||
|
||||
pDM_Odm->Adaptivity_IGI_upper = 0;
|
||||
pDM_Odm->Adaptivity_enable = FALSE; /*use this flag to decide enable or disable*/
|
||||
|
||||
pDM_Odm->EDCCA_enable = TRUE; /*even no adaptivity, we still enable EDCCA*/
|
||||
|
||||
pDM_Odm->TH_L2H_ini_mode2 = 20;
|
||||
pDM_Odm->TH_EDCCA_HL_diff_mode2 = 8;
|
||||
|
||||
Adaptivity->IGI_Base = 0x32;
|
||||
Adaptivity->IGI_target = 0x1c;
|
||||
Adaptivity->H2L_lb = 0;
|
||||
Adaptivity->L2H_lb = 0;
|
||||
Adaptivity->NHMWait = 0;
|
||||
Adaptivity->bCheck = FALSE;
|
||||
Adaptivity->bFirstLink = TRUE;
|
||||
Adaptivity->AdajustIGILevel = 0;
|
||||
|
||||
Phydm_MACEDCCAState(pDM_Odm, PhyDM_DONT_IGNORE_EDCCA);
|
||||
|
||||
/*Search pwdB lower bound*/
|
||||
if (pDM_Odm->SupportICType & ODM_IC_11N_SERIES)
|
||||
ODM_SetBBReg(pDM_Odm, ODM_REG_DBG_RPT_11N, bMaskDWord, 0x208);
|
||||
#if (RTL8195A_SUPPORT == 0)
|
||||
else if (pDM_Odm->SupportICType & ODM_IC_11AC_SERIES)
|
||||
ODM_SetBBReg(pDM_Odm, ODM_REG_DBG_RPT_11AC, bMaskDWord, 0x209);
|
||||
#endif
|
||||
|
||||
if (pDM_Odm->SupportICType & ODM_IC_11N_GAIN_IDX_EDCCA) {
|
||||
/*ODM_SetBBReg(pDM_Odm, ODM_REG_EDCCA_DOWN_OPT_11N, BIT12 | BIT11 | BIT10, 0x7);*/ /*interfernce need > 2^x us, and then EDCCA will be 1*/
|
||||
ODM_SetBBReg(pDM_Odm, ODM_REG_EDCCA_DCNF_11N, BIT21 | BIT20, 0x1); /*0:rx_dfir, 1: dcnf_out, 2 :rx_iq, 3: rx_nbi_nf_out*/
|
||||
}
|
||||
#if (RTL8195A_SUPPORT == 0)
|
||||
if (pDM_Odm->SupportICType & ODM_IC_11AC_GAIN_IDX_EDCCA) { /*8814a no need to find pwdB lower bound, maybe*/
|
||||
/*ODM_SetBBReg(pDM_Odm, ODM_REG_EDCCA_DOWN_OPT, BIT30 | BIT29 | BIT28, 0x7);*/ /*interfernce need > 2^x us, and then EDCCA will be 1*/
|
||||
ODM_SetBBReg(pDM_Odm, ODM_REG_ACBB_EDCCA_ENHANCE, BIT29 | BIT28, 0x1); /*0:rx_dfir, 1: dcnf_out, 2 :rx_iq, 3: rx_nbi_nf_out*/
|
||||
}
|
||||
|
||||
if(!(pDM_Odm->SupportICType & (ODM_IC_11AC_GAIN_IDX_EDCCA | ODM_IC_11N_GAIN_IDX_EDCCA)))
|
||||
Phydm_SearchPwdBLowerBound(pDM_Odm);
|
||||
#endif
|
||||
|
||||
/*we need to consider PwdB upper bound for 8814 later IC*/
|
||||
Adaptivity->AdajustIGILevel = (u1Byte)((pDM_Odm->TH_L2H_ini + IGItarget) - PwdBUpperBound + DFIRloss); /*IGI = L2H - PwdB - DFIRloss*/
|
||||
|
||||
ODM_RT_TRACE(pDM_Odm, PHYDM_COMP_ADAPTIVITY, ODM_DBG_LOUD, ("TH_L2H_ini = 0x%x, TH_EDCCA_HL_diff = 0x%x, Adaptivity->AdajustIGILevel = 0x%x\n", pDM_Odm->TH_L2H_ini, pDM_Odm->TH_EDCCA_HL_diff, Adaptivity->AdajustIGILevel));
|
||||
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
Phydm_Adaptivity(
|
||||
IN PVOID pDM_VOID,
|
||||
IN u1Byte IGI
|
||||
)
|
||||
{
|
||||
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
|
||||
s1Byte TH_L2H_dmc, TH_H2L_dmc;
|
||||
s1Byte Diff = 0, IGI_target;
|
||||
PADAPTIVITY_STATISTICS Adaptivity = (PADAPTIVITY_STATISTICS)PhyDM_Get_Structure(pDM_Odm, PHYDM_ADAPTIVITY);
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
|
||||
PADAPTER pAdapter = pDM_Odm->Adapter;
|
||||
BOOLEAN bFwCurrentInPSMode = FALSE;
|
||||
PMGNT_INFO pMgntInfo = &(pAdapter->MgntInfo);
|
||||
|
||||
pAdapter->HalFunc.GetHwRegHandler(pAdapter, HW_VAR_FW_PSMODE_STATUS, (pu1Byte)(&bFwCurrentInPSMode));
|
||||
|
||||
/*Disable EDCCA mode while under LPS mode, added by Roger, 2012.09.14.*/
|
||||
if (bFwCurrentInPSMode)
|
||||
return;
|
||||
#endif
|
||||
|
||||
if ((pDM_Odm->EDCCA_enable == FALSE) || (pDM_Odm->bWIFITest == TRUE)) {
|
||||
ODM_RT_TRACE(pDM_Odm, PHYDM_COMP_ADAPTIVITY, ODM_DBG_LOUD, ("Disable EDCCA!!!\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(pDM_Odm->SupportAbility & ODM_BB_ADAPTIVITY)) {
|
||||
ODM_RT_TRACE(pDM_Odm, PHYDM_COMP_ADAPTIVITY, ODM_DBG_LOUD, ("adaptivity disable, enable EDCCA mode!!!\n"));
|
||||
pDM_Odm->TH_L2H_ini = pDM_Odm->TH_L2H_ini_mode2;
|
||||
pDM_Odm->TH_EDCCA_HL_diff = pDM_Odm->TH_EDCCA_HL_diff_mode2;
|
||||
}
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
|
||||
else{
|
||||
if (Phydm_CheckChannelPlan(pDM_Odm) || (pDM_Odm->APTotalNum > Adaptivity->APNumTH)) {
|
||||
pDM_Odm->TH_L2H_ini = pDM_Odm->TH_L2H_ini_mode2;
|
||||
pDM_Odm->TH_EDCCA_HL_diff = pDM_Odm->TH_EDCCA_HL_diff_mode2;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
ODM_RT_TRACE(pDM_Odm, PHYDM_COMP_ADAPTIVITY, ODM_DBG_LOUD, ("odm_Adaptivity() =====>\n"));
|
||||
ODM_RT_TRACE(pDM_Odm, PHYDM_COMP_ADAPTIVITY, ODM_DBG_LOUD, ("IGI_Base=0x%x, TH_L2H_ini = %d, TH_EDCCA_HL_diff = %d\n",
|
||||
Adaptivity->IGI_Base, pDM_Odm->TH_L2H_ini, pDM_Odm->TH_EDCCA_HL_diff));
|
||||
#if (RTL8195A_SUPPORT == 0)
|
||||
if (pDM_Odm->SupportICType & ODM_IC_11AC_SERIES) {
|
||||
/*fix AC series when enable EDCCA hang issue*/
|
||||
ODM_SetBBReg(pDM_Odm, 0x800, BIT10, 1); /*ADC_mask disable*/
|
||||
ODM_SetBBReg(pDM_Odm, 0x800, BIT10, 0); /*ADC_mask enable*/
|
||||
}
|
||||
#endif
|
||||
if (*pDM_Odm->pBandWidth == ODM_BW20M) /*CHANNEL_WIDTH_20*/
|
||||
IGI_target = Adaptivity->IGI_Base;
|
||||
else if (*pDM_Odm->pBandWidth == ODM_BW40M)
|
||||
IGI_target = Adaptivity->IGI_Base + 2;
|
||||
#if (RTL8195A_SUPPORT == 0)
|
||||
else if (*pDM_Odm->pBandWidth == ODM_BW80M)
|
||||
IGI_target = Adaptivity->IGI_Base + 2;
|
||||
#endif
|
||||
else
|
||||
IGI_target = Adaptivity->IGI_Base;
|
||||
Adaptivity->IGI_target = (u1Byte) IGI_target;
|
||||
|
||||
ODM_RT_TRACE(pDM_Odm, PHYDM_COMP_ADAPTIVITY, ODM_DBG_LOUD, ("BandWidth=%s, IGI_target=0x%x, DynamicLinkAdaptivity = %d\n",
|
||||
(*pDM_Odm->pBandWidth == ODM_BW80M) ? "80M" : ((*pDM_Odm->pBandWidth == ODM_BW40M) ? "40M" : "20M"), IGI_target, Adaptivity->DynamicLinkAdaptivity));
|
||||
ODM_RT_TRACE(pDM_Odm, PHYDM_COMP_ADAPTIVITY, ODM_DBG_LOUD, ("RSSI_min = %d, Adaptivity->AdajustIGILevel= 0x%x, adaptivity_flag = %d, Adaptivity_enable = %d\n",
|
||||
pDM_Odm->RSSI_Min, Adaptivity->AdajustIGILevel, pDM_Odm->adaptivity_flag, pDM_Odm->Adaptivity_enable));
|
||||
|
||||
if ((Adaptivity->DynamicLinkAdaptivity == TRUE) && (!pDM_Odm->bLinked) && (pDM_Odm->Adaptivity_enable == FALSE)) {
|
||||
Phydm_SetEDCCAThreshold(pDM_Odm, 0x7f, 0x7f);
|
||||
ODM_RT_TRACE(pDM_Odm, PHYDM_COMP_ADAPTIVITY, ODM_DBG_LOUD, ("In DynamicLink mode(noisy) and No link, Turn off EDCCA!!\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (pDM_Odm->SupportICType & (ODM_IC_11AC_GAIN_IDX_EDCCA | ODM_IC_11N_GAIN_IDX_EDCCA)) {
|
||||
if ((Adaptivity->AdajustIGILevel > IGI) && (pDM_Odm->Adaptivity_enable == TRUE))
|
||||
Diff = Adaptivity->AdajustIGILevel - IGI;
|
||||
|
||||
TH_L2H_dmc = pDM_Odm->TH_L2H_ini - Diff + IGI_target;
|
||||
TH_H2L_dmc = TH_L2H_dmc - pDM_Odm->TH_EDCCA_HL_diff;
|
||||
}
|
||||
#if (RTL8195A_SUPPORT == 0)
|
||||
else {
|
||||
Diff = IGI_target - (s1Byte)IGI;
|
||||
TH_L2H_dmc = pDM_Odm->TH_L2H_ini + Diff;
|
||||
if (TH_L2H_dmc > 10 && (pDM_Odm->Adaptivity_enable == TRUE))
|
||||
TH_L2H_dmc = 10;
|
||||
|
||||
TH_H2L_dmc = TH_L2H_dmc - pDM_Odm->TH_EDCCA_HL_diff;
|
||||
|
||||
/*replace lower bound to prevent EDCCA always equal 1*/
|
||||
if (TH_H2L_dmc < Adaptivity->H2L_lb)
|
||||
TH_H2L_dmc = Adaptivity->H2L_lb;
|
||||
if (TH_L2H_dmc < Adaptivity->L2H_lb)
|
||||
TH_L2H_dmc = Adaptivity->L2H_lb;
|
||||
}
|
||||
#endif
|
||||
ODM_RT_TRACE(pDM_Odm, PHYDM_COMP_ADAPTIVITY, ODM_DBG_LOUD, ("IGI=0x%x, TH_L2H_dmc = %d, TH_H2L_dmc = %d\n", IGI, TH_L2H_dmc, TH_H2L_dmc));
|
||||
ODM_RT_TRACE(pDM_Odm, PHYDM_COMP_ADAPTIVITY, ODM_DBG_LOUD, ("Adaptivity_IGI_upper=0x%x, H2L_lb = 0x%x, L2H_lb = 0x%x\n", pDM_Odm->Adaptivity_IGI_upper, Adaptivity->H2L_lb, Adaptivity->L2H_lb));
|
||||
|
||||
Phydm_SetEDCCAThreshold(pDM_Odm, TH_H2L_dmc, TH_L2H_dmc);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
|
||||
|
||||
VOID
|
||||
Phydm_AdaptivityBSOD(
|
||||
IN PVOID pDM_VOID
|
||||
)
|
||||
{
|
||||
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
|
||||
PADAPTER pAdapter = pDM_Odm->Adapter;
|
||||
PMGNT_INFO pMgntInfo = &(pAdapter->MgntInfo);
|
||||
u1Byte count = 0;
|
||||
u4Byte u4Value;
|
||||
|
||||
/*
|
||||
1. turn off RF (TRX Mux in standby mode)
|
||||
2. H2C mac id drop
|
||||
3. ignore EDCCA
|
||||
4. wait for clear FIFO
|
||||
5. don't ignore EDCCA
|
||||
6. turn on RF (TRX Mux in TRx mdoe)
|
||||
7. H2C mac id resume
|
||||
*/
|
||||
|
||||
RT_TRACE(COMP_MLME, DBG_WARNING, ("MAC id drop packet!!!!!\n"));
|
||||
|
||||
pAdapter->dropPktByMacIdCnt++;
|
||||
pMgntInfo->bDropPktInProgress = TRUE;
|
||||
|
||||
pAdapter->HalFunc.GetHwRegHandler(pAdapter, HW_VAR_MAX_Q_PAGE_NUM, (pu1Byte)(&u4Value));
|
||||
RT_TRACE(COMP_INIT, DBG_LOUD, ("Queue Reserved Page Number = 0x%08x\n", u4Value));
|
||||
pAdapter->HalFunc.GetHwRegHandler(pAdapter, HW_VAR_AVBL_Q_PAGE_NUM, (pu1Byte)(&u4Value));
|
||||
RT_TRACE(COMP_INIT, DBG_LOUD, ("Available Queue Page Number = 0x%08x\n", u4Value));
|
||||
|
||||
#if 1
|
||||
|
||||
/*Standby mode*/
|
||||
Phydm_SetTRxMux(pDM_Odm, PhyDM_STANDBY_MODE, PhyDM_STANDBY_MODE);
|
||||
ODM_Write_DIG(pDM_Odm, 0x20);
|
||||
|
||||
/*H2C mac id drop*/
|
||||
MacIdIndicateDisconnect(pAdapter);
|
||||
|
||||
/*Ignore EDCCA*/
|
||||
Phydm_MACEDCCAState(pDM_Odm, PhyDM_IGNORE_EDCCA);
|
||||
|
||||
delay_ms(50);
|
||||
count = 5;
|
||||
|
||||
#else
|
||||
|
||||
do {
|
||||
|
||||
u8Byte diffTime, curTime, oldestTime;
|
||||
u1Byte queueIdx
|
||||
|
||||
//3 Standby mode
|
||||
Phydm_SetTRxMux(pDM_Odm, PhyDM_STANDBY_MODE, PhyDM_STANDBY_MODE);
|
||||
ODM_Write_DIG(pDM_Odm, 0x20);
|
||||
|
||||
//3 H2C mac id drop
|
||||
MacIdIndicateDisconnect(pAdapter);
|
||||
|
||||
//3 Ignore EDCCA
|
||||
Phydm_MACEDCCAState(pDM_Odm, PhyDM_IGNORE_EDCCA);
|
||||
|
||||
count++;
|
||||
delay_ms(10);
|
||||
|
||||
// Check latest packet
|
||||
curTime = PlatformGetCurrentTime();
|
||||
oldestTime = 0xFFFFFFFFFFFFFFFF;
|
||||
|
||||
for (queueIdx = 0; queueIdx < MAX_TX_QUEUE; queueIdx++) {
|
||||
if (!IS_DATA_QUEUE(queueIdx))
|
||||
continue;
|
||||
|
||||
if (!pAdapter->bTcbBusyQEmpty[queueIdx]) {
|
||||
RT_TRACE(COMP_MLME, DBG_WARNING, ("oldestTime = %llu\n", oldestTime));
|
||||
RT_TRACE(COMP_MLME, DBG_WARNING, ("Q[%d] = %llu\n", queueIdx, pAdapter->firstTcbSysTime[queueIdx]));
|
||||
if (pAdapter->firstTcbSysTime[queueIdx] < oldestTime)
|
||||
oldestTime = pAdapter->firstTcbSysTime[queueIdx];
|
||||
}
|
||||
}
|
||||
|
||||
diffTime = curTime - oldestTime;
|
||||
|
||||
RT_TRACE(COMP_MLME, DBG_WARNING, ("diff s = %llu\n", (diffTime / 1000000)));
|
||||
|
||||
} while (((diffTime / 1000000) >= 4) && (oldestTime != 0xFFFFFFFFFFFFFFFF));
|
||||
#endif
|
||||
|
||||
/*Resume EDCCA*/
|
||||
Phydm_MACEDCCAState(pDM_Odm, PhyDM_DONT_IGNORE_EDCCA);
|
||||
|
||||
/*Turn on TRx mode*/
|
||||
Phydm_SetTRxMux(pDM_Odm, PhyDM_TX_MODE, PhyDM_RX_MODE);
|
||||
ODM_Write_DIG(pDM_Odm, 0x20);
|
||||
|
||||
/*Resume H2C macid*/
|
||||
MacIdRecoverMediaStatus(pAdapter);
|
||||
|
||||
pAdapter->HalFunc.GetHwRegHandler(pAdapter, HW_VAR_AVBL_Q_PAGE_NUM, (pu1Byte)(&u4Value));
|
||||
RT_TRACE(COMP_INIT, DBG_LOUD, ("Available Queue Page Number = 0x%08x\n", u4Value));
|
||||
|
||||
pMgntInfo->bDropPktInProgress = FALSE;
|
||||
RT_TRACE(COMP_MLME, DBG_WARNING, ("End of MAC id drop packet, spent %dms\n", count * 10));
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
VOID
|
||||
phydm_setEDCCAThresholdAPI(
|
||||
IN PVOID pDM_VOID,
|
||||
IN u1Byte IGI
|
||||
)
|
||||
{
|
||||
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
|
||||
PADAPTIVITY_STATISTICS Adaptivity = (PADAPTIVITY_STATISTICS)PhyDM_Get_Structure(pDM_Odm, PHYDM_ADAPTIVITY);
|
||||
s1Byte TH_L2H_dmc, TH_H2L_dmc;
|
||||
s1Byte Diff = 0, IGI_target = 0x32;
|
||||
|
||||
if (pDM_Odm->SupportAbility & ODM_BB_ADAPTIVITY) {
|
||||
|
||||
if (pDM_Odm->SupportICType & (ODM_IC_11AC_GAIN_IDX_EDCCA | ODM_IC_11N_GAIN_IDX_EDCCA)) {
|
||||
if (Adaptivity->AdajustIGILevel > IGI)
|
||||
Diff = Adaptivity->AdajustIGILevel - IGI;
|
||||
|
||||
TH_L2H_dmc = pDM_Odm->TH_L2H_ini - Diff + IGI_target;
|
||||
TH_H2L_dmc = TH_L2H_dmc - pDM_Odm->TH_EDCCA_HL_diff;
|
||||
}
|
||||
#if (RTL8195A_SUPPORT == 0)
|
||||
else {
|
||||
Diff = IGI_target - (s1Byte)IGI;
|
||||
TH_L2H_dmc = pDM_Odm->TH_L2H_ini + Diff;
|
||||
if (TH_L2H_dmc > 10)
|
||||
TH_L2H_dmc = 10;
|
||||
|
||||
TH_H2L_dmc = TH_L2H_dmc - pDM_Odm->TH_EDCCA_HL_diff;
|
||||
|
||||
/*replace lower bound to prevent EDCCA always equal 1*/
|
||||
if (TH_H2L_dmc < Adaptivity->H2L_lb)
|
||||
TH_H2L_dmc = Adaptivity->H2L_lb;
|
||||
if (TH_L2H_dmc < Adaptivity->L2H_lb)
|
||||
TH_L2H_dmc = Adaptivity->L2H_lb;
|
||||
}
|
||||
#endif
|
||||
ODM_RT_TRACE(pDM_Odm, PHYDM_COMP_ADAPTIVITY, ODM_DBG_LOUD, ("API :IGI=0x%x, TH_L2H_dmc = %d, TH_H2L_dmc = %d\n", IGI, TH_L2H_dmc, TH_H2L_dmc));
|
||||
ODM_RT_TRACE(pDM_Odm, PHYDM_COMP_ADAPTIVITY, ODM_DBG_LOUD, ("API :Adaptivity_IGI_upper=0x%x, H2L_lb = 0x%x, L2H_lb = 0x%x\n", pDM_Odm->Adaptivity_IGI_upper, Adaptivity->H2L_lb, Adaptivity->L2H_lb));
|
||||
|
||||
Phydm_SetEDCCAThreshold(pDM_Odm, TH_H2L_dmc, TH_L2H_dmc);
|
||||
}
|
||||
|
||||
}
|
||||
172
hal/phydm/phydm_adaptivity.h
Normal file
172
hal/phydm/phydm_adaptivity.h
Normal file
|
|
@ -0,0 +1,172 @@
|
|||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __PHYDMADAPTIVITY_H__
|
||||
#define __PHYDMADAPTIVITY_H__
|
||||
|
||||
#define ADAPTIVITY_VERSION "9.0"
|
||||
|
||||
#define PwdBUpperBound 7
|
||||
#define DFIRloss 5
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN))
|
||||
typedef enum _tag_PhyDM_REGULATION_Type {
|
||||
REGULATION_FCC = 0,
|
||||
REGULATION_MKK = 1,
|
||||
REGULATION_ETSI = 2,
|
||||
REGULATION_WW = 3,
|
||||
|
||||
MAX_REGULATION_NUM = 4
|
||||
} PhyDM_REGULATION_TYPE;
|
||||
#endif
|
||||
|
||||
typedef enum tag_PhyDM_set_LNA {
|
||||
PhyDM_disable_LNA = 0,
|
||||
PhyDM_enable_LNA = 1,
|
||||
} PhyDM_set_LNA;
|
||||
|
||||
|
||||
typedef enum tag_PhyDM_TRx_MUX_Type
|
||||
{
|
||||
PhyDM_SHUTDOWN = 0,
|
||||
PhyDM_STANDBY_MODE = 1,
|
||||
PhyDM_TX_MODE = 2,
|
||||
PhyDM_RX_MODE = 3
|
||||
}PhyDM_Trx_MUX_Type;
|
||||
|
||||
typedef enum tag_PhyDM_MACEDCCA_Type
|
||||
{
|
||||
PhyDM_IGNORE_EDCCA = 0,
|
||||
PhyDM_DONT_IGNORE_EDCCA = 1
|
||||
}PhyDM_MACEDCCA_Type;
|
||||
|
||||
typedef struct _ADAPTIVITY_STATISTICS {
|
||||
s1Byte TH_L2H_ini_backup;
|
||||
s1Byte TH_EDCCA_HL_diff_backup;
|
||||
s1Byte IGI_Base;
|
||||
u1Byte IGI_target;
|
||||
u1Byte NHMWait;
|
||||
s1Byte H2L_lb;
|
||||
s1Byte L2H_lb;
|
||||
BOOLEAN bFirstLink;
|
||||
BOOLEAN bCheck;
|
||||
BOOLEAN DynamicLinkAdaptivity;
|
||||
u1Byte APNumTH;
|
||||
u1Byte AdajustIGILevel;
|
||||
} ADAPTIVITY_STATISTICS, *PADAPTIVITY_STATISTICS;
|
||||
|
||||
VOID
|
||||
Phydm_CheckAdaptivity(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
Phydm_CheckEnvironment(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
Phydm_NHMCounterStatisticsInit(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
Phydm_NHMCounterStatistics(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
Phydm_NHMCounterStatisticsReset(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
Phydm_GetNHMCounterStatistics(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
Phydm_MACEDCCAState(
|
||||
IN PVOID pDM_VOID,
|
||||
IN PhyDM_MACEDCCA_Type State
|
||||
);
|
||||
|
||||
VOID
|
||||
Phydm_SetEDCCAThreshold(
|
||||
IN PVOID pDM_VOID,
|
||||
IN s1Byte H2L,
|
||||
IN s1Byte L2H
|
||||
);
|
||||
|
||||
VOID
|
||||
Phydm_SetTRxMux(
|
||||
IN PVOID pDM_VOID,
|
||||
IN PhyDM_Trx_MUX_Type txMode,
|
||||
IN PhyDM_Trx_MUX_Type rxMode
|
||||
);
|
||||
|
||||
BOOLEAN
|
||||
Phydm_CalNHMcnt(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
Phydm_SearchPwdBLowerBound(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
Phydm_AdaptivityInit(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
Phydm_Adaptivity(
|
||||
IN PVOID pDM_VOID,
|
||||
IN u1Byte IGI
|
||||
);
|
||||
|
||||
VOID
|
||||
phydm_setEDCCAThresholdAPI(
|
||||
IN PVOID pDM_VOID,
|
||||
IN u1Byte IGI
|
||||
);
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
|
||||
VOID
|
||||
Phydm_DisableEDCCA(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
Phydm_DynamicEDCCA(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
Phydm_AdaptivityBSOD(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
1215
hal/phydm/phydm_antdect.c
Normal file
1215
hal/phydm/phydm_antdect.c
Normal file
File diff suppressed because it is too large
Load diff
98
hal/phydm/phydm_antdect.h
Normal file
98
hal/phydm/phydm_antdect.h
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __PHYDMANTDECT_H__
|
||||
#define __PHYDMANTDECT_H__
|
||||
|
||||
#define ANTDECT_VERSION "2.0" //2014.11.04
|
||||
|
||||
#if(defined(CONFIG_ANT_DETECTION))
|
||||
//#if( DM_ODM_SUPPORT_TYPE & (ODM_WIN |ODM_CE))
|
||||
//ANT Test
|
||||
#define ANTTESTALL 0x00 /*Ant A or B will be Testing*/
|
||||
#define ANTTESTA 0x01 /*Ant A will be Testing*/
|
||||
#define ANTTESTB 0x02 /*Ant B will be testing*/
|
||||
|
||||
#define MAX_ANTENNA_DETECTION_CNT 10
|
||||
|
||||
|
||||
typedef struct _ANT_DETECTED_INFO{
|
||||
BOOLEAN bAntDetected;
|
||||
u4Byte dBForAntA;
|
||||
u4Byte dBForAntB;
|
||||
u4Byte dBForAntO;
|
||||
}ANT_DETECTED_INFO, *PANT_DETECTED_INFO;
|
||||
|
||||
|
||||
typedef enum tag_SW_Antenna_Switch_Definition
|
||||
{
|
||||
Antenna_A = 1,
|
||||
Antenna_B = 2,
|
||||
Antenna_MAX = 3,
|
||||
}DM_SWAS_E;
|
||||
|
||||
|
||||
|
||||
//1 [1. Single Tone Method] ===================================================
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
ODM_SingleDualAntennaDefaultSetting(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
BOOLEAN
|
||||
ODM_SingleDualAntennaDetection(
|
||||
IN PVOID pDM_VOID,
|
||||
IN u1Byte mode
|
||||
);
|
||||
|
||||
//1 [2. Scan AP RSSI Method] ==================================================
|
||||
|
||||
#define SwAntDivCheckBeforeLink ODM_SwAntDivCheckBeforeLink
|
||||
|
||||
BOOLEAN
|
||||
ODM_SwAntDivCheckBeforeLink(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
//1 [3. PSD Method] ==========================================================
|
||||
|
||||
|
||||
VOID
|
||||
ODM_SingleDualAntennaDetection_PSD(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
VOID
|
||||
odm_SwAntDetectInit(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
4811
hal/phydm/phydm_antdiv.c
Normal file
4811
hal/phydm/phydm_antdiv.c
Normal file
File diff suppressed because it is too large
Load diff
594
hal/phydm/phydm_antdiv.h
Normal file
594
hal/phydm/phydm_antdiv.h
Normal file
|
|
@ -0,0 +1,594 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __PHYDMANTDIV_H__
|
||||
#define __PHYDMANTDIV_H__
|
||||
|
||||
/*#define ANTDIV_VERSION "2.0" //2014.11.04*/
|
||||
/*#define ANTDIV_VERSION "2.1" //2015.01.13 Dino*/
|
||||
/*#define ANTDIV_VERSION "2.2" 2015.01.16 Dino*/
|
||||
/*#define ANTDIV_VERSION "3.1" 2015.07.29 YuChen, remove 92c 92d 8723a*/
|
||||
/*#define ANTDIV_VERSION "3.2" 2015.08.11 Stanley, disable antenna diversity when BT is enable for 8723B*/
|
||||
#define ANTDIV_VERSION "3.3" /*2015.08.12 Stanley. 8723B does not need to check the antenna is control by BT,
|
||||
because antenna diversity only works when BT is disable or radio off*/
|
||||
|
||||
//1 ============================================================
|
||||
//1 Definition
|
||||
//1 ============================================================
|
||||
|
||||
#define ANTDIV_INIT 0xff
|
||||
#define MAIN_ANT 1 //Ant A or Ant Main
|
||||
#define AUX_ANT 2 //AntB or Ant Aux
|
||||
#define MAX_ANT 3 // 3 for AP using
|
||||
|
||||
#define ANT1_2G 0 // = ANT2_5G
|
||||
#define ANT2_2G 1 // = ANT1_5G
|
||||
/*smart antenna*/
|
||||
#define SUPPORT_RF_PATH_NUM 4
|
||||
#define SUPPORT_BEAM_PATTERN_NUM 4
|
||||
|
||||
|
||||
//Antenna Diversty Control Type
|
||||
#define ODM_AUTO_ANT 0
|
||||
#define ODM_FIX_MAIN_ANT 1
|
||||
#define ODM_FIX_AUX_ANT 2
|
||||
|
||||
#define ODM_ANTDIV_SUPPORT (ODM_RTL8188E|ODM_RTL8192E|ODM_RTL8723B|ODM_RTL8821|ODM_RTL8881A|ODM_RTL8812)
|
||||
#define ODM_N_ANTDIV_SUPPORT (ODM_RTL8188E|ODM_RTL8192E|ODM_RTL8723B)
|
||||
#define ODM_AC_ANTDIV_SUPPORT (ODM_RTL8821|ODM_RTL8881A|ODM_RTL8812)
|
||||
#define ODM_SMART_ANT_SUPPORT (ODM_RTL8188E|ODM_RTL8192E)
|
||||
#define ODM_HL_SMART_ANT_TYPE1_SUPPORT (ODM_RTL8821)
|
||||
|
||||
#define ODM_ANTDIV_2G_SUPPORT_IC (ODM_RTL8188E|ODM_RTL8192E|ODM_RTL8723B|ODM_RTL8881A)
|
||||
#define ODM_ANTDIV_5G_SUPPORT_IC (ODM_RTL8821|ODM_RTL8881A|ODM_RTL8812)
|
||||
|
||||
#define ODM_EVM_ENHANCE_ANTDIV_SUPPORT_IC (ODM_RTL8192E)
|
||||
|
||||
#define ODM_ANTDIV_2G BIT0
|
||||
#define ODM_ANTDIV_5G BIT1
|
||||
|
||||
#define ANTDIV_ON 1
|
||||
#define ANTDIV_OFF 0
|
||||
|
||||
#define FAT_ON 1
|
||||
#define FAT_OFF 0
|
||||
|
||||
#define TX_BY_DESC 1
|
||||
#define REG 0
|
||||
|
||||
#define RSSI_METHOD 0
|
||||
#define EVM_METHOD 1
|
||||
#define CRC32_METHOD 2
|
||||
|
||||
#define INIT_ANTDIV_TIMMER 0
|
||||
#define CANCEL_ANTDIV_TIMMER 1
|
||||
#define RELEASE_ANTDIV_TIMMER 2
|
||||
|
||||
#define CRC32_FAIL 1
|
||||
#define CRC32_OK 0
|
||||
|
||||
#define Evm_RSSI_TH_High 25
|
||||
#define Evm_RSSI_TH_Low 20
|
||||
|
||||
#define NORMAL_STATE_MIAN 1
|
||||
#define NORMAL_STATE_AUX 2
|
||||
#define TRAINING_STATE 3
|
||||
|
||||
#define FORCE_RSSI_DIFF 10
|
||||
|
||||
#define CSI_ON 1
|
||||
#define CSI_OFF 0
|
||||
|
||||
#define DIVON_CSIOFF 1
|
||||
#define DIVOFF_CSION 2
|
||||
|
||||
#define BDC_DIV_TRAIN_STATE 0
|
||||
#define BDC_BFer_TRAIN_STATE 1
|
||||
#define BDC_DECISION_STATE 2
|
||||
#define BDC_BF_HOLD_STATE 3
|
||||
#define BDC_DIV_HOLD_STATE 4
|
||||
|
||||
#define BDC_MODE_1 1
|
||||
#define BDC_MODE_2 2
|
||||
#define BDC_MODE_3 3
|
||||
#define BDC_MODE_4 4
|
||||
#define BDC_MODE_NULL 0xff
|
||||
|
||||
#define SWAW_STEP_PEEK 0
|
||||
#define SWAW_STEP_DETERMINE 1
|
||||
|
||||
#define HL_SMTANT_2WIRE_DATA_LEN 24
|
||||
|
||||
//1 ============================================================
|
||||
//1 structure
|
||||
//1 ============================================================
|
||||
|
||||
|
||||
typedef struct _SW_Antenna_Switch_
|
||||
{
|
||||
u1Byte Double_chk_flag;
|
||||
u1Byte try_flag;
|
||||
s4Byte PreRSSI;
|
||||
u1Byte CurAntenna;
|
||||
u1Byte PreAntenna;
|
||||
u1Byte RSSI_Trying;
|
||||
u1Byte TestMode;
|
||||
u1Byte bTriggerAntennaSwitch;
|
||||
u1Byte SelectAntennaMap;
|
||||
u1Byte RSSI_target;
|
||||
u1Byte reset_idx;
|
||||
u2Byte Single_Ant_Counter;
|
||||
u2Byte Dual_Ant_Counter;
|
||||
u2Byte Aux_FailDetec_Counter;
|
||||
u2Byte Retry_Counter;
|
||||
|
||||
// Before link Antenna Switch check
|
||||
u1Byte SWAS_NoLink_State;
|
||||
u4Byte SWAS_NoLink_BK_Reg860;
|
||||
u4Byte SWAS_NoLink_BK_Reg92c;
|
||||
u4Byte SWAS_NoLink_BK_Reg948;
|
||||
BOOLEAN ANTA_ON; //To indicate Ant A is or not
|
||||
BOOLEAN ANTB_ON; //To indicate Ant B is on or not
|
||||
BOOLEAN Pre_Aux_FailDetec;
|
||||
BOOLEAN RSSI_AntDect_bResult;
|
||||
u1Byte Ant5G;
|
||||
u1Byte Ant2G;
|
||||
|
||||
s4Byte RSSI_sum_A;
|
||||
s4Byte RSSI_sum_B;
|
||||
s4Byte RSSI_cnt_A;
|
||||
s4Byte RSSI_cnt_B;
|
||||
|
||||
u8Byte lastTxOkCnt;
|
||||
u8Byte lastRxOkCnt;
|
||||
u8Byte TXByteCnt_A;
|
||||
u8Byte TXByteCnt_B;
|
||||
u8Byte RXByteCnt_A;
|
||||
u8Byte RXByteCnt_B;
|
||||
u1Byte TrafficLoad;
|
||||
u1Byte Train_time;
|
||||
u1Byte Train_time_flag;
|
||||
RT_TIMER SwAntennaSwitchTimer;
|
||||
#if (RTL8723B_SUPPORT == 1) || (RTL8821A_SUPPORT == 1) || (RTL8188F_SUPPORT == 1)
|
||||
RT_TIMER SwAntennaSwitchTimer_8723B;
|
||||
u4Byte PktCnt_SWAntDivByCtrlFrame;
|
||||
BOOLEAN bSWAntDivByCtrlFrame;
|
||||
#endif
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
|
||||
#if USE_WORKITEM
|
||||
RT_WORK_ITEM SwAntennaSwitchWorkitem;
|
||||
#if (RTL8723B_SUPPORT == 1) || (RTL8821A_SUPPORT == 1)
|
||||
RT_WORK_ITEM SwAntennaSwitchWorkitem_8723B;
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PHYDM_ANTENNA_DIVERSITY
|
||||
//Hybrid Antenna Diversity
|
||||
u4Byte CCK_Ant1_Cnt[ODM_ASSOCIATE_ENTRY_NUM];
|
||||
u4Byte CCK_Ant2_Cnt[ODM_ASSOCIATE_ENTRY_NUM];
|
||||
u4Byte OFDM_Ant1_Cnt[ODM_ASSOCIATE_ENTRY_NUM];
|
||||
u4Byte OFDM_Ant2_Cnt[ODM_ASSOCIATE_ENTRY_NUM];
|
||||
u4Byte RSSI_Ant1_Sum[ODM_ASSOCIATE_ENTRY_NUM];
|
||||
u4Byte RSSI_Ant2_Sum[ODM_ASSOCIATE_ENTRY_NUM];
|
||||
u1Byte TxAnt[ODM_ASSOCIATE_ENTRY_NUM];
|
||||
u1Byte TargetSTA;
|
||||
u1Byte antsel;
|
||||
u1Byte RxIdleAnt;
|
||||
|
||||
#endif
|
||||
|
||||
}SWAT_T, *pSWAT_T;
|
||||
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
|
||||
#if (defined(CONFIG_PHYDM_ANTENNA_DIVERSITY))
|
||||
typedef struct _BF_DIV_COEX_
|
||||
{
|
||||
BOOLEAN w_BFer_Client[ODM_ASSOCIATE_ENTRY_NUM];
|
||||
BOOLEAN w_BFee_Client[ODM_ASSOCIATE_ENTRY_NUM];
|
||||
u4Byte MA_rx_TP[ODM_ASSOCIATE_ENTRY_NUM];
|
||||
u4Byte MA_rx_TP_DIV[ODM_ASSOCIATE_ENTRY_NUM];
|
||||
|
||||
u1Byte BDCcoexType_wBfer;
|
||||
u1Byte num_Txbfee_Client;
|
||||
u1Byte num_Txbfer_Client;
|
||||
u1Byte BDC_Try_counter;
|
||||
u1Byte BDC_Hold_counter;
|
||||
u1Byte BDC_Mode;
|
||||
u1Byte BDC_active_Mode;
|
||||
u1Byte BDC_state;
|
||||
u1Byte BDC_RxIdleUpdate_counter;
|
||||
u1Byte num_Client;
|
||||
u1Byte pre_num_Client;
|
||||
u1Byte num_BfTar;
|
||||
u1Byte num_DivTar;
|
||||
|
||||
BOOLEAN bAll_DivSta_Idle;
|
||||
BOOLEAN bAll_BFSta_Idle;
|
||||
BOOLEAN BDC_Try_flag;
|
||||
BOOLEAN BF_pass;
|
||||
BOOLEAN DIV_pass;
|
||||
}BDC_T,*pBDC_T;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_HL_SMART_ANTENNA_TYPE1
|
||||
typedef struct _SMART_ANTENNA_TRAINNING_ {
|
||||
u4Byte latch_time;
|
||||
BOOLEAN pkt_skip_statistic_en;
|
||||
u4Byte fix_beam_pattern_en;
|
||||
u4Byte fix_training_num_en;
|
||||
u4Byte fix_beam_pattern_codeword;
|
||||
u4Byte update_beam_codeword;
|
||||
u4Byte ant_num; /*number of smart beam antenna*/
|
||||
u4Byte beam_patten_num_each_ant;/*number of beam can be switched in each antenna*/
|
||||
u4Byte data_codeword_bit_num;
|
||||
u4Byte per_beam_training_pkt_num;
|
||||
u1Byte pre_traffic_state;
|
||||
u1Byte decision_holding_period;
|
||||
u4Byte pkt_counter;
|
||||
u4Byte fast_training_beam_num;
|
||||
u4Byte pre_fast_training_beam_num;
|
||||
u4Byte pkt_rssi_pre[SUPPORT_RF_PATH_NUM][SUPPORT_BEAM_PATTERN_NUM];
|
||||
u4Byte pkt_rssi_sum[8][SUPPORT_BEAM_PATTERN_NUM];
|
||||
u4Byte pkt_rssi_cnt[8][SUPPORT_BEAM_PATTERN_NUM];
|
||||
u4Byte rx_idle_beam[SUPPORT_RF_PATH_NUM];
|
||||
u4Byte pre_codeword;
|
||||
BOOLEAN force_update_beam_en;
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
|
||||
RT_WORK_ITEM hl_smart_antenna_workitem;
|
||||
RT_WORK_ITEM hl_smart_antenna_decision_workitem;
|
||||
#endif
|
||||
|
||||
} SAT_T, *pSAT_T;
|
||||
#endif
|
||||
|
||||
typedef struct _FAST_ANTENNA_TRAINNING_
|
||||
{
|
||||
u1Byte Bssid[6];
|
||||
u1Byte antsel_rx_keep_0;
|
||||
u1Byte antsel_rx_keep_1;
|
||||
u1Byte antsel_rx_keep_2;
|
||||
u1Byte antsel_rx_keep_3;
|
||||
u4Byte antSumRSSI[7];
|
||||
u4Byte antRSSIcnt[7];
|
||||
u4Byte antAveRSSI[7];
|
||||
u1Byte FAT_State;
|
||||
u4Byte TrainIdx;
|
||||
u1Byte antsel_a[ODM_ASSOCIATE_ENTRY_NUM];
|
||||
u1Byte antsel_b[ODM_ASSOCIATE_ENTRY_NUM];
|
||||
u1Byte antsel_c[ODM_ASSOCIATE_ENTRY_NUM];
|
||||
u4Byte MainAnt_Sum[ODM_ASSOCIATE_ENTRY_NUM];
|
||||
u4Byte AuxAnt_Sum[ODM_ASSOCIATE_ENTRY_NUM];
|
||||
u4Byte MainAnt_Cnt[ODM_ASSOCIATE_ENTRY_NUM];
|
||||
u4Byte AuxAnt_Cnt[ODM_ASSOCIATE_ENTRY_NUM];
|
||||
u1Byte RxIdleAnt;
|
||||
u1Byte AntDiv_OnOff;
|
||||
BOOLEAN bBecomeLinked;
|
||||
u4Byte MinMaxRSSI;
|
||||
u1Byte idx_AntDiv_counter_2G;
|
||||
u1Byte idx_AntDiv_counter_5G;
|
||||
u1Byte AntDiv_2G_5G;
|
||||
u4Byte CCK_counter_main;
|
||||
u4Byte CCK_counter_aux;
|
||||
u4Byte OFDM_counter_main;
|
||||
u4Byte OFDM_counter_aux;
|
||||
|
||||
#ifdef ODM_EVM_ENHANCE_ANTDIV
|
||||
u4Byte MainAntEVM_Sum[ODM_ASSOCIATE_ENTRY_NUM];
|
||||
u4Byte AuxAntEVM_Sum[ODM_ASSOCIATE_ENTRY_NUM];
|
||||
u4Byte MainAntEVM_Cnt[ODM_ASSOCIATE_ENTRY_NUM];
|
||||
u4Byte AuxAntEVM_Cnt[ODM_ASSOCIATE_ENTRY_NUM];
|
||||
BOOLEAN EVM_method_enable;
|
||||
u1Byte TargetAnt_EVM;
|
||||
u1Byte TargetAnt_CRC32;
|
||||
u1Byte TargetAnt_enhance;
|
||||
u1Byte pre_TargetAnt_enhance;
|
||||
u2Byte Main_MPDU_OK_cnt;
|
||||
u2Byte Aux_MPDU_OK_cnt;
|
||||
|
||||
u4Byte CRC32_Ok_Cnt;
|
||||
u4Byte CRC32_Fail_Cnt;
|
||||
u4Byte MainCRC32_Ok_Cnt;
|
||||
u4Byte AuxCRC32_Ok_Cnt;
|
||||
u4Byte MainCRC32_Fail_Cnt;
|
||||
u4Byte AuxCRC32_Fail_Cnt;
|
||||
#endif
|
||||
#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE))
|
||||
u4Byte CCK_CtrlFrame_Cnt_main;
|
||||
u4Byte CCK_CtrlFrame_Cnt_aux;
|
||||
u4Byte OFDM_CtrlFrame_Cnt_main;
|
||||
u4Byte OFDM_CtrlFrame_Cnt_aux;
|
||||
u4Byte MainAnt_CtrlFrame_Sum;
|
||||
u4Byte AuxAnt_CtrlFrame_Sum;
|
||||
u4Byte MainAnt_CtrlFrame_Cnt;
|
||||
u4Byte AuxAnt_CtrlFrame_Cnt;
|
||||
#endif
|
||||
BOOLEAN fix_ant_bfee;
|
||||
BOOLEAN enable_ctrl_frame_antdiv;
|
||||
BOOLEAN use_ctrl_frame_antdiv;
|
||||
u1Byte hw_antsw_occur;
|
||||
}FAT_T,*pFAT_T;
|
||||
|
||||
|
||||
//1 ============================================================
|
||||
//1 enumeration
|
||||
//1 ============================================================
|
||||
|
||||
|
||||
|
||||
typedef enum _FAT_STATE /*Fast antenna training*/
|
||||
{
|
||||
FAT_BEFORE_LINK_STATE = 0,
|
||||
FAT_PREPARE_STATE = 1,
|
||||
FAT_TRAINING_STATE = 2,
|
||||
FAT_DECISION_STATE = 3
|
||||
}FAT_STATE_E, *PFAT_STATE_E;
|
||||
|
||||
typedef enum _ANT_DIV_TYPE
|
||||
{
|
||||
NO_ANTDIV = 0xFF,
|
||||
CG_TRX_HW_ANTDIV = 0x01,
|
||||
CGCS_RX_HW_ANTDIV = 0x02,
|
||||
FIXED_HW_ANTDIV = 0x03,
|
||||
CG_TRX_SMART_ANTDIV = 0x04,
|
||||
CGCS_RX_SW_ANTDIV = 0x05,
|
||||
S0S1_SW_ANTDIV = 0x06, /*8723B intrnal switch S0 S1*/
|
||||
HL_SW_SMART_ANT_TYPE1 = 0x10 /*Hong-Lin Smart antenna use for 8821AE which is a 2 Ant. entitys, and each Ant. is equipped with 4 antenna patterns*/
|
||||
}ANT_DIV_TYPE_E, *PANT_DIV_TYPE_E;
|
||||
|
||||
|
||||
//1 ============================================================
|
||||
//1 function prototype
|
||||
//1 ============================================================
|
||||
|
||||
|
||||
VOID
|
||||
ODM_StopAntennaSwitchDm(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
VOID
|
||||
ODM_SetAntConfig(
|
||||
IN PVOID pDM_VOID,
|
||||
IN u1Byte antSetting // 0=A, 1=B, 2=C, ....
|
||||
);
|
||||
|
||||
|
||||
#define SwAntDivRestAfterLink ODM_SwAntDivRestAfterLink
|
||||
VOID ODM_SwAntDivRestAfterLink(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
#if (defined(CONFIG_PHYDM_ANTENNA_DIVERSITY))
|
||||
|
||||
VOID
|
||||
ODM_UpdateRxIdleAnt(
|
||||
IN PVOID pDM_VOID,
|
||||
IN u1Byte Ant
|
||||
);
|
||||
|
||||
#ifdef CONFIG_S0S1_SW_ANTENNA_DIVERSITY
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
|
||||
VOID
|
||||
ODM_SW_AntDiv_Callback(
|
||||
IN PRT_TIMER pTimer
|
||||
);
|
||||
|
||||
VOID
|
||||
ODM_SW_AntDiv_WorkitemCallback(
|
||||
IN PVOID pContext
|
||||
);
|
||||
|
||||
|
||||
#elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
|
||||
|
||||
VOID
|
||||
ODM_SW_AntDiv_WorkitemCallback(
|
||||
IN PVOID pContext
|
||||
);
|
||||
|
||||
VOID
|
||||
ODM_SW_AntDiv_Callback(
|
||||
void *FunctionContext
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
VOID
|
||||
odm_S0S1_SwAntDivByCtrlFrame(
|
||||
IN PVOID pDM_VOID,
|
||||
IN u1Byte Step
|
||||
);
|
||||
|
||||
VOID
|
||||
odm_AntselStatisticsOfCtrlFrame(
|
||||
IN PVOID pDM_VOID,
|
||||
IN u1Byte antsel_tr_mux,
|
||||
IN u4Byte RxPWDBAll
|
||||
);
|
||||
|
||||
VOID
|
||||
odm_S0S1_SwAntDivByCtrlFrame_ProcessRSSI(
|
||||
IN PVOID pDM_VOID,
|
||||
IN PVOID p_phy_info_void,
|
||||
IN PVOID p_pkt_info_void
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef ODM_EVM_ENHANCE_ANTDIV
|
||||
VOID
|
||||
odm_EVM_FastAntTrainingCallback(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
#endif
|
||||
|
||||
VOID
|
||||
odm_HW_AntDiv(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
#if( defined(CONFIG_5G_CG_SMART_ANT_DIVERSITY) ) ||( defined(CONFIG_2G_CG_SMART_ANT_DIVERSITY) )
|
||||
VOID
|
||||
odm_FastAntTraining(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
odm_FastAntTrainingCallback(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
odm_FastAntTrainingWorkItemCallback(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef CONFIG_HL_SMART_ANTENNA_TYPE1
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
|
||||
VOID
|
||||
phydm_beam_switch_workitem_callback(
|
||||
IN PVOID pContext
|
||||
);
|
||||
|
||||
VOID
|
||||
phydm_beam_decision_workitem_callback(
|
||||
IN PVOID pContext
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
VOID
|
||||
phydm_update_beam_pattern(
|
||||
IN PVOID pDM_VOID,
|
||||
IN u4Byte codeword,
|
||||
IN u4Byte codeword_length
|
||||
);
|
||||
|
||||
void
|
||||
phydm_set_all_ant_same_beam_num(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
phydm_hl_smart_ant_cmd(
|
||||
IN PVOID pDM_VOID,
|
||||
IN u4Byte *const dm_value,
|
||||
IN u4Byte *_used,
|
||||
OUT char *output,
|
||||
IN u4Byte *_out_len
|
||||
);
|
||||
|
||||
#endif/*#ifdef CONFIG_HL_SMART_ANTENNA_TYPE1*/
|
||||
|
||||
VOID
|
||||
ODM_AntDivInit(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
ODM_AntDiv(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
odm_AntselStatistics(
|
||||
IN PVOID pDM_VOID,
|
||||
IN u1Byte antsel_tr_mux,
|
||||
IN u4Byte MacId,
|
||||
IN u4Byte utility,
|
||||
IN u1Byte method
|
||||
);
|
||||
|
||||
VOID
|
||||
ODM_Process_RSSIForAntDiv(
|
||||
IN OUT PVOID pDM_VOID,
|
||||
IN PVOID p_phy_info_void,
|
||||
IN PVOID p_pkt_info_void
|
||||
);
|
||||
|
||||
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE))
|
||||
VOID
|
||||
ODM_SetTxAntByTxInfo(
|
||||
IN PVOID pDM_VOID,
|
||||
IN pu1Byte pDesc,
|
||||
IN u1Byte macId
|
||||
);
|
||||
|
||||
#elif(DM_ODM_SUPPORT_TYPE == ODM_AP)
|
||||
|
||||
VOID
|
||||
ODM_SetTxAntByTxInfo(
|
||||
struct rtl8192cd_priv *priv,
|
||||
struct tx_desc *pdesc,
|
||||
unsigned short aid
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
VOID
|
||||
ODM_AntDiv_Config(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
|
||||
VOID
|
||||
ODM_UpdateRxIdleAnt_8723B(
|
||||
IN PVOID pDM_VOID,
|
||||
IN u1Byte Ant,
|
||||
IN u4Byte DefaultAnt,
|
||||
IN u4Byte OptionalAnt
|
||||
);
|
||||
|
||||
VOID
|
||||
ODM_AntDivTimers(
|
||||
IN PVOID pDM_VOID,
|
||||
IN u1Byte state
|
||||
);
|
||||
|
||||
#endif /*#if (defined(CONFIG_PHYDM_ANTENNA_DIVERSITY))*/
|
||||
|
||||
VOID
|
||||
ODM_AntDivReset(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
odm_AntennaDiversityInit(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
odm_AntennaDiversity(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
|
||||
#endif //#ifndef __ODMANTDIV_H__
|
||||
1939
hal/phydm/phydm_beamforming.c
Normal file
1939
hal/phydm/phydm_beamforming.c
Normal file
File diff suppressed because it is too large
Load diff
365
hal/phydm/phydm_beamforming.h
Normal file
365
hal/phydm/phydm_beamforming.h
Normal file
|
|
@ -0,0 +1,365 @@
|
|||
#ifndef __INC_BEAMFORMING_H
|
||||
#define __INC_BEAMFORMING_H
|
||||
|
||||
#ifndef BEAMFORMING_SUPPORT
|
||||
#define BEAMFORMING_SUPPORT 0
|
||||
#endif
|
||||
|
||||
/*Beamforming Related*/
|
||||
#include "txbf/halcomtxbf.h"
|
||||
#include "txbf/haltxbfjaguar.h"
|
||||
#include "txbf/haltxbf8192e.h"
|
||||
#include "txbf/haltxbf8814a.h"
|
||||
#include "txbf/haltxbf8821b.h"
|
||||
#include "txbf/haltxbf8822b.h"
|
||||
#include "txbf/haltxbfinterface.h"
|
||||
|
||||
#if (BEAMFORMING_SUPPORT == 1)
|
||||
|
||||
#define MAX_BEAMFORMEE_SU 2
|
||||
#define MAX_BEAMFORMER_SU 2
|
||||
#if (RTL8822B_SUPPORT == 1)
|
||||
#define MAX_BEAMFORMEE_MU 6
|
||||
#define MAX_BEAMFORMER_MU 1
|
||||
#else
|
||||
#define MAX_BEAMFORMEE_MU 0
|
||||
#define MAX_BEAMFORMER_MU 0
|
||||
#endif
|
||||
|
||||
#define BEAMFORMEE_ENTRY_NUM (MAX_BEAMFORMEE_SU + MAX_BEAMFORMEE_MU)
|
||||
#define BEAMFORMER_ENTRY_NUM (MAX_BEAMFORMER_SU + MAX_BEAMFORMER_MU)
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_CE)
|
||||
/*for different naming between WIN and CE*/
|
||||
#define BEACON_QUEUE BCN_QUEUE_INX
|
||||
#define NORMAL_QUEUE MGT_QUEUE_INX
|
||||
#define RT_DISABLE_FUNC RTW_DISABLE_FUNC
|
||||
#define RT_ENABLE_FUNC RTW_ENABLE_FUNC
|
||||
#endif
|
||||
|
||||
typedef enum _BEAMFORMING_ENTRY_STATE {
|
||||
BEAMFORMING_ENTRY_STATE_UNINITIALIZE,
|
||||
BEAMFORMING_ENTRY_STATE_INITIALIZEING,
|
||||
BEAMFORMING_ENTRY_STATE_INITIALIZED,
|
||||
BEAMFORMING_ENTRY_STATE_PROGRESSING,
|
||||
BEAMFORMING_ENTRY_STATE_PROGRESSED
|
||||
} BEAMFORMING_ENTRY_STATE, *PBEAMFORMING_ENTRY_STATE;
|
||||
|
||||
|
||||
typedef enum _BEAMFORMING_NOTIFY_STATE {
|
||||
BEAMFORMING_NOTIFY_NONE,
|
||||
BEAMFORMING_NOTIFY_ADD,
|
||||
BEAMFORMING_NOTIFY_DELETE,
|
||||
BEAMFORMEE_NOTIFY_ADD_SU,
|
||||
BEAMFORMEE_NOTIFY_DELETE_SU,
|
||||
BEAMFORMEE_NOTIFY_ADD_MU,
|
||||
BEAMFORMEE_NOTIFY_DELETE_MU,
|
||||
BEAMFORMING_NOTIFY_RESET
|
||||
} BEAMFORMING_NOTIFY_STATE, *PBEAMFORMING_NOTIFY_STATE;
|
||||
|
||||
typedef enum _BEAMFORMING_CAP {
|
||||
BEAMFORMING_CAP_NONE = 0x0,
|
||||
BEAMFORMER_CAP_HT_EXPLICIT = BIT1,
|
||||
BEAMFORMEE_CAP_HT_EXPLICIT = BIT2,
|
||||
BEAMFORMER_CAP_VHT_SU = BIT5, /* Self has er Cap, because Reg er & peer ee */
|
||||
BEAMFORMEE_CAP_VHT_SU = BIT6, /* Self has ee Cap, because Reg ee & peer er */
|
||||
BEAMFORMER_CAP_VHT_MU = BIT7, /* Self has er Cap, because Reg er & peer ee */
|
||||
BEAMFORMEE_CAP_VHT_MU = BIT8, /* Self has ee Cap, because Reg ee & peer er */
|
||||
BEAMFORMER_CAP = BIT9,
|
||||
BEAMFORMEE_CAP = BIT10,
|
||||
}BEAMFORMING_CAP, *PBEAMFORMING_CAP;
|
||||
|
||||
|
||||
typedef enum _SOUNDING_MODE {
|
||||
SOUNDING_SW_VHT_TIMER = 0x0,
|
||||
SOUNDING_SW_HT_TIMER = 0x1,
|
||||
SOUNDING_STOP_All_TIMER = 0x2,
|
||||
SOUNDING_HW_VHT_TIMER = 0x3,
|
||||
SOUNDING_HW_HT_TIMER = 0x4,
|
||||
SOUNDING_STOP_OID_TIMER = 0x5,
|
||||
SOUNDING_AUTO_VHT_TIMER = 0x6,
|
||||
SOUNDING_AUTO_HT_TIMER = 0x7,
|
||||
SOUNDING_FW_VHT_TIMER = 0x8,
|
||||
SOUNDING_FW_HT_TIMER = 0x9,
|
||||
}SOUNDING_MODE, *PSOUNDING_MODE;
|
||||
|
||||
typedef struct _RT_BEAMFORM_STAINFO {
|
||||
pu1Byte RA;
|
||||
u2Byte AID;
|
||||
u2Byte MacID;
|
||||
u1Byte MyMacAddr[6];
|
||||
WIRELESS_MODE WirelessMode;
|
||||
CHANNEL_WIDTH BW;
|
||||
BEAMFORMING_CAP BeamformCap;
|
||||
u1Byte HtBeamformCap;
|
||||
u2Byte VhtBeamformCap;
|
||||
u1Byte CurBeamform;
|
||||
u2Byte CurBeamformVHT;
|
||||
} RT_BEAMFORM_STAINFO, *PRT_BEAMFORM_STAINFO;
|
||||
|
||||
|
||||
typedef struct _RT_BEAMFORMEE_ENTRY {
|
||||
BOOLEAN bUsed;
|
||||
BOOLEAN bTxBF;
|
||||
BOOLEAN bSound;
|
||||
u2Byte AID; /*Used to construct AID field of NDPA packet.*/
|
||||
u2Byte MacId; /*Used to Set Reg42C in IBSS mode. */
|
||||
u2Byte P_AID; /*Used to fill Reg42C & Reg714 to compare with P_AID of Tx DESC. */
|
||||
u2Byte G_ID; /*Used to fill Tx DESC*/
|
||||
u1Byte MyMacAddr[6];
|
||||
u1Byte MacAddr[6]; /*Used to fill Reg6E4 to fill Mac address of CSI report frame.*/
|
||||
CHANNEL_WIDTH SoundBW; /*Sounding BandWidth*/
|
||||
u2Byte SoundPeriod;
|
||||
BEAMFORMING_CAP BeamformEntryCap;
|
||||
BEAMFORMING_ENTRY_STATE BeamformEntryState;
|
||||
BOOLEAN bBeamformingInProgress;
|
||||
/*u1Byte LogSeq; // Move to _RT_BEAMFORMER_ENTRY*/
|
||||
/*u2Byte LogRetryCnt:3; // 0~4 // Move to _RT_BEAMFORMER_ENTRY*/
|
||||
/*u2Byte LogSuccessCnt:2; // 0~2 // Move to _RT_BEAMFORMER_ENTRY*/
|
||||
u2Byte LogStatusFailCnt:5; // 0~21
|
||||
u2Byte DefaultCSICnt:5; // 0~21
|
||||
u1Byte CSIMatrix[327];
|
||||
u2Byte CSIMatrixLen;
|
||||
u1Byte NumofSoundingDim;
|
||||
u1Byte CompSteeringNumofBFer;
|
||||
u1Byte su_reg_index;
|
||||
/*For MU-MIMO*/
|
||||
BOOLEAN is_mu_sta;
|
||||
u1Byte mu_reg_index;
|
||||
u1Byte gid_valid[8];
|
||||
u1Byte user_position[16];
|
||||
} RT_BEAMFORMEE_ENTRY, *PRT_BEAMFORMEE_ENTRY;
|
||||
|
||||
typedef struct _RT_BEAMFORMER_ENTRY {
|
||||
BOOLEAN bUsed;
|
||||
/*P_AID of BFer entry is probably not used*/
|
||||
u2Byte P_AID; /*Used to fill Reg42C & Reg714 to compare with P_AID of Tx DESC. */
|
||||
u2Byte G_ID;
|
||||
u1Byte MyMacAddr[6];
|
||||
u1Byte MacAddr[6];
|
||||
BEAMFORMING_CAP BeamformEntryCap;
|
||||
u1Byte NumofSoundingDim;
|
||||
u1Byte ClockResetTimes; /*Modified by Jeffery @2015-04-10*/
|
||||
u1Byte PreLogSeq; /*Modified by Jeffery @2015-03-30*/
|
||||
u1Byte LogSeq; /*Modified by Jeffery @2014-10-29*/
|
||||
u2Byte LogRetryCnt:3; /*Modified by Jeffery @2014-10-29*/
|
||||
u2Byte LogSuccess:2; /*Modified by Jeffery @2014-10-29*/
|
||||
u1Byte su_reg_index;
|
||||
/*For MU-MIMO*/
|
||||
BOOLEAN is_mu_ap;
|
||||
u1Byte gid_valid[8];
|
||||
u1Byte user_position[16];
|
||||
u2Byte AID;
|
||||
} RT_BEAMFORMER_ENTRY, *PRT_BEAMFORMER_ENTRY;
|
||||
|
||||
typedef struct _RT_SOUNDING_INFO {
|
||||
u1Byte SoundIdx;
|
||||
CHANNEL_WIDTH SoundBW;
|
||||
SOUNDING_MODE SoundMode;
|
||||
u2Byte SoundPeriod;
|
||||
} RT_SOUNDING_INFO, *PRT_SOUNDING_INFO;
|
||||
|
||||
|
||||
|
||||
typedef struct _RT_BEAMFORMING_OID_INFO {
|
||||
u1Byte SoundOidIdx;
|
||||
CHANNEL_WIDTH SoundOidBW;
|
||||
SOUNDING_MODE SoundOidMode;
|
||||
u2Byte SoundOidPeriod;
|
||||
} RT_BEAMFORMING_OID_INFO, *PRT_BEAMFORMING_OID_INFO;
|
||||
|
||||
|
||||
typedef struct _RT_BEAMFORMING_INFO {
|
||||
BEAMFORMING_CAP BeamformCap;
|
||||
RT_BEAMFORMEE_ENTRY BeamformeeEntry[BEAMFORMEE_ENTRY_NUM];
|
||||
RT_BEAMFORMER_ENTRY BeamformerEntry[BEAMFORMER_ENTRY_NUM];
|
||||
RT_BEAMFORM_STAINFO BeamformSTAinfo;
|
||||
u1Byte BeamformeeCurIdx;
|
||||
RT_TIMER BeamformingTimer;
|
||||
RT_TIMER mu_timer;
|
||||
RT_SOUNDING_INFO SoundingInfo;
|
||||
RT_BEAMFORMING_OID_INFO BeamformingOidInfo;
|
||||
HAL_TXBF_INFO TxbfInfo;
|
||||
u1Byte SoundingSequence;
|
||||
u1Byte beamformee_su_cnt;
|
||||
u1Byte beamformer_su_cnt;
|
||||
u4Byte beamformee_su_reg_maping;
|
||||
u4Byte beamformer_su_reg_maping;
|
||||
/*For MU-MINO*/
|
||||
u1Byte beamformee_mu_cnt;
|
||||
u1Byte beamformer_mu_cnt;
|
||||
u4Byte beamformee_mu_reg_maping;
|
||||
u1Byte mu_ap_index;
|
||||
BOOLEAN is_mu_sounding;
|
||||
u1Byte FirstMUBFeeIndex;
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
|
||||
PADAPTER SourceAdapter;
|
||||
#endif
|
||||
/* Control register */
|
||||
u4Byte RegMUTxCtrl; /* For USB/SDIO interfaces aync I/O */
|
||||
} RT_BEAMFORMING_INFO, *PRT_BEAMFORMING_INFO;
|
||||
|
||||
|
||||
typedef struct _RT_NDPA_STA_INFO {
|
||||
u2Byte AID:12;
|
||||
u2Byte FeedbackType:1;
|
||||
u2Byte NcIndex:3;
|
||||
} RT_NDPA_STA_INFO, *PRT_NDPA_STA_INFO;
|
||||
|
||||
|
||||
BEAMFORMING_CAP
|
||||
phydm_Beamforming_GetEntryBeamCapByMacId(
|
||||
IN PVOID pDM_VOID,
|
||||
IN u1Byte MacId
|
||||
);
|
||||
|
||||
PRT_BEAMFORMEE_ENTRY
|
||||
phydm_Beamforming_GetBFeeEntryByAddr(
|
||||
IN PVOID pDM_VOID,
|
||||
IN pu1Byte RA,
|
||||
OUT pu1Byte Idx
|
||||
);
|
||||
|
||||
PRT_BEAMFORMER_ENTRY
|
||||
phydm_Beamforming_GetBFerEntryByAddr(
|
||||
IN PVOID pDM_VOID,
|
||||
IN pu1Byte TA,
|
||||
OUT pu1Byte Idx
|
||||
);
|
||||
|
||||
u1Byte
|
||||
Beamforming_GetHTNDPTxRate(
|
||||
IN PVOID pDM_VOID,
|
||||
u1Byte CompSteeringNumofBFer
|
||||
);
|
||||
|
||||
u1Byte
|
||||
Beamforming_GetVHTNDPTxRate(
|
||||
IN PVOID pDM_VOID,
|
||||
u1Byte CompSteeringNumofBFer
|
||||
);
|
||||
|
||||
VOID
|
||||
phydm_Beamforming_Notify(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
|
||||
VOID
|
||||
Beamforming_Enter(
|
||||
IN PVOID pDM_VOID,
|
||||
IN u2Byte staIdx
|
||||
);
|
||||
|
||||
VOID
|
||||
Beamforming_Leave(
|
||||
IN PVOID pDM_VOID,
|
||||
pu1Byte RA
|
||||
);
|
||||
|
||||
BOOLEAN
|
||||
BeamformingStart_FW(
|
||||
IN PVOID pDM_VOID,
|
||||
u1Byte Idx
|
||||
);
|
||||
|
||||
VOID
|
||||
Beamforming_CheckSoundingSuccess(
|
||||
IN PVOID pDM_VOID,
|
||||
BOOLEAN Status
|
||||
);
|
||||
|
||||
VOID
|
||||
phydm_Beamforming_End_SW(
|
||||
IN PVOID pDM_VOID,
|
||||
BOOLEAN Status
|
||||
);
|
||||
|
||||
VOID
|
||||
Beamforming_TimerCallback(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
phydm_Beamforming_Init(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
|
||||
|
||||
BEAMFORMING_CAP
|
||||
phydm_Beamforming_GetBeamCap(
|
||||
IN PVOID pDM_VOID,
|
||||
IN PRT_BEAMFORMING_INFO pBeamInfo
|
||||
);
|
||||
|
||||
|
||||
BOOLEAN
|
||||
BeamformingControl_V1(
|
||||
IN PVOID pDM_VOID,
|
||||
pu1Byte RA,
|
||||
u1Byte AID,
|
||||
u1Byte Mode,
|
||||
CHANNEL_WIDTH BW,
|
||||
u1Byte Rate
|
||||
);
|
||||
|
||||
|
||||
BOOLEAN
|
||||
phydm_BeamformingControl_V2(
|
||||
IN PVOID pDM_VOID,
|
||||
u1Byte Idx,
|
||||
u1Byte Mode,
|
||||
CHANNEL_WIDTH BW,
|
||||
u2Byte Period
|
||||
);
|
||||
|
||||
VOID
|
||||
phydm_Beamforming_Watchdog(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
Beamforming_SWTimerCallback(
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
|
||||
PRT_TIMER pTimer
|
||||
#elif(DM_ODM_SUPPORT_TYPE == ODM_CE)
|
||||
void *FunctionContext
|
||||
#endif
|
||||
);
|
||||
|
||||
BOOLEAN
|
||||
Beamforming_SendHTNDPAPacket(
|
||||
IN PVOID pDM_VOID,
|
||||
IN pu1Byte RA,
|
||||
IN CHANNEL_WIDTH BW,
|
||||
IN u1Byte QIdx
|
||||
);
|
||||
|
||||
|
||||
BOOLEAN
|
||||
Beamforming_SendVHTNDPAPacket(
|
||||
IN PVOID pDM_VOID,
|
||||
IN pu1Byte RA,
|
||||
IN u2Byte AID,
|
||||
IN CHANNEL_WIDTH BW,
|
||||
IN u1Byte QIdx
|
||||
);
|
||||
|
||||
#else
|
||||
#define Beamforming_GidPAid(Adapter, pTcb)
|
||||
#define Beamforming_Enter(pDM_Odm, staIdx)
|
||||
#define Beamforming_Leave(pDM_Odm, RA)
|
||||
#define Beamforming_End_FW(pDMOdm)
|
||||
#define BeamformingControl_V1(pDM_Odm, RA, AID, Mode, BW, Rate) TRUE
|
||||
#define BeamformingControl_V2(pDM_Odm, Idx, Mode, BW, Period) TRUE
|
||||
#define phydm_Beamforming_End_SW(pDM_Odm, _Status)
|
||||
#define Beamforming_TimerCallback(pDM_Odm)
|
||||
#define phydm_Beamforming_Init(pDM_Odm)
|
||||
#define phydm_BeamformingControl_V2(pDM_Odm, _Idx, _Mode, _BW, _Period) FALSE
|
||||
#define Beamforming_Watchdog(pDM_Odm)
|
||||
#define phydm_Beamforming_Watchdog(pDM_Odm)
|
||||
|
||||
|
||||
#endif
|
||||
#endif
|
||||
347
hal/phydm/phydm_cfotracking.c
Normal file
347
hal/phydm/phydm_cfotracking.c
Normal file
|
|
@ -0,0 +1,347 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
#include "mp_precomp.h"
|
||||
#include "phydm_precomp.h"
|
||||
|
||||
VOID
|
||||
odm_SetCrystalCap(
|
||||
IN PVOID pDM_VOID,
|
||||
IN u1Byte CrystalCap
|
||||
)
|
||||
{
|
||||
#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE))
|
||||
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
|
||||
PCFO_TRACKING pCfoTrack = (PCFO_TRACKING)PhyDM_Get_Structure( pDM_Odm, PHYDM_CFOTRACK);
|
||||
BOOLEAN bEEPROMCheck;
|
||||
#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE))
|
||||
PADAPTER Adapter = pDM_Odm->Adapter;
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
|
||||
|
||||
bEEPROMCheck = (pHalData->EEPROMVersion >= 0x01)?TRUE:FALSE;
|
||||
#else
|
||||
bEEPROMCheck = TRUE;
|
||||
#endif
|
||||
|
||||
if(pCfoTrack->CrystalCap == CrystalCap)
|
||||
return;
|
||||
|
||||
pCfoTrack->CrystalCap = CrystalCap;
|
||||
|
||||
if (pDM_Odm->SupportICType & (ODM_RTL8188E | ODM_RTL8188F)) {
|
||||
/* write 0x24[22:17] = 0x24[16:11] = CrystalCap */
|
||||
CrystalCap = CrystalCap & 0x3F;
|
||||
ODM_SetBBReg(pDM_Odm, REG_AFE_XTAL_CTRL, 0x007ff800, (CrystalCap|(CrystalCap << 6)));
|
||||
} else if (pDM_Odm->SupportICType & ODM_RTL8812) {
|
||||
/* write 0x2C[30:25] = 0x2C[24:19] = CrystalCap */
|
||||
CrystalCap = CrystalCap & 0x3F;
|
||||
ODM_SetBBReg(pDM_Odm, REG_MAC_PHY_CTRL, 0x7FF80000, (CrystalCap|(CrystalCap << 6)));
|
||||
} else if (((pDM_Odm->SupportICType & ODM_RTL8723A) && bEEPROMCheck) ||
|
||||
(pDM_Odm->SupportICType & (ODM_RTL8703B|ODM_RTL8723B|ODM_RTL8192E|ODM_RTL8821))) {
|
||||
/* 0x2C[23:18] = 0x2C[17:12] = CrystalCap */
|
||||
CrystalCap = CrystalCap & 0x3F;
|
||||
ODM_SetBBReg(pDM_Odm, REG_MAC_PHY_CTRL, 0x00FFF000, (CrystalCap|(CrystalCap << 6)));
|
||||
} else if (pDM_Odm->SupportICType & ODM_RTL8821B) {
|
||||
/* write 0x28[6:1] = 0x24[30:25] = CrystalCap */
|
||||
CrystalCap = CrystalCap & 0x3F;
|
||||
ODM_SetBBReg(pDM_Odm, REG_AFE_XTAL_CTRL, 0x7E000000, CrystalCap);
|
||||
ODM_SetBBReg(pDM_Odm, REG_AFE_PLL_CTRL, 0x7E, CrystalCap);
|
||||
} else if (pDM_Odm->SupportICType & ODM_RTL8814A) {
|
||||
/* write 0x2C[26:21] = 0x2C[20:15] = CrystalCap */
|
||||
CrystalCap = CrystalCap & 0x3F;
|
||||
ODM_SetBBReg(pDM_Odm, REG_MAC_PHY_CTRL, 0x07FF8000, (CrystalCap|(CrystalCap << 6)));
|
||||
} else if (pDM_Odm->SupportICType & ODM_RTL8822B) {
|
||||
/* write 0x24[30:25] = 0x28[6:1] = CrystalCap */
|
||||
CrystalCap = CrystalCap & 0x3F;
|
||||
ODM_SetBBReg(pDM_Odm, REG_AFE_XTAL_CTRL, 0x7e000000, CrystalCap);
|
||||
ODM_SetBBReg(pDM_Odm, REG_AFE_PLL_CTRL, 0x7e, CrystalCap);
|
||||
} else {
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_CFO_TRACKING, ODM_DBG_LOUD, ("odm_SetCrystalCap(): Use default setting.\n"));
|
||||
ODM_SetBBReg(pDM_Odm, REG_MAC_PHY_CTRL, 0xFFF000, (CrystalCap|(CrystalCap << 6)));
|
||||
}
|
||||
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_CFO_TRACKING, ODM_DBG_LOUD, ("odm_SetCrystalCap(): CrystalCap = 0x%x\n", CrystalCap));
|
||||
#endif
|
||||
}
|
||||
|
||||
u1Byte
|
||||
odm_GetDefaultCrytaltalCap(
|
||||
IN PVOID pDM_VOID
|
||||
)
|
||||
{
|
||||
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
|
||||
u1Byte CrystalCap = 0x20;
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE))
|
||||
PADAPTER Adapter = pDM_Odm->Adapter;
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
|
||||
|
||||
CrystalCap = pHalData->CrystalCap;
|
||||
#else
|
||||
prtl8192cd_priv priv = pDM_Odm->priv;
|
||||
|
||||
if(priv->pmib->dot11RFEntry.xcap > 0)
|
||||
CrystalCap = priv->pmib->dot11RFEntry.xcap;
|
||||
#endif
|
||||
|
||||
CrystalCap = CrystalCap & 0x3f;
|
||||
|
||||
return CrystalCap;
|
||||
}
|
||||
|
||||
VOID
|
||||
odm_SetATCStatus(
|
||||
IN PVOID pDM_VOID,
|
||||
IN BOOLEAN ATCStatus
|
||||
)
|
||||
{
|
||||
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
|
||||
PCFO_TRACKING pCfoTrack = (PCFO_TRACKING)PhyDM_Get_Structure( pDM_Odm, PHYDM_CFOTRACK);
|
||||
|
||||
if(pCfoTrack->bATCStatus == ATCStatus)
|
||||
return;
|
||||
|
||||
ODM_SetBBReg(pDM_Odm, ODM_REG(BB_ATC,pDM_Odm), ODM_BIT(BB_ATC,pDM_Odm), ATCStatus);
|
||||
pCfoTrack->bATCStatus = ATCStatus;
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
odm_GetATCStatus(
|
||||
IN PVOID pDM_VOID
|
||||
)
|
||||
{
|
||||
BOOLEAN ATCStatus;
|
||||
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
|
||||
|
||||
ATCStatus = (BOOLEAN)ODM_GetBBReg(pDM_Odm, ODM_REG(BB_ATC,pDM_Odm), ODM_BIT(BB_ATC,pDM_Odm));
|
||||
return ATCStatus;
|
||||
}
|
||||
|
||||
VOID
|
||||
ODM_CfoTrackingReset(
|
||||
IN PVOID pDM_VOID
|
||||
)
|
||||
{
|
||||
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
|
||||
PCFO_TRACKING pCfoTrack = (PCFO_TRACKING)PhyDM_Get_Structure( pDM_Odm, PHYDM_CFOTRACK);
|
||||
|
||||
pCfoTrack->DefXCap = odm_GetDefaultCrytaltalCap(pDM_Odm);
|
||||
pCfoTrack->bAdjust = TRUE;
|
||||
|
||||
if(pCfoTrack->CrystalCap > pCfoTrack->DefXCap)
|
||||
{
|
||||
odm_SetCrystalCap(pDM_Odm, pCfoTrack->CrystalCap - 1);
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_CFO_TRACKING, ODM_DBG_LOUD,
|
||||
("ODM_CfoTrackingReset(): approch default value (0x%x)\n", pCfoTrack->CrystalCap));
|
||||
} else if (pCfoTrack->CrystalCap < pCfoTrack->DefXCap)
|
||||
{
|
||||
odm_SetCrystalCap(pDM_Odm, pCfoTrack->CrystalCap + 1);
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_CFO_TRACKING, ODM_DBG_LOUD,
|
||||
("ODM_CfoTrackingReset(): approch default value (0x%x)\n", pCfoTrack->CrystalCap));
|
||||
}
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE))
|
||||
odm_SetATCStatus(pDM_Odm, TRUE);
|
||||
#endif
|
||||
}
|
||||
|
||||
VOID
|
||||
ODM_CfoTrackingInit(
|
||||
IN PVOID pDM_VOID
|
||||
)
|
||||
{
|
||||
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
|
||||
PCFO_TRACKING pCfoTrack = (PCFO_TRACKING)PhyDM_Get_Structure( pDM_Odm, PHYDM_CFOTRACK);
|
||||
|
||||
pCfoTrack->DefXCap = pCfoTrack->CrystalCap = odm_GetDefaultCrytaltalCap(pDM_Odm);
|
||||
pCfoTrack->bATCStatus = odm_GetATCStatus(pDM_Odm);
|
||||
pCfoTrack->bAdjust = TRUE;
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_CFO_TRACKING, ODM_DBG_LOUD, ("ODM_CfoTracking_init()=========> \n"));
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_CFO_TRACKING, ODM_DBG_LOUD, ("ODM_CfoTracking_init(): bATCStatus = %d, CrystalCap = 0x%x \n",pCfoTrack->bATCStatus, pCfoTrack->DefXCap));
|
||||
}
|
||||
|
||||
VOID
|
||||
ODM_CfoTracking(
|
||||
IN PVOID pDM_VOID
|
||||
)
|
||||
{
|
||||
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
|
||||
PCFO_TRACKING pCfoTrack = (PCFO_TRACKING)PhyDM_Get_Structure( pDM_Odm, PHYDM_CFOTRACK);
|
||||
int CFO_kHz_A, CFO_kHz_B, CFO_ave = 0;
|
||||
int CFO_ave_diff;
|
||||
int CrystalCap = (int)pCfoTrack->CrystalCap;
|
||||
u1Byte Adjust_Xtal = 1;
|
||||
|
||||
//4 Support ability
|
||||
if(!(pDM_Odm->SupportAbility & ODM_BB_CFO_TRACKING))
|
||||
{
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_CFO_TRACKING, ODM_DBG_LOUD, ("ODM_CfoTracking(): Return: SupportAbility ODM_BB_CFO_TRACKING is disabled\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_CFO_TRACKING, ODM_DBG_LOUD, ("ODM_CfoTracking()=========> \n"));
|
||||
|
||||
if(!pDM_Odm->bLinked || !pDM_Odm->bOneEntryOnly)
|
||||
{
|
||||
//4 No link or more than one entry
|
||||
ODM_CfoTrackingReset(pDM_Odm);
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_CFO_TRACKING, ODM_DBG_LOUD, ("ODM_CfoTracking(): Reset: bLinked = %d, bOneEntryOnly = %d\n",
|
||||
pDM_Odm->bLinked, pDM_Odm->bOneEntryOnly));
|
||||
}
|
||||
else
|
||||
{
|
||||
//3 1. CFO Tracking
|
||||
//4 1.1 No new packet
|
||||
if(pCfoTrack->packetCount == pCfoTrack->packetCount_pre)
|
||||
{
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_CFO_TRACKING, ODM_DBG_LOUD, ("ODM_CfoTracking(): packet counter doesn't change\n"));
|
||||
return;
|
||||
}
|
||||
pCfoTrack->packetCount_pre = pCfoTrack->packetCount;
|
||||
|
||||
//4 1.2 Calculate CFO
|
||||
CFO_kHz_A = (int)((pCfoTrack->CFO_tail[0] * 3125) / 10)>>7; /* CFO_tail[1:0] is S(8,7), (num_subcarrier>>7) x 312.5K = CFO value(K Hz) */
|
||||
CFO_kHz_B = (int)((pCfoTrack->CFO_tail[1] * 3125) / 10)>>7;
|
||||
|
||||
if(pDM_Odm->RFType < ODM_2T2R)
|
||||
CFO_ave = CFO_kHz_A;
|
||||
else
|
||||
CFO_ave = (int)(CFO_kHz_A + CFO_kHz_B) >> 1;
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_CFO_TRACKING, ODM_DBG_LOUD, ("ODM_CfoTracking(): CFO_kHz_A = %dkHz, CFO_kHz_B = %dkHz, CFO_ave = %dkHz\n",
|
||||
CFO_kHz_A, CFO_kHz_B, CFO_ave));
|
||||
|
||||
//4 1.3 Avoid abnormal large CFO
|
||||
CFO_ave_diff = (pCfoTrack->CFO_ave_pre >= CFO_ave)?(pCfoTrack->CFO_ave_pre - CFO_ave):(CFO_ave - pCfoTrack->CFO_ave_pre);
|
||||
if(CFO_ave_diff > 20 && pCfoTrack->largeCFOHit == 0 && !pCfoTrack->bAdjust)
|
||||
{
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_CFO_TRACKING, ODM_DBG_LOUD, ("ODM_CfoTracking(): first large CFO hit\n"));
|
||||
pCfoTrack->largeCFOHit = 1;
|
||||
return;
|
||||
}
|
||||
else
|
||||
pCfoTrack->largeCFOHit = 0;
|
||||
pCfoTrack->CFO_ave_pre = CFO_ave;
|
||||
|
||||
//4 1.4 Dynamic Xtal threshold
|
||||
if(pCfoTrack->bAdjust == FALSE)
|
||||
{
|
||||
if(CFO_ave > CFO_TH_XTAL_HIGH || CFO_ave < (-CFO_TH_XTAL_HIGH))
|
||||
pCfoTrack->bAdjust = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(CFO_ave < CFO_TH_XTAL_LOW && CFO_ave > (-CFO_TH_XTAL_LOW))
|
||||
pCfoTrack->bAdjust = FALSE;
|
||||
}
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE))
|
||||
//4 1.5 BT case: Disable CFO tracking
|
||||
if(pDM_Odm->bBtEnabled)
|
||||
{
|
||||
pCfoTrack->bAdjust = FALSE;
|
||||
odm_SetCrystalCap(pDM_Odm, pCfoTrack->DefXCap);
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_CFO_TRACKING, ODM_DBG_LOUD, ("ODM_CfoTracking(): Disable CFO tracking for BT!!\n"));
|
||||
}
|
||||
/*
|
||||
//4 1.6 Big jump
|
||||
if(pCfoTrack->bAdjust)
|
||||
{
|
||||
if(CFO_ave > CFO_TH_XTAL_LOW)
|
||||
Adjust_Xtal = Adjust_Xtal + ((CFO_ave - CFO_TH_XTAL_LOW) >> 2);
|
||||
else if(CFO_ave < (-CFO_TH_XTAL_LOW))
|
||||
Adjust_Xtal = Adjust_Xtal + ((CFO_TH_XTAL_LOW - CFO_ave) >> 2);
|
||||
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_CFO_TRACKING, ODM_DBG_LOUD, ("ODM_CfoTracking(): Crystal cap offset = %d\n", Adjust_Xtal));
|
||||
}
|
||||
*/
|
||||
#endif
|
||||
|
||||
//4 1.7 Adjust Crystal Cap.
|
||||
if(pCfoTrack->bAdjust)
|
||||
{
|
||||
if(CFO_ave > CFO_TH_XTAL_LOW)
|
||||
CrystalCap = CrystalCap + Adjust_Xtal;
|
||||
else if(CFO_ave < (-CFO_TH_XTAL_LOW))
|
||||
CrystalCap = CrystalCap - Adjust_Xtal;
|
||||
|
||||
if(CrystalCap > 0x3f)
|
||||
CrystalCap = 0x3f;
|
||||
else if (CrystalCap < 0)
|
||||
CrystalCap = 0;
|
||||
|
||||
odm_SetCrystalCap(pDM_Odm, (u1Byte)CrystalCap);
|
||||
}
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_CFO_TRACKING, ODM_DBG_LOUD, ("ODM_CfoTracking(): Crystal cap = 0x%x, Default Crystal cap = 0x%x\n",
|
||||
pCfoTrack->CrystalCap, pCfoTrack->DefXCap));
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE))
|
||||
if(pDM_Odm->SupportICType & ODM_IC_11AC_SERIES)
|
||||
return;
|
||||
|
||||
//3 2. Dynamic ATC switch
|
||||
if(CFO_ave < CFO_TH_ATC && CFO_ave > -CFO_TH_ATC)
|
||||
{
|
||||
odm_SetATCStatus(pDM_Odm, FALSE);
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_CFO_TRACKING, ODM_DBG_LOUD, ("ODM_CfoTracking(): Disable ATC!!\n"));
|
||||
}
|
||||
else
|
||||
{
|
||||
odm_SetATCStatus(pDM_Odm, TRUE);
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_CFO_TRACKING, ODM_DBG_LOUD, ("ODM_CfoTracking(): Enable ATC!!\n"));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
VOID
|
||||
ODM_ParsingCFO(
|
||||
IN PVOID pDM_VOID,
|
||||
IN PVOID pPktinfo_VOID,
|
||||
IN s1Byte* pcfotail
|
||||
)
|
||||
{
|
||||
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
|
||||
PODM_PACKET_INFO_T pPktinfo = (PODM_PACKET_INFO_T)pPktinfo_VOID;
|
||||
PCFO_TRACKING pCfoTrack = (PCFO_TRACKING)PhyDM_Get_Structure( pDM_Odm, PHYDM_CFOTRACK);
|
||||
u1Byte i;
|
||||
|
||||
if(!(pDM_Odm->SupportAbility & ODM_BB_CFO_TRACKING))
|
||||
return;
|
||||
|
||||
#if(DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE))
|
||||
if(pPktinfo->bPacketMatchBSSID)
|
||||
#else
|
||||
if(pPktinfo->StationID != 0)
|
||||
#endif
|
||||
{
|
||||
//3 Update CFO report for path-A & path-B
|
||||
// Only paht-A and path-B have CFO tail and short CFO
|
||||
for(i = ODM_RF_PATH_A; i <= ODM_RF_PATH_B; i++)
|
||||
{
|
||||
pCfoTrack->CFO_tail[i] = (int)pcfotail[i];
|
||||
}
|
||||
|
||||
//3 Update packet counter
|
||||
if(pCfoTrack->packetCount == 0xffffffff)
|
||||
pCfoTrack->packetCount = 0;
|
||||
else
|
||||
pCfoTrack->packetCount++;
|
||||
}
|
||||
}
|
||||
|
||||
68
hal/phydm/phydm_cfotracking.h
Normal file
68
hal/phydm/phydm_cfotracking.h
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __PHYDMCFOTRACK_H__
|
||||
#define __PHYDMCFOTRACK_H__
|
||||
|
||||
#define CFO_TRACKING_VERSION "1.2" /*2015.06.17*/
|
||||
|
||||
#define CFO_TH_XTAL_HIGH 20 // kHz
|
||||
#define CFO_TH_XTAL_LOW 10 // kHz
|
||||
#define CFO_TH_ATC 80 // kHz
|
||||
|
||||
typedef struct _CFO_TRACKING_
|
||||
{
|
||||
BOOLEAN bATCStatus;
|
||||
BOOLEAN largeCFOHit;
|
||||
BOOLEAN bAdjust;
|
||||
u1Byte CrystalCap;
|
||||
u1Byte DefXCap;
|
||||
int CFO_tail[2];
|
||||
int CFO_ave_pre;
|
||||
u4Byte packetCount;
|
||||
u4Byte packetCount_pre;
|
||||
|
||||
BOOLEAN bForceXtalCap;
|
||||
BOOLEAN bReset;
|
||||
}CFO_TRACKING, *PCFO_TRACKING;
|
||||
|
||||
VOID
|
||||
ODM_CfoTrackingReset(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
ODM_CfoTrackingInit(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
ODM_CfoTracking(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
ODM_ParsingCFO(
|
||||
IN PVOID pDM_VOID,
|
||||
IN PVOID pPktinfo_VOID,
|
||||
IN s1Byte* pcfotail
|
||||
);
|
||||
|
||||
#endif
|
||||
2002
hal/phydm/phydm_debug.c
Normal file
2002
hal/phydm/phydm_debug.c
Normal file
File diff suppressed because it is too large
Load diff
330
hal/phydm/phydm_debug.h
Normal file
330
hal/phydm/phydm_debug.h
Normal file
|
|
@ -0,0 +1,330 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
#ifndef __ODM_DBG_H__
|
||||
#define __ODM_DBG_H__
|
||||
|
||||
#define DEBUG_VERSION "1.0" /*2015.01.13 Dino*/
|
||||
//-----------------------------------------------------------------------------
|
||||
// Define the debug levels
|
||||
//
|
||||
// 1. DBG_TRACE and DBG_LOUD are used for normal cases.
|
||||
// So that, they can help SW engineer to develope or trace states changed
|
||||
// and also help HW enginner to trace every operation to and from HW,
|
||||
// e.g IO, Tx, Rx.
|
||||
//
|
||||
// 2. DBG_WARNNING and DBG_SERIOUS are used for unusual or error cases,
|
||||
// which help us to debug SW or HW.
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Never used in a call to ODM_RT_TRACE()!
|
||||
//
|
||||
#define ODM_DBG_OFF 1
|
||||
|
||||
//
|
||||
// Fatal bug.
|
||||
// For example, Tx/Rx/IO locked up, OS hangs, memory access violation,
|
||||
// resource allocation failed, unexpected HW behavior, HW BUG and so on.
|
||||
//
|
||||
#define ODM_DBG_SERIOUS 2
|
||||
|
||||
//
|
||||
// Abnormal, rare, or unexpeted cases.
|
||||
// For example, IRP/Packet/OID canceled, device suprisely unremoved and so on.
|
||||
//
|
||||
#define ODM_DBG_WARNING 3
|
||||
|
||||
//
|
||||
// Normal case with useful information about current SW or HW state.
|
||||
// For example, Tx/Rx descriptor to fill, Tx/Rx descriptor completed status,
|
||||
// SW protocol state change, dynamic mechanism state change and so on.
|
||||
//
|
||||
#define ODM_DBG_LOUD 4
|
||||
|
||||
//
|
||||
// Normal case with detail execution flow or information.
|
||||
//
|
||||
#define ODM_DBG_TRACE 5
|
||||
|
||||
/*FW DBG MSG*/
|
||||
#define RATE_DECISION BIT0
|
||||
#define INIT_RA_TABLE BIT1
|
||||
#define RATE_UP BIT2
|
||||
#define RATE_DOWN BIT3
|
||||
#define TRY_DONE BIT4
|
||||
#define F_RATE_AP_RPT BIT7
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Define the tracing components
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
//BB Functions
|
||||
#define ODM_COMP_DIG BIT0
|
||||
#define ODM_COMP_RA_MASK BIT1
|
||||
#define ODM_COMP_DYNAMIC_TXPWR BIT2
|
||||
#define ODM_COMP_FA_CNT BIT3
|
||||
#define ODM_COMP_RSSI_MONITOR BIT4
|
||||
#define ODM_COMP_CCK_PD BIT5
|
||||
#define ODM_COMP_ANT_DIV BIT6
|
||||
#define ODM_COMP_PWR_SAVE BIT7
|
||||
#define ODM_COMP_PWR_TRAIN BIT8
|
||||
#define ODM_COMP_RATE_ADAPTIVE BIT9
|
||||
#define ODM_COMP_PATH_DIV BIT10
|
||||
#define ODM_COMP_PSD BIT11
|
||||
#define ODM_COMP_DYNAMIC_PRICCA BIT12
|
||||
#define ODM_COMP_RXHP BIT13
|
||||
#define ODM_COMP_MP BIT14
|
||||
#define ODM_COMP_CFO_TRACKING BIT15
|
||||
#define ODM_COMP_ACS BIT16
|
||||
#define PHYDM_COMP_ADAPTIVITY BIT17
|
||||
#define PHYDM_COMP_RA_DBG BIT18
|
||||
#define PHYDM_COMP_TXBF BIT19
|
||||
//MAC Functions
|
||||
#define ODM_COMP_EDCA_TURBO BIT20
|
||||
#define ODM_COMP_EARLY_MODE BIT21
|
||||
#define ODM_FW_DEBUG_TRACE BIT22
|
||||
//RF Functions
|
||||
#define ODM_COMP_TX_PWR_TRACK BIT24
|
||||
#define ODM_COMP_RX_GAIN_TRACK BIT25
|
||||
#define ODM_COMP_CALIBRATION BIT26
|
||||
//Common Functions
|
||||
#define ODM_PHY_CONFIG BIT28
|
||||
#define BEAMFORMING_DEBUG BIT29
|
||||
#define ODM_COMP_COMMON BIT30
|
||||
#define ODM_COMP_INIT BIT31
|
||||
#define ODM_COMP_NOISY_DETECT BIT32
|
||||
|
||||
/*------------------------Export Marco Definition---------------------------*/
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
|
||||
#define RT_PRINTK DbgPrint
|
||||
#elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
|
||||
#define DbgPrint printk
|
||||
#define RT_PRINTK(fmt, args...) DbgPrint( "%s(): " fmt, __FUNCTION__, ## args);
|
||||
#define RT_DISP(dbgtype, dbgflag, printstr)
|
||||
#else
|
||||
#define DbgPrint panic_printk
|
||||
#define RT_PRINTK(fmt, args...) DbgPrint( "%s(): " fmt, __FUNCTION__, ## args);
|
||||
#endif
|
||||
|
||||
#ifndef ASSERT
|
||||
#define ASSERT(expr)
|
||||
#endif
|
||||
|
||||
#if DBG
|
||||
#define ODM_RT_TRACE(pDM_Odm, comp, level, fmt) \
|
||||
do { \
|
||||
if(((comp) & pDM_Odm->DebugComponents) && (level <= pDM_Odm->DebugLevel || level == ODM_DBG_SERIOUS)) \
|
||||
{ \
|
||||
if(pDM_Odm->SupportICType == ODM_RTL8192C) \
|
||||
DbgPrint("[ODM-92C] "); \
|
||||
else if(pDM_Odm->SupportICType == ODM_RTL8192D) \
|
||||
DbgPrint("[ODM-92D] "); \
|
||||
else if(pDM_Odm->SupportICType == ODM_RTL8723A) \
|
||||
DbgPrint("[ODM-8723A] "); \
|
||||
else if(pDM_Odm->SupportICType == ODM_RTL8188E) \
|
||||
DbgPrint("[ODM-8188E] "); \
|
||||
else if(pDM_Odm->SupportICType == ODM_RTL8192E) \
|
||||
DbgPrint("[ODM-8192E] "); \
|
||||
else if(pDM_Odm->SupportICType == ODM_RTL8812) \
|
||||
DbgPrint("[ODM-8812] "); \
|
||||
else if(pDM_Odm->SupportICType == ODM_RTL8821) \
|
||||
DbgPrint("[ODM-8821] "); \
|
||||
else if(pDM_Odm->SupportICType == ODM_RTL8814A) \
|
||||
DbgPrint("[ODM-8814] "); \
|
||||
else if(pDM_Odm->SupportICType == ODM_RTL8703B) \
|
||||
DbgPrint("[ODM-8703B] "); \
|
||||
else if(pDM_Odm->SupportICType == ODM_RTL8822B) \
|
||||
DbgPrint("[ODM-8822] "); \
|
||||
else if (pDM_Odm->SupportICType == ODM_RTL8188F) \
|
||||
DbgPrint("[ODM-8188F] "); \
|
||||
RT_PRINTK fmt; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define ODM_RT_TRACE_F(pDM_Odm, comp, level, fmt) \
|
||||
if(((comp) & pDM_Odm->DebugComponents) && (level <= pDM_Odm->DebugLevel)) \
|
||||
{ \
|
||||
RT_PRINTK fmt; \
|
||||
}
|
||||
|
||||
#define ODM_RT_ASSERT(pDM_Odm, expr, fmt) \
|
||||
if(!(expr)) { \
|
||||
DbgPrint( "Assertion failed! %s at ......\n", #expr); \
|
||||
DbgPrint( " ......%s,%s,line=%d\n",__FILE__,__FUNCTION__,__LINE__); \
|
||||
RT_PRINTK fmt; \
|
||||
ASSERT(FALSE); \
|
||||
}
|
||||
#define ODM_dbg_enter() { DbgPrint("==> %s\n", __FUNCTION__); }
|
||||
#define ODM_dbg_exit() { DbgPrint("<== %s\n", __FUNCTION__); }
|
||||
#define ODM_dbg_trace(str) { DbgPrint("%s:%s\n", __FUNCTION__, str); }
|
||||
|
||||
#define ODM_PRINT_ADDR(pDM_Odm, comp, level, title_str, ptr) \
|
||||
if(((comp) & pDM_Odm->DebugComponents) && (level <= pDM_Odm->DebugLevel)) \
|
||||
{ \
|
||||
int __i; \
|
||||
pu1Byte __ptr = (pu1Byte)ptr; \
|
||||
DbgPrint("[ODM] "); \
|
||||
DbgPrint(title_str); \
|
||||
DbgPrint(" "); \
|
||||
for( __i=0; __i<6; __i++ ) \
|
||||
DbgPrint("%02X%s", __ptr[__i], (__i==5)?"":"-"); \
|
||||
DbgPrint("\n"); \
|
||||
}
|
||||
#else
|
||||
#define ODM_RT_TRACE(pDM_Odm, comp, level, fmt)
|
||||
#define ODM_RT_TRACE_F(pDM_Odm, comp, level, fmt)
|
||||
#define ODM_RT_ASSERT(pDM_Odm, expr, fmt)
|
||||
#define ODM_dbg_enter()
|
||||
#define ODM_dbg_exit()
|
||||
#define ODM_dbg_trace(str)
|
||||
#define ODM_PRINT_ADDR(pDM_Odm, comp, level, title_str, ptr)
|
||||
#endif
|
||||
|
||||
|
||||
VOID
|
||||
PHYDM_InitDebugSetting(IN PDM_ODM_T pDM_Odm);
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
|
||||
VOID phydm_BB_RxHang_Info(IN PDM_ODM_T pDM_Odm);
|
||||
#endif
|
||||
|
||||
#define BB_TMP_BUF_SIZE 100
|
||||
VOID phydm_BB_Debug_Info(IN PDM_ODM_T pDM_Odm);
|
||||
VOID phydm_BasicDbgMessage( IN PVOID pDM_VOID);
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
|
||||
#define PHYDM_DBGPRINT 0
|
||||
#define PHYDM_SSCANF(x, y, z) DCMD_Scanf(x, y, z)
|
||||
#if (PHYDM_DBGPRINT == 1)
|
||||
#define PHYDM_SNPRINTF(msg) \
|
||||
do {\
|
||||
rsprintf msg;\
|
||||
DbgPrint(output);\
|
||||
} while (0)
|
||||
#else
|
||||
#define PHYDM_SNPRINTF(msg) \
|
||||
do {\
|
||||
rsprintf msg;\
|
||||
DCMD_Printf(output);\
|
||||
} while (0)
|
||||
#endif
|
||||
#else
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_CE)
|
||||
#define PHYDM_DBGPRINT 0
|
||||
#else
|
||||
#define PHYDM_DBGPRINT 1
|
||||
#endif
|
||||
#define MAX_ARGC 20
|
||||
#define MAX_ARGV 16
|
||||
#define DCMD_DECIMAL "%d"
|
||||
#define DCMD_CHAR "%c"
|
||||
#define DCMD_HEX "%x"
|
||||
|
||||
#define PHYDM_SSCANF(x, y, z) sscanf(x, y, z)
|
||||
#if (PHYDM_DBGPRINT == 1)
|
||||
#define PHYDM_SNPRINTF(msg)\
|
||||
do {\
|
||||
snprintf msg;\
|
||||
DbgPrint(output);\
|
||||
} while (0)
|
||||
#else
|
||||
#define PHYDM_SNPRINTF(msg)\
|
||||
do {\
|
||||
if(out_len > used)\
|
||||
used+=snprintf msg;\
|
||||
} while (0)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
VOID phydm_BasicProfile(
|
||||
IN PVOID pDM_VOID,
|
||||
IN u4Byte *_used,
|
||||
OUT char *output,
|
||||
IN u4Byte *_out_len
|
||||
);
|
||||
#if(DM_ODM_SUPPORT_TYPE & (ODM_CE|ODM_AP))
|
||||
s4Byte
|
||||
phydm_cmd(
|
||||
IN PDM_ODM_T pDM_Odm,
|
||||
IN char *input,
|
||||
IN u4Byte in_len,
|
||||
IN u1Byte flag,
|
||||
OUT char *output,
|
||||
IN u4Byte out_len
|
||||
);
|
||||
#endif
|
||||
VOID
|
||||
phydm_cmd_parser(
|
||||
IN PDM_ODM_T pDM_Odm,
|
||||
IN char input[][16],
|
||||
IN u4Byte input_num,
|
||||
IN u1Byte flag,
|
||||
OUT char *output,
|
||||
IN u4Byte out_len
|
||||
);
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
|
||||
void phydm_sbd_check(
|
||||
IN PDM_ODM_T pDM_Odm
|
||||
);
|
||||
|
||||
void phydm_sbd_callback(
|
||||
PRT_TIMER pTimer
|
||||
);
|
||||
|
||||
void phydm_sbd_workitem_callback(
|
||||
IN PVOID pContext
|
||||
);
|
||||
#endif
|
||||
|
||||
VOID
|
||||
phydm_fw_trace_en_h2c(
|
||||
IN PVOID pDM_VOID,
|
||||
IN BOOLEAN enable,
|
||||
IN u4Byte monitor_mode,
|
||||
IN u4Byte macid
|
||||
);
|
||||
|
||||
VOID
|
||||
phydm_fw_trace_handler(
|
||||
IN PVOID pDM_VOID,
|
||||
IN pu1Byte CmdBuf,
|
||||
IN u1Byte CmdLen
|
||||
);
|
||||
|
||||
VOID
|
||||
phydm_fw_trace_handler_code(
|
||||
IN PVOID pDM_VOID,
|
||||
IN pu1Byte Buffer,
|
||||
IN u1Byte CmdLen
|
||||
);
|
||||
|
||||
VOID
|
||||
phydm_fw_trace_handler_8051(
|
||||
IN PVOID pDM_VOID,
|
||||
IN pu1Byte CmdBuf,
|
||||
IN u1Byte CmdLen
|
||||
);
|
||||
|
||||
#endif // __ODM_DBG_H__
|
||||
|
||||
2087
hal/phydm/phydm_dig.c
Normal file
2087
hal/phydm/phydm_dig.c
Normal file
File diff suppressed because it is too large
Load diff
327
hal/phydm/phydm_dig.h
Normal file
327
hal/phydm/phydm_dig.h
Normal file
|
|
@ -0,0 +1,327 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __PHYDMDIG_H__
|
||||
#define __PHYDMDIG_H__
|
||||
|
||||
#define DIG_VERSION "1.8" /*2015.07.01*/
|
||||
|
||||
/* Pause DIG & CCKPD */
|
||||
#define DM_DIG_MAX_PAUSE_TYPE 0x7
|
||||
|
||||
typedef struct _Dynamic_Initial_Gain_Threshold_
|
||||
{
|
||||
BOOLEAN bStopDIG; // for debug
|
||||
BOOLEAN bIgnoreDIG;
|
||||
BOOLEAN bPSDInProgress;
|
||||
|
||||
u1Byte Dig_Enable_Flag;
|
||||
u1Byte Dig_Ext_Port_Stage;
|
||||
|
||||
int RssiLowThresh;
|
||||
int RssiHighThresh;
|
||||
|
||||
u4Byte FALowThresh;
|
||||
u4Byte FAHighThresh;
|
||||
|
||||
u1Byte CurSTAConnectState;
|
||||
u1Byte PreSTAConnectState;
|
||||
u1Byte CurMultiSTAConnectState;
|
||||
|
||||
u1Byte PreIGValue;
|
||||
u1Byte CurIGValue;
|
||||
u1Byte BackupIGValue; //MP DIG
|
||||
u1Byte BT30_CurIGI;
|
||||
u1Byte IGIBackup;
|
||||
|
||||
s1Byte BackoffVal;
|
||||
s1Byte BackoffVal_range_max;
|
||||
s1Byte BackoffVal_range_min;
|
||||
u1Byte rx_gain_range_max;
|
||||
u1Byte rx_gain_range_min;
|
||||
u1Byte Rssi_val_min;
|
||||
|
||||
u1Byte PreCCK_CCAThres;
|
||||
u1Byte CurCCK_CCAThres;
|
||||
u1Byte PreCCKPDState;
|
||||
u1Byte CurCCKPDState;
|
||||
u1Byte CCKPDBackup;
|
||||
u1Byte pause_cckpd_level;
|
||||
u1Byte pause_cckpd_value[DM_DIG_MAX_PAUSE_TYPE + 1];
|
||||
|
||||
u1Byte LargeFAHit;
|
||||
u1Byte ForbiddenIGI;
|
||||
u4Byte Recover_cnt;
|
||||
|
||||
u1Byte DIG_Dynamic_MIN_0;
|
||||
u1Byte DIG_Dynamic_MIN_1;
|
||||
BOOLEAN bMediaConnect_0;
|
||||
BOOLEAN bMediaConnect_1;
|
||||
|
||||
u4Byte AntDiv_RSSI_max;
|
||||
u4Byte RSSI_max;
|
||||
|
||||
u1Byte *bP2PInProcess;
|
||||
|
||||
u1Byte pause_dig_level;
|
||||
u1Byte pause_dig_value[DM_DIG_MAX_PAUSE_TYPE + 1];
|
||||
|
||||
#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
|
||||
BOOLEAN bTpTarget;
|
||||
BOOLEAN bNoiseEst;
|
||||
u4Byte TpTrainTH_min;
|
||||
u1Byte IGIOffset_A;
|
||||
u1Byte IGIOffset_B;
|
||||
#endif
|
||||
}DIG_T,*pDIG_T;
|
||||
|
||||
typedef struct _FALSE_ALARM_STATISTICS{
|
||||
u4Byte Cnt_Parity_Fail;
|
||||
u4Byte Cnt_Rate_Illegal;
|
||||
u4Byte Cnt_Crc8_fail;
|
||||
u4Byte Cnt_Mcs_fail;
|
||||
u4Byte Cnt_Ofdm_fail;
|
||||
u4Byte Cnt_Ofdm_fail_pre; //For RTL8881A
|
||||
u4Byte Cnt_Cck_fail;
|
||||
u4Byte Cnt_all;
|
||||
u4Byte Cnt_Fast_Fsync;
|
||||
u4Byte Cnt_SB_Search_fail;
|
||||
u4Byte Cnt_OFDM_CCA;
|
||||
u4Byte Cnt_CCK_CCA;
|
||||
u4Byte Cnt_CCA_all;
|
||||
u4Byte Cnt_BW_USC; //Gary
|
||||
u4Byte Cnt_BW_LSC; //Gary
|
||||
}FALSE_ALARM_STATISTICS, *PFALSE_ALARM_STATISTICS;
|
||||
|
||||
typedef enum tag_Dynamic_Init_Gain_Operation_Type_Definition
|
||||
{
|
||||
DIG_TYPE_THRESH_HIGH = 0,
|
||||
DIG_TYPE_THRESH_LOW = 1,
|
||||
DIG_TYPE_BACKOFF = 2,
|
||||
DIG_TYPE_RX_GAIN_MIN = 3,
|
||||
DIG_TYPE_RX_GAIN_MAX = 4,
|
||||
DIG_TYPE_ENABLE = 5,
|
||||
DIG_TYPE_DISABLE = 6,
|
||||
DIG_OP_TYPE_MAX
|
||||
}DM_DIG_OP_E;
|
||||
|
||||
/*
|
||||
typedef enum tag_CCK_Packet_Detection_Threshold_Type_Definition
|
||||
{
|
||||
CCK_PD_STAGE_LowRssi = 0,
|
||||
CCK_PD_STAGE_HighRssi = 1,
|
||||
CCK_PD_STAGE_MAX = 3,
|
||||
}DM_CCK_PDTH_E;
|
||||
|
||||
typedef enum tag_DIG_EXT_PORT_ALGO_Definition
|
||||
{
|
||||
DIG_EXT_PORT_STAGE_0 = 0,
|
||||
DIG_EXT_PORT_STAGE_1 = 1,
|
||||
DIG_EXT_PORT_STAGE_2 = 2,
|
||||
DIG_EXT_PORT_STAGE_3 = 3,
|
||||
DIG_EXT_PORT_STAGE_MAX = 4,
|
||||
}DM_DIG_EXT_PORT_ALG_E;
|
||||
|
||||
typedef enum tag_DIG_Connect_Definition
|
||||
{
|
||||
DIG_STA_DISCONNECT = 0,
|
||||
DIG_STA_CONNECT = 1,
|
||||
DIG_STA_BEFORE_CONNECT = 2,
|
||||
DIG_MultiSTA_DISCONNECT = 3,
|
||||
DIG_MultiSTA_CONNECT = 4,
|
||||
DIG_CONNECT_MAX
|
||||
}DM_DIG_CONNECT_E;
|
||||
|
||||
|
||||
#define DM_MultiSTA_InitGainChangeNotify(Event) {DM_DigTable.CurMultiSTAConnectState = Event;}
|
||||
|
||||
#define DM_MultiSTA_InitGainChangeNotify_CONNECT(_ADAPTER) \
|
||||
DM_MultiSTA_InitGainChangeNotify(DIG_MultiSTA_CONNECT)
|
||||
|
||||
#define DM_MultiSTA_InitGainChangeNotify_DISCONNECT(_ADAPTER) \
|
||||
DM_MultiSTA_InitGainChangeNotify(DIG_MultiSTA_DISCONNECT)
|
||||
*/
|
||||
|
||||
typedef enum tag_PHYDM_Pause_Type {
|
||||
PHYDM_PAUSE = BIT0,
|
||||
PHYDM_RESUME = BIT1
|
||||
} PHYDM_PAUSE_TYPE;
|
||||
|
||||
typedef enum tag_PHYDM_Pause_Level {
|
||||
/* number of pause level can't exceed DM_DIG_MAX_PAUSE_TYPE */
|
||||
PHYDM_PAUSE_LEVEL_0 = 0,
|
||||
PHYDM_PAUSE_LEVEL_1 = 1,
|
||||
PHYDM_PAUSE_LEVEL_2 = 2,
|
||||
PHYDM_PAUSE_LEVEL_3 = 3,
|
||||
PHYDM_PAUSE_LEVEL_4 = 4,
|
||||
PHYDM_PAUSE_LEVEL_5 = 5,
|
||||
PHYDM_PAUSE_LEVEL_6 = 6,
|
||||
PHYDM_PAUSE_LEVEL_7 = DM_DIG_MAX_PAUSE_TYPE /* maximum level */
|
||||
} PHYDM_PAUSE_LEVEL;
|
||||
|
||||
|
||||
#define DM_DIG_THRESH_HIGH 40
|
||||
#define DM_DIG_THRESH_LOW 35
|
||||
|
||||
#define DM_FALSEALARM_THRESH_LOW 400
|
||||
#define DM_FALSEALARM_THRESH_HIGH 1000
|
||||
|
||||
#define DM_DIG_MAX_NIC 0x3e
|
||||
#define DM_DIG_MIN_NIC 0x1e //0x22//0x1c
|
||||
#define DM_DIG_MAX_OF_MIN_NIC 0x3e
|
||||
|
||||
#define DM_DIG_MAX_AP 0x3e
|
||||
#define DM_DIG_MIN_AP 0x1c
|
||||
#define DM_DIG_MAX_OF_MIN 0x2A //0x32
|
||||
#define DM_DIG_MIN_AP_DFS 0x20
|
||||
|
||||
#define DM_DIG_MAX_NIC_HP 0x46
|
||||
#define DM_DIG_MIN_NIC_HP 0x2e
|
||||
|
||||
#define DM_DIG_MAX_AP_HP 0x42
|
||||
#define DM_DIG_MIN_AP_HP 0x30
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
|
||||
#define DM_DIG_MAX_AP_COVERAGR 0x26
|
||||
#define DM_DIG_MIN_AP_COVERAGE 0x1c
|
||||
#define DM_DIG_MAX_OF_MIN_COVERAGE 0x22
|
||||
|
||||
#define DM_DIG_TP_Target_TH0 500
|
||||
#define DM_DIG_TP_Target_TH1 1000
|
||||
#define DM_DIG_TP_Training_Period 10
|
||||
#endif
|
||||
|
||||
//vivi 92c&92d has different definition, 20110504
|
||||
//this is for 92c
|
||||
#if (DM_ODM_SUPPORT_TYPE & ODM_CE)
|
||||
#ifdef CONFIG_SPECIAL_SETTING_FOR_FUNAI_TV
|
||||
#define DM_DIG_FA_TH0 0x80//0x20
|
||||
#else
|
||||
#define DM_DIG_FA_TH0 0x200//0x20
|
||||
#endif
|
||||
#else
|
||||
#define DM_DIG_FA_TH0 0x200//0x20
|
||||
#endif
|
||||
|
||||
#define DM_DIG_FA_TH1 0x300
|
||||
#define DM_DIG_FA_TH2 0x400
|
||||
//this is for 92d
|
||||
#define DM_DIG_FA_TH0_92D 0x100
|
||||
#define DM_DIG_FA_TH1_92D 0x400
|
||||
#define DM_DIG_FA_TH2_92D 0x600
|
||||
|
||||
#define DM_DIG_BACKOFF_MAX 12
|
||||
#define DM_DIG_BACKOFF_MIN -4
|
||||
#define DM_DIG_BACKOFF_DEFAULT 10
|
||||
|
||||
#define DM_DIG_FA_TH0_LPS 4 //-> 4 in lps
|
||||
#define DM_DIG_FA_TH1_LPS 15 //-> 15 lps
|
||||
#define DM_DIG_FA_TH2_LPS 30 //-> 30 lps
|
||||
#define RSSI_OFFSET_DIG 0x05
|
||||
|
||||
VOID
|
||||
ODM_ChangeDynamicInitGainThresh(
|
||||
IN PVOID pDM_VOID,
|
||||
IN u4Byte DM_Type,
|
||||
IN u4Byte DM_Value
|
||||
);
|
||||
|
||||
VOID
|
||||
ODM_Write_DIG(
|
||||
IN PVOID pDM_VOID,
|
||||
IN u1Byte CurrentIGI
|
||||
);
|
||||
|
||||
VOID
|
||||
odm_PauseDIG(
|
||||
IN PVOID pDM_VOID,
|
||||
IN PHYDM_PAUSE_TYPE PauseType,
|
||||
IN PHYDM_PAUSE_LEVEL pause_level,
|
||||
IN u1Byte IGIValue
|
||||
);
|
||||
|
||||
VOID
|
||||
odm_DIGInit(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
odm_DIG(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
odm_DIGbyRSSI_LPS(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
odm_FalseAlarmCounterStatistics(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
odm_PauseCCKPacketDetection(
|
||||
IN PVOID pDM_VOID,
|
||||
IN PHYDM_PAUSE_TYPE PauseType,
|
||||
IN PHYDM_PAUSE_LEVEL pause_level,
|
||||
IN u1Byte CCKPDThreshold
|
||||
);
|
||||
|
||||
VOID
|
||||
odm_CCKPacketDetectionThresh(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
ODM_Write_CCK_CCA_Thres(
|
||||
IN PVOID pDM_VOID,
|
||||
IN u1Byte CurCCK_CCAThres
|
||||
);
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
|
||||
VOID
|
||||
odm_MPT_DIGCallback(
|
||||
PRT_TIMER pTimer
|
||||
);
|
||||
|
||||
VOID
|
||||
odm_MPT_DIGWorkItemCallback(
|
||||
IN PVOID pContext
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
|
||||
VOID
|
||||
odm_MPT_DIGCallback(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
#endif
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE != ODM_CE)
|
||||
VOID
|
||||
ODM_MPT_DIG(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
219
hal/phydm/phydm_dynamicbbpowersaving.c
Normal file
219
hal/phydm/phydm_dynamicbbpowersaving.c
Normal file
|
|
@ -0,0 +1,219 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
//============================================================
|
||||
// include files
|
||||
//============================================================
|
||||
#include "mp_precomp.h"
|
||||
#include "phydm_precomp.h"
|
||||
|
||||
VOID
|
||||
odm_DynamicBBPowerSavingInit(
|
||||
IN PVOID pDM_VOID
|
||||
)
|
||||
{
|
||||
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
|
||||
pPS_T pDM_PSTable = &pDM_Odm->DM_PSTable;
|
||||
|
||||
pDM_PSTable->PreCCAState = CCA_MAX;
|
||||
pDM_PSTable->CurCCAState = CCA_MAX;
|
||||
pDM_PSTable->PreRFState = RF_MAX;
|
||||
pDM_PSTable->CurRFState = RF_MAX;
|
||||
pDM_PSTable->Rssi_val_min = 0;
|
||||
pDM_PSTable->initialize = 0;
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
odm_DynamicBBPowerSaving(
|
||||
IN PVOID pDM_VOID
|
||||
)
|
||||
{
|
||||
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
|
||||
#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE))
|
||||
|
||||
if (pDM_Odm->SupportICType != ODM_RTL8723A)
|
||||
return;
|
||||
if(!(pDM_Odm->SupportAbility & ODM_BB_PWR_SAVE))
|
||||
return;
|
||||
if(!(pDM_Odm->SupportPlatform & (ODM_WIN|ODM_CE)))
|
||||
return;
|
||||
|
||||
//1 2.Power Saving for 92C
|
||||
if((pDM_Odm->SupportICType == ODM_RTL8192C) &&(pDM_Odm->RFType == ODM_2T2R))
|
||||
{
|
||||
odm_1R_CCA(pDM_Odm);
|
||||
}
|
||||
|
||||
// 20100628 Joseph: Turn off BB power save for 88CE because it makesthroughput unstable.
|
||||
// 20100831 Joseph: Turn ON BB power save again after modifying AGC delay from 900ns ot 600ns.
|
||||
//1 3.Power Saving for 88C
|
||||
else
|
||||
{
|
||||
ODM_RF_Saving(pDM_Odm, FALSE);
|
||||
}
|
||||
#endif // #if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
|
||||
|
||||
}
|
||||
|
||||
VOID
|
||||
odm_1R_CCA(
|
||||
IN PVOID pDM_VOID
|
||||
)
|
||||
{
|
||||
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
|
||||
pPS_T pDM_PSTable = &pDM_Odm->DM_PSTable;
|
||||
|
||||
if(pDM_Odm->RSSI_Min!= 0xFF)
|
||||
{
|
||||
|
||||
if(pDM_PSTable->PreCCAState == CCA_2R)
|
||||
{
|
||||
if(pDM_Odm->RSSI_Min >= 35)
|
||||
pDM_PSTable->CurCCAState = CCA_1R;
|
||||
else
|
||||
pDM_PSTable->CurCCAState = CCA_2R;
|
||||
|
||||
}
|
||||
else{
|
||||
if(pDM_Odm->RSSI_Min <= 30)
|
||||
pDM_PSTable->CurCCAState = CCA_2R;
|
||||
else
|
||||
pDM_PSTable->CurCCAState = CCA_1R;
|
||||
}
|
||||
}
|
||||
else{
|
||||
pDM_PSTable->CurCCAState=CCA_MAX;
|
||||
}
|
||||
|
||||
if(pDM_PSTable->PreCCAState != pDM_PSTable->CurCCAState)
|
||||
{
|
||||
if(pDM_PSTable->CurCCAState == CCA_1R)
|
||||
{
|
||||
if( pDM_Odm->RFType ==ODM_2T2R )
|
||||
{
|
||||
ODM_SetBBReg(pDM_Odm, 0xc04 , bMaskByte0, 0x13);
|
||||
//PHY_SetBBReg(pAdapter, 0xe70, bMaskByte3, 0x20);
|
||||
}
|
||||
else
|
||||
{
|
||||
ODM_SetBBReg(pDM_Odm, 0xc04 , bMaskByte0, 0x23);
|
||||
//PHY_SetBBReg(pAdapter, 0xe70, 0x7fc00000, 0x10c); // Set RegE70[30:22] = 9b'100001100
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ODM_SetBBReg(pDM_Odm, 0xc04 , bMaskByte0, 0x33);
|
||||
//PHY_SetBBReg(pAdapter,0xe70, bMaskByte3, 0x63);
|
||||
}
|
||||
pDM_PSTable->PreCCAState = pDM_PSTable->CurCCAState;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ODM_RF_Saving(
|
||||
IN PVOID pDM_VOID,
|
||||
IN u1Byte bForceInNormal
|
||||
)
|
||||
{
|
||||
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
|
||||
#if (DM_ODM_SUPPORT_TYPE != ODM_AP)
|
||||
pPS_T pDM_PSTable = &pDM_Odm->DM_PSTable;
|
||||
u1Byte Rssi_Up_bound = 30 ;
|
||||
u1Byte Rssi_Low_bound = 25;
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_CE)
|
||||
if(pDM_Odm->PatchID == 40 ) //RT_CID_819x_FUNAI_TV
|
||||
{
|
||||
Rssi_Up_bound = 50 ;
|
||||
Rssi_Low_bound = 45;
|
||||
}
|
||||
#endif
|
||||
if(pDM_PSTable->initialize == 0){
|
||||
|
||||
pDM_PSTable->Reg874 = (ODM_GetBBReg(pDM_Odm, 0x874, bMaskDWord)&0x1CC000)>>14;
|
||||
pDM_PSTable->RegC70 = (ODM_GetBBReg(pDM_Odm, 0xc70, bMaskDWord)&BIT3)>>3;
|
||||
pDM_PSTable->Reg85C = (ODM_GetBBReg(pDM_Odm, 0x85c, bMaskDWord)&0xFF000000)>>24;
|
||||
pDM_PSTable->RegA74 = (ODM_GetBBReg(pDM_Odm, 0xa74, bMaskDWord)&0xF000)>>12;
|
||||
//Reg818 = PHY_QueryBBReg(pAdapter, 0x818, bMaskDWord);
|
||||
pDM_PSTable->initialize = 1;
|
||||
}
|
||||
|
||||
if(!bForceInNormal)
|
||||
{
|
||||
if(pDM_Odm->RSSI_Min != 0xFF)
|
||||
{
|
||||
if(pDM_PSTable->PreRFState == RF_Normal)
|
||||
{
|
||||
if(pDM_Odm->RSSI_Min >= Rssi_Up_bound)
|
||||
pDM_PSTable->CurRFState = RF_Save;
|
||||
else
|
||||
pDM_PSTable->CurRFState = RF_Normal;
|
||||
}
|
||||
else{
|
||||
if(pDM_Odm->RSSI_Min <= Rssi_Low_bound)
|
||||
pDM_PSTable->CurRFState = RF_Normal;
|
||||
else
|
||||
pDM_PSTable->CurRFState = RF_Save;
|
||||
}
|
||||
}
|
||||
else
|
||||
pDM_PSTable->CurRFState=RF_MAX;
|
||||
}
|
||||
else
|
||||
{
|
||||
pDM_PSTable->CurRFState = RF_Normal;
|
||||
}
|
||||
|
||||
if(pDM_PSTable->PreRFState != pDM_PSTable->CurRFState)
|
||||
{
|
||||
if(pDM_PSTable->CurRFState == RF_Save)
|
||||
{
|
||||
// <tynli_note> 8723 RSSI report will be wrong. Set 0x874[5]=1 when enter BB power saving mode.
|
||||
// Suggested by SD3 Yu-Nan. 2011.01.20.
|
||||
if(pDM_Odm->SupportICType == ODM_RTL8723A)
|
||||
{
|
||||
ODM_SetBBReg(pDM_Odm, 0x874 , BIT5, 0x1); //Reg874[5]=1b'1
|
||||
}
|
||||
ODM_SetBBReg(pDM_Odm, 0x874 , 0x1C0000, 0x2); //Reg874[20:18]=3'b010
|
||||
ODM_SetBBReg(pDM_Odm, 0xc70, BIT3, 0); //RegC70[3]=1'b0
|
||||
ODM_SetBBReg(pDM_Odm, 0x85c, 0xFF000000, 0x63); //Reg85C[31:24]=0x63
|
||||
ODM_SetBBReg(pDM_Odm, 0x874, 0xC000, 0x2); //Reg874[15:14]=2'b10
|
||||
ODM_SetBBReg(pDM_Odm, 0xa74, 0xF000, 0x3); //RegA75[7:4]=0x3
|
||||
ODM_SetBBReg(pDM_Odm, 0x818, BIT28, 0x0); //Reg818[28]=1'b0
|
||||
ODM_SetBBReg(pDM_Odm, 0x818, BIT28, 0x1); //Reg818[28]=1'b1
|
||||
}
|
||||
else
|
||||
{
|
||||
ODM_SetBBReg(pDM_Odm, 0x874 , 0x1CC000, pDM_PSTable->Reg874);
|
||||
ODM_SetBBReg(pDM_Odm, 0xc70, BIT3, pDM_PSTable->RegC70);
|
||||
ODM_SetBBReg(pDM_Odm, 0x85c, 0xFF000000, pDM_PSTable->Reg85C);
|
||||
ODM_SetBBReg(pDM_Odm, 0xa74, 0xF000, pDM_PSTable->RegA74);
|
||||
ODM_SetBBReg(pDM_Odm,0x818, BIT28, 0x0);
|
||||
|
||||
if(pDM_Odm->SupportICType == ODM_RTL8723A)
|
||||
{
|
||||
ODM_SetBBReg(pDM_Odm,0x874 , BIT5, 0x0); //Reg874[5]=1b'0
|
||||
}
|
||||
}
|
||||
pDM_PSTable->PreRFState =pDM_PSTable->CurRFState;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
63
hal/phydm/phydm_dynamicbbpowersaving.h
Normal file
63
hal/phydm/phydm_dynamicbbpowersaving.h
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __PHYDMDYNAMICBBPOWERSAVING_H__
|
||||
#define __PHYDMDYNAMICBBPOWERSAVING_H__
|
||||
|
||||
#define DYNAMIC_BBPWRSAV_VERSION "1.0"
|
||||
|
||||
typedef struct _Dynamic_Power_Saving_
|
||||
{
|
||||
u1Byte PreCCAState;
|
||||
u1Byte CurCCAState;
|
||||
|
||||
u1Byte PreRFState;
|
||||
u1Byte CurRFState;
|
||||
|
||||
int Rssi_val_min;
|
||||
|
||||
u1Byte initialize;
|
||||
u4Byte Reg874,RegC70,Reg85C,RegA74;
|
||||
|
||||
}PS_T,*pPS_T;
|
||||
|
||||
#define dm_RF_Saving ODM_RF_Saving
|
||||
|
||||
void ODM_RF_Saving(
|
||||
IN PVOID pDM_VOID,
|
||||
IN u1Byte bForceInNormal
|
||||
);
|
||||
|
||||
VOID
|
||||
odm_DynamicBBPowerSavingInit(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
odm_DynamicBBPowerSaving(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
odm_1R_CCA(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
#endif
|
||||
633
hal/phydm/phydm_dynamictxpower.c
Normal file
633
hal/phydm/phydm_dynamictxpower.c
Normal file
|
|
@ -0,0 +1,633 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
//============================================================
|
||||
// include files
|
||||
//============================================================
|
||||
#include "mp_precomp.h"
|
||||
#include "phydm_precomp.h"
|
||||
|
||||
VOID
|
||||
odm_DynamicTxPowerInit(
|
||||
IN PVOID pDM_VOID
|
||||
)
|
||||
{
|
||||
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
|
||||
PADAPTER Adapter = pDM_Odm->Adapter;
|
||||
PMGNT_INFO pMgntInfo = &Adapter->MgntInfo;
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
|
||||
|
||||
#if DEV_BUS_TYPE==RT_USB_INTERFACE
|
||||
if(RT_GetInterfaceSelection(Adapter) == INTF_SEL1_USB_High_Power)
|
||||
{
|
||||
odm_DynamicTxPowerSavePowerIndex(pDM_Odm);
|
||||
pMgntInfo->bDynamicTxPowerEnable = TRUE;
|
||||
}
|
||||
else
|
||||
#else
|
||||
//so 92c pci do not need dynamic tx power? vivi check it later
|
||||
if(IS_HARDWARE_TYPE_8192D(Adapter))
|
||||
pMgntInfo->bDynamicTxPowerEnable = TRUE;
|
||||
else
|
||||
pMgntInfo->bDynamicTxPowerEnable = FALSE;
|
||||
#endif
|
||||
|
||||
|
||||
pHalData->LastDTPLvl = TxHighPwrLevel_Normal;
|
||||
pHalData->DynamicTxHighPowerLvl = TxHighPwrLevel_Normal;
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
VOID
|
||||
odm_DynamicTxPowerSavePowerIndex(
|
||||
IN PVOID pDM_VOID
|
||||
)
|
||||
{
|
||||
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
|
||||
#if (DM_ODM_SUPPORT_TYPE & (ODM_CE|ODM_WIN))
|
||||
u1Byte index;
|
||||
u4Byte Power_Index_REG[6] = {0xc90, 0xc91, 0xc92, 0xc98, 0xc99, 0xc9a};
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
|
||||
PADAPTER Adapter = pDM_Odm->Adapter;
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
|
||||
for(index = 0; index< 6; index++)
|
||||
pHalData->PowerIndex_backup[index] = PlatformEFIORead1Byte(Adapter, Power_Index_REG[index]);
|
||||
|
||||
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
VOID
|
||||
odm_DynamicTxPowerRestorePowerIndex(
|
||||
IN PVOID pDM_VOID
|
||||
)
|
||||
{
|
||||
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
|
||||
#if (DM_ODM_SUPPORT_TYPE & (ODM_CE|ODM_WIN))
|
||||
u1Byte index;
|
||||
PADAPTER Adapter = pDM_Odm->Adapter;
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
|
||||
u4Byte Power_Index_REG[6] = {0xc90, 0xc91, 0xc92, 0xc98, 0xc99, 0xc9a};
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
|
||||
for(index = 0; index< 6; index++)
|
||||
PlatformEFIOWrite1Byte(Adapter, Power_Index_REG[index], pHalData->PowerIndex_backup[index]);
|
||||
|
||||
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
VOID
|
||||
odm_DynamicTxPowerWritePowerIndex(
|
||||
IN PVOID pDM_VOID,
|
||||
IN u1Byte Value)
|
||||
{
|
||||
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
|
||||
u1Byte index;
|
||||
u4Byte Power_Index_REG[6] = {0xc90, 0xc91, 0xc92, 0xc98, 0xc99, 0xc9a};
|
||||
|
||||
for(index = 0; index< 6; index++)
|
||||
//PlatformEFIOWrite1Byte(Adapter, Power_Index_REG[index], Value);
|
||||
ODM_Write1Byte(pDM_Odm, Power_Index_REG[index], Value);
|
||||
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
odm_DynamicTxPower(
|
||||
IN PVOID pDM_VOID
|
||||
)
|
||||
{
|
||||
//
|
||||
// For AP/ADSL use prtl8192cd_priv
|
||||
// For CE/NIC use PADAPTER
|
||||
//
|
||||
//PADAPTER pAdapter = pDM_Odm->Adapter;
|
||||
// prtl8192cd_priv priv = pDM_Odm->priv;
|
||||
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
|
||||
if (!(pDM_Odm->SupportAbility & ODM_BB_DYNAMIC_TXPWR))
|
||||
return;
|
||||
//
|
||||
// 2011/09/29 MH In HW integration first stage, we provide 4 different handle to operate
|
||||
// at the same time. In the stage2/3, we need to prive universal interface and merge all
|
||||
// HW dynamic mechanism.
|
||||
//
|
||||
switch (pDM_Odm->SupportPlatform)
|
||||
{
|
||||
case ODM_WIN:
|
||||
case ODM_CE:
|
||||
odm_DynamicTxPowerNIC(pDM_Odm);
|
||||
break;
|
||||
case ODM_AP:
|
||||
odm_DynamicTxPowerAP(pDM_Odm);
|
||||
break;
|
||||
|
||||
case ODM_ADSL:
|
||||
//odm_DIGAP(pDM_Odm);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
odm_DynamicTxPowerNIC(
|
||||
IN PVOID pDM_VOID
|
||||
)
|
||||
{
|
||||
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
|
||||
|
||||
if (!(pDM_Odm->SupportAbility & ODM_BB_DYNAMIC_TXPWR))
|
||||
return;
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE))
|
||||
|
||||
if(pDM_Odm->SupportICType == ODM_RTL8192C)
|
||||
{
|
||||
odm_DynamicTxPower_92C(pDM_Odm);
|
||||
}
|
||||
else if(pDM_Odm->SupportICType == ODM_RTL8192D)
|
||||
{
|
||||
odm_DynamicTxPower_92D(pDM_Odm);
|
||||
}
|
||||
else if (pDM_Odm->SupportICType == ODM_RTL8821)
|
||||
{
|
||||
#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN))
|
||||
PADAPTER Adapter = pDM_Odm->Adapter;
|
||||
PMGNT_INFO pMgntInfo = GetDefaultMgntInfo(Adapter);
|
||||
|
||||
if (pMgntInfo->RegRspPwr == 1)
|
||||
{
|
||||
if(pDM_Odm->RSSI_Min > 60)
|
||||
{
|
||||
ODM_SetMACReg(pDM_Odm, ODM_REG_RESP_TX_11AC, BIT20|BIT19|BIT18, 1); // Resp TXAGC offset = -3dB
|
||||
|
||||
}
|
||||
else if(pDM_Odm->RSSI_Min < 55)
|
||||
{
|
||||
ODM_SetMACReg(pDM_Odm, ODM_REG_RESP_TX_11AC, BIT20|BIT19|BIT18, 0); // Resp TXAGC offset = 0dB
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
VOID
|
||||
odm_DynamicTxPowerAP(
|
||||
IN PVOID pDM_VOID
|
||||
|
||||
)
|
||||
{
|
||||
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_AP)
|
||||
|
||||
//#if ((RTL8192C_SUPPORT==1) || (RTL8192D_SUPPORT==1) || (RTL8188E_SUPPORT==1) || (RTL8812E_SUPPORT==1))
|
||||
|
||||
|
||||
prtl8192cd_priv priv = pDM_Odm->priv;
|
||||
s4Byte i;
|
||||
s2Byte pwr_thd = TX_POWER_NEAR_FIELD_THRESH_AP;
|
||||
|
||||
if(!priv->pshare->rf_ft_var.tx_pwr_ctrl)
|
||||
return;
|
||||
|
||||
#if ((RTL8812E_SUPPORT==1) || (RTL8881A_SUPPORT==1) || (RTL8814A_SUPPORT==1))
|
||||
if (pDM_Odm->SupportICType & (ODM_RTL8812 | ODM_RTL8881A | ODM_RTL8814A))
|
||||
pwr_thd = TX_POWER_NEAR_FIELD_THRESH_8812;
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL_92D_SUPPORT) || defined(CONFIG_RTL_92C_SUPPORT)
|
||||
if(CHIP_VER_92X_SERIES(priv))
|
||||
{
|
||||
#ifdef HIGH_POWER_EXT_PA
|
||||
if(pDM_Odm->ExtPA)
|
||||
tx_power_control(priv);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
* Check if station is near by to use lower tx power
|
||||
*/
|
||||
|
||||
if ((priv->up_time % 3) == 0 ) {
|
||||
int disable_pwr_ctrl = ((pDM_Odm->FalseAlmCnt.Cnt_all > 1000 ) || ((pDM_Odm->FalseAlmCnt.Cnt_all > 300 ) && ((RTL_R8(0xc50) & 0x7f) >= 0x32))) ? 1 : 0;
|
||||
|
||||
for(i=0; i<ODM_ASSOCIATE_ENTRY_NUM; i++){
|
||||
PSTA_INFO_T pstat = pDM_Odm->pODM_StaInfo[i];
|
||||
if(IS_STA_VALID(pstat) ) {
|
||||
if(disable_pwr_ctrl)
|
||||
pstat->hp_level = 0;
|
||||
else if ((pstat->hp_level == 0) && (pstat->rssi > pwr_thd))
|
||||
pstat->hp_level = 1;
|
||||
else if ((pstat->hp_level == 1) && (pstat->rssi < (pwr_thd-8)))
|
||||
pstat->hp_level = 0;
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(CONFIG_WLAN_HAL_8192EE)
|
||||
if (GET_CHIP_VER(priv) == VERSION_8192E) {
|
||||
if( !disable_pwr_ctrl && (pDM_Odm->RSSI_Min != 0xff) ) {
|
||||
if(pDM_Odm->RSSI_Min > pwr_thd)
|
||||
RRSR_power_control_11n(priv, 1 );
|
||||
else if(pDM_Odm->RSSI_Min < (pwr_thd-8))
|
||||
RRSR_power_control_11n(priv, 0 );
|
||||
} else {
|
||||
RRSR_power_control_11n(priv, 0 );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_WLAN_HAL_8814AE
|
||||
if (GET_CHIP_VER(priv) == VERSION_8814A) {
|
||||
if (!disable_pwr_ctrl && (pDM_Odm->RSSI_Min != 0xff)) {
|
||||
if (pDM_Odm->RSSI_Min > pwr_thd)
|
||||
RRSR_power_control_14(priv, 1);
|
||||
else if (pDM_Odm->RSSI_Min < (pwr_thd-8))
|
||||
RRSR_power_control_14(priv, 0);
|
||||
} else {
|
||||
RRSR_power_control_14(priv, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
//#endif
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
odm_DynamicTxPower_92C(
|
||||
IN PVOID pDM_VOID
|
||||
)
|
||||
{
|
||||
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
|
||||
PADAPTER Adapter = pDM_Odm->Adapter;
|
||||
PMGNT_INFO pMgntInfo = &Adapter->MgntInfo;
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
|
||||
s4Byte UndecoratedSmoothedPWDB;
|
||||
|
||||
// 2012/01/12 MH According to Luke's suggestion, only high power will support the feature.
|
||||
if (pDM_Odm->ExtPA == FALSE)
|
||||
return;
|
||||
|
||||
// STA not connected and AP not connected
|
||||
if((!pMgntInfo->bMediaConnect) &&
|
||||
(pHalData->EntryMinUndecoratedSmoothedPWDB == 0))
|
||||
{
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD, ("Not connected to any \n"));
|
||||
pHalData->DynamicTxHighPowerLvl = TxHighPwrLevel_Normal;
|
||||
|
||||
//the LastDTPlvl should reset when disconnect,
|
||||
//otherwise the tx power level wouldn't change when disconnect and connect again.
|
||||
// Maddest 20091220.
|
||||
pHalData->LastDTPLvl=TxHighPwrLevel_Normal;
|
||||
return;
|
||||
}
|
||||
|
||||
#if (INTEL_PROXIMITY_SUPPORT == 1)
|
||||
// Intel set fixed tx power
|
||||
if(pMgntInfo->IntelProximityModeInfo.PowerOutput > 0)
|
||||
{
|
||||
switch(pMgntInfo->IntelProximityModeInfo.PowerOutput){
|
||||
case 1:
|
||||
pHalData->DynamicTxHighPowerLvl = TxHighPwrLevel_100;
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD, ("TxHighPwrLevel_100\n"));
|
||||
break;
|
||||
case 2:
|
||||
pHalData->DynamicTxHighPowerLvl = TxHighPwrLevel_70;
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD, ("TxHighPwrLevel_70\n"));
|
||||
break;
|
||||
case 3:
|
||||
pHalData->DynamicTxHighPowerLvl = TxHighPwrLevel_50;
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD, ("TxHighPwrLevel_50\n"));
|
||||
break;
|
||||
case 4:
|
||||
pHalData->DynamicTxHighPowerLvl = TxHighPwrLevel_35;
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD, ("TxHighPwrLevel_35\n"));
|
||||
break;
|
||||
case 5:
|
||||
pHalData->DynamicTxHighPowerLvl = TxHighPwrLevel_15;
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD, ("TxHighPwrLevel_15\n"));
|
||||
break;
|
||||
default:
|
||||
pHalData->DynamicTxHighPowerLvl = TxHighPwrLevel_100;
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD, ("TxHighPwrLevel_100\n"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
if( (pMgntInfo->bDynamicTxPowerEnable != TRUE) ||
|
||||
pMgntInfo->IOTAction & HT_IOT_ACT_DISABLE_HIGH_POWER)
|
||||
{
|
||||
pHalData->DynamicTxHighPowerLvl = TxHighPwrLevel_Normal;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(pMgntInfo->bMediaConnect) // Default port
|
||||
{
|
||||
if(ACTING_AS_AP(Adapter) || ACTING_AS_IBSS(Adapter))
|
||||
{
|
||||
UndecoratedSmoothedPWDB = pHalData->EntryMinUndecoratedSmoothedPWDB;
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD, ("AP Client PWDB = 0x%x \n", UndecoratedSmoothedPWDB));
|
||||
}
|
||||
else
|
||||
{
|
||||
UndecoratedSmoothedPWDB = pHalData->UndecoratedSmoothedPWDB;
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD, ("STA Default Port PWDB = 0x%x \n", UndecoratedSmoothedPWDB));
|
||||
}
|
||||
}
|
||||
else // associated entry pwdb
|
||||
{
|
||||
UndecoratedSmoothedPWDB = pHalData->EntryMinUndecoratedSmoothedPWDB;
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD, ("AP Ext Port PWDB = 0x%x \n", UndecoratedSmoothedPWDB));
|
||||
}
|
||||
|
||||
if(UndecoratedSmoothedPWDB >= TX_POWER_NEAR_FIELD_THRESH_LVL2)
|
||||
{
|
||||
pHalData->DynamicTxHighPowerLvl = TxHighPwrLevel_Level2;
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD, ("TxHighPwrLevel_Level1 (TxPwr=0x0)\n"));
|
||||
}
|
||||
else if((UndecoratedSmoothedPWDB < (TX_POWER_NEAR_FIELD_THRESH_LVL2-3)) &&
|
||||
(UndecoratedSmoothedPWDB >= TX_POWER_NEAR_FIELD_THRESH_LVL1) )
|
||||
{
|
||||
pHalData->DynamicTxHighPowerLvl = TxHighPwrLevel_Level1;
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD, ("TxHighPwrLevel_Level1 (TxPwr=0x10)\n"));
|
||||
}
|
||||
else if(UndecoratedSmoothedPWDB < (TX_POWER_NEAR_FIELD_THRESH_LVL1-5))
|
||||
{
|
||||
pHalData->DynamicTxHighPowerLvl = TxHighPwrLevel_Normal;
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD, ("TxHighPwrLevel_Normal\n"));
|
||||
}
|
||||
}
|
||||
}
|
||||
if( pHalData->DynamicTxHighPowerLvl != pHalData->LastDTPLvl )
|
||||
{
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD, ("PHY_SetTxPowerLevel8192C() Channel = %d \n" , pHalData->CurrentChannel));
|
||||
PHY_SetTxPowerLevel8192C(Adapter, pHalData->CurrentChannel);
|
||||
if( (pHalData->DynamicTxHighPowerLvl == TxHighPwrLevel_Normal) &&
|
||||
(pHalData->LastDTPLvl == TxHighPwrLevel_Level1 || pHalData->LastDTPLvl == TxHighPwrLevel_Level2)) //TxHighPwrLevel_Normal
|
||||
odm_DynamicTxPowerRestorePowerIndex(pDM_Odm);
|
||||
else if(pHalData->DynamicTxHighPowerLvl == TxHighPwrLevel_Level1)
|
||||
odm_DynamicTxPowerWritePowerIndex(pDM_Odm, 0x14);
|
||||
else if(pHalData->DynamicTxHighPowerLvl == TxHighPwrLevel_Level2)
|
||||
odm_DynamicTxPowerWritePowerIndex(pDM_Odm, 0x10);
|
||||
}
|
||||
pHalData->LastDTPLvl = pHalData->DynamicTxHighPowerLvl;
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // #if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
|
||||
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
odm_DynamicTxPower_92D(
|
||||
IN PVOID pDM_VOID
|
||||
)
|
||||
{
|
||||
#if (RTL8192D_SUPPORT==1)
|
||||
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
|
||||
PADAPTER Adapter = pDM_Odm->Adapter;
|
||||
PMGNT_INFO pMgntInfo = &Adapter->MgntInfo;
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
|
||||
s4Byte UndecoratedSmoothedPWDB;
|
||||
|
||||
PADAPTER BuddyAdapter = Adapter->BuddyAdapter;
|
||||
BOOLEAN bGetValueFromBuddyAdapter = dm_DualMacGetParameterFromBuddyAdapter(Adapter);
|
||||
u1Byte HighPowerLvlBackForMac0 = TxHighPwrLevel_Level1;
|
||||
|
||||
// 2012/01/12 MH According to Luke's suggestion, only high power will support the feature.
|
||||
if (pDM_Odm->ExtPA == FALSE)
|
||||
return;
|
||||
|
||||
// If dynamic high power is disabled.
|
||||
if( (pMgntInfo->bDynamicTxPowerEnable != TRUE) ||
|
||||
pMgntInfo->IOTAction & HT_IOT_ACT_DISABLE_HIGH_POWER)
|
||||
{
|
||||
pHalData->DynamicTxHighPowerLvl = TxHighPwrLevel_Normal;
|
||||
return;
|
||||
}
|
||||
|
||||
// STA not connected and AP not connected
|
||||
if((!pMgntInfo->bMediaConnect) &&
|
||||
(pHalData->EntryMinUndecoratedSmoothedPWDB == 0))
|
||||
{
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD, ("Not connected to any \n"));
|
||||
pHalData->DynamicTxHighPowerLvl = TxHighPwrLevel_Normal;
|
||||
|
||||
//the LastDTPlvl should reset when disconnect,
|
||||
//otherwise the tx power level wouldn't change when disconnect and connect again.
|
||||
// Maddest 20091220.
|
||||
pHalData->LastDTPLvl=TxHighPwrLevel_Normal;
|
||||
return;
|
||||
}
|
||||
|
||||
if(pMgntInfo->bMediaConnect) // Default port
|
||||
{
|
||||
if(ACTING_AS_AP(Adapter) || pMgntInfo->mIbss)
|
||||
{
|
||||
UndecoratedSmoothedPWDB = pHalData->EntryMinUndecoratedSmoothedPWDB;
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD, ("AP Client PWDB = 0x%x \n", UndecoratedSmoothedPWDB));
|
||||
}
|
||||
else
|
||||
{
|
||||
UndecoratedSmoothedPWDB = pHalData->UndecoratedSmoothedPWDB;
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD, ("STA Default Port PWDB = 0x%x \n", UndecoratedSmoothedPWDB));
|
||||
}
|
||||
}
|
||||
else // associated entry pwdb
|
||||
{
|
||||
UndecoratedSmoothedPWDB = pHalData->EntryMinUndecoratedSmoothedPWDB;
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD, ("AP Ext Port PWDB = 0x%x \n", UndecoratedSmoothedPWDB));
|
||||
}
|
||||
|
||||
if(IS_HARDWARE_TYPE_8192D(Adapter) && GET_HAL_DATA(Adapter)->CurrentBandType == 1){
|
||||
if(UndecoratedSmoothedPWDB >= 0x33)
|
||||
{
|
||||
pHalData->DynamicTxHighPowerLvl = TxHighPwrLevel_Level2;
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD, ("5G:TxHighPwrLevel_Level2 (TxPwr=0x0)\n"));
|
||||
}
|
||||
else if((UndecoratedSmoothedPWDB <0x33) &&
|
||||
(UndecoratedSmoothedPWDB >= 0x2b) )
|
||||
{
|
||||
pHalData->DynamicTxHighPowerLvl = TxHighPwrLevel_Level1;
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD, ("5G:TxHighPwrLevel_Level1 (TxPwr=0x10)\n"));
|
||||
}
|
||||
else if(UndecoratedSmoothedPWDB < 0x2b)
|
||||
{
|
||||
pHalData->DynamicTxHighPowerLvl = TxHighPwrLevel_Normal;
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD, ("5G:TxHighPwrLevel_Normal\n"));
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
|
||||
{
|
||||
if(UndecoratedSmoothedPWDB >= TX_POWER_NEAR_FIELD_THRESH_LVL2)
|
||||
{
|
||||
pHalData->DynamicTxHighPowerLvl = TxHighPwrLevel_Level1;
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD, ("TxHighPwrLevel_Level1 (TxPwr=0x0)\n"));
|
||||
}
|
||||
else if((UndecoratedSmoothedPWDB < (TX_POWER_NEAR_FIELD_THRESH_LVL2-3)) &&
|
||||
(UndecoratedSmoothedPWDB >= TX_POWER_NEAR_FIELD_THRESH_LVL1) )
|
||||
{
|
||||
pHalData->DynamicTxHighPowerLvl = TxHighPwrLevel_Level1;
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD, ("TxHighPwrLevel_Level1 (TxPwr=0x10)\n"));
|
||||
}
|
||||
else if(UndecoratedSmoothedPWDB < (TX_POWER_NEAR_FIELD_THRESH_LVL1-5))
|
||||
{
|
||||
pHalData->DynamicTxHighPowerLvl = TxHighPwrLevel_Normal;
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD, ("TxHighPwrLevel_Normal\n"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//sherry delete flag 20110517
|
||||
if(bGetValueFromBuddyAdapter)
|
||||
{
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR,DBG_LOUD,("dm_DynamicTxPower() mac 0 for mac 1 \n"));
|
||||
if(Adapter->DualMacDMSPControl.bChangeTxHighPowerLvlForAnotherMacOfDMSP)
|
||||
{
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR,DBG_LOUD,("dm_DynamicTxPower() change value \n"));
|
||||
HighPowerLvlBackForMac0 = pHalData->DynamicTxHighPowerLvl;
|
||||
pHalData->DynamicTxHighPowerLvl = Adapter->DualMacDMSPControl.CurTxHighLvlForAnotherMacOfDMSP;
|
||||
PHY_SetTxPowerLevel8192C(Adapter, pHalData->CurrentChannel);
|
||||
pHalData->DynamicTxHighPowerLvl = HighPowerLvlBackForMac0;
|
||||
Adapter->DualMacDMSPControl.bChangeTxHighPowerLvlForAnotherMacOfDMSP = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if( (pHalData->DynamicTxHighPowerLvl != pHalData->LastDTPLvl) )
|
||||
{
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD, ("PHY_SetTxPowerLevel8192S() Channel = %d \n" , pHalData->CurrentChannel));
|
||||
if(Adapter->DualMacSmartConcurrent == TRUE)
|
||||
{
|
||||
if(BuddyAdapter == NULL)
|
||||
{
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR,DBG_LOUD,("dm_DynamicTxPower() BuddyAdapter == NULL case \n"));
|
||||
if(!Adapter->bSlaveOfDMSP)
|
||||
{
|
||||
PHY_SetTxPowerLevel8192C(Adapter, pHalData->CurrentChannel);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(pHalData->MacPhyMode92D == DUALMAC_SINGLEPHY)
|
||||
{
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR,DBG_LOUD,("dm_DynamicTxPower() BuddyAdapter DMSP \n"));
|
||||
if(Adapter->bSlaveOfDMSP)
|
||||
{
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR,DBG_LOUD,("dm_DynamicTxPower() bslave case \n"));
|
||||
BuddyAdapter->DualMacDMSPControl.bChangeTxHighPowerLvlForAnotherMacOfDMSP = TRUE;
|
||||
BuddyAdapter->DualMacDMSPControl.CurTxHighLvlForAnotherMacOfDMSP = pHalData->DynamicTxHighPowerLvl;
|
||||
}
|
||||
else
|
||||
{
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR,DBG_LOUD,("dm_DynamicTxPower() master case \n"));
|
||||
if(!bGetValueFromBuddyAdapter)
|
||||
{
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR,DBG_LOUD,("dm_DynamicTxPower() mac 0 for mac 0 \n"));
|
||||
PHY_SetTxPowerLevel8192C(Adapter, pHalData->CurrentChannel);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR,DBG_LOUD,("dm_DynamicTxPower() BuddyAdapter DMDP\n"));
|
||||
PHY_SetTxPowerLevel8192C(Adapter, pHalData->CurrentChannel);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
PHY_SetTxPowerLevel8192C(Adapter, pHalData->CurrentChannel);
|
||||
}
|
||||
|
||||
}
|
||||
pHalData->LastDTPLvl = pHalData->DynamicTxHighPowerLvl;
|
||||
|
||||
|
||||
#endif // #if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
|
||||
#endif
|
||||
}
|
||||
|
||||
VOID
|
||||
odm_DynamicTxPower_8821(
|
||||
IN PVOID pDM_VOID,
|
||||
IN pu1Byte pDesc,
|
||||
IN u1Byte macId
|
||||
)
|
||||
{
|
||||
#if (RTL8821A_SUPPORT == 1)
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
|
||||
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
|
||||
PSTA_INFO_T pEntry;
|
||||
u1Byte reg0xc56_byte;
|
||||
u1Byte reg0xe56_byte;
|
||||
u1Byte txpwr_offset = 0;
|
||||
|
||||
pEntry = pDM_Odm->pODM_StaInfo[macId];
|
||||
|
||||
reg0xc56_byte = ODM_Read1Byte(pDM_Odm, 0xc56);
|
||||
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD, ("reg0xc56_byte=%d\n", reg0xc56_byte));
|
||||
|
||||
if (pEntry[macId].rssi_stat.UndecoratedSmoothedPWDB > 85) {
|
||||
|
||||
/* Avoid TXAGC error after TX power offset is applied.
|
||||
For example: Reg0xc56=0x6, if txpwr_offset=3( reduce 11dB )
|
||||
Total power = 6-11= -5( overflow!! ), PA may be burned !
|
||||
so txpwr_offset should be adjusted by Reg0xc56*/
|
||||
|
||||
if (reg0xc56_byte < 7)
|
||||
txpwr_offset = 1;
|
||||
else if (reg0xc56_byte < 11)
|
||||
txpwr_offset = 2;
|
||||
else
|
||||
txpwr_offset = 3;
|
||||
|
||||
SET_TX_DESC_TX_POWER_OFFSET_8812(pDesc, txpwr_offset);
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD, ("odm_DynamicTxPower_8821: RSSI=%d, txpwr_offset=%d\n", pEntry[macId].rssi_stat.UndecoratedSmoothedPWDB, txpwr_offset));
|
||||
|
||||
} else{
|
||||
SET_TX_DESC_TX_POWER_OFFSET_8812(pDesc, txpwr_offset);
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD, ("odm_DynamicTxPower_8821: RSSI=%d, txpwr_offset=%d\n", pEntry[macId].rssi_stat.UndecoratedSmoothedPWDB, txpwr_offset));
|
||||
|
||||
}
|
||||
#endif /*#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)*/
|
||||
#endif /*#if (RTL8821A_SUPPORT==1)*/
|
||||
}
|
||||
|
||||
98
hal/phydm/phydm_dynamictxpower.h
Normal file
98
hal/phydm/phydm_dynamictxpower.h
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __PHYDMDYNAMICTXPOWER_H__
|
||||
#define __PHYDMDYNAMICTXPOWER_H__
|
||||
|
||||
/*#define DYNAMIC_TXPWR_VERSION "1.0"*/
|
||||
#define DYNAMIC_TXPWR_VERSION "1.1" /*2015.01.13*/
|
||||
|
||||
#define TX_POWER_NEAR_FIELD_THRESH_LVL2 74
|
||||
#define TX_POWER_NEAR_FIELD_THRESH_LVL1 67
|
||||
#define TX_POWER_NEAR_FIELD_THRESH_AP 0x3F
|
||||
#define TX_POWER_NEAR_FIELD_THRESH_8812 60
|
||||
|
||||
#define TxHighPwrLevel_Normal 0
|
||||
#define TxHighPwrLevel_Level1 1
|
||||
#define TxHighPwrLevel_Level2 2
|
||||
#define TxHighPwrLevel_BT1 3
|
||||
#define TxHighPwrLevel_BT2 4
|
||||
#define TxHighPwrLevel_15 5
|
||||
#define TxHighPwrLevel_35 6
|
||||
#define TxHighPwrLevel_50 7
|
||||
#define TxHighPwrLevel_70 8
|
||||
#define TxHighPwrLevel_100 9
|
||||
|
||||
VOID
|
||||
odm_DynamicTxPowerInit(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
odm_DynamicTxPowerRestorePowerIndex(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
odm_DynamicTxPowerNIC(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
#if(DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE))
|
||||
VOID
|
||||
odm_DynamicTxPowerSavePowerIndex(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
odm_DynamicTxPowerWritePowerIndex(
|
||||
IN PVOID pDM_VOID,
|
||||
IN u1Byte Value);
|
||||
|
||||
VOID
|
||||
odm_DynamicTxPower_92C(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
odm_DynamicTxPower_92D(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
odm_DynamicTxPower_8821(
|
||||
IN PVOID pDM_VOID,
|
||||
IN pu1Byte pDesc,
|
||||
IN u1Byte macId
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
VOID
|
||||
odm_DynamicTxPower(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
odm_DynamicTxPowerAP(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
#endif
|
||||
835
hal/phydm/phydm_edcaturbocheck.c
Normal file
835
hal/phydm/phydm_edcaturbocheck.c
Normal file
|
|
@ -0,0 +1,835 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
//============================================================
|
||||
// include files
|
||||
//============================================================
|
||||
#include "mp_precomp.h"
|
||||
#include "phydm_precomp.h"
|
||||
|
||||
VOID
|
||||
ODM_EdcaTurboInit(
|
||||
IN PVOID pDM_VOID)
|
||||
{
|
||||
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE==ODM_WIN)
|
||||
PADAPTER Adapter = NULL;
|
||||
HAL_DATA_TYPE *pHalData = NULL;
|
||||
|
||||
if(pDM_Odm->Adapter==NULL) {
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("EdcaTurboInit fail!!!\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
Adapter=pDM_Odm->Adapter;
|
||||
pHalData=GET_HAL_DATA(Adapter);
|
||||
|
||||
pDM_Odm->DM_EDCA_Table.bCurrentTurboEDCA = FALSE;
|
||||
pDM_Odm->DM_EDCA_Table.bIsCurRDLState = FALSE;
|
||||
pHalData->bIsAnyNonBEPkts = FALSE;
|
||||
|
||||
#elif(DM_ODM_SUPPORT_TYPE==ODM_CE)
|
||||
PADAPTER Adapter = pDM_Odm->Adapter;
|
||||
pDM_Odm->DM_EDCA_Table.bCurrentTurboEDCA = FALSE;
|
||||
pDM_Odm->DM_EDCA_Table.bIsCurRDLState = FALSE;
|
||||
Adapter->recvpriv.bIsAnyNonBEPkts =FALSE;
|
||||
|
||||
#endif
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("Orginial VO PARAM: 0x%x\n",ODM_Read4Byte(pDM_Odm,ODM_EDCA_VO_PARAM)));
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("Orginial VI PARAM: 0x%x\n",ODM_Read4Byte(pDM_Odm,ODM_EDCA_VI_PARAM)));
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("Orginial BE PARAM: 0x%x\n",ODM_Read4Byte(pDM_Odm,ODM_EDCA_BE_PARAM)));
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("Orginial BK PARAM: 0x%x\n",ODM_Read4Byte(pDM_Odm,ODM_EDCA_BK_PARAM)));
|
||||
|
||||
|
||||
} // ODM_InitEdcaTurbo
|
||||
|
||||
VOID
|
||||
odm_EdcaTurboCheck(
|
||||
IN PVOID pDM_VOID
|
||||
)
|
||||
{
|
||||
//
|
||||
// For AP/ADSL use prtl8192cd_priv
|
||||
// For CE/NIC use PADAPTER
|
||||
//
|
||||
|
||||
//
|
||||
// 2011/09/29 MH In HW integration first stage, we provide 4 different handle to operate
|
||||
// at the same time. In the stage2/3, we need to prive universal interface and merge all
|
||||
// HW dynamic mechanism.
|
||||
//
|
||||
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("odm_EdcaTurboCheck========================>\n"));
|
||||
|
||||
if(!(pDM_Odm->SupportAbility& ODM_MAC_EDCA_TURBO ))
|
||||
return;
|
||||
|
||||
switch (pDM_Odm->SupportPlatform)
|
||||
{
|
||||
case ODM_WIN:
|
||||
|
||||
#if(DM_ODM_SUPPORT_TYPE==ODM_WIN)
|
||||
odm_EdcaTurboCheckMP(pDM_Odm);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case ODM_CE:
|
||||
#if(DM_ODM_SUPPORT_TYPE==ODM_CE)
|
||||
odm_EdcaTurboCheckCE(pDM_Odm);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("<========================odm_EdcaTurboCheck\n"));
|
||||
|
||||
} // odm_CheckEdcaTurbo
|
||||
|
||||
#if(DM_ODM_SUPPORT_TYPE==ODM_CE)
|
||||
|
||||
|
||||
VOID
|
||||
odm_EdcaTurboCheckCE(
|
||||
IN PVOID pDM_VOID
|
||||
)
|
||||
{
|
||||
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
|
||||
PADAPTER Adapter = pDM_Odm->Adapter;
|
||||
u32 EDCA_BE_UL = 0x5ea42b;//Parameter suggested by Scott //edca_setting_UL[pMgntInfo->IOTPeer];
|
||||
u32 EDCA_BE_DL = 0x5ea42b;//Parameter suggested by Scott //edca_setting_DL[pMgntInfo->IOTPeer];
|
||||
u32 ICType=pDM_Odm->SupportICType;
|
||||
u32 IOTPeer=0;
|
||||
u8 WirelessMode=0xFF; //invalid value
|
||||
u32 trafficIndex;
|
||||
u32 edca_param;
|
||||
u64 cur_tx_bytes = 0;
|
||||
u64 cur_rx_bytes = 0;
|
||||
u8 bbtchange = _FALSE;
|
||||
u8 bBiasOnRx = _FALSE;
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
|
||||
struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(Adapter);
|
||||
struct xmit_priv *pxmitpriv = &(Adapter->xmitpriv);
|
||||
struct recv_priv *precvpriv = &(Adapter->recvpriv);
|
||||
struct registry_priv *pregpriv = &Adapter->registrypriv;
|
||||
struct mlme_ext_priv *pmlmeext = &(Adapter->mlmeextpriv);
|
||||
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
|
||||
|
||||
if(pDM_Odm->bLinked != _TRUE)
|
||||
{
|
||||
precvpriv->bIsAnyNonBEPkts = _FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
if ((pregpriv->wifi_spec == 1) )//|| (pmlmeinfo->HT_enable == 0))
|
||||
{
|
||||
precvpriv->bIsAnyNonBEPkts = _FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
if(pDM_Odm->pWirelessMode!=NULL)
|
||||
WirelessMode=*(pDM_Odm->pWirelessMode);
|
||||
|
||||
IOTPeer = pmlmeinfo->assoc_AP_vendor;
|
||||
|
||||
if (IOTPeer >= HT_IOT_PEER_MAX)
|
||||
{
|
||||
precvpriv->bIsAnyNonBEPkts = _FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
if( (pDM_Odm->SupportICType == ODM_RTL8192C) ||
|
||||
(pDM_Odm->SupportICType == ODM_RTL8723A) ||
|
||||
(pDM_Odm->SupportICType == ODM_RTL8188E))
|
||||
{
|
||||
if((IOTPeer == HT_IOT_PEER_RALINK)||(IOTPeer == HT_IOT_PEER_ATHEROS))
|
||||
bBiasOnRx = _TRUE;
|
||||
}
|
||||
|
||||
// Check if the status needs to be changed.
|
||||
if((bbtchange) || (!precvpriv->bIsAnyNonBEPkts) )
|
||||
{
|
||||
cur_tx_bytes = pdvobjpriv->traffic_stat.cur_tx_bytes;
|
||||
cur_rx_bytes = pdvobjpriv->traffic_stat.cur_rx_bytes;
|
||||
|
||||
//traffic, TX or RX
|
||||
if(bBiasOnRx)
|
||||
{
|
||||
if (cur_tx_bytes > (cur_rx_bytes << 2))
|
||||
{ // Uplink TP is present.
|
||||
trafficIndex = UP_LINK;
|
||||
}
|
||||
else
|
||||
{ // Balance TP is present.
|
||||
trafficIndex = DOWN_LINK;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (cur_rx_bytes > (cur_tx_bytes << 2))
|
||||
{ // Downlink TP is present.
|
||||
trafficIndex = DOWN_LINK;
|
||||
}
|
||||
else
|
||||
{ // Balance TP is present.
|
||||
trafficIndex = UP_LINK;
|
||||
}
|
||||
}
|
||||
|
||||
//if ((pDM_Odm->DM_EDCA_Table.prv_traffic_idx != trafficIndex) || (!pDM_Odm->DM_EDCA_Table.bCurrentTurboEDCA))
|
||||
{
|
||||
if (ICType == ODM_RTL8192D) {
|
||||
// Single PHY
|
||||
if (pDM_Odm->RFType == ODM_2T2R) {
|
||||
EDCA_BE_UL = 0x60a42b; //0x5ea42b;
|
||||
EDCA_BE_DL = 0x60a42b; //0x5ea42b;
|
||||
} else {
|
||||
EDCA_BE_UL = 0x6ea42b;
|
||||
EDCA_BE_DL = 0x6ea42b;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(pDM_Odm->SupportInterface==ODM_ITRF_PCIE) {
|
||||
if((ICType==ODM_RTL8192C)&&(pDM_Odm->RFType==ODM_2T2R)) {
|
||||
EDCA_BE_UL = 0x60a42b;
|
||||
EDCA_BE_DL = 0x60a42b;
|
||||
} else {
|
||||
EDCA_BE_UL = 0x6ea42b;
|
||||
EDCA_BE_DL = 0x6ea42b;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//92D txop can't be set to 0x3e for cisco1250
|
||||
if((ICType!=ODM_RTL8192D) && (IOTPeer== HT_IOT_PEER_CISCO) &&(WirelessMode==ODM_WM_N24G))
|
||||
{
|
||||
EDCA_BE_DL = edca_setting_DL[IOTPeer];
|
||||
EDCA_BE_UL = edca_setting_UL[IOTPeer];
|
||||
}
|
||||
//merge from 92s_92c_merge temp brunch v2445 20120215
|
||||
else if((IOTPeer == HT_IOT_PEER_CISCO) &&((WirelessMode==ODM_WM_G)||(WirelessMode==(ODM_WM_B|ODM_WM_G))||(WirelessMode==ODM_WM_A)||(WirelessMode==ODM_WM_B)))
|
||||
{
|
||||
EDCA_BE_DL = edca_setting_DL_GMode[IOTPeer];
|
||||
}
|
||||
else if((IOTPeer== HT_IOT_PEER_AIRGO )&& ((WirelessMode==ODM_WM_G)||(WirelessMode==ODM_WM_A)))
|
||||
{
|
||||
EDCA_BE_DL = 0xa630;
|
||||
}
|
||||
else if(IOTPeer == HT_IOT_PEER_MARVELL)
|
||||
{
|
||||
EDCA_BE_DL = edca_setting_DL[IOTPeer];
|
||||
EDCA_BE_UL = edca_setting_UL[IOTPeer];
|
||||
}
|
||||
else if(IOTPeer == HT_IOT_PEER_ATHEROS)
|
||||
{
|
||||
// Set DL EDCA for Atheros peer to 0x3ea42b. Suggested by SD3 Wilson for ASUS TP issue.
|
||||
EDCA_BE_DL = edca_setting_DL[IOTPeer];
|
||||
}
|
||||
|
||||
if((ICType==ODM_RTL8812)||(ICType==ODM_RTL8821)||(ICType==ODM_RTL8192E)) //add 8812AU/8812AE
|
||||
{
|
||||
EDCA_BE_UL = 0x5ea42b;
|
||||
EDCA_BE_DL = 0x5ea42b;
|
||||
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("8812A: EDCA_BE_UL=0x%x EDCA_BE_DL =0x%x",EDCA_BE_UL,EDCA_BE_DL));
|
||||
}
|
||||
|
||||
if (trafficIndex == DOWN_LINK)
|
||||
edca_param = EDCA_BE_DL;
|
||||
else
|
||||
edca_param = EDCA_BE_UL;
|
||||
|
||||
rtw_write32(Adapter, REG_EDCA_BE_PARAM, edca_param);
|
||||
|
||||
pDM_Odm->DM_EDCA_Table.prv_traffic_idx = trafficIndex;
|
||||
}
|
||||
|
||||
pDM_Odm->DM_EDCA_Table.bCurrentTurboEDCA = _TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
// Turn Off EDCA turbo here.
|
||||
// Restore original EDCA according to the declaration of AP.
|
||||
//
|
||||
if(pDM_Odm->DM_EDCA_Table.bCurrentTurboEDCA)
|
||||
{
|
||||
rtw_write32(Adapter, REG_EDCA_BE_PARAM, pHalData->AcParam_BE);
|
||||
pDM_Odm->DM_EDCA_Table.bCurrentTurboEDCA = _FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
#elif(DM_ODM_SUPPORT_TYPE==ODM_WIN)
|
||||
VOID
|
||||
odm_EdcaTurboCheckMP(
|
||||
IN PVOID pDM_VOID
|
||||
)
|
||||
{
|
||||
|
||||
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
|
||||
PADAPTER Adapter = pDM_Odm->Adapter;
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
|
||||
|
||||
PADAPTER pDefaultAdapter = GetDefaultAdapter(Adapter);
|
||||
PADAPTER pExtAdapter = GetFirstExtAdapter(Adapter);//NULL;
|
||||
PMGNT_INFO pMgntInfo = &Adapter->MgntInfo;
|
||||
PSTA_QOS pStaQos = Adapter->MgntInfo.pStaQos;
|
||||
//[Win7 Count Tx/Rx statistic for Extension Port] odm_CheckEdcaTurbo's Adapter is always Default. 2009.08.20, by Bohn
|
||||
u8Byte Ext_curTxOkCnt = 0;
|
||||
u8Byte Ext_curRxOkCnt = 0;
|
||||
//For future Win7 Enable Default Port to modify AMPDU size dynamically, 2009.08.20, Bohn.
|
||||
u1Byte TwoPortStatus = (u1Byte)TWO_PORT_STATUS__WITHOUT_ANY_ASSOCIATE;
|
||||
|
||||
// Keep past Tx/Rx packet count for RT-to-RT EDCA turbo.
|
||||
u8Byte curTxOkCnt = 0;
|
||||
u8Byte curRxOkCnt = 0;
|
||||
u4Byte EDCA_BE_UL = 0x5ea42b;//Parameter suggested by Scott //edca_setting_UL[pMgntInfo->IOTPeer];
|
||||
u4Byte EDCA_BE_DL = 0x5ea42b;//Parameter suggested by Scott //edca_setting_DL[pMgntInfo->IOTPeer];
|
||||
u4Byte EDCA_BE = 0x5ea42b;
|
||||
u1Byte IOTPeer=0;
|
||||
BOOLEAN *pbIsCurRDLState=NULL;
|
||||
BOOLEAN bLastIsCurRDLState=FALSE;
|
||||
BOOLEAN bBiasOnRx=FALSE;
|
||||
BOOLEAN bEdcaTurboOn=FALSE;
|
||||
u1Byte TxRate = 0xFF;
|
||||
u8Byte value64;
|
||||
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("odm_EdcaTurboCheckMP========================>"));
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("Orginial BE PARAM: 0x%x\n",ODM_Read4Byte(pDM_Odm,ODM_EDCA_BE_PARAM)));
|
||||
|
||||
////===============================
|
||||
////list paramter for different platform
|
||||
////===============================
|
||||
bLastIsCurRDLState=pDM_Odm->DM_EDCA_Table.bIsCurRDLState;
|
||||
pbIsCurRDLState=&(pDM_Odm->DM_EDCA_Table.bIsCurRDLState);
|
||||
|
||||
//2012/09/14 MH Add
|
||||
if (pMgntInfo->NumNonBePkt > pMgntInfo->RegEdcaThresh && !Adapter->MgntInfo.bWiFiConfg)
|
||||
pHalData->bIsAnyNonBEPkts = TRUE;
|
||||
|
||||
pMgntInfo->NumNonBePkt = 0;
|
||||
|
||||
// Caculate TX/RX TP:
|
||||
//curTxOkCnt = Adapter->TxStats.NumTxBytesUnicast - pMgntInfo->lastTxOkCnt;
|
||||
//curRxOkCnt = Adapter->RxStats.NumRxBytesUnicast - pMgntInfo->lastRxOkCnt;
|
||||
curTxOkCnt = Adapter->TxStats.NumTxBytesUnicast - pDM_Odm->lastTxOkCnt;
|
||||
curRxOkCnt = Adapter->RxStats.NumRxBytesUnicast - pDM_Odm->lastRxOkCnt;
|
||||
pDM_Odm->lastTxOkCnt = Adapter->TxStats.NumTxBytesUnicast;
|
||||
pDM_Odm->lastRxOkCnt = Adapter->RxStats.NumRxBytesUnicast;
|
||||
|
||||
if(pExtAdapter == NULL)
|
||||
pExtAdapter = pDefaultAdapter;
|
||||
|
||||
Ext_curTxOkCnt = pExtAdapter->TxStats.NumTxBytesUnicast - pMgntInfo->Ext_lastTxOkCnt;
|
||||
Ext_curRxOkCnt = pExtAdapter->RxStats.NumRxBytesUnicast - pMgntInfo->Ext_lastRxOkCnt;
|
||||
GetTwoPortSharedResource(Adapter,TWO_PORT_SHARED_OBJECT__STATUS,NULL,&TwoPortStatus);
|
||||
//For future Win7 Enable Default Port to modify AMPDU size dynamically, 2009.08.20, Bohn.
|
||||
if(TwoPortStatus == TWO_PORT_STATUS__EXTENSION_ONLY)
|
||||
{
|
||||
curTxOkCnt = Ext_curTxOkCnt ;
|
||||
curRxOkCnt = Ext_curRxOkCnt ;
|
||||
}
|
||||
//
|
||||
IOTPeer=pMgntInfo->IOTPeer;
|
||||
bBiasOnRx=(pMgntInfo->IOTAction & HT_IOT_ACT_EDCA_BIAS_ON_RX)?TRUE:FALSE;
|
||||
bEdcaTurboOn=((!pHalData->bIsAnyNonBEPkts))?TRUE:FALSE;
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("bIsAnyNonBEPkts : 0x%lx \n",pHalData->bIsAnyNonBEPkts));
|
||||
|
||||
|
||||
////===============================
|
||||
////check if edca turbo is disabled
|
||||
////===============================
|
||||
if(odm_IsEdcaTurboDisable(pDM_Odm))
|
||||
{
|
||||
pHalData->bIsAnyNonBEPkts = FALSE;
|
||||
pMgntInfo->lastTxOkCnt = Adapter->TxStats.NumTxBytesUnicast;
|
||||
pMgntInfo->lastRxOkCnt = Adapter->RxStats.NumRxBytesUnicast;
|
||||
pMgntInfo->Ext_lastTxOkCnt = pExtAdapter->TxStats.NumTxBytesUnicast;
|
||||
pMgntInfo->Ext_lastRxOkCnt = pExtAdapter->RxStats.NumRxBytesUnicast;
|
||||
|
||||
}
|
||||
|
||||
////===============================
|
||||
////remove iot case out
|
||||
////===============================
|
||||
ODM_EdcaParaSelByIot(pDM_Odm, &EDCA_BE_UL, &EDCA_BE_DL);
|
||||
|
||||
|
||||
////===============================
|
||||
////Check if the status needs to be changed.
|
||||
////===============================
|
||||
if(bEdcaTurboOn)
|
||||
{
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("bEdcaTurboOn : 0x%x bBiasOnRx : 0x%x\n",bEdcaTurboOn,bBiasOnRx));
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("curTxOkCnt : 0x%lx \n",curTxOkCnt));
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("curRxOkCnt : 0x%lx \n",curRxOkCnt));
|
||||
if(bBiasOnRx)
|
||||
odm_EdcaChooseTrafficIdx(pDM_Odm,curTxOkCnt, curRxOkCnt, TRUE, pbIsCurRDLState);
|
||||
else
|
||||
odm_EdcaChooseTrafficIdx(pDM_Odm,curTxOkCnt, curRxOkCnt, FALSE, pbIsCurRDLState);
|
||||
|
||||
//modify by Guo.Mingzhi 2011-12-29
|
||||
EDCA_BE=((*pbIsCurRDLState)==TRUE)?EDCA_BE_DL:EDCA_BE_UL;
|
||||
if(IS_HARDWARE_TYPE_8821U(Adapter))
|
||||
{
|
||||
if(pMgntInfo->RegTxDutyEnable)
|
||||
{
|
||||
//2013.01.23 LukeLee: debug for 8811AU thermal issue (reduce Tx duty cycle)
|
||||
if(!pMgntInfo->ForcedDataRate) //auto rate
|
||||
{
|
||||
if(pDM_Odm->TxRate != 0xFF)
|
||||
TxRate = Adapter->HalFunc.GetHwRateFromMRateHandler(pDM_Odm->TxRate);
|
||||
}
|
||||
else //force rate
|
||||
{
|
||||
TxRate = (u1Byte) pMgntInfo->ForcedDataRate;
|
||||
}
|
||||
|
||||
value64 = (curRxOkCnt<<2);
|
||||
if(curTxOkCnt < value64) //Downlink
|
||||
ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,EDCA_BE);
|
||||
else //Uplink
|
||||
{
|
||||
/*DbgPrint("pRFCalibrateInfo->ThermalValue = 0x%X\n", pRFCalibrateInfo->ThermalValue);*/
|
||||
/*if(pRFCalibrateInfo->ThermalValue < pHalData->EEPROMThermalMeter)*/
|
||||
if((pDM_Odm->RFCalibrateInfo.ThermalValue < 0x2c) || (*pDM_Odm->pBandType == BAND_ON_2_4G))
|
||||
ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,EDCA_BE);
|
||||
else
|
||||
{
|
||||
switch (TxRate)
|
||||
{
|
||||
case MGN_VHT1SS_MCS6:
|
||||
case MGN_VHT1SS_MCS5:
|
||||
case MGN_MCS6:
|
||||
case MGN_MCS5:
|
||||
case MGN_48M:
|
||||
case MGN_54M:
|
||||
ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,0x1ea42b);
|
||||
break;
|
||||
case MGN_VHT1SS_MCS4:
|
||||
case MGN_MCS4:
|
||||
case MGN_36M:
|
||||
ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,0xa42b);
|
||||
break;
|
||||
case MGN_VHT1SS_MCS3:
|
||||
case MGN_MCS3:
|
||||
case MGN_24M:
|
||||
ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,0xa47f);
|
||||
break;
|
||||
case MGN_VHT1SS_MCS2:
|
||||
case MGN_MCS2:
|
||||
case MGN_18M:
|
||||
ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,0xa57f);
|
||||
break;
|
||||
case MGN_VHT1SS_MCS1:
|
||||
case MGN_MCS1:
|
||||
case MGN_9M:
|
||||
case MGN_12M:
|
||||
ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,0xa77f);
|
||||
break;
|
||||
case MGN_VHT1SS_MCS0:
|
||||
case MGN_MCS0:
|
||||
case MGN_6M:
|
||||
ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,0xa87f);
|
||||
break;
|
||||
default:
|
||||
ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,EDCA_BE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,EDCA_BE);
|
||||
}
|
||||
|
||||
}
|
||||
else if (IS_HARDWARE_TYPE_8812AU(Adapter)){
|
||||
if(pMgntInfo->RegTxDutyEnable)
|
||||
{
|
||||
//2013.07.26 Wilson: debug for 8812AU thermal issue (reduce Tx duty cycle)
|
||||
// it;s the same issue as 8811AU
|
||||
if(!pMgntInfo->ForcedDataRate) //auto rate
|
||||
{
|
||||
if(pDM_Odm->TxRate != 0xFF)
|
||||
TxRate = Adapter->HalFunc.GetHwRateFromMRateHandler(pDM_Odm->TxRate);
|
||||
}
|
||||
else //force rate
|
||||
{
|
||||
TxRate = (u1Byte) pMgntInfo->ForcedDataRate;
|
||||
}
|
||||
|
||||
value64 = (curRxOkCnt<<2);
|
||||
if(curTxOkCnt < value64) //Downlink
|
||||
ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,EDCA_BE);
|
||||
else //Uplink
|
||||
{
|
||||
/*DbgPrint("pRFCalibrateInfo->ThermalValue = 0x%X\n", pRFCalibrateInfo->ThermalValue);*/
|
||||
/*if(pRFCalibrateInfo->ThermalValue < pHalData->EEPROMThermalMeter)*/
|
||||
if((pDM_Odm->RFCalibrateInfo.ThermalValue < 0x2c) || (*pDM_Odm->pBandType == BAND_ON_2_4G))
|
||||
ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,EDCA_BE);
|
||||
else
|
||||
{
|
||||
switch (TxRate)
|
||||
{
|
||||
case MGN_VHT2SS_MCS9:
|
||||
case MGN_VHT1SS_MCS9:
|
||||
case MGN_VHT1SS_MCS8:
|
||||
case MGN_MCS15:
|
||||
case MGN_MCS7:
|
||||
ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,0x1ea44f);
|
||||
case MGN_VHT2SS_MCS8:
|
||||
case MGN_VHT1SS_MCS7:
|
||||
case MGN_MCS14:
|
||||
case MGN_MCS6:
|
||||
case MGN_54M:
|
||||
ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,0xa44f);
|
||||
case MGN_VHT2SS_MCS7:
|
||||
case MGN_VHT2SS_MCS6:
|
||||
case MGN_VHT1SS_MCS6:
|
||||
case MGN_VHT1SS_MCS5:
|
||||
case MGN_MCS13:
|
||||
case MGN_MCS5:
|
||||
case MGN_48M:
|
||||
ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,0xa630);
|
||||
break;
|
||||
case MGN_VHT2SS_MCS5:
|
||||
case MGN_VHT2SS_MCS4:
|
||||
case MGN_VHT1SS_MCS4:
|
||||
case MGN_VHT1SS_MCS3:
|
||||
case MGN_MCS12:
|
||||
case MGN_MCS4:
|
||||
case MGN_MCS3:
|
||||
case MGN_36M:
|
||||
case MGN_24M:
|
||||
ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,0xa730);
|
||||
break;
|
||||
case MGN_VHT2SS_MCS3:
|
||||
case MGN_VHT2SS_MCS2:
|
||||
case MGN_VHT2SS_MCS1:
|
||||
case MGN_VHT1SS_MCS2:
|
||||
case MGN_VHT1SS_MCS1:
|
||||
case MGN_MCS11:
|
||||
case MGN_MCS10:
|
||||
case MGN_MCS9:
|
||||
case MGN_MCS2:
|
||||
case MGN_MCS1:
|
||||
case MGN_18M:
|
||||
case MGN_12M:
|
||||
ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,0xa830);
|
||||
break;
|
||||
case MGN_VHT2SS_MCS0:
|
||||
case MGN_VHT1SS_MCS0:
|
||||
case MGN_MCS0:
|
||||
case MGN_MCS8:
|
||||
case MGN_9M:
|
||||
case MGN_6M:
|
||||
ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,0xa87f);
|
||||
break;
|
||||
default:
|
||||
ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,EDCA_BE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,EDCA_BE);
|
||||
}
|
||||
}
|
||||
else
|
||||
ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,EDCA_BE);
|
||||
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("EDCA Turbo on: EDCA_BE:0x%lx\n",EDCA_BE));
|
||||
|
||||
pDM_Odm->DM_EDCA_Table.bCurrentTurboEDCA = TRUE;
|
||||
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("EDCA_BE_DL : 0x%lx EDCA_BE_UL : 0x%lx EDCA_BE : 0x%lx \n",EDCA_BE_DL,EDCA_BE_UL,EDCA_BE));
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// Turn Off EDCA turbo here.
|
||||
// Restore original EDCA according to the declaration of AP.
|
||||
if(pDM_Odm->DM_EDCA_Table.bCurrentTurboEDCA)
|
||||
{
|
||||
Adapter->HalFunc.SetHwRegHandler(Adapter, HW_VAR_AC_PARAM, GET_WMM_PARAM_ELE_SINGLE_AC_PARAM(pStaQos->WMMParamEle, AC0_BE) );
|
||||
|
||||
pDM_Odm->DM_EDCA_Table.bCurrentTurboEDCA = FALSE;
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("Restore EDCA BE: 0x%lx \n",pDM_Odm->WMMEDCA_BE));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//check if edca turbo is disabled
|
||||
BOOLEAN
|
||||
odm_IsEdcaTurboDisable(
|
||||
IN PVOID pDM_VOID
|
||||
)
|
||||
{
|
||||
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
|
||||
PADAPTER Adapter = pDM_Odm->Adapter;
|
||||
PMGNT_INFO pMgntInfo = &Adapter->MgntInfo;
|
||||
u4Byte IOTPeer=pMgntInfo->IOTPeer;
|
||||
|
||||
if(pDM_Odm->bBtDisableEdcaTurbo)
|
||||
{
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD, ("EdcaTurboDisable for BT!!\n"));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if((!(pDM_Odm->SupportAbility& ODM_MAC_EDCA_TURBO ))||
|
||||
(pDM_Odm->bWIFITest)||
|
||||
(IOTPeer>= HT_IOT_PEER_MAX))
|
||||
{
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD, ("EdcaTurboDisable\n"));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
// 1. We do not turn on EDCA turbo mode for some AP that has IOT issue
|
||||
// 2. User may disable EDCA Turbo mode with OID settings.
|
||||
if(pMgntInfo->IOTAction & HT_IOT_ACT_DISABLE_EDCA_TURBO){
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD, ("IOTAction:EdcaTurboDisable\n"));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
||||
|
||||
}
|
||||
|
||||
//add iot case here: for MP/CE
|
||||
VOID
|
||||
ODM_EdcaParaSelByIot(
|
||||
IN PVOID pDM_VOID,
|
||||
OUT u4Byte *EDCA_BE_UL,
|
||||
OUT u4Byte *EDCA_BE_DL
|
||||
)
|
||||
{
|
||||
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
|
||||
PADAPTER Adapter = pDM_Odm->Adapter;
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
|
||||
u4Byte IOTPeer=0;
|
||||
u4Byte ICType=pDM_Odm->SupportICType;
|
||||
u1Byte WirelessMode=0xFF; //invalid value
|
||||
u4Byte RFType=pDM_Odm->RFType;
|
||||
u4Byte IOTPeerSubType = 0;
|
||||
|
||||
PMGNT_INFO pMgntInfo = &Adapter->MgntInfo;
|
||||
u1Byte TwoPortStatus = (u1Byte)TWO_PORT_STATUS__WITHOUT_ANY_ASSOCIATE;
|
||||
|
||||
if(pDM_Odm->pWirelessMode!=NULL)
|
||||
WirelessMode=*(pDM_Odm->pWirelessMode);
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
////list paramter for different platform
|
||||
|
||||
IOTPeer=pMgntInfo->IOTPeer;
|
||||
IOTPeerSubType=pMgntInfo->IOTPeerSubtype;
|
||||
GetTwoPortSharedResource(Adapter,TWO_PORT_SHARED_OBJECT__STATUS,NULL,&TwoPortStatus);
|
||||
|
||||
|
||||
if(ICType==ODM_RTL8192D)
|
||||
{
|
||||
// Single PHY
|
||||
if(pDM_Odm->RFType==ODM_2T2R)
|
||||
{
|
||||
(*EDCA_BE_UL) = 0x60a42b; //0x5ea42b;
|
||||
(*EDCA_BE_DL) = 0x60a42b; //0x5ea42b;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
(*EDCA_BE_UL) = 0x6ea42b;
|
||||
(*EDCA_BE_DL) = 0x6ea42b;
|
||||
}
|
||||
|
||||
}
|
||||
////============================
|
||||
/// IOT case for MP
|
||||
////============================
|
||||
|
||||
else
|
||||
{
|
||||
|
||||
if(pDM_Odm->SupportInterface==ODM_ITRF_PCIE){
|
||||
if((ICType==ODM_RTL8192C)&&(pDM_Odm->RFType==ODM_2T2R)) {
|
||||
(*EDCA_BE_UL) = 0x60a42b;
|
||||
(*EDCA_BE_DL) = 0x60a42b;
|
||||
}
|
||||
else
|
||||
{
|
||||
(*EDCA_BE_UL) = 0x6ea42b;
|
||||
(*EDCA_BE_DL) = 0x6ea42b;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(TwoPortStatus == TWO_PORT_STATUS__EXTENSION_ONLY)
|
||||
{
|
||||
(*EDCA_BE_UL) = 0x5ea42b;//Parameter suggested by Scott //edca_setting_UL[ExtAdapter->MgntInfo.IOTPeer];
|
||||
(*EDCA_BE_DL) = 0x5ea42b;//Parameter suggested by Scott //edca_setting_DL[ExtAdapter->MgntInfo.IOTPeer];
|
||||
}
|
||||
|
||||
#if (INTEL_PROXIMITY_SUPPORT == 1)
|
||||
if(pMgntInfo->IntelClassModeInfo.bEnableCA == TRUE)
|
||||
{
|
||||
(*EDCA_BE_UL) = (*EDCA_BE_DL) = 0xa44f;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
if((pMgntInfo->IOTAction & (HT_IOT_ACT_FORCED_ENABLE_BE_TXOP|HT_IOT_ACT_AMSDU_ENABLE)))
|
||||
{// To check whether we shall force turn on TXOP configuration.
|
||||
if(!((*EDCA_BE_UL) & 0xffff0000))
|
||||
(*EDCA_BE_UL) |= 0x005e0000; // Force TxOP limit to 0x005e for UL.
|
||||
if(!((*EDCA_BE_DL) & 0xffff0000))
|
||||
(*EDCA_BE_DL) |= 0x005e0000; // Force TxOP limit to 0x005e for DL.
|
||||
}
|
||||
|
||||
//92D txop can't be set to 0x3e for cisco1250
|
||||
if((ICType!=ODM_RTL8192D) && (IOTPeer== HT_IOT_PEER_CISCO) &&(WirelessMode==ODM_WM_N24G))
|
||||
{
|
||||
(*EDCA_BE_DL) = edca_setting_DL[IOTPeer];
|
||||
(*EDCA_BE_UL) = edca_setting_UL[IOTPeer];
|
||||
}
|
||||
//merge from 92s_92c_merge temp brunch v2445 20120215
|
||||
else if((IOTPeer == HT_IOT_PEER_CISCO) &&((WirelessMode==ODM_WM_G)||(WirelessMode==(ODM_WM_B|ODM_WM_G))||(WirelessMode==ODM_WM_A)||(WirelessMode==ODM_WM_B)))
|
||||
{
|
||||
(*EDCA_BE_DL) = edca_setting_DL_GMode[IOTPeer];
|
||||
}
|
||||
else if((IOTPeer== HT_IOT_PEER_AIRGO )&& ((WirelessMode==ODM_WM_G)||(WirelessMode==ODM_WM_A)))
|
||||
{
|
||||
(*EDCA_BE_DL) = 0xa630;
|
||||
}
|
||||
|
||||
else if(IOTPeer == HT_IOT_PEER_MARVELL)
|
||||
{
|
||||
(*EDCA_BE_DL) = edca_setting_DL[IOTPeer];
|
||||
(*EDCA_BE_UL) = edca_setting_UL[IOTPeer];
|
||||
}
|
||||
else if(IOTPeer == HT_IOT_PEER_ATHEROS && IOTPeerSubType != HT_IOT_PEER_TPLINK_AC1750)
|
||||
{
|
||||
// Set DL EDCA for Atheros peer to 0x3ea42b. Suggested by SD3 Wilson for ASUS TP issue.
|
||||
if(WirelessMode==ODM_WM_G)
|
||||
(*EDCA_BE_DL) = edca_setting_DL_GMode[IOTPeer];
|
||||
else
|
||||
(*EDCA_BE_DL) = edca_setting_DL[IOTPeer];
|
||||
|
||||
if(ICType == ODM_RTL8821)
|
||||
(*EDCA_BE_DL) = 0x5ea630;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if((ICType == ODM_RTL8192D)&&(IOTPeerSubType == HT_IOT_PEER_LINKSYS_E4200_V1)&&((WirelessMode==ODM_WM_N5G)))
|
||||
{
|
||||
(*EDCA_BE_DL) = 0x432b;
|
||||
(*EDCA_BE_UL) = 0x432b;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if((ICType==ODM_RTL8812)||(ICType==ODM_RTL8192E)) //add 8812AU/8812AE
|
||||
{
|
||||
(*EDCA_BE_UL) = 0x5ea42b;
|
||||
(*EDCA_BE_DL) = 0x5ea42b;
|
||||
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("8812A: EDCA_BE_UL=0x%lx EDCA_BE_DL =0x%lx\n",(*EDCA_BE_UL),(*EDCA_BE_DL)));
|
||||
}
|
||||
|
||||
if((ICType==ODM_RTL8814A) && (IOTPeer == HT_IOT_PEER_REALTEK)) /*8814AU and 8814AR*/
|
||||
{
|
||||
(*EDCA_BE_UL) = 0x5ea42b;
|
||||
(*EDCA_BE_DL) = 0xa42b;
|
||||
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("8814A: EDCA_BE_UL=0x%lx EDCA_BE_DL =0x%lx\n",(*EDCA_BE_UL),(*EDCA_BE_DL)));
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Revised for Atheros DIR-655 IOT issue to improve down link TP, added by Roger, 2013.03.22.
|
||||
if((ICType == ODM_RTL8723A) && (IOTPeerSubType== HT_IOT_PEER_ATHEROS_DIR655) &&
|
||||
(pMgntInfo->dot11CurrentChannelNumber == 6))
|
||||
{
|
||||
(*EDCA_BE_DL) = 0xa92b;
|
||||
}
|
||||
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("Special: EDCA_BE_UL=0x%lx EDCA_BE_DL =0x%lx, IOTPeer = %d\n",(*EDCA_BE_UL),(*EDCA_BE_DL), IOTPeer));
|
||||
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
odm_EdcaChooseTrafficIdx(
|
||||
IN PVOID pDM_VOID,
|
||||
IN u8Byte cur_tx_bytes,
|
||||
IN u8Byte cur_rx_bytes,
|
||||
IN BOOLEAN bBiasOnRx,
|
||||
OUT BOOLEAN *pbIsCurRDLState
|
||||
)
|
||||
{
|
||||
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
|
||||
|
||||
if(bBiasOnRx)
|
||||
{
|
||||
|
||||
if(cur_tx_bytes>(cur_rx_bytes*4))
|
||||
{
|
||||
*pbIsCurRDLState=FALSE;
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("Uplink Traffic\n "));
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
*pbIsCurRDLState=TRUE;
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("Balance Traffic\n"));
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(cur_rx_bytes>(cur_tx_bytes*4))
|
||||
{
|
||||
*pbIsCurRDLState=TRUE;
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("Downlink Traffic\n"));
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
*pbIsCurRDLState=FALSE;
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("Balance Traffic\n"));
|
||||
}
|
||||
}
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
100
hal/phydm/phydm_edcaturbocheck.h
Normal file
100
hal/phydm/phydm_edcaturbocheck.h
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __PHYDMEDCATURBOCHECK_H__
|
||||
#define __PHYDMEDCATURBOCHECK_H__
|
||||
|
||||
/*#define EDCATURBO_VERSION "2.1"*/
|
||||
#define EDCATURBO_VERSION "2.2" /*2015.01.13*/
|
||||
|
||||
typedef struct _EDCA_TURBO_
|
||||
{
|
||||
BOOLEAN bCurrentTurboEDCA;
|
||||
BOOLEAN bIsCurRDLState;
|
||||
|
||||
#if(DM_ODM_SUPPORT_TYPE == ODM_CE )
|
||||
u4Byte prv_traffic_idx; // edca turbo
|
||||
#endif
|
||||
|
||||
}EDCA_T,*pEDCA_T;
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE))
|
||||
static u4Byte edca_setting_UL[HT_IOT_PEER_MAX] =
|
||||
// UNKNOWN REALTEK_90 REALTEK_92SE BROADCOM RALINK ATHEROS CISCO MERU MARVELL 92U_AP SELF_AP(DownLink/Tx)
|
||||
{ 0x5e4322, 0xa44f, 0x5e4322, 0x5ea32b, 0x5ea422, 0x5ea322, 0x3ea430, 0x5ea42b, 0x5ea44f, 0x5e4322, 0x5e4322};
|
||||
|
||||
|
||||
static u4Byte edca_setting_DL[HT_IOT_PEER_MAX] =
|
||||
// UNKNOWN REALTEK_90 REALTEK_92SE BROADCOM RALINK ATHEROS CISCO MERU, MARVELL 92U_AP SELF_AP(UpLink/Rx)
|
||||
{ 0xa44f, 0x5ea44f, 0x5e4322, 0x5ea42b, 0xa44f, 0xa630, 0x5ea630, 0x5ea42b, 0xa44f, 0xa42b, 0xa42b};
|
||||
|
||||
static u4Byte edca_setting_DL_GMode[HT_IOT_PEER_MAX] =
|
||||
// UNKNOWN REALTEK_90 REALTEK_92SE BROADCOM RALINK ATHEROS CISCO MERU, MARVELL 92U_AP SELF_AP
|
||||
{ 0x4322, 0xa44f, 0x5e4322, 0xa42b, 0x5e4322, 0x4322, 0xa42b, 0x5ea42b, 0xa44f, 0x5e4322, 0x5ea42b};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
odm_EdcaTurboCheck(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
VOID
|
||||
ODM_EdcaTurboInit(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
#if(DM_ODM_SUPPORT_TYPE==ODM_WIN)
|
||||
VOID
|
||||
odm_EdcaTurboCheckMP(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
//check if edca turbo is disabled
|
||||
BOOLEAN
|
||||
odm_IsEdcaTurboDisable(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
//choose edca paramter for special IOT case
|
||||
VOID
|
||||
ODM_EdcaParaSelByIot(
|
||||
IN PVOID pDM_VOID,
|
||||
OUT u4Byte *EDCA_BE_UL,
|
||||
OUT u4Byte *EDCA_BE_DL
|
||||
);
|
||||
//check if it is UL or DL
|
||||
VOID
|
||||
odm_EdcaChooseTrafficIdx(
|
||||
IN PVOID pDM_VOID,
|
||||
IN u8Byte cur_tx_bytes,
|
||||
IN u8Byte cur_rx_bytes,
|
||||
IN BOOLEAN bBiasOnRx,
|
||||
OUT BOOLEAN *pbIsCurRDLState
|
||||
);
|
||||
|
||||
#elif (DM_ODM_SUPPORT_TYPE==ODM_CE)
|
||||
VOID
|
||||
odm_EdcaTurboCheckCE(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
119
hal/phydm/phydm_features.h
Normal file
119
hal/phydm/phydm_features.h
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __PHYDM_FEATURES_H__
|
||||
#define __PHYDM_FEATURES
|
||||
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
|
||||
/*Antenna Diversity*/
|
||||
#define CONFIG_PHYDM_ANTENNA_DIVERSITY
|
||||
#ifdef CONFIG_PHYDM_ANTENNA_DIVERSITY
|
||||
|
||||
#if (RTL8723B_SUPPORT == 1) || (RTL8821A_SUPPORT == 1) || (RTL8188F_SUPPORT == 1)
|
||||
#define CONFIG_S0S1_SW_ANTENNA_DIVERSITY
|
||||
#endif
|
||||
|
||||
#if (RTL8821A_SUPPORT == 1)
|
||||
/*#define CONFIG_HL_SMART_ANTENNA_TYPE1*/
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*#define CONFIG_PATH_DIVERSITY*/
|
||||
/*#define CONFIG_RA_DYNAMIC_RTY_LIMIT*/
|
||||
#define CONFIG_ANT_DETECTION
|
||||
#define CONFIG_RA_DBG_CMD
|
||||
|
||||
#elif (DM_ODM_SUPPORT_TYPE == ODM_AP)
|
||||
|
||||
/* [ Configure RA Debug H2C CMD ]*/
|
||||
#define CONFIG_RA_DBG_CMD
|
||||
|
||||
/*#define CONFIG_PATH_DIVERSITY*/
|
||||
/*#define CONFIG_RA_DYNAMIC_RTY_LIMIT*/
|
||||
#define CONFIG_RA_DYNAMIC_RATE_ID
|
||||
|
||||
/* [ Configure Antenna Diversity ] */
|
||||
#if defined(CONFIG_RTL_8881A_ANT_SWITCH) || defined(CONFIG_SLOT_0_ANT_SWITCH) || defined(CONFIG_SLOT_1_ANT_SWITCH)
|
||||
#define CONFIG_PHYDM_ANTENNA_DIVERSITY
|
||||
#define ODM_EVM_ENHANCE_ANTDIV
|
||||
|
||||
/*----------*/
|
||||
|
||||
#if (!defined(CONFIG_NO_2G_DIVERSITY) && !defined(CONFIG_2G5G_CG_TRX_DIVERSITY_8881A) && !defined(CONFIG_2G_CGCS_RX_DIVERSITY) && !defined(CONFIG_2G_CG_TRX_DIVERSITY) && !defined(CONFIG_2G_CG_SMART_ANT_DIVERSITY))
|
||||
#define CONFIG_NO_2G_DIVERSITY
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NO_5G_DIVERSITY_8881A
|
||||
#define CONFIG_NO_5G_DIVERSITY
|
||||
#elif defined(CONFIG_5G_CGCS_RX_DIVERSITY_8881A)
|
||||
#define CONFIG_5G_CGCS_RX_DIVERSITY
|
||||
#elif defined(CONFIG_5G_CG_TRX_DIVERSITY_8881A)
|
||||
#define CONFIG_5G_CG_TRX_DIVERSITY
|
||||
#elif defined(CONFIG_2G5G_CG_TRX_DIVERSITY_8881A)
|
||||
#define CONFIG_2G5G_CG_TRX_DIVERSITY
|
||||
#endif
|
||||
#if (!defined(CONFIG_NO_5G_DIVERSITY) && !defined(CONFIG_5G_CGCS_RX_DIVERSITY) && !defined(CONFIG_5G_CG_TRX_DIVERSITY) && !defined(CONFIG_2G5G_CG_TRX_DIVERSITY) && !defined(CONFIG_5G_CG_SMART_ANT_DIVERSITY))
|
||||
#define CONFIG_NO_5G_DIVERSITY
|
||||
#endif
|
||||
/*----------*/
|
||||
#if (defined(CONFIG_NO_2G_DIVERSITY) && defined(CONFIG_NO_5G_DIVERSITY))
|
||||
#define CONFIG_NOT_SUPPORT_ANTDIV
|
||||
#elif (!defined(CONFIG_NO_2G_DIVERSITY) && defined(CONFIG_NO_5G_DIVERSITY))
|
||||
#define CONFIG_2G_SUPPORT_ANTDIV
|
||||
#elif (defined(CONFIG_NO_2G_DIVERSITY) && !defined(CONFIG_NO_5G_DIVERSITY))
|
||||
#define CONFIG_5G_SUPPORT_ANTDIV
|
||||
#elif ((!defined(CONFIG_NO_2G_DIVERSITY) && !defined(CONFIG_NO_5G_DIVERSITY)) || defined(CONFIG_2G5G_CG_TRX_DIVERSITY))
|
||||
#define CONFIG_2G5G_SUPPORT_ANTDIV
|
||||
#endif
|
||||
/*----------*/
|
||||
#endif
|
||||
|
||||
#elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
|
||||
|
||||
/*Antenna Diversity*/
|
||||
#ifdef CONFIG_ANTENNA_DIVERSITY
|
||||
#define CONFIG_PHYDM_ANTENNA_DIVERSITY
|
||||
|
||||
#ifdef CONFIG_PHYDM_ANTENNA_DIVERSITY
|
||||
|
||||
#if (RTL8723B_SUPPORT == 1) || (RTL8821A_SUPPORT == 1) || (RTL8188F_SUPPORT == 1)
|
||||
#define CONFIG_S0S1_SW_ANTENNA_DIVERSITY
|
||||
#endif
|
||||
|
||||
#if (RTL8821A_SUPPORT == 1)
|
||||
/*#define CONFIG_HL_SMART_ANTENNA_TYPE1*/
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*#define CONFIG_RA_DBG_CMD*/
|
||||
/*#define CONFIG_ANT_DETECTION*/
|
||||
/*#define CONFIG_PATH_DIVERSITY*/
|
||||
/*#define CONFIG_RA_DYNAMIC_RTY_LIMIT*/
|
||||
|
||||
#ifdef CONFIG_BT_COEXIST
|
||||
#define BT_SUPPORT 1
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
3332
hal/phydm/phydm_hwconfig.c
Normal file
3332
hal/phydm/phydm_hwconfig.c
Normal file
File diff suppressed because it is too large
Load diff
506
hal/phydm/phydm_hwconfig.h
Normal file
506
hal/phydm/phydm_hwconfig.h
Normal file
|
|
@ -0,0 +1,506 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
#ifndef __HALHWOUTSRC_H__
|
||||
#define __HALHWOUTSRC_H__
|
||||
|
||||
|
||||
/*--------------------------Define -------------------------------------------*/
|
||||
|
||||
#define AGC_DIFF_CONFIG_MP(ic, band) (ODM_ReadAndConfig_MP_##ic##_AGC_TAB_DIFF(pDM_Odm, Array_MP_##ic##_AGC_TAB_DIFF_##band, \
|
||||
sizeof(Array_MP_##ic##_AGC_TAB_DIFF_##band)/sizeof(u4Byte)))
|
||||
#define AGC_DIFF_CONFIG_TC(ic, band) (ODM_ReadAndConfig_TC_##ic##_AGC_TAB_DIFF(pDM_Odm, Array_TC_##ic##_AGC_TAB_DIFF_##band, \
|
||||
sizeof(Array_TC_##ic##_AGC_TAB_DIFF_##band)/sizeof(u4Byte)))
|
||||
|
||||
#define AGC_DIFF_CONFIG(ic, band) do {\
|
||||
if (pDM_Odm->bIsMPChip)\
|
||||
AGC_DIFF_CONFIG_MP(ic,band);\
|
||||
else\
|
||||
AGC_DIFF_CONFIG_TC(ic,band);\
|
||||
} while(0)
|
||||
|
||||
|
||||
//============================================================
|
||||
// structure and define
|
||||
//============================================================
|
||||
|
||||
__PACK typedef struct _Phy_Rx_AGC_Info
|
||||
{
|
||||
#if (ODM_ENDIAN_TYPE == ODM_ENDIAN_LITTLE)
|
||||
u1Byte gain:7,trsw:1;
|
||||
#else
|
||||
u1Byte trsw:1,gain:7;
|
||||
#endif
|
||||
} __WLAN_ATTRIB_PACK__ PHY_RX_AGC_INFO_T, *pPHY_RX_AGC_INFO_T;
|
||||
|
||||
__PACK typedef struct _Phy_Status_Rpt_8192cd {
|
||||
PHY_RX_AGC_INFO_T path_agc[2];
|
||||
u1Byte ch_corr[2];
|
||||
u1Byte cck_sig_qual_ofdm_pwdb_all;
|
||||
u1Byte cck_agc_rpt_ofdm_cfosho_a;
|
||||
u1Byte cck_rpt_b_ofdm_cfosho_b;
|
||||
u1Byte rsvd_1;/*ch_corr_msb;*/
|
||||
u1Byte noise_power_db_msb;
|
||||
s1Byte path_cfotail[2];
|
||||
u1Byte pcts_mask[2];
|
||||
s1Byte stream_rxevm[2];
|
||||
u1Byte path_rxsnr[2];
|
||||
u1Byte noise_power_db_lsb;
|
||||
u1Byte rsvd_2[3];
|
||||
u1Byte stream_csi[2];
|
||||
u1Byte stream_target_csi[2];
|
||||
s1Byte sig_evm;
|
||||
u1Byte rsvd_3;
|
||||
|
||||
#if (ODM_ENDIAN_TYPE == ODM_ENDIAN_LITTLE)
|
||||
u1Byte antsel_rx_keep_2: 1; /*ex_intf_flg:1;*/
|
||||
u1Byte sgi_en: 1;
|
||||
u1Byte rxsc: 2;
|
||||
u1Byte idle_long: 1;
|
||||
u1Byte r_ant_train_en: 1;
|
||||
u1Byte ant_sel_b: 1;
|
||||
u1Byte ant_sel: 1;
|
||||
#else /*_BIG_ENDIAN_ */
|
||||
u1Byte ant_sel: 1;
|
||||
u1Byte ant_sel_b: 1;
|
||||
u1Byte r_ant_train_en: 1;
|
||||
u1Byte idle_long: 1;
|
||||
u1Byte rxsc: 2;
|
||||
u1Byte sgi_en: 1;
|
||||
u1Byte antsel_rx_keep_2: 1;/*ex_intf_flg:1;*/
|
||||
#endif
|
||||
} __WLAN_ATTRIB_PACK__ PHY_STATUS_RPT_8192CD_T, *PPHY_STATUS_RPT_8192CD_T;
|
||||
|
||||
|
||||
typedef struct _Phy_Status_Rpt_8812 {
|
||||
/* DWORD 0*/
|
||||
u1Byte gain_trsw[2]; /*path-A and path-B {TRSW, gain[6:0] }*/
|
||||
u1Byte chl_num_LSB; /*channel number[7:0]*/
|
||||
#if (ODM_ENDIAN_TYPE == ODM_ENDIAN_LITTLE)
|
||||
u1Byte chl_num_MSB: 2; /*channel number[9:8]*/
|
||||
u1Byte sub_chnl: 4; /*sub-channel location[3:0]*/
|
||||
u1Byte r_RFMOD: 2; /*RF mode[1:0]*/
|
||||
#else /*_BIG_ENDIAN_ */
|
||||
u1Byte r_RFMOD: 2;
|
||||
u1Byte sub_chnl: 4;
|
||||
u1Byte chl_num_MSB: 2;
|
||||
#endif
|
||||
|
||||
/* DWORD 1*/
|
||||
u1Byte pwdb_all; /*CCK signal quality / OFDM pwdb all*/
|
||||
s1Byte cfosho[2]; /*DW1 byte 1 DW1 byte2 CCK AGC report and CCK_BB_Power / OFDM Path-A and Path-B short CFO*/
|
||||
#if (ODM_ENDIAN_TYPE == ODM_ENDIAN_LITTLE)
|
||||
/*this should be checked again because the definition of 8812 and 8814 is different*/
|
||||
/* u1Byte r_cck_rx_enable_pathc:2; cck rx enable pathc[1:0]*/
|
||||
/* u1Byte cck_rx_path:4; cck rx path[3:0]*/
|
||||
u1Byte resvd_0: 6;
|
||||
u1Byte bt_RF_ch_MSB: 2; /*8812A:2'b0 8814A: bt rf channel keep[7:6]*/
|
||||
#else /*_BIG_ENDIAN_*/
|
||||
u1Byte bt_RF_ch_MSB: 2;
|
||||
u1Byte resvd_0: 6;
|
||||
#endif
|
||||
|
||||
/* DWORD 2*/
|
||||
#if (ODM_ENDIAN_TYPE == ODM_ENDIAN_LITTLE)
|
||||
u1Byte ant_div_sw_a: 1; /*8812A: ant_div_sw_a 8814A: 1'b0*/
|
||||
u1Byte ant_div_sw_b: 1; /*8812A: ant_div_sw_b 8814A: 1'b0*/
|
||||
u1Byte bt_RF_ch_LSB: 6; /*8812A: 6'b0 8814A: bt rf channel keep[5:0]*/
|
||||
#else /*_BIG_ENDIAN_ */
|
||||
u1Byte bt_RF_ch_LSB: 6;
|
||||
u1Byte ant_div_sw_b: 1;
|
||||
u1Byte ant_div_sw_a: 1;
|
||||
#endif
|
||||
s1Byte cfotail[2]; /*DW2 byte 1 DW2 byte 2 path-A and path-B CFO tail*/
|
||||
u1Byte PCTS_MSK_RPT_0; /*PCTS mask report[7:0]*/
|
||||
u1Byte PCTS_MSK_RPT_1; /*PCTS mask report[15:8]*/
|
||||
|
||||
/* DWORD 3*/
|
||||
s1Byte rxevm[2]; /*DW3 byte 1 DW3 byte 2 stream 1 and stream 2 RX EVM*/
|
||||
s1Byte rxsnr[2]; /*DW3 byte 3 DW4 byte 0 path-A and path-B RX SNR*/
|
||||
|
||||
/* DWORD 4*/
|
||||
u1Byte PCTS_MSK_RPT_2; /*PCTS mask report[23:16]*/
|
||||
#if (ODM_ENDIAN_TYPE == ODM_ENDIAN_LITTLE)
|
||||
u1Byte PCTS_MSK_RPT_3: 6; /*PCTS mask report[29:24]*/
|
||||
u1Byte pcts_rpt_valid: 1; /*pcts_rpt_valid*/
|
||||
u1Byte resvd_1: 1; /*1'b0*/
|
||||
#else /*_BIG_ENDIAN_*/
|
||||
u1Byte resvd_1: 1;
|
||||
u1Byte pcts_rpt_valid: 1;
|
||||
u1Byte PCTS_MSK_RPT_3: 6;
|
||||
#endif
|
||||
s1Byte rxevm_cd[2]; /*DW 4 byte 3 DW5 byte 0 8812A: 16'b0 8814A: stream 3 and stream 4 RX EVM*/
|
||||
|
||||
/* DWORD 5*/
|
||||
u1Byte csi_current[2]; /*DW5 byte 1 DW5 byte 2 8812A: stream 1 and 2 CSI 8814A: path-C and path-D RX SNR*/
|
||||
u1Byte gain_trsw_cd[2]; /*DW5 byte 3 DW6 byte 0 path-C and path-D {TRSW, gain[6:0] }*/
|
||||
|
||||
/* DWORD 6*/
|
||||
s1Byte sigevm; /*signal field EVM*/
|
||||
#if (ODM_ENDIAN_TYPE == ODM_ENDIAN_LITTLE)
|
||||
u1Byte antidx_antc: 3; /*8812A: 3'b0 8814A: antidx_antc[2:0]*/
|
||||
u1Byte antidx_antd: 3; /*8812A: 3'b0 8814A: antidx_antd[2:0]*/
|
||||
u1Byte dpdt_ctrl_keep: 1; /*8812A: 1'b0 8814A: dpdt_ctrl_keep*/
|
||||
u1Byte GNT_BT_keep: 1; /*8812A: 1'b0 8814A: GNT_BT_keep*/
|
||||
#else /*_BIG_ENDIAN_*/
|
||||
u1Byte GNT_BT_keep: 1;
|
||||
u1Byte dpdt_ctrl_keep: 1;
|
||||
u1Byte antidx_antd: 3;
|
||||
u1Byte antidx_antc: 3;
|
||||
#endif
|
||||
#if (ODM_ENDIAN_TYPE == ODM_ENDIAN_LITTLE)
|
||||
u1Byte antidx_anta: 3; /*antidx_anta[2:0]*/
|
||||
u1Byte antidx_antb: 3; /*antidx_antb[2:0]*/
|
||||
u1Byte hw_antsw_occur: 2; /*1'b0*/
|
||||
#else /*_BIG_ENDIAN_*/
|
||||
u1Byte hw_antsw_occur: 2;
|
||||
u1Byte antidx_antb: 3;
|
||||
u1Byte antidx_anta: 3;
|
||||
#endif
|
||||
} PHY_STATUS_RPT_8812_T, *PPHY_STATUS_RPT_8812_T;
|
||||
|
||||
VOID
|
||||
odm_Init_RSSIForDM(
|
||||
IN OUT PDM_ODM_T pDM_Odm
|
||||
);
|
||||
|
||||
VOID
|
||||
ODM_PhyStatusQuery(
|
||||
IN OUT PDM_ODM_T pDM_Odm,
|
||||
OUT PODM_PHY_INFO_T pPhyInfo,
|
||||
IN pu1Byte pPhyStatus,
|
||||
IN PODM_PACKET_INFO_T pPktinfo
|
||||
);
|
||||
|
||||
VOID
|
||||
ODM_MacStatusQuery(
|
||||
IN OUT PDM_ODM_T pDM_Odm,
|
||||
IN pu1Byte pMacStatus,
|
||||
IN u1Byte MacID,
|
||||
IN BOOLEAN bPacketMatchBSSID,
|
||||
IN BOOLEAN bPacketToSelf,
|
||||
IN BOOLEAN bPacketBeacon
|
||||
);
|
||||
|
||||
HAL_STATUS
|
||||
ODM_ConfigRFWithTxPwrTrackHeaderFile(
|
||||
IN PDM_ODM_T pDM_Odm
|
||||
);
|
||||
|
||||
HAL_STATUS
|
||||
ODM_ConfigRFWithHeaderFile(
|
||||
IN PDM_ODM_T pDM_Odm,
|
||||
IN ODM_RF_Config_Type ConfigType,
|
||||
IN ODM_RF_RADIO_PATH_E eRFPath
|
||||
);
|
||||
|
||||
HAL_STATUS
|
||||
ODM_ConfigBBWithHeaderFile(
|
||||
IN PDM_ODM_T pDM_Odm,
|
||||
IN ODM_BB_Config_Type ConfigType
|
||||
);
|
||||
|
||||
HAL_STATUS
|
||||
ODM_ConfigMACWithHeaderFile(
|
||||
IN PDM_ODM_T pDM_Odm
|
||||
);
|
||||
|
||||
HAL_STATUS
|
||||
ODM_ConfigFWWithHeaderFile(
|
||||
IN PDM_ODM_T pDM_Odm,
|
||||
IN ODM_FW_Config_Type ConfigType,
|
||||
OUT u1Byte *pFirmware,
|
||||
OUT u4Byte *pSize
|
||||
);
|
||||
|
||||
u4Byte
|
||||
ODM_GetHWImgVersion(
|
||||
IN PDM_ODM_T pDM_Odm
|
||||
);
|
||||
|
||||
s4Byte
|
||||
odm_SignalScaleMapping(
|
||||
IN OUT PDM_ODM_T pDM_Odm,
|
||||
IN s4Byte CurrSig
|
||||
);
|
||||
|
||||
#if (RTL8822B_SUPPORT == 1)
|
||||
/*For 8822B only!! need to move to FW finally */
|
||||
/*==============================================*/
|
||||
VOID
|
||||
phydm_RxPhyStatusJaguarSeries2(
|
||||
IN PDM_ODM_T pPhydm,
|
||||
IN pu1Byte pPhyStatus,
|
||||
IN PODM_PACKET_INFO_T pPktinfo,
|
||||
OUT PODM_PHY_INFO_T pPhyInfo
|
||||
);
|
||||
|
||||
typedef struct _Phy_Status_Rpt_Jaguar2_Type0 {
|
||||
/* DW0 */
|
||||
u1Byte page_num;
|
||||
u1Byte pwdb;
|
||||
#if (ODM_ENDIAN_TYPE == ODM_ENDIAN_LITTLE)
|
||||
u1Byte gain: 6;
|
||||
u1Byte rsvd_0: 1;
|
||||
u1Byte trsw: 1;
|
||||
#else
|
||||
u1Byte trsw: 1;
|
||||
u1Byte rsvd_0: 1;
|
||||
u1Byte gain: 6;
|
||||
#endif
|
||||
u1Byte rsvd_1;
|
||||
|
||||
/* DW1 */
|
||||
u1Byte rsvd_2;
|
||||
#if (ODM_ENDIAN_TYPE == ODM_ENDIAN_LITTLE)
|
||||
u1Byte rxsc: 4;
|
||||
u1Byte agc_table: 4;
|
||||
#else
|
||||
u1Byte agc_table: 4;
|
||||
u1Byte rxsc: 4;
|
||||
#endif
|
||||
u1Byte channel;
|
||||
u1Byte band;
|
||||
|
||||
/* DW2 */
|
||||
u2Byte length;
|
||||
#if (ODM_ENDIAN_TYPE == ODM_ENDIAN_LITTLE)
|
||||
u1Byte antidx_a: 3;
|
||||
u1Byte antidx_b: 3;
|
||||
u1Byte rsvd_3: 2;
|
||||
u1Byte antidx_c: 3;
|
||||
u1Byte antidx_d: 3;
|
||||
u1Byte rsvd_4:2;
|
||||
#else
|
||||
u1Byte rsvd_3: 2;
|
||||
u1Byte antidx_b: 3;
|
||||
u1Byte antidx_a: 3;
|
||||
u1Byte rsvd_4:2;
|
||||
u1Byte antidx_d: 3;
|
||||
u1Byte antidx_c: 3;
|
||||
#endif
|
||||
|
||||
/* DW3 */
|
||||
u1Byte signal_quality;
|
||||
u1Byte agc_rpt;
|
||||
u1Byte bb_power;
|
||||
u1Byte rsvd_5;
|
||||
|
||||
/* DW4 */
|
||||
u4Byte rsvd_6;
|
||||
|
||||
/* DW5 */
|
||||
u4Byte rsvd_7;
|
||||
|
||||
/* DW6 */
|
||||
u4Byte rsvd_8;
|
||||
} PHY_STATUS_RPT_JAGUAR2_TYPE0, *PPHY_STATUS_RPT_JAGUAR2_TYPE0;
|
||||
|
||||
typedef struct _Phy_Status_Rpt_Jaguar2_Type1 {
|
||||
/* DW0 and DW1 */
|
||||
u1Byte page_num;
|
||||
u1Byte pwdb[4];
|
||||
#if (ODM_ENDIAN_TYPE == ODM_ENDIAN_LITTLE)
|
||||
u1Byte l_rxsc: 4;
|
||||
u1Byte ht_rxsc: 4;
|
||||
#else
|
||||
u1Byte ht_rxsc: 4;
|
||||
u1Byte l_rxsc: 4;
|
||||
#endif
|
||||
u1Byte channel;
|
||||
#if (ODM_ENDIAN_TYPE == ODM_ENDIAN_LITTLE)
|
||||
u1Byte band: 2;
|
||||
u1Byte rsvd_0: 1;
|
||||
u1Byte hw_antsw_occu: 1;
|
||||
u1Byte gnt_bt: 1;
|
||||
u1Byte ldpc: 1;
|
||||
u1Byte stbc: 1;
|
||||
u1Byte beamformed: 1;
|
||||
#else
|
||||
u1Byte beamformed: 1;
|
||||
u1Byte stbc: 1;
|
||||
u1Byte ldpc: 1;
|
||||
u1Byte gnt_bt: 1;
|
||||
u1Byte hw_antsw_occu: 1;
|
||||
u1Byte rsvd_0: 1;
|
||||
u1Byte band: 2;
|
||||
#endif
|
||||
|
||||
/* DW2 */
|
||||
u2Byte lsig_length;
|
||||
#if (ODM_ENDIAN_TYPE == ODM_ENDIAN_LITTLE)
|
||||
u1Byte antidx_a: 3;
|
||||
u1Byte antidx_b: 3;
|
||||
u1Byte rsvd_1: 2;
|
||||
u1Byte antidx_c: 3;
|
||||
u1Byte antidx_d: 3;
|
||||
u1Byte rsvd_2: 2;
|
||||
#else
|
||||
u1Byte rsvd_1: 2;
|
||||
u1Byte antidx_b: 3;
|
||||
u1Byte antidx_a: 3;
|
||||
u1Byte rsvd_2: 2;
|
||||
u1Byte antidx_d: 3;
|
||||
u1Byte antidx_c: 3;
|
||||
#endif
|
||||
|
||||
/* DW3 */
|
||||
u1Byte paid;
|
||||
#if (ODM_ENDIAN_TYPE == ODM_ENDIAN_LITTLE)
|
||||
u1Byte paid_msb: 1;
|
||||
u1Byte gid: 6;
|
||||
u1Byte rsvd_3: 1;
|
||||
#else
|
||||
u1Byte rsvd_3: 1;
|
||||
u1Byte gid: 6;
|
||||
u1Byte paid_msb: 1;
|
||||
#endif
|
||||
u1Byte intf_pos;
|
||||
#if (ODM_ENDIAN_TYPE == ODM_ENDIAN_LITTLE)
|
||||
u1Byte intf_pos_msb: 1;
|
||||
u1Byte rsvd_4: 2;
|
||||
u1Byte nb_intf_flag: 1;
|
||||
u1Byte rf_mode: 2;
|
||||
u1Byte rsvd_5: 2;
|
||||
#else
|
||||
u1Byte rsvd_5: 2;
|
||||
u1Byte rf_mode: 2;
|
||||
u1Byte nb_intf_flag: 1;
|
||||
u1Byte rsvd_4: 2;
|
||||
u1Byte intf_pos_msb: 1;
|
||||
#endif
|
||||
|
||||
/* DW4 */
|
||||
s1Byte rxevm[4]; /* s(8,1) */
|
||||
|
||||
/* DW5 */
|
||||
s1Byte cfo_tail[4]; /* s(8,7) */
|
||||
|
||||
/* DW6 */
|
||||
s1Byte rxsnr[4]; /* s(8,1) */
|
||||
} PHY_STATUS_RPT_JAGUAR2_TYPE1, *PPHY_STATUS_RPT_JAGUAR2_TYPE1;
|
||||
|
||||
typedef struct _Phy_Status_Rpt_Jaguar2_Type2 {
|
||||
/* DW0 ane DW1 */
|
||||
u1Byte page_num;
|
||||
u1Byte pwdb[4];
|
||||
#if (ODM_ENDIAN_TYPE == ODM_ENDIAN_LITTLE)
|
||||
u1Byte l_rxsc: 4;
|
||||
u1Byte ht_rxsc: 4;
|
||||
#else
|
||||
u1Byte ht_rxsc: 4;
|
||||
u1Byte l_rxsc: 4;
|
||||
#endif
|
||||
u1Byte channel;
|
||||
#if (ODM_ENDIAN_TYPE == ODM_ENDIAN_LITTLE)
|
||||
u1Byte band: 2;
|
||||
u1Byte rsvd_0: 1;
|
||||
u1Byte hw_antsw_occu: 1;
|
||||
u1Byte gnt_bt: 1;
|
||||
u1Byte ldpc: 1;
|
||||
u1Byte stbc: 1;
|
||||
u1Byte beamformed: 1;
|
||||
#else
|
||||
u1Byte beamformed: 1;
|
||||
u1Byte stbc: 1;
|
||||
u1Byte ldpc: 1;
|
||||
u1Byte gnt_bt: 1;
|
||||
u1Byte hw_antsw_occu: 1;
|
||||
u1Byte rsvd_0: 1;
|
||||
u1Byte band: 2;
|
||||
#endif
|
||||
|
||||
/* DW2 */
|
||||
#if (ODM_ENDIAN_TYPE == ODM_ENDIAN_LITTLE)
|
||||
u1Byte shift_l_map: 6;
|
||||
u1Byte rsvd_1: 2;
|
||||
#else
|
||||
u1Byte rsvd_1: 2;
|
||||
u1Byte shift_l_map: 6;
|
||||
#endif
|
||||
u1Byte cnt_pw2cca;
|
||||
#if (ODM_ENDIAN_TYPE == ODM_ENDIAN_LITTLE)
|
||||
u1Byte agc_table_a: 4;
|
||||
u1Byte agc_table_b: 4;
|
||||
u1Byte agc_table_c: 4;
|
||||
u1Byte agc_table_d: 4;
|
||||
#else
|
||||
u1Byte agc_table_b: 4;
|
||||
u1Byte agc_table_a: 4;
|
||||
u1Byte agc_table_d: 4;
|
||||
u1Byte agc_table_c: 4;
|
||||
#endif
|
||||
|
||||
/* DW3 ~ DW6*/
|
||||
u1Byte cnt_cca2agc_rdy;
|
||||
#if (ODM_ENDIAN_TYPE == ODM_ENDIAN_LITTLE)
|
||||
u1Byte gain_a: 6;
|
||||
u1Byte rsvd_2: 1;
|
||||
u1Byte trsw_a: 1;
|
||||
u1Byte gain_b: 6;
|
||||
u1Byte rsvd_3: 1;
|
||||
u1Byte trsw_b: 1;
|
||||
u1Byte gain_c: 6;
|
||||
u1Byte rsvd_4: 1;
|
||||
u1Byte trsw_c: 1;
|
||||
u1Byte gain_d: 6;
|
||||
u1Byte rsvd_5: 1;
|
||||
u1Byte trsw_d: 1;
|
||||
u1Byte aagc_step_a: 2;
|
||||
u1Byte aagc_step_b: 2;
|
||||
u1Byte aagc_step_c: 2;
|
||||
u1Byte aagc_step_d: 2;
|
||||
#else
|
||||
u1Byte trsw_a: 1;
|
||||
u1Byte rsvd_2: 1;
|
||||
u1Byte gain_a: 6;
|
||||
u1Byte trsw_b: 1;
|
||||
u1Byte rsvd_3: 1;
|
||||
u1Byte gain_b: 6;
|
||||
u1Byte trsw_c: 1;
|
||||
u1Byte rsvd_4: 1;
|
||||
u1Byte gain_c: 6;
|
||||
u1Byte trsw_d: 1;
|
||||
u1Byte rsvd_5: 1;
|
||||
u1Byte gain_d: 6;
|
||||
u1Byte aagc_step_d: 2;
|
||||
u1Byte aagc_step_c: 2;
|
||||
u1Byte aagc_step_b: 2;
|
||||
u1Byte aagc_step_a: 2;
|
||||
#endif
|
||||
u1Byte ht_aagc_gain[4];
|
||||
u1Byte dagc_gain[4];
|
||||
#if (ODM_ENDIAN_TYPE == ODM_ENDIAN_LITTLE)
|
||||
u1Byte counter: 6;
|
||||
u1Byte rsvd_6: 2;
|
||||
u1Byte syn_count: 5;
|
||||
u1Byte rsvd_7:3;
|
||||
#else
|
||||
u1Byte rsvd_6: 2;
|
||||
u1Byte counter: 6;
|
||||
u1Byte rsvd_7:3;
|
||||
u1Byte syn_count: 5;
|
||||
#endif
|
||||
} PHY_STATUS_RPT_JAGUAR2_TYPE2, *PPHY_STATUS_RPT_JAGUAR2_TYPE2;
|
||||
/*==============================================*/
|
||||
#endif
|
||||
#endif
|
||||
|
||||
1014
hal/phydm/phydm_interface.c
Normal file
1014
hal/phydm/phydm_interface.c
Normal file
File diff suppressed because it is too large
Load diff
442
hal/phydm/phydm_interface.h
Normal file
442
hal/phydm/phydm_interface.h
Normal file
|
|
@ -0,0 +1,442 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
#ifndef __ODM_INTERFACE_H__
|
||||
#define __ODM_INTERFACE_H__
|
||||
|
||||
#define INTERFACE_VERSION "1.0" /*2015.01.13 Dino*/
|
||||
|
||||
//
|
||||
// =========== Constant/Structure/Enum/... Define
|
||||
//
|
||||
|
||||
|
||||
|
||||
//
|
||||
// =========== Macro Define
|
||||
//
|
||||
|
||||
#define _reg_all(_name) ODM_##_name
|
||||
#define _reg_ic(_name, _ic) ODM_##_name##_ic
|
||||
#define _bit_all(_name) BIT_##_name
|
||||
#define _bit_ic(_name, _ic) BIT_##_name##_ic
|
||||
|
||||
// _cat: implemented by Token-Pasting Operator.
|
||||
#if 0
|
||||
#define _cat(_name, _ic_type, _func) \
|
||||
( \
|
||||
_func##_all(_name) \
|
||||
)
|
||||
#endif
|
||||
|
||||
/*===================================
|
||||
|
||||
#define ODM_REG_DIG_11N 0xC50
|
||||
#define ODM_REG_DIG_11AC 0xDDD
|
||||
|
||||
ODM_REG(DIG,_pDM_Odm)
|
||||
=====================================*/
|
||||
|
||||
#define _reg_11N(_name) ODM_REG_##_name##_11N
|
||||
#define _reg_11AC(_name) ODM_REG_##_name##_11AC
|
||||
#define _bit_11N(_name) ODM_BIT_##_name##_11N
|
||||
#define _bit_11AC(_name) ODM_BIT_##_name##_11AC
|
||||
|
||||
#ifdef __ECOS
|
||||
#define _rtk_cat(_name, _ic_type, _func) \
|
||||
( \
|
||||
((_ic_type) & ODM_IC_11N_SERIES)? _func##_11N(_name): \
|
||||
_func##_11AC(_name) \
|
||||
)
|
||||
#else
|
||||
|
||||
#define _cat(_name, _ic_type, _func) \
|
||||
( \
|
||||
((_ic_type) & ODM_IC_11N_SERIES)? _func##_11N(_name): \
|
||||
_func##_11AC(_name) \
|
||||
)
|
||||
#endif
|
||||
/*
|
||||
// only sample code
|
||||
//#define _cat(_name, _ic_type, _func) \
|
||||
// ( \
|
||||
// ((_ic_type) & ODM_RTL8192C)? _func##_ic(_name, _8192C): \
|
||||
// ((_ic_type) & ODM_RTL8192D)? _func##_ic(_name, _8192D): \
|
||||
// ((_ic_type) & ODM_RTL8192S)? _func##_ic(_name, _8192S): \
|
||||
// ((_ic_type) & ODM_RTL8723A)? _func##_ic(_name, _8723A): \
|
||||
// ((_ic_type) & ODM_RTL8188E)? _func##_ic(_name, _8188E): \
|
||||
// _func##_ic(_name, _8195) \
|
||||
// )
|
||||
*/
|
||||
|
||||
// _name: name of register or bit.
|
||||
// Example: "ODM_REG(R_A_AGC_CORE1, pDM_Odm)"
|
||||
// gets "ODM_R_A_AGC_CORE1" or "ODM_R_A_AGC_CORE1_8192C", depends on SupportICType.
|
||||
#ifdef __ECOS
|
||||
#define ODM_REG(_name, _pDM_Odm) _rtk_cat(_name, _pDM_Odm->SupportICType, _reg)
|
||||
#define ODM_BIT(_name, _pDM_Odm) _rtk_cat(_name, _pDM_Odm->SupportICType, _bit)
|
||||
#else
|
||||
#define ODM_REG(_name, _pDM_Odm) _cat(_name, _pDM_Odm->SupportICType, _reg)
|
||||
#define ODM_BIT(_name, _pDM_Odm) _cat(_name, _pDM_Odm->SupportICType, _bit)
|
||||
#endif
|
||||
typedef enum _PHYDM_H2C_CMD {
|
||||
ODM_H2C_RSSI_REPORT = 0,
|
||||
ODM_H2C_PSD_RESULT = 1,
|
||||
ODM_H2C_PathDiv = 2,
|
||||
ODM_H2C_WIFI_CALIBRATION = 3,
|
||||
ODM_H2C_IQ_CALIBRATION = 4,
|
||||
ODM_H2C_RA_PARA_ADJUST = 5,
|
||||
PHYDM_H2C_DYNAMIC_TX_PATH = 6,
|
||||
PHYDM_H2C_FW_TRACE_EN = 7,
|
||||
PHYDM_H2C_TXBF = 8,
|
||||
ODM_MAX_H2CCMD
|
||||
} PHYDM_H2C_CMD;
|
||||
|
||||
typedef enum _PHYDM_C2H_EVT {
|
||||
PHYDM_C2H_DBG = 0,
|
||||
PHYDM_C2H_LB = 1,
|
||||
PHYDM_C2H_XBF = 2,
|
||||
PHYDM_C2H_TX_REPORT = 3,
|
||||
PHYDM_C2H_INFO = 9,
|
||||
PHYDM_C2H_BT_MP = 11,
|
||||
PHYDM_C2H_RA_RPT = 12,
|
||||
PHYDM_C2H_RA_PARA_RPT = 14,
|
||||
PHYDM_C2H_DYNAMIC_TX_PATH_RPT = 15,
|
||||
PHYDM_C2H_IQK_FINISH = 17, /*0x11*/
|
||||
PHYDM_C2H_DBG_CODE = 0xFE,
|
||||
PHYDM_C2H_EXTEND = 0xFF,
|
||||
} PHYDM_C2H_EVT;
|
||||
|
||||
typedef enum _PHYDM_EXTEND_C2H_EVT {
|
||||
PHYDM_EXTEND_C2H_DBG_PRINT = 0
|
||||
|
||||
} PHYDM_EXTEND_C2H_EVT;
|
||||
|
||||
typedef enum _PHYDM_ACTING_TYPE {
|
||||
PhyDM_ACTING_AS_IBSS = 0,
|
||||
PhyDM_ACTING_AS_AP = 1
|
||||
} PHYDM_ACTING_TYPE;
|
||||
|
||||
|
||||
//
|
||||
// 2012/02/17 MH For non-MP compile pass only. Linux does not support workitem.
|
||||
// Suggest HW team to use thread instead of workitem. Windows also support the feature.
|
||||
//
|
||||
#if (DM_ODM_SUPPORT_TYPE != ODM_WIN)
|
||||
typedef void *PRT_WORK_ITEM ;
|
||||
typedef void RT_WORKITEM_HANDLE,*PRT_WORKITEM_HANDLE;
|
||||
typedef VOID (*RT_WORKITEM_CALL_BACK)(PVOID pContext);
|
||||
|
||||
#if 0
|
||||
typedef struct tasklet_struct RT_WORKITEM_HANDLE, *PRT_WORKITEM_HANDLE;
|
||||
|
||||
typedef struct _RT_WORK_ITEM
|
||||
{
|
||||
|
||||
RT_WORKITEM_HANDLE Handle; // Platform-dependent handle for this workitem, e.g. Ndis Workitem object.
|
||||
PVOID Adapter; // Pointer to Adapter object.
|
||||
PVOID pContext; // Parameter to passed to CallBackFunc().
|
||||
RT_WORKITEM_CALL_BACK CallbackFunc; // Callback function of the workitem.
|
||||
u1Byte RefCount; // 0: driver is going to unload, 1: No such workitem scheduled, 2: one workitem is schedueled.
|
||||
PVOID pPlatformExt; // Pointer to platform-dependent extension.
|
||||
BOOLEAN bFree;
|
||||
char szID[36]; // An identity string of this workitem.
|
||||
}RT_WORK_ITEM, *PRT_WORK_ITEM;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
//
|
||||
// =========== Extern Variable ??? It should be forbidden.
|
||||
//
|
||||
|
||||
|
||||
//
|
||||
// =========== EXtern Function Prototype
|
||||
//
|
||||
|
||||
|
||||
u1Byte
|
||||
ODM_Read1Byte(
|
||||
IN PDM_ODM_T pDM_Odm,
|
||||
IN u4Byte RegAddr
|
||||
);
|
||||
|
||||
u2Byte
|
||||
ODM_Read2Byte(
|
||||
IN PDM_ODM_T pDM_Odm,
|
||||
IN u4Byte RegAddr
|
||||
);
|
||||
|
||||
u4Byte
|
||||
ODM_Read4Byte(
|
||||
IN PDM_ODM_T pDM_Odm,
|
||||
IN u4Byte RegAddr
|
||||
);
|
||||
|
||||
VOID
|
||||
ODM_Write1Byte(
|
||||
IN PDM_ODM_T pDM_Odm,
|
||||
IN u4Byte RegAddr,
|
||||
IN u1Byte Data
|
||||
);
|
||||
|
||||
VOID
|
||||
ODM_Write2Byte(
|
||||
IN PDM_ODM_T pDM_Odm,
|
||||
IN u4Byte RegAddr,
|
||||
IN u2Byte Data
|
||||
);
|
||||
|
||||
VOID
|
||||
ODM_Write4Byte(
|
||||
IN PDM_ODM_T pDM_Odm,
|
||||
IN u4Byte RegAddr,
|
||||
IN u4Byte Data
|
||||
);
|
||||
|
||||
VOID
|
||||
ODM_SetMACReg(
|
||||
IN PDM_ODM_T pDM_Odm,
|
||||
IN u4Byte RegAddr,
|
||||
IN u4Byte BitMask,
|
||||
IN u4Byte Data
|
||||
);
|
||||
|
||||
u4Byte
|
||||
ODM_GetMACReg(
|
||||
IN PDM_ODM_T pDM_Odm,
|
||||
IN u4Byte RegAddr,
|
||||
IN u4Byte BitMask
|
||||
);
|
||||
|
||||
VOID
|
||||
ODM_SetBBReg(
|
||||
IN PDM_ODM_T pDM_Odm,
|
||||
IN u4Byte RegAddr,
|
||||
IN u4Byte BitMask,
|
||||
IN u4Byte Data
|
||||
);
|
||||
|
||||
u4Byte
|
||||
ODM_GetBBReg(
|
||||
IN PDM_ODM_T pDM_Odm,
|
||||
IN u4Byte RegAddr,
|
||||
IN u4Byte BitMask
|
||||
);
|
||||
|
||||
VOID
|
||||
ODM_SetRFReg(
|
||||
IN PDM_ODM_T pDM_Odm,
|
||||
IN ODM_RF_RADIO_PATH_E eRFPath,
|
||||
IN u4Byte RegAddr,
|
||||
IN u4Byte BitMask,
|
||||
IN u4Byte Data
|
||||
);
|
||||
|
||||
u4Byte
|
||||
ODM_GetRFReg(
|
||||
IN PDM_ODM_T pDM_Odm,
|
||||
IN ODM_RF_RADIO_PATH_E eRFPath,
|
||||
IN u4Byte RegAddr,
|
||||
IN u4Byte BitMask
|
||||
);
|
||||
|
||||
|
||||
//
|
||||
// Memory Relative Function.
|
||||
//
|
||||
VOID
|
||||
ODM_AllocateMemory(
|
||||
IN PDM_ODM_T pDM_Odm,
|
||||
OUT PVOID *pPtr,
|
||||
IN u4Byte length
|
||||
);
|
||||
VOID
|
||||
ODM_FreeMemory(
|
||||
IN PDM_ODM_T pDM_Odm,
|
||||
OUT PVOID pPtr,
|
||||
IN u4Byte length
|
||||
);
|
||||
|
||||
VOID
|
||||
ODM_MoveMemory(
|
||||
IN PDM_ODM_T pDM_Odm,
|
||||
OUT PVOID pDest,
|
||||
IN PVOID pSrc,
|
||||
IN u4Byte Length
|
||||
);
|
||||
|
||||
s4Byte ODM_CompareMemory(
|
||||
IN PDM_ODM_T pDM_Odm,
|
||||
IN PVOID pBuf1,
|
||||
IN PVOID pBuf2,
|
||||
IN u4Byte length
|
||||
);
|
||||
|
||||
void ODM_Memory_Set
|
||||
(IN PDM_ODM_T pDM_Odm,
|
||||
IN PVOID pbuf,
|
||||
IN s1Byte value,
|
||||
IN u4Byte length);
|
||||
|
||||
//
|
||||
// ODM MISC-spin lock relative API.
|
||||
//
|
||||
VOID
|
||||
ODM_AcquireSpinLock(
|
||||
IN PDM_ODM_T pDM_Odm,
|
||||
IN RT_SPINLOCK_TYPE type
|
||||
);
|
||||
|
||||
VOID
|
||||
ODM_ReleaseSpinLock(
|
||||
IN PDM_ODM_T pDM_Odm,
|
||||
IN RT_SPINLOCK_TYPE type
|
||||
);
|
||||
|
||||
|
||||
//
|
||||
// ODM MISC-workitem relative API.
|
||||
//
|
||||
VOID
|
||||
ODM_InitializeWorkItem(
|
||||
IN PDM_ODM_T pDM_Odm,
|
||||
IN PRT_WORK_ITEM pRtWorkItem,
|
||||
IN RT_WORKITEM_CALL_BACK RtWorkItemCallback,
|
||||
IN PVOID pContext,
|
||||
IN const char* szID
|
||||
);
|
||||
|
||||
VOID
|
||||
ODM_StartWorkItem(
|
||||
IN PRT_WORK_ITEM pRtWorkItem
|
||||
);
|
||||
|
||||
VOID
|
||||
ODM_StopWorkItem(
|
||||
IN PRT_WORK_ITEM pRtWorkItem
|
||||
);
|
||||
|
||||
VOID
|
||||
ODM_FreeWorkItem(
|
||||
IN PRT_WORK_ITEM pRtWorkItem
|
||||
);
|
||||
|
||||
VOID
|
||||
ODM_ScheduleWorkItem(
|
||||
IN PRT_WORK_ITEM pRtWorkItem
|
||||
);
|
||||
|
||||
VOID
|
||||
ODM_IsWorkItemScheduled(
|
||||
IN PRT_WORK_ITEM pRtWorkItem
|
||||
);
|
||||
|
||||
//
|
||||
// ODM Timer relative API.
|
||||
//
|
||||
VOID
|
||||
ODM_StallExecution(
|
||||
IN u4Byte usDelay
|
||||
);
|
||||
|
||||
VOID
|
||||
ODM_delay_ms(IN u4Byte ms);
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
ODM_delay_us(IN u4Byte us);
|
||||
|
||||
VOID
|
||||
ODM_sleep_ms(IN u4Byte ms);
|
||||
|
||||
VOID
|
||||
ODM_sleep_us(IN u4Byte us);
|
||||
|
||||
VOID
|
||||
ODM_SetTimer(
|
||||
IN PDM_ODM_T pDM_Odm,
|
||||
IN PRT_TIMER pTimer,
|
||||
IN u4Byte msDelay
|
||||
);
|
||||
|
||||
VOID
|
||||
ODM_InitializeTimer(
|
||||
IN PDM_ODM_T pDM_Odm,
|
||||
IN PRT_TIMER pTimer,
|
||||
IN RT_TIMER_CALL_BACK CallBackFunc,
|
||||
IN PVOID pContext,
|
||||
IN const char* szID
|
||||
);
|
||||
|
||||
VOID
|
||||
ODM_CancelTimer(
|
||||
IN PDM_ODM_T pDM_Odm,
|
||||
IN PRT_TIMER pTimer
|
||||
);
|
||||
|
||||
VOID
|
||||
ODM_ReleaseTimer(
|
||||
IN PDM_ODM_T pDM_Odm,
|
||||
IN PRT_TIMER pTimer
|
||||
);
|
||||
|
||||
BOOLEAN
|
||||
phydm_actingDetermine(
|
||||
IN PDM_ODM_T pDM_Odm,
|
||||
IN PHYDM_ACTING_TYPE type
|
||||
);
|
||||
|
||||
//
|
||||
// ODM FW relative API.
|
||||
//
|
||||
VOID
|
||||
ODM_FillH2CCmd(
|
||||
IN PDM_ODM_T pDM_Odm,
|
||||
IN u1Byte ElementID,
|
||||
IN u4Byte CmdLen,
|
||||
IN pu1Byte pCmdBuffer
|
||||
);
|
||||
|
||||
u1Byte
|
||||
phydm_c2H_content_parsing(
|
||||
IN PVOID pDM_VOID,
|
||||
IN u1Byte c2hCmdId,
|
||||
IN u1Byte c2hCmdLen,
|
||||
IN pu1Byte tmpBuf
|
||||
);
|
||||
|
||||
u8Byte
|
||||
ODM_GetCurrentTime(
|
||||
IN PDM_ODM_T pDM_Odm
|
||||
);
|
||||
u8Byte
|
||||
ODM_GetProgressingTime(
|
||||
IN PDM_ODM_T pDM_Odm,
|
||||
IN u8Byte Start_Time
|
||||
);
|
||||
|
||||
#endif // __ODM_INTERFACE_H__
|
||||
|
||||
299
hal/phydm/phydm_noisemonitor.c
Normal file
299
hal/phydm/phydm_noisemonitor.c
Normal file
|
|
@ -0,0 +1,299 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
//============================================================
|
||||
// include files
|
||||
//============================================================
|
||||
//#include "mp_precomp.h"
|
||||
#include "phydm_precomp.h"
|
||||
#include "phydm_noisemonitor.h"
|
||||
|
||||
//=================================================
|
||||
// This function is for inband noise test utility only
|
||||
// To obtain the inband noise level(dbm), do the following.
|
||||
// 1. disable DIG and Power Saving
|
||||
// 2. Set initial gain = 0x1a
|
||||
// 3. Stop updating idle time pwer report (for driver read)
|
||||
// - 0x80c[25]
|
||||
//
|
||||
//=================================================
|
||||
|
||||
#define Valid_Min -35
|
||||
#define Valid_Max 10
|
||||
#define ValidCnt 5
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE & (ODM_CE))
|
||||
|
||||
s2Byte odm_InbandNoise_Monitor_NSeries(PDM_ODM_T pDM_Odm,u8 bPauseDIG,u8 IGIValue,u32 max_time)
|
||||
{
|
||||
u4Byte tmp4b;
|
||||
u1Byte max_rf_path=0,rf_path;
|
||||
u1Byte reg_c50, reg_c58,valid_done=0;
|
||||
struct noise_level noise_data;
|
||||
u32 start = 0, func_start=0, func_end = 0;
|
||||
|
||||
func_start = ODM_GetCurrentTime(pDM_Odm);
|
||||
pDM_Odm->noise_level.noise_all = 0;
|
||||
|
||||
if((pDM_Odm->RFType == ODM_1T2R) ||(pDM_Odm->RFType == ODM_2T2R))
|
||||
max_rf_path = 2;
|
||||
else
|
||||
max_rf_path = 1;
|
||||
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD,("odm_DebugControlInbandNoise_Nseries() ==> \n"));
|
||||
|
||||
ODM_Memory_Set(pDM_Odm,&noise_data,0,sizeof(struct noise_level));
|
||||
|
||||
//
|
||||
// Step 1. Disable DIG && Set initial gain.
|
||||
//
|
||||
|
||||
if(bPauseDIG)
|
||||
{
|
||||
odm_PauseDIG(pDM_Odm, PHYDM_PAUSE, PHYDM_PAUSE_LEVEL_1, IGIValue);
|
||||
}
|
||||
//
|
||||
// Step 2. Disable all power save for read registers
|
||||
//
|
||||
//dcmd_DebugControlPowerSave(pAdapter, PSDisable);
|
||||
|
||||
//
|
||||
// Step 3. Get noise power level
|
||||
//
|
||||
start = ODM_GetCurrentTime(pDM_Odm);
|
||||
while(1)
|
||||
{
|
||||
|
||||
//Stop updating idle time pwer report (for driver read)
|
||||
ODM_SetBBReg(pDM_Odm, rFPGA0_TxGainStage, BIT25, 1);
|
||||
|
||||
//Read Noise Floor Report
|
||||
tmp4b = ODM_GetBBReg(pDM_Odm, 0x8f8,bMaskDWord );
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD,("Noise Floor Report (0x8f8) = 0x%08x\n", tmp4b));
|
||||
|
||||
//ODM_SetBBReg(pDM_Odm, rOFDM0_XAAGCCore1, bMaskByte0, TestInitialGain);
|
||||
//if(max_rf_path == 2)
|
||||
// ODM_SetBBReg(pDM_Odm, rOFDM0_XBAGCCore1, bMaskByte0, TestInitialGain);
|
||||
|
||||
//update idle time pwer report per 5us
|
||||
ODM_SetBBReg(pDM_Odm, rFPGA0_TxGainStage, BIT25, 0);
|
||||
|
||||
noise_data.value[ODM_RF_PATH_A] = (u1Byte)(tmp4b&0xff);
|
||||
noise_data.value[ODM_RF_PATH_B] = (u1Byte)((tmp4b&0xff00)>>8);
|
||||
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("value_a = 0x%x(%d), value_b = 0x%x(%d)\n",
|
||||
noise_data.value[ODM_RF_PATH_A], noise_data.value[ODM_RF_PATH_A], noise_data.value[ODM_RF_PATH_B], noise_data.value[ODM_RF_PATH_B]));
|
||||
|
||||
for(rf_path = ODM_RF_PATH_A; rf_path < max_rf_path; rf_path++)
|
||||
{
|
||||
noise_data.sval[rf_path] = (s1Byte)noise_data.value[rf_path];
|
||||
noise_data.sval[rf_path] /= 2;
|
||||
}
|
||||
|
||||
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD,("sval_a = %d, sval_b = %d\n",
|
||||
noise_data.sval[ODM_RF_PATH_A], noise_data.sval[ODM_RF_PATH_B]));
|
||||
//ODM_delay_ms(10);
|
||||
//ODM_sleep_ms(10);
|
||||
|
||||
for(rf_path = ODM_RF_PATH_A; rf_path < max_rf_path; rf_path++)
|
||||
{
|
||||
if( (noise_data.valid_cnt[rf_path] < ValidCnt) && (noise_data.sval[rf_path] < Valid_Max && noise_data.sval[rf_path] >= Valid_Min))
|
||||
{
|
||||
noise_data.valid_cnt[rf_path]++;
|
||||
noise_data.sum[rf_path] += noise_data.sval[rf_path];
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD,("RF_Path:%d Valid sval = %d\n", rf_path,noise_data.sval[rf_path]));
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD,("Sum of sval = %d, \n", noise_data.sum[rf_path]));
|
||||
if(noise_data.valid_cnt[rf_path] == ValidCnt)
|
||||
{
|
||||
valid_done++;
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD,("After divided, RF_Path:%d ,sum = %d \n", rf_path,noise_data.sum[rf_path]));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//printk("####### valid_done:%d #############\n",valid_done);
|
||||
if ((valid_done==max_rf_path) || (ODM_GetProgressingTime(pDM_Odm,start) > max_time))
|
||||
{
|
||||
for(rf_path = ODM_RF_PATH_A; rf_path < max_rf_path; rf_path++)
|
||||
{
|
||||
//printk("%s PATH_%d - sum = %d, valid_cnt = %d \n",__FUNCTION__,rf_path,noise_data.sum[rf_path], noise_data.valid_cnt[rf_path]);
|
||||
if(noise_data.valid_cnt[rf_path])
|
||||
noise_data.sum[rf_path] /= noise_data.valid_cnt[rf_path];
|
||||
else
|
||||
noise_data.sum[rf_path] = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
reg_c50 = (s4Byte)ODM_GetBBReg(pDM_Odm,rOFDM0_XAAGCCore1,bMaskByte0);
|
||||
reg_c50 &= ~BIT7;
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD,("0x%x = 0x%02x(%d)\n", rOFDM0_XAAGCCore1, reg_c50, reg_c50));
|
||||
pDM_Odm->noise_level.noise[ODM_RF_PATH_A] = -110 + reg_c50 + noise_data.sum[ODM_RF_PATH_A];
|
||||
pDM_Odm->noise_level.noise_all += pDM_Odm->noise_level.noise[ODM_RF_PATH_A];
|
||||
|
||||
if(max_rf_path == 2){
|
||||
reg_c58 = (s4Byte)ODM_GetBBReg(pDM_Odm,rOFDM0_XBAGCCore1,bMaskByte0);
|
||||
reg_c58 &= ~BIT7;
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD,("0x%x = 0x%02x(%d)\n", rOFDM0_XBAGCCore1, reg_c58, reg_c58));
|
||||
pDM_Odm->noise_level.noise[ODM_RF_PATH_B] = -110 + reg_c58 + noise_data.sum[ODM_RF_PATH_B];
|
||||
pDM_Odm->noise_level.noise_all += pDM_Odm->noise_level.noise[ODM_RF_PATH_B];
|
||||
}
|
||||
pDM_Odm->noise_level.noise_all /= max_rf_path;
|
||||
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD,("noise_a = %d, noise_b = %d\n",
|
||||
pDM_Odm->noise_level.noise[ODM_RF_PATH_A],
|
||||
pDM_Odm->noise_level.noise[ODM_RF_PATH_B]));
|
||||
|
||||
//
|
||||
// Step 4. Recover the Dig
|
||||
//
|
||||
if(bPauseDIG)
|
||||
{
|
||||
odm_PauseDIG(pDM_Odm, PHYDM_RESUME, PHYDM_PAUSE_LEVEL_1, IGIValue);
|
||||
}
|
||||
func_end = ODM_GetProgressingTime(pDM_Odm,func_start) ;
|
||||
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, ("odm_DebugControlInbandNoise_Nseries() <==\n"));
|
||||
return pDM_Odm->noise_level.noise_all;
|
||||
|
||||
}
|
||||
|
||||
s2Byte
|
||||
odm_InbandNoise_Monitor_ACSeries(PDM_ODM_T pDM_Odm, u8 bPauseDIG, u8 IGIValue, u32 max_time
|
||||
)
|
||||
{
|
||||
s4Byte rxi_buf_anta, rxq_buf_anta; /*rxi_buf_antb, rxq_buf_antb;*/
|
||||
s4Byte value32, pwdb_A = 0, sval, noise, sum;
|
||||
BOOLEAN pd_flag;
|
||||
u1Byte i, valid_cnt;
|
||||
u32 start = 0, func_start = 0, func_end = 0;
|
||||
|
||||
|
||||
if (!(pDM_Odm->SupportICType & (ODM_RTL8812 | ODM_RTL8821)))
|
||||
return 0;
|
||||
|
||||
func_start = ODM_GetCurrentTime(pDM_Odm);
|
||||
pDM_Odm->noise_level.noise_all = 0;
|
||||
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, ("odm_InbandNoise_Monitor_ACSeries() ==>\n"));
|
||||
|
||||
/* Step 1. Disable DIG && Set initial gain. */
|
||||
if (bPauseDIG)
|
||||
odm_PauseDIG(pDM_Odm, PHYDM_PAUSE, PHYDM_PAUSE_LEVEL_1, IGIValue);
|
||||
|
||||
/* Step 2. Disable all power save for read registers */
|
||||
/*dcmd_DebugControlPowerSave(pAdapter, PSDisable); */
|
||||
|
||||
/* Step 3. Get noise power level */
|
||||
start = ODM_GetCurrentTime(pDM_Odm);
|
||||
|
||||
/* reset counters */
|
||||
sum = 0;
|
||||
valid_cnt = 0;
|
||||
|
||||
/* Step 3. Get noise power level */
|
||||
while (1) {
|
||||
/*Set IGI=0x1C */
|
||||
ODM_Write_DIG(pDM_Odm, 0x1C);
|
||||
/*stop CK320&CK88 */
|
||||
ODM_SetBBReg(pDM_Odm, 0x8B4, BIT6, 1);
|
||||
/*Read Path-A */
|
||||
ODM_SetBBReg(pDM_Odm, 0x8FC, bMaskDWord, 0x200); /*set debug port*/
|
||||
value32 = ODM_GetBBReg(pDM_Odm, 0xFA0, bMaskDWord); /*read debug port*/
|
||||
|
||||
rxi_buf_anta = (value32 & 0xFFC00) >> 10; /*rxi_buf_anta=RegFA0[19:10]*/
|
||||
rxq_buf_anta = value32 & 0x3FF; /*rxq_buf_anta=RegFA0[19:10]*/
|
||||
|
||||
pd_flag = (BOOLEAN) ((value32 & BIT31) >> 31);
|
||||
|
||||
/*Not in packet detection period or Tx state */
|
||||
if ((!pd_flag) || (rxi_buf_anta != 0x200)) {
|
||||
/*sign conversion*/
|
||||
rxi_buf_anta = ODM_SignConversion(rxi_buf_anta, 10);
|
||||
rxq_buf_anta = ODM_SignConversion(rxq_buf_anta, 10);
|
||||
|
||||
pwdb_A = ODM_PWdB_Conversion(rxi_buf_anta * rxi_buf_anta + rxq_buf_anta * rxq_buf_anta, 20, 18); /*S(10,9)*S(10,9)=S(20,18)*/
|
||||
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, ("pwdb_A= %d dB, rxi_buf_anta= 0x%x, rxq_buf_anta= 0x%x\n", pwdb_A, rxi_buf_anta & 0x3FF, rxq_buf_anta & 0x3FF));
|
||||
}
|
||||
|
||||
/*BB Reset*/
|
||||
ODM_Write1Byte(pDM_Odm, 0x02, ODM_Read1Byte(pDM_Odm, 0x02) & (~BIT0));
|
||||
ODM_Write1Byte(pDM_Odm, 0x02, ODM_Read1Byte(pDM_Odm, 0x02) | BIT0);
|
||||
|
||||
/*Start CK320&CK88*/
|
||||
ODM_SetBBReg(pDM_Odm, 0x8B4, BIT6, 0);
|
||||
|
||||
sval = pwdb_A;
|
||||
|
||||
if (sval < 0 && sval >= -27) {
|
||||
if (valid_cnt < ValidCnt) {
|
||||
valid_cnt++;
|
||||
sum += sval;
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, ("Valid sval = %d\n", sval));
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, ("Sum of sval = %d,\n", sum));
|
||||
if ((valid_cnt >= ValidCnt) || (ODM_GetProgressingTime(pDM_Odm, start) > max_time)) {
|
||||
sum /= valid_cnt;
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, ("After divided, sum = %d\n", sum));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*ADC backoff is 12dB,*/
|
||||
/*Ptarget=0x1C-110=-82dBm*/
|
||||
noise = sum + 12 + 0x1C - 110;
|
||||
|
||||
/*Offset*/
|
||||
noise = noise - 3;
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, ("noise = %d\n", noise));
|
||||
pDM_Odm->noise_level.noise_all = (s2Byte)noise;
|
||||
|
||||
/* Step 4. Recover the Dig*/
|
||||
if (bPauseDIG)
|
||||
odm_PauseDIG(pDM_Odm, PHYDM_RESUME, PHYDM_PAUSE_LEVEL_1, IGIValue);
|
||||
|
||||
func_end = ODM_GetProgressingTime(pDM_Odm, func_start);
|
||||
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, ("odm_InbandNoise_Monitor_ACSeries() <==\n"));
|
||||
|
||||
return pDM_Odm->noise_level.noise_all;
|
||||
}
|
||||
|
||||
|
||||
|
||||
s2Byte
|
||||
ODM_InbandNoise_Monitor(PVOID pDM_VOID, u8 bPauseDIG, u8 IGIValue, u32 max_time)
|
||||
{
|
||||
|
||||
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
|
||||
if (pDM_Odm->SupportICType & ODM_IC_11AC_SERIES)
|
||||
return odm_InbandNoise_Monitor_ACSeries(pDM_Odm, bPauseDIG, IGIValue, max_time);
|
||||
else
|
||||
return odm_InbandNoise_Monitor_NSeries(pDM_Odm, bPauseDIG, IGIValue, max_time);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
49
hal/phydm/phydm_noisemonitor.h
Normal file
49
hal/phydm/phydm_noisemonitor.h
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
*****************************************************************************/
|
||||
#ifndef __ODMNOISEMONITOR_H__
|
||||
#define __ODMNOISEMONITOR_H__
|
||||
|
||||
#define ODM_MAX_CHANNEL_NUM 38//14+24
|
||||
struct noise_level
|
||||
{
|
||||
//u1Byte value_a, value_b;
|
||||
u1Byte value[MAX_RF_PATH];
|
||||
//s1Byte sval_a, sval_b;
|
||||
s1Byte sval[MAX_RF_PATH];
|
||||
|
||||
//s4Byte noise_a=0, noise_b=0,sum_a=0, sum_b=0;
|
||||
//s4Byte noise[ODM_RF_PATH_MAX];
|
||||
s4Byte sum[MAX_RF_PATH];
|
||||
//u1Byte valid_cnt_a=0, valid_cnt_b=0,
|
||||
u1Byte valid[MAX_RF_PATH];
|
||||
u1Byte valid_cnt[MAX_RF_PATH];
|
||||
|
||||
};
|
||||
|
||||
|
||||
typedef struct _ODM_NOISE_MONITOR_
|
||||
{
|
||||
s1Byte noise[MAX_RF_PATH];
|
||||
s2Byte noise_all;
|
||||
}ODM_NOISE_MONITOR;
|
||||
|
||||
s2Byte ODM_InbandNoise_Monitor(PVOID pDM_VOID,u8 bPauseDIG,u8 IGIValue,u32 max_time);
|
||||
|
||||
#endif
|
||||
2311
hal/phydm/phydm_pathdiv.c
Normal file
2311
hal/phydm/phydm_pathdiv.c
Normal file
File diff suppressed because it is too large
Load diff
324
hal/phydm/phydm_pathdiv.h
Normal file
324
hal/phydm/phydm_pathdiv.h
Normal file
|
|
@ -0,0 +1,324 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __PHYDMPATHDIV_H__
|
||||
#define __PHYDMPATHDIV_H__
|
||||
/*#define PATHDIV_VERSION "2.0" //2014.11.04*/
|
||||
#define PATHDIV_VERSION "3.0" /*2015.01.13 Dino*/
|
||||
|
||||
#if(defined(CONFIG_PATH_DIVERSITY))
|
||||
#define USE_PATH_A_AS_DEFAULT_ANT //for 8814 dynamic TX path selection
|
||||
|
||||
#define NUM_RESET_DTP_PERIOD 5
|
||||
#define ANT_DECT_RSSI_TH 3
|
||||
|
||||
#define PATH_A 1
|
||||
#define PATH_B 2
|
||||
#define PATH_C 3
|
||||
#define PATH_D 4
|
||||
|
||||
#define PHYDM_AUTO_PATH 0
|
||||
#define PHYDM_FIX_PATH 1
|
||||
|
||||
#define NUM_CHOOSE2_FROM4 6
|
||||
#define NUM_CHOOSE3_FROM4 4
|
||||
|
||||
|
||||
#define PHYDM_A BIT0
|
||||
#define PHYDM_B BIT1
|
||||
#define PHYDM_C BIT2
|
||||
#define PHYDM_D BIT3
|
||||
#define PHYDM_AB (BIT0 | BIT1) // 0
|
||||
#define PHYDM_AC (BIT0 | BIT2) // 1
|
||||
#define PHYDM_AD (BIT0 | BIT3) // 2
|
||||
#define PHYDM_BC (BIT1 | BIT2) // 3
|
||||
#define PHYDM_BD (BIT1 | BIT3) // 4
|
||||
#define PHYDM_CD (BIT2 | BIT3) // 5
|
||||
|
||||
#define PHYDM_ABC (BIT0 | BIT1 | BIT2) /* 0*/
|
||||
#define PHYDM_ABD (BIT0 | BIT1 | BIT3) /* 1*/
|
||||
#define PHYDM_ACD (BIT0 | BIT2 | BIT3) /* 2*/
|
||||
#define PHYDM_BCD (BIT1 | BIT2 | BIT3) /* 3*/
|
||||
|
||||
#define PHYDM_ABCD (BIT0 | BIT1 | BIT2 | BIT3)
|
||||
|
||||
|
||||
typedef enum dtp_state
|
||||
{
|
||||
PHYDM_DTP_INIT=1,
|
||||
PHYDM_DTP_RUNNING_1
|
||||
|
||||
}PHYDM_DTP_STATE;
|
||||
|
||||
typedef enum path_div_type
|
||||
{
|
||||
PHYDM_2R_PATH_DIV = 1,
|
||||
PHYDM_4R_PATH_DIV = 2
|
||||
}PHYDM_PATH_DIV_TYPE;
|
||||
|
||||
VOID
|
||||
phydm_process_rssi_for_path_div(
|
||||
IN OUT PVOID pDM_VOID,
|
||||
IN PVOID p_phy_info_void,
|
||||
IN PVOID p_pkt_info_void
|
||||
);
|
||||
|
||||
typedef struct _ODM_PATH_DIVERSITY_
|
||||
{
|
||||
u1Byte RespTxPath;
|
||||
u1Byte PathSel[ODM_ASSOCIATE_ENTRY_NUM];
|
||||
u4Byte PathA_Sum[ODM_ASSOCIATE_ENTRY_NUM];
|
||||
u4Byte PathB_Sum[ODM_ASSOCIATE_ENTRY_NUM];
|
||||
u2Byte PathA_Cnt[ODM_ASSOCIATE_ENTRY_NUM];
|
||||
u2Byte PathB_Cnt[ODM_ASSOCIATE_ENTRY_NUM];
|
||||
u1Byte path_div_type;
|
||||
#if RTL8814A_SUPPORT
|
||||
|
||||
u4Byte path_a_sum_all;
|
||||
u4Byte path_b_sum_all;
|
||||
u4Byte path_c_sum_all;
|
||||
u4Byte path_d_sum_all;
|
||||
|
||||
u4Byte path_a_cnt_all;
|
||||
u4Byte path_b_cnt_all;
|
||||
u4Byte path_c_cnt_all;
|
||||
u4Byte path_d_cnt_all;
|
||||
|
||||
u1Byte dtp_period;
|
||||
BOOLEAN bBecomeLinked;
|
||||
BOOLEAN is_u3_mode;
|
||||
u1Byte num_tx_path;
|
||||
u1Byte default_path;
|
||||
u1Byte num_candidate;
|
||||
u1Byte ant_candidate_1;
|
||||
u1Byte ant_candidate_2;
|
||||
u1Byte ant_candidate_3;
|
||||
u1Byte dtp_state;
|
||||
u1Byte dtp_check_patha_counter;
|
||||
BOOLEAN fix_path_bfer;
|
||||
u1Byte search_space_2[NUM_CHOOSE2_FROM4];
|
||||
u1Byte search_space_3[NUM_CHOOSE3_FROM4];
|
||||
|
||||
u1Byte pre_tx_path;
|
||||
u1Byte use_path_a_as_default_ant;
|
||||
BOOLEAN is_pathA_exist;
|
||||
|
||||
#endif
|
||||
}PATHDIV_T, *pPATHDIV_T;
|
||||
|
||||
|
||||
#endif //#if(defined(CONFIG_PATH_DIVERSITY))
|
||||
|
||||
VOID
|
||||
phydm_c2h_dtp_handler(
|
||||
IN PVOID pDM_VOID,
|
||||
IN pu1Byte CmdBuf,
|
||||
IN u1Byte CmdLen
|
||||
);
|
||||
|
||||
VOID
|
||||
odm_PathDiversityInit(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
odm_PathDiversity(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
odm_pathdiv_debug(
|
||||
IN PVOID pDM_VOID,
|
||||
IN u4Byte *const dm_value,
|
||||
IN u4Byte *_used,
|
||||
OUT char *output,
|
||||
IN u4Byte *_out_len
|
||||
);
|
||||
|
||||
|
||||
|
||||
//1 [OLD IC]--------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#if(DM_ODM_SUPPORT_TYPE & (ODM_WIN))
|
||||
|
||||
//#define PATHDIV_ENABLE 1
|
||||
#define dm_PathDiv_RSSI_Check ODM_PathDivChkPerPktRssi
|
||||
#define PathDivCheckBeforeLink8192C ODM_PathDiversityBeforeLink92C
|
||||
|
||||
|
||||
|
||||
|
||||
typedef struct _PathDiv_Parameter_define_
|
||||
{
|
||||
u4Byte org_5g_RegE30;
|
||||
u4Byte org_5g_RegC14;
|
||||
u4Byte org_5g_RegCA0;
|
||||
u4Byte swt_5g_RegE30;
|
||||
u4Byte swt_5g_RegC14;
|
||||
u4Byte swt_5g_RegCA0;
|
||||
//for 2G IQK information
|
||||
u4Byte org_2g_RegC80;
|
||||
u4Byte org_2g_RegC4C;
|
||||
u4Byte org_2g_RegC94;
|
||||
u4Byte org_2g_RegC14;
|
||||
u4Byte org_2g_RegCA0;
|
||||
|
||||
u4Byte swt_2g_RegC80;
|
||||
u4Byte swt_2g_RegC4C;
|
||||
u4Byte swt_2g_RegC94;
|
||||
u4Byte swt_2g_RegC14;
|
||||
u4Byte swt_2g_RegCA0;
|
||||
}PATHDIV_PARA,*pPATHDIV_PARA;
|
||||
|
||||
VOID
|
||||
odm_PathDiversityInit_92C(
|
||||
IN PADAPTER Adapter
|
||||
);
|
||||
|
||||
VOID
|
||||
odm_2TPathDiversityInit_92C(
|
||||
IN PADAPTER Adapter
|
||||
);
|
||||
|
||||
VOID
|
||||
odm_1TPathDiversityInit_92C(
|
||||
IN PADAPTER Adapter
|
||||
);
|
||||
|
||||
BOOLEAN
|
||||
odm_IsConnected_92C(
|
||||
IN PADAPTER Adapter
|
||||
);
|
||||
|
||||
BOOLEAN
|
||||
ODM_PathDiversityBeforeLink92C(
|
||||
//IN PADAPTER Adapter
|
||||
IN PDM_ODM_T pDM_Odm
|
||||
);
|
||||
|
||||
VOID
|
||||
odm_PathDiversityAfterLink_92C(
|
||||
IN PADAPTER Adapter
|
||||
);
|
||||
|
||||
VOID
|
||||
odm_SetRespPath_92C(
|
||||
IN PADAPTER Adapter,
|
||||
IN u1Byte DefaultRespPath
|
||||
);
|
||||
|
||||
VOID
|
||||
odm_OFDMTXPathDiversity_92C(
|
||||
IN PADAPTER Adapter
|
||||
);
|
||||
|
||||
VOID
|
||||
odm_CCKTXPathDiversity_92C(
|
||||
IN PADAPTER Adapter
|
||||
);
|
||||
|
||||
VOID
|
||||
odm_ResetPathDiversity_92C(
|
||||
IN PADAPTER Adapter
|
||||
);
|
||||
|
||||
VOID
|
||||
odm_CCKTXPathDiversityCallback(
|
||||
PRT_TIMER pTimer
|
||||
);
|
||||
|
||||
VOID
|
||||
odm_CCKTXPathDiversityWorkItemCallback(
|
||||
IN PVOID pContext
|
||||
);
|
||||
|
||||
VOID
|
||||
odm_PathDivChkAntSwitchCallback(
|
||||
PRT_TIMER pTimer
|
||||
);
|
||||
|
||||
VOID
|
||||
odm_PathDivChkAntSwitchWorkitemCallback(
|
||||
IN PVOID pContext
|
||||
);
|
||||
|
||||
|
||||
VOID
|
||||
odm_PathDivChkAntSwitch(
|
||||
PDM_ODM_T pDM_Odm
|
||||
);
|
||||
|
||||
VOID
|
||||
ODM_CCKPathDiversityChkPerPktRssi(
|
||||
PADAPTER Adapter,
|
||||
BOOLEAN bIsDefPort,
|
||||
BOOLEAN bMatchBSSID,
|
||||
PRT_WLAN_STA pEntry,
|
||||
PRT_RFD pRfd,
|
||||
pu1Byte pDesc
|
||||
);
|
||||
|
||||
VOID
|
||||
ODM_PathDivChkPerPktRssi(
|
||||
PADAPTER Adapter,
|
||||
BOOLEAN bIsDefPort,
|
||||
BOOLEAN bMatchBSSID,
|
||||
PRT_WLAN_STA pEntry,
|
||||
PRT_RFD pRfd
|
||||
);
|
||||
|
||||
VOID
|
||||
ODM_PathDivRestAfterLink(
|
||||
IN PDM_ODM_T pDM_Odm
|
||||
);
|
||||
|
||||
VOID
|
||||
ODM_FillTXPathInTXDESC(
|
||||
IN PADAPTER Adapter,
|
||||
IN PRT_TCB pTcb,
|
||||
IN pu1Byte pDesc
|
||||
);
|
||||
|
||||
VOID
|
||||
odm_PathDivInit_92D(
|
||||
IN PDM_ODM_T pDM_Odm
|
||||
);
|
||||
|
||||
u1Byte
|
||||
odm_SwAntDivSelectScanChnl(
|
||||
IN PADAPTER Adapter
|
||||
);
|
||||
|
||||
VOID
|
||||
odm_SwAntDivConstructScanChnl(
|
||||
IN PADAPTER Adapter,
|
||||
IN u1Byte ScanChnl
|
||||
);
|
||||
|
||||
#endif //#if(DM_ODM_SUPPORT_TYPE & (ODM_WIN))
|
||||
|
||||
|
||||
#endif //#ifndef __ODMPATHDIV_H__
|
||||
|
||||
1050
hal/phydm/phydm_powertracking_ap.c
Normal file
1050
hal/phydm/phydm_powertracking_ap.c
Normal file
File diff suppressed because it is too large
Load diff
314
hal/phydm/phydm_powertracking_ap.h
Normal file
314
hal/phydm/phydm_powertracking_ap.h
Normal file
|
|
@ -0,0 +1,314 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __PHYDMPOWERTRACKING_H__
|
||||
#define __PHYDMPOWERTRACKING_H__
|
||||
|
||||
#define POWRTRACKING_VERSION "1.1"
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_AP)
|
||||
#ifdef RTK_AC_SUPPORT
|
||||
#define ODM_IC_11AC_SERIES_SUPPORT 1
|
||||
#else
|
||||
#define ODM_IC_11AC_SERIES_SUPPORT 0
|
||||
#endif
|
||||
#else
|
||||
#define ODM_IC_11AC_SERIES_SUPPORT 1
|
||||
#endif
|
||||
|
||||
#define DPK_DELTA_MAPPING_NUM 13
|
||||
#define index_mapping_HP_NUM 15
|
||||
#define DELTA_SWINGIDX_SIZE 30
|
||||
#define BAND_NUM 3
|
||||
#define MAX_RF_PATH 4
|
||||
#define TXSCALE_TABLE_SIZE 37
|
||||
#define IQK_MAC_REG_NUM 4
|
||||
#define IQK_ADDA_REG_NUM 16
|
||||
#define IQK_BB_REG_NUM_MAX 10
|
||||
|
||||
#define IQK_BB_REG_NUM 9
|
||||
|
||||
#define HP_THERMAL_NUM 8
|
||||
|
||||
#define AVG_THERMAL_NUM 8
|
||||
#define IQK_Matrix_REG_NUM 8
|
||||
//#define IQK_Matrix_Settings_NUM 1+24+21
|
||||
#define IQK_Matrix_Settings_NUM (14+24+21) // Channels_2_4G_NUM + Channels_5G_20M_NUM + Channels_5G
|
||||
|
||||
#if !defined(_OUTSRC_COEXIST)
|
||||
#define OFDM_TABLE_SIZE_92D 43
|
||||
#define OFDM_TABLE_SIZE 37
|
||||
#define CCK_TABLE_SIZE 33
|
||||
#define CCK_TABLE_SIZE_88F 21
|
||||
|
||||
|
||||
|
||||
//#define OFDM_TABLE_SIZE_92E 54
|
||||
//#define CCK_TABLE_SIZE_92E 54
|
||||
extern u4Byte OFDMSwingTable[OFDM_TABLE_SIZE_92D];
|
||||
extern u1Byte CCKSwingTable_Ch1_Ch13[CCK_TABLE_SIZE][8];
|
||||
extern u1Byte CCKSwingTable_Ch14 [CCK_TABLE_SIZE][8];
|
||||
|
||||
|
||||
extern u4Byte OFDMSwingTable_New[OFDM_TABLE_SIZE_92D];
|
||||
extern u1Byte CCKSwingTable_Ch1_Ch13_New[CCK_TABLE_SIZE][8];
|
||||
extern u1Byte CCKSwingTable_Ch14_New [CCK_TABLE_SIZE][8];
|
||||
extern u1Byte CCKSwingTable_Ch1_Ch14_88F[CCK_TABLE_SIZE_88F][16];
|
||||
|
||||
#endif
|
||||
|
||||
#define ODM_OFDM_TABLE_SIZE 37
|
||||
#define ODM_CCK_TABLE_SIZE 33
|
||||
// <20140613, YuChen> In case fail to read TxPowerTrack.txt, we use the table of 88E as the default table.
|
||||
extern u1Byte DeltaSwingTableIdx_2GA_P_DEFAULT[DELTA_SWINGIDX_SIZE];
|
||||
extern u1Byte DeltaSwingTableIdx_2GA_N_DEFAULT[DELTA_SWINGIDX_SIZE];
|
||||
|
||||
|
||||
//extern u4Byte OFDMSwingTable_92E[OFDM_TABLE_SIZE_92E];
|
||||
//extern u1Byte CCKSwingTable_Ch1_Ch13_92E[CCK_TABLE_SIZE_92E][8];
|
||||
//extern u1Byte CCKSwingTable_Ch14_92E[CCK_TABLE_SIZE_92E][8];
|
||||
|
||||
#ifdef CONFIG_WLAN_HAL_8192EE
|
||||
#define OFDM_TABLE_SIZE_92E 54
|
||||
#define CCK_TABLE_SIZE_92E 54
|
||||
extern u4Byte OFDMSwingTable_92E[OFDM_TABLE_SIZE_92E];
|
||||
extern u1Byte CCKSwingTable_Ch1_Ch13_92E[CCK_TABLE_SIZE_92E][8];
|
||||
extern u1Byte CCKSwingTable_Ch14_92E[CCK_TABLE_SIZE_92E][8];
|
||||
#endif
|
||||
|
||||
#define OFDM_TABLE_SIZE_8812 43
|
||||
#define AVG_THERMAL_NUM_8812 4
|
||||
|
||||
#if(RTL8814A_SUPPORT == 1)
|
||||
extern u4Byte TxScalingTable_Jaguar[TXSCALE_TABLE_SIZE];
|
||||
#elif(ODM_IC_11AC_SERIES_SUPPORT)
|
||||
extern unsigned int OFDMSwingTable_8812[OFDM_TABLE_SIZE_8812];
|
||||
#endif
|
||||
|
||||
#define dm_CheckTXPowerTracking ODM_TXPowerTrackingCheck
|
||||
|
||||
typedef struct _IQK_MATRIX_REGS_SETTING{
|
||||
BOOLEAN bIQKDone;
|
||||
s4Byte Value[1][IQK_Matrix_REG_NUM];
|
||||
}IQK_MATRIX_REGS_SETTING,*PIQK_MATRIX_REGS_SETTING;
|
||||
|
||||
typedef struct ODM_RF_Calibration_Structure
|
||||
{
|
||||
//for tx power tracking
|
||||
|
||||
u4Byte RegA24; // for TempCCK
|
||||
s4Byte RegE94;
|
||||
s4Byte RegE9C;
|
||||
s4Byte RegEB4;
|
||||
s4Byte RegEBC;
|
||||
|
||||
//u1Byte bTXPowerTracking;
|
||||
u1Byte TXPowercount;
|
||||
BOOLEAN bTXPowerTrackingInit;
|
||||
BOOLEAN bTXPowerTracking;
|
||||
u1Byte TxPowerTrackControl; //for mp mode, turn off txpwrtracking as default
|
||||
u1Byte TM_Trigger;
|
||||
u1Byte InternalPA5G[2]; //pathA / pathB
|
||||
|
||||
u1Byte ThermalMeter[2]; // ThermalMeter, index 0 for RFIC0, and 1 for RFIC1
|
||||
u1Byte ThermalValue;
|
||||
u1Byte ThermalValue_LCK;
|
||||
u1Byte ThermalValue_IQK;
|
||||
u1Byte ThermalValue_DPK;
|
||||
u1Byte ThermalValue_AVG[AVG_THERMAL_NUM];
|
||||
u1Byte ThermalValue_AVG_index;
|
||||
u1Byte ThermalValue_RxGain;
|
||||
u1Byte ThermalValue_Crystal;
|
||||
u1Byte ThermalValue_DPKstore;
|
||||
u1Byte ThermalValue_DPKtrack;
|
||||
BOOLEAN TxPowerTrackingInProgress;
|
||||
BOOLEAN bDPKenable;
|
||||
|
||||
BOOLEAN bReloadtxpowerindex;
|
||||
u1Byte bRfPiEnable;
|
||||
u4Byte TXPowerTrackingCallbackCnt; //cosa add for debug
|
||||
|
||||
u1Byte bCCKinCH14;
|
||||
u1Byte CCK_index;
|
||||
u1Byte OFDM_index[MAX_RF_PATH];
|
||||
s1Byte PowerIndexOffset;
|
||||
s1Byte DeltaPowerIndex;
|
||||
s1Byte DeltaPowerIndexLast;
|
||||
BOOLEAN bTxPowerChanged;
|
||||
|
||||
u1Byte ThermalValue_HP[HP_THERMAL_NUM];
|
||||
u1Byte ThermalValue_HP_index;
|
||||
IQK_MATRIX_REGS_SETTING IQKMatrixRegSetting[IQK_Matrix_Settings_NUM];
|
||||
BOOLEAN bNeedIQK;
|
||||
u1Byte Delta_IQK;
|
||||
u1Byte Delta_LCK;
|
||||
u1Byte DeltaSwingTableIdx_2GCCKA_P[DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_2GCCKA_N[DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_2GCCKB_P[DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_2GCCKB_N[DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_2GCCKC_P[DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_2GCCKC_N[DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_2GCCKD_P[DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_2GCCKD_N[DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_2GA_P[DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_2GA_N[DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_2GB_P[DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_2GB_N[DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_2GC_P[DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_2GC_N[DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_2GD_P[DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_2GD_N[DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_5GA_P[BAND_NUM][DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_5GA_N[BAND_NUM][DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_5GB_P[BAND_NUM][DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_5GB_N[BAND_NUM][DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_5GC_P[BAND_NUM][DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_5GC_N[BAND_NUM][DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_5GD_P[BAND_NUM][DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_5GD_N[BAND_NUM][DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_2GA_P_8188E[DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_2GA_N_8188E[DELTA_SWINGIDX_SIZE];
|
||||
|
||||
u1Byte BbSwingIdxOfdm[MAX_RF_PATH];
|
||||
u1Byte BbSwingIdxOfdmCurrent;
|
||||
#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE))
|
||||
u1Byte BbSwingIdxOfdmBase[MAX_RF_PATH];
|
||||
#else
|
||||
u1Byte BbSwingIdxOfdmBase;
|
||||
#endif
|
||||
BOOLEAN BbSwingFlagOfdm;
|
||||
u1Byte BbSwingIdxCck;
|
||||
u1Byte BbSwingIdxCckCurrent;
|
||||
u1Byte BbSwingIdxCckBase;
|
||||
u1Byte DefaultOfdmIndex;
|
||||
u1Byte DefaultCckIndex;
|
||||
BOOLEAN BbSwingFlagCck;
|
||||
|
||||
s1Byte Absolute_OFDMSwingIdx[MAX_RF_PATH];
|
||||
s1Byte Remnant_OFDMSwingIdx[MAX_RF_PATH];
|
||||
s1Byte Remnant_CCKSwingIdx;
|
||||
s1Byte Modify_TxAGC_Value; /*Remnat compensate value at TxAGC */
|
||||
BOOLEAN Modify_TxAGC_Flag_PathA;
|
||||
BOOLEAN Modify_TxAGC_Flag_PathB;
|
||||
BOOLEAN Modify_TxAGC_Flag_PathC;
|
||||
BOOLEAN Modify_TxAGC_Flag_PathD;
|
||||
BOOLEAN Modify_TxAGC_Flag_PathA_CCK;
|
||||
|
||||
s1Byte KfreeOffset[MAX_RF_PATH];
|
||||
|
||||
//--------------------------------------------------------------------//
|
||||
|
||||
//for IQK
|
||||
u4Byte RegC04;
|
||||
u4Byte Reg874;
|
||||
u4Byte RegC08;
|
||||
u4Byte RegB68;
|
||||
u4Byte RegB6C;
|
||||
u4Byte Reg870;
|
||||
u4Byte Reg860;
|
||||
u4Byte Reg864;
|
||||
|
||||
BOOLEAN bIQKInitialized;
|
||||
BOOLEAN bLCKInProgress;
|
||||
BOOLEAN bAntennaDetected;
|
||||
u4Byte ADDA_backup[IQK_ADDA_REG_NUM];
|
||||
u4Byte IQK_MAC_backup[IQK_MAC_REG_NUM];
|
||||
u4Byte IQK_BB_backup_recover[9];
|
||||
u4Byte IQK_BB_backup[IQK_BB_REG_NUM];
|
||||
|
||||
//for APK
|
||||
u4Byte APKoutput[2][2]; //path A/B; output1_1a/output1_2a
|
||||
u1Byte bAPKdone;
|
||||
u1Byte bAPKThermalMeterIgnore;
|
||||
u1Byte bDPdone;
|
||||
u1Byte bDPPathAOK;
|
||||
u1Byte bDPPathBOK;
|
||||
|
||||
/*Add by Yuchen for Kfree Phydm*/
|
||||
u1Byte RegRfKFreeEnable; /*for registry*/
|
||||
u1Byte RfKFreeEnable; /*for efuse enable check*/
|
||||
|
||||
}ODM_RF_CAL_T,*PODM_RF_CAL_T;
|
||||
|
||||
VOID
|
||||
odm_TXPowerTrackingCheckAP(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
ODM_TXPowerTrackingCheck(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
|
||||
VOID
|
||||
odm_TXPowerTrackingThermalMeterInit(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
odm_TXPowerTrackingInit(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
odm_TXPowerTrackingCheckMP(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
|
||||
VOID
|
||||
odm_TXPowerTrackingCheckCE(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
|
||||
#if(DM_ODM_SUPPORT_TYPE & (ODM_WIN))
|
||||
|
||||
VOID
|
||||
odm_TXPowerTrackingCallbackThermalMeter92C(
|
||||
IN PADAPTER Adapter
|
||||
);
|
||||
|
||||
VOID
|
||||
odm_TXPowerTrackingCallbackRXGainThermalMeter92D(
|
||||
IN PADAPTER Adapter
|
||||
);
|
||||
|
||||
VOID
|
||||
odm_TXPowerTrackingCallbackThermalMeter92D(
|
||||
IN PADAPTER Adapter
|
||||
);
|
||||
|
||||
VOID
|
||||
odm_TXPowerTrackingDirectCall92C(
|
||||
IN PADAPTER Adapter
|
||||
);
|
||||
|
||||
VOID
|
||||
odm_TXPowerTrackingThermalMeterCheck(
|
||||
IN PADAPTER Adapter
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
670
hal/phydm/phydm_powertracking_ce.c
Normal file
670
hal/phydm/phydm_powertracking_ce.c
Normal file
|
|
@ -0,0 +1,670 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/*============================================================ */
|
||||
/* include files */
|
||||
/*============================================================ */
|
||||
#include "mp_precomp.h"
|
||||
#include "phydm_precomp.h"
|
||||
|
||||
//============================================================
|
||||
// Global var
|
||||
//============================================================
|
||||
|
||||
u4Byte OFDMSwingTable[OFDM_TABLE_SIZE] = {
|
||||
0x7f8001fe, // 0, +6.0dB
|
||||
0x788001e2, // 1, +5.5dB
|
||||
0x71c001c7, // 2, +5.0dB
|
||||
0x6b8001ae, // 3, +4.5dB
|
||||
0x65400195, // 4, +4.0dB
|
||||
0x5fc0017f, // 5, +3.5dB
|
||||
0x5a400169, // 6, +3.0dB
|
||||
0x55400155, // 7, +2.5dB
|
||||
0x50800142, // 8, +2.0dB
|
||||
0x4c000130, // 9, +1.5dB
|
||||
0x47c0011f, // 10, +1.0dB
|
||||
0x43c0010f, // 11, +0.5dB
|
||||
0x40000100, // 12, +0dB
|
||||
0x3c8000f2, // 13, -0.5dB
|
||||
0x390000e4, // 14, -1.0dB
|
||||
0x35c000d7, // 15, -1.5dB
|
||||
0x32c000cb, // 16, -2.0dB
|
||||
0x300000c0, // 17, -2.5dB
|
||||
0x2d4000b5, // 18, -3.0dB
|
||||
0x2ac000ab, // 19, -3.5dB
|
||||
0x288000a2, // 20, -4.0dB
|
||||
0x26000098, // 21, -4.5dB
|
||||
0x24000090, // 22, -5.0dB
|
||||
0x22000088, // 23, -5.5dB
|
||||
0x20000080, // 24, -6.0dB
|
||||
0x1e400079, // 25, -6.5dB
|
||||
0x1c800072, // 26, -7.0dB
|
||||
0x1b00006c, // 27. -7.5dB
|
||||
0x19800066, // 28, -8.0dB
|
||||
0x18000060, // 29, -8.5dB
|
||||
0x16c0005b, // 30, -9.0dB
|
||||
0x15800056, // 31, -9.5dB
|
||||
0x14400051, // 32, -10.0dB
|
||||
0x1300004c, // 33, -10.5dB
|
||||
0x12000048, // 34, -11.0dB
|
||||
0x11000044, // 35, -11.5dB
|
||||
0x10000040, // 36, -12.0dB
|
||||
};
|
||||
|
||||
u1Byte CCKSwingTable_Ch1_Ch13[CCK_TABLE_SIZE][8] = {
|
||||
{0x36, 0x35, 0x2e, 0x25, 0x1c, 0x12, 0x09, 0x04}, // 0, +0dB
|
||||
{0x33, 0x32, 0x2b, 0x23, 0x1a, 0x11, 0x08, 0x04}, // 1, -0.5dB
|
||||
{0x30, 0x2f, 0x29, 0x21, 0x19, 0x10, 0x08, 0x03}, // 2, -1.0dB
|
||||
{0x2d, 0x2d, 0x27, 0x1f, 0x18, 0x0f, 0x08, 0x03}, // 3, -1.5dB
|
||||
{0x2b, 0x2a, 0x25, 0x1e, 0x16, 0x0e, 0x07, 0x03}, // 4, -2.0dB
|
||||
{0x28, 0x28, 0x22, 0x1c, 0x15, 0x0d, 0x07, 0x03}, // 5, -2.5dB
|
||||
{0x26, 0x25, 0x21, 0x1b, 0x14, 0x0d, 0x06, 0x03}, // 6, -3.0dB
|
||||
{0x24, 0x23, 0x1f, 0x19, 0x13, 0x0c, 0x06, 0x03}, // 7, -3.5dB
|
||||
{0x22, 0x21, 0x1d, 0x18, 0x11, 0x0b, 0x06, 0x02}, // 8, -4.0dB
|
||||
{0x20, 0x20, 0x1b, 0x16, 0x11, 0x08, 0x05, 0x02}, // 9, -4.5dB
|
||||
{0x1f, 0x1e, 0x1a, 0x15, 0x10, 0x0a, 0x05, 0x02}, // 10, -5.0dB
|
||||
{0x1d, 0x1c, 0x18, 0x14, 0x0f, 0x0a, 0x05, 0x02}, // 11, -5.5dB
|
||||
{0x1b, 0x1a, 0x17, 0x13, 0x0e, 0x09, 0x04, 0x02}, // 12, -6.0dB <== default
|
||||
{0x1a, 0x19, 0x16, 0x12, 0x0d, 0x09, 0x04, 0x02}, // 13, -6.5dB
|
||||
{0x18, 0x17, 0x15, 0x11, 0x0c, 0x08, 0x04, 0x02}, // 14, -7.0dB
|
||||
{0x17, 0x16, 0x13, 0x10, 0x0c, 0x08, 0x04, 0x02}, // 15, -7.5dB
|
||||
{0x16, 0x15, 0x12, 0x0f, 0x0b, 0x07, 0x04, 0x01}, // 16, -8.0dB
|
||||
{0x14, 0x14, 0x11, 0x0e, 0x0b, 0x07, 0x03, 0x02}, // 17, -8.5dB
|
||||
{0x13, 0x13, 0x10, 0x0d, 0x0a, 0x06, 0x03, 0x01}, // 18, -9.0dB
|
||||
{0x12, 0x12, 0x0f, 0x0c, 0x09, 0x06, 0x03, 0x01}, // 19, -9.5dB
|
||||
{0x11, 0x11, 0x0f, 0x0c, 0x09, 0x06, 0x03, 0x01}, // 20, -10.0dB
|
||||
{0x10, 0x10, 0x0e, 0x0b, 0x08, 0x05, 0x03, 0x01}, // 21, -10.5dB
|
||||
{0x0f, 0x0f, 0x0d, 0x0b, 0x08, 0x05, 0x03, 0x01}, // 22, -11.0dB
|
||||
{0x0e, 0x0e, 0x0c, 0x0a, 0x08, 0x05, 0x02, 0x01}, // 23, -11.5dB
|
||||
{0x0d, 0x0d, 0x0c, 0x0a, 0x07, 0x05, 0x02, 0x01}, // 24, -12.0dB
|
||||
{0x0d, 0x0c, 0x0b, 0x09, 0x07, 0x04, 0x02, 0x01}, // 25, -12.5dB
|
||||
{0x0c, 0x0c, 0x0a, 0x09, 0x06, 0x04, 0x02, 0x01}, // 26, -13.0dB
|
||||
{0x0b, 0x0b, 0x0a, 0x08, 0x06, 0x04, 0x02, 0x01}, // 27, -13.5dB
|
||||
{0x0b, 0x0a, 0x09, 0x08, 0x06, 0x04, 0x02, 0x01}, // 28, -14.0dB
|
||||
{0x0a, 0x0a, 0x09, 0x07, 0x05, 0x03, 0x02, 0x01}, // 29, -14.5dB
|
||||
{0x0a, 0x09, 0x08, 0x07, 0x05, 0x03, 0x02, 0x01}, // 30, -15.0dB
|
||||
{0x09, 0x09, 0x08, 0x06, 0x05, 0x03, 0x01, 0x01}, // 31, -15.5dB
|
||||
{0x09, 0x08, 0x07, 0x06, 0x04, 0x03, 0x01, 0x01} // 32, -16.0dB
|
||||
};
|
||||
|
||||
|
||||
u1Byte CCKSwingTable_Ch14[CCK_TABLE_SIZE][8] = {
|
||||
{0x36, 0x35, 0x2e, 0x1b, 0x00, 0x00, 0x00, 0x00}, // 0, +0dB
|
||||
{0x33, 0x32, 0x2b, 0x19, 0x00, 0x00, 0x00, 0x00}, // 1, -0.5dB
|
||||
{0x30, 0x2f, 0x29, 0x18, 0x00, 0x00, 0x00, 0x00}, // 2, -1.0dB
|
||||
{0x2d, 0x2d, 0x17, 0x17, 0x00, 0x00, 0x00, 0x00}, // 3, -1.5dB
|
||||
{0x2b, 0x2a, 0x25, 0x15, 0x00, 0x00, 0x00, 0x00}, // 4, -2.0dB
|
||||
{0x28, 0x28, 0x24, 0x14, 0x00, 0x00, 0x00, 0x00}, // 5, -2.5dB
|
||||
{0x26, 0x25, 0x21, 0x13, 0x00, 0x00, 0x00, 0x00}, // 6, -3.0dB
|
||||
{0x24, 0x23, 0x1f, 0x12, 0x00, 0x00, 0x00, 0x00}, // 7, -3.5dB
|
||||
{0x22, 0x21, 0x1d, 0x11, 0x00, 0x00, 0x00, 0x00}, // 8, -4.0dB
|
||||
{0x20, 0x20, 0x1b, 0x10, 0x00, 0x00, 0x00, 0x00}, // 9, -4.5dB
|
||||
{0x1f, 0x1e, 0x1a, 0x0f, 0x00, 0x00, 0x00, 0x00}, // 10, -5.0dB
|
||||
{0x1d, 0x1c, 0x18, 0x0e, 0x00, 0x00, 0x00, 0x00}, // 11, -5.5dB
|
||||
{0x1b, 0x1a, 0x17, 0x0e, 0x00, 0x00, 0x00, 0x00}, // 12, -6.0dB <== default
|
||||
{0x1a, 0x19, 0x16, 0x0d, 0x00, 0x00, 0x00, 0x00}, // 13, -6.5dB
|
||||
{0x18, 0x17, 0x15, 0x0c, 0x00, 0x00, 0x00, 0x00}, // 14, -7.0dB
|
||||
{0x17, 0x16, 0x13, 0x0b, 0x00, 0x00, 0x00, 0x00}, // 15, -7.5dB
|
||||
{0x16, 0x15, 0x12, 0x0b, 0x00, 0x00, 0x00, 0x00}, // 16, -8.0dB
|
||||
{0x14, 0x14, 0x11, 0x0a, 0x00, 0x00, 0x00, 0x00}, // 17, -8.5dB
|
||||
{0x13, 0x13, 0x10, 0x0a, 0x00, 0x00, 0x00, 0x00}, // 18, -9.0dB
|
||||
{0x12, 0x12, 0x0f, 0x09, 0x00, 0x00, 0x00, 0x00}, // 19, -9.5dB
|
||||
{0x11, 0x11, 0x0f, 0x09, 0x00, 0x00, 0x00, 0x00}, // 20, -10.0dB
|
||||
{0x10, 0x10, 0x0e, 0x08, 0x00, 0x00, 0x00, 0x00}, // 21, -10.5dB
|
||||
{0x0f, 0x0f, 0x0d, 0x08, 0x00, 0x00, 0x00, 0x00}, // 22, -11.0dB
|
||||
{0x0e, 0x0e, 0x0c, 0x07, 0x00, 0x00, 0x00, 0x00}, // 23, -11.5dB
|
||||
{0x0d, 0x0d, 0x0c, 0x07, 0x00, 0x00, 0x00, 0x00}, // 24, -12.0dB
|
||||
{0x0d, 0x0c, 0x0b, 0x06, 0x00, 0x00, 0x00, 0x00}, // 25, -12.5dB
|
||||
{0x0c, 0x0c, 0x0a, 0x06, 0x00, 0x00, 0x00, 0x00}, // 26, -13.0dB
|
||||
{0x0b, 0x0b, 0x0a, 0x06, 0x00, 0x00, 0x00, 0x00}, // 27, -13.5dB
|
||||
{0x0b, 0x0a, 0x09, 0x05, 0x00, 0x00, 0x00, 0x00}, // 28, -14.0dB
|
||||
{0x0a, 0x0a, 0x09, 0x05, 0x00, 0x00, 0x00, 0x00}, // 29, -14.5dB
|
||||
{0x0a, 0x09, 0x08, 0x05, 0x00, 0x00, 0x00, 0x00}, // 30, -15.0dB
|
||||
{0x09, 0x09, 0x08, 0x05, 0x00, 0x00, 0x00, 0x00}, // 31, -15.5dB
|
||||
{0x09, 0x08, 0x07, 0x04, 0x00, 0x00, 0x00, 0x00} // 32, -16.0dB
|
||||
};
|
||||
|
||||
|
||||
u4Byte OFDMSwingTable_New[OFDM_TABLE_SIZE] = {
|
||||
0x0b40002d, // 0, -15.0dB
|
||||
0x0c000030, // 1, -14.5dB
|
||||
0x0cc00033, // 2, -14.0dB
|
||||
0x0d800036, // 3, -13.5dB
|
||||
0x0e400039, // 4, -13.0dB
|
||||
0x0f00003c, // 5, -12.5dB
|
||||
0x10000040, // 6, -12.0dB
|
||||
0x11000044, // 7, -11.5dB
|
||||
0x12000048, // 8, -11.0dB
|
||||
0x1300004c, // 9, -10.5dB
|
||||
0x14400051, // 10, -10.0dB
|
||||
0x15800056, // 11, -9.5dB
|
||||
0x16c0005b, // 12, -9.0dB
|
||||
0x18000060, // 13, -8.5dB
|
||||
0x19800066, // 14, -8.0dB
|
||||
0x1b00006c, // 15, -7.5dB
|
||||
0x1c800072, // 16, -7.0dB
|
||||
0x1e400079, // 17, -6.5dB
|
||||
0x20000080, // 18, -6.0dB
|
||||
0x22000088, // 19, -5.5dB
|
||||
0x24000090, // 20, -5.0dB
|
||||
0x26000098, // 21, -4.5dB
|
||||
0x288000a2, // 22, -4.0dB
|
||||
0x2ac000ab, // 23, -3.5dB
|
||||
0x2d4000b5, // 24, -3.0dB
|
||||
0x300000c0, // 25, -2.5dB
|
||||
0x32c000cb, // 26, -2.0dB
|
||||
0x35c000d7, // 27, -1.5dB
|
||||
0x390000e4, // 28, -1.0dB
|
||||
0x3c8000f2, // 29, -0.5dB
|
||||
0x40000100, // 30, +0dB
|
||||
0x43c0010f, // 31, +0.5dB
|
||||
0x47c0011f, // 32, +1.0dB
|
||||
0x4c000130, // 33, +1.5dB
|
||||
0x50800142, // 34, +2.0dB
|
||||
0x55400155, // 35, +2.5dB
|
||||
0x5a400169, // 36, +3.0dB
|
||||
0x5fc0017f, // 37, +3.5dB
|
||||
0x65400195, // 38, +4.0dB
|
||||
0x6b8001ae, // 39, +4.5dB
|
||||
0x71c001c7, // 40, +5.0dB
|
||||
0x788001e2, // 41, +5.5dB
|
||||
0x7f8001fe // 42, +6.0dB
|
||||
};
|
||||
|
||||
|
||||
u1Byte CCKSwingTable_Ch1_Ch14_88F[CCK_TABLE_SIZE_88F][16] = {
|
||||
{0x44, 0x42, 0x3C, 0x33, 0x28, 0x1C, 0x13, 0x0B, 0x05, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-16dB*/
|
||||
{0x48, 0x46, 0x3F, 0x36, 0x2A, 0x1E, 0x14, 0x0B, 0x05, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-15.5dB*/
|
||||
{0x4D, 0x4A, 0x43, 0x39, 0x2C, 0x20, 0x15, 0x0C, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-15dB*/
|
||||
{0x51, 0x4F, 0x47, 0x3C, 0x2F, 0x22, 0x16, 0x0D, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-14.5dB*/
|
||||
{0x56, 0x53, 0x4B, 0x40, 0x32, 0x24, 0x17, 0x0E, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-14dB*/
|
||||
{0x5B, 0x58, 0x50, 0x43, 0x35, 0x26, 0x19, 0x0E, 0x07, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-13.5dB*/
|
||||
{0x60, 0x5D, 0x54, 0x47, 0x38, 0x28, 0x1A, 0x0F, 0x07, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-13dB*/
|
||||
{0x66, 0x63, 0x59, 0x4C, 0x3B, 0x2B, 0x1C, 0x10, 0x08, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-12.5dB*/
|
||||
{0x6C, 0x69, 0x5F, 0x50, 0x3F, 0x2D, 0x1E, 0x11, 0x08, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-12dB*/
|
||||
{0x73, 0x6F, 0x64, 0x55, 0x42, 0x30, 0x1F, 0x12, 0x08, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-11.5dB*/
|
||||
{0x79, 0x76, 0x6A, 0x5A, 0x46, 0x33, 0x21, 0x13, 0x09, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-11dB*/
|
||||
{0x81, 0x7C, 0x71, 0x5F, 0x4A, 0x36, 0x23, 0x14, 0x0A, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-10.5dB*/
|
||||
{0x88, 0x84, 0x77, 0x65, 0x4F, 0x39, 0x25, 0x15, 0x0A, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-10dB*/
|
||||
{0x90, 0x8C, 0x7E, 0x6B, 0x54, 0x3C, 0x27, 0x17, 0x0B, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-9.5dB*/
|
||||
{0x99, 0x94, 0x86, 0x71, 0x58, 0x40, 0x2A, 0x18, 0x0B, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-9dB*/
|
||||
{0xA2, 0x9D, 0x8E, 0x78, 0x5E, 0x43, 0x2C, 0x19, 0x0C, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-8.5dB*/
|
||||
{0xAC, 0xA6, 0x96, 0x7F, 0x63, 0x47, 0x2F, 0x1B, 0x0D, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-8dB*/
|
||||
{0xB6, 0xB0, 0x9F, 0x87, 0x69, 0x4C, 0x32, 0x1D, 0x0D, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-7.5dB*/
|
||||
{0xC1, 0xBA, 0xA8, 0x8F, 0x6F, 0x50, 0x35, 0x1E, 0x0E, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-7dB*/
|
||||
{0xCC, 0xC5, 0xB2, 0x97, 0x76, 0x55, 0x38, 0x20, 0x0F, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-6.5dB*/
|
||||
{0xD8, 0xD1, 0xBD, 0xA0, 0x7D, 0x5A, 0x3B, 0x22, 0x10, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} /*-6dB*/
|
||||
};
|
||||
|
||||
|
||||
u1Byte CCKSwingTable_Ch1_Ch13_New[CCK_TABLE_SIZE][8] = {
|
||||
{0x09, 0x08, 0x07, 0x06, 0x04, 0x03, 0x01, 0x01}, // 0, -16.0dB
|
||||
{0x09, 0x09, 0x08, 0x06, 0x05, 0x03, 0x01, 0x01}, // 1, -15.5dB
|
||||
{0x0a, 0x09, 0x08, 0x07, 0x05, 0x03, 0x02, 0x01}, // 2, -15.0dB
|
||||
{0x0a, 0x0a, 0x09, 0x07, 0x05, 0x03, 0x02, 0x01}, // 3, -14.5dB
|
||||
{0x0b, 0x0a, 0x09, 0x08, 0x06, 0x04, 0x02, 0x01}, // 4, -14.0dB
|
||||
{0x0b, 0x0b, 0x0a, 0x08, 0x06, 0x04, 0x02, 0x01}, // 5, -13.5dB
|
||||
{0x0c, 0x0c, 0x0a, 0x09, 0x06, 0x04, 0x02, 0x01}, // 6, -13.0dB
|
||||
{0x0d, 0x0c, 0x0b, 0x09, 0x07, 0x04, 0x02, 0x01}, // 7, -12.5dB
|
||||
{0x0d, 0x0d, 0x0c, 0x0a, 0x07, 0x05, 0x02, 0x01}, // 8, -12.0dB
|
||||
{0x0e, 0x0e, 0x0c, 0x0a, 0x08, 0x05, 0x02, 0x01}, // 9, -11.5dB
|
||||
{0x0f, 0x0f, 0x0d, 0x0b, 0x08, 0x05, 0x03, 0x01}, // 10, -11.0dB
|
||||
{0x10, 0x10, 0x0e, 0x0b, 0x08, 0x05, 0x03, 0x01}, // 11, -10.5dB
|
||||
{0x11, 0x11, 0x0f, 0x0c, 0x09, 0x06, 0x03, 0x01}, // 12, -10.0dB
|
||||
{0x12, 0x12, 0x0f, 0x0c, 0x09, 0x06, 0x03, 0x01}, // 13, -9.5dB
|
||||
{0x13, 0x13, 0x10, 0x0d, 0x0a, 0x06, 0x03, 0x01}, // 14, -9.0dB
|
||||
{0x14, 0x14, 0x11, 0x0e, 0x0b, 0x07, 0x03, 0x02}, // 15, -8.5dB
|
||||
{0x16, 0x15, 0x12, 0x0f, 0x0b, 0x07, 0x04, 0x01}, // 16, -8.0dB
|
||||
{0x17, 0x16, 0x13, 0x10, 0x0c, 0x08, 0x04, 0x02}, // 17, -7.5dB
|
||||
{0x18, 0x17, 0x15, 0x11, 0x0c, 0x08, 0x04, 0x02}, // 18, -7.0dB
|
||||
{0x1a, 0x19, 0x16, 0x12, 0x0d, 0x09, 0x04, 0x02}, // 19, -6.5dB
|
||||
{0x1b, 0x1a, 0x17, 0x13, 0x0e, 0x09, 0x04, 0x02}, // 20, -6.0dB
|
||||
{0x1d, 0x1c, 0x18, 0x14, 0x0f, 0x0a, 0x05, 0x02}, // 21, -5.5dB
|
||||
{0x1f, 0x1e, 0x1a, 0x15, 0x10, 0x0a, 0x05, 0x02}, // 22, -5.0dB
|
||||
{0x20, 0x20, 0x1b, 0x16, 0x11, 0x08, 0x05, 0x02}, // 23, -4.5dB
|
||||
{0x22, 0x21, 0x1d, 0x18, 0x11, 0x0b, 0x06, 0x02}, // 24, -4.0dB
|
||||
{0x24, 0x23, 0x1f, 0x19, 0x13, 0x0c, 0x06, 0x03}, // 25, -3.5dB
|
||||
{0x26, 0x25, 0x21, 0x1b, 0x14, 0x0d, 0x06, 0x03}, // 26, -3.0dB
|
||||
{0x28, 0x28, 0x22, 0x1c, 0x15, 0x0d, 0x07, 0x03}, // 27, -2.5dB
|
||||
{0x2b, 0x2a, 0x25, 0x1e, 0x16, 0x0e, 0x07, 0x03}, // 28, -2.0dB
|
||||
{0x2d, 0x2d, 0x27, 0x1f, 0x18, 0x0f, 0x08, 0x03}, // 29, -1.5dB
|
||||
{0x30, 0x2f, 0x29, 0x21, 0x19, 0x10, 0x08, 0x03}, // 30, -1.0dB
|
||||
{0x33, 0x32, 0x2b, 0x23, 0x1a, 0x11, 0x08, 0x04}, // 31, -0.5dB
|
||||
{0x36, 0x35, 0x2e, 0x25, 0x1c, 0x12, 0x09, 0x04} // 32, +0dB
|
||||
};
|
||||
|
||||
|
||||
u1Byte CCKSwingTable_Ch14_New[CCK_TABLE_SIZE][8]= {
|
||||
{0x09, 0x08, 0x07, 0x04, 0x00, 0x00, 0x00, 0x00}, // 0, -16.0dB
|
||||
{0x09, 0x09, 0x08, 0x05, 0x00, 0x00, 0x00, 0x00}, // 1, -15.5dB
|
||||
{0x0a, 0x09, 0x08, 0x05, 0x00, 0x00, 0x00, 0x00}, // 2, -15.0dB
|
||||
{0x0a, 0x0a, 0x09, 0x05, 0x00, 0x00, 0x00, 0x00}, // 3, -14.5dB
|
||||
{0x0b, 0x0a, 0x09, 0x05, 0x00, 0x00, 0x00, 0x00}, // 4, -14.0dB
|
||||
{0x0b, 0x0b, 0x0a, 0x06, 0x00, 0x00, 0x00, 0x00}, // 5, -13.5dB
|
||||
{0x0c, 0x0c, 0x0a, 0x06, 0x00, 0x00, 0x00, 0x00}, // 6, -13.0dB
|
||||
{0x0d, 0x0c, 0x0b, 0x06, 0x00, 0x00, 0x00, 0x00}, // 7, -12.5dB
|
||||
{0x0d, 0x0d, 0x0c, 0x07, 0x00, 0x00, 0x00, 0x00}, // 8, -12.0dB
|
||||
{0x0e, 0x0e, 0x0c, 0x07, 0x00, 0x00, 0x00, 0x00}, // 9, -11.5dB
|
||||
{0x0f, 0x0f, 0x0d, 0x08, 0x00, 0x00, 0x00, 0x00}, // 10, -11.0dB
|
||||
{0x10, 0x10, 0x0e, 0x08, 0x00, 0x00, 0x00, 0x00}, // 11, -10.5dB
|
||||
{0x11, 0x11, 0x0f, 0x09, 0x00, 0x00, 0x00, 0x00}, // 12, -10.0dB
|
||||
{0x12, 0x12, 0x0f, 0x09, 0x00, 0x00, 0x00, 0x00}, // 13, -9.5dB
|
||||
{0x13, 0x13, 0x10, 0x0a, 0x00, 0x00, 0x00, 0x00}, // 14, -9.0dB
|
||||
{0x14, 0x14, 0x11, 0x0a, 0x00, 0x00, 0x00, 0x00}, // 15, -8.5dB
|
||||
{0x16, 0x15, 0x12, 0x0b, 0x00, 0x00, 0x00, 0x00}, // 16, -8.0dB
|
||||
{0x17, 0x16, 0x13, 0x0b, 0x00, 0x00, 0x00, 0x00}, // 17, -7.5dB
|
||||
{0x18, 0x17, 0x15, 0x0c, 0x00, 0x00, 0x00, 0x00}, // 18, -7.0dB
|
||||
{0x1a, 0x19, 0x16, 0x0d, 0x00, 0x00, 0x00, 0x00}, // 19, -6.5dB
|
||||
{0x1b, 0x1a, 0x17, 0x0e, 0x00, 0x00, 0x00, 0x00}, // 20, -6.0dB
|
||||
{0x1d, 0x1c, 0x18, 0x0e, 0x00, 0x00, 0x00, 0x00}, // 21, -5.5dB
|
||||
{0x1f, 0x1e, 0x1a, 0x0f, 0x00, 0x00, 0x00, 0x00}, // 22, -5.0dB
|
||||
{0x20, 0x20, 0x1b, 0x10, 0x00, 0x00, 0x00, 0x00}, // 23, -4.5dB
|
||||
{0x22, 0x21, 0x1d, 0x11, 0x00, 0x00, 0x00, 0x00}, // 24, -4.0dB
|
||||
{0x24, 0x23, 0x1f, 0x12, 0x00, 0x00, 0x00, 0x00}, // 25, -3.5dB
|
||||
{0x26, 0x25, 0x21, 0x13, 0x00, 0x00, 0x00, 0x00}, // 26, -3.0dB
|
||||
{0x28, 0x28, 0x24, 0x14, 0x00, 0x00, 0x00, 0x00}, // 27, -2.5dB
|
||||
{0x2b, 0x2a, 0x25, 0x15, 0x00, 0x00, 0x00, 0x00}, // 28, -2.0dB
|
||||
{0x2d, 0x2d, 0x17, 0x17, 0x00, 0x00, 0x00, 0x00}, // 29, -1.5dB
|
||||
{0x30, 0x2f, 0x29, 0x18, 0x00, 0x00, 0x00, 0x00}, // 30, -1.0dB
|
||||
{0x33, 0x32, 0x2b, 0x19, 0x00, 0x00, 0x00, 0x00}, // 31, -0.5dB
|
||||
{0x36, 0x35, 0x2e, 0x1b, 0x00, 0x00, 0x00, 0x00} // 32, +0dB
|
||||
};
|
||||
|
||||
u4Byte TxScalingTable_Jaguar[TXSCALE_TABLE_SIZE] =
|
||||
{
|
||||
0x081, // 0, -12.0dB
|
||||
0x088, // 1, -11.5dB
|
||||
0x090, // 2, -11.0dB
|
||||
0x099, // 3, -10.5dB
|
||||
0x0A2, // 4, -10.0dB
|
||||
0x0AC, // 5, -9.5dB
|
||||
0x0B6, // 6, -9.0dB
|
||||
0x0C0, // 7, -8.5dB
|
||||
0x0CC, // 8, -8.0dB
|
||||
0x0D8, // 9, -7.5dB
|
||||
0x0E5, // 10, -7.0dB
|
||||
0x0F2, // 11, -6.5dB
|
||||
0x101, // 12, -6.0dB
|
||||
0x110, // 13, -5.5dB
|
||||
0x120, // 14, -5.0dB
|
||||
0x131, // 15, -4.5dB
|
||||
0x143, // 16, -4.0dB
|
||||
0x156, // 17, -3.5dB
|
||||
0x16A, // 18, -3.0dB
|
||||
0x180, // 19, -2.5dB
|
||||
0x197, // 20, -2.0dB
|
||||
0x1AF, // 21, -1.5dB
|
||||
0x1C8, // 22, -1.0dB
|
||||
0x1E3, // 23, -0.5dB
|
||||
0x200, // 24, +0 dB
|
||||
0x21E, // 25, +0.5dB
|
||||
0x23E, // 26, +1.0dB
|
||||
0x261, // 27, +1.5dB
|
||||
0x285, // 28, +2.0dB
|
||||
0x2AB, // 29, +2.5dB
|
||||
0x2D3, // 30, +3.0dB
|
||||
0x2FE, // 31, +3.5dB
|
||||
0x32B, // 32, +4.0dB
|
||||
0x35C, // 33, +4.5dB
|
||||
0x38E, // 34, +5.0dB
|
||||
0x3C4, // 35, +5.5dB
|
||||
0x3FE // 36, +6.0dB
|
||||
};
|
||||
|
||||
#ifdef AP_BUILD_WORKAROUND
|
||||
|
||||
unsigned int TxPwrTrk_OFDM_SwingTbl[TxPwrTrk_OFDM_SwingTbl_Len] = {
|
||||
/* +6.0dB */ 0x7f8001fe,
|
||||
/* +5.5dB */ 0x788001e2,
|
||||
/* +5.0dB */ 0x71c001c7,
|
||||
/* +4.5dB */ 0x6b8001ae,
|
||||
/* +4.0dB */ 0x65400195,
|
||||
/* +3.5dB */ 0x5fc0017f,
|
||||
/* +3.0dB */ 0x5a400169,
|
||||
/* +2.5dB */ 0x55400155,
|
||||
/* +2.0dB */ 0x50800142,
|
||||
/* +1.5dB */ 0x4c000130,
|
||||
/* +1.0dB */ 0x47c0011f,
|
||||
/* +0.5dB */ 0x43c0010f,
|
||||
/* 0.0dB */ 0x40000100,
|
||||
/* -0.5dB */ 0x3c8000f2,
|
||||
/* -1.0dB */ 0x390000e4,
|
||||
/* -1.5dB */ 0x35c000d7,
|
||||
/* -2.0dB */ 0x32c000cb,
|
||||
/* -2.5dB */ 0x300000c0,
|
||||
/* -3.0dB */ 0x2d4000b5,
|
||||
/* -3.5dB */ 0x2ac000ab,
|
||||
/* -4.0dB */ 0x288000a2,
|
||||
/* -4.5dB */ 0x26000098,
|
||||
/* -5.0dB */ 0x24000090,
|
||||
/* -5.5dB */ 0x22000088,
|
||||
/* -6.0dB */ 0x20000080,
|
||||
/* -6.5dB */ 0x1a00006c,
|
||||
/* -7.0dB */ 0x1c800072,
|
||||
/* -7.5dB */ 0x18000060,
|
||||
/* -8.0dB */ 0x19800066,
|
||||
/* -8.5dB */ 0x15800056,
|
||||
/* -9.0dB */ 0x26c0005b,
|
||||
/* -9.5dB */ 0x14400051,
|
||||
/* -10.0dB */ 0x24400051,
|
||||
/* -10.5dB */ 0x1300004c,
|
||||
/* -11.0dB */ 0x12000048,
|
||||
/* -11.5dB */ 0x11000044,
|
||||
/* -12.0dB */ 0x10000040
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
odm_TXPowerTrackingInit(
|
||||
IN PVOID pDM_VOID
|
||||
)
|
||||
{
|
||||
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
|
||||
#if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
|
||||
if(!(pDM_Odm->SupportICType & (ODM_RTL8814A|ODM_IC_11N_SERIES)))
|
||||
return;
|
||||
#endif
|
||||
|
||||
odm_TXPowerTrackingThermalMeterInit(pDM_Odm);
|
||||
}
|
||||
|
||||
u1Byte
|
||||
getSwingIndex(
|
||||
IN PVOID pDM_VOID
|
||||
)
|
||||
{
|
||||
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
|
||||
PADAPTER Adapter = pDM_Odm->Adapter;
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
|
||||
u1Byte i = 0;
|
||||
u4Byte bbSwing;
|
||||
u4Byte swingTableSize;
|
||||
pu4Byte pSwingTable;
|
||||
|
||||
if (pDM_Odm->SupportICType == ODM_RTL8188E || pDM_Odm->SupportICType == ODM_RTL8723B
|
||||
|| pDM_Odm->SupportICType == ODM_RTL8192E || pDM_Odm->SupportICType == ODM_RTL8188F || pDM_Odm->SupportICType == ODM_RTL8703B
|
||||
) {
|
||||
bbSwing = PHY_QueryBBReg(Adapter, rOFDM0_XATxIQImbalance, 0xFFC00000);
|
||||
|
||||
pSwingTable = OFDMSwingTable_New;
|
||||
swingTableSize = OFDM_TABLE_SIZE;
|
||||
} else {
|
||||
#if ((RTL8812A_SUPPORT==1)||(RTL8821A_SUPPORT==1))
|
||||
if (pDM_Odm->SupportICType == ODM_RTL8812 || pDM_Odm->SupportICType == ODM_RTL8821)
|
||||
{
|
||||
bbSwing = PHY_GetTxBBSwing_8812A(Adapter, pHalData->CurrentBandType, ODM_RF_PATH_A);
|
||||
pSwingTable = TxScalingTable_Jaguar;
|
||||
swingTableSize = TXSCALE_TABLE_SIZE;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
bbSwing = 0;
|
||||
pSwingTable = OFDMSwingTable;
|
||||
swingTableSize = OFDM_TABLE_SIZE;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < swingTableSize; ++i) {
|
||||
u4Byte tableValue = pSwingTable[i];
|
||||
|
||||
if (tableValue >= 0x100000 )
|
||||
tableValue >>= 22;
|
||||
if (bbSwing == tableValue)
|
||||
break;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
VOID
|
||||
odm_TXPowerTrackingThermalMeterInit(
|
||||
IN PVOID pDM_VOID
|
||||
)
|
||||
{
|
||||
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
|
||||
u1Byte defaultSwingIndex = getSwingIndex(pDM_Odm);
|
||||
u1Byte p = 0;
|
||||
PODM_RF_CAL_T pRFCalibrateInfo = &(pDM_Odm->RFCalibrateInfo);
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
|
||||
PADAPTER Adapter = pDM_Odm->Adapter;
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
|
||||
|
||||
if(pDM_Odm->mp_mode == FALSE)
|
||||
pHalData->TxPowerTrackControl = TRUE;
|
||||
#elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
|
||||
PADAPTER Adapter = pDM_Odm->Adapter;
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
|
||||
|
||||
pRFCalibrateInfo->bTXPowerTracking = _TRUE;
|
||||
pRFCalibrateInfo->TXPowercount = 0;
|
||||
pRFCalibrateInfo->bTXPowerTrackingInit = _FALSE;
|
||||
|
||||
if(pDM_Odm->mp_mode == FALSE)
|
||||
pRFCalibrateInfo->TxPowerTrackControl = _TRUE;
|
||||
else
|
||||
pRFCalibrateInfo->TxPowerTrackControl = _FALSE;
|
||||
|
||||
if(pDM_Odm->mp_mode == FALSE)
|
||||
pRFCalibrateInfo->TxPowerTrackControl = _TRUE;
|
||||
|
||||
|
||||
MSG_8192C("pDM_Odm TxPowerTrackControl = %d\n", pRFCalibrateInfo->TxPowerTrackControl);
|
||||
|
||||
#elif (DM_ODM_SUPPORT_TYPE & (ODM_AP))
|
||||
#ifdef RTL8188E_SUPPORT
|
||||
{
|
||||
pRFCalibrateInfo->bTXPowerTracking = _TRUE;
|
||||
pRFCalibrateInfo->TXPowercount = 0;
|
||||
pRFCalibrateInfo->bTXPowerTrackingInit = _FALSE;
|
||||
pRFCalibrateInfo->TxPowerTrackControl = _TRUE;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//pDM_Odm->RFCalibrateInfo.TxPowerTrackControl = TRUE;
|
||||
pRFCalibrateInfo->ThermalValue = pHalData->EEPROMThermalMeter;
|
||||
pRFCalibrateInfo->ThermalValue_IQK = pHalData->EEPROMThermalMeter;
|
||||
pRFCalibrateInfo->ThermalValue_LCK = pHalData->EEPROMThermalMeter;
|
||||
|
||||
// The index of "0 dB" in SwingTable.
|
||||
if (pDM_Odm->SupportICType == ODM_RTL8188E || pDM_Odm->SupportICType == ODM_RTL8723B ||
|
||||
pDM_Odm->SupportICType == ODM_RTL8192E || pDM_Odm->SupportICType == ODM_RTL8703B) {
|
||||
pRFCalibrateInfo->DefaultOfdmIndex = (defaultSwingIndex >= OFDM_TABLE_SIZE) ? 30 : defaultSwingIndex;
|
||||
pRFCalibrateInfo->DefaultCckIndex = 20;
|
||||
}
|
||||
else if(pDM_Odm->SupportICType == ODM_RTL8188F) //add by Mingzhi.Guo 2015-03-23
|
||||
{
|
||||
pRFCalibrateInfo->DefaultOfdmIndex =28; //OFDM: -1dB
|
||||
pRFCalibrateInfo->DefaultCckIndex =20; //CCK:-6dB
|
||||
}
|
||||
else
|
||||
{
|
||||
pRFCalibrateInfo->DefaultOfdmIndex = (defaultSwingIndex >= TXSCALE_TABLE_SIZE) ? 24 : defaultSwingIndex;
|
||||
pRFCalibrateInfo->DefaultCckIndex = 24;
|
||||
}
|
||||
|
||||
pRFCalibrateInfo->BbSwingIdxCckBase = pRFCalibrateInfo->DefaultCckIndex;
|
||||
pRFCalibrateInfo->CCK_index = pRFCalibrateInfo->DefaultCckIndex;
|
||||
|
||||
for (p = ODM_RF_PATH_A; p < MAX_RF_PATH; ++p)
|
||||
{
|
||||
pRFCalibrateInfo->BbSwingIdxOfdmBase[p] = pRFCalibrateInfo->DefaultOfdmIndex;
|
||||
pRFCalibrateInfo->OFDM_index[p] = pRFCalibrateInfo->DefaultOfdmIndex;
|
||||
pRFCalibrateInfo->DeltaPowerIndex[p] = 0;
|
||||
pRFCalibrateInfo->DeltaPowerIndexLast[p] = 0;
|
||||
pRFCalibrateInfo->PowerIndexOffset[p] = 0;
|
||||
}
|
||||
pRFCalibrateInfo->Modify_TxAGC_Value_OFDM=0; //add by Mingzhi.Guo
|
||||
pRFCalibrateInfo->Modify_TxAGC_Value_CCK=0; //add by Mingzhi.Guo
|
||||
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
ODM_TXPowerTrackingCheck(
|
||||
IN PVOID pDM_VOID
|
||||
)
|
||||
{
|
||||
/* 2011/09/29 MH In HW integration first stage, we provide 4 different handle to operate
|
||||
at the same time. In the stage2/3, we need to prive universal interface and merge all
|
||||
HW dynamic mechanism. */
|
||||
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
|
||||
switch (pDM_Odm->SupportPlatform)
|
||||
{
|
||||
case ODM_WIN:
|
||||
odm_TXPowerTrackingCheckMP(pDM_Odm);
|
||||
break;
|
||||
|
||||
case ODM_CE:
|
||||
odm_TXPowerTrackingCheckCE(pDM_Odm);
|
||||
break;
|
||||
|
||||
case ODM_AP:
|
||||
odm_TXPowerTrackingCheckAP(pDM_Odm);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
VOID
|
||||
odm_TXPowerTrackingCheckCE(
|
||||
IN PVOID pDM_VOID
|
||||
)
|
||||
{
|
||||
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_CE)
|
||||
PADAPTER Adapter = pDM_Odm->Adapter;
|
||||
|
||||
if (!(pDM_Odm->SupportAbility & ODM_RF_TX_PWR_TRACK))
|
||||
return;
|
||||
|
||||
if(!pDM_Odm->RFCalibrateInfo.TM_Trigger) //at least delay 1 sec
|
||||
{
|
||||
//pHalData->TxPowerCheckCnt++; //cosa add for debug
|
||||
if (IS_HARDWARE_TYPE_8188E(Adapter) || IS_HARDWARE_TYPE_8188F(Adapter) || IS_HARDWARE_TYPE_8192E(Adapter)
|
||||
|| IS_HARDWARE_TYPE_8723B(Adapter)
|
||||
|| IS_HARDWARE_TYPE_JAGUAR(Adapter) || IS_HARDWARE_TYPE_8814A(Adapter)
|
||||
|| IS_HARDWARE_TYPE_8703B(Adapter)
|
||||
) {
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_T_METER_NEW, (BIT17 | BIT16), 0x03);
|
||||
} else {
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_T_METER_OLD, bRFRegOffsetMask, 0x60);
|
||||
}
|
||||
|
||||
//DBG_871X("Trigger Thermal Meter!!\n");
|
||||
|
||||
pDM_Odm->RFCalibrateInfo.TM_Trigger = 1;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
//DBG_871X("Schedule TxPowerTracking direct call!!\n");
|
||||
ODM_TXPowerTrackingCallback_ThermalMeter(Adapter);
|
||||
pDM_Odm->RFCalibrateInfo.TM_Trigger = 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
VOID
|
||||
odm_TXPowerTrackingCheckMP(
|
||||
IN PVOID pDM_VOID
|
||||
)
|
||||
{
|
||||
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
|
||||
PADAPTER Adapter = pDM_Odm->Adapter;
|
||||
|
||||
if (ODM_CheckPowerStatus(Adapter) == FALSE)
|
||||
{
|
||||
RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, ("===>ODM_CheckPowerStatus() return FALSE\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
if(!Adapter->bSlaveOfDMSP || Adapter->DualMacSmartConcurrent == FALSE)
|
||||
odm_TXPowerTrackingThermalMeterCheck(Adapter);
|
||||
else {
|
||||
RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, ("!Adapter->bSlaveOfDMSP || Adapter->DualMacSmartConcurrent == FALSE\n"));
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
odm_TXPowerTrackingCheckAP(
|
||||
IN PVOID pDM_VOID
|
||||
)
|
||||
{
|
||||
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_AP)
|
||||
prtl8192cd_priv priv = pDM_Odm->priv;
|
||||
|
||||
return;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
|
||||
VOID
|
||||
odm_TXPowerTrackingThermalMeterCheck(
|
||||
IN PADAPTER Adapter
|
||||
)
|
||||
{
|
||||
#ifndef AP_BUILD_WORKAROUND
|
||||
static u1Byte TM_Trigger = 0;
|
||||
|
||||
if(!(GET_HAL_DATA(Adapter)->DM_OutSrc.SupportAbility & ODM_RF_TX_PWR_TRACK))
|
||||
{
|
||||
RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD,
|
||||
("===>odm_TXPowerTrackingThermalMeterCheck(),pMgntInfo->bTXPowerTracking is FALSE, return!!\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
if(!TM_Trigger) //at least delay 1 sec
|
||||
{
|
||||
if (IS_HARDWARE_TYPE_8188E(Adapter) || IS_HARDWARE_TYPE_JAGUAR(Adapter) || IS_HARDWARE_TYPE_8192E(Adapter) ||
|
||||
IS_HARDWARE_TYPE_8723B(Adapter) || IS_HARDWARE_TYPE_8814A(Adapter) || IS_HARDWARE_TYPE_8188F(Adapter)
|
||||
|| IS_HARDWARE_TYPE_8703B(Adapter))
|
||||
PHY_SetRFReg(Adapter, ODM_RF_PATH_A, RF_T_METER_88E, BIT17 | BIT16, 0x03);
|
||||
else
|
||||
PHY_SetRFReg(Adapter, ODM_RF_PATH_A, RF_T_METER, bRFRegOffsetMask, 0x60);
|
||||
|
||||
RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD,("Trigger Thermal Meter!!\n"));
|
||||
|
||||
TM_Trigger = 1;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD,("Schedule TxPowerTracking direct call!!\n"));
|
||||
odm_TXPowerTrackingDirectCall(Adapter); //Using direct call is instead, added by Roger, 2009.06.18.
|
||||
TM_Trigger = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
296
hal/phydm/phydm_powertracking_ce.h
Normal file
296
hal/phydm/phydm_powertracking_ce.h
Normal file
|
|
@ -0,0 +1,296 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __PHYDMPOWERTRACKING_H__
|
||||
#define __PHYDMPOWERTRACKING_H__
|
||||
|
||||
#define POWRTRACKING_VERSION "1.1"
|
||||
|
||||
#define DPK_DELTA_MAPPING_NUM 13
|
||||
#define index_mapping_HP_NUM 15
|
||||
#define OFDM_TABLE_SIZE 43
|
||||
#define CCK_TABLE_SIZE 33
|
||||
#define CCK_TABLE_SIZE_88F 21
|
||||
#define TXSCALE_TABLE_SIZE 37
|
||||
#define TXPWR_TRACK_TABLE_SIZE 30
|
||||
#define DELTA_SWINGIDX_SIZE 30
|
||||
#define BAND_NUM 4
|
||||
|
||||
#define AVG_THERMAL_NUM 8
|
||||
#define HP_THERMAL_NUM 8
|
||||
#define IQK_MAC_REG_NUM 4
|
||||
#define IQK_ADDA_REG_NUM 16
|
||||
#define IQK_BB_REG_NUM_MAX 10
|
||||
|
||||
#define IQK_BB_REG_NUM 9
|
||||
|
||||
|
||||
|
||||
#define IQK_Matrix_REG_NUM 8
|
||||
#define IQK_Matrix_Settings_NUM 14+24+21 // Channels_2_4G_NUM + Channels_5G_20M_NUM + Channels_5G
|
||||
|
||||
extern u4Byte OFDMSwingTable[OFDM_TABLE_SIZE];
|
||||
extern u1Byte CCKSwingTable_Ch1_Ch13[CCK_TABLE_SIZE][8];
|
||||
extern u1Byte CCKSwingTable_Ch14 [CCK_TABLE_SIZE][8];
|
||||
|
||||
extern u4Byte OFDMSwingTable_New[OFDM_TABLE_SIZE];
|
||||
extern u1Byte CCKSwingTable_Ch1_Ch13_New[CCK_TABLE_SIZE][8];
|
||||
extern u1Byte CCKSwingTable_Ch14_New [CCK_TABLE_SIZE][8];
|
||||
extern u1Byte CCKSwingTable_Ch1_Ch14_88F[CCK_TABLE_SIZE_88F][16];
|
||||
|
||||
|
||||
extern u4Byte TxScalingTable_Jaguar[TXSCALE_TABLE_SIZE];
|
||||
|
||||
// <20121018, Kordan> In case fail to read TxPowerTrack.txt, we use the table of 88E as the default table.
|
||||
static u1Byte DeltaSwingTableIdx_2GA_P_8188E[] = {0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 7, 7, 8, 8, 8, 9, 9, 9, 9, 9};
|
||||
static u1Byte DeltaSwingTableIdx_2GA_N_8188E[] = {0, 0, 0, 2, 2, 3, 3, 4, 4, 4, 4, 5, 5, 6, 6, 7, 7, 7, 7, 8, 8, 9, 9, 10, 10, 10, 11, 11, 11, 11};
|
||||
|
||||
#define dm_CheckTXPowerTracking ODM_TXPowerTrackingCheck
|
||||
|
||||
typedef struct _IQK_MATRIX_REGS_SETTING{
|
||||
BOOLEAN bIQKDone;
|
||||
s4Byte Value[3][IQK_Matrix_REG_NUM];
|
||||
BOOLEAN bBWIqkResultSaved[3];
|
||||
}IQK_MATRIX_REGS_SETTING,*PIQK_MATRIX_REGS_SETTING;
|
||||
|
||||
typedef struct ODM_RF_Calibration_Structure
|
||||
{
|
||||
//for tx power tracking
|
||||
|
||||
u4Byte RegA24; // for TempCCK
|
||||
s4Byte RegE94;
|
||||
s4Byte RegE9C;
|
||||
s4Byte RegEB4;
|
||||
s4Byte RegEBC;
|
||||
|
||||
u1Byte TXPowercount;
|
||||
BOOLEAN bTXPowerTrackingInit;
|
||||
BOOLEAN bTXPowerTracking;
|
||||
u1Byte TxPowerTrackControl; //for mp mode, turn off txpwrtracking as default
|
||||
u1Byte TM_Trigger;
|
||||
u1Byte InternalPA5G[2]; //pathA / pathB
|
||||
|
||||
u1Byte ThermalMeter[2]; // ThermalMeter, index 0 for RFIC0, and 1 for RFIC1
|
||||
u1Byte ThermalValue;
|
||||
u1Byte ThermalValue_LCK;
|
||||
u1Byte ThermalValue_IQK;
|
||||
u1Byte ThermalValue_DPK;
|
||||
u1Byte ThermalValue_AVG[AVG_THERMAL_NUM];
|
||||
u1Byte ThermalValue_AVG_index;
|
||||
u1Byte ThermalValue_RxGain;
|
||||
u1Byte ThermalValue_Crystal;
|
||||
u1Byte ThermalValue_DPKstore;
|
||||
u1Byte ThermalValue_DPKtrack;
|
||||
BOOLEAN TxPowerTrackingInProgress;
|
||||
|
||||
BOOLEAN bReloadtxpowerindex;
|
||||
u1Byte bRfPiEnable;
|
||||
u4Byte TXPowerTrackingCallbackCnt; //cosa add for debug
|
||||
|
||||
|
||||
//------------------------- Tx power Tracking -------------------------//
|
||||
u1Byte bCCKinCH14;
|
||||
u1Byte CCK_index;
|
||||
u1Byte OFDM_index[MAX_RF_PATH];
|
||||
s1Byte PowerIndexOffset[MAX_RF_PATH];
|
||||
s1Byte DeltaPowerIndex[MAX_RF_PATH];
|
||||
s1Byte DeltaPowerIndexLast[MAX_RF_PATH];
|
||||
BOOLEAN bTxPowerChanged;
|
||||
|
||||
u1Byte ThermalValue_HP[HP_THERMAL_NUM];
|
||||
u1Byte ThermalValue_HP_index;
|
||||
IQK_MATRIX_REGS_SETTING IQKMatrixRegSetting[IQK_Matrix_Settings_NUM];
|
||||
u1Byte Delta_LCK;
|
||||
s1Byte BBSwingDiff2G, BBSwingDiff5G; // Unit: dB
|
||||
u1Byte DeltaSwingTableIdx_2GCCKA_P[DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_2GCCKA_N[DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_2GCCKB_P[DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_2GCCKB_N[DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_2GCCKC_P[DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_2GCCKC_N[DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_2GCCKD_P[DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_2GCCKD_N[DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_2GA_P[DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_2GA_N[DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_2GB_P[DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_2GB_N[DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_2GC_P[DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_2GC_N[DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_2GD_P[DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_2GD_N[DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_5GA_P[BAND_NUM][DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_5GA_N[BAND_NUM][DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_5GB_P[BAND_NUM][DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_5GB_N[BAND_NUM][DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_5GC_P[BAND_NUM][DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_5GC_N[BAND_NUM][DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_5GD_P[BAND_NUM][DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_5GD_N[BAND_NUM][DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_2GA_P_8188E[DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_2GA_N_8188E[DELTA_SWINGIDX_SIZE];
|
||||
|
||||
u1Byte BbSwingIdxOfdm[MAX_RF_PATH];
|
||||
u1Byte BbSwingIdxOfdmCurrent;
|
||||
#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE))
|
||||
u1Byte BbSwingIdxOfdmBase[MAX_RF_PATH];
|
||||
#else
|
||||
u1Byte BbSwingIdxOfdmBase;
|
||||
#endif
|
||||
BOOLEAN BbSwingFlagOfdm;
|
||||
u1Byte BbSwingIdxCck;
|
||||
u1Byte BbSwingIdxCckCurrent;
|
||||
u1Byte BbSwingIdxCckBase;
|
||||
u1Byte DefaultOfdmIndex;
|
||||
u1Byte DefaultCckIndex;
|
||||
BOOLEAN BbSwingFlagCck;
|
||||
|
||||
s1Byte Absolute_OFDMSwingIdx[MAX_RF_PATH];
|
||||
s1Byte Remnant_OFDMSwingIdx[MAX_RF_PATH];
|
||||
s1Byte Remnant_CCKSwingIdx;
|
||||
s1Byte Modify_TxAGC_Value; /*Remnat compensate value at TxAGC */
|
||||
BOOLEAN Modify_TxAGC_Flag_PathA;
|
||||
BOOLEAN Modify_TxAGC_Flag_PathB;
|
||||
BOOLEAN Modify_TxAGC_Flag_PathC;
|
||||
BOOLEAN Modify_TxAGC_Flag_PathD;
|
||||
BOOLEAN Modify_TxAGC_Flag_PathA_CCK;
|
||||
|
||||
s1Byte KfreeOffset[MAX_RF_PATH];
|
||||
|
||||
//--------------------------------------------------------------------//
|
||||
|
||||
//for IQK
|
||||
u4Byte RegC04;
|
||||
u4Byte Reg874;
|
||||
u4Byte RegC08;
|
||||
u4Byte RegB68;
|
||||
u4Byte RegB6C;
|
||||
u4Byte Reg870;
|
||||
u4Byte Reg860;
|
||||
u4Byte Reg864;
|
||||
|
||||
BOOLEAN bIQKInitialized;
|
||||
BOOLEAN bLCKInProgress;
|
||||
BOOLEAN bAntennaDetected;
|
||||
BOOLEAN bNeedIQK;
|
||||
BOOLEAN bIQKInProgress;
|
||||
u1Byte Delta_IQK;
|
||||
u4Byte ADDA_backup[IQK_ADDA_REG_NUM];
|
||||
u4Byte IQK_MAC_backup[IQK_MAC_REG_NUM];
|
||||
u4Byte IQK_BB_backup_recover[9];
|
||||
u4Byte IQK_BB_backup[IQK_BB_REG_NUM];
|
||||
u4Byte TxIQC_8723B[2][3][2]; // { {S1: 0xc94, 0xc80, 0xc4c} , {S0: 0xc9c, 0xc88, 0xc4c}}
|
||||
u4Byte RxIQC_8723B[2][2][2]; // { {S1: 0xc14, 0xca0} , {S0: 0xc14, 0xca0}}
|
||||
u4Byte TxIQC_8703B[3][2]; /* { {S1: 0xc94, 0xc80, 0xc4c} , {S0: 0xc9c, 0xc88, 0xc4c}}*/
|
||||
u4Byte RxIQC_8703B[2][2]; /* { {S1: 0xc14, 0xca0} , {S0: 0xc14, 0xca0}}*/
|
||||
|
||||
|
||||
|
||||
// <James> IQK time measurement
|
||||
u8Byte IQK_StartTime;
|
||||
u8Byte IQK_ProgressingTime;
|
||||
u4Byte LOK_Result;
|
||||
|
||||
//for APK
|
||||
u4Byte APKoutput[2][2]; //path A/B; output1_1a/output1_2a
|
||||
u1Byte bAPKdone;
|
||||
u1Byte bAPKThermalMeterIgnore;
|
||||
|
||||
// DPK
|
||||
BOOLEAN bDPKFail;
|
||||
u1Byte bDPdone;
|
||||
u1Byte bDPPathAOK;
|
||||
u1Byte bDPPathBOK;
|
||||
|
||||
u4Byte TxLOK[2];
|
||||
u4Byte DpkTxAGC;
|
||||
s4Byte DpkGain;
|
||||
u4Byte DpkThermal[4];
|
||||
s1Byte Modify_TxAGC_Value_OFDM;
|
||||
s1Byte Modify_TxAGC_Value_CCK;
|
||||
}ODM_RF_CAL_T,*PODM_RF_CAL_T;
|
||||
|
||||
|
||||
VOID
|
||||
ODM_TXPowerTrackingCheck(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
|
||||
VOID
|
||||
odm_TXPowerTrackingInit(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
odm_TXPowerTrackingCheckAP(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
odm_TXPowerTrackingThermalMeterInit(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
odm_TXPowerTrackingInit(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
odm_TXPowerTrackingCheckMP(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
|
||||
VOID
|
||||
odm_TXPowerTrackingCheckCE(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
#if(DM_ODM_SUPPORT_TYPE & (ODM_WIN))
|
||||
|
||||
VOID
|
||||
odm_TXPowerTrackingCallbackThermalMeter92C(
|
||||
IN PADAPTER Adapter
|
||||
);
|
||||
|
||||
VOID
|
||||
odm_TXPowerTrackingCallbackRXGainThermalMeter92D(
|
||||
IN PADAPTER Adapter
|
||||
);
|
||||
|
||||
VOID
|
||||
odm_TXPowerTrackingCallbackThermalMeter92D(
|
||||
IN PADAPTER Adapter
|
||||
);
|
||||
|
||||
VOID
|
||||
odm_TXPowerTrackingDirectCall92C(
|
||||
IN PADAPTER Adapter
|
||||
);
|
||||
|
||||
VOID
|
||||
odm_TXPowerTrackingThermalMeterCheck(
|
||||
IN PADAPTER Adapter
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
687
hal/phydm/phydm_powertracking_win.c
Normal file
687
hal/phydm/phydm_powertracking_win.c
Normal file
|
|
@ -0,0 +1,687 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
//============================================================
|
||||
// include files
|
||||
//============================================================
|
||||
#include "mp_precomp.h"
|
||||
#include "phydm_precomp.h"
|
||||
|
||||
//============================================================
|
||||
// Global var
|
||||
//============================================================
|
||||
|
||||
u4Byte OFDMSwingTable[OFDM_TABLE_SIZE] = {
|
||||
0x7f8001fe, // 0, +6.0dB
|
||||
0x788001e2, // 1, +5.5dB
|
||||
0x71c001c7, // 2, +5.0dB
|
||||
0x6b8001ae, // 3, +4.5dB
|
||||
0x65400195, // 4, +4.0dB
|
||||
0x5fc0017f, // 5, +3.5dB
|
||||
0x5a400169, // 6, +3.0dB
|
||||
0x55400155, // 7, +2.5dB
|
||||
0x50800142, // 8, +2.0dB
|
||||
0x4c000130, // 9, +1.5dB
|
||||
0x47c0011f, // 10, +1.0dB
|
||||
0x43c0010f, // 11, +0.5dB
|
||||
0x40000100, // 12, +0dB
|
||||
0x3c8000f2, // 13, -0.5dB
|
||||
0x390000e4, // 14, -1.0dB
|
||||
0x35c000d7, // 15, -1.5dB
|
||||
0x32c000cb, // 16, -2.0dB
|
||||
0x300000c0, // 17, -2.5dB
|
||||
0x2d4000b5, // 18, -3.0dB
|
||||
0x2ac000ab, // 19, -3.5dB
|
||||
0x288000a2, // 20, -4.0dB
|
||||
0x26000098, // 21, -4.5dB
|
||||
0x24000090, // 22, -5.0dB
|
||||
0x22000088, // 23, -5.5dB
|
||||
0x20000080, // 24, -6.0dB
|
||||
0x1e400079, // 25, -6.5dB
|
||||
0x1c800072, // 26, -7.0dB
|
||||
0x1b00006c, // 27. -7.5dB
|
||||
0x19800066, // 28, -8.0dB
|
||||
0x18000060, // 29, -8.5dB
|
||||
0x16c0005b, // 30, -9.0dB
|
||||
0x15800056, // 31, -9.5dB
|
||||
0x14400051, // 32, -10.0dB
|
||||
0x1300004c, // 33, -10.5dB
|
||||
0x12000048, // 34, -11.0dB
|
||||
0x11000044, // 35, -11.5dB
|
||||
0x10000040, // 36, -12.0dB
|
||||
};
|
||||
|
||||
u1Byte CCKSwingTable_Ch1_Ch13[CCK_TABLE_SIZE][8] = {
|
||||
{0x36, 0x35, 0x2e, 0x25, 0x1c, 0x12, 0x09, 0x04}, // 0, +0dB
|
||||
{0x33, 0x32, 0x2b, 0x23, 0x1a, 0x11, 0x08, 0x04}, // 1, -0.5dB
|
||||
{0x30, 0x2f, 0x29, 0x21, 0x19, 0x10, 0x08, 0x03}, // 2, -1.0dB
|
||||
{0x2d, 0x2d, 0x27, 0x1f, 0x18, 0x0f, 0x08, 0x03}, // 3, -1.5dB
|
||||
{0x2b, 0x2a, 0x25, 0x1e, 0x16, 0x0e, 0x07, 0x03}, // 4, -2.0dB
|
||||
{0x28, 0x28, 0x22, 0x1c, 0x15, 0x0d, 0x07, 0x03}, // 5, -2.5dB
|
||||
{0x26, 0x25, 0x21, 0x1b, 0x14, 0x0d, 0x06, 0x03}, // 6, -3.0dB
|
||||
{0x24, 0x23, 0x1f, 0x19, 0x13, 0x0c, 0x06, 0x03}, // 7, -3.5dB
|
||||
{0x22, 0x21, 0x1d, 0x18, 0x11, 0x0b, 0x06, 0x02}, // 8, -4.0dB
|
||||
{0x20, 0x20, 0x1b, 0x16, 0x11, 0x08, 0x05, 0x02}, // 9, -4.5dB
|
||||
{0x1f, 0x1e, 0x1a, 0x15, 0x10, 0x0a, 0x05, 0x02}, // 10, -5.0dB
|
||||
{0x1d, 0x1c, 0x18, 0x14, 0x0f, 0x0a, 0x05, 0x02}, // 11, -5.5dB
|
||||
{0x1b, 0x1a, 0x17, 0x13, 0x0e, 0x09, 0x04, 0x02}, // 12, -6.0dB <== default
|
||||
{0x1a, 0x19, 0x16, 0x12, 0x0d, 0x09, 0x04, 0x02}, // 13, -6.5dB
|
||||
{0x18, 0x17, 0x15, 0x11, 0x0c, 0x08, 0x04, 0x02}, // 14, -7.0dB
|
||||
{0x17, 0x16, 0x13, 0x10, 0x0c, 0x08, 0x04, 0x02}, // 15, -7.5dB
|
||||
{0x16, 0x15, 0x12, 0x0f, 0x0b, 0x07, 0x04, 0x01}, // 16, -8.0dB
|
||||
{0x14, 0x14, 0x11, 0x0e, 0x0b, 0x07, 0x03, 0x02}, // 17, -8.5dB
|
||||
{0x13, 0x13, 0x10, 0x0d, 0x0a, 0x06, 0x03, 0x01}, // 18, -9.0dB
|
||||
{0x12, 0x12, 0x0f, 0x0c, 0x09, 0x06, 0x03, 0x01}, // 19, -9.5dB
|
||||
{0x11, 0x11, 0x0f, 0x0c, 0x09, 0x06, 0x03, 0x01}, // 20, -10.0dB
|
||||
{0x10, 0x10, 0x0e, 0x0b, 0x08, 0x05, 0x03, 0x01}, // 21, -10.5dB
|
||||
{0x0f, 0x0f, 0x0d, 0x0b, 0x08, 0x05, 0x03, 0x01}, // 22, -11.0dB
|
||||
{0x0e, 0x0e, 0x0c, 0x0a, 0x08, 0x05, 0x02, 0x01}, // 23, -11.5dB
|
||||
{0x0d, 0x0d, 0x0c, 0x0a, 0x07, 0x05, 0x02, 0x01}, // 24, -12.0dB
|
||||
{0x0d, 0x0c, 0x0b, 0x09, 0x07, 0x04, 0x02, 0x01}, // 25, -12.5dB
|
||||
{0x0c, 0x0c, 0x0a, 0x09, 0x06, 0x04, 0x02, 0x01}, // 26, -13.0dB
|
||||
{0x0b, 0x0b, 0x0a, 0x08, 0x06, 0x04, 0x02, 0x01}, // 27, -13.5dB
|
||||
{0x0b, 0x0a, 0x09, 0x08, 0x06, 0x04, 0x02, 0x01}, // 28, -14.0dB
|
||||
{0x0a, 0x0a, 0x09, 0x07, 0x05, 0x03, 0x02, 0x01}, // 29, -14.5dB
|
||||
{0x0a, 0x09, 0x08, 0x07, 0x05, 0x03, 0x02, 0x01}, // 30, -15.0dB
|
||||
{0x09, 0x09, 0x08, 0x06, 0x05, 0x03, 0x01, 0x01}, // 31, -15.5dB
|
||||
{0x09, 0x08, 0x07, 0x06, 0x04, 0x03, 0x01, 0x01} // 32, -16.0dB
|
||||
};
|
||||
|
||||
|
||||
u1Byte CCKSwingTable_Ch14[CCK_TABLE_SIZE][8] = {
|
||||
{0x36, 0x35, 0x2e, 0x1b, 0x00, 0x00, 0x00, 0x00}, // 0, +0dB
|
||||
{0x33, 0x32, 0x2b, 0x19, 0x00, 0x00, 0x00, 0x00}, // 1, -0.5dB
|
||||
{0x30, 0x2f, 0x29, 0x18, 0x00, 0x00, 0x00, 0x00}, // 2, -1.0dB
|
||||
{0x2d, 0x2d, 0x17, 0x17, 0x00, 0x00, 0x00, 0x00}, // 3, -1.5dB
|
||||
{0x2b, 0x2a, 0x25, 0x15, 0x00, 0x00, 0x00, 0x00}, // 4, -2.0dB
|
||||
{0x28, 0x28, 0x24, 0x14, 0x00, 0x00, 0x00, 0x00}, // 5, -2.5dB
|
||||
{0x26, 0x25, 0x21, 0x13, 0x00, 0x00, 0x00, 0x00}, // 6, -3.0dB
|
||||
{0x24, 0x23, 0x1f, 0x12, 0x00, 0x00, 0x00, 0x00}, // 7, -3.5dB
|
||||
{0x22, 0x21, 0x1d, 0x11, 0x00, 0x00, 0x00, 0x00}, // 8, -4.0dB
|
||||
{0x20, 0x20, 0x1b, 0x10, 0x00, 0x00, 0x00, 0x00}, // 9, -4.5dB
|
||||
{0x1f, 0x1e, 0x1a, 0x0f, 0x00, 0x00, 0x00, 0x00}, // 10, -5.0dB
|
||||
{0x1d, 0x1c, 0x18, 0x0e, 0x00, 0x00, 0x00, 0x00}, // 11, -5.5dB
|
||||
{0x1b, 0x1a, 0x17, 0x0e, 0x00, 0x00, 0x00, 0x00}, // 12, -6.0dB <== default
|
||||
{0x1a, 0x19, 0x16, 0x0d, 0x00, 0x00, 0x00, 0x00}, // 13, -6.5dB
|
||||
{0x18, 0x17, 0x15, 0x0c, 0x00, 0x00, 0x00, 0x00}, // 14, -7.0dB
|
||||
{0x17, 0x16, 0x13, 0x0b, 0x00, 0x00, 0x00, 0x00}, // 15, -7.5dB
|
||||
{0x16, 0x15, 0x12, 0x0b, 0x00, 0x00, 0x00, 0x00}, // 16, -8.0dB
|
||||
{0x14, 0x14, 0x11, 0x0a, 0x00, 0x00, 0x00, 0x00}, // 17, -8.5dB
|
||||
{0x13, 0x13, 0x10, 0x0a, 0x00, 0x00, 0x00, 0x00}, // 18, -9.0dB
|
||||
{0x12, 0x12, 0x0f, 0x09, 0x00, 0x00, 0x00, 0x00}, // 19, -9.5dB
|
||||
{0x11, 0x11, 0x0f, 0x09, 0x00, 0x00, 0x00, 0x00}, // 20, -10.0dB
|
||||
{0x10, 0x10, 0x0e, 0x08, 0x00, 0x00, 0x00, 0x00}, // 21, -10.5dB
|
||||
{0x0f, 0x0f, 0x0d, 0x08, 0x00, 0x00, 0x00, 0x00}, // 22, -11.0dB
|
||||
{0x0e, 0x0e, 0x0c, 0x07, 0x00, 0x00, 0x00, 0x00}, // 23, -11.5dB
|
||||
{0x0d, 0x0d, 0x0c, 0x07, 0x00, 0x00, 0x00, 0x00}, // 24, -12.0dB
|
||||
{0x0d, 0x0c, 0x0b, 0x06, 0x00, 0x00, 0x00, 0x00}, // 25, -12.5dB
|
||||
{0x0c, 0x0c, 0x0a, 0x06, 0x00, 0x00, 0x00, 0x00}, // 26, -13.0dB
|
||||
{0x0b, 0x0b, 0x0a, 0x06, 0x00, 0x00, 0x00, 0x00}, // 27, -13.5dB
|
||||
{0x0b, 0x0a, 0x09, 0x05, 0x00, 0x00, 0x00, 0x00}, // 28, -14.0dB
|
||||
{0x0a, 0x0a, 0x09, 0x05, 0x00, 0x00, 0x00, 0x00}, // 29, -14.5dB
|
||||
{0x0a, 0x09, 0x08, 0x05, 0x00, 0x00, 0x00, 0x00}, // 30, -15.0dB
|
||||
{0x09, 0x09, 0x08, 0x05, 0x00, 0x00, 0x00, 0x00}, // 31, -15.5dB
|
||||
{0x09, 0x08, 0x07, 0x04, 0x00, 0x00, 0x00, 0x00} // 32, -16.0dB
|
||||
};
|
||||
|
||||
|
||||
u4Byte OFDMSwingTable_New[OFDM_TABLE_SIZE] = {
|
||||
0x0b40002d, // 0, -15.0dB
|
||||
0x0c000030, // 1, -14.5dB
|
||||
0x0cc00033, // 2, -14.0dB
|
||||
0x0d800036, // 3, -13.5dB
|
||||
0x0e400039, // 4, -13.0dB
|
||||
0x0f00003c, // 5, -12.5dB
|
||||
0x10000040, // 6, -12.0dB
|
||||
0x11000044, // 7, -11.5dB
|
||||
0x12000048, // 8, -11.0dB
|
||||
0x1300004c, // 9, -10.5dB
|
||||
0x14400051, // 10, -10.0dB
|
||||
0x15800056, // 11, -9.5dB
|
||||
0x16c0005b, // 12, -9.0dB
|
||||
0x18000060, // 13, -8.5dB
|
||||
0x19800066, // 14, -8.0dB
|
||||
0x1b00006c, // 15, -7.5dB
|
||||
0x1c800072, // 16, -7.0dB
|
||||
0x1e400079, // 17, -6.5dB
|
||||
0x20000080, // 18, -6.0dB
|
||||
0x22000088, // 19, -5.5dB
|
||||
0x24000090, // 20, -5.0dB
|
||||
0x26000098, // 21, -4.5dB
|
||||
0x288000a2, // 22, -4.0dB
|
||||
0x2ac000ab, // 23, -3.5dB
|
||||
0x2d4000b5, // 24, -3.0dB
|
||||
0x300000c0, // 25, -2.5dB
|
||||
0x32c000cb, // 26, -2.0dB
|
||||
0x35c000d7, // 27, -1.5dB
|
||||
0x390000e4, // 28, -1.0dB
|
||||
0x3c8000f2, // 29, -0.5dB
|
||||
0x40000100, // 30, +0dB
|
||||
0x43c0010f, // 31, +0.5dB
|
||||
0x47c0011f, // 32, +1.0dB
|
||||
0x4c000130, // 33, +1.5dB
|
||||
0x50800142, // 34, +2.0dB
|
||||
0x55400155, // 35, +2.5dB
|
||||
0x5a400169, // 36, +3.0dB
|
||||
0x5fc0017f, // 37, +3.5dB
|
||||
0x65400195, // 38, +4.0dB
|
||||
0x6b8001ae, // 39, +4.5dB
|
||||
0x71c001c7, // 40, +5.0dB
|
||||
0x788001e2, // 41, +5.5dB
|
||||
0x7f8001fe // 42, +6.0dB
|
||||
};
|
||||
|
||||
|
||||
u1Byte CCKSwingTable_Ch1_Ch14_88F[CCK_TABLE_SIZE_88F][16] = {
|
||||
{0x44, 0x42, 0x3C, 0x33, 0x28, 0x1C, 0x13, 0x0B, 0x05, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-16dB*/
|
||||
{0x48, 0x46, 0x3F, 0x36, 0x2A, 0x1E, 0x14, 0x0B, 0x05, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-15.5dB*/
|
||||
{0x4D, 0x4A, 0x43, 0x39, 0x2C, 0x20, 0x15, 0x0C, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-15dB*/
|
||||
{0x51, 0x4F, 0x47, 0x3C, 0x2F, 0x22, 0x16, 0x0D, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-14.5dB*/
|
||||
{0x56, 0x53, 0x4B, 0x40, 0x32, 0x24, 0x17, 0x0E, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-14dB*/
|
||||
{0x5B, 0x58, 0x50, 0x43, 0x35, 0x26, 0x19, 0x0E, 0x07, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-13.5dB*/
|
||||
{0x60, 0x5D, 0x54, 0x47, 0x38, 0x28, 0x1A, 0x0F, 0x07, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-13dB*/
|
||||
{0x66, 0x63, 0x59, 0x4C, 0x3B, 0x2B, 0x1C, 0x10, 0x08, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-12.5dB*/
|
||||
{0x6C, 0x69, 0x5F, 0x50, 0x3F, 0x2D, 0x1E, 0x11, 0x08, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-12dB*/
|
||||
{0x73, 0x6F, 0x64, 0x55, 0x42, 0x30, 0x1F, 0x12, 0x08, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-11.5dB*/
|
||||
{0x79, 0x76, 0x6A, 0x5A, 0x46, 0x33, 0x21, 0x13, 0x09, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-11dB*/
|
||||
{0x81, 0x7C, 0x71, 0x5F, 0x4A, 0x36, 0x23, 0x14, 0x0A, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-10.5dB*/
|
||||
{0x88, 0x84, 0x77, 0x65, 0x4F, 0x39, 0x25, 0x15, 0x0A, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-10dB*/
|
||||
{0x90, 0x8C, 0x7E, 0x6B, 0x54, 0x3C, 0x27, 0x17, 0x0B, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-9.5dB*/
|
||||
{0x99, 0x94, 0x86, 0x71, 0x58, 0x40, 0x2A, 0x18, 0x0B, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-9dB*/
|
||||
{0xA2, 0x9D, 0x8E, 0x78, 0x5E, 0x43, 0x2C, 0x19, 0x0C, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-8.5dB*/
|
||||
{0xAC, 0xA6, 0x96, 0x7F, 0x63, 0x47, 0x2F, 0x1B, 0x0D, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-8dB*/
|
||||
{0xB6, 0xB0, 0x9F, 0x87, 0x69, 0x4C, 0x32, 0x1D, 0x0D, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-7.5dB*/
|
||||
{0xC1, 0xBA, 0xA8, 0x8F, 0x6F, 0x50, 0x35, 0x1E, 0x0E, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-7dB*/
|
||||
{0xCC, 0xC5, 0xB2, 0x97, 0x76, 0x55, 0x38, 0x20, 0x0F, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-6.5dB*/
|
||||
{0xD8, 0xD1, 0xBD, 0xA0, 0x7D, 0x5A, 0x3B, 0x22, 0x10, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} /*-6dB*/
|
||||
};
|
||||
|
||||
|
||||
u1Byte CCKSwingTable_Ch1_Ch13_New[CCK_TABLE_SIZE][8] = {
|
||||
{0x09, 0x08, 0x07, 0x06, 0x04, 0x03, 0x01, 0x01}, // 0, -16.0dB
|
||||
{0x09, 0x09, 0x08, 0x06, 0x05, 0x03, 0x01, 0x01}, // 1, -15.5dB
|
||||
{0x0a, 0x09, 0x08, 0x07, 0x05, 0x03, 0x02, 0x01}, // 2, -15.0dB
|
||||
{0x0a, 0x0a, 0x09, 0x07, 0x05, 0x03, 0x02, 0x01}, // 3, -14.5dB
|
||||
{0x0b, 0x0a, 0x09, 0x08, 0x06, 0x04, 0x02, 0x01}, // 4, -14.0dB
|
||||
{0x0b, 0x0b, 0x0a, 0x08, 0x06, 0x04, 0x02, 0x01}, // 5, -13.5dB
|
||||
{0x0c, 0x0c, 0x0a, 0x09, 0x06, 0x04, 0x02, 0x01}, // 6, -13.0dB
|
||||
{0x0d, 0x0c, 0x0b, 0x09, 0x07, 0x04, 0x02, 0x01}, // 7, -12.5dB
|
||||
{0x0d, 0x0d, 0x0c, 0x0a, 0x07, 0x05, 0x02, 0x01}, // 8, -12.0dB
|
||||
{0x0e, 0x0e, 0x0c, 0x0a, 0x08, 0x05, 0x02, 0x01}, // 9, -11.5dB
|
||||
{0x0f, 0x0f, 0x0d, 0x0b, 0x08, 0x05, 0x03, 0x01}, // 10, -11.0dB
|
||||
{0x10, 0x10, 0x0e, 0x0b, 0x08, 0x05, 0x03, 0x01}, // 11, -10.5dB
|
||||
{0x11, 0x11, 0x0f, 0x0c, 0x09, 0x06, 0x03, 0x01}, // 12, -10.0dB
|
||||
{0x12, 0x12, 0x0f, 0x0c, 0x09, 0x06, 0x03, 0x01}, // 13, -9.5dB
|
||||
{0x13, 0x13, 0x10, 0x0d, 0x0a, 0x06, 0x03, 0x01}, // 14, -9.0dB
|
||||
{0x14, 0x14, 0x11, 0x0e, 0x0b, 0x07, 0x03, 0x02}, // 15, -8.5dB
|
||||
{0x16, 0x15, 0x12, 0x0f, 0x0b, 0x07, 0x04, 0x01}, // 16, -8.0dB
|
||||
{0x17, 0x16, 0x13, 0x10, 0x0c, 0x08, 0x04, 0x02}, // 17, -7.5dB
|
||||
{0x18, 0x17, 0x15, 0x11, 0x0c, 0x08, 0x04, 0x02}, // 18, -7.0dB
|
||||
{0x1a, 0x19, 0x16, 0x12, 0x0d, 0x09, 0x04, 0x02}, // 19, -6.5dB
|
||||
{0x1b, 0x1a, 0x17, 0x13, 0x0e, 0x09, 0x04, 0x02}, // 20, -6.0dB
|
||||
{0x1d, 0x1c, 0x18, 0x14, 0x0f, 0x0a, 0x05, 0x02}, // 21, -5.5dB
|
||||
{0x1f, 0x1e, 0x1a, 0x15, 0x10, 0x0a, 0x05, 0x02}, // 22, -5.0dB
|
||||
{0x20, 0x20, 0x1b, 0x16, 0x11, 0x08, 0x05, 0x02}, // 23, -4.5dB
|
||||
{0x22, 0x21, 0x1d, 0x18, 0x11, 0x0b, 0x06, 0x02}, // 24, -4.0dB
|
||||
{0x24, 0x23, 0x1f, 0x19, 0x13, 0x0c, 0x06, 0x03}, // 25, -3.5dB
|
||||
{0x26, 0x25, 0x21, 0x1b, 0x14, 0x0d, 0x06, 0x03}, // 26, -3.0dB
|
||||
{0x28, 0x28, 0x22, 0x1c, 0x15, 0x0d, 0x07, 0x03}, // 27, -2.5dB
|
||||
{0x2b, 0x2a, 0x25, 0x1e, 0x16, 0x0e, 0x07, 0x03}, // 28, -2.0dB
|
||||
{0x2d, 0x2d, 0x27, 0x1f, 0x18, 0x0f, 0x08, 0x03}, // 29, -1.5dB
|
||||
{0x30, 0x2f, 0x29, 0x21, 0x19, 0x10, 0x08, 0x03}, // 30, -1.0dB
|
||||
{0x33, 0x32, 0x2b, 0x23, 0x1a, 0x11, 0x08, 0x04}, // 31, -0.5dB
|
||||
{0x36, 0x35, 0x2e, 0x25, 0x1c, 0x12, 0x09, 0x04} // 32, +0dB
|
||||
};
|
||||
|
||||
|
||||
u1Byte CCKSwingTable_Ch14_New[CCK_TABLE_SIZE][8]= {
|
||||
{0x09, 0x08, 0x07, 0x04, 0x00, 0x00, 0x00, 0x00}, // 0, -16.0dB
|
||||
{0x09, 0x09, 0x08, 0x05, 0x00, 0x00, 0x00, 0x00}, // 1, -15.5dB
|
||||
{0x0a, 0x09, 0x08, 0x05, 0x00, 0x00, 0x00, 0x00}, // 2, -15.0dB
|
||||
{0x0a, 0x0a, 0x09, 0x05, 0x00, 0x00, 0x00, 0x00}, // 3, -14.5dB
|
||||
{0x0b, 0x0a, 0x09, 0x05, 0x00, 0x00, 0x00, 0x00}, // 4, -14.0dB
|
||||
{0x0b, 0x0b, 0x0a, 0x06, 0x00, 0x00, 0x00, 0x00}, // 5, -13.5dB
|
||||
{0x0c, 0x0c, 0x0a, 0x06, 0x00, 0x00, 0x00, 0x00}, // 6, -13.0dB
|
||||
{0x0d, 0x0c, 0x0b, 0x06, 0x00, 0x00, 0x00, 0x00}, // 7, -12.5dB
|
||||
{0x0d, 0x0d, 0x0c, 0x07, 0x00, 0x00, 0x00, 0x00}, // 8, -12.0dB
|
||||
{0x0e, 0x0e, 0x0c, 0x07, 0x00, 0x00, 0x00, 0x00}, // 9, -11.5dB
|
||||
{0x0f, 0x0f, 0x0d, 0x08, 0x00, 0x00, 0x00, 0x00}, // 10, -11.0dB
|
||||
{0x10, 0x10, 0x0e, 0x08, 0x00, 0x00, 0x00, 0x00}, // 11, -10.5dB
|
||||
{0x11, 0x11, 0x0f, 0x09, 0x00, 0x00, 0x00, 0x00}, // 12, -10.0dB
|
||||
{0x12, 0x12, 0x0f, 0x09, 0x00, 0x00, 0x00, 0x00}, // 13, -9.5dB
|
||||
{0x13, 0x13, 0x10, 0x0a, 0x00, 0x00, 0x00, 0x00}, // 14, -9.0dB
|
||||
{0x14, 0x14, 0x11, 0x0a, 0x00, 0x00, 0x00, 0x00}, // 15, -8.5dB
|
||||
{0x16, 0x15, 0x12, 0x0b, 0x00, 0x00, 0x00, 0x00}, // 16, -8.0dB
|
||||
{0x17, 0x16, 0x13, 0x0b, 0x00, 0x00, 0x00, 0x00}, // 17, -7.5dB
|
||||
{0x18, 0x17, 0x15, 0x0c, 0x00, 0x00, 0x00, 0x00}, // 18, -7.0dB
|
||||
{0x1a, 0x19, 0x16, 0x0d, 0x00, 0x00, 0x00, 0x00}, // 19, -6.5dB
|
||||
{0x1b, 0x1a, 0x17, 0x0e, 0x00, 0x00, 0x00, 0x00}, // 20, -6.0dB
|
||||
{0x1d, 0x1c, 0x18, 0x0e, 0x00, 0x00, 0x00, 0x00}, // 21, -5.5dB
|
||||
{0x1f, 0x1e, 0x1a, 0x0f, 0x00, 0x00, 0x00, 0x00}, // 22, -5.0dB
|
||||
{0x20, 0x20, 0x1b, 0x10, 0x00, 0x00, 0x00, 0x00}, // 23, -4.5dB
|
||||
{0x22, 0x21, 0x1d, 0x11, 0x00, 0x00, 0x00, 0x00}, // 24, -4.0dB
|
||||
{0x24, 0x23, 0x1f, 0x12, 0x00, 0x00, 0x00, 0x00}, // 25, -3.5dB
|
||||
{0x26, 0x25, 0x21, 0x13, 0x00, 0x00, 0x00, 0x00}, // 26, -3.0dB
|
||||
{0x28, 0x28, 0x24, 0x14, 0x00, 0x00, 0x00, 0x00}, // 27, -2.5dB
|
||||
{0x2b, 0x2a, 0x25, 0x15, 0x00, 0x00, 0x00, 0x00}, // 28, -2.0dB
|
||||
{0x2d, 0x2d, 0x17, 0x17, 0x00, 0x00, 0x00, 0x00}, // 29, -1.5dB
|
||||
{0x30, 0x2f, 0x29, 0x18, 0x00, 0x00, 0x00, 0x00}, // 30, -1.0dB
|
||||
{0x33, 0x32, 0x2b, 0x19, 0x00, 0x00, 0x00, 0x00}, // 31, -0.5dB
|
||||
{0x36, 0x35, 0x2e, 0x1b, 0x00, 0x00, 0x00, 0x00} // 32, +0dB
|
||||
};
|
||||
|
||||
u4Byte TxScalingTable_Jaguar[TXSCALE_TABLE_SIZE] =
|
||||
{
|
||||
0x081, // 0, -12.0dB
|
||||
0x088, // 1, -11.5dB
|
||||
0x090, // 2, -11.0dB
|
||||
0x099, // 3, -10.5dB
|
||||
0x0A2, // 4, -10.0dB
|
||||
0x0AC, // 5, -9.5dB
|
||||
0x0B6, // 6, -9.0dB
|
||||
0x0C0, // 7, -8.5dB
|
||||
0x0CC, // 8, -8.0dB
|
||||
0x0D8, // 9, -7.5dB
|
||||
0x0E5, // 10, -7.0dB
|
||||
0x0F2, // 11, -6.5dB
|
||||
0x101, // 12, -6.0dB
|
||||
0x110, // 13, -5.5dB
|
||||
0x120, // 14, -5.0dB
|
||||
0x131, // 15, -4.5dB
|
||||
0x143, // 16, -4.0dB
|
||||
0x156, // 17, -3.5dB
|
||||
0x16A, // 18, -3.0dB
|
||||
0x180, // 19, -2.5dB
|
||||
0x197, // 20, -2.0dB
|
||||
0x1AF, // 21, -1.5dB
|
||||
0x1C8, // 22, -1.0dB
|
||||
0x1E3, // 23, -0.5dB
|
||||
0x200, // 24, +0 dB
|
||||
0x21E, // 25, +0.5dB
|
||||
0x23E, // 26, +1.0dB
|
||||
0x261, // 27, +1.5dB
|
||||
0x285, // 28, +2.0dB
|
||||
0x2AB, // 29, +2.5dB
|
||||
0x2D3, // 30, +3.0dB
|
||||
0x2FE, // 31, +3.5dB
|
||||
0x32B, // 32, +4.0dB
|
||||
0x35C, // 33, +4.5dB
|
||||
0x38E, // 34, +5.0dB
|
||||
0x3C4, // 35, +5.5dB
|
||||
0x3FE // 36, +6.0dB
|
||||
};
|
||||
|
||||
#ifdef AP_BUILD_WORKAROUND
|
||||
|
||||
unsigned int TxPwrTrk_OFDM_SwingTbl[TxPwrTrk_OFDM_SwingTbl_Len] = {
|
||||
/* +6.0dB */ 0x7f8001fe,
|
||||
/* +5.5dB */ 0x788001e2,
|
||||
/* +5.0dB */ 0x71c001c7,
|
||||
/* +4.5dB */ 0x6b8001ae,
|
||||
/* +4.0dB */ 0x65400195,
|
||||
/* +3.5dB */ 0x5fc0017f,
|
||||
/* +3.0dB */ 0x5a400169,
|
||||
/* +2.5dB */ 0x55400155,
|
||||
/* +2.0dB */ 0x50800142,
|
||||
/* +1.5dB */ 0x4c000130,
|
||||
/* +1.0dB */ 0x47c0011f,
|
||||
/* +0.5dB */ 0x43c0010f,
|
||||
/* 0.0dB */ 0x40000100,
|
||||
/* -0.5dB */ 0x3c8000f2,
|
||||
/* -1.0dB */ 0x390000e4,
|
||||
/* -1.5dB */ 0x35c000d7,
|
||||
/* -2.0dB */ 0x32c000cb,
|
||||
/* -2.5dB */ 0x300000c0,
|
||||
/* -3.0dB */ 0x2d4000b5,
|
||||
/* -3.5dB */ 0x2ac000ab,
|
||||
/* -4.0dB */ 0x288000a2,
|
||||
/* -4.5dB */ 0x26000098,
|
||||
/* -5.0dB */ 0x24000090,
|
||||
/* -5.5dB */ 0x22000088,
|
||||
/* -6.0dB */ 0x20000080,
|
||||
/* -6.5dB */ 0x1a00006c,
|
||||
/* -7.0dB */ 0x1c800072,
|
||||
/* -7.5dB */ 0x18000060,
|
||||
/* -8.0dB */ 0x19800066,
|
||||
/* -8.5dB */ 0x15800056,
|
||||
/* -9.0dB */ 0x26c0005b,
|
||||
/* -9.5dB */ 0x14400051,
|
||||
/* -10.0dB */ 0x24400051,
|
||||
/* -10.5dB */ 0x1300004c,
|
||||
/* -11.0dB */ 0x12000048,
|
||||
/* -11.5dB */ 0x11000044,
|
||||
/* -12.0dB */ 0x10000040
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
VOID
|
||||
odm_TXPowerTrackingInit(
|
||||
IN PVOID pDM_VOID
|
||||
)
|
||||
{
|
||||
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
|
||||
#if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
|
||||
if(!(pDM_Odm->SupportICType & (ODM_RTL8814A|ODM_IC_11N_SERIES|ODM_RTL8822B)))
|
||||
return;
|
||||
#endif
|
||||
|
||||
odm_TXPowerTrackingThermalMeterInit(pDM_Odm);
|
||||
}
|
||||
|
||||
u1Byte
|
||||
getSwingIndex(
|
||||
IN PVOID pDM_VOID
|
||||
)
|
||||
{
|
||||
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
|
||||
PADAPTER Adapter = pDM_Odm->Adapter;
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
|
||||
u1Byte i = 0;
|
||||
u4Byte bbSwing;
|
||||
u4Byte swingTableSize;
|
||||
pu4Byte pSwingTable;
|
||||
|
||||
if (pDM_Odm->SupportICType == ODM_RTL8188E || pDM_Odm->SupportICType == ODM_RTL8723B ||
|
||||
pDM_Odm->SupportICType == ODM_RTL8192E || pDM_Odm->SupportICType == ODM_RTL8188F || pDM_Odm->SupportICType == ODM_RTL8703B)
|
||||
{
|
||||
bbSwing = PHY_QueryBBReg(Adapter, rOFDM0_XATxIQImbalance, 0xFFC00000);
|
||||
|
||||
pSwingTable = OFDMSwingTable_New;
|
||||
swingTableSize = OFDM_TABLE_SIZE;
|
||||
} else {
|
||||
bbSwing = PHY_GetTxBBSwing_8812A(Adapter, pHalData->CurrentBandType, ODM_RF_PATH_A);
|
||||
pSwingTable = TxScalingTable_Jaguar;
|
||||
swingTableSize = TXSCALE_TABLE_SIZE;
|
||||
}
|
||||
|
||||
for (i = 0; i < swingTableSize; ++i) {
|
||||
u4Byte tableValue = pSwingTable[i];
|
||||
|
||||
if (tableValue >= 0x100000 )
|
||||
tableValue >>= 22;
|
||||
if (bbSwing == tableValue)
|
||||
break;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
VOID
|
||||
odm_TXPowerTrackingThermalMeterInit(
|
||||
IN PVOID pDM_VOID
|
||||
)
|
||||
{
|
||||
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
|
||||
u1Byte defaultSwingIndex = getSwingIndex(pDM_Odm);
|
||||
PODM_RF_CAL_T pRFCalibrateInfo = &(pDM_Odm->RFCalibrateInfo);
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
|
||||
PADAPTER Adapter = pDM_Odm->Adapter;
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
|
||||
u1Byte p = 0;
|
||||
|
||||
if(pDM_Odm->mp_mode == FALSE)
|
||||
pRFCalibrateInfo->TxPowerTrackControl = TRUE;
|
||||
#elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
|
||||
#ifdef CONFIG_RTL8188E
|
||||
{
|
||||
pRFCalibrateInfo->bTXPowerTracking = _TRUE;
|
||||
pRFCalibrateInfo->TXPowercount = 0;
|
||||
pRFCalibrateInfo->bTXPowerTrackingInit = _FALSE;
|
||||
|
||||
if(pDM_Odm->mp_mode == FALSE)
|
||||
pRFCalibrateInfo->TxPowerTrackControl = _TRUE;
|
||||
|
||||
MSG_8192C("pDM_Odm TxPowerTrackControl = %d\n", pRFCalibrateInfo->TxPowerTrackControl);
|
||||
}
|
||||
#else
|
||||
{
|
||||
PADAPTER Adapter = pDM_Odm->Adapter;
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
|
||||
struct dm_priv *pdmpriv = &pHalData->dmpriv;
|
||||
|
||||
pdmpriv->bTXPowerTracking = _TRUE;
|
||||
pdmpriv->TXPowercount = 0;
|
||||
pdmpriv->bTXPowerTrackingInit = _FALSE;
|
||||
|
||||
if(pDM_Odm->mp_mode == FALSE)
|
||||
pdmpriv->TxPowerTrackControl = _TRUE;
|
||||
|
||||
MSG_8192C("pdmpriv->TxPowerTrackControl = %d\n", pdmpriv->TxPowerTrackControl);
|
||||
|
||||
}
|
||||
#endif//endif (CONFIG_RTL8188E==1)
|
||||
#elif (DM_ODM_SUPPORT_TYPE & (ODM_AP))
|
||||
#ifdef RTL8188E_SUPPORT
|
||||
{
|
||||
pRFCalibrateInfo->bTXPowerTracking = _TRUE;
|
||||
pRFCalibrateInfo->TXPowercount = 0;
|
||||
pRFCalibrateInfo->bTXPowerTrackingInit = _FALSE;
|
||||
pRFCalibrateInfo->TxPowerTrackControl = _TRUE;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
pRFCalibrateInfo->TxPowerTrackControl = TRUE;
|
||||
pRFCalibrateInfo->ThermalValue = pHalData->EEPROMThermalMeter;
|
||||
pRFCalibrateInfo->ThermalValue_IQK = pHalData->EEPROMThermalMeter;
|
||||
pRFCalibrateInfo->ThermalValue_LCK = pHalData->EEPROMThermalMeter;
|
||||
|
||||
// The index of "0 dB" in SwingTable.
|
||||
if (pDM_Odm->SupportICType == ODM_RTL8188E || pDM_Odm->SupportICType == ODM_RTL8723B ||
|
||||
pDM_Odm->SupportICType == ODM_RTL8192E || pDM_Odm->SupportICType == ODM_RTL8703B)
|
||||
{
|
||||
pRFCalibrateInfo->DefaultOfdmIndex = (defaultSwingIndex >= OFDM_TABLE_SIZE) ? 30 : defaultSwingIndex;
|
||||
pRFCalibrateInfo->DefaultCckIndex = 20;
|
||||
}
|
||||
else if(pDM_Odm->SupportICType == ODM_RTL8188F) //add by Mingzhi.Guo 2015-03-23
|
||||
{
|
||||
pRFCalibrateInfo->DefaultOfdmIndex =28; //OFDM: -1dB
|
||||
pRFCalibrateInfo->DefaultCckIndex =20; //CCK:-6dB
|
||||
}
|
||||
else
|
||||
{
|
||||
pRFCalibrateInfo->DefaultOfdmIndex = (defaultSwingIndex >= TXSCALE_TABLE_SIZE) ? 24 : defaultSwingIndex;
|
||||
pRFCalibrateInfo->DefaultCckIndex = 24;
|
||||
}
|
||||
|
||||
pRFCalibrateInfo->BbSwingIdxCckBase = pRFCalibrateInfo->DefaultCckIndex;
|
||||
pRFCalibrateInfo->CCK_index = pRFCalibrateInfo->DefaultCckIndex;
|
||||
|
||||
for (p = ODM_RF_PATH_A; p < MAX_RF_PATH; ++p)
|
||||
{
|
||||
pRFCalibrateInfo->BbSwingIdxOfdmBase[p] = pRFCalibrateInfo->DefaultOfdmIndex;
|
||||
pRFCalibrateInfo->OFDM_index[p] = pRFCalibrateInfo->DefaultOfdmIndex;
|
||||
pRFCalibrateInfo->DeltaPowerIndex[p] = 0;
|
||||
pRFCalibrateInfo->DeltaPowerIndexLast[p] = 0;
|
||||
pRFCalibrateInfo->PowerIndexOffset[p] = 0;
|
||||
pRFCalibrateInfo->KfreeOffset[p] = 0;
|
||||
}
|
||||
pRFCalibrateInfo->Modify_TxAGC_Value_OFDM=0; //add by Mingzhi.Guo
|
||||
pRFCalibrateInfo->Modify_TxAGC_Value_CCK=0; //add by Mingzhi.Guo
|
||||
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
ODM_TXPowerTrackingCheck(
|
||||
IN PVOID pDM_VOID
|
||||
)
|
||||
{
|
||||
//
|
||||
// 2011/09/29 MH In HW integration first stage, we provide 4 different handle to operate
|
||||
// at the same time. In the stage2/3, we need to prive universal interface and merge all
|
||||
// HW dynamic mechanism.
|
||||
//
|
||||
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
|
||||
switch (pDM_Odm->SupportPlatform)
|
||||
{
|
||||
case ODM_WIN:
|
||||
odm_TXPowerTrackingCheckMP(pDM_Odm);
|
||||
break;
|
||||
|
||||
case ODM_CE:
|
||||
odm_TXPowerTrackingCheckCE(pDM_Odm);
|
||||
break;
|
||||
|
||||
case ODM_AP:
|
||||
odm_TXPowerTrackingCheckAP(pDM_Odm);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
VOID
|
||||
odm_TXPowerTrackingCheckCE(
|
||||
IN PVOID pDM_VOID
|
||||
)
|
||||
{
|
||||
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_CE)
|
||||
PADAPTER Adapter = pDM_Odm->Adapter;
|
||||
#if ((RTL8188F_SUPPORT == 1))
|
||||
rtl8192c_odm_CheckTXPowerTracking(Adapter);
|
||||
#endif
|
||||
|
||||
#if(RTL8188E_SUPPORT==1)
|
||||
|
||||
if(!(pDM_Odm->SupportAbility & ODM_RF_TX_PWR_TRACK))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(!pRFCalibrateInfo->TM_Trigger) //at least delay 1 sec
|
||||
{
|
||||
ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_T_METER, bRFRegOffsetMask, 0x60);
|
||||
//DBG_8192C("Trigger 92C Thermal Meter!!\n");
|
||||
|
||||
pRFCalibrateInfo->TM_Trigger = 1;
|
||||
return;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//DBG_8192C("Schedule TxPowerTracking direct call!!\n");
|
||||
odm_TXPowerTrackingCallback_ThermalMeter_8188E(Adapter);
|
||||
pRFCalibrateInfo->TM_Trigger = 0;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
VOID
|
||||
odm_TXPowerTrackingCheckMP(
|
||||
IN PVOID pDM_VOID
|
||||
)
|
||||
{
|
||||
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
|
||||
PADAPTER Adapter = pDM_Odm->Adapter;
|
||||
|
||||
if(*pDM_Odm->pIsFcsModeEnable)
|
||||
return;
|
||||
|
||||
if (ODM_CheckPowerStatus(Adapter) == FALSE)
|
||||
{
|
||||
RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, ("===>ODM_CheckPowerStatus() return FALSE\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
if(IS_HARDWARE_TYPE_8821B(Adapter)) // TODO: Don't Do PowerTracking
|
||||
return;
|
||||
|
||||
// #if(RTL8192D_SUPPORT==1)
|
||||
// if(!Adapter->bSlaveOfDMSP || Adapter->DualMacSmartConcurrent == FALSE)
|
||||
if (IS_HARDWARE_TYPE_8814A(Adapter) || IS_HARDWARE_TYPE_8188F(Adapter))
|
||||
odm_TXPowerTrackingThermalMeterCheck(Adapter);
|
||||
else {
|
||||
RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, ("!Adapter->bSlaveOfDMSP || Adapter->DualMacSmartConcurrent == FALSE\n"));
|
||||
}
|
||||
// #endif
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
odm_TXPowerTrackingCheckAP(
|
||||
IN PVOID pDM_VOID
|
||||
)
|
||||
{
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
|
||||
|
||||
VOID
|
||||
odm_TXPowerTrackingDirectCall(
|
||||
IN PADAPTER Adapter
|
||||
)
|
||||
{
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
|
||||
PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc;
|
||||
|
||||
ODM_TXPowerTrackingCallback_ThermalMeter(Adapter);
|
||||
}
|
||||
|
||||
VOID
|
||||
odm_TXPowerTrackingThermalMeterCheck(
|
||||
IN PADAPTER Adapter
|
||||
)
|
||||
{
|
||||
#ifndef AP_BUILD_WORKAROUND
|
||||
static u1Byte TM_Trigger = 0;
|
||||
|
||||
if(!(GET_HAL_DATA(Adapter)->DM_OutSrc.SupportAbility & ODM_RF_TX_PWR_TRACK))
|
||||
{
|
||||
RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD,
|
||||
("===>odm_TXPowerTrackingThermalMeterCheck(),pMgntInfo->bTXPowerTracking is FALSE, return!!\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
if(!TM_Trigger) //at least delay 1 sec
|
||||
{
|
||||
if (IS_HARDWARE_TYPE_8188E(Adapter) || IS_HARDWARE_TYPE_JAGUAR(Adapter) || IS_HARDWARE_TYPE_8192E(Adapter) ||
|
||||
IS_HARDWARE_TYPE_8723B(Adapter) || IS_HARDWARE_TYPE_8814A(Adapter) || IS_HARDWARE_TYPE_8188F(Adapter) || IS_HARDWARE_TYPE_8703B(Adapter))
|
||||
PHY_SetRFReg(Adapter, ODM_RF_PATH_A, RF_T_METER_88E, BIT17 | BIT16, 0x03);
|
||||
else
|
||||
PHY_SetRFReg(Adapter, ODM_RF_PATH_A, RF_T_METER, bRFRegOffsetMask, 0x60);
|
||||
|
||||
RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD,("Trigger Thermal Meter!!\n"));
|
||||
|
||||
TM_Trigger = 1;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD,("Schedule TxPowerTracking direct call!!\n"));
|
||||
odm_TXPowerTrackingDirectCall(Adapter); //Using direct call is instead, added by Roger, 2009.06.18.
|
||||
TM_Trigger = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif //end #ifMP
|
||||
|
||||
|
||||
265
hal/phydm/phydm_powertracking_win.h
Normal file
265
hal/phydm/phydm_powertracking_win.h
Normal file
|
|
@ -0,0 +1,265 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __PHYDMPOWERTRACKING_H__
|
||||
#define __PHYDMPOWERTRACKING_H__
|
||||
|
||||
#define POWRTRACKING_VERSION "1.1"
|
||||
|
||||
#define DPK_DELTA_MAPPING_NUM 13
|
||||
#define index_mapping_HP_NUM 15
|
||||
#define TXSCALE_TABLE_SIZE 37
|
||||
#define TXPWR_TRACK_TABLE_SIZE 30
|
||||
#define DELTA_SWINGIDX_SIZE 30
|
||||
#define BAND_NUM 3
|
||||
#define MAX_RF_PATH 4
|
||||
#define CCK_TABLE_SIZE_88F 21
|
||||
|
||||
|
||||
#define dm_CheckTXPowerTracking ODM_TXPowerTrackingCheck
|
||||
|
||||
#define IQK_Matrix_Settings_NUM 14+24+21 // Channels_2_4G_NUM + Channels_5G_20M_NUM + Channels_5G
|
||||
#define AVG_THERMAL_NUM 8
|
||||
#define HP_THERMAL_NUM 8
|
||||
#define IQK_Matrix_REG_NUM 8
|
||||
#define IQK_MAC_REG_NUM 4
|
||||
#define IQK_ADDA_REG_NUM 16
|
||||
|
||||
#define IQK_BB_REG_NUM 9
|
||||
|
||||
|
||||
extern u4Byte OFDMSwingTable[OFDM_TABLE_SIZE];
|
||||
extern u1Byte CCKSwingTable_Ch1_Ch13[CCK_TABLE_SIZE][8];
|
||||
extern u1Byte CCKSwingTable_Ch14 [CCK_TABLE_SIZE][8];
|
||||
|
||||
extern u4Byte OFDMSwingTable_New[OFDM_TABLE_SIZE];
|
||||
extern u1Byte CCKSwingTable_Ch1_Ch13_New[CCK_TABLE_SIZE][8];
|
||||
extern u1Byte CCKSwingTable_Ch14_New [CCK_TABLE_SIZE][8];
|
||||
extern u1Byte CCKSwingTable_Ch1_Ch14_88F[CCK_TABLE_SIZE_88F][16];
|
||||
|
||||
extern u4Byte TxScalingTable_Jaguar[TXSCALE_TABLE_SIZE];
|
||||
|
||||
// <20121018, Kordan> In case fail to read TxPowerTrack.txt, we use the table of 88E as the default table.
|
||||
static u1Byte DeltaSwingTableIdx_2GA_P_8188E[] = {0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 7, 7, 8, 8, 8, 9, 9, 9, 9, 9};
|
||||
static u1Byte DeltaSwingTableIdx_2GA_N_8188E[] = {0, 0, 0, 2, 2, 3, 3, 4, 4, 4, 4, 5, 5, 6, 6, 7, 7, 7, 7, 8, 8, 9, 9, 10, 10, 10, 11, 11, 11, 11};
|
||||
|
||||
VOID
|
||||
ODM_TXPowerTrackingCheck(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
odm_TXPowerTrackingCheckAP(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
odm_TXPowerTrackingThermalMeterInit(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
odm_TXPowerTrackingInit(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
odm_TXPowerTrackingCheckMP(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
|
||||
VOID
|
||||
odm_TXPowerTrackingCheckCE(
|
||||
IN PVOID pDM_VOID
|
||||
);
|
||||
|
||||
#if(DM_ODM_SUPPORT_TYPE & (ODM_WIN))
|
||||
|
||||
|
||||
VOID
|
||||
odm_TXPowerTrackingThermalMeterCheck(
|
||||
IN PADAPTER Adapter
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
typedef struct _IQK_MATRIX_REGS_SETTING{
|
||||
BOOLEAN bIQKDone;
|
||||
s4Byte Value[3][IQK_Matrix_REG_NUM];
|
||||
BOOLEAN bBWIqkResultSaved[3];
|
||||
}IQK_MATRIX_REGS_SETTING,*PIQK_MATRIX_REGS_SETTING;
|
||||
|
||||
typedef struct ODM_RF_Calibration_Structure
|
||||
{
|
||||
//for tx power tracking
|
||||
|
||||
u4Byte RegA24; // for TempCCK
|
||||
s4Byte RegE94;
|
||||
s4Byte RegE9C;
|
||||
s4Byte RegEB4;
|
||||
s4Byte RegEBC;
|
||||
//u1Byte bTXPowerTracking;
|
||||
u1Byte TXPowercount;
|
||||
BOOLEAN bTXPowerTrackingInit;
|
||||
BOOLEAN bTXPowerTracking;
|
||||
u1Byte TxPowerTrackControl; //for mp mode, turn off txpwrtracking as default
|
||||
u1Byte TM_Trigger;
|
||||
u1Byte InternalPA5G[2]; //pathA / pathB
|
||||
|
||||
u1Byte ThermalMeter[2]; // ThermalMeter, index 0 for RFIC0, and 1 for RFIC1
|
||||
u1Byte ThermalValue;
|
||||
u1Byte ThermalValue_LCK;
|
||||
u1Byte ThermalValue_IQK;
|
||||
u1Byte ThermalValue_AVG[AVG_THERMAL_NUM];
|
||||
u1Byte ThermalValue_AVG_index;
|
||||
u1Byte ThermalValue_RxGain;
|
||||
|
||||
BOOLEAN bReloadtxpowerindex;
|
||||
u1Byte bRfPiEnable;
|
||||
u4Byte TXPowerTrackingCallbackCnt; //cosa add for debug
|
||||
|
||||
|
||||
//------------------------- Tx power Tracking -------------------------//
|
||||
u1Byte bCCKinCH14;
|
||||
u1Byte CCK_index;
|
||||
u1Byte OFDM_index[MAX_RF_PATH];
|
||||
s1Byte PowerIndexOffset[MAX_RF_PATH];
|
||||
s1Byte DeltaPowerIndex[MAX_RF_PATH];
|
||||
s1Byte DeltaPowerIndexLast[MAX_RF_PATH];
|
||||
BOOLEAN bTxPowerChanged;
|
||||
|
||||
u1Byte ThermalValue_HP[HP_THERMAL_NUM];
|
||||
u1Byte ThermalValue_HP_index;
|
||||
IQK_MATRIX_REGS_SETTING IQKMatrixRegSetting[IQK_Matrix_Settings_NUM];
|
||||
u1Byte Delta_LCK;
|
||||
s1Byte BBSwingDiff2G, BBSwingDiff5G; // Unit: dB
|
||||
u1Byte DeltaSwingTableIdx_2GCCKA_P[DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_2GCCKA_N[DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_2GCCKB_P[DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_2GCCKB_N[DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_2GCCKC_P[DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_2GCCKC_N[DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_2GCCKD_P[DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_2GCCKD_N[DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_2GA_P[DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_2GA_N[DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_2GB_P[DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_2GB_N[DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_2GC_P[DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_2GC_N[DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_2GD_P[DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_2GD_N[DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_5GA_P[BAND_NUM][DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_5GA_N[BAND_NUM][DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_5GB_P[BAND_NUM][DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_5GB_N[BAND_NUM][DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_5GC_P[BAND_NUM][DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_5GC_N[BAND_NUM][DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_5GD_P[BAND_NUM][DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_5GD_N[BAND_NUM][DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_2GA_P_8188E[DELTA_SWINGIDX_SIZE];
|
||||
u1Byte DeltaSwingTableIdx_2GA_N_8188E[DELTA_SWINGIDX_SIZE];
|
||||
|
||||
u1Byte BbSwingIdxOfdm[MAX_RF_PATH];
|
||||
u1Byte BbSwingIdxOfdmCurrent;
|
||||
#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE))
|
||||
u1Byte BbSwingIdxOfdmBase[MAX_RF_PATH];
|
||||
#else
|
||||
u1Byte BbSwingIdxOfdmBase;
|
||||
#endif
|
||||
BOOLEAN BbSwingFlagOfdm;
|
||||
u1Byte BbSwingIdxCck;
|
||||
u1Byte BbSwingIdxCckCurrent;
|
||||
u1Byte BbSwingIdxCckBase;
|
||||
u1Byte DefaultOfdmIndex;
|
||||
u1Byte DefaultCckIndex;
|
||||
BOOLEAN BbSwingFlagCck;
|
||||
|
||||
s1Byte Absolute_OFDMSwingIdx[MAX_RF_PATH];
|
||||
s1Byte Remnant_OFDMSwingIdx[MAX_RF_PATH];
|
||||
s1Byte Remnant_CCKSwingIdx;
|
||||
s1Byte Modify_TxAGC_Value; /*Remnat compensate value at TxAGC */
|
||||
BOOLEAN Modify_TxAGC_Flag_PathA;
|
||||
BOOLEAN Modify_TxAGC_Flag_PathB;
|
||||
BOOLEAN Modify_TxAGC_Flag_PathC;
|
||||
BOOLEAN Modify_TxAGC_Flag_PathD;
|
||||
BOOLEAN Modify_TxAGC_Flag_PathA_CCK;
|
||||
|
||||
s1Byte KfreeOffset[MAX_RF_PATH];
|
||||
|
||||
//--------------------------------------------------------------------//
|
||||
|
||||
//for IQK
|
||||
u4Byte RegC04;
|
||||
u4Byte Reg874;
|
||||
u4Byte RegC08;
|
||||
u4Byte RegB68;
|
||||
u4Byte RegB6C;
|
||||
u4Byte Reg870;
|
||||
u4Byte Reg860;
|
||||
u4Byte Reg864;
|
||||
|
||||
BOOLEAN bIQKInitialized;
|
||||
BOOLEAN bLCKInProgress;
|
||||
BOOLEAN bAntennaDetected;
|
||||
BOOLEAN bNeedIQK;
|
||||
BOOLEAN bIQKInProgress;
|
||||
u1Byte Delta_IQK;
|
||||
u4Byte ADDA_backup[IQK_ADDA_REG_NUM];
|
||||
u4Byte IQK_MAC_backup[IQK_MAC_REG_NUM];
|
||||
u4Byte IQK_BB_backup_recover[9];
|
||||
u4Byte IQK_BB_backup[IQK_BB_REG_NUM];
|
||||
u4Byte TxIQC_8723B[2][3][2]; /* { {S1: 0xc94, 0xc80, 0xc4c} , {S0: 0xc9c, 0xc88, 0xc4c}} */
|
||||
u4Byte RxIQC_8723B[2][2][2]; /* { {S1: 0xc14, 0xca0} , {S0: 0xc14, 0xca0}} */
|
||||
u4Byte TxIQC_8703B[3][2]; /* { {S1: 0xc94, 0xc80, 0xc4c} , {S0: 0xc9c, 0xc88, 0xc4c}}*/
|
||||
u4Byte RxIQC_8703B[2][2]; /* { {S1: 0xc14, 0xca0} , {S0: 0xc14, 0xca0}}*/
|
||||
|
||||
|
||||
|
||||
// <James> IQK time measurement
|
||||
u8Byte IQK_StartTime;
|
||||
u8Byte IQK_ProgressingTime;
|
||||
u4Byte LOK_Result;
|
||||
|
||||
//for APK
|
||||
u4Byte APKoutput[2][2]; //path A/B; output1_1a/output1_2a
|
||||
u1Byte bAPKdone;
|
||||
u1Byte bAPKThermalMeterIgnore;
|
||||
|
||||
// DPK
|
||||
BOOLEAN bDPKFail;
|
||||
u1Byte bDPdone;
|
||||
u1Byte bDPPathAOK;
|
||||
u1Byte bDPPathBOK;
|
||||
|
||||
u4Byte TxLOK[2];
|
||||
u4Byte DpkTxAGC;
|
||||
s4Byte DpkGain;
|
||||
u4Byte DpkThermal[4];
|
||||
|
||||
s1Byte Modify_TxAGC_Value_OFDM;
|
||||
s1Byte Modify_TxAGC_Value_CCK;
|
||||
}ODM_RF_CAL_T,*PODM_RF_CAL_T;
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
615
hal/phydm/phydm_pre_define.h
Normal file
615
hal/phydm/phydm_pre_define.h
Normal file
|
|
@ -0,0 +1,615 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
#ifndef __PHYDMPREDEFINE_H__
|
||||
#define __PHYDMPREDEFINE_H__
|
||||
|
||||
//1 ============================================================
|
||||
//1 Definition
|
||||
//1 ============================================================
|
||||
|
||||
//Max path of IC
|
||||
#define MAX_PATH_NUM_92CS 2
|
||||
#define MAX_PATH_NUM_8188E 1
|
||||
#define MAX_PATH_NUM_8192E 2
|
||||
#define MAX_PATH_NUM_8723B 1
|
||||
#define MAX_PATH_NUM_8812A 2
|
||||
#define MAX_PATH_NUM_8821A 1
|
||||
#define MAX_PATH_NUM_8814A 4
|
||||
#define MAX_PATH_NUM_8822B 2
|
||||
#define MAX_PATH_NUM_8821B 2
|
||||
#define MAX_PATH_NUM_8703B 1
|
||||
#define MAX_PATH_NUM_8188F 1
|
||||
|
||||
//Max RF path
|
||||
#define ODM_RF_PATH_MAX 2
|
||||
#define ODM_RF_PATH_MAX_JAGUAR 4
|
||||
|
||||
//number of entry
|
||||
#if(DM_ODM_SUPPORT_TYPE & (ODM_CE))
|
||||
#define ASSOCIATE_ENTRY_NUM MACID_NUM_SW_LIMIT /* Max size of AsocEntry[].*/
|
||||
#define ODM_ASSOCIATE_ENTRY_NUM ASSOCIATE_ENTRY_NUM
|
||||
#elif(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
|
||||
#define ASSOCIATE_ENTRY_NUM NUM_STAT
|
||||
#define ODM_ASSOCIATE_ENTRY_NUM (ASSOCIATE_ENTRY_NUM+1)
|
||||
#else
|
||||
#define ODM_ASSOCIATE_ENTRY_NUM ((ASSOCIATE_ENTRY_NUM*3)+1)
|
||||
#endif
|
||||
|
||||
/* -----MGN rate--------------------------------- */
|
||||
|
||||
#define ODM_MGN_1M 0x02
|
||||
#define ODM_MGN_2M 0x04
|
||||
#define ODM_MGN_5_5M 0x0b
|
||||
#define ODM_MGN_11M 0x16
|
||||
|
||||
#define ODM_MGN_6M 0x0c
|
||||
#define ODM_MGN_9M 0x12
|
||||
#define ODM_MGN_12M 0x18
|
||||
#define ODM_MGN_18M 0x24
|
||||
#define ODM_MGN_24M 0x30
|
||||
#define ODM_MGN_36M 0x48
|
||||
#define ODM_MGN_48M 0x60
|
||||
#define ODM_MGN_54M 0x6c
|
||||
|
||||
/*TxHT = 1*/
|
||||
#define ODM_MGN_MCS0 0x80
|
||||
#define ODM_MGN_MCS1 0x81
|
||||
#define ODM_MGN_MCS2 0x82
|
||||
#define ODM_MGN_MCS3 0x83
|
||||
#define ODM_MGN_MCS4 0x84
|
||||
#define ODM_MGN_MCS5 0x85
|
||||
#define ODM_MGN_MCS6 0x86
|
||||
#define ODM_MGN_MCS7 0x87
|
||||
#define ODM_MGN_MCS8 0x88
|
||||
#define ODM_MGN_MCS9 0x89
|
||||
#define ODM_MGN_MCS10 0x8a
|
||||
#define ODM_MGN_MCS11 0x8b
|
||||
#define ODM_MGN_MCS12 0x8c
|
||||
#define ODM_MGN_MCS13 0x8d
|
||||
#define ODM_MGN_MCS14 0x8e
|
||||
#define ODM_MGN_MCS15 0x8f
|
||||
#define ODM_MGN_VHT1SS_MCS0 0x90
|
||||
#define ODM_MGN_VHT1SS_MCS1 0x91
|
||||
#define ODM_MGN_VHT1SS_MCS2 0x92
|
||||
#define ODM_MGN_VHT1SS_MCS3 0x93
|
||||
#define ODM_MGN_VHT1SS_MCS4 0x94
|
||||
#define ODM_MGN_VHT1SS_MCS5 0x95
|
||||
#define ODM_MGN_VHT1SS_MCS6 0x96
|
||||
#define ODM_MGN_VHT1SS_MCS7 0x97
|
||||
#define ODM_MGN_VHT1SS_MCS8 0x98
|
||||
#define ODM_MGN_VHT1SS_MCS9 0x99
|
||||
#define ODM_MGN_VHT2SS_MCS0 0x9a
|
||||
#define ODM_MGN_VHT2SS_MCS1 0x9b
|
||||
#define ODM_MGN_VHT2SS_MCS2 0x9c
|
||||
#define ODM_MGN_VHT2SS_MCS3 0x9d
|
||||
#define ODM_MGN_VHT2SS_MCS4 0x9e
|
||||
#define ODM_MGN_VHT2SS_MCS5 0x9f
|
||||
#define ODM_MGN_VHT2SS_MCS6 0xa0
|
||||
#define ODM_MGN_VHT2SS_MCS7 0xa1
|
||||
#define ODM_MGN_VHT2SS_MCS8 0xa2
|
||||
#define ODM_MGN_VHT2SS_MCS9 0xa3
|
||||
|
||||
#define ODM_MGN_MCS0_SG 0xc0
|
||||
#define ODM_MGN_MCS1_SG 0xc1
|
||||
#define ODM_MGN_MCS2_SG 0xc2
|
||||
#define ODM_MGN_MCS3_SG 0xc3
|
||||
#define ODM_MGN_MCS4_SG 0xc4
|
||||
#define ODM_MGN_MCS5_SG 0xc5
|
||||
#define ODM_MGN_MCS6_SG 0xc6
|
||||
#define ODM_MGN_MCS7_SG 0xc7
|
||||
#define ODM_MGN_MCS8_SG 0xc8
|
||||
#define ODM_MGN_MCS9_SG 0xc9
|
||||
#define ODM_MGN_MCS10_SG 0xca
|
||||
#define ODM_MGN_MCS11_SG 0xcb
|
||||
#define ODM_MGN_MCS12_SG 0xcc
|
||||
#define ODM_MGN_MCS13_SG 0xcd
|
||||
#define ODM_MGN_MCS14_SG 0xce
|
||||
#define ODM_MGN_MCS15_SG 0xcf
|
||||
|
||||
/* -----DESC rate--------------------------------- */
|
||||
|
||||
#define ODM_RATEMCS15_SG 0x1c
|
||||
#define ODM_RATEMCS32 0x20
|
||||
|
||||
|
||||
// CCK Rates, TxHT = 0
|
||||
#define ODM_RATE1M 0x00
|
||||
#define ODM_RATE2M 0x01
|
||||
#define ODM_RATE5_5M 0x02
|
||||
#define ODM_RATE11M 0x03
|
||||
// OFDM Rates, TxHT = 0
|
||||
#define ODM_RATE6M 0x04
|
||||
#define ODM_RATE9M 0x05
|
||||
#define ODM_RATE12M 0x06
|
||||
#define ODM_RATE18M 0x07
|
||||
#define ODM_RATE24M 0x08
|
||||
#define ODM_RATE36M 0x09
|
||||
#define ODM_RATE48M 0x0A
|
||||
#define ODM_RATE54M 0x0B
|
||||
// MCS Rates, TxHT = 1
|
||||
#define ODM_RATEMCS0 0x0C
|
||||
#define ODM_RATEMCS1 0x0D
|
||||
#define ODM_RATEMCS2 0x0E
|
||||
#define ODM_RATEMCS3 0x0F
|
||||
#define ODM_RATEMCS4 0x10
|
||||
#define ODM_RATEMCS5 0x11
|
||||
#define ODM_RATEMCS6 0x12
|
||||
#define ODM_RATEMCS7 0x13
|
||||
#define ODM_RATEMCS8 0x14
|
||||
#define ODM_RATEMCS9 0x15
|
||||
#define ODM_RATEMCS10 0x16
|
||||
#define ODM_RATEMCS11 0x17
|
||||
#define ODM_RATEMCS12 0x18
|
||||
#define ODM_RATEMCS13 0x19
|
||||
#define ODM_RATEMCS14 0x1A
|
||||
#define ODM_RATEMCS15 0x1B
|
||||
#define ODM_RATEMCS16 0x1C
|
||||
#define ODM_RATEMCS17 0x1D
|
||||
#define ODM_RATEMCS18 0x1E
|
||||
#define ODM_RATEMCS19 0x1F
|
||||
#define ODM_RATEMCS20 0x20
|
||||
#define ODM_RATEMCS21 0x21
|
||||
#define ODM_RATEMCS22 0x22
|
||||
#define ODM_RATEMCS23 0x23
|
||||
#define ODM_RATEMCS24 0x24
|
||||
#define ODM_RATEMCS25 0x25
|
||||
#define ODM_RATEMCS26 0x26
|
||||
#define ODM_RATEMCS27 0x27
|
||||
#define ODM_RATEMCS28 0x28
|
||||
#define ODM_RATEMCS29 0x29
|
||||
#define ODM_RATEMCS30 0x2A
|
||||
#define ODM_RATEMCS31 0x2B
|
||||
#define ODM_RATEVHTSS1MCS0 0x2C
|
||||
#define ODM_RATEVHTSS1MCS1 0x2D
|
||||
#define ODM_RATEVHTSS1MCS2 0x2E
|
||||
#define ODM_RATEVHTSS1MCS3 0x2F
|
||||
#define ODM_RATEVHTSS1MCS4 0x30
|
||||
#define ODM_RATEVHTSS1MCS5 0x31
|
||||
#define ODM_RATEVHTSS1MCS6 0x32
|
||||
#define ODM_RATEVHTSS1MCS7 0x33
|
||||
#define ODM_RATEVHTSS1MCS8 0x34
|
||||
#define ODM_RATEVHTSS1MCS9 0x35
|
||||
#define ODM_RATEVHTSS2MCS0 0x36
|
||||
#define ODM_RATEVHTSS2MCS1 0x37
|
||||
#define ODM_RATEVHTSS2MCS2 0x38
|
||||
#define ODM_RATEVHTSS2MCS3 0x39
|
||||
#define ODM_RATEVHTSS2MCS4 0x3A
|
||||
#define ODM_RATEVHTSS2MCS5 0x3B
|
||||
#define ODM_RATEVHTSS2MCS6 0x3C
|
||||
#define ODM_RATEVHTSS2MCS7 0x3D
|
||||
#define ODM_RATEVHTSS2MCS8 0x3E
|
||||
#define ODM_RATEVHTSS2MCS9 0x3F
|
||||
#define ODM_RATEVHTSS3MCS0 0x40
|
||||
#define ODM_RATEVHTSS3MCS1 0x41
|
||||
#define ODM_RATEVHTSS3MCS2 0x42
|
||||
#define ODM_RATEVHTSS3MCS3 0x43
|
||||
#define ODM_RATEVHTSS3MCS4 0x44
|
||||
#define ODM_RATEVHTSS3MCS5 0x45
|
||||
#define ODM_RATEVHTSS3MCS6 0x46
|
||||
#define ODM_RATEVHTSS3MCS7 0x47
|
||||
#define ODM_RATEVHTSS3MCS8 0x48
|
||||
#define ODM_RATEVHTSS3MCS9 0x49
|
||||
#define ODM_RATEVHTSS4MCS0 0x4A
|
||||
#define ODM_RATEVHTSS4MCS1 0x4B
|
||||
#define ODM_RATEVHTSS4MCS2 0x4C
|
||||
#define ODM_RATEVHTSS4MCS3 0x4D
|
||||
#define ODM_RATEVHTSS4MCS4 0x4E
|
||||
#define ODM_RATEVHTSS4MCS5 0x4F
|
||||
#define ODM_RATEVHTSS4MCS6 0x50
|
||||
#define ODM_RATEVHTSS4MCS7 0x51
|
||||
#define ODM_RATEVHTSS4MCS8 0x52
|
||||
#define ODM_RATEVHTSS4MCS9 0x53
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
|
||||
#define ODM_NUM_RATE_IDX (ODM_RATEVHTSS4MCS9+1)
|
||||
#else
|
||||
#if (RTL8192E_SUPPORT == 1)
|
||||
#define ODM_NUM_RATE_IDX (ODM_RATEMCS15+1)
|
||||
#elif (RTL8723B_SUPPORT == 1) || (RTL8188E_SUPPORT == 1) || (RTL8188F_SUPPORT == 1)
|
||||
#define ODM_NUM_RATE_IDX (ODM_RATEMCS7+1)
|
||||
#elif (RTL8821A_SUPPORT == 1) || (RTL8881A_SUPPORT == 1)
|
||||
#define ODM_NUM_RATE_IDX (ODM_RATEVHTSS1MCS9+1)
|
||||
#elif (RTL8812A_SUPPORT == 1)
|
||||
#define ODM_NUM_RATE_IDX (ODM_RATEVHTSS2MCS9+1)
|
||||
#elif(RTL8814A_SUPPORT == 1)
|
||||
#define ODM_NUM_RATE_IDX (ODM_RATEVHTSS3MCS9+1)
|
||||
#else
|
||||
#define ODM_NUM_RATE_IDX (ODM_RATEVHTSS4MCS9+1)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
|
||||
#define CONFIG_SFW_SUPPORTED
|
||||
#endif
|
||||
|
||||
//1 ============================================================
|
||||
//1 enumeration
|
||||
//1 ============================================================
|
||||
|
||||
|
||||
// ODM_CMNINFO_INTERFACE
|
||||
typedef enum tag_ODM_Support_Interface_Definition
|
||||
{
|
||||
ODM_ITRF_PCIE = 0x1,
|
||||
ODM_ITRF_USB = 0x2,
|
||||
ODM_ITRF_SDIO = 0x4,
|
||||
ODM_ITRF_ALL = 0x7,
|
||||
}ODM_INTERFACE_E;
|
||||
|
||||
// ODM_CMNINFO_IC_TYPE
|
||||
typedef enum tag_ODM_Support_IC_Type_Definition
|
||||
{
|
||||
ODM_RTL8192S = BIT0,
|
||||
ODM_RTL8192C = BIT1,
|
||||
ODM_RTL8192D = BIT2,
|
||||
ODM_RTL8723A = BIT3,
|
||||
ODM_RTL8188E = BIT4,
|
||||
ODM_RTL8812 = BIT5,
|
||||
ODM_RTL8821 = BIT6,
|
||||
ODM_RTL8192E = BIT7,
|
||||
ODM_RTL8723B = BIT8,
|
||||
ODM_RTL8814A = BIT9,
|
||||
ODM_RTL8881A = BIT10,
|
||||
ODM_RTL8821B = BIT11,
|
||||
ODM_RTL8822B = BIT12,
|
||||
ODM_RTL8703B = BIT13,
|
||||
ODM_RTL8195A = BIT14,
|
||||
ODM_RTL8188F = BIT15
|
||||
}ODM_IC_TYPE_E;
|
||||
|
||||
|
||||
|
||||
|
||||
#define ODM_IC_11N_SERIES (ODM_RTL8192S|ODM_RTL8192C|ODM_RTL8192D|ODM_RTL8723A|ODM_RTL8188E|ODM_RTL8192E|ODM_RTL8723B|ODM_RTL8703B|ODM_RTL8188F)
|
||||
#define ODM_IC_11AC_SERIES (ODM_RTL8812|ODM_RTL8821|ODM_RTL8814A|ODM_RTL8881A|ODM_RTL8821B|ODM_RTL8822B)
|
||||
#define ODM_IC_TXBF_SUPPORT (ODM_RTL8192E|ODM_RTL8812|ODM_RTL8821|ODM_RTL8814A|ODM_RTL8881A|ODM_RTL8822B)
|
||||
#define ODM_IC_11N_GAIN_IDX_EDCCA (ODM_RTL8195A|ODM_RTL8703B|ODM_RTL8188F)
|
||||
#define ODM_IC_11AC_GAIN_IDX_EDCCA (ODM_RTL8814A|ODM_RTL8822B)
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_AP)
|
||||
|
||||
#ifdef RTK_AC_SUPPORT
|
||||
#define ODM_IC_11AC_SERIES_SUPPORT 1
|
||||
#else
|
||||
#define ODM_IC_11AC_SERIES_SUPPORT 0
|
||||
#endif
|
||||
|
||||
#define ODM_IC_11N_SERIES_SUPPORT 1
|
||||
#define ODM_CONFIG_BT_COEXIST 0
|
||||
|
||||
#elif (DM_ODM_SUPPORT_TYPE == ODM_WIN)
|
||||
|
||||
#define ODM_IC_11AC_SERIES_SUPPORT 1
|
||||
#define ODM_IC_11N_SERIES_SUPPORT 1
|
||||
#define ODM_CONFIG_BT_COEXIST 1
|
||||
|
||||
#else
|
||||
|
||||
#if((RTL8192C_SUPPORT == 1) || (RTL8192D_SUPPORT == 1) || (RTL8723A_SUPPORT == 1) || (RTL8188E_SUPPORT == 1) ||\
|
||||
(RTL8723B_SUPPORT == 1) || (RTL8192E_SUPPORT == 1) || (RTL8195A_SUPPORT == 1) || (RTL8703B_SUPPORT == 1) || \
|
||||
(RTL8188F_SUPPORT == 1))
|
||||
#define ODM_IC_11N_SERIES_SUPPORT 1
|
||||
#define ODM_IC_11AC_SERIES_SUPPORT 0
|
||||
#else
|
||||
#define ODM_IC_11N_SERIES_SUPPORT 0
|
||||
#define ODM_IC_11AC_SERIES_SUPPORT 1
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BT_COEXIST
|
||||
#define ODM_CONFIG_BT_COEXIST 1
|
||||
#else
|
||||
#define ODM_CONFIG_BT_COEXIST 0
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
//ODM_CMNINFO_CUT_VER
|
||||
typedef enum tag_ODM_Cut_Version_Definition
|
||||
{
|
||||
ODM_CUT_A = 0,
|
||||
ODM_CUT_B = 1,
|
||||
ODM_CUT_C = 2,
|
||||
ODM_CUT_D = 3,
|
||||
ODM_CUT_E = 4,
|
||||
ODM_CUT_F = 5,
|
||||
|
||||
ODM_CUT_I = 8,
|
||||
ODM_CUT_J = 9,
|
||||
ODM_CUT_K = 10,
|
||||
ODM_CUT_TEST = 15,
|
||||
}ODM_CUT_VERSION_E;
|
||||
|
||||
// ODM_CMNINFO_FAB_VER
|
||||
typedef enum tag_ODM_Fab_Version_Definition
|
||||
{
|
||||
ODM_TSMC = 0,
|
||||
ODM_UMC = 1,
|
||||
}ODM_FAB_E;
|
||||
|
||||
// ODM_CMNINFO_RF_TYPE
|
||||
//
|
||||
// For example 1T2R (A+AB = BIT0|BIT4|BIT5)
|
||||
//
|
||||
typedef enum tag_ODM_RF_Path_Bit_Definition
|
||||
{
|
||||
ODM_RF_A = BIT0,
|
||||
ODM_RF_B = BIT1,
|
||||
ODM_RF_C = BIT2,
|
||||
ODM_RF_D = BIT3,
|
||||
}ODM_RF_PATH_E;
|
||||
|
||||
typedef enum tag_PHYDM_RF_TX_NUM {
|
||||
ODM_1T = 1,
|
||||
ODM_2T = 2,
|
||||
ODM_3T = 3,
|
||||
ODM_4T = 4,
|
||||
} ODM_RF_TX_NUM_E;
|
||||
|
||||
typedef enum tag_ODM_RF_Type_Definition {
|
||||
ODM_1T1R,
|
||||
ODM_1T2R,
|
||||
ODM_2T2R,
|
||||
ODM_2T2R_GREEN,
|
||||
ODM_2T3R,
|
||||
ODM_2T4R,
|
||||
ODM_3T3R,
|
||||
ODM_3T4R,
|
||||
ODM_4T4R,
|
||||
ODM_XTXR
|
||||
}ODM_RF_TYPE_E;
|
||||
|
||||
|
||||
typedef enum tag_ODM_MAC_PHY_Mode_Definition
|
||||
{
|
||||
ODM_SMSP = 0,
|
||||
ODM_DMSP = 1,
|
||||
ODM_DMDP = 2,
|
||||
}ODM_MAC_PHY_MODE_E;
|
||||
|
||||
|
||||
typedef enum tag_BT_Coexist_Definition
|
||||
{
|
||||
ODM_BT_BUSY = 1,
|
||||
ODM_BT_ON = 2,
|
||||
ODM_BT_OFF = 3,
|
||||
ODM_BT_NONE = 4,
|
||||
}ODM_BT_COEXIST_E;
|
||||
|
||||
// ODM_CMNINFO_OP_MODE
|
||||
typedef enum tag_Operation_Mode_Definition
|
||||
{
|
||||
ODM_NO_LINK = BIT0,
|
||||
ODM_LINK = BIT1,
|
||||
ODM_SCAN = BIT2,
|
||||
ODM_POWERSAVE = BIT3,
|
||||
ODM_AP_MODE = BIT4,
|
||||
ODM_CLIENT_MODE = BIT5,
|
||||
ODM_AD_HOC = BIT6,
|
||||
ODM_WIFI_DIRECT = BIT7,
|
||||
ODM_WIFI_DISPLAY = BIT8,
|
||||
}ODM_OPERATION_MODE_E;
|
||||
|
||||
// ODM_CMNINFO_WM_MODE
|
||||
#if (DM_ODM_SUPPORT_TYPE & (ODM_CE))
|
||||
typedef enum tag_Wireless_Mode_Definition
|
||||
{
|
||||
ODM_WM_UNKNOW = 0x0,
|
||||
ODM_WM_B = BIT0,
|
||||
ODM_WM_G = BIT1,
|
||||
ODM_WM_A = BIT2,
|
||||
ODM_WM_N24G = BIT3,
|
||||
ODM_WM_N5G = BIT4,
|
||||
ODM_WM_AUTO = BIT5,
|
||||
ODM_WM_AC = BIT6,
|
||||
}ODM_WIRELESS_MODE_E;
|
||||
#else
|
||||
typedef enum tag_Wireless_Mode_Definition
|
||||
{
|
||||
ODM_WM_UNKNOWN = 0x00,/*0x0*/
|
||||
ODM_WM_A = BIT0, /* 0x1*/
|
||||
ODM_WM_B = BIT1, /* 0x2*/
|
||||
ODM_WM_G = BIT2,/* 0x4*/
|
||||
ODM_WM_AUTO = BIT3,/* 0x8*/
|
||||
ODM_WM_N24G = BIT4,/* 0x10*/
|
||||
ODM_WM_N5G = BIT5,/* 0x20*/
|
||||
ODM_WM_AC_5G = BIT6,/* 0x40*/
|
||||
ODM_WM_AC_24G = BIT7,/* 0x80*/
|
||||
ODM_WM_AC_ONLY = BIT8,/* 0x100*/
|
||||
ODM_WM_MAX = BIT11/* 0x800*/
|
||||
|
||||
}ODM_WIRELESS_MODE_E;
|
||||
#endif
|
||||
|
||||
// ODM_CMNINFO_BAND
|
||||
typedef enum tag_Band_Type_Definition
|
||||
{
|
||||
#if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
|
||||
ODM_BAND_2_4G = BIT0,
|
||||
ODM_BAND_5G = BIT1,
|
||||
#else
|
||||
ODM_BAND_2_4G = 0,
|
||||
ODM_BAND_5G,
|
||||
ODM_BAND_ON_BOTH,
|
||||
ODM_BANDMAX
|
||||
#endif
|
||||
}ODM_BAND_TYPE_E;
|
||||
|
||||
|
||||
// ODM_CMNINFO_SEC_CHNL_OFFSET
|
||||
typedef enum tag_Secondary_Channel_Offset_Definition
|
||||
{
|
||||
ODM_DONT_CARE = 0,
|
||||
ODM_BELOW = 1,
|
||||
ODM_ABOVE = 2
|
||||
}ODM_SEC_CHNL_OFFSET_E;
|
||||
|
||||
// ODM_CMNINFO_SEC_MODE
|
||||
typedef enum tag_Security_Definition
|
||||
{
|
||||
ODM_SEC_OPEN = 0,
|
||||
ODM_SEC_WEP40 = 1,
|
||||
ODM_SEC_TKIP = 2,
|
||||
ODM_SEC_RESERVE = 3,
|
||||
ODM_SEC_AESCCMP = 4,
|
||||
ODM_SEC_WEP104 = 5,
|
||||
ODM_WEP_WPA_MIXED = 6, // WEP + WPA
|
||||
ODM_SEC_SMS4 = 7,
|
||||
}ODM_SECURITY_E;
|
||||
|
||||
// ODM_CMNINFO_BW
|
||||
typedef enum tag_Bandwidth_Definition
|
||||
{
|
||||
ODM_BW20M = 0,
|
||||
ODM_BW40M = 1,
|
||||
ODM_BW80M = 2,
|
||||
ODM_BW160M = 3,
|
||||
ODM_BW5M = 4,
|
||||
ODM_BW10M = 5,
|
||||
ODM_BW_MAX = 6
|
||||
}ODM_BW_E;
|
||||
|
||||
// ODM_CMNINFO_CHNL
|
||||
|
||||
// ODM_CMNINFO_BOARD_TYPE
|
||||
typedef enum tag_Board_Definition
|
||||
{
|
||||
ODM_BOARD_DEFAULT = 0, // The DEFAULT case.
|
||||
ODM_BOARD_MINICARD = BIT(0), // 0 = non-mini card, 1= mini card.
|
||||
ODM_BOARD_SLIM = BIT(1), // 0 = non-slim card, 1 = slim card
|
||||
ODM_BOARD_BT = BIT(2), // 0 = without BT card, 1 = with BT
|
||||
ODM_BOARD_EXT_PA = BIT(3), // 0 = no 2G ext-PA, 1 = existing 2G ext-PA
|
||||
ODM_BOARD_EXT_LNA = BIT(4), // 0 = no 2G ext-LNA, 1 = existing 2G ext-LNA
|
||||
ODM_BOARD_EXT_TRSW = BIT(5), // 0 = no ext-TRSW, 1 = existing ext-TRSW
|
||||
ODM_BOARD_EXT_PA_5G = BIT(6), // 0 = no 5G ext-PA, 1 = existing 5G ext-PA
|
||||
ODM_BOARD_EXT_LNA_5G= BIT(7), // 0 = no 5G ext-LNA, 1 = existing 5G ext-LNA
|
||||
}ODM_BOARD_TYPE_E;
|
||||
|
||||
typedef enum tag_ODM_Package_Definition
|
||||
{
|
||||
ODM_PACKAGE_DEFAULT = 0,
|
||||
ODM_PACKAGE_QFN68 = BIT(0),
|
||||
ODM_PACKAGE_TFBGA90 = BIT(1),
|
||||
ODM_PACKAGE_TFBGA79 = BIT(2),
|
||||
}ODM_Package_TYPE_E;
|
||||
|
||||
typedef enum tag_ODM_TYPE_GPA_Definition {
|
||||
TYPE_GPA0 = 0x0000,
|
||||
TYPE_GPA1 = 0x0055,
|
||||
TYPE_GPA2 = 0x00AA,
|
||||
TYPE_GPA3 = 0x00FF,
|
||||
TYPE_GPA4 = 0x5500,
|
||||
TYPE_GPA5 = 0x5555,
|
||||
TYPE_GPA6 = 0x55AA,
|
||||
TYPE_GPA7 = 0x55FF,
|
||||
TYPE_GPA8 = 0xAA00,
|
||||
TYPE_GPA9 = 0xAA55,
|
||||
TYPE_GPA10 = 0xAAAA,
|
||||
TYPE_GPA11 = 0xAAFF,
|
||||
TYPE_GPA12 = 0xFF00,
|
||||
TYPE_GPA13 = 0xFF55,
|
||||
TYPE_GPA14 = 0xFFAA,
|
||||
TYPE_GPA15 = 0xFFFF,
|
||||
}ODM_TYPE_GPA_E;
|
||||
|
||||
typedef enum tag_ODM_TYPE_APA_Definition {
|
||||
TYPE_APA0 = 0x0000,
|
||||
TYPE_APA1 = 0x0055,
|
||||
TYPE_APA2 = 0x00AA,
|
||||
TYPE_APA3 = 0x00FF,
|
||||
TYPE_APA4 = 0x5500,
|
||||
TYPE_APA5 = 0x5555,
|
||||
TYPE_APA6 = 0x55AA,
|
||||
TYPE_APA7 = 0x55FF,
|
||||
TYPE_APA8 = 0xAA00,
|
||||
TYPE_APA9 = 0xAA55,
|
||||
TYPE_APA10 = 0xAAAA,
|
||||
TYPE_APA11 = 0xAAFF,
|
||||
TYPE_APA12 = 0xFF00,
|
||||
TYPE_APA13 = 0xFF55,
|
||||
TYPE_APA14 = 0xFFAA,
|
||||
TYPE_APA15 = 0xFFFF,
|
||||
}ODM_TYPE_APA_E;
|
||||
|
||||
typedef enum tag_ODM_TYPE_GLNA_Definition {
|
||||
TYPE_GLNA0 = 0x0000,
|
||||
TYPE_GLNA1 = 0x0055,
|
||||
TYPE_GLNA2 = 0x00AA,
|
||||
TYPE_GLNA3 = 0x00FF,
|
||||
TYPE_GLNA4 = 0x5500,
|
||||
TYPE_GLNA5 = 0x5555,
|
||||
TYPE_GLNA6 = 0x55AA,
|
||||
TYPE_GLNA7 = 0x55FF,
|
||||
TYPE_GLNA8 = 0xAA00,
|
||||
TYPE_GLNA9 = 0xAA55,
|
||||
TYPE_GLNA10 = 0xAAAA,
|
||||
TYPE_GLNA11 = 0xAAFF,
|
||||
TYPE_GLNA12 = 0xFF00,
|
||||
TYPE_GLNA13 = 0xFF55,
|
||||
TYPE_GLNA14 = 0xFFAA,
|
||||
TYPE_GLNA15 = 0xFFFF,
|
||||
}ODM_TYPE_GLNA_E;
|
||||
|
||||
typedef enum tag_ODM_TYPE_ALNA_Definition {
|
||||
TYPE_ALNA0 = 0x0000,
|
||||
TYPE_ALNA1 = 0x0055,
|
||||
TYPE_ALNA2 = 0x00AA,
|
||||
TYPE_ALNA3 = 0x00FF,
|
||||
TYPE_ALNA4 = 0x5500,
|
||||
TYPE_ALNA5 = 0x5555,
|
||||
TYPE_ALNA6 = 0x55AA,
|
||||
TYPE_ALNA7 = 0x55FF,
|
||||
TYPE_ALNA8 = 0xAA00,
|
||||
TYPE_ALNA9 = 0xAA55,
|
||||
TYPE_ALNA10 = 0xAAAA,
|
||||
TYPE_ALNA11 = 0xAAFF,
|
||||
TYPE_ALNA12 = 0xFF00,
|
||||
TYPE_ALNA13 = 0xFF55,
|
||||
TYPE_ALNA14 = 0xFFAA,
|
||||
TYPE_ALNA15 = 0xFFFF,
|
||||
}ODM_TYPE_ALNA_E;
|
||||
|
||||
|
||||
typedef enum _ODM_RF_RADIO_PATH {
|
||||
ODM_RF_PATH_A = 0, //Radio Path A
|
||||
ODM_RF_PATH_B = 1, //Radio Path B
|
||||
ODM_RF_PATH_C = 2, //Radio Path C
|
||||
ODM_RF_PATH_D = 3, //Radio Path D
|
||||
ODM_RF_PATH_AB,
|
||||
ODM_RF_PATH_AC,
|
||||
ODM_RF_PATH_AD,
|
||||
ODM_RF_PATH_BC,
|
||||
ODM_RF_PATH_BD,
|
||||
ODM_RF_PATH_CD,
|
||||
ODM_RF_PATH_ABC,
|
||||
ODM_RF_PATH_ACD,
|
||||
ODM_RF_PATH_BCD,
|
||||
ODM_RF_PATH_ABCD,
|
||||
// ODM_RF_PATH_MAX, //Max RF number 90 support
|
||||
} ODM_RF_RADIO_PATH_E, *PODM_RF_RADIO_PATH_E;
|
||||
|
||||
typedef enum _ODM_PARAMETER_INIT {
|
||||
ODM_PRE_SETTING = 0,
|
||||
ODM_POST_SETTING = 1,
|
||||
} ODM_PARAMETER_INIT_E;
|
||||
|
||||
#endif
|
||||
320
hal/phydm/phydm_precomp.h
Normal file
320
hal/phydm/phydm_precomp.h
Normal file
|
|
@ -0,0 +1,320 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __ODM_PRECOMP_H__
|
||||
#define __ODM_PRECOMP_H__
|
||||
|
||||
#include "phydm_types.h"
|
||||
#include "phydm_features.h"
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
|
||||
#include "Precomp.h" // We need to include mp_precomp.h due to batch file setting.
|
||||
#else
|
||||
#define TEST_FALG___ 1
|
||||
#endif
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE ==ODM_CE)
|
||||
#define RTL8192CE_SUPPORT 0
|
||||
#define RTL8192CU_SUPPORT 0
|
||||
#define RTL8192C_SUPPORT 0
|
||||
|
||||
#define RTL8192DE_SUPPORT 0
|
||||
#define RTL8192DU_SUPPORT 0
|
||||
#define RTL8192D_SUPPORT 0
|
||||
|
||||
#define RTL8723AU_SUPPORT 0
|
||||
#define RTL8723AS_SUPPORT 0
|
||||
#define RTL8723AE_SUPPORT 0
|
||||
#define RTL8723A_SUPPORT 0
|
||||
#define RTL8723_FPGA_VERIFICATION 0
|
||||
#endif
|
||||
|
||||
//2 Config Flags and Structs - defined by each ODM Type
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_AP)
|
||||
#include "../8192cd_cfg.h"
|
||||
#include "../odm_inc.h"
|
||||
|
||||
#include "../8192cd.h"
|
||||
#include "../8192cd_util.h"
|
||||
#ifdef _BIG_ENDIAN_
|
||||
#define ODM_ENDIAN_TYPE ODM_ENDIAN_BIG
|
||||
#else
|
||||
#define ODM_ENDIAN_TYPE ODM_ENDIAN_LITTLE
|
||||
#endif
|
||||
|
||||
#ifdef AP_BUILD_WORKAROUND
|
||||
#include "../8192cd_headers.h"
|
||||
#include "../8192cd_debug.h"
|
||||
#endif
|
||||
|
||||
#elif (DM_ODM_SUPPORT_TYPE ==ODM_CE)
|
||||
#define __PACK
|
||||
#define __WLAN_ATTRIB_PACK__
|
||||
#elif (DM_ODM_SUPPORT_TYPE == ODM_WIN)
|
||||
#include "mp_precomp.h"
|
||||
#define ODM_ENDIAN_TYPE ODM_ENDIAN_LITTLE
|
||||
#define __PACK
|
||||
#define __WLAN_ATTRIB_PACK__
|
||||
#endif
|
||||
|
||||
//2 OutSrc Header Files
|
||||
|
||||
#include "phydm.h"
|
||||
#include "phydm_hwconfig.h"
|
||||
#include "phydm_debug.h"
|
||||
#include "phydm_regdefine11ac.h"
|
||||
#include "phydm_regdefine11n.h"
|
||||
#include "phydm_interface.h"
|
||||
#include "phydm_reg.h"
|
||||
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE & ODM_CE)
|
||||
#define RTL8821B_SUPPORT 0
|
||||
#define RTL8822B_SUPPORT 0
|
||||
|
||||
VOID
|
||||
PHY_SetTxPowerLimit(
|
||||
IN PDM_ODM_T pDM_Odm,
|
||||
IN u8 *Regulation,
|
||||
IN u8 *Band,
|
||||
IN u8 *Bandwidth,
|
||||
IN u8 *RateSection,
|
||||
IN u8 *RfPath,
|
||||
IN u8 *Channel,
|
||||
IN u8 *PowerLimit
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
|
||||
#define RTL8821B_SUPPORT 0
|
||||
#define RTL8822B_SUPPORT 0
|
||||
#define RTL8703B_SUPPORT 0
|
||||
#define RTL8188F_SUPPORT 0
|
||||
#endif
|
||||
|
||||
#if RTL8188E_SUPPORT == 1
|
||||
#define RTL8188E_T_SUPPORT 1
|
||||
#ifdef CONFIG_SFW_SUPPORTED
|
||||
#define RTL8188E_S_SUPPORT 1
|
||||
#else
|
||||
#define RTL8188E_S_SUPPORT 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if (RTL8188E_SUPPORT==1)
|
||||
#include "rtl8188e/hal8188erateadaptive.h"//for RA,Power training
|
||||
#include "rtl8188e/halhwimg8188e_mac.h"
|
||||
#include "rtl8188e/halhwimg8188e_rf.h"
|
||||
#include "rtl8188e/halhwimg8188e_bb.h"
|
||||
#include "rtl8188e/halhwimg8188e_t_fw.h"
|
||||
#include "rtl8188e/halhwimg8188e_s_fw.h"
|
||||
#include "rtl8188e/phydm_regconfig8188e.h"
|
||||
#include "rtl8188e/phydm_rtl8188e.h"
|
||||
#include "rtl8188e/hal8188ereg.h"
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_CE)
|
||||
#include "rtl8188e_hal.h"
|
||||
#include "rtl8188e/halphyrf_8188e_ce.h"
|
||||
#endif
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
|
||||
#include "rtl8188e/halphyrf_8188e_win.h"
|
||||
#endif
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_AP)
|
||||
#include "rtl8188e/halphyrf_8188e_ap.h"
|
||||
#endif
|
||||
#endif //88E END
|
||||
|
||||
#if (RTL8192E_SUPPORT==1)
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
|
||||
#include "rtl8192e/halphyrf_8192e_win.h" /*FOR_8192E_IQK*/
|
||||
#elif (DM_ODM_SUPPORT_TYPE == ODM_AP)
|
||||
#include "rtl8192e/halphyrf_8192e_ap.h" /*FOR_8192E_IQK*/
|
||||
#elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
|
||||
#include "rtl8192e/halphyrf_8192e_ce.h" /*FOR_8192E_IQK*/
|
||||
#endif
|
||||
|
||||
#include "rtl8192e/phydm_rtl8192e.h" //FOR_8192E_IQK
|
||||
#if (DM_ODM_SUPPORT_TYPE != ODM_AP)
|
||||
#include "rtl8192e/halhwimg8192e_bb.h"
|
||||
#include "rtl8192e/halhwimg8192e_mac.h"
|
||||
#include "rtl8192e/halhwimg8192e_rf.h"
|
||||
#include "rtl8192e/phydm_regconfig8192e.h"
|
||||
#include "rtl8192e/halhwimg8192e_fw.h"
|
||||
#include "rtl8192e/hal8192ereg.h"
|
||||
#endif
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_CE)
|
||||
#include "rtl8192e_hal.h"
|
||||
#endif
|
||||
#endif //92E END
|
||||
|
||||
#if (RTL8812A_SUPPORT==1)
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
|
||||
#include "rtl8812a/halphyrf_8812a_win.h"
|
||||
#elif (DM_ODM_SUPPORT_TYPE == ODM_AP)
|
||||
#include "rtl8812a/halphyrf_8812a_ap.h"
|
||||
#elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
|
||||
#include "rtl8812a/halphyrf_8812a_ce.h"
|
||||
#endif
|
||||
|
||||
//#include "rtl8812a/HalPhyRf_8812A.h" //FOR_8812_IQK
|
||||
#if (DM_ODM_SUPPORT_TYPE != ODM_AP)
|
||||
#include "rtl8812a/halhwimg8812a_bb.h"
|
||||
#include "rtl8812a/halhwimg8812a_mac.h"
|
||||
#include "rtl8812a/halhwimg8812a_rf.h"
|
||||
#include "rtl8812a/phydm_regconfig8812a.h"
|
||||
#include "rtl8812a/halhwimg8812a_fw.h"
|
||||
#include "rtl8812a/phydm_rtl8812a.h"
|
||||
#endif
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_CE)
|
||||
#include "rtl8812a_hal.h"
|
||||
#endif
|
||||
|
||||
#endif //8812 END
|
||||
|
||||
#if (RTL8814A_SUPPORT==1)
|
||||
|
||||
#include "rtl8814a/halhwimg8814a_mac.h"
|
||||
#include "rtl8814a/halhwimg8814a_rf.h"
|
||||
#include "rtl8814a/halhwimg8814a_bb.h"
|
||||
#if (DM_ODM_SUPPORT_TYPE != ODM_AP)
|
||||
#include "rtl8814a/halhwimg8814a_fw.h"
|
||||
#include "rtl8814a/phydm_rtl8814a.h"
|
||||
#endif
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
|
||||
#include "rtl8814a/halphyrf_8814a_win.h"
|
||||
#elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
|
||||
#include "rtl8814a/halphyrf_8814a_ce.h"
|
||||
#elif (DM_ODM_SUPPORT_TYPE == ODM_AP)
|
||||
#include "rtl8814a/halphyrf_8814a_ap.h"
|
||||
#endif
|
||||
#include "rtl8814a/phydm_regconfig8814a.h"
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_CE)
|
||||
#include "rtl8814a_hal.h"
|
||||
#include "rtl8814a/phydm_iqk_8814a.h"
|
||||
#endif
|
||||
#endif //8814 END
|
||||
|
||||
#if (RTL8881A_SUPPORT==1)//FOR_8881_IQK
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
|
||||
#include "rtl8821a/phydm_iqk_8821a_win.h"
|
||||
#elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
|
||||
#include "rtl8821a/phydm_iqk_8821a_ce.h"
|
||||
#else
|
||||
#include "rtl8821a/phydm_iqk_8821a_ap.h"
|
||||
#endif
|
||||
//#include "rtl8881a/HalHWImg8881A_BB.h"
|
||||
//#include "rtl8881a/HalHWImg8881A_MAC.h"
|
||||
//#include "rtl8881a/HalHWImg8881A_RF.h"
|
||||
//#include "rtl8881a/odm_RegConfig8881A.h"
|
||||
#endif
|
||||
|
||||
#if (RTL8723B_SUPPORT==1)
|
||||
#include "rtl8723b/halhwimg8723b_mac.h"
|
||||
#include "rtl8723b/halhwimg8723b_rf.h"
|
||||
#include "rtl8723b/halhwimg8723b_bb.h"
|
||||
#include "rtl8723b/halhwimg8723b_fw.h"
|
||||
#include "rtl8723b/phydm_regconfig8723b.h"
|
||||
#include "rtl8723b/phydm_rtl8723b.h"
|
||||
#include "rtl8723b/hal8723breg.h"
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
|
||||
#include "rtl8723b/halphyrf_8723b_win.h"
|
||||
#elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
|
||||
#include "rtl8723b/halphyrf_8723b_ce.h"
|
||||
#include "rtl8723b/halhwimg8723b_mp.h"
|
||||
#include "rtl8723b_hal.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if (RTL8821A_SUPPORT==1)
|
||||
#include "rtl8821a/halhwimg8821a_mac.h"
|
||||
#include "rtl8821a/halhwimg8821a_rf.h"
|
||||
#include "rtl8821a/halhwimg8821a_bb.h"
|
||||
#include "rtl8821a/halhwimg8821a_fw.h"
|
||||
#include "rtl8821a/phydm_regconfig8821a.h"
|
||||
#include "rtl8821a/phydm_rtl8821a.h"
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
|
||||
#include "rtl8821a/halphyrf_8821a_win.h"
|
||||
#elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
|
||||
#include "rtl8821a/halphyrf_8821a_ce.h"
|
||||
#include "rtl8821a/phydm_iqk_8821a_ce.h"/*for IQK*/
|
||||
#include "rtl8812a/halphyrf_8812a_ce.h"/*for IQK,LCK,Power-tracking*/
|
||||
#include "rtl8812a_hal.h"
|
||||
#else
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if (RTL8821B_SUPPORT==1)
|
||||
#include "rtl8821b/halhwimg8821b_mac.h"
|
||||
#include "rtl8821b/halhwimg8821b_rf.h"
|
||||
#include "rtl8821b/halhwimg8821b_bb.h"
|
||||
#include "rtl8821b/halhwimg8821b_fw.h"
|
||||
#include "rtl8821b/phydm_regconfig8821b.h"
|
||||
#include "rtl8821b/halhwimg8821b_testchip_mac.h"
|
||||
#include "rtl8821b/halhwimg8821b_testchip_rf.h"
|
||||
#include "rtl8821b/halhwimg8821b_testchip_bb.h"
|
||||
#include "rtl8821b/halhwimg8821b_testchip_fw.h"
|
||||
#include "rtl8821b/halphyrf_8821b.h"
|
||||
#endif
|
||||
|
||||
#if (RTL8822B_SUPPORT==1)
|
||||
#include "rtl8822b/halhwimg8822b_mac.h"
|
||||
#include "rtl8822b/halhwimg8822b_rf.h"
|
||||
#include "rtl8822b/halhwimg8822b_bb.h"
|
||||
/*#include "rtl8822b/halhwimg8822b_fw.h"*/
|
||||
#include "rtl8822b/phydm_regconfig8822b.h"
|
||||
#include "rtl8822b/halphyrf_8822b.h"
|
||||
#include "rtl8822b/phydm_rtl8822b.h"
|
||||
#include "rtl8822b/phydm_hal_api8822b.h"
|
||||
#include "rtl8822b/version_rtl8822b.h"
|
||||
#endif
|
||||
|
||||
#if (RTL8703B_SUPPORT==1)
|
||||
#include "rtl8703b/phydm_regconfig8703b.h"
|
||||
#include "rtl8703b/halhwimg8703b_mac.h"
|
||||
#include "rtl8703b/halhwimg8703b_rf.h"
|
||||
#include "rtl8703b/halhwimg8703b_bb.h"
|
||||
#include "rtl8703b/halhwimg8703b_fw.h"
|
||||
#include "rtl8703b/halphyrf_8703b.h"
|
||||
#include "rtl8703b/version_rtl8703b.h"
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_CE)
|
||||
#include "rtl8703b_hal.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if (RTL8188F_SUPPORT == 1)
|
||||
#include "rtl8188f/halhwimg8188f_mac.h"
|
||||
#include "rtl8188f/halhwimg8188f_rf.h"
|
||||
#include "rtl8188f/halhwimg8188f_bb.h"
|
||||
#include "rtl8188f/halhwimg8188f_fw.h"
|
||||
#include "rtl8188f/hal8188freg.h"
|
||||
#include "rtl8188f/phydm_rtl8188f.h"
|
||||
#include "rtl8188f/phydm_regconfig8188f.h"
|
||||
#include "rtl8188f/halphyrf_8188f.h" /* for IQK,LCK,Power-tracking */
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_CE)
|
||||
#include "rtl8188f_hal.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif // __ODM_PRECOMP_H__
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue