mirror of
https://github.com/lwfinger/rtl8188eu.git
synced 2025-05-08 14:33:05 +00:00
rtl8188EUS: Initial addition of files in branch v5.2.2.4
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
This commit is contained in:
parent
77471b4361
commit
6fa9ed423c
541 changed files with 393757 additions and 85553 deletions
File diff suppressed because it is too large
Load diff
|
@ -1,106 +0,0 @@
|
|||
#ifndef __INC_RA_H
|
||||
#define __INC_RA_H
|
||||
/*++
|
||||
Copyright (c) Realtek Semiconductor Corp. All rights reserved.
|
||||
|
||||
Module Name:
|
||||
RateAdaptive.h
|
||||
|
||||
Abstract:
|
||||
Prototype of RA and related data structure.
|
||||
|
||||
Major Change History:
|
||||
When Who What
|
||||
---------- --------------- -------------------------------
|
||||
2011-08-12 Page Create.
|
||||
--*/
|
||||
|
||||
/* Rate adaptive define */
|
||||
#define PERENTRY 23
|
||||
#define RETRYSIZE 5
|
||||
#define RATESIZE 28
|
||||
#define TX_RPT2_ITEM_SIZE 8
|
||||
|
||||
/* */
|
||||
/* TX report 2 format in Rx desc */
|
||||
/* */
|
||||
#define GET_TX_RPT2_DESC_PKT_LEN_88E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 0, 9)
|
||||
#define GET_TX_RPT2_DESC_MACID_VALID_1_88E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+16, 0, 32)
|
||||
#define GET_TX_RPT2_DESC_MACID_VALID_2_88E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+20, 0, 32)
|
||||
|
||||
#define GET_TX_REPORT_TYPE1_RERTY_0(__pAddr) LE_BITS_TO_4BYTE( __pAddr, 0, 16)
|
||||
#define GET_TX_REPORT_TYPE1_RERTY_1(__pAddr) LE_BITS_TO_1BYTE( __pAddr+2, 0, 8)
|
||||
#define GET_TX_REPORT_TYPE1_RERTY_2(__pAddr) LE_BITS_TO_1BYTE( __pAddr+3, 0, 8)
|
||||
#define GET_TX_REPORT_TYPE1_RERTY_3(__pAddr) LE_BITS_TO_1BYTE( __pAddr+4, 0, 8)
|
||||
#define GET_TX_REPORT_TYPE1_RERTY_4(__pAddr) LE_BITS_TO_1BYTE( __pAddr+4+1, 0, 8)
|
||||
#define GET_TX_REPORT_TYPE1_DROP_0(__pAddr) LE_BITS_TO_1BYTE( __pAddr+4+2, 0, 8)
|
||||
#define GET_TX_REPORT_TYPE1_DROP_1(__pAddr) LE_BITS_TO_1BYTE( __pAddr+4+3, 0, 8)
|
||||
|
||||
/* End rate adaptive define */
|
||||
|
||||
void
|
||||
ODM_RASupport_Init(
|
||||
PDM_ODM_T pDM_Odm
|
||||
);
|
||||
|
||||
int
|
||||
ODM_RAInfo_Init_all(
|
||||
PDM_ODM_T pDM_Odm
|
||||
);
|
||||
|
||||
int
|
||||
ODM_RAInfo_Init(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
u8 MacID
|
||||
);
|
||||
|
||||
u8
|
||||
ODM_RA_GetShortGI_8188E(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
u8 MacID
|
||||
);
|
||||
|
||||
u8
|
||||
ODM_RA_GetDecisionRate_8188E(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
u8 MacID
|
||||
);
|
||||
|
||||
u8
|
||||
ODM_RA_GetHwPwrStatus_8188E(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
u8 MacID
|
||||
);
|
||||
void
|
||||
ODM_RA_UpdateRateInfo_8188E(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
u8 MacID,
|
||||
u8 RateID,
|
||||
u32 RateMask,
|
||||
u8 SGIEnable
|
||||
);
|
||||
|
||||
void
|
||||
ODM_RA_SetRSSI_8188E(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
u8 MacID,
|
||||
u8 Rssi
|
||||
);
|
||||
|
||||
void
|
||||
ODM_RA_TxRPT2Handle_8188E(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
u8 * TxRPT_Buf,
|
||||
u16 TxRPT_Len,
|
||||
u32 MacIDValidEntry0,
|
||||
u32 MacIDValidEntry1
|
||||
);
|
||||
|
||||
|
||||
void
|
||||
ODM_RA_Set_TxRPT_Time(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
u16 minRptTime
|
||||
);
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load diff
|
@ -1,373 +0,0 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* 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 "odm_precomp.h"
|
||||
|
||||
static bool
|
||||
CheckCondition(
|
||||
const u32 Condition,
|
||||
const u32 Hex
|
||||
)
|
||||
{
|
||||
u32 _board = (Hex & 0x000000FF);
|
||||
u32 _interface = (Hex & 0x0000FF00) >> 8;
|
||||
u32 _platform = (Hex & 0x00FF0000) >> 16;
|
||||
u32 cond = Condition;
|
||||
|
||||
if ( Condition == 0xCDCDCDCD )
|
||||
return true;
|
||||
|
||||
cond = Condition & 0x000000FF;
|
||||
if ( (_board != cond) && (cond != 0xFF) )
|
||||
return false;
|
||||
|
||||
cond = Condition & 0x0000FF00;
|
||||
cond = cond >> 8;
|
||||
if ( ((_interface & cond) == 0) && (cond != 0x07) )
|
||||
return false;
|
||||
|
||||
cond = Condition & 0x00FF0000;
|
||||
cond = cond >> 16;
|
||||
if ( ((_platform & cond) == 0) && (cond != 0x0F) )
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* MAC_REG.TXT
|
||||
******************************************************************************/
|
||||
|
||||
static u32 Array_MAC_REG_8188E[] = {
|
||||
0x026, 0x00000041,
|
||||
0x027, 0x00000035,
|
||||
0xFF0F0718, 0xABCD,
|
||||
0x040, 0x0000000C,
|
||||
0xCDCDCDCD, 0xCDCD,
|
||||
0x040, 0x00000000,
|
||||
0xFF0F0718, 0xDEAD,
|
||||
0x428, 0x0000000A,
|
||||
0x429, 0x00000010,
|
||||
0x430, 0x00000000,
|
||||
0x431, 0x00000001,
|
||||
0x432, 0x00000002,
|
||||
0x433, 0x00000004,
|
||||
0x434, 0x00000005,
|
||||
0x435, 0x00000006,
|
||||
0x436, 0x00000007,
|
||||
0x437, 0x00000008,
|
||||
0x438, 0x00000000,
|
||||
0x439, 0x00000000,
|
||||
0x43A, 0x00000001,
|
||||
0x43B, 0x00000002,
|
||||
0x43C, 0x00000004,
|
||||
0x43D, 0x00000005,
|
||||
0x43E, 0x00000006,
|
||||
0x43F, 0x00000007,
|
||||
0x440, 0x0000005D,
|
||||
0x441, 0x00000001,
|
||||
0x442, 0x00000000,
|
||||
0x444, 0x00000015,
|
||||
0x445, 0x000000F0,
|
||||
0x446, 0x0000000F,
|
||||
0x447, 0x00000000,
|
||||
0x458, 0x00000041,
|
||||
0x459, 0x000000A8,
|
||||
0x45A, 0x00000072,
|
||||
0x45B, 0x000000B9,
|
||||
0x460, 0x00000066,
|
||||
0x461, 0x00000066,
|
||||
0x480, 0x00000008,
|
||||
0x4C8, 0x000000FF,
|
||||
0x4C9, 0x00000008,
|
||||
0x4CC, 0x000000FF,
|
||||
0x4CD, 0x000000FF,
|
||||
0x4CE, 0x00000001,
|
||||
0x4D3, 0x00000001,
|
||||
0x500, 0x00000026,
|
||||
0x501, 0x000000A2,
|
||||
0x502, 0x0000002F,
|
||||
0x503, 0x00000000,
|
||||
0x504, 0x00000028,
|
||||
0x505, 0x000000A3,
|
||||
0x506, 0x0000005E,
|
||||
0x507, 0x00000000,
|
||||
0x508, 0x0000002B,
|
||||
0x509, 0x000000A4,
|
||||
0x50A, 0x0000005E,
|
||||
0x50B, 0x00000000,
|
||||
0x50C, 0x0000004F,
|
||||
0x50D, 0x000000A4,
|
||||
0x50E, 0x00000000,
|
||||
0x50F, 0x00000000,
|
||||
0x512, 0x0000001C,
|
||||
0x514, 0x0000000A,
|
||||
0x516, 0x0000000A,
|
||||
0x525, 0x0000004F,
|
||||
0x550, 0x00000010,
|
||||
0x551, 0x00000010,
|
||||
0x559, 0x00000002,
|
||||
0x55D, 0x000000FF,
|
||||
0x605, 0x00000030,
|
||||
0x608, 0x0000000E,
|
||||
0x609, 0x0000002A,
|
||||
0x620, 0x000000FF,
|
||||
0x621, 0x000000FF,
|
||||
0x622, 0x000000FF,
|
||||
0x623, 0x000000FF,
|
||||
0x624, 0x000000FF,
|
||||
0x625, 0x000000FF,
|
||||
0x626, 0x000000FF,
|
||||
0x627, 0x000000FF,
|
||||
0x652, 0x00000020,
|
||||
0x63C, 0x0000000A,
|
||||
0x63D, 0x0000000A,
|
||||
0x63E, 0x0000000E,
|
||||
0x63F, 0x0000000E,
|
||||
0x640, 0x00000040,
|
||||
0x66E, 0x00000005,
|
||||
0x700, 0x00000021,
|
||||
0x701, 0x00000043,
|
||||
0x702, 0x00000065,
|
||||
0x703, 0x00000087,
|
||||
0x708, 0x00000021,
|
||||
0x709, 0x00000043,
|
||||
0x70A, 0x00000065,
|
||||
0x70B, 0x00000087,
|
||||
};
|
||||
|
||||
HAL_STATUS
|
||||
ODM_ReadAndConfig_MAC_REG_8188E(
|
||||
PDM_ODM_T pDM_Odm
|
||||
)
|
||||
{
|
||||
#define READ_NEXT_PAIR(v1, v2, i) do { i += 2; v1 = Array[i]; v2 = Array[i+1]; } while (0)
|
||||
|
||||
u32 hex = 0;
|
||||
u32 i = 0;
|
||||
u16 count = 0;
|
||||
u32 * ptr_array = NULL;
|
||||
u8 platform = pDM_Odm->SupportPlatform;
|
||||
u8 interfaceValue = pDM_Odm->SupportInterface;
|
||||
u8 board = pDM_Odm->BoardType;
|
||||
u32 ArrayLen = sizeof(Array_MAC_REG_8188E)/sizeof(u32);
|
||||
u32 * Array = Array_MAC_REG_8188E;
|
||||
bool biol = false;
|
||||
HAL_STATUS rst =HAL_STATUS_SUCCESS;
|
||||
hex += board;
|
||||
hex += interfaceValue << 8;
|
||||
hex += platform << 16;
|
||||
hex += 0xFF000000;
|
||||
|
||||
for (i = 0; i < ArrayLen; i += 2 ) {
|
||||
u32 v1 = Array[i];
|
||||
u32 v2 = Array[i+1];
|
||||
|
||||
/* This (offset, data) pair meets the condition. */
|
||||
if ( v1 < 0xCDCDCDCD )
|
||||
{
|
||||
odm_ConfigMAC_8188E(pDM_Odm, v1, (u8)v2);
|
||||
continue;
|
||||
} else { /* This line is the start line of branch. */
|
||||
if ( !CheckCondition(Array[i], hex) )
|
||||
{ /* Discard the following (offset, data) pairs. */
|
||||
READ_NEXT_PAIR(v1, v2, i);
|
||||
while ( v2 != 0xDEAD &&
|
||||
v2 != 0xCDEF &&
|
||||
v2 != 0xCDCD && i < ArrayLen -2)
|
||||
{
|
||||
READ_NEXT_PAIR(v1, v2, i);
|
||||
}
|
||||
i -= 2; /* prevent from for-loop += 2 */
|
||||
}
|
||||
else /* Configure matched pairs and skip to end of if-else. */
|
||||
{
|
||||
READ_NEXT_PAIR(v1, v2, i);
|
||||
while (v2 != 0xDEAD &&
|
||||
v2 != 0xCDEF &&
|
||||
v2 != 0xCDCD && i < ArrayLen -2) {
|
||||
odm_ConfigMAC_8188E(pDM_Odm, v1, (u8)v2);
|
||||
READ_NEXT_PAIR(v1, v2, i);
|
||||
}
|
||||
while (v2 != 0xDEAD && i < ArrayLen -2)
|
||||
READ_NEXT_PAIR(v1, v2, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return rst;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* MAC_REG_ICUT.TXT
|
||||
******************************************************************************/
|
||||
|
||||
static u32 Array_MP_8188E_MAC_REG_ICUT[] = {
|
||||
0x026, 0x00000041,
|
||||
0x027, 0x00000035,
|
||||
0x428, 0x0000000A,
|
||||
0x429, 0x00000010,
|
||||
0x430, 0x00000000,
|
||||
0x431, 0x00000001,
|
||||
0x432, 0x00000002,
|
||||
0x433, 0x00000004,
|
||||
0x434, 0x00000005,
|
||||
0x435, 0x00000006,
|
||||
0x436, 0x00000007,
|
||||
0x437, 0x00000008,
|
||||
0x438, 0x00000000,
|
||||
0x439, 0x00000000,
|
||||
0x43A, 0x00000001,
|
||||
0x43B, 0x00000002,
|
||||
0x43C, 0x00000004,
|
||||
0x43D, 0x00000005,
|
||||
0x43E, 0x00000006,
|
||||
0x43F, 0x00000007,
|
||||
0x440, 0x0000005D,
|
||||
0x441, 0x00000001,
|
||||
0x442, 0x00000000,
|
||||
0x444, 0x00000015,
|
||||
0x445, 0x000000F0,
|
||||
0x446, 0x0000000F,
|
||||
0x447, 0x00000000,
|
||||
0x458, 0x00000041,
|
||||
0x459, 0x000000A8,
|
||||
0x45A, 0x00000072,
|
||||
0x45B, 0x000000B9,
|
||||
0x460, 0x00000066,
|
||||
0x461, 0x00000066,
|
||||
0x480, 0x00000008,
|
||||
0x4C8, 0x000000FF,
|
||||
0x4C9, 0x00000008,
|
||||
0x4CC, 0x000000FF,
|
||||
0x4CD, 0x000000FF,
|
||||
0x4CE, 0x00000001,
|
||||
0x4D3, 0x00000001,
|
||||
0x500, 0x00000026,
|
||||
0x501, 0x000000A2,
|
||||
0x502, 0x0000002F,
|
||||
0x503, 0x00000000,
|
||||
0x504, 0x00000028,
|
||||
0x505, 0x000000A3,
|
||||
0x506, 0x0000005E,
|
||||
0x507, 0x00000000,
|
||||
0x508, 0x0000002B,
|
||||
0x509, 0x000000A4,
|
||||
0x50A, 0x0000005E,
|
||||
0x50B, 0x00000000,
|
||||
0x50C, 0x0000004F,
|
||||
0x50D, 0x000000A4,
|
||||
0x50E, 0x00000000,
|
||||
0x50F, 0x00000000,
|
||||
0x512, 0x0000001C,
|
||||
0x514, 0x0000000A,
|
||||
0x516, 0x0000000A,
|
||||
0x525, 0x0000004F,
|
||||
0x550, 0x00000010,
|
||||
0x551, 0x00000010,
|
||||
0x559, 0x00000002,
|
||||
0x55D, 0x000000FF,
|
||||
0x605, 0x00000030,
|
||||
0x608, 0x0000000E,
|
||||
0x609, 0x0000002A,
|
||||
0x620, 0x000000FF,
|
||||
0x621, 0x000000FF,
|
||||
0x622, 0x000000FF,
|
||||
0x623, 0x000000FF,
|
||||
0x624, 0x000000FF,
|
||||
0x625, 0x000000FF,
|
||||
0x626, 0x000000FF,
|
||||
0x627, 0x000000FF,
|
||||
0x652, 0x00000020,
|
||||
0x63C, 0x0000000A,
|
||||
0x63D, 0x0000000A,
|
||||
0x63E, 0x0000000E,
|
||||
0x63F, 0x0000000E,
|
||||
0x640, 0x00000040,
|
||||
0x66E, 0x00000005,
|
||||
0x700, 0x00000021,
|
||||
0x701, 0x00000043,
|
||||
0x702, 0x00000065,
|
||||
0x703, 0x00000087,
|
||||
0x708, 0x00000021,
|
||||
0x709, 0x00000043,
|
||||
0x70A, 0x00000065,
|
||||
0x70B, 0x00000087,
|
||||
|
||||
};
|
||||
|
||||
void
|
||||
ODM_ReadAndConfig_MAC_REG_ICUT_8188E(
|
||||
PDM_ODM_T pDM_Odm
|
||||
)
|
||||
{
|
||||
#define READ_NEXT_PAIR(v1, v2, i) do { i += 2; v1 = Array[i]; v2 = Array[i+1]; } while (0)
|
||||
|
||||
u32 hex = 0;
|
||||
u32 i = 0;
|
||||
u16 count = 0;
|
||||
u32 * ptr_array = NULL;
|
||||
u8 platform = pDM_Odm->SupportPlatform;
|
||||
u8 _interface = pDM_Odm->SupportInterface;
|
||||
u8 board = pDM_Odm->BoardType;
|
||||
u32 ArrayLen = sizeof(Array_MP_8188E_MAC_REG_ICUT)/sizeof(u32);
|
||||
u32 * Array = Array_MP_8188E_MAC_REG_ICUT;
|
||||
|
||||
|
||||
hex += board;
|
||||
hex += _interface << 8;
|
||||
hex += platform << 16;
|
||||
hex += 0xFF000000;
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ReadAndConfig_MP_8188E_MAC_REG_ICUT, hex = 0x%X\n", hex));
|
||||
|
||||
for (i = 0; i < ArrayLen; i += 2 ) {
|
||||
u32 v1 = Array[i];
|
||||
u32 v2 = Array[i+1];
|
||||
|
||||
/* This (offset, data) pair meets the condition. */
|
||||
if ( v1 < 0xCDCDCDCD ) {
|
||||
odm_ConfigMAC_8188E(pDM_Odm, v1, (u8)v2);
|
||||
continue;
|
||||
} else
|
||||
{ /* This line is the start line of branch. */
|
||||
if ( !CheckCondition(Array[i], hex) )
|
||||
{ /* Discard the following (offset, data) pairs. */
|
||||
READ_NEXT_PAIR(v1, v2, i);
|
||||
while (v2 != 0xDEAD &&
|
||||
v2 != 0xCDEF &&
|
||||
v2 != 0xCDCD && i < ArrayLen -2)
|
||||
READ_NEXT_PAIR(v1, v2, i);
|
||||
i -= 2; /* prevent from for-loop += 2 */
|
||||
} else /* Configure matched pairs and skip to end of if-else. */
|
||||
{
|
||||
READ_NEXT_PAIR(v1, v2, i);
|
||||
while (v2 != 0xDEAD &&
|
||||
v2 != 0xCDEF &&
|
||||
v2 != 0xCDCD && i < ArrayLen -2) {
|
||||
odm_ConfigMAC_8188E(pDM_Odm, v1, (u8)v2);
|
||||
READ_NEXT_PAIR(v1, v2, i);
|
||||
}
|
||||
|
||||
while (v2 != 0xDEAD && i < ArrayLen -2)
|
||||
READ_NEXT_PAIR(v1, v2, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,414 +0,0 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* 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 "odm_precomp.h"
|
||||
|
||||
static bool
|
||||
CheckCondition(
|
||||
const u32 Condition,
|
||||
const u32 Hex
|
||||
)
|
||||
{
|
||||
u32 _board = (Hex & 0x000000FF);
|
||||
u32 _interface = (Hex & 0x0000FF00) >> 8;
|
||||
u32 _platform = (Hex & 0x00FF0000) >> 16;
|
||||
u32 cond = Condition;
|
||||
|
||||
if ( Condition == 0xCDCDCDCD )
|
||||
return true;
|
||||
|
||||
cond = Condition & 0x000000FF;
|
||||
if ( (_board != cond) && (cond != 0xFF) )
|
||||
return false;
|
||||
|
||||
cond = Condition & 0x0000FF00;
|
||||
cond = cond >> 8;
|
||||
if ( ((_interface & cond) == 0) && (cond != 0x07) )
|
||||
return false;
|
||||
|
||||
cond = Condition & 0x00FF0000;
|
||||
cond = cond >> 16;
|
||||
if ( ((_platform & cond) == 0) && (cond != 0x0F) )
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* RadioA_1T.TXT
|
||||
******************************************************************************/
|
||||
|
||||
static u32 Array_RadioA_1T_8188E[] = {
|
||||
0x000, 0x00030000,
|
||||
0x008, 0x00084000,
|
||||
0x018, 0x00000407,
|
||||
0x019, 0x00000012,
|
||||
0x01E, 0x00080009,
|
||||
0x01F, 0x00000880,
|
||||
0x02F, 0x0001A060,
|
||||
0x03F, 0x00000000,
|
||||
0x042, 0x000060C0,
|
||||
0x057, 0x000D0000,
|
||||
0x058, 0x000BE180,
|
||||
0x067, 0x00001552,
|
||||
0x083, 0x00000000,
|
||||
0x0B0, 0x000FF8FC,
|
||||
0x0B1, 0x00054400,
|
||||
0x0B2, 0x000CCC19,
|
||||
0x0B4, 0x00043003,
|
||||
0x0B6, 0x0004953E,
|
||||
0x0B7, 0x0001C718,
|
||||
0x0B8, 0x000060FF,
|
||||
0x0B9, 0x00080001,
|
||||
0x0BA, 0x00040000,
|
||||
0x0BB, 0x00000400,
|
||||
0x0BF, 0x000C0000,
|
||||
0x0C2, 0x00002400,
|
||||
0x0C3, 0x00000009,
|
||||
0x0C4, 0x00040C91,
|
||||
0x0C5, 0x00099999,
|
||||
0x0C6, 0x000000A3,
|
||||
0x0C7, 0x00088820,
|
||||
0x0C8, 0x00076C06,
|
||||
0x0C9, 0x00000000,
|
||||
0x0CA, 0x00080000,
|
||||
0x0DF, 0x00000180,
|
||||
0x0EF, 0x000001A0,
|
||||
0x051, 0x0006B27D,
|
||||
0xFF0F0400, 0xABCD,
|
||||
0x052, 0x0007E4DD,
|
||||
0xCDCDCDCD, 0xCDCD,
|
||||
0x052, 0x0007E49D,
|
||||
0xFF0F0400, 0xDEAD,
|
||||
0x053, 0x00000073,
|
||||
0x056, 0x00051FF3,
|
||||
0x035, 0x00000086,
|
||||
0x035, 0x00000186,
|
||||
0x035, 0x00000286,
|
||||
0x036, 0x00001C25,
|
||||
0x036, 0x00009C25,
|
||||
0x036, 0x00011C25,
|
||||
0x036, 0x00019C25,
|
||||
0x0B6, 0x00048538,
|
||||
0x018, 0x00000C07,
|
||||
0x05A, 0x0004BD00,
|
||||
0x019, 0x000739D0,
|
||||
0xFF0F0718, 0xABCD,
|
||||
0x034, 0x0000A093,
|
||||
0x034, 0x0000908F,
|
||||
0x034, 0x0000808C,
|
||||
0x034, 0x0000704F,
|
||||
0x034, 0x0000604C,
|
||||
0x034, 0x00005049,
|
||||
0x034, 0x0000400C,
|
||||
0x034, 0x00003009,
|
||||
0x034, 0x00002006,
|
||||
0x034, 0x00001003,
|
||||
0x034, 0x00000000,
|
||||
0xCDCDCDCD, 0xCDCD,
|
||||
0x034, 0x0000ADF3,
|
||||
0x034, 0x00009DF0,
|
||||
0x034, 0x00008DED,
|
||||
0x034, 0x00007DEA,
|
||||
0x034, 0x00006DE7,
|
||||
0x034, 0x000054EE,
|
||||
0x034, 0x000044EB,
|
||||
0x034, 0x000034E8,
|
||||
0x034, 0x0000246B,
|
||||
0x034, 0x00001468,
|
||||
0x034, 0x0000006D,
|
||||
0xFF0F0718, 0xDEAD,
|
||||
0x000, 0x00030159,
|
||||
0x084, 0x00068200,
|
||||
0x086, 0x000000CE,
|
||||
0x087, 0x00048A00,
|
||||
0x08E, 0x00065540,
|
||||
0x08F, 0x00088000,
|
||||
0x0EF, 0x000020A0,
|
||||
0x03B, 0x000F02B0,
|
||||
0x03B, 0x000EF7B0,
|
||||
0x03B, 0x000D4FB0,
|
||||
0x03B, 0x000CF060,
|
||||
0x03B, 0x000B0090,
|
||||
0x03B, 0x000A0080,
|
||||
0x03B, 0x00090080,
|
||||
0x03B, 0x0008F780,
|
||||
0x03B, 0x000722B0,
|
||||
0x03B, 0x0006F7B0,
|
||||
0x03B, 0x00054FB0,
|
||||
0x03B, 0x0004F060,
|
||||
0x03B, 0x00030090,
|
||||
0x03B, 0x00020080,
|
||||
0x03B, 0x00010080,
|
||||
0x03B, 0x0000F780,
|
||||
0x0EF, 0x000000A0,
|
||||
0x000, 0x00010159,
|
||||
0x018, 0x0000F407,
|
||||
0xFFE, 0x00000000,
|
||||
0xFFE, 0x00000000,
|
||||
0x01F, 0x00080003,
|
||||
0xFFE, 0x00000000,
|
||||
0xFFE, 0x00000000,
|
||||
0x01E, 0x00000001,
|
||||
0x01F, 0x00080000,
|
||||
0x000, 0x00033E60,
|
||||
|
||||
};
|
||||
|
||||
HAL_STATUS
|
||||
ODM_ReadAndConfig_RadioA_1T_8188E(
|
||||
PDM_ODM_T pDM_Odm
|
||||
)
|
||||
{
|
||||
#define READ_NEXT_PAIR(v1, v2, i) do { i += 2; v1 = Array[i]; v2 = Array[i+1]; } while (0)
|
||||
|
||||
u32 hex = 0;
|
||||
u32 i = 0;
|
||||
u16 count = 0;
|
||||
u32 * ptr_array = NULL;
|
||||
u8 platform = pDM_Odm->SupportPlatform;
|
||||
u8 interfaceValue = pDM_Odm->SupportInterface;
|
||||
u8 board = pDM_Odm->BoardType;
|
||||
u32 ArrayLen = sizeof(Array_RadioA_1T_8188E)/sizeof(u32);
|
||||
u32 * Array = Array_RadioA_1T_8188E;
|
||||
bool biol = false;
|
||||
HAL_STATUS rst =HAL_STATUS_SUCCESS;
|
||||
|
||||
hex += board;
|
||||
hex += interfaceValue << 8;
|
||||
hex += platform << 16;
|
||||
hex += 0xFF000000;
|
||||
for (i = 0; i < ArrayLen; i += 2 ) {
|
||||
u32 v1 = Array[i];
|
||||
u32 v2 = Array[i+1];
|
||||
|
||||
/* This (offset, data) pair meets the condition. */
|
||||
if ( v1 < 0xCDCDCDCD ) {
|
||||
odm_ConfigRF_RadioA_8188E(pDM_Odm, v1, v2);
|
||||
continue;
|
||||
} else { /* This line is the start line of branch. */
|
||||
if ( !CheckCondition(Array[i], hex) )
|
||||
{ /* Discard the following (offset, data) pairs. */
|
||||
READ_NEXT_PAIR(v1, v2, i);
|
||||
while (v2 != 0xDEAD &&
|
||||
v2 != 0xCDEF &&
|
||||
v2 != 0xCDCD && i < ArrayLen -2)
|
||||
{
|
||||
READ_NEXT_PAIR(v1, v2, i);
|
||||
}
|
||||
i -= 2; /* prevent from for-loop += 2 */
|
||||
}
|
||||
else /* Configure matched pairs and skip to end of if-else. */
|
||||
{
|
||||
READ_NEXT_PAIR(v1, v2, i);
|
||||
while (v2 != 0xDEAD &&
|
||||
v2 != 0xCDEF &&
|
||||
v2 != 0xCDCD && i < ArrayLen -2)
|
||||
{
|
||||
odm_ConfigRF_RadioA_8188E(pDM_Odm, v1, v2);
|
||||
READ_NEXT_PAIR(v1, v2, i);
|
||||
}
|
||||
|
||||
while (v2 != 0xDEAD && i < ArrayLen -2)
|
||||
{
|
||||
READ_NEXT_PAIR(v1, v2, i);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return rst;
|
||||
}
|
||||
/******************************************************************************
|
||||
* RadioA_1T_ICUT.TXT
|
||||
******************************************************************************/
|
||||
|
||||
static u32 Array_MP_8188E_RadioA_1T_ICUT[] = {
|
||||
0x000, 0x00030000,
|
||||
0x008, 0x00084000,
|
||||
0x018, 0x00000407,
|
||||
0x019, 0x00000012,
|
||||
0x01E, 0x00080009,
|
||||
0x01F, 0x00000880,
|
||||
0x02F, 0x0001A060,
|
||||
0x03F, 0x00000000,
|
||||
0x042, 0x000060C0,
|
||||
0x057, 0x000D0000,
|
||||
0x058, 0x000BE180,
|
||||
0x067, 0x00001552,
|
||||
0x083, 0x00000000,
|
||||
0x0B0, 0x000FF8FC,
|
||||
0x0B1, 0x00054400,
|
||||
0x0B2, 0x000CCC19,
|
||||
0x0B4, 0x00043003,
|
||||
0x0B6, 0x0004953E,
|
||||
0x0B7, 0x0001C718,
|
||||
0x0B8, 0x000060FF,
|
||||
0x0B9, 0x00080001,
|
||||
0x0BA, 0x00040000,
|
||||
0x0BB, 0x00000400,
|
||||
0x0BF, 0x000C0000,
|
||||
0x0C2, 0x00002400,
|
||||
0x0C3, 0x00000009,
|
||||
0x0C4, 0x00040C91,
|
||||
0x0C5, 0x00099999,
|
||||
0x0C6, 0x000000A3,
|
||||
0x0C7, 0x00088820,
|
||||
0x0C8, 0x00076C06,
|
||||
0x0C9, 0x00000000,
|
||||
0x0CA, 0x00080000,
|
||||
0x0DF, 0x00000180,
|
||||
0x0EF, 0x000001A0,
|
||||
0x051, 0x0006B27D,
|
||||
0xFF0F0400, 0xABCD,
|
||||
0x052, 0x0007E4DD,
|
||||
0xCDCDCDCD, 0xCDCD,
|
||||
0x052, 0x0007E49D,
|
||||
0xFF0F0400, 0xDEAD,
|
||||
0x053, 0x00000073,
|
||||
0x056, 0x00051FF3,
|
||||
0x035, 0x00000086,
|
||||
0x035, 0x00000186,
|
||||
0x035, 0x00000286,
|
||||
0x036, 0x00001C25,
|
||||
0x036, 0x00009C25,
|
||||
0x036, 0x00011C25,
|
||||
0x036, 0x00019C25,
|
||||
0x0B6, 0x00048538,
|
||||
0x018, 0x00000C07,
|
||||
0x05A, 0x0004BD00,
|
||||
0x019, 0x000739D0,
|
||||
0x034, 0x0000ADF3,
|
||||
0x034, 0x00009DF0,
|
||||
0x034, 0x00008DED,
|
||||
0x034, 0x00007DEA,
|
||||
0x034, 0x00006DE7,
|
||||
0x034, 0x000054EE,
|
||||
0x034, 0x000044EB,
|
||||
0x034, 0x000034E8,
|
||||
0x034, 0x0000246B,
|
||||
0x034, 0x00001468,
|
||||
0x034, 0x0000006D,
|
||||
0x000, 0x00030159,
|
||||
0x084, 0x00068200,
|
||||
0x086, 0x000000CE,
|
||||
0x087, 0x00048A00,
|
||||
0x08E, 0x00065540,
|
||||
0x08F, 0x00088000,
|
||||
0x0EF, 0x000020A0,
|
||||
0x03B, 0x000F02B0,
|
||||
0x03B, 0x000EF7B0,
|
||||
0x03B, 0x000D4FB0,
|
||||
0x03B, 0x000CF060,
|
||||
0x03B, 0x000B0090,
|
||||
0x03B, 0x000A0080,
|
||||
0x03B, 0x00090080,
|
||||
0x03B, 0x0008F780,
|
||||
0x03B, 0x000722B0,
|
||||
0x03B, 0x0006F7B0,
|
||||
0x03B, 0x00054FB0,
|
||||
0x03B, 0x0004F060,
|
||||
0x03B, 0x00030090,
|
||||
0x03B, 0x00020080,
|
||||
0x03B, 0x00010080,
|
||||
0x03B, 0x0000F780,
|
||||
0x0EF, 0x000000A0,
|
||||
0x000, 0x00010159,
|
||||
0x018, 0x0000F407,
|
||||
0xFFE, 0x00000000,
|
||||
0xFFE, 0x00000000,
|
||||
0x01F, 0x00080003,
|
||||
0xFFE, 0x00000000,
|
||||
0xFFE, 0x00000000,
|
||||
0x01E, 0x00000001,
|
||||
0x01F, 0x00080000,
|
||||
0x000, 0x00033E60,
|
||||
|
||||
};
|
||||
|
||||
void
|
||||
ODM_ReadAndConfig_RadioA_1T_ICUT_8188E(
|
||||
PDM_ODM_T pDM_Odm
|
||||
)
|
||||
{
|
||||
#define READ_NEXT_PAIR(v1, v2, i) do { i += 2; v1 = Array[i]; v2 = Array[i+1]; } while (0)
|
||||
|
||||
u32 hex = 0;
|
||||
u32 i = 0;
|
||||
u16 count = 0;
|
||||
u32 * ptr_array = NULL;
|
||||
u8 platform = pDM_Odm->SupportPlatform;
|
||||
u8 _interface = pDM_Odm->SupportInterface;
|
||||
u8 board = pDM_Odm->BoardType;
|
||||
u32 ArrayLen = sizeof(Array_MP_8188E_RadioA_1T_ICUT)/sizeof(u32);
|
||||
u32 * Array = Array_MP_8188E_RadioA_1T_ICUT;
|
||||
|
||||
|
||||
hex += board;
|
||||
hex += _interface << 8;
|
||||
hex += platform << 16;
|
||||
hex += 0xFF000000;
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ReadAndConfig_MP_8188E_RadioA_1T_ICUT, hex = 0x%X\n", hex));
|
||||
|
||||
for (i = 0; i < ArrayLen; i += 2 )
|
||||
{
|
||||
u32 v1 = Array[i];
|
||||
u32 v2 = Array[i+1];
|
||||
|
||||
/* This (offset, data) pair meets the condition. */
|
||||
if ( v1 < 0xCDCDCDCD )
|
||||
{
|
||||
odm_ConfigRF_RadioA_8188E(pDM_Odm, v1, v2);
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{ /* This line is the start line of branch. */
|
||||
if ( !CheckCondition(Array[i], hex) )
|
||||
{ /* Discard the following (offset, data) pairs. */
|
||||
READ_NEXT_PAIR(v1, v2, i);
|
||||
while (v2 != 0xDEAD &&
|
||||
v2 != 0xCDEF &&
|
||||
v2 != 0xCDCD && i < ArrayLen -2)
|
||||
{
|
||||
READ_NEXT_PAIR(v1, v2, i);
|
||||
}
|
||||
i -= 2; /* prevent from for-loop += 2 */
|
||||
}
|
||||
else /* Configure matched pairs and skip to end of if-else. */
|
||||
{
|
||||
READ_NEXT_PAIR(v1, v2, i);
|
||||
while (v2 != 0xDEAD &&
|
||||
v2 != 0xCDEF &&
|
||||
v2 != 0xCDCD && i < ArrayLen -2)
|
||||
{
|
||||
odm_ConfigRF_RadioA_8188E(pDM_Odm, v1, v2);
|
||||
READ_NEXT_PAIR(v1, v2, i);
|
||||
}
|
||||
|
||||
while (v2 != 0xDEAD && i < ArrayLen -2)
|
||||
{
|
||||
READ_NEXT_PAIR(v1, v2, i);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,78 +0,0 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* 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 "odm_precomp.h"
|
||||
|
||||
/* 3============================================================ */
|
||||
/* 3 IQ Calibration */
|
||||
/* 3============================================================ */
|
||||
|
||||
void
|
||||
ODM_ResetIQKResult(
|
||||
PDM_ODM_T pDM_Odm
|
||||
)
|
||||
{
|
||||
u8 i;
|
||||
struct adapter *Adapter = pDM_Odm->Adapter;
|
||||
|
||||
if (!IS_HARDWARE_TYPE_8192D(Adapter))
|
||||
return;
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD,("PHY_ResetIQKResult:: settings regs %d default regs %d\n", (u32)(sizeof(pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting)/sizeof(IQK_MATRIX_REGS_SETTING)), IQK_Matrix_Settings_NUM));
|
||||
/* 0xe94, 0xe9c, 0xea4, 0xeac, 0xeb4, 0xebc, 0xec4, 0xecc */
|
||||
|
||||
for (i = 0; i < IQK_Matrix_Settings_NUM; i++)
|
||||
{
|
||||
{
|
||||
pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[i].Value[0][0] =
|
||||
pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[i].Value[0][2] =
|
||||
pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[i].Value[0][4] =
|
||||
pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[i].Value[0][6] = 0x100;
|
||||
|
||||
pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[i].Value[0][1] =
|
||||
pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[i].Value[0][3] =
|
||||
pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[i].Value[0][5] =
|
||||
pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[i].Value[0][7] = 0x0;
|
||||
|
||||
pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[i].bIQKDone = false;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
u8 ODM_GetRightChnlPlaceforIQK(u8 chnl)
|
||||
{
|
||||
u8 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};
|
||||
u8 place = chnl;
|
||||
|
||||
|
||||
if (chnl > 14)
|
||||
{
|
||||
for (place = 14; place<sizeof(channel_all); place++)
|
||||
{
|
||||
if (channel_all[place] == chnl)
|
||||
{
|
||||
return place-13;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
2221
hal/HalPhyRf_8188e.c
2221
hal/HalPhyRf_8188e.c
File diff suppressed because it is too large
Load diff
|
@ -1,110 +0,0 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* 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_8188E_H__
|
||||
#define __HAL_PHY_RF_8188E_H__
|
||||
|
||||
|
||||
/*--------------------------Define Parameters-------------------------------*/
|
||||
#define IQK_DELAY_TIME_88E 10 /* ms */
|
||||
#define index_mapping_NUM_88E 15
|
||||
#define AVG_THERMAL_NUM_88E 4
|
||||
|
||||
typedef enum _PWRTRACK_CONTROL_METHOD {
|
||||
BBSWING,
|
||||
TXAGC
|
||||
} PWRTRACK_METHOD;
|
||||
|
||||
|
||||
void
|
||||
ODM_TxPwrTrackAdjust88E(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
u8 Type, /* 0 = OFDM, 1 = CCK */
|
||||
u8 * pDirection, /* 1 = +(increase) 2 = -(decrease) */
|
||||
u32 * pOutWriteVal /* Tx tracking CCK/OFDM BB swing index adjust */
|
||||
);
|
||||
|
||||
|
||||
void
|
||||
odm_TXPowerTrackingCallback_ThermalMeter_8188E(
|
||||
struct adapter * Adapter
|
||||
);
|
||||
|
||||
|
||||
/* 1 7. IQK */
|
||||
|
||||
void
|
||||
PHY_IQCalibrate_8188E(
|
||||
struct adapter * Adapter,
|
||||
bool bReCovery);
|
||||
|
||||
|
||||
/* */
|
||||
/* LC calibrate */
|
||||
/* */
|
||||
void
|
||||
PHY_LCCalibrate_8188E(
|
||||
struct adapter * pAdapter
|
||||
);
|
||||
|
||||
/* */
|
||||
/* AP calibrate */
|
||||
/* */
|
||||
void
|
||||
PHY_APCalibrate_8188E(
|
||||
struct adapter * pAdapter,
|
||||
s8 delta);
|
||||
|
||||
void
|
||||
PHY_DigitalPredistortion_8188E(struct adapter * pAdapter);
|
||||
|
||||
|
||||
void
|
||||
_PHY_SaveADDARegisters(
|
||||
struct adapter * pAdapter,
|
||||
u32 * ADDAReg,
|
||||
u32 * ADDABackup,
|
||||
u32 RegisterNum
|
||||
);
|
||||
|
||||
void
|
||||
_PHY_PathADDAOn(
|
||||
struct adapter * pAdapter,
|
||||
u32 * ADDAReg,
|
||||
bool isPathAOn,
|
||||
bool is2T
|
||||
);
|
||||
|
||||
void
|
||||
_PHY_MACSettingCalibration(
|
||||
struct adapter * pAdapter,
|
||||
u32 * MACReg,
|
||||
u32 * MACBackup
|
||||
);
|
||||
|
||||
|
||||
void
|
||||
_PHY_PathAStandBy(
|
||||
struct adapter * pAdapter
|
||||
);
|
||||
|
||||
|
||||
#endif /* #ifndef __HAL_PHY_RF_8188E_H__ */
|
||||
|
|
@ -35,112 +35,127 @@ Major Change History:
|
|||
--*/
|
||||
#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. */
|
||||
/* */
|
||||
|
||||
/*
|
||||
* 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(
|
||||
struct adapter * padapter,
|
||||
PADAPTER padapter,
|
||||
u8 CutVersion,
|
||||
u8 FabVersion,
|
||||
u8 InterfaceType,
|
||||
struct wl_pwr_cfg PwrSeqCmd[])
|
||||
WLAN_PWR_CFG PwrSeqCmd[])
|
||||
{
|
||||
struct wl_pwr_cfg PwrCfgCmd = {0};
|
||||
u8 bPollingBit = false;
|
||||
WLAN_PWR_CFG PwrCfgCmd = {0};
|
||||
u8 bPollingBit = _FALSE;
|
||||
u32 AryIdx = 0;
|
||||
u8 value = 0;
|
||||
u32 offset = 0;
|
||||
u32 pollingCount = 0; /* polling autoload done. */
|
||||
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;
|
||||
(GET_PWR_CFG_CUT_MASK(PwrCfgCmd) & CutVersion) &&
|
||||
(GET_PWR_CFG_INTF_MASK(PwrCfgCmd) & InterfaceType)) {
|
||||
switch (GET_PWR_CFG_CMD(PwrCfgCmd)) {
|
||||
case PWR_CMD_READ:
|
||||
break;
|
||||
|
||||
case PWR_CMD_WRITE:
|
||||
RT_TRACE(_module_hal_init_c_ , _drv_info_, ("HalPwrSeqCmdParsing: PWR_CMD_WRITE\n"));
|
||||
offset = GET_PWR_CFG_OFFSET(PwrCfgCmd);
|
||||
case PWR_CMD_WRITE:
|
||||
offset = GET_PWR_CFG_OFFSET(PwrCfgCmd);
|
||||
|
||||
/* Read the value from system register */
|
||||
value = rtw_read8(padapter, offset);
|
||||
#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 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"));
|
||||
/* 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);
|
||||
|
||||
bPollingBit = false;
|
||||
offset = GET_PWR_CFG_OFFSET(PwrCfgCmd);
|
||||
do {
|
||||
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:
|
||||
|
||||
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 &= 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_88E("Fail to polling Offset[%#x]\n", offset);
|
||||
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));
|
||||
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(GET_PWR_CFG_OFFSET(PwrCfgCmd)*1000);
|
||||
break;
|
||||
rtw_udelay_os(10);
|
||||
|
||||
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;
|
||||
if (pollingCount++ > maxPollingCnt) {
|
||||
RTW_ERR("HalPwrSeqCmdParsing: Fail to polling Offset[%#x]=%02x\n", offset, value);
|
||||
return _FALSE;
|
||||
}
|
||||
} while (!bPollingBit);
|
||||
|
||||
default:
|
||||
RT_TRACE(_module_hal_init_c_ , _drv_err_, ("HalPwrSeqCmdParsing: Unknown CMD!!\n"));
|
||||
break;
|
||||
break;
|
||||
|
||||
case PWR_CMD_DELAY:
|
||||
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 */
|
||||
return _TRUE;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
AryIdx++;/* Add Array Index */
|
||||
}while (1);
|
||||
} while (1);
|
||||
|
||||
return true;
|
||||
return _TRUE;
|
||||
}
|
||||
|
|
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
|
4377
hal/btc/halbtc8192e2ant.c
Normal file
4377
hal/btc/halbtc8192e2ant.c
Normal file
File diff suppressed because it is too large
Load diff
211
hal/btc/halbtc8192e2ant.h
Normal file
211
hal/btc/halbtc8192e2ant.h
Normal file
|
@ -0,0 +1,211 @@
|
|||
|
||||
#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
|
||||
#define NOISY_AP_NUM_THRESH_8192E 10
|
||||
|
||||
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 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;
|
||||
|
||||
/* 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;
|
||||
|
||||
u8 pre_lps;
|
||||
u8 cur_lps;
|
||||
u8 pre_rpwm;
|
||||
u8 cur_rpwm;
|
||||
|
||||
|
||||
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;
|
||||
u8 scan_ap_num;
|
||||
u32 bt_coex_supported_version;
|
||||
|
||||
u32 crc_ok_cck;
|
||||
u32 crc_ok_11g;
|
||||
u32 crc_ok_11n;
|
||||
u32 crc_ok_11n_vht;
|
||||
|
||||
u32 crc_err_cck;
|
||||
u32 crc_err_11g;
|
||||
u32 crc_err_11n;
|
||||
u32 crc_err_11n_vht;
|
||||
};
|
||||
|
||||
/* *******************************************
|
||||
* 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
|
||||
|
||||
|
4293
hal/btc/halbtc8703b1ant.c
Normal file
4293
hal/btc/halbtc8703b1ant.c
Normal file
File diff suppressed because it is too large
Load diff
404
hal/btc/halbtc8703b1ant.h
Normal file
404
hal/btc/halbtc8703b1ant.h
Normal file
|
@ -0,0 +1,404 @@
|
|||
|
||||
#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_SWEEPPOINT_DELAY 40000
|
||||
#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,
|
||||
};
|
||||
|
||||
enum bt_8703b_1ant_phase {
|
||||
BT_8703B_1ANT_PHASE_COEX_INIT = 0x0,
|
||||
BT_8703B_1ANT_PHASE_WLANONLY_INIT = 0x1,
|
||||
BT_8703B_1ANT_PHASE_WLAN_OFF = 0x2,
|
||||
BT_8703B_1ANT_PHASE_2G_RUNTIME = 0x3,
|
||||
BT_8703B_1ANT_PHASE_5G_RUNTIME = 0x4,
|
||||
BT_8703B_1ANT_PHASE_BTMPMODE = 0x5,
|
||||
BT_8703B_1ANT_PHASE_ANTENNA_DET = 0x6,
|
||||
BT_8703B_1ANT_PHASE_MAX
|
||||
};
|
||||
|
||||
enum bt_8703b_1ant_Scoreboard {
|
||||
BT_8703B_1ANT_SCOREBOARD_ACTIVE = BIT(0),
|
||||
BT_8703B_1ANT_SCOREBOARD_ONOFF = BIT(1),
|
||||
BT_8703B_1ANT_SCOREBOARD_SCAN = BIT(2),
|
||||
BT_8703B_1ANT_SCOREBOARD_UNDERTEST = BIT(3),
|
||||
BT_8703B_1ANT_SCOREBOARD_WLBUSY = BIT(6)
|
||||
};
|
||||
|
||||
|
||||
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;
|
||||
boolean is_hiPri_rx_overhead;
|
||||
s8 bt_rssi;
|
||||
boolean bt_tx_rx_mask;
|
||||
u8 pre_bt_rssi_state;
|
||||
u8 pre_wifi_rssi_state[4];
|
||||
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_remote_name_req;
|
||||
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;
|
||||
u8 bt_info_ext2;
|
||||
u32 pop_event_cnt;
|
||||
u8 scan_ap_num;
|
||||
|
||||
u32 crc_ok_cck;
|
||||
u32 crc_ok_11g;
|
||||
u32 crc_ok_11n;
|
||||
u32 crc_ok_11n_vht;
|
||||
|
||||
u32 crc_err_cck;
|
||||
u32 crc_err_11g;
|
||||
u32 crc_err_11n;
|
||||
u32 crc_err_11n_vht;
|
||||
|
||||
boolean cck_lock;
|
||||
boolean pre_ccklock;
|
||||
boolean cck_ever_lock;
|
||||
u8 coex_table_type;
|
||||
|
||||
boolean force_lps_on;
|
||||
|
||||
boolean concurrent_rx_mode_on;
|
||||
|
||||
u16 score_board;
|
||||
u8 isolation_btween_wb; /* 0~ 50 */
|
||||
|
||||
u8 a2dp_bit_pool;
|
||||
u8 cut_version;
|
||||
boolean acl_busy;
|
||||
boolean bt_create_connection;
|
||||
|
||||
u32 bt_coex_supported_feature;
|
||||
u32 bt_coex_supported_version;
|
||||
|
||||
u8 bt_ble_scan_type;
|
||||
u32 bt_ble_scan_para[3];
|
||||
|
||||
boolean run_time_state;
|
||||
boolean freeze_coexrun_by_btinfo;
|
||||
|
||||
boolean is_A2DP_3M;
|
||||
boolean voice_over_HOGP;
|
||||
u8 bt_info;
|
||||
boolean is_autoslot;
|
||||
u8 forbidden_slot;
|
||||
u8 hid_busy_num;
|
||||
u8 hid_pair_cnt;
|
||||
|
||||
u32 cnt_RemoteNameReq;
|
||||
u32 cnt_setupLink;
|
||||
u32 cnt_ReInit;
|
||||
u32 cnt_IgnWlanAct;
|
||||
u32 cnt_Page;
|
||||
|
||||
u16 bt_reg_vendor_ac;
|
||||
u16 bt_reg_vendor_ae;
|
||||
|
||||
boolean is_setupLink;
|
||||
u8 wl_noisy_level;
|
||||
u32 gnt_error_cnt;
|
||||
|
||||
u8 bt_afh_map[10];
|
||||
u8 bt_relink_downcount;
|
||||
boolean is_tdma_btautoslot;
|
||||
boolean is_tdma_btautoslot_hang;
|
||||
};
|
||||
|
||||
#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_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_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
|
||||
|
5113
hal/btc/halbtc8723b1ant.c
Normal file
5113
hal/btc/halbtc8723b1ant.c
Normal file
File diff suppressed because it is too large
Load diff
293
hal/btc/halbtc8723b1ant.h
Normal file
293
hal/btc/halbtc8723b1ant.h
Normal file
|
@ -0,0 +1,293 @@
|
|||
|
||||
#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 48
|
||||
#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_enable_disable_change;
|
||||
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_vht;
|
||||
|
||||
u32 crc_err_cck;
|
||||
u32 crc_err_11g;
|
||||
u32 crc_err_11n;
|
||||
u32 crc_err_11n_vht;
|
||||
|
||||
boolean cck_lock;
|
||||
boolean pre_ccklock;
|
||||
boolean cck_ever_lock;
|
||||
u8 coex_table_type;
|
||||
|
||||
boolean force_lps_on;
|
||||
u32 wrong_profile_notification;
|
||||
u32 bt_coex_supported_version;
|
||||
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_set_antenna_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_set_antenna_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
|
||||
|
4958
hal/btc/halbtc8723b2ant.c
Normal file
4958
hal/btc/halbtc8723b2ant.c
Normal file
File diff suppressed because it is too large
Load diff
217
hal/btc/halbtc8723b2ant.h
Normal file
217
hal/btc/halbtc8723b2ant.h
Normal file
|
@ -0,0 +1,217 @@
|
|||
|
||||
#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_vht;
|
||||
|
||||
u32 crc_err_cck;
|
||||
u32 crc_err_11g;
|
||||
u32 crc_err_11n;
|
||||
u32 crc_err_11n_vht;
|
||||
|
||||
u32 bt_coex_supported_version;
|
||||
|
||||
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
|
||||
|
68
hal/btc/halbtc8723bwifionly.c
Normal file
68
hal/btc/halbtc8723bwifionly.c
Normal file
|
@ -0,0 +1,68 @@
|
|||
#include "mp_precomp.h"
|
||||
|
||||
|
||||
VOID
|
||||
ex_hal8723b_wifi_only_hw_config(
|
||||
IN struct wifi_only_cfg *pwifionlycfg
|
||||
)
|
||||
{
|
||||
struct wifi_only_haldata *pwifionly_haldata = &pwifionlycfg->haldata_info;
|
||||
|
||||
|
||||
halwifionly_write1byte(pwifionlycfg, 0x778, 0x3); /* Set pta for wifi first priority, 0x1 need to reference pta table to determine wifi and bt priority */
|
||||
halwifionly_bitmaskwrite1byte(pwifionlycfg, 0x40, 0x20, 0x1);
|
||||
|
||||
/* Set Antenna path to Wifi */
|
||||
halwifionly_write2byte(pwifionlycfg, 0x0765, 0x8); /* Set pta for wifi first priority, 0x0 need to reference pta table to determine wifi and bt priority */
|
||||
halwifionly_write2byte(pwifionlycfg, 0x076e, 0xc);
|
||||
|
||||
halwifionly_write4byte(pwifionlycfg, 0x000006c0, 0xaaaaaaaa); /* pta table, 0xaaaaaaaa means wifi is higher priority than bt */
|
||||
halwifionly_write4byte(pwifionlycfg, 0x000006c4, 0xaaaaaaaa);
|
||||
|
||||
halwifionly_bitmaskwrite1byte(pwifionlycfg, 0x67, 0x20, 0x1); /* BT select s0/s1 is controlled by WiFi */
|
||||
|
||||
/* 0x948 setting */
|
||||
if (pwifionlycfg->chip_interface == WIFIONLY_INTF_PCI) {
|
||||
/* HP Foxconn NGFF at S0
|
||||
not sure HP pg correct or not(EEPROMBluetoothSingleAntPath), so here we just write
|
||||
0x948=0x280 for HP HW id NIC. */
|
||||
if (pwifionly_haldata->customer_id == CUSTOMER_HP_1) {
|
||||
halwifionly_write4byte(pwifionlycfg, 0x948, 0x280);
|
||||
halwifionly_phy_set_rf_reg(pwifionlycfg, 0, 0x1, 0xfffff, 0x0); /* WiFi TRx Mask off */
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (pwifionly_haldata->efuse_pg_antnum == 2) {
|
||||
halwifionly_write4byte(pwifionlycfg, 0x948, 0x0);
|
||||
} else {
|
||||
/* 3Attention !!! For 8723BU !!!!
|
||||
For 8723BU single ant case: jira [USB-1237]
|
||||
Because of 8723BU S1 has HW problem, we only can use S0 instead.
|
||||
Whether Efuse 0xc3 [6] is 0 or 1, we should always use S0 and write 0x948 to 80/280
|
||||
|
||||
--------------------------------------------------
|
||||
BT Team :
|
||||
When in Single Ant case, Reg[0x948] has two case : 0x80 or 0x200
|
||||
When in Two Ant case, Reg[0x948] has two case : 0x280 or 0x0
|
||||
Efuse 0xc3 [6] Antenna Path
|
||||
0xc3 [6] = 0 ==> S1 ==> 0x948 = 0/40/200
|
||||
0xc3 [6] = 1 ==> S0 ==> 0x948 = 80/240/280 */
|
||||
|
||||
if (pwifionlycfg->chip_interface == WIFIONLY_INTF_USB)
|
||||
halwifionly_write4byte(pwifionlycfg, 0x948, 0x80);
|
||||
else {
|
||||
if (pwifionly_haldata->efuse_pg_antpath == 0)
|
||||
halwifionly_write4byte(pwifionlycfg, 0x948, 0x0);
|
||||
else
|
||||
halwifionly_write4byte(pwifionlycfg, 0x948, 0x280);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* after 8723B F-cut, TRx Mask should be set when 0x948=0x0 or 0x280
|
||||
PHY_SetRFReg(Adapter, 0, 0x1, 0xfffff, 0x780); WiFi TRx Mask on */
|
||||
halwifionly_phy_set_rf_reg(pwifionlycfg, 0, 0x1, 0xfffff, 0x0); /*WiFi TRx Mask off */
|
||||
|
||||
}
|
8
hal/btc/halbtc8723bwifionly.h
Normal file
8
hal/btc/halbtc8723bwifionly.h
Normal file
|
@ -0,0 +1,8 @@
|
|||
#ifndef __INC_HAL8723BWIFIONLYHWCFG_H
|
||||
#define __INC_HAL8723BWIFIONLYHWCFG_H
|
||||
|
||||
VOID
|
||||
ex_hal8723b_wifi_only_hw_config(
|
||||
IN struct wifi_only_cfg *pwifionlycfg
|
||||
);
|
||||
#endif
|
6225
hal/btc/halbtc8723d1ant.c
Normal file
6225
hal/btc/halbtc8723d1ant.c
Normal file
File diff suppressed because it is too large
Load diff
413
hal/btc/halbtc8723d1ant.h
Normal file
413
hal/btc/halbtc8723d1ant.h
Normal file
|
@ -0,0 +1,413 @@
|
|||
|
||||
#if (BT_SUPPORT == 1 && COEX_SUPPORT == 1)
|
||||
|
||||
#if (RTL8723D_SUPPORT == 1)
|
||||
|
||||
/* *******************************************
|
||||
* The following is for 8723D 1ANT BT Co-exist definition
|
||||
* ******************************************* */
|
||||
#define BT_8723D_1ANT_COEX_DBG 0
|
||||
#define BT_AUTO_REPORT_ONLY_8723D_1ANT 1
|
||||
|
||||
#define BT_INFO_8723D_1ANT_B_FTP BIT(7)
|
||||
#define BT_INFO_8723D_1ANT_B_A2DP BIT(6)
|
||||
#define BT_INFO_8723D_1ANT_B_HID BIT(5)
|
||||
#define BT_INFO_8723D_1ANT_B_SCO_BUSY BIT(4)
|
||||
#define BT_INFO_8723D_1ANT_B_ACL_BUSY BIT(3)
|
||||
#define BT_INFO_8723D_1ANT_B_INQ_PAGE BIT(2)
|
||||
#define BT_INFO_8723D_1ANT_B_SCO_ESCO BIT(1)
|
||||
#define BT_INFO_8723D_1ANT_B_CONNECTION BIT(0)
|
||||
|
||||
#define BT_INFO_8723D_1ANT_A2DP_BASIC_RATE(_BT_INFO_EXT_) \
|
||||
(((_BT_INFO_EXT_&BIT(0))) ? true : false)
|
||||
|
||||
#define BTC_RSSI_COEX_THRESH_TOL_8723D_1ANT 2
|
||||
|
||||
#define BT_8723D_1ANT_WIFI_NOISY_THRESH 30 /* max: 255 */
|
||||
#define BT_8723D_1ANT_DEFAULT_ISOLATION 15 /* unit: dB */
|
||||
|
||||
|
||||
/* for Antenna detection */
|
||||
#define BT_8723D_1ANT_ANTDET_PSDTHRES_BACKGROUND 50
|
||||
#define BT_8723D_1ANT_ANTDET_PSDTHRES_2ANT_BADISOLATION 70
|
||||
#define BT_8723D_1ANT_ANTDET_PSDTHRES_2ANT_GOODISOLATION 55
|
||||
#define BT_8723D_1ANT_ANTDET_PSDTHRES_1ANT 35
|
||||
#define BT_8723D_1ANT_ANTDET_RETRY_INTERVAL 10 /* retry timer if ant det is fail, unit: second */
|
||||
#define BT_8723D_1ANT_ANTDET_SWEEPPOINT_DELAY 60000
|
||||
#define BT_8723D_1ANT_ANTDET_ENABLE 1
|
||||
#define BT_8723D_1ANT_ANTDET_BTTXTIME 100
|
||||
#define BT_8723D_1ANT_ANTDET_BTTXCHANNEL 39
|
||||
#define BT_8723D_1ANT_ANTDET_PSD_SWWEEPCOUNT 50
|
||||
|
||||
#define BT_8723D_1ANT_LTECOEX_INDIRECTREG_ACCESS_TIMEOUT 30000
|
||||
|
||||
enum bt_8723d_1ant_signal_state {
|
||||
BT_8723D_1ANT_SIG_STA_SET_TO_LOW = 0x0,
|
||||
BT_8723D_1ANT_SIG_STA_SET_BY_HW = 0x0,
|
||||
BT_8723D_1ANT_SIG_STA_SET_TO_HIGH = 0x1,
|
||||
BT_8723D_1ANT_SIG_STA_MAX
|
||||
};
|
||||
|
||||
enum bt_8723d_1ant_path_ctrl_owner {
|
||||
BT_8723D_1ANT_PCO_BTSIDE = 0x0,
|
||||
BT_8723D_1ANT_PCO_WLSIDE = 0x1,
|
||||
BT_8723D_1ANT_PCO_MAX
|
||||
};
|
||||
|
||||
enum bt_8723d_1ant_gnt_ctrl_type {
|
||||
BT_8723D_1ANT_GNT_TYPE_CTRL_BY_PTA = 0x0,
|
||||
BT_8723D_1ANT_GNT_TYPE_CTRL_BY_SW = 0x1,
|
||||
BT_8723D_1ANT_GNT_TYPE_MAX
|
||||
};
|
||||
|
||||
enum bt_8723d_1ant_gnt_ctrl_block {
|
||||
BT_8723D_1ANT_GNT_BLOCK_RFC_BB = 0x0,
|
||||
BT_8723D_1ANT_GNT_BLOCK_RFC = 0x1,
|
||||
BT_8723D_1ANT_GNT_BLOCK_BB = 0x2,
|
||||
BT_8723D_1ANT_GNT_BLOCK_MAX
|
||||
};
|
||||
|
||||
enum bt_8723d_1ant_lte_coex_table_type {
|
||||
BT_8723D_1ANT_CTT_WL_VS_LTE = 0x0,
|
||||
BT_8723D_1ANT_CTT_BT_VS_LTE = 0x1,
|
||||
BT_8723D_1ANT_CTT_MAX
|
||||
};
|
||||
|
||||
enum bt_8723d_1ant_lte_break_table_type {
|
||||
BT_8723D_1ANT_LBTT_WL_BREAK_LTE = 0x0,
|
||||
BT_8723D_1ANT_LBTT_BT_BREAK_LTE = 0x1,
|
||||
BT_8723D_1ANT_LBTT_LTE_BREAK_WL = 0x2,
|
||||
BT_8723D_1ANT_LBTT_LTE_BREAK_BT = 0x3,
|
||||
BT_8723D_1ANT_LBTT_MAX
|
||||
};
|
||||
|
||||
enum bt_info_src_8723d_1ant {
|
||||
BT_INFO_SRC_8723D_1ANT_WIFI_FW = 0x0,
|
||||
BT_INFO_SRC_8723D_1ANT_BT_RSP = 0x1,
|
||||
BT_INFO_SRC_8723D_1ANT_BT_ACTIVE_SEND = 0x2,
|
||||
BT_INFO_SRC_8723D_1ANT_MAX
|
||||
};
|
||||
|
||||
enum bt_8723d_1ant_bt_status {
|
||||
BT_8723D_1ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0,
|
||||
BT_8723D_1ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
|
||||
BT_8723D_1ANT_BT_STATUS_INQ_PAGE = 0x2,
|
||||
BT_8723D_1ANT_BT_STATUS_ACL_BUSY = 0x3,
|
||||
BT_8723D_1ANT_BT_STATUS_SCO_BUSY = 0x4,
|
||||
BT_8723D_1ANT_BT_STATUS_ACL_SCO_BUSY = 0x5,
|
||||
BT_8723D_1ANT_BT_STATUS_MAX
|
||||
};
|
||||
|
||||
enum bt_8723d_1ant_wifi_status {
|
||||
BT_8723D_1ANT_WIFI_STATUS_NON_CONNECTED_IDLE = 0x0,
|
||||
BT_8723D_1ANT_WIFI_STATUS_NON_CONNECTED_ASSO_AUTH_SCAN = 0x1,
|
||||
BT_8723D_1ANT_WIFI_STATUS_CONNECTED_SCAN = 0x2,
|
||||
BT_8723D_1ANT_WIFI_STATUS_CONNECTED_SPECIFIC_PKT = 0x3,
|
||||
BT_8723D_1ANT_WIFI_STATUS_CONNECTED_IDLE = 0x4,
|
||||
BT_8723D_1ANT_WIFI_STATUS_CONNECTED_BUSY = 0x5,
|
||||
BT_8723D_1ANT_WIFI_STATUS_MAX
|
||||
};
|
||||
|
||||
enum bt_8723d_1ant_coex_algo {
|
||||
BT_8723D_1ANT_COEX_ALGO_UNDEFINED = 0x0,
|
||||
BT_8723D_1ANT_COEX_ALGO_SCO = 0x1,
|
||||
BT_8723D_1ANT_COEX_ALGO_HID = 0x2,
|
||||
BT_8723D_1ANT_COEX_ALGO_A2DP = 0x3,
|
||||
BT_8723D_1ANT_COEX_ALGO_A2DP_PANHS = 0x4,
|
||||
BT_8723D_1ANT_COEX_ALGO_PANEDR = 0x5,
|
||||
BT_8723D_1ANT_COEX_ALGO_PANHS = 0x6,
|
||||
BT_8723D_1ANT_COEX_ALGO_PANEDR_A2DP = 0x7,
|
||||
BT_8723D_1ANT_COEX_ALGO_PANEDR_HID = 0x8,
|
||||
BT_8723D_1ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x9,
|
||||
BT_8723D_1ANT_COEX_ALGO_HID_A2DP = 0xa,
|
||||
BT_8723D_1ANT_COEX_ALGO_MAX = 0xb,
|
||||
};
|
||||
|
||||
enum bt_8723d_1ant_phase {
|
||||
BT_8723D_1ANT_PHASE_COEX_INIT = 0x0,
|
||||
BT_8723D_1ANT_PHASE_WLANONLY_INIT = 0x1,
|
||||
BT_8723D_1ANT_PHASE_WLAN_OFF = 0x2,
|
||||
BT_8723D_1ANT_PHASE_2G_RUNTIME = 0x3,
|
||||
BT_8723D_1ANT_PHASE_5G_RUNTIME = 0x4,
|
||||
BT_8723D_1ANT_PHASE_BTMPMODE = 0x5,
|
||||
BT_8723D_1ANT_PHASE_ANTENNA_DET = 0x6,
|
||||
BT_8723D_1ANT_PHASE_COEX_POWERON = 0x7,
|
||||
BT_8723D_1ANT_PHASE_MAX
|
||||
};
|
||||
|
||||
enum bt_8723d_1ant_Scoreboard {
|
||||
BT_8723D_1ANT_SCOREBOARD_ACTIVE = BIT(0),
|
||||
BT_8723D_1ANT_SCOREBOARD_ONOFF = BIT(1),
|
||||
BT_8723D_1ANT_SCOREBOARD_SCAN = BIT(2),
|
||||
BT_8723D_1ANT_SCOREBOARD_UNDERTEST = BIT(3),
|
||||
BT_8723D_1ANT_SCOREBOARD_WLBUSY = BIT(6)
|
||||
};
|
||||
|
||||
struct coex_dm_8723d_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 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_8723d_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;
|
||||
boolean is_hiPri_rx_overhead;
|
||||
s8 bt_rssi;
|
||||
boolean bt_tx_rx_mask;
|
||||
u8 pre_bt_rssi_state;
|
||||
u8 pre_wifi_rssi_state[4];
|
||||
u8 bt_info_c2h[BT_INFO_SRC_8723D_1ANT_MAX][10];
|
||||
u32 bt_info_c2h_cnt[BT_INFO_SRC_8723D_1ANT_MAX];
|
||||
boolean bt_whck_test;
|
||||
boolean c2h_bt_inquiry_page;
|
||||
boolean c2h_bt_remote_name_req;
|
||||
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;
|
||||
u8 bt_info_ext2;
|
||||
u32 pop_event_cnt;
|
||||
u8 scan_ap_num;
|
||||
|
||||
u32 crc_ok_cck;
|
||||
u32 crc_ok_11g;
|
||||
u32 crc_ok_11n;
|
||||
u32 crc_ok_11n_vht;
|
||||
|
||||
u32 crc_err_cck;
|
||||
u32 crc_err_11g;
|
||||
u32 crc_err_11n;
|
||||
u32 crc_err_11n_vht;
|
||||
|
||||
boolean cck_lock;
|
||||
boolean pre_ccklock;
|
||||
boolean cck_ever_lock;
|
||||
u8 coex_table_type;
|
||||
|
||||
boolean force_lps_on;
|
||||
|
||||
boolean concurrent_rx_mode_on;
|
||||
|
||||
u16 score_board;
|
||||
u8 isolation_btween_wb; /* 0~ 50 */
|
||||
|
||||
u8 a2dp_bit_pool;
|
||||
u8 cut_version;
|
||||
boolean acl_busy;
|
||||
boolean bt_create_connection;
|
||||
|
||||
u32 bt_coex_supported_feature;
|
||||
u32 bt_coex_supported_version;
|
||||
|
||||
u8 bt_ble_scan_type;
|
||||
u32 bt_ble_scan_para[3];
|
||||
|
||||
boolean run_time_state;
|
||||
boolean freeze_coexrun_by_btinfo;
|
||||
|
||||
boolean is_A2DP_3M;
|
||||
boolean voice_over_HOGP;
|
||||
u8 bt_info;
|
||||
boolean is_autoslot;
|
||||
u8 forbidden_slot;
|
||||
u8 hid_busy_num;
|
||||
u8 hid_pair_cnt;
|
||||
|
||||
u32 cnt_RemoteNameReq;
|
||||
u32 cnt_setupLink;
|
||||
u32 cnt_ReInit;
|
||||
u32 cnt_IgnWlanAct;
|
||||
u32 cnt_Page;
|
||||
u32 cnt_RoleSwitch;
|
||||
|
||||
u16 bt_reg_vendor_ac;
|
||||
u16 bt_reg_vendor_ae;
|
||||
|
||||
boolean is_setupLink;
|
||||
u8 wl_noisy_level;
|
||||
u32 gnt_error_cnt;
|
||||
|
||||
u8 bt_afh_map[10];
|
||||
u8 bt_relink_downcount;
|
||||
boolean is_tdma_btautoslot;
|
||||
boolean is_tdma_btautoslot_hang;
|
||||
};
|
||||
|
||||
#define BT_8723D_1ANT_ANTDET_PSD_POINTS 256 /* MAX:1024 */
|
||||
#define BT_8723D_1ANT_ANTDET_PSD_AVGNUM 1 /* MAX:3 */
|
||||
#define BT_8723D_1ANT_ANTDET_BUF_LEN 16
|
||||
|
||||
struct psdscan_sta_8723d_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_8723D_1ANT_ANTDET_BUF_LEN];
|
||||
u8 ant_det_peak_freq[BT_8723D_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_max_value2;
|
||||
u32 psd_avg_value; /* filter loop_max_value that below BT_8723D_1ANT_ANTDET_PSDTHRES_1ANT, and average the rest*/
|
||||
u32 psd_loop_max_value[BT_8723D_1ANT_ANTDET_PSD_SWWEEPCOUNT]; /*max value in each loop */
|
||||
u32 psd_start_base;
|
||||
u32 psd_avg_num; /* 1/8/16/32 */
|
||||
u32 psd_gen_count;
|
||||
boolean is_AntDet_running;
|
||||
boolean is_psd_show_max_only;
|
||||
};
|
||||
|
||||
/* *******************************************
|
||||
* The following is interface which will notify coex module.
|
||||
* ******************************************* */
|
||||
void ex_halbtc8723d1ant_power_on_setting(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8723d1ant_pre_load_firmware(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8723d1ant_init_hw_config(IN struct btc_coexist *btcoexist,
|
||||
IN boolean wifi_only);
|
||||
void ex_halbtc8723d1ant_init_coex_dm(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8723d1ant_ips_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8723d1ant_lps_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8723d1ant_scan_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8723d1ant_connect_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8723d1ant_media_status_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8723d1ant_specific_packet_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8723d1ant_bt_info_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 *tmp_buf, IN u8 length);
|
||||
void ex_halbtc8723d1ant_rf_status_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8723d1ant_halt_notify(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8723d1ant_pnp_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 pnp_state);
|
||||
void ex_halbtc8723d1ant_coex_dm_reset(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8723d1ant_periodical(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8723d1ant_set_antenna_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8723d1ant_display_coex_info(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8723d1ant_antenna_detection(IN struct btc_coexist *btcoexist,
|
||||
IN u32 cent_freq, IN u32 offset, IN u32 span, IN u32 seconds);
|
||||
void ex_halbtc8723d1ant_antenna_isolation(IN struct btc_coexist *btcoexist,
|
||||
IN u32 cent_freq, IN u32 offset, IN u32 span, IN u32 seconds);
|
||||
|
||||
void ex_halbtc8723d1ant_psd_scan(IN struct btc_coexist *btcoexist,
|
||||
IN u32 cent_freq, IN u32 offset, IN u32 span, IN u32 seconds);
|
||||
void ex_halbtc8723d1ant_display_ant_detection(IN struct btc_coexist *btcoexist);
|
||||
|
||||
#else
|
||||
#define ex_halbtc8723d1ant_power_on_setting(btcoexist)
|
||||
#define ex_halbtc8723d1ant_pre_load_firmware(btcoexist)
|
||||
#define ex_halbtc8723d1ant_init_hw_config(btcoexist, wifi_only)
|
||||
#define ex_halbtc8723d1ant_init_coex_dm(btcoexist)
|
||||
#define ex_halbtc8723d1ant_ips_notify(btcoexist, type)
|
||||
#define ex_halbtc8723d1ant_lps_notify(btcoexist, type)
|
||||
#define ex_halbtc8723d1ant_scan_notify(btcoexist, type)
|
||||
#define ex_halbtc8723d1ant_connect_notify(btcoexist, type)
|
||||
#define ex_halbtc8723d1ant_media_status_notify(btcoexist, type)
|
||||
#define ex_halbtc8723d1ant_specific_packet_notify(btcoexist, type)
|
||||
#define ex_halbtc8723d1ant_bt_info_notify(btcoexist, tmp_buf, length)
|
||||
#define ex_halbtc8723d1ant_rf_status_notify(btcoexist, type)
|
||||
#define ex_halbtc8723d1ant_halt_notify(btcoexist)
|
||||
#define ex_halbtc8723d1ant_pnp_notify(btcoexist, pnp_state)
|
||||
#define ex_halbtc8723d1ant_coex_dm_reset(btcoexist)
|
||||
#define ex_halbtc8723d1ant_periodical(btcoexist)
|
||||
#define ex_halbtc8723d1ant_display_coex_info(btcoexist)
|
||||
#define ex_halbtc8723d1ant_set_antenna_notify(btcoexist, type)
|
||||
#define ex_halbtc8723d1ant_antenna_detection(btcoexist, cent_freq, offset, span, seconds)
|
||||
#define ex_halbtc8723d1ant_antenna_isolation(btcoexist, cent_freq, offset, span, seconds)
|
||||
#define ex_halbtc8723d1ant_psd_scan(btcoexist, cent_freq, offset, span, seconds)
|
||||
#define ex_halbtc8723d1ant_display_ant_detection(btcoexist)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
6774
hal/btc/halbtc8723d2ant.c
Normal file
6774
hal/btc/halbtc8723d2ant.c
Normal file
File diff suppressed because it is too large
Load diff
418
hal/btc/halbtc8723d2ant.h
Normal file
418
hal/btc/halbtc8723d2ant.h
Normal file
|
@ -0,0 +1,418 @@
|
|||
|
||||
#if (BT_SUPPORT == 1 && COEX_SUPPORT == 1)
|
||||
|
||||
#if (RTL8723D_SUPPORT == 1)
|
||||
|
||||
/* *******************************************
|
||||
* The following is for 8723D 2Ant BT Co-exist definition
|
||||
* ******************************************* */
|
||||
#define BT_8723D_2ANT_COEX_DBG 0
|
||||
#define BT_AUTO_REPORT_ONLY_8723D_2ANT 1
|
||||
|
||||
|
||||
#define BT_INFO_8723D_2ANT_B_FTP BIT(7)
|
||||
#define BT_INFO_8723D_2ANT_B_A2DP BIT(6)
|
||||
#define BT_INFO_8723D_2ANT_B_HID BIT(5)
|
||||
#define BT_INFO_8723D_2ANT_B_SCO_BUSY BIT(4)
|
||||
#define BT_INFO_8723D_2ANT_B_ACL_BUSY BIT(3)
|
||||
#define BT_INFO_8723D_2ANT_B_INQ_PAGE BIT(2)
|
||||
#define BT_INFO_8723D_2ANT_B_SCO_ESCO BIT(1)
|
||||
#define BT_INFO_8723D_2ANT_B_CONNECTION BIT(0)
|
||||
|
||||
#define BTC_RSSI_COEX_THRESH_TOL_8723D_2ANT 2
|
||||
|
||||
|
||||
#define BT_8723D_2ANT_WIFI_RSSI_COEXSWITCH_THRES1 80 /* unit: % WiFi RSSI Threshold for 2-Ant free-run/2-Ant TDMA translation, default = 42 */
|
||||
#define BT_8723D_2ANT_BT_RSSI_COEXSWITCH_THRES1 80 /* unit: % BT RSSI Threshold for 2-Ant free-run/2-Ant TDMA translation, default = 46 */
|
||||
#define BT_8723D_2ANT_WIFI_RSSI_COEXSWITCH_THRES2 80 /* unit: % WiFi RSSI Threshold for 1-Ant TDMA/1-Ant PS-TDMA translation, default = 42 */
|
||||
#define BT_8723D_2ANT_BT_RSSI_COEXSWITCH_THRES2 80 /* unit: % BT RSSI Threshold for 1-Ant TDMA/1-Ant PS-TDMA translation, default = 46 */
|
||||
#define BT_8723D_2ANT_DEFAULT_ISOLATION 15 /* unit: dB */
|
||||
#define BT_8723D_2ANT_WIFI_MAX_TX_POWER 15 /* unit: dBm */
|
||||
#define BT_8723D_2ANT_BT_MAX_TX_POWER 3 /* unit: dBm */
|
||||
#define BT_8723D_2ANT_WIFI_SIR_THRES1 -15 /* unit: dB */
|
||||
#define BT_8723D_2ANT_WIFI_SIR_THRES2 -30 /* unit: dB */
|
||||
#define BT_8723D_2ANT_BT_SIR_THRES1 -15 /* unit: dB */
|
||||
#define BT_8723D_2ANT_BT_SIR_THRES2 -30 /* unit: dB */
|
||||
|
||||
|
||||
/* for Antenna detection */
|
||||
#define BT_8723D_2ANT_ANTDET_PSDTHRES_BACKGROUND 50
|
||||
#define BT_8723D_2ANT_ANTDET_PSDTHRES_2ANT_BADISOLATION 70
|
||||
#define BT_8723D_2ANT_ANTDET_PSDTHRES_2ANT_GOODISOLATION 52
|
||||
#define BT_8723D_2ANT_ANTDET_PSDTHRES_1ANT 40
|
||||
#define BT_8723D_2ANT_ANTDET_RETRY_INTERVAL 10 /* retry timer if ant det is fail, unit: second */
|
||||
#define BT_8723D_2ANT_ANTDET_SWEEPPOINT_DELAY 60000
|
||||
#define BT_8723D_2ANT_ANTDET_ENABLE 1
|
||||
#define BT_8723D_2ANT_ANTDET_BTTXTIME 100
|
||||
#define BT_8723D_2ANT_ANTDET_BTTXCHANNEL 39
|
||||
#define BT_8723D_2ANT_ANTDET_PSD_SWWEEPCOUNT 50
|
||||
|
||||
|
||||
#define BT_8723D_2ANT_LTECOEX_INDIRECTREG_ACCESS_TIMEOUT 30000
|
||||
|
||||
enum bt_8723d_2ant_signal_state {
|
||||
BT_8723D_2ANT_SIG_STA_SET_TO_LOW = 0x0,
|
||||
BT_8723D_2ANT_SIG_STA_SET_BY_HW = 0x0,
|
||||
BT_8723D_2ANT_SIG_STA_SET_TO_HIGH = 0x1,
|
||||
BT_8723D_2ANT_SIG_STA_MAX
|
||||
};
|
||||
|
||||
enum bt_8723d_2ant_path_ctrl_owner {
|
||||
BT_8723D_2ANT_PCO_BTSIDE = 0x0,
|
||||
BT_8723D_2ANT_PCO_WLSIDE = 0x1,
|
||||
BT_8723D_2ANT_PCO_MAX
|
||||
};
|
||||
|
||||
enum bt_8723d_2ant_gnt_ctrl_type {
|
||||
BT_8723D_2ANT_GNT_TYPE_CTRL_BY_PTA = 0x0,
|
||||
BT_8723D_2ANT_GNT_TYPE_CTRL_BY_SW = 0x1,
|
||||
BT_8723D_2ANT_GNT_TYPE_MAX
|
||||
};
|
||||
|
||||
enum bt_8723d_2ant_gnt_ctrl_block {
|
||||
BT_8723D_2ANT_GNT_BLOCK_RFC_BB = 0x0,
|
||||
BT_8723D_2ANT_GNT_BLOCK_RFC = 0x1,
|
||||
BT_8723D_2ANT_GNT_BLOCK_BB = 0x2,
|
||||
BT_8723D_2ANT_GNT_BLOCK_MAX
|
||||
};
|
||||
|
||||
enum bt_8723d_2ant_lte_coex_table_type {
|
||||
BT_8723D_2ANT_CTT_WL_VS_LTE = 0x0,
|
||||
BT_8723D_2ANT_CTT_BT_VS_LTE = 0x1,
|
||||
BT_8723D_2ANT_CTT_MAX
|
||||
};
|
||||
|
||||
enum bt_8723d_2ant_lte_break_table_type {
|
||||
BT_8723D_2ANT_LBTT_WL_BREAK_LTE = 0x0,
|
||||
BT_8723D_2ANT_LBTT_BT_BREAK_LTE = 0x1,
|
||||
BT_8723D_2ANT_LBTT_LTE_BREAK_WL = 0x2,
|
||||
BT_8723D_2ANT_LBTT_LTE_BREAK_BT = 0x3,
|
||||
BT_8723D_2ANT_LBTT_MAX
|
||||
};
|
||||
|
||||
enum bt_info_src_8723d_2ant {
|
||||
BT_INFO_SRC_8723D_2ANT_WIFI_FW = 0x0,
|
||||
BT_INFO_SRC_8723D_2ANT_BT_RSP = 0x1,
|
||||
BT_INFO_SRC_8723D_2ANT_BT_ACTIVE_SEND = 0x2,
|
||||
BT_INFO_SRC_8723D_2ANT_MAX
|
||||
};
|
||||
|
||||
enum bt_8723d_2ant_bt_status {
|
||||
BT_8723D_2ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0,
|
||||
BT_8723D_2ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
|
||||
BT_8723D_2ANT_BT_STATUS_INQ_PAGE = 0x2,
|
||||
BT_8723D_2ANT_BT_STATUS_ACL_BUSY = 0x3,
|
||||
BT_8723D_2ANT_BT_STATUS_SCO_BUSY = 0x4,
|
||||
BT_8723D_2ANT_BT_STATUS_ACL_SCO_BUSY = 0x5,
|
||||
BT_8723D_2ANT_BT_STATUS_MAX
|
||||
};
|
||||
|
||||
enum bt_8723d_2ant_coex_algo {
|
||||
BT_8723D_2ANT_COEX_ALGO_UNDEFINED = 0x0,
|
||||
BT_8723D_2ANT_COEX_ALGO_SCO = 0x1,
|
||||
BT_8723D_2ANT_COEX_ALGO_HID = 0x2,
|
||||
BT_8723D_2ANT_COEX_ALGO_A2DP = 0x3,
|
||||
BT_8723D_2ANT_COEX_ALGO_A2DP_PANHS = 0x4,
|
||||
BT_8723D_2ANT_COEX_ALGO_PANEDR = 0x5,
|
||||
BT_8723D_2ANT_COEX_ALGO_PANHS = 0x6,
|
||||
BT_8723D_2ANT_COEX_ALGO_PANEDR_A2DP = 0x7,
|
||||
BT_8723D_2ANT_COEX_ALGO_PANEDR_HID = 0x8,
|
||||
BT_8723D_2ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x9,
|
||||
BT_8723D_2ANT_COEX_ALGO_HID_A2DP = 0xa,
|
||||
BT_8723D_2ANT_COEX_ALGO_NOPROFILEBUSY = 0xb,
|
||||
BT_8723D_2ANT_COEX_ALGO_MAX
|
||||
};
|
||||
|
||||
enum bt_8723d_2ant_phase {
|
||||
BT_8723D_2ANT_PHASE_COEX_INIT = 0x0,
|
||||
BT_8723D_2ANT_PHASE_WLANONLY_INIT = 0x1,
|
||||
BT_8723D_2ANT_PHASE_WLAN_OFF = 0x2,
|
||||
BT_8723D_2ANT_PHASE_2G_RUNTIME = 0x3,
|
||||
BT_8723D_2ANT_PHASE_5G_RUNTIME = 0x4,
|
||||
BT_8723D_2ANT_PHASE_BTMPMODE = 0x5,
|
||||
BT_8723D_2ANT_PHASE_ANTENNA_DET = 0x6,
|
||||
BT_8723D_2ANT_PHASE_COEX_POWERON = 0x7,
|
||||
BT_8723D_2ANT_PHASE_MAX
|
||||
};
|
||||
|
||||
enum bt_8723d_2ant_Scoreboard {
|
||||
BT_8723D_2ANT_SCOREBOARD_ACTIVE = BIT(0),
|
||||
BT_8723D_2ANT_SCOREBOARD_ONOFF = BIT(1),
|
||||
BT_8723D_2ANT_SCOREBOARD_SCAN = BIT(2),
|
||||
BT_8723D_2ANT_SCOREBOARD_UNDERTEST = BIT(3),
|
||||
BT_8723D_2ANT_SCOREBOARD_WLBUSY = BIT(6)
|
||||
};
|
||||
|
||||
|
||||
|
||||
struct coex_dm_8723d_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 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;
|
||||
u32 arp_cnt;
|
||||
|
||||
u8 pre_ant_pos_type;
|
||||
u8 cur_ant_pos_type;
|
||||
};
|
||||
|
||||
struct coex_sta_8723d_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;
|
||||
boolean is_hiPri_rx_overhead;
|
||||
u8 bt_rssi;
|
||||
boolean bt_tx_rx_mask;
|
||||
u8 pre_bt_rssi_state;
|
||||
u8 pre_wifi_rssi_state[4];
|
||||
u8 bt_info_c2h[BT_INFO_SRC_8723D_2ANT_MAX][10];
|
||||
u32 bt_info_c2h_cnt[BT_INFO_SRC_8723D_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;
|
||||
u8 bt_info_ext2;
|
||||
u32 pop_event_cnt;
|
||||
u8 scan_ap_num;
|
||||
|
||||
u32 crc_ok_cck;
|
||||
u32 crc_ok_11g;
|
||||
u32 crc_ok_11n;
|
||||
u32 crc_ok_11n_vht;
|
||||
|
||||
u32 crc_err_cck;
|
||||
u32 crc_err_11g;
|
||||
u32 crc_err_11n;
|
||||
u32 crc_err_11n_vht;
|
||||
|
||||
boolean cck_lock;
|
||||
boolean pre_ccklock;
|
||||
boolean cck_ever_lock;
|
||||
u8 coex_table_type;
|
||||
boolean force_lps_on;
|
||||
|
||||
u8 dis_ver_info_cnt;
|
||||
|
||||
u8 a2dp_bit_pool;
|
||||
u8 cut_version;
|
||||
|
||||
boolean concurrent_rx_mode_on;
|
||||
|
||||
u16 score_board;
|
||||
u8 isolation_btween_wb; /* 0~ 50 */
|
||||
u8 wifi_coex_thres;
|
||||
u8 bt_coex_thres;
|
||||
u8 wifi_coex_thres2;
|
||||
u8 bt_coex_thres2;
|
||||
|
||||
u8 num_of_profile;
|
||||
boolean acl_busy;
|
||||
boolean bt_create_connection;
|
||||
boolean wifi_is_high_pri_task;
|
||||
u32 specific_pkt_period_cnt;
|
||||
u32 bt_coex_supported_feature;
|
||||
u32 bt_coex_supported_version;
|
||||
|
||||
u8 bt_ble_scan_type;
|
||||
u32 bt_ble_scan_para[3];
|
||||
|
||||
boolean run_time_state;
|
||||
boolean freeze_coexrun_by_btinfo;
|
||||
|
||||
boolean is_A2DP_3M;
|
||||
boolean voice_over_HOGP;
|
||||
u8 bt_info;
|
||||
boolean is_autoslot;
|
||||
u8 forbidden_slot;
|
||||
u8 hid_busy_num;
|
||||
u8 hid_pair_cnt;
|
||||
|
||||
u32 cnt_RemoteNameReq;
|
||||
u32 cnt_setupLink;
|
||||
u32 cnt_ReInit;
|
||||
u32 cnt_IgnWlanAct;
|
||||
u32 cnt_Page;
|
||||
u32 cnt_RoleSwitch;
|
||||
|
||||
u16 bt_reg_vendor_ac;
|
||||
u16 bt_reg_vendor_ae;
|
||||
|
||||
boolean is_setupLink;
|
||||
boolean wl_noisy_level;
|
||||
u32 gnt_error_cnt;
|
||||
|
||||
u8 bt_afh_map[10];
|
||||
u8 bt_relink_downcount;
|
||||
boolean is_tdma_btautoslot;
|
||||
boolean is_tdma_btautoslot_hang;
|
||||
};
|
||||
|
||||
#define BT_8723D_2ANT_ANTDET_PSD_POINTS 256 /* MAX:1024 */
|
||||
#define BT_8723D_2ANT_ANTDET_PSD_AVGNUM 1 /* MAX:3 */
|
||||
#define BT_8723D_2ANT_ANTDET_BUF_LEN 16
|
||||
|
||||
struct psdscan_sta_8723d_2ant {
|
||||
|
||||
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_8723D_2ANT_ANTDET_BUF_LEN];
|
||||
u8 ant_det_peak_freq[BT_8723D_2ANT_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_max_value2;
|
||||
u32 psd_avg_value; /* filter loop_max_value that below BT_8723D_1ANT_ANTDET_PSDTHRES_1ANT, and average the rest*/
|
||||
u32 psd_loop_max_value[BT_8723D_2ANT_ANTDET_PSD_SWWEEPCOUNT]; /*max value in each loop */
|
||||
u32 psd_start_base;
|
||||
u32 psd_avg_num; /* 1/8/16/32 */
|
||||
u32 psd_gen_count;
|
||||
boolean is_AntDet_running;
|
||||
boolean is_psd_show_max_only;
|
||||
};
|
||||
|
||||
|
||||
/* *******************************************
|
||||
* The following is interface which will notify coex module.
|
||||
* ******************************************* */
|
||||
void ex_halbtc8723d2ant_power_on_setting(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8723d2ant_pre_load_firmware(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8723d2ant_init_hw_config(IN struct btc_coexist *btcoexist,
|
||||
IN boolean wifi_only);
|
||||
void ex_halbtc8723d2ant_init_coex_dm(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8723d2ant_ips_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8723d2ant_lps_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8723d2ant_scan_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8723d2ant_connect_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8723d2ant_media_status_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8723d2ant_specific_packet_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8723d2ant_bt_info_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 *tmp_buf, IN u8 length);
|
||||
void ex_halbtc8723d2ant_rf_status_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8723d2ant_halt_notify(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8723d2ant_pnp_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 pnp_state);
|
||||
void ex_halbtc8723d2ant_set_antenna_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8723d2ant_periodical(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8723d2ant_display_coex_info(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8723d2ant_antenna_detection(IN struct btc_coexist *btcoexist,
|
||||
IN u32 cent_freq, IN u32 offset, IN u32 span, IN u32 seconds);
|
||||
void ex_halbtc8723d2ant_display_ant_detection(IN struct btc_coexist *btcoexist);
|
||||
|
||||
|
||||
#else
|
||||
#define ex_halbtc8723d2ant_power_on_setting(btcoexist)
|
||||
#define ex_halbtc8723d2ant_pre_load_firmware(btcoexist)
|
||||
#define ex_halbtc8723d2ant_init_hw_config(btcoexist, wifi_only)
|
||||
#define ex_halbtc8723d2ant_init_coex_dm(btcoexist)
|
||||
#define ex_halbtc8723d2ant_ips_notify(btcoexist, type)
|
||||
#define ex_halbtc8723d2ant_lps_notify(btcoexist, type)
|
||||
#define ex_halbtc8723d2ant_scan_notify(btcoexist, type)
|
||||
#define ex_halbtc8723d2ant_connect_notify(btcoexist, type)
|
||||
#define ex_halbtc8723d2ant_media_status_notify(btcoexist, type)
|
||||
#define ex_halbtc8723d2ant_specific_packet_notify(btcoexist, type)
|
||||
#define ex_halbtc8723d2ant_bt_info_notify(btcoexist, tmp_buf, length)
|
||||
#define ex_halbtc8723d2ant_rf_status_notify(btcoexist, type)
|
||||
#define ex_halbtc8723d2ant_halt_notify(btcoexist)
|
||||
#define ex_halbtc8723d2ant_pnp_notify(btcoexist, pnp_state)
|
||||
#define ex_halbtc8723d2ant_periodical(btcoexist)
|
||||
#define ex_halbtc8723d2ant_display_coex_info(btcoexist)
|
||||
#define ex_halbtc8723d2ant_set_antenna_notify(btcoexist, type)
|
||||
#define ex_halbtc8723d2ant_display_ant_detection(btcoexist)
|
||||
#define ex_halbtc8723d2ant_antenna_detection(btcoexist, cent_freq, offset, span, seconds)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
3461
hal/btc/halbtc8812a1ant.c
Normal file
3461
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
|
5624
hal/btc/halbtc8812a2ant.c
Normal file
5624
hal/btc/halbtc8812a2ant.c
Normal file
File diff suppressed because it is too large
Load diff
227
hal/btc/halbtc8812a2ant.h
Normal file
227
hal/btc/halbtc8812a2ant.h
Normal file
|
@ -0,0 +1,227 @@
|
|||
|
||||
#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
|
||||
#define NOISY_AP_NUM_THRESH_8812A 50
|
||||
|
||||
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;
|
||||
|
||||
boolean cur_enable_pta;
|
||||
boolean pre_enable_pta;
|
||||
};
|
||||
|
||||
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;
|
||||
u8 scan_ap_num;
|
||||
boolean pre_bt_disabled;
|
||||
u32 pre_bt_info_c2h_cnt_bt_rsp;
|
||||
u32 pre_bt_info_c2h_cnt_bt_send;
|
||||
boolean force_lps_on;
|
||||
u32 bt_coex_supported_version;
|
||||
|
||||
u32 crc_ok_cck;
|
||||
u32 crc_ok_11g;
|
||||
u32 crc_ok_11n;
|
||||
u32 crc_ok_11n_vht;
|
||||
|
||||
u32 crc_err_cck;
|
||||
u32 crc_err_11g;
|
||||
u32 crc_err_11n;
|
||||
u32 crc_err_11n_vht;
|
||||
};
|
||||
|
||||
/* *******************************************
|
||||
* 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);
|
||||
void ex_halbtc8812a2ant_pta_off_on_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 bt_status);
|
||||
|
||||
#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)
|
||||
#define ex_halbtc8812a2ant_pta_off_on_notify(btcoexist, bt_status)
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
3289
hal/btc/halbtc8821a1ant.c
Normal file
3289
hal/btc/halbtc8821a1ant.c
Normal file
File diff suppressed because it is too large
Load diff
214
hal/btc/halbtc8821a1ant.h
Normal file
214
hal/btc/halbtc8821a1ant.h
Normal file
|
@ -0,0 +1,214 @@
|
|||
|
||||
#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;
|
||||
|
||||
u32 crc_ok_cck;
|
||||
u32 crc_ok_11g;
|
||||
u32 crc_ok_11n;
|
||||
u32 crc_ok_11n_vht;
|
||||
|
||||
u32 crc_err_cck;
|
||||
u32 crc_err_11g;
|
||||
u32 crc_err_11n;
|
||||
u32 crc_err_11n_vht;
|
||||
|
||||
u32 bt_coex_supported_version;
|
||||
u8 cut_version;
|
||||
u8 bt_rssi;
|
||||
u8 scan_ap_num;
|
||||
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_switchband_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_switchband_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
|
||||
|
4637
hal/btc/halbtc8821a2ant.c
Normal file
4637
hal/btc/halbtc8821a2ant.c
Normal file
File diff suppressed because it is too large
Load diff
211
hal/btc/halbtc8821a2ant.h
Normal file
211
hal/btc/halbtc8821a2ant.h
Normal file
|
@ -0,0 +1,211 @@
|
|||
|
||||
#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;
|
||||
u8 scan_ap_num;
|
||||
u32 crc_ok_cck;
|
||||
u32 crc_ok_11g;
|
||||
u32 crc_ok_11n;
|
||||
u32 crc_ok_11n_vht;
|
||||
|
||||
u32 crc_err_cck;
|
||||
u32 crc_err_11g;
|
||||
u32 crc_err_11n;
|
||||
u32 crc_err_11n_vht;
|
||||
|
||||
u32 bt_coex_supported_version;
|
||||
u8 cut_version;
|
||||
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_switchband_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_switchband_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
|
||||
|
6674
hal/btc/halbtc8821c1ant.c
Normal file
6674
hal/btc/halbtc8821c1ant.c
Normal file
File diff suppressed because it is too large
Load diff
473
hal/btc/halbtc8821c1ant.h
Normal file
473
hal/btc/halbtc8821c1ant.h
Normal file
|
@ -0,0 +1,473 @@
|
|||
|
||||
#if (BT_SUPPORT == 1 && COEX_SUPPORT == 1)
|
||||
|
||||
#if (RTL8821C_SUPPORT == 1)
|
||||
|
||||
/* *******************************************
|
||||
* The following is for 8821C 1ANT BT Co-exist definition
|
||||
* ******************************************* */
|
||||
#define BT_8821C_1ANT_COEX_DBG 0
|
||||
#define BT_AUTO_REPORT_ONLY_8821C_1ANT 1
|
||||
|
||||
#define BT_INFO_8821C_1ANT_B_FTP BIT(7)
|
||||
#define BT_INFO_8821C_1ANT_B_A2DP BIT(6)
|
||||
#define BT_INFO_8821C_1ANT_B_HID BIT(5)
|
||||
#define BT_INFO_8821C_1ANT_B_SCO_BUSY BIT(4)
|
||||
#define BT_INFO_8821C_1ANT_B_ACL_BUSY BIT(3)
|
||||
#define BT_INFO_8821C_1ANT_B_INQ_PAGE BIT(2)
|
||||
#define BT_INFO_8821C_1ANT_B_SCO_ESCO BIT(1)
|
||||
#define BT_INFO_8821C_1ANT_B_CONNECTION BIT(0)
|
||||
|
||||
#define BT_INFO_8821C_1ANT_A2DP_BASIC_RATE(_BT_INFO_EXT_) \
|
||||
(((_BT_INFO_EXT_&BIT(0))) ? true : false)
|
||||
|
||||
#define BTC_RSSI_COEX_THRESH_TOL_8821C_1ANT 2
|
||||
|
||||
#define BT_8821C_1ANT_WIFI_NOISY_THRESH 30 /* max: 255 */
|
||||
#define BT_8821C_1ANT_DEFAULT_ISOLATION 15 /* unit: dB */
|
||||
|
||||
|
||||
/* for Antenna detection */
|
||||
#define BT_8821C_1ANT_ANTDET_PSDTHRES_BACKGROUND 50
|
||||
#define BT_8821C_1ANT_ANTDET_PSDTHRES_2ANT_BADISOLATION 70
|
||||
#define BT_8821C_1ANT_ANTDET_PSDTHRES_2ANT_GOODISOLATION 55
|
||||
#define BT_8821C_1ANT_ANTDET_PSDTHRES_1ANT 35
|
||||
#define BT_8821C_1ANT_ANTDET_RETRY_INTERVAL 10 /* retry timer if ant det is fail, unit: second */
|
||||
#define BT_8821C_1ANT_ANTDET_SWEEPPOINT_DELAY 60000
|
||||
#define BT_8821C_1ANT_ANTDET_ENABLE 0
|
||||
#define BT_8821C_1ANT_ANTDET_BTTXTIME 100
|
||||
#define BT_8821C_1ANT_ANTDET_BTTXCHANNEL 39
|
||||
#define BT_8821C_1ANT_ANTDET_PSD_SWWEEPCOUNT 50
|
||||
|
||||
#define BT_8821C_1ANT_LTECOEX_INDIRECTREG_ACCESS_TIMEOUT 30000
|
||||
|
||||
enum bt_8821c_1ant_signal_state {
|
||||
BT_8821C_1ANT_SIG_STA_SET_TO_LOW = 0x0,
|
||||
BT_8821C_1ANT_SIG_STA_SET_BY_HW = 0x0,
|
||||
BT_8821C_1ANT_SIG_STA_SET_TO_HIGH = 0x1,
|
||||
BT_8821C_1ANT_SIG_STA_MAX
|
||||
};
|
||||
|
||||
enum bt_8821c_1ant_path_ctrl_owner {
|
||||
BT_8821C_1ANT_PCO_BTSIDE = 0x0,
|
||||
BT_8821C_1ANT_PCO_WLSIDE = 0x1,
|
||||
BT_8821C_1ANT_PCO_MAX
|
||||
};
|
||||
|
||||
enum bt_8821c_1ant_gnt_ctrl_type {
|
||||
BT_8821C_1ANT_GNT_TYPE_CTRL_BY_PTA = 0x0,
|
||||
BT_8821C_1ANT_GNT_TYPE_CTRL_BY_SW = 0x1,
|
||||
BT_8821C_1ANT_GNT_TYPE_MAX
|
||||
};
|
||||
|
||||
enum bt_8821c_1ant_gnt_ctrl_block {
|
||||
BT_8821C_1ANT_GNT_BLOCK_RFC_BB = 0x0,
|
||||
BT_8821C_1ANT_GNT_BLOCK_RFC = 0x1,
|
||||
BT_8821C_1ANT_GNT_BLOCK_BB = 0x2,
|
||||
BT_8821C_1ANT_GNT_BLOCK_MAX
|
||||
};
|
||||
|
||||
enum bt_8821c_1ant_lte_coex_table_type {
|
||||
BT_8821C_1ANT_CTT_WL_VS_LTE = 0x0,
|
||||
BT_8821C_1ANT_CTT_BT_VS_LTE = 0x1,
|
||||
BT_8821C_1ANT_CTT_MAX
|
||||
};
|
||||
|
||||
enum bt_8821c_1ant_lte_break_table_type {
|
||||
BT_8821C_1ANT_LBTT_WL_BREAK_LTE = 0x0,
|
||||
BT_8821C_1ANT_LBTT_BT_BREAK_LTE = 0x1,
|
||||
BT_8821C_1ANT_LBTT_LTE_BREAK_WL = 0x2,
|
||||
BT_8821C_1ANT_LBTT_LTE_BREAK_BT = 0x3,
|
||||
BT_8821C_1ANT_LBTT_MAX
|
||||
};
|
||||
|
||||
enum bt_info_src_8821c_1ant {
|
||||
BT_INFO_SRC_8821C_1ANT_WIFI_FW = 0x0,
|
||||
BT_INFO_SRC_8821C_1ANT_BT_RSP = 0x1,
|
||||
BT_INFO_SRC_8821C_1ANT_BT_ACTIVE_SEND = 0x2,
|
||||
BT_INFO_SRC_8821C_1ANT_MAX
|
||||
};
|
||||
|
||||
enum bt_8821c_1ant_bt_status {
|
||||
BT_8821C_1ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0,
|
||||
BT_8821C_1ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
|
||||
BT_8821C_1ANT_BT_STATUS_INQ_PAGE = 0x2,
|
||||
BT_8821C_1ANT_BT_STATUS_ACL_BUSY = 0x3,
|
||||
BT_8821C_1ANT_BT_STATUS_SCO_BUSY = 0x4,
|
||||
BT_8821C_1ANT_BT_STATUS_ACL_SCO_BUSY = 0x5,
|
||||
BT_8821C_1ANT_BT_STATUS_MAX
|
||||
};
|
||||
|
||||
enum bt_8821c_1ant_wifi_status {
|
||||
BT_8821C_1ANT_WIFI_STATUS_NON_CONNECTED_IDLE = 0x0,
|
||||
BT_8821C_1ANT_WIFI_STATUS_NON_CONNECTED_ASSO_AUTH_SCAN = 0x1,
|
||||
BT_8821C_1ANT_WIFI_STATUS_CONNECTED_SCAN = 0x2,
|
||||
BT_8821C_1ANT_WIFI_STATUS_CONNECTED_SPECIFIC_PKT = 0x3,
|
||||
BT_8821C_1ANT_WIFI_STATUS_CONNECTED_IDLE = 0x4,
|
||||
BT_8821C_1ANT_WIFI_STATUS_CONNECTED_BUSY = 0x5,
|
||||
BT_8821C_1ANT_WIFI_STATUS_MAX
|
||||
};
|
||||
|
||||
enum bt_8821c_1ant_coex_algo {
|
||||
BT_8821C_1ANT_COEX_ALGO_UNDEFINED = 0x0,
|
||||
BT_8821C_1ANT_COEX_ALGO_SCO = 0x1,
|
||||
BT_8821C_1ANT_COEX_ALGO_HID = 0x2,
|
||||
BT_8821C_1ANT_COEX_ALGO_A2DP = 0x3,
|
||||
BT_8821C_1ANT_COEX_ALGO_A2DP_PANHS = 0x4,
|
||||
BT_8821C_1ANT_COEX_ALGO_PANEDR = 0x5,
|
||||
BT_8821C_1ANT_COEX_ALGO_PANHS = 0x6,
|
||||
BT_8821C_1ANT_COEX_ALGO_PANEDR_A2DP = 0x7,
|
||||
BT_8821C_1ANT_COEX_ALGO_PANEDR_HID = 0x8,
|
||||
BT_8821C_1ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x9,
|
||||
BT_8821C_1ANT_COEX_ALGO_HID_A2DP = 0xa,
|
||||
BT_8821C_1ANT_COEX_ALGO_MAX = 0xb,
|
||||
};
|
||||
|
||||
enum bt_8821c_1ant_ext_ant_switch_type {
|
||||
BT_8821C_1ANT_EXT_ANT_SWITCH_USE_DPDT = 0x0,
|
||||
BT_8821C_1ANT_EXT_ANT_SWITCH_USE_SPDT = 0x1,
|
||||
BT_8821C_1ANT_EXT_ANT_SWITCH_NONE = 0x2,
|
||||
BT_8821C_1ANT_EXT_ANT_SWITCH_MAX
|
||||
};
|
||||
|
||||
|
||||
enum bt_8821c_1ant_ext_ant_switch_ctrl_type {
|
||||
BT_8821C_1ANT_EXT_ANT_SWITCH_CTRL_BY_BBSW = 0x0,
|
||||
BT_8821C_1ANT_EXT_ANT_SWITCH_CTRL_BY_PTA = 0x1,
|
||||
BT_8821C_1ANT_EXT_ANT_SWITCH_CTRL_BY_ANTDIV = 0x2,
|
||||
BT_8821C_1ANT_EXT_ANT_SWITCH_CTRL_BY_MAC = 0x3,
|
||||
BT_8821C_1ANT_EXT_ANT_SWITCH_CTRL_BY_BT = 0x4,
|
||||
BT_8821C_1ANT_EXT_ANT_SWITCH_CTRL_MAX
|
||||
};
|
||||
|
||||
enum bt_8821c_1ant_ext_ant_switch_pos_type {
|
||||
BT_8821C_1ANT_EXT_ANT_SWITCH_TO_BT = 0x0,
|
||||
BT_8821C_1ANT_EXT_ANT_SWITCH_TO_WLG = 0x1,
|
||||
BT_8821C_1ANT_EXT_ANT_SWITCH_TO_WLA = 0x2,
|
||||
BT_8821C_1ANT_EXT_ANT_SWITCH_TO_NOCARE = 0x3,
|
||||
BT_8821C_1ANT_EXT_ANT_SWITCH_TO_MAX
|
||||
};
|
||||
|
||||
enum bt_8821c_1ant_ext_band_switch_pos_type {
|
||||
BT_8821C_1ANT_EXT_BAND_SWITCH_TO_WLG = 0x0,
|
||||
BT_8821C_1ANT_EXT_BAND_SWITCH_TO_WLA = 0x1,
|
||||
BT_8821C_1ANT_EXT_BAND_SWITCH_TO_MAX
|
||||
};
|
||||
|
||||
enum bt_8821c_1ant_int_block {
|
||||
BT_8821C_1ANT_INT_BLOCK_SWITCH_TO_WLG_OF_BTG = 0x0,
|
||||
BT_8821C_1ANT_INT_BLOCK_SWITCH_TO_WLG_OF_WLAG = 0x1,
|
||||
BT_8821C_1ANT_INT_BLOCK_SWITCH_TO_WLA_OF_WLAG = 0x2,
|
||||
BT_8821C_1ANT_INT_BLOCK_SWITCH_TO_MAX
|
||||
};
|
||||
|
||||
enum bt_8821c_1ant_phase {
|
||||
BT_8821C_1ANT_PHASE_COEX_INIT = 0x0,
|
||||
BT_8821C_1ANT_PHASE_WLANONLY_INIT = 0x1,
|
||||
BT_8821C_1ANT_PHASE_WLAN_OFF = 0x2,
|
||||
BT_8821C_1ANT_PHASE_2G_RUNTIME = 0x3,
|
||||
BT_8821C_1ANT_PHASE_5G_RUNTIME = 0x4,
|
||||
BT_8821C_1ANT_PHASE_BTMPMODE = 0x5,
|
||||
BT_8821C_1ANT_PHASE_ANTENNA_DET = 0x6,
|
||||
BT_8821C_1ANT_PHASE_COEX_POWERON = 0x7,
|
||||
BT_8821C_1ANT_PHASE_MAX
|
||||
};
|
||||
|
||||
enum bt_8821c_1ant_Scoreboard {
|
||||
BT_8821C_1ANT_SCOREBOARD_ACTIVE = BIT(0),
|
||||
BT_8821C_1ANT_SCOREBOARD_ONOFF = BIT(1),
|
||||
BT_8821C_1ANT_SCOREBOARD_SCAN = BIT(2)
|
||||
};
|
||||
|
||||
struct coex_dm_8821c_1ant {
|
||||
/* hw setting */
|
||||
u32 pre_ant_pos_type;
|
||||
u32 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 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;
|
||||
|
||||
u32 pre_ext_ant_switch_status;
|
||||
u32 cur_ext_ant_switch_status;
|
||||
|
||||
u8 pre_ext_band_switch_status;
|
||||
u8 cur_ext_band_switch_status;
|
||||
|
||||
u8 pre_int_block_status;
|
||||
u8 cur_int_block_status;
|
||||
|
||||
u8 error_condition;
|
||||
};
|
||||
|
||||
struct coex_sta_8821c_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_8821C_1ANT_MAX][10];
|
||||
u32 bt_info_c2h_cnt[BT_INFO_SRC_8821C_1ANT_MAX];
|
||||
boolean bt_whck_test;
|
||||
boolean c2h_bt_inquiry_page;
|
||||
boolean c2h_bt_remote_name_req;
|
||||
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;
|
||||
u8 bt_info_ext2;
|
||||
u32 pop_event_cnt;
|
||||
u8 scan_ap_num;
|
||||
|
||||
u32 crc_ok_cck;
|
||||
u32 crc_ok_11g;
|
||||
u32 crc_ok_11n;
|
||||
u32 crc_ok_11n_vht;
|
||||
|
||||
u32 crc_err_cck;
|
||||
u32 crc_err_11g;
|
||||
u32 crc_err_11n;
|
||||
u32 crc_err_11n_vht;
|
||||
|
||||
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;
|
||||
u8 isolation_btween_wb; /* 0~ 50 */
|
||||
|
||||
u8 a2dp_bit_pool;
|
||||
u8 cut_version;
|
||||
boolean acl_busy;
|
||||
boolean wl_rf_off_on_event;
|
||||
boolean bt_create_connection;
|
||||
|
||||
u32 bt_coex_supported_feature;
|
||||
u32 bt_coex_supported_version;
|
||||
|
||||
u8 bt_ble_scan_type;
|
||||
u8 bt_ble_scan_para[3];
|
||||
|
||||
boolean run_time_state;
|
||||
boolean freeze_coexrun_by_btinfo;
|
||||
|
||||
boolean is_A2DP_3M;
|
||||
boolean voice_over_HOGP;
|
||||
u8 bt_info;
|
||||
boolean is_autoslot;
|
||||
u8 forbidden_slot;
|
||||
u8 hid_busy_num;
|
||||
u8 hid_pair_cnt;
|
||||
|
||||
u32 cnt_RemoteNameReq;
|
||||
u32 cnt_setupLink;
|
||||
u32 cnt_ReInit;
|
||||
u32 cnt_IgnWlanAct;
|
||||
u32 cnt_Page;
|
||||
|
||||
u16 bt_reg_vendor_ac;
|
||||
u16 bt_reg_vendor_ae;
|
||||
|
||||
boolean is_setupLink;
|
||||
};
|
||||
|
||||
|
||||
#define BT_8821C_1ANT_EXT_BAND_SWITCH_USE_DPDT 0
|
||||
#define BT_8821C_1ANT_EXT_BAND_SWITCH_USE_SPDT 1
|
||||
|
||||
|
||||
struct rfe_type_8821c_1ant {
|
||||
|
||||
u8 rfe_module_type;
|
||||
boolean ext_ant_switch_exist;
|
||||
u8 ext_ant_switch_type; /* 0:DPDT, 1:SPDT */
|
||||
u8 ext_ant_switch_ctrl_polarity; /* iF 0: DPDT_P=0, DPDT_N=1 => BTG to Main, WL_A+G to Aux */
|
||||
|
||||
boolean ext_band_switch_exist;
|
||||
u8 ext_band_switch_type; /* 0:DPDT, 1:SPDT */
|
||||
u8 ext_band_switch_ctrl_polarity;
|
||||
|
||||
boolean wlg_Locate_at_btg; /* If true: WLG at BTG, If false: WLG at WLAG */
|
||||
|
||||
boolean ext_ant_switch_diversity; /* If diversity on */
|
||||
};
|
||||
|
||||
#define BT_8821C_1ANT_ANTDET_PSD_POINTS 256 /* MAX:1024 */
|
||||
#define BT_8821C_1ANT_ANTDET_PSD_AVGNUM 1 /* MAX:3 */
|
||||
#define BT_8821C_1ANT_ANTDET_BUF_LEN 16
|
||||
|
||||
struct psdscan_sta_8821c_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_8821C_1ANT_ANTDET_BUF_LEN];
|
||||
u8 ant_det_peak_freq[BT_8821C_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_max_value2;
|
||||
u32 psd_avg_value; /* filter loop_max_value that below BT_8821C_1ANT_ANTDET_PSDTHRES_1ANT, and average the rest*/
|
||||
u32 psd_loop_max_value[BT_8821C_1ANT_ANTDET_PSD_SWWEEPCOUNT]; /*max value in each loop */
|
||||
u32 psd_start_base;
|
||||
u32 psd_avg_num; /* 1/8/16/32 */
|
||||
u32 psd_gen_count;
|
||||
boolean is_AntDet_running;
|
||||
boolean is_psd_show_max_only;
|
||||
};
|
||||
|
||||
/* *******************************************
|
||||
* The following is interface which will notify coex module.
|
||||
* ******************************************* */
|
||||
void ex_halbtc8821c1ant_power_on_setting(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8821c1ant_pre_load_firmware(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8821c1ant_init_hw_config(IN struct btc_coexist *btcoexist,
|
||||
IN boolean wifi_only);
|
||||
void ex_halbtc8821c1ant_init_coex_dm(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8821c1ant_ips_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8821c1ant_lps_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8821c1ant_scan_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8821c1ant_switchband_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8821c1ant_connect_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8821c1ant_media_status_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8821c1ant_specific_packet_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8821c1ant_bt_info_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 *tmp_buf, IN u8 length);
|
||||
void ex_halbtc8821c1ant_rf_status_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8821c1ant_halt_notify(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8821c1ant_pnp_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 pnp_state);
|
||||
void ex_halbtc8821c1ant_coex_dm_reset(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8821c1ant_periodical(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8821c1ant_display_coex_info(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8821c1ant_antenna_detection(IN struct btc_coexist *btcoexist,
|
||||
IN u32 cent_freq, IN u32 offset, IN u32 span, IN u32 seconds);
|
||||
void ex_halbtc8821c1ant_antenna_isolation(IN struct btc_coexist *btcoexist,
|
||||
IN u32 cent_freq, IN u32 offset, IN u32 span, IN u32 seconds);
|
||||
|
||||
void ex_halbtc8821c1ant_psd_scan(IN struct btc_coexist *btcoexist,
|
||||
IN u32 cent_freq, IN u32 offset, IN u32 span, IN u32 seconds);
|
||||
void ex_halbtc8821c1ant_display_ant_detection(IN struct btc_coexist *btcoexist);
|
||||
|
||||
#else
|
||||
#define ex_halbtc8821c1ant_power_on_setting(btcoexist)
|
||||
#define ex_halbtc8821c1ant_pre_load_firmware(btcoexist)
|
||||
#define ex_halbtc8821c1ant_init_hw_config(btcoexist, wifi_only)
|
||||
#define ex_halbtc8821c1ant_init_coex_dm(btcoexist)
|
||||
#define ex_halbtc8821c1ant_ips_notify(btcoexist, type)
|
||||
#define ex_halbtc8821c1ant_lps_notify(btcoexist, type)
|
||||
#define ex_halbtc8821c1ant_scan_notify(btcoexist, type)
|
||||
#define ex_halbtc8821c1ant_switchband_notify(btcoexist,type)
|
||||
#define ex_halbtc8821c1ant_connect_notify(btcoexist, type)
|
||||
#define ex_halbtc8821c1ant_media_status_notify(btcoexist, type)
|
||||
#define ex_halbtc8821c1ant_specific_packet_notify(btcoexist, type)
|
||||
#define ex_halbtc8821c1ant_bt_info_notify(btcoexist, tmp_buf, length)
|
||||
#define ex_halbtc8821c1ant_rf_status_notify(btcoexist, type)
|
||||
#define ex_halbtc8821c1ant_halt_notify(btcoexist)
|
||||
#define ex_halbtc8821c1ant_pnp_notify(btcoexist, pnp_state)
|
||||
#define ex_halbtc8821c1ant_coex_dm_reset(btcoexist)
|
||||
#define ex_halbtc8821c1ant_periodical(btcoexist)
|
||||
#define ex_halbtc8821c1ant_display_coex_info(btcoexist)
|
||||
#define ex_halbtc8821c1ant_antenna_detection(btcoexist, cent_freq, offset, span, seconds)
|
||||
#define ex_halbtc8821c1ant_antenna_isolation(btcoexist, cent_freq, offset, span, seconds)
|
||||
#define ex_halbtc8821c1ant_psd_scan(btcoexist, cent_freq, offset, span, seconds)
|
||||
#define ex_halbtc8821c1ant_display_ant_detection(btcoexist)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
6936
hal/btc/halbtc8821c2ant.c
Normal file
6936
hal/btc/halbtc8821c2ant.c
Normal file
File diff suppressed because it is too large
Load diff
478
hal/btc/halbtc8821c2ant.h
Normal file
478
hal/btc/halbtc8821c2ant.h
Normal file
|
@ -0,0 +1,478 @@
|
|||
|
||||
#if (BT_SUPPORT == 1 && COEX_SUPPORT == 1)
|
||||
|
||||
#if (RTL8821C_SUPPORT == 1)
|
||||
|
||||
/* *******************************************
|
||||
* The following is for 8821C 2Ant BT Co-exist definition
|
||||
* ******************************************* */
|
||||
#define BT_8821C_2ANT_COEX_DBG 0
|
||||
#define BT_AUTO_REPORT_ONLY_8821C_2ANT 1
|
||||
|
||||
|
||||
#define BT_INFO_8821C_2ANT_B_FTP BIT(7)
|
||||
#define BT_INFO_8821C_2ANT_B_A2DP BIT(6)
|
||||
#define BT_INFO_8821C_2ANT_B_HID BIT(5)
|
||||
#define BT_INFO_8821C_2ANT_B_SCO_BUSY BIT(4)
|
||||
#define BT_INFO_8821C_2ANT_B_ACL_BUSY BIT(3)
|
||||
#define BT_INFO_8821C_2ANT_B_INQ_PAGE BIT(2)
|
||||
#define BT_INFO_8821C_2ANT_B_SCO_ESCO BIT(1)
|
||||
#define BT_INFO_8821C_2ANT_B_CONNECTION BIT(0)
|
||||
|
||||
#define BTC_RSSI_COEX_THRESH_TOL_8821C_2ANT 2
|
||||
|
||||
|
||||
#define BT_8821C_2ANT_WIFI_RSSI_COEXSWITCH_THRES1 80 /* unit: % WiFi RSSI Threshold for 2-Ant free-run/2-Ant TDMA translation, default = 42 */
|
||||
#define BT_8821C_2ANT_BT_RSSI_COEXSWITCH_THRES1 80 /* unit: % BT RSSI Threshold for 2-Ant free-run/2-Ant TDMA translation, default = 46 */
|
||||
#define BT_8821C_2ANT_WIFI_RSSI_COEXSWITCH_THRES2 80 /* unit: % WiFi RSSI Threshold for 1-Ant TDMA/1-Ant PS-TDMA translation, default = 42 */
|
||||
#define BT_8821C_2ANT_BT_RSSI_COEXSWITCH_THRES2 80 /* unit: % BT RSSI Threshold for 1-Ant TDMA/1-Ant PS-TDMA translation, default = 46 */
|
||||
#define BT_8821C_2ANT_DEFAULT_ISOLATION 15 /* unit: dB */
|
||||
#define BT_8821C_2ANT_WIFI_MAX_TX_POWER 15 /* unit: dBm */
|
||||
#define BT_8821C_2ANT_BT_MAX_TX_POWER 3 /* unit: dBm */
|
||||
#define BT_8821C_2ANT_WIFI_SIR_THRES1 -15 /* unit: dB */
|
||||
#define BT_8821C_2ANT_WIFI_SIR_THRES2 -30 /* unit: dB */
|
||||
#define BT_8821C_2ANT_BT_SIR_THRES1 -15 /* unit: dB */
|
||||
#define BT_8821C_2ANT_BT_SIR_THRES2 -30 /* unit: dB */
|
||||
|
||||
|
||||
/* for Antenna detection */
|
||||
#define BT_8821C_2ANT_ANTDET_PSDTHRES_BACKGROUND 50
|
||||
#define BT_8821C_2ANT_ANTDET_PSDTHRES_2ANT_BADISOLATION 70
|
||||
#define BT_8821C_2ANT_ANTDET_PSDTHRES_2ANT_GOODISOLATION 52
|
||||
#define BT_8821C_2ANT_ANTDET_PSDTHRES_1ANT 40
|
||||
#define BT_8821C_2ANT_ANTDET_RETRY_INTERVAL 10 /* retry timer if ant det is fail, unit: second */
|
||||
#define BT_8821C_2ANT_ANTDET_SWEEPPOINT_DELAY 60000
|
||||
#define BT_8821C_2ANT_ANTDET_ENABLE 0
|
||||
#define BT_8821C_2ANT_ANTDET_BTTXTIME 100
|
||||
#define BT_8821C_2ANT_ANTDET_BTTXCHANNEL 39
|
||||
#define BT_8821C_2ANT_ANTDET_PSD_SWWEEPCOUNT 50
|
||||
|
||||
|
||||
#define BT_8821C_2ANT_LTECOEX_INDIRECTREG_ACCESS_TIMEOUT 30000
|
||||
|
||||
enum bt_8821c_2ant_signal_state {
|
||||
BT_8821C_2ANT_SIG_STA_SET_TO_LOW = 0x0,
|
||||
BT_8821C_2ANT_SIG_STA_SET_BY_HW = 0x0,
|
||||
BT_8821C_2ANT_SIG_STA_SET_TO_HIGH = 0x1,
|
||||
BT_8821C_2ANT_SIG_STA_MAX
|
||||
};
|
||||
|
||||
enum bt_8821c_2ant_path_ctrl_owner {
|
||||
BT_8821C_2ANT_PCO_BTSIDE = 0x0,
|
||||
BT_8821C_2ANT_PCO_WLSIDE = 0x1,
|
||||
BT_8821C_2ANT_PCO_MAX
|
||||
};
|
||||
|
||||
enum bt_8821c_2ant_gnt_ctrl_type {
|
||||
BT_8821C_2ANT_GNT_TYPE_CTRL_BY_PTA = 0x0,
|
||||
BT_8821C_2ANT_GNT_TYPE_CTRL_BY_SW = 0x1,
|
||||
BT_8821C_2ANT_GNT_TYPE_MAX
|
||||
};
|
||||
|
||||
enum bt_8821c_2ant_gnt_ctrl_block {
|
||||
BT_8821C_2ANT_GNT_BLOCK_RFC_BB = 0x0,
|
||||
BT_8821C_2ANT_GNT_BLOCK_RFC = 0x1,
|
||||
BT_8821C_2ANT_GNT_BLOCK_BB = 0x2,
|
||||
BT_8821C_2ANT_GNT_BLOCK_MAX
|
||||
};
|
||||
|
||||
enum bt_8821c_2ant_lte_coex_table_type {
|
||||
BT_8821C_2ANT_CTT_WL_VS_LTE = 0x0,
|
||||
BT_8821C_2ANT_CTT_BT_VS_LTE = 0x1,
|
||||
BT_8821C_2ANT_CTT_MAX
|
||||
};
|
||||
|
||||
enum bt_8821c_2ant_lte_break_table_type {
|
||||
BT_8821C_2ANT_LBTT_WL_BREAK_LTE = 0x0,
|
||||
BT_8821C_2ANT_LBTT_BT_BREAK_LTE = 0x1,
|
||||
BT_8821C_2ANT_LBTT_LTE_BREAK_WL = 0x2,
|
||||
BT_8821C_2ANT_LBTT_LTE_BREAK_BT = 0x3,
|
||||
BT_8821C_2ANT_LBTT_MAX
|
||||
};
|
||||
|
||||
enum bt_info_src_8821c_2ant {
|
||||
BT_INFO_SRC_8821C_2ANT_WIFI_FW = 0x0,
|
||||
BT_INFO_SRC_8821C_2ANT_BT_RSP = 0x1,
|
||||
BT_INFO_SRC_8821C_2ANT_BT_ACTIVE_SEND = 0x2,
|
||||
BT_INFO_SRC_8821C_2ANT_MAX
|
||||
};
|
||||
|
||||
enum bt_8821c_2ant_bt_status {
|
||||
BT_8821C_2ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0,
|
||||
BT_8821C_2ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
|
||||
BT_8821C_2ANT_BT_STATUS_INQ_PAGE = 0x2,
|
||||
BT_8821C_2ANT_BT_STATUS_ACL_BUSY = 0x3,
|
||||
BT_8821C_2ANT_BT_STATUS_SCO_BUSY = 0x4,
|
||||
BT_8821C_2ANT_BT_STATUS_ACL_SCO_BUSY = 0x5,
|
||||
BT_8821C_2ANT_BT_STATUS_MAX
|
||||
};
|
||||
|
||||
enum bt_8821c_2ant_coex_algo {
|
||||
BT_8821C_2ANT_COEX_ALGO_UNDEFINED = 0x0,
|
||||
BT_8821C_2ANT_COEX_ALGO_SCO = 0x1,
|
||||
BT_8821C_2ANT_COEX_ALGO_HID = 0x2,
|
||||
BT_8821C_2ANT_COEX_ALGO_A2DP = 0x3,
|
||||
BT_8821C_2ANT_COEX_ALGO_A2DP_PANHS = 0x4,
|
||||
BT_8821C_2ANT_COEX_ALGO_PANEDR = 0x5,
|
||||
BT_8821C_2ANT_COEX_ALGO_PANHS = 0x6,
|
||||
BT_8821C_2ANT_COEX_ALGO_PANEDR_A2DP = 0x7,
|
||||
BT_8821C_2ANT_COEX_ALGO_PANEDR_HID = 0x8,
|
||||
BT_8821C_2ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x9,
|
||||
BT_8821C_2ANT_COEX_ALGO_HID_A2DP = 0xa,
|
||||
BT_8821C_2ANT_COEX_ALGO_NOPROFILEBUSY = 0xb,
|
||||
BT_8821C_2ANT_COEX_ALGO_MAX
|
||||
};
|
||||
|
||||
enum bt_8821c_2ant_ext_ant_switch_type {
|
||||
BT_8821C_2ANT_EXT_ANT_SWITCH_USE_DPDT = 0x0,
|
||||
BT_8821C_2ANT_EXT_ANT_SWITCH_USE_SPDT = 0x1,
|
||||
BT_8821C_2ANT_EXT_ANT_SWITCH_NONE = 0x2,
|
||||
BT_8821C_2ANT_EXT_ANT_SWITCH_MAX
|
||||
};
|
||||
|
||||
enum bt_8821c_2ant_ext_ant_switch_ctrl_type {
|
||||
BT_8821C_2ANT_EXT_ANT_SWITCH_CTRL_BY_BBSW = 0x0,
|
||||
BT_8821C_2ANT_EXT_ANT_SWITCH_CTRL_BY_PTA = 0x1,
|
||||
BT_8821C_2ANT_EXT_ANT_SWITCH_CTRL_BY_ANTDIV = 0x2,
|
||||
BT_8821C_2ANT_EXT_ANT_SWITCH_CTRL_BY_MAC = 0x3,
|
||||
BT_8821C_2ANT_EXT_ANT_SWITCH_CTRL_BY_BT = 0x4,
|
||||
BT_8821C_2ANT_EXT_ANT_SWITCH_CTRL_MAX
|
||||
};
|
||||
|
||||
enum bt_8821c_2ant_ext_ant_switch_pos_type {
|
||||
BT_8821C_2ANT_EXT_ANT_SWITCH_MAIN_TO_BT = 0x0,
|
||||
BT_8821C_2ANT_EXT_ANT_SWITCH_MAIN_TO_WLG = 0x1,
|
||||
BT_8821C_2ANT_EXT_ANT_SWITCH_MAIN_TO_WLA = 0x2,
|
||||
BT_8821C_2ANT_EXT_ANT_SWITCH_MAIN_TO_NOCARE = 0x3,
|
||||
BT_8821C_2ANT_EXT_ANT_SWITCH_MAIN_TO_MAX
|
||||
};
|
||||
|
||||
enum bt_8821c_2ant_ext_band_switch_pos_type {
|
||||
BT_8821C_2ANT_EXT_BAND_SWITCH_TO_WLG = 0x0,
|
||||
BT_8821C_2ANT_EXT_BAND_SWITCH_TO_WLA = 0x1,
|
||||
BT_8821C_2ANT_EXT_BAND_SWITCH_TO_MAX
|
||||
};
|
||||
|
||||
enum bt_8821c_2ant_int_block {
|
||||
BT_8821C_2ANT_INT_BLOCK_SWITCH_TO_WLG_OF_BTG = 0x0,
|
||||
BT_8821C_2ANT_INT_BLOCK_SWITCH_TO_WLG_OF_WLAG = 0x1,
|
||||
BT_8821C_2ANT_INT_BLOCK_SWITCH_TO_WLA_OF_WLAG = 0x2,
|
||||
BT_8821C_2ANT_INT_BLOCK_SWITCH_TO_MAX
|
||||
};
|
||||
|
||||
enum bt_8821c_2ant_phase {
|
||||
BT_8821C_2ANT_PHASE_COEX_INIT = 0x0,
|
||||
BT_8821C_2ANT_PHASE_WLANONLY_INIT = 0x1,
|
||||
BT_8821C_2ANT_PHASE_WLAN_OFF = 0x2,
|
||||
BT_8821C_2ANT_PHASE_2G_RUNTIME = 0x3,
|
||||
BT_8821C_2ANT_PHASE_5G_RUNTIME = 0x4,
|
||||
BT_8821C_2ANT_PHASE_BTMPMODE = 0x5,
|
||||
BT_8821C_2ANT_PHASE_ANTENNA_DET = 0x6,
|
||||
BT_8821C_2ANT_PHASE_COEX_POWERON = 0x7,
|
||||
BT_8821C_2ANT_PHASE_2G_RUNTIME_CONCURRENT = 0x8,
|
||||
BT_8821C_2ANT_PHASE_MAX
|
||||
};
|
||||
|
||||
enum bt_8821c_2ant_Scoreboard {
|
||||
BT_8821C_2ANT_SCOREBOARD_ACTIVE = BIT(0),
|
||||
BT_8821C_2ANT_SCOREBOARD_ONOFF = BIT(1),
|
||||
BT_8821C_2ANT_SCOREBOARD_SCAN = BIT(2)
|
||||
};
|
||||
|
||||
|
||||
|
||||
struct coex_dm_8821c_2ant {
|
||||
/* hw setting */
|
||||
u32 pre_ant_pos_type;
|
||||
u32 cur_ant_pos_type;
|
||||
/* 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 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;
|
||||
u32 arp_cnt;
|
||||
|
||||
u32 pre_ext_ant_switch_status;
|
||||
u32 cur_ext_ant_switch_status;
|
||||
|
||||
u8 pre_ext_band_switch_status;
|
||||
u8 cur_ext_band_switch_status;
|
||||
|
||||
u8 pre_int_block_status;
|
||||
u8 cur_int_block_status;
|
||||
};
|
||||
|
||||
struct coex_sta_8821c_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_8821C_2ANT_MAX][10];
|
||||
u32 bt_info_c2h_cnt[BT_INFO_SRC_8821C_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;
|
||||
u8 bt_info_ext2;
|
||||
u32 pop_event_cnt;
|
||||
u8 scan_ap_num;
|
||||
|
||||
u32 crc_ok_cck;
|
||||
u32 crc_ok_11g;
|
||||
u32 crc_ok_11n;
|
||||
u32 crc_ok_11n_vht;
|
||||
|
||||
u32 crc_err_cck;
|
||||
u32 crc_err_11g;
|
||||
u32 crc_err_11n;
|
||||
u32 crc_err_11n_vht;
|
||||
|
||||
boolean cck_lock;
|
||||
boolean pre_ccklock;
|
||||
boolean cck_ever_lock;
|
||||
|
||||
u8 coex_table_type;
|
||||
boolean force_lps_on;
|
||||
|
||||
u8 dis_ver_info_cnt;
|
||||
|
||||
u8 a2dp_bit_pool;
|
||||
u8 cut_version;
|
||||
|
||||
boolean concurrent_rx_mode_on;
|
||||
|
||||
u16 score_board;
|
||||
u8 isolation_btween_wb; /* 0~ 50 */
|
||||
u8 wifi_coex_thres;
|
||||
u8 bt_coex_thres;
|
||||
u8 wifi_coex_thres2;
|
||||
u8 bt_coex_thres2;
|
||||
|
||||
u8 num_of_profile;
|
||||
boolean acl_busy;
|
||||
boolean wl_rf_off_on_event;
|
||||
boolean bt_create_connection;
|
||||
boolean wifi_is_high_pri_task;
|
||||
u32 specific_pkt_period_cnt;
|
||||
u32 bt_coex_supported_feature;
|
||||
u32 bt_coex_supported_version;
|
||||
|
||||
u8 bt_ble_scan_type;
|
||||
u8 bt_ble_scan_para[3];
|
||||
|
||||
boolean run_time_state;
|
||||
boolean freeze_coexrun_by_btinfo;
|
||||
|
||||
boolean is_A2DP_3M;
|
||||
boolean voice_over_HOGP;
|
||||
u8 bt_info;
|
||||
boolean is_autoslot;
|
||||
u8 forbidden_slot;
|
||||
u8 hid_busy_num;
|
||||
u8 hid_pair_cnt;
|
||||
|
||||
u32 cnt_RemoteNameReq;
|
||||
u32 cnt_setupLink;
|
||||
u32 cnt_ReInit;
|
||||
u32 cnt_IgnWlanAct;
|
||||
u32 cnt_Page;
|
||||
|
||||
u16 bt_reg_vendor_ac;
|
||||
u16 bt_reg_vendor_ae;
|
||||
|
||||
boolean is_setupLink;
|
||||
};
|
||||
|
||||
|
||||
#define BT_8821C_2ANT_EXT_BAND_SWITCH_USE_DPDT 0
|
||||
#define BT_8821C_2ANT_EXT_BAND_SWITCH_USE_SPDT 1
|
||||
|
||||
|
||||
struct rfe_type_8821c_2ant {
|
||||
|
||||
u8 rfe_module_type;
|
||||
boolean ext_ant_switch_exist;
|
||||
u8 ext_ant_switch_type; /* 0:DPDT, 1:SPDT */
|
||||
u8 ext_ant_switch_ctrl_polarity; /* iF 0: DPDT_P=0, DPDT_N=1 => BTG to Main, WL_A+G to Aux */
|
||||
|
||||
boolean ext_band_switch_exist;
|
||||
u8 ext_band_switch_type; /* 0:DPDT, 1:SPDT */
|
||||
u8 ext_band_switch_ctrl_polarity;
|
||||
|
||||
boolean wlg_Locate_at_btg; /* If true: WLG at BTG, If false: WLG at WLAG */
|
||||
|
||||
boolean ext_ant_switch_diversity; /* If diversity on */
|
||||
};
|
||||
|
||||
#define BT_8821C_2ANT_ANTDET_PSD_POINTS 256 /* MAX:1024 */
|
||||
#define BT_8821C_2ANT_ANTDET_PSD_AVGNUM 1 /* MAX:3 */
|
||||
#define BT_8821C_2ANT_ANTDET_BUF_LEN 16
|
||||
|
||||
struct psdscan_sta_8821c_2ant {
|
||||
|
||||
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_8821C_2ANT_ANTDET_BUF_LEN];
|
||||
u8 ant_det_peak_freq[BT_8821C_2ANT_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_max_value2;
|
||||
u32 psd_avg_value; /* filter loop_max_value that below BT_8821C_1ANT_ANTDET_PSDTHRES_1ANT, and average the rest*/
|
||||
u32 psd_loop_max_value[BT_8821C_2ANT_ANTDET_PSD_SWWEEPCOUNT]; /*max value in each loop */
|
||||
u32 psd_start_base;
|
||||
u32 psd_avg_num; /* 1/8/16/32 */
|
||||
u32 psd_gen_count;
|
||||
boolean is_AntDet_running;
|
||||
boolean is_psd_show_max_only;
|
||||
};
|
||||
|
||||
|
||||
/* *******************************************
|
||||
* The following is interface which will notify coex module.
|
||||
* ******************************************* */
|
||||
void ex_halbtc8821c2ant_power_on_setting(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8821c2ant_pre_load_firmware(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8821c2ant_init_hw_config(IN struct btc_coexist *btcoexist,
|
||||
IN boolean wifi_only);
|
||||
void ex_halbtc8821c2ant_init_coex_dm(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8821c2ant_ips_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8821c2ant_lps_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8821c2ant_scan_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8821c2ant_switchband_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8821c2ant_connect_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8821c2ant_media_status_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8821c2ant_specific_packet_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8821c2ant_bt_info_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 *tmp_buf, IN u8 length);
|
||||
void ex_halbtc8821c2ant_rf_status_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8821c2ant_halt_notify(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8821c2ant_pnp_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 pnp_state);
|
||||
void ex_halbtc8821c2ant_periodical(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8821c2ant_display_coex_info(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8821c2ant_antenna_detection(IN struct btc_coexist *btcoexist,
|
||||
IN u32 cent_freq, IN u32 offset, IN u32 span, IN u32 seconds);
|
||||
void ex_halbtc8821c2ant_display_ant_detection(IN struct btc_coexist *btcoexist);
|
||||
|
||||
|
||||
#else
|
||||
#define ex_halbtc8821c2ant_power_on_setting(btcoexist)
|
||||
#define ex_halbtc8821c2ant_pre_load_firmware(btcoexist)
|
||||
#define ex_halbtc8821c2ant_init_hw_config(btcoexist, wifi_only)
|
||||
#define ex_halbtc8821c2ant_init_coex_dm(btcoexist)
|
||||
#define ex_halbtc8821c2ant_ips_notify(btcoexist, type)
|
||||
#define ex_halbtc8821c2ant_lps_notify(btcoexist, type)
|
||||
#define ex_halbtc8821c2ant_scan_notify(btcoexist, type)
|
||||
#define ex_halbtc8821c2ant_switchband_notify(btcoexist,type)
|
||||
#define ex_halbtc8821c2ant_connect_notify(btcoexist, type)
|
||||
#define ex_halbtc8821c2ant_media_status_notify(btcoexist, type)
|
||||
#define ex_halbtc8821c2ant_specific_packet_notify(btcoexist, type)
|
||||
#define ex_halbtc8821c2ant_bt_info_notify(btcoexist, tmp_buf, length)
|
||||
#define ex_halbtc8821c2ant_rf_status_notify(btcoexist, type)
|
||||
#define ex_halbtc8821c2ant_halt_notify(btcoexist)
|
||||
#define ex_halbtc8821c2ant_pnp_notify(btcoexist, pnp_state)
|
||||
#define ex_halbtc8821c2ant_periodical(btcoexist)
|
||||
#define ex_halbtc8821c2ant_display_coex_info(btcoexist)
|
||||
#define ex_halbtc8821c2ant_display_ant_detection(btcoexist)
|
||||
#define ex_halbtc8821c2ant_antenna_detection(btcoexist, cent_freq, offset, span, seconds)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
186
hal/btc/halbtc8821cwifionly.c
Executable file
186
hal/btc/halbtc8821cwifionly.c
Executable file
|
@ -0,0 +1,186 @@
|
|||
#include "mp_precomp.h"
|
||||
|
||||
static struct rfe_type_8821c_wifi_only gl_rfe_type_8821c_1ant;
|
||||
static struct rfe_type_8821c_wifi_only *rfe_type = &gl_rfe_type_8821c_1ant;
|
||||
|
||||
|
||||
|
||||
VOID hal8821c_wifi_only_switch_antenna(
|
||||
IN struct wifi_only_cfg *pwifionlycfg,
|
||||
IN u1Byte is_5g
|
||||
)
|
||||
{
|
||||
boolean switch_polatiry_inverse = false;
|
||||
u8 regval_0xcb7 = 0;
|
||||
u8 pos_type, ctrl_type;
|
||||
|
||||
if (!rfe_type->ext_ant_switch_exist)
|
||||
return;
|
||||
|
||||
/* swap control polarity if use different switch control polarity*/
|
||||
/* Normal switch polarity for DPDT, 0xcb4[29:28] = 2b'01 => BTG to Main, WLG to Aux, 0xcb4[29:28] = 2b'10 => BTG to Aux, WLG to Main */
|
||||
/* Normal switch polarity for SPDT, 0xcb4[29:28] = 2b'01 => Ant to BTG, 0xcb4[29:28] = 2b'10 => Ant to WLG */
|
||||
if (rfe_type->ext_ant_switch_ctrl_polarity)
|
||||
switch_polatiry_inverse = !switch_polatiry_inverse;
|
||||
|
||||
/* swap control polarity if 1-Ant at Aux */
|
||||
if (rfe_type->ant_at_main_port == false)
|
||||
switch_polatiry_inverse = !switch_polatiry_inverse;
|
||||
|
||||
if (is_5g)
|
||||
pos_type = BT_8821C_WIFI_ONLY_EXT_ANT_SWITCH_TO_WLA;
|
||||
else
|
||||
pos_type = BT_8821C_WIFI_ONLY_EXT_ANT_SWITCH_TO_WLG;
|
||||
|
||||
switch (pos_type) {
|
||||
default:
|
||||
case BT_8821C_WIFI_ONLY_EXT_ANT_SWITCH_TO_WLA:
|
||||
|
||||
break;
|
||||
case BT_8821C_WIFI_ONLY_EXT_ANT_SWITCH_TO_WLG:
|
||||
if (!rfe_type->wlg_Locate_at_btg)
|
||||
switch_polatiry_inverse = !switch_polatiry_inverse;
|
||||
break;
|
||||
}
|
||||
|
||||
if (pwifionlycfg->haldata_info.ant_div_cfg)
|
||||
ctrl_type = BT_8821C_WIFI_ONLY_EXT_ANT_SWITCH_CTRL_BY_ANTDIV;
|
||||
else
|
||||
ctrl_type = BT_8821C_WIFI_ONLY_EXT_ANT_SWITCH_CTRL_BY_BBSW;
|
||||
|
||||
|
||||
switch (ctrl_type) {
|
||||
default:
|
||||
case BT_8821C_WIFI_ONLY_EXT_ANT_SWITCH_CTRL_BY_BBSW:
|
||||
halwifionly_phy_set_bb_reg(pwifionlycfg, 0x4c, 0x01800000, 0x2);
|
||||
|
||||
/* BB SW, DPDT use RFE_ctrl8 and RFE_ctrl9 as control pin */
|
||||
halwifionly_phy_set_bb_reg(pwifionlycfg, 0xcb4, 0x000000ff, 0x77);
|
||||
|
||||
regval_0xcb7 = (switch_polatiry_inverse == false ? 0x1 : 0x2);
|
||||
|
||||
/* 0xcb4[29:28] = 2b'01 for no switch_polatiry_inverse, DPDT_SEL_N =1, DPDT_SEL_P =0 */
|
||||
halwifionly_phy_set_bb_reg(pwifionlycfg, 0xcb4, 0x30000000, regval_0xcb7);
|
||||
break;
|
||||
|
||||
case BT_8821C_WIFI_ONLY_EXT_ANT_SWITCH_CTRL_BY_ANTDIV:
|
||||
halwifionly_phy_set_bb_reg(pwifionlycfg, 0x4c, 0x01800000, 0x2);
|
||||
|
||||
/* BB SW, DPDT use RFE_ctrl8 and RFE_ctrl9 as control pin */
|
||||
halwifionly_phy_set_bb_reg(pwifionlycfg, 0xcb4, 0x000000ff, 0x88);
|
||||
|
||||
/* no regval_0xcb7 setup required, because antenna switch control value by antenna diversity */
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
VOID halbtc8821c_wifi_only_set_rfe_type(
|
||||
IN struct wifi_only_cfg *pwifionlycfg
|
||||
)
|
||||
{
|
||||
|
||||
/* the following setup should be got from Efuse in the future */
|
||||
rfe_type->rfe_module_type = (pwifionlycfg->haldata_info.rfe_type) & 0x1f;
|
||||
|
||||
rfe_type->ext_ant_switch_ctrl_polarity = 0;
|
||||
|
||||
switch (rfe_type->rfe_module_type) {
|
||||
case 0:
|
||||
default:
|
||||
rfe_type->ext_ant_switch_exist = true;
|
||||
rfe_type->ext_ant_switch_type =
|
||||
BT_8821C_WIFI_ONLY_EXT_ANT_SWITCH_USE_DPDT; /*2-Ant, DPDT, WLG*/
|
||||
rfe_type->wlg_Locate_at_btg = false;
|
||||
rfe_type->ant_at_main_port = true;
|
||||
break;
|
||||
case 1:
|
||||
rfe_type->ext_ant_switch_exist = true;
|
||||
rfe_type->ext_ant_switch_type =
|
||||
BT_8821C_WIFI_ONLY_EXT_ANT_SWITCH_USE_SPDT; /*1-Ant, Main, DPDT or SPDT, WLG */
|
||||
rfe_type->wlg_Locate_at_btg = false;
|
||||
rfe_type->ant_at_main_port = true;
|
||||
break;
|
||||
case 2:
|
||||
rfe_type->ext_ant_switch_exist = true;
|
||||
rfe_type->ext_ant_switch_type =
|
||||
BT_8821C_WIFI_ONLY_EXT_ANT_SWITCH_USE_SPDT; /*1-Ant, Main, DPDT or SPDT, BTG */
|
||||
rfe_type->wlg_Locate_at_btg = true;
|
||||
rfe_type->ant_at_main_port = true;
|
||||
break;
|
||||
case 3:
|
||||
rfe_type->ext_ant_switch_exist = true;
|
||||
rfe_type->ext_ant_switch_type =
|
||||
BT_8821C_WIFI_ONLY_EXT_ANT_SWITCH_USE_DPDT; /*1-Ant, Aux, DPDT, WLG */
|
||||
rfe_type->wlg_Locate_at_btg = false;
|
||||
rfe_type->ant_at_main_port = false;
|
||||
break;
|
||||
case 4:
|
||||
rfe_type->ext_ant_switch_exist = true;
|
||||
rfe_type->ext_ant_switch_type =
|
||||
BT_8821C_WIFI_ONLY_EXT_ANT_SWITCH_USE_DPDT; /*1-Ant, Aux, DPDT, BTG */
|
||||
rfe_type->wlg_Locate_at_btg = true;
|
||||
rfe_type->ant_at_main_port = false;
|
||||
break;
|
||||
case 5:
|
||||
rfe_type->ext_ant_switch_exist = false; /*2-Ant, no antenna switch, WLG*/
|
||||
rfe_type->ext_ant_switch_type =
|
||||
BT_8821C_WIFI_ONLY_EXT_ANT_SWITCH_NONE;
|
||||
rfe_type->wlg_Locate_at_btg = false;
|
||||
rfe_type->ant_at_main_port = true;
|
||||
break;
|
||||
case 6:
|
||||
rfe_type->ext_ant_switch_exist = false; /*2-Ant, no antenna switch, WLG*/
|
||||
rfe_type->ext_ant_switch_type =
|
||||
BT_8821C_WIFI_ONLY_EXT_ANT_SWITCH_NONE;
|
||||
rfe_type->wlg_Locate_at_btg = false;
|
||||
rfe_type->ant_at_main_port = true;
|
||||
break;
|
||||
case 7:
|
||||
rfe_type->ext_ant_switch_exist = true; /*2-Ant, DPDT, BTG*/
|
||||
rfe_type->ext_ant_switch_type =
|
||||
BT_8821C_WIFI_ONLY_EXT_ANT_SWITCH_USE_DPDT;
|
||||
rfe_type->wlg_Locate_at_btg = true;
|
||||
rfe_type->ant_at_main_port = true;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
ex_hal8821c_wifi_only_hw_config(
|
||||
IN struct wifi_only_cfg *pwifionlycfg
|
||||
)
|
||||
{
|
||||
halbtc8821c_wifi_only_set_rfe_type(pwifionlycfg);
|
||||
|
||||
/* set gnt_wl, gnt_bt control owner to WL*/
|
||||
halwifionly_phy_set_bb_reg(pwifionlycfg, 0x70, 0x400000, 0x1);
|
||||
|
||||
/*gnt_wl=1 , gnt_bt=0*/
|
||||
halwifionly_phy_set_bb_reg(pwifionlycfg, 0x1704, 0xffffffff, 0x7700);
|
||||
halwifionly_phy_set_bb_reg(pwifionlycfg, 0x1700, 0xffffffff, 0xc00f0038);
|
||||
}
|
||||
|
||||
VOID
|
||||
ex_hal8821c_wifi_only_scannotify(
|
||||
IN struct wifi_only_cfg *pwifionlycfg,
|
||||
IN u1Byte is_5g
|
||||
)
|
||||
{
|
||||
hal8821c_wifi_only_switch_antenna(pwifionlycfg, is_5g);
|
||||
}
|
||||
|
||||
VOID
|
||||
ex_hal8821c_wifi_only_switchbandnotify(
|
||||
IN struct wifi_only_cfg *pwifionlycfg,
|
||||
IN u1Byte is_5g
|
||||
)
|
||||
{
|
||||
hal8821c_wifi_only_switch_antenna(pwifionlycfg, is_5g);
|
||||
}
|
||||
|
70
hal/btc/halbtc8821cwifionly.h
Executable file
70
hal/btc/halbtc8821cwifionly.h
Executable file
|
@ -0,0 +1,70 @@
|
|||
#ifndef __INC_HAL8821CWIFIONLYHWCFG_H
|
||||
#define __INC_HAL8821CWIFIONLYHWCFG_H
|
||||
|
||||
|
||||
struct rfe_type_8821c_wifi_only {
|
||||
|
||||
u8 rfe_module_type;
|
||||
boolean ext_ant_switch_exist;
|
||||
u8 ext_ant_switch_type; /* 0:DPDT, 1:SPDT */
|
||||
u8 ext_ant_switch_ctrl_polarity; /* iF 0: DPDT_P=0, DPDT_N=1 => BTG to Main, WL_A+G to Aux */
|
||||
|
||||
boolean ant_at_main_port;
|
||||
|
||||
boolean wlg_Locate_at_btg; /* If true: WLG at BTG, If false: WLG at WLAG */
|
||||
|
||||
boolean ext_ant_switch_diversity; /* If diversity on */
|
||||
};
|
||||
|
||||
enum bt_8821c_wifi_only_ext_ant_switch_type {
|
||||
BT_8821C_WIFI_ONLY_EXT_ANT_SWITCH_USE_DPDT = 0x0,
|
||||
BT_8821C_WIFI_ONLY_EXT_ANT_SWITCH_USE_SPDT = 0x1,
|
||||
BT_8821C_WIFI_ONLY_EXT_ANT_SWITCH_NONE = 0x2,
|
||||
BT_8821C_WIFI_ONLY_EXT_ANT_SWITCH_MAX
|
||||
};
|
||||
|
||||
enum bt_8821c_wifi_only_ext_ant_switch_ctrl_type {
|
||||
BT_8821C_WIFI_ONLY_EXT_ANT_SWITCH_CTRL_BY_BBSW = 0x0,
|
||||
BT_8821C_WIFI_ONLY_EXT_ANT_SWITCH_CTRL_BY_PTA = 0x1,
|
||||
BT_8821C_WIFI_ONLY_EXT_ANT_SWITCH_CTRL_BY_ANTDIV = 0x2,
|
||||
BT_8821C_WIFI_ONLY_EXT_ANT_SWITCH_CTRL_BY_MAC = 0x3,
|
||||
BT_8821C_WIFI_ONLY_EXT_ANT_SWITCH_CTRL_BY_BT = 0x4,
|
||||
BT_8821C_WIFI_ONLY_EXT_ANT_SWITCH_CTRL_MAX
|
||||
};
|
||||
|
||||
enum bt_8821c_wifi_only_ext_ant_switch_pos_type {
|
||||
BT_8821C_WIFI_ONLY_EXT_ANT_SWITCH_TO_BT = 0x0,
|
||||
BT_8821C_WIFI_ONLY_EXT_ANT_SWITCH_TO_WLG = 0x1,
|
||||
BT_8821C_WIFI_ONLY_EXT_ANT_SWITCH_TO_WLA = 0x2,
|
||||
BT_8821C_WIFI_ONLY_EXT_ANT_SWITCH_TO_NOCARE = 0x3,
|
||||
BT_8821C_WIFI_ONLY_EXT_ANT_SWITCH_TO_MAX
|
||||
};
|
||||
|
||||
|
||||
VOID
|
||||
hal8821c_wifi_only_switch_antenna(
|
||||
IN struct wifi_only_cfg *pwifionlycfg,
|
||||
IN u1Byte is_5g
|
||||
);
|
||||
|
||||
VOID
|
||||
halbtc8821c_wifi_only_set_rfe_type(
|
||||
IN struct wifi_only_cfg *pwifionlycfg
|
||||
);
|
||||
|
||||
|
||||
VOID
|
||||
ex_hal8821c_wifi_only_hw_config(
|
||||
IN struct wifi_only_cfg *pwifionlycfg
|
||||
);
|
||||
VOID
|
||||
ex_hal8821c_wifi_only_scannotify(
|
||||
IN struct wifi_only_cfg *pwifionlycfg,
|
||||
IN u1Byte is_5g
|
||||
);
|
||||
VOID
|
||||
ex_hal8821c_wifi_only_switchbandnotify(
|
||||
IN struct wifi_only_cfg *pwifionlycfg,
|
||||
IN u1Byte is_5g
|
||||
);
|
||||
#endif
|
6840
hal/btc/halbtc8822b1ant.c
Normal file
6840
hal/btc/halbtc8822b1ant.c
Normal file
File diff suppressed because it is too large
Load diff
433
hal/btc/halbtc8822b1ant.h
Normal file
433
hal/btc/halbtc8822b1ant.h
Normal file
|
@ -0,0 +1,433 @@
|
|||
|
||||
#if (BT_SUPPORT == 1 && COEX_SUPPORT == 1)
|
||||
|
||||
#if (RTL8822B_SUPPORT == 1)
|
||||
|
||||
/* *******************************************
|
||||
* The following is for 8822B 1ANT BT Co-exist definition
|
||||
* ******************************************* */
|
||||
#define BT_AUTO_REPORT_ONLY_8822B_1ANT 1
|
||||
|
||||
#define BT_INFO_8822B_1ANT_B_FTP BIT(7)
|
||||
#define BT_INFO_8822B_1ANT_B_A2DP BIT(6)
|
||||
#define BT_INFO_8822B_1ANT_B_HID BIT(5)
|
||||
#define BT_INFO_8822B_1ANT_B_SCO_BUSY BIT(4)
|
||||
#define BT_INFO_8822B_1ANT_B_ACL_BUSY BIT(3)
|
||||
#define BT_INFO_8822B_1ANT_B_INQ_PAGE BIT(2)
|
||||
#define BT_INFO_8822B_1ANT_B_SCO_ESCO BIT(1)
|
||||
#define BT_INFO_8822B_1ANT_B_CONNECTION BIT(0)
|
||||
|
||||
#define BT_INFO_8822B_1ANT_A2DP_BASIC_RATE(_BT_INFO_EXT_) \
|
||||
(((_BT_INFO_EXT_&BIT(0))) ? true : false)
|
||||
|
||||
#define BTC_RSSI_COEX_THRESH_TOL_8822B_1ANT 2
|
||||
|
||||
#define BT_8822B_1ANT_WIFI_NOISY_THRESH 150 /* max: 255 */
|
||||
|
||||
/* for Antenna detection */
|
||||
#define BT_8822B_1ANT_ANTDET_PSDTHRES_BACKGROUND 50
|
||||
#define BT_8822B_1ANT_ANTDET_PSDTHRES_2ANT_BADISOLATION 70
|
||||
#define BT_8822B_1ANT_ANTDET_PSDTHRES_2ANT_GOODISOLATION 55
|
||||
#define BT_8822B_1ANT_ANTDET_PSDTHRES_1ANT 35
|
||||
#define BT_8822B_1ANT_ANTDET_RETRY_INTERVAL 10 /* retry timer if ant det is fail, unit: second */
|
||||
#define BT_8822B_1ANT_ANTDET_ENABLE 0
|
||||
#define BT_8822B_1ANT_ANTDET_COEXMECHANISMSWITCH_ENABLE 0
|
||||
|
||||
#define BT_8822B_1ANT_LTECOEX_INDIRECTREG_ACCESS_TIMEOUT 30000
|
||||
|
||||
|
||||
|
||||
enum bt_8822b_1ant_signal_state {
|
||||
BT_8822B_1ANT_SIG_STA_SET_TO_LOW = 0x0,
|
||||
BT_8822B_1ANT_SIG_STA_SET_BY_HW = 0x0,
|
||||
BT_8822B_1ANT_SIG_STA_SET_TO_HIGH = 0x1,
|
||||
BT_8822B_1ANT_SIG_STA_MAX
|
||||
};
|
||||
|
||||
enum bt_8822b_1ant_path_ctrl_owner {
|
||||
BT_8822B_1ANT_PCO_BTSIDE = 0x0,
|
||||
BT_8822B_1ANT_PCO_WLSIDE = 0x1,
|
||||
BT_8822B_1ANT_PCO_MAX
|
||||
};
|
||||
|
||||
enum bt_8822b_1ant_gnt_ctrl_type {
|
||||
BT_8822B_1ANT_GNT_CTRL_BY_PTA = 0x0,
|
||||
BT_8822B_1ANT_GNT_CTRL_BY_SW = 0x1,
|
||||
BT_8822B_1ANT_GNT_CTRL_MAX
|
||||
};
|
||||
|
||||
enum bt_8822b_1ant_gnt_ctrl_block {
|
||||
BT_8822B_1ANT_GNT_BLOCK_RFC_BB = 0x0,
|
||||
BT_8822B_1ANT_GNT_BLOCK_RFC = 0x1,
|
||||
BT_8822B_1ANT_GNT_BLOCK_BB = 0x2,
|
||||
BT_8822B_1ANT_GNT_BLOCK_MAX
|
||||
};
|
||||
|
||||
enum bt_8822b_1ant_lte_coex_table_type {
|
||||
BT_8822B_1ANT_CTT_WL_VS_LTE = 0x0,
|
||||
BT_8822B_1ANT_CTT_BT_VS_LTE = 0x1,
|
||||
BT_8822B_1ANT_CTT_MAX
|
||||
};
|
||||
|
||||
enum bt_8822b_1ant_lte_break_table_type {
|
||||
BT_8822B_1ANT_LBTT_WL_BREAK_LTE = 0x0,
|
||||
BT_8822B_1ANT_LBTT_BT_BREAK_LTE = 0x1,
|
||||
BT_8822B_1ANT_LBTT_LTE_BREAK_WL = 0x2,
|
||||
BT_8822B_1ANT_LBTT_LTE_BREAK_BT = 0x3,
|
||||
BT_8822B_1ANT_LBTT_MAX
|
||||
};
|
||||
|
||||
enum bt_info_src_8822b_1ant {
|
||||
BT_INFO_SRC_8822B_1ANT_WIFI_FW = 0x0,
|
||||
BT_INFO_SRC_8822B_1ANT_BT_RSP = 0x1,
|
||||
BT_INFO_SRC_8822B_1ANT_BT_ACTIVE_SEND = 0x2,
|
||||
BT_INFO_SRC_8822B_1ANT_MAX
|
||||
};
|
||||
|
||||
enum bt_8822b_1ant_bt_status {
|
||||
BT_8822B_1ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0,
|
||||
BT_8822B_1ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
|
||||
BT_8822B_1ANT_BT_STATUS_INQ_PAGE = 0x2,
|
||||
BT_8822B_1ANT_BT_STATUS_ACL_BUSY = 0x3,
|
||||
BT_8822B_1ANT_BT_STATUS_SCO_BUSY = 0x4,
|
||||
BT_8822B_1ANT_BT_STATUS_ACL_SCO_BUSY = 0x5,
|
||||
BT_8822B_1ANT_BT_STATUS_MAX
|
||||
};
|
||||
|
||||
enum bt_8822b_1ant_wifi_status {
|
||||
BT_8822B_1ANT_WIFI_STATUS_NON_CONNECTED_IDLE = 0x0,
|
||||
BT_8822B_1ANT_WIFI_STATUS_NON_CONNECTED_ASSO_AUTH_SCAN = 0x1,
|
||||
BT_8822B_1ANT_WIFI_STATUS_CONNECTED_SCAN = 0x2,
|
||||
BT_8822B_1ANT_WIFI_STATUS_CONNECTED_SPECIFIC_PKT = 0x3,
|
||||
BT_8822B_1ANT_WIFI_STATUS_CONNECTED_IDLE = 0x4,
|
||||
BT_8822B_1ANT_WIFI_STATUS_CONNECTED_BUSY = 0x5,
|
||||
BT_8822B_1ANT_WIFI_STATUS_MAX
|
||||
};
|
||||
|
||||
enum bt_8822b_1ant_coex_algo {
|
||||
BT_8822B_1ANT_COEX_ALGO_UNDEFINED = 0x0,
|
||||
BT_8822B_1ANT_COEX_ALGO_SCO = 0x1,
|
||||
BT_8822B_1ANT_COEX_ALGO_HID = 0x2,
|
||||
BT_8822B_1ANT_COEX_ALGO_A2DP = 0x3,
|
||||
BT_8822B_1ANT_COEX_ALGO_A2DP_PANHS = 0x4,
|
||||
BT_8822B_1ANT_COEX_ALGO_PANEDR = 0x5,
|
||||
BT_8822B_1ANT_COEX_ALGO_PANHS = 0x6,
|
||||
BT_8822B_1ANT_COEX_ALGO_PANEDR_A2DP = 0x7,
|
||||
BT_8822B_1ANT_COEX_ALGO_PANEDR_HID = 0x8,
|
||||
BT_8822B_1ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x9,
|
||||
BT_8822B_1ANT_COEX_ALGO_HID_A2DP = 0xa,
|
||||
BT_8822B_1ANT_COEX_ALGO_MAX = 0xb,
|
||||
};
|
||||
|
||||
enum bt_8822b_1ant_ext_ant_switch_type {
|
||||
BT_8822B_1ANT_EXT_ANT_SWITCH_USE_SPDT = 0x0,
|
||||
BT_8822B_1ANT_EXT_ANT_SWITCH_USE_SP3T = 0x1,
|
||||
BT_8822B_1ANT_EXT_ANT_SWITCH_MAX
|
||||
};
|
||||
|
||||
enum bt_8822b_1ant_ext_ant_switch_ctrl_type {
|
||||
BT_8822B_1ANT_EXT_ANT_SWITCH_CTRL_BY_BBSW = 0x0,
|
||||
BT_8822B_1ANT_EXT_ANT_SWITCH_CTRL_BY_PTA = 0x1,
|
||||
BT_8822B_1ANT_EXT_ANT_SWITCH_CTRL_BY_ANTDIV = 0x2,
|
||||
BT_8822B_1ANT_EXT_ANT_SWITCH_CTRL_BY_MAC = 0x3,
|
||||
BT_8822B_1ANT_EXT_ANT_SWITCH_CTRL_BY_BT = 0x4,
|
||||
BT_8822B_1ANT_EXT_ANT_SWITCH_CTRL_MAX
|
||||
};
|
||||
|
||||
enum bt_8822b_1ant_ext_ant_switch_pos_type {
|
||||
BT_8822B_1ANT_EXT_ANT_SWITCH_TO_BT = 0x0,
|
||||
BT_8822B_1ANT_EXT_ANT_SWITCH_TO_WLG = 0x1,
|
||||
BT_8822B_1ANT_EXT_ANT_SWITCH_TO_WLA = 0x2,
|
||||
BT_8822B_1ANT_EXT_ANT_SWITCH_TO_NOCARE = 0x3,
|
||||
BT_8822B_1ANT_EXT_ANT_SWITCH_TO_MAX
|
||||
};
|
||||
|
||||
enum bt_8822b_1ant_phase {
|
||||
BT_8822B_1ANT_PHASE_COEX_INIT = 0x0,
|
||||
BT_8822B_1ANT_PHASE_WLANONLY_INIT = 0x1,
|
||||
BT_8822B_1ANT_PHASE_WLAN_OFF = 0x2,
|
||||
BT_8822B_1ANT_PHASE_2G_RUNTIME = 0x3,
|
||||
BT_8822B_1ANT_PHASE_5G_RUNTIME = 0x4,
|
||||
BT_8822B_1ANT_PHASE_BTMPMODE = 0x5,
|
||||
BT_8822B_1ANT_PHASE_MAX
|
||||
};
|
||||
|
||||
/*ADD SCOREBOARD TO FIX BT LPS 32K ISSUE WHILE WL BUSY*/
|
||||
enum bt_8822b_1ant_Scoreboard {
|
||||
BT_8822B_1ANT_SCOREBOARD_ACTIVE = BIT(0),
|
||||
BT_8822B_1ANT_SCOREBOARD_ONOFF = BIT(1),
|
||||
BT_8822B_1ANT_SCOREBOARD_SCAN = BIT(2),
|
||||
BT_8822B_1ANT_SCOREBOARD_UNDERTEST = BIT(3),
|
||||
BT_8822B_1ANT_SCOREBOARD_WLBUSY = BIT(6)
|
||||
};
|
||||
|
||||
struct coex_dm_8822b_1ant {
|
||||
/* hw setting */
|
||||
u32 pre_ant_pos_type;
|
||||
u32 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;
|
||||
|
||||
u32 pre_ext_ant_switch_status;
|
||||
u32 cur_ext_ant_switch_status;
|
||||
|
||||
u8 error_condition;
|
||||
};
|
||||
|
||||
struct coex_sta_8822b_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_8822B_1ANT_MAX][10];
|
||||
u32 bt_info_c2h_cnt[BT_INFO_SRC_8822B_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_ok_11n_vht;
|
||||
|
||||
u32 crc_err_cck;
|
||||
u32 crc_err_11g;
|
||||
u32 crc_err_11n;
|
||||
u32 crc_err_11n_agg;
|
||||
u32 crc_err_11n_vht;
|
||||
|
||||
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;
|
||||
|
||||
u32 special_pkt_period_cnt;
|
||||
|
||||
u16 score_board;
|
||||
|
||||
u8 a2dp_bit_pool;
|
||||
u8 cut_version;
|
||||
boolean acl_busy;
|
||||
boolean wl_rf_off_on_event;
|
||||
boolean bt_create_connection;
|
||||
boolean run_time_state;
|
||||
|
||||
u32 bt_coex_supported_feature;
|
||||
u32 bt_coex_supported_version;
|
||||
};
|
||||
|
||||
struct rfe_type_8822b_1ant {
|
||||
|
||||
u8 rfe_module_type;
|
||||
boolean ext_ant_switch_exist;
|
||||
u8 ext_ant_switch_type;
|
||||
u8 ext_ant_switch_ctrl_polarity; /* iF 0: ANTSW(rfe_sel9)=0, ANTSWB(rfe_sel8)=1 => Ant to BT/5G */
|
||||
};
|
||||
|
||||
|
||||
#define BT_8822B_1ANT_ANTDET_PSD_POINTS 256 /* MAX:1024 */
|
||||
#define BT_8822B_1ANT_ANTDET_PSD_AVGNUM 1 /* MAX:3 */
|
||||
#define BT_8822B_1ANT_ANTDET_BUF_LEN 16
|
||||
|
||||
struct psdscan_sta_8822b_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_8822B_1ANT_ANTDET_BUF_LEN];
|
||||
u8 ant_det_peak_freq[BT_8822B_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_halbtc8822b1ant_power_on_setting(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8822b1ant_pre_load_firmware(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8822b1ant_init_hw_config(IN struct btc_coexist *btcoexist,
|
||||
IN boolean wifi_only);
|
||||
void ex_halbtc8822b1ant_init_coex_dm(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8822b1ant_ips_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8822b1ant_lps_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8822b1ant_scan_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8822b1ant_scan_notify_without_bt(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8822b1ant_switchband_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8822b1ant_switchband_notify_without_bt(IN struct btc_coexist
|
||||
*btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8822b1ant_connect_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8822b1ant_media_status_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8822b1ant_specific_packet_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8822b1ant_bt_info_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 *tmp_buf, IN u8 length);
|
||||
void ex_halbtc8822b1ant_rf_status_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8822b1ant_halt_notify(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8822b1ant_pnp_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 pnp_state);
|
||||
void ex_halbtc8822b1ant_ScoreBoardStatusNotify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 *tmp_buf, IN u8 length);
|
||||
void ex_halbtc8822b1ant_coex_dm_reset(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8822b1ant_periodical(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8822b1ant_display_coex_info(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8822b1ant_antenna_detection(IN struct btc_coexist *btcoexist,
|
||||
IN u32 cent_freq, IN u32 offset, IN u32 span, IN u32 seconds);
|
||||
void ex_halbtc8822b1ant_antenna_isolation(IN struct btc_coexist *btcoexist,
|
||||
IN u32 cent_freq, IN u32 offset, IN u32 span, IN u32 seconds);
|
||||
|
||||
void ex_halbtc8822b1ant_psd_scan(IN struct btc_coexist *btcoexist,
|
||||
IN u32 cent_freq, IN u32 offset, IN u32 span, IN u32 seconds);
|
||||
void ex_halbtc8822b1ant_display_ant_detection(IN struct btc_coexist *btcoexist);
|
||||
|
||||
void ex_halbtc8822b1ant_dbg_control(IN struct btc_coexist *btcoexist,
|
||||
IN u8 op_code, IN u8 op_len, IN u8 *pdata);
|
||||
|
||||
#else
|
||||
#define ex_halbtc8822b1ant_power_on_setting(btcoexist)
|
||||
#define ex_halbtc8822b1ant_pre_load_firmware(btcoexist)
|
||||
#define ex_halbtc8822b1ant_init_hw_config(btcoexist, wifi_only)
|
||||
#define ex_halbtc8822b1ant_init_coex_dm(btcoexist)
|
||||
#define ex_halbtc8822b1ant_ips_notify(btcoexist, type)
|
||||
#define ex_halbtc8822b1ant_lps_notify(btcoexist, type)
|
||||
#define ex_halbtc8822b1ant_scan_notify(btcoexist, type)
|
||||
#define ex_halbtc8822b1ant_scan_notify_without_bt(btcoexist, type)
|
||||
#define ex_halbtc8822b1ant_switchband_notify(btcoexist, type)
|
||||
#define ex_halbtc8822b1ant_switchband_notify_without_bt(btcoexist, type)
|
||||
#define ex_halbtc8822b1ant_connect_notify(btcoexist, type)
|
||||
#define ex_halbtc8822b1ant_media_status_notify(btcoexist, type)
|
||||
#define ex_halbtc8822b1ant_specific_packet_notify(btcoexist, type)
|
||||
#define ex_halbtc8822b1ant_bt_info_notify(btcoexist, tmp_buf, length)
|
||||
#define ex_halbtc8822b1ant_rf_status_notify(btcoexist, type)
|
||||
#define ex_halbtc8822b1ant_halt_notify(btcoexist)
|
||||
#define ex_halbtc8822b1ant_pnp_notify(btcoexist, pnp_state)
|
||||
#define ex_halbtc8822b1ant_ScoreBoardStatusNotify(btcoexist, tmp_buf, length)
|
||||
#define ex_halbtc8822b1ant_coex_dm_reset(btcoexist)
|
||||
#define ex_halbtc8822b1ant_periodical(btcoexist)
|
||||
#define ex_halbtc8822b1ant_display_coex_info(btcoexist)
|
||||
#define ex_halbtc8822b1ant_antenna_detection(btcoexist, cent_freq, offset, span, seconds)
|
||||
#define ex_halbtc8822b1ant_antenna_isolation(btcoexist, cent_freq, offset, span, seconds)
|
||||
#define ex_halbtc8822b1ant_psd_scan(btcoexist, cent_freq, offset, span, seconds)
|
||||
#define ex_halbtc8822b1ant_display_ant_detection(btcoexist)
|
||||
#define ex_halbtc8822b1ant_dbg_control(btcoexist, op_code, op_len, pdata)
|
||||
#endif
|
||||
#else
|
||||
|
||||
void ex_halbtc8822b1ant_init_hw_config_without_bt(IN struct btc_coexist
|
||||
*btcoexist);
|
||||
void ex_halbtc8822b1ant_switch_band_without_bt(IN struct btc_coexist *btcoexist,
|
||||
IN boolean wifi_only_5g);
|
||||
|
||||
|
||||
#endif
|
||||
|
5543
hal/btc/halbtc8822b2ant.c
Normal file
5543
hal/btc/halbtc8822b2ant.c
Normal file
File diff suppressed because it is too large
Load diff
493
hal/btc/halbtc8822b2ant.h
Normal file
493
hal/btc/halbtc8822b2ant.h
Normal file
|
@ -0,0 +1,493 @@
|
|||
|
||||
#if (BT_SUPPORT == 1 && COEX_SUPPORT == 1)
|
||||
|
||||
#if (RTL8822B_SUPPORT == 1)
|
||||
|
||||
/* *******************************************
|
||||
* The following is for 8822B 2Ant BT Co-exist definition
|
||||
* ******************************************* */
|
||||
#define BT_8822B_2ANT_COEX_DBG 1
|
||||
#define BT_AUTO_REPORT_ONLY_8822B_2ANT 1
|
||||
|
||||
|
||||
|
||||
|
||||
#define BT_INFO_8822B_2ANT_B_FTP BIT(7)
|
||||
#define BT_INFO_8822B_2ANT_B_A2DP BIT(6)
|
||||
#define BT_INFO_8822B_2ANT_B_HID BIT(5)
|
||||
#define BT_INFO_8822B_2ANT_B_SCO_BUSY BIT(4)
|
||||
#define BT_INFO_8822B_2ANT_B_ACL_BUSY BIT(3)
|
||||
#define BT_INFO_8822B_2ANT_B_INQ_PAGE BIT(2)
|
||||
#define BT_INFO_8822B_2ANT_B_SCO_ESCO BIT(1)
|
||||
#define BT_INFO_8822B_2ANT_B_CONNECTION BIT(0)
|
||||
|
||||
#define BTC_RSSI_COEX_THRESH_TOL_8822B_2ANT 2
|
||||
|
||||
|
||||
#define BT_8822B_2ANT_WIFI_RSSI_COEXSWITCH_THRES1 80 /* unit: % WiFi RSSI Threshold for 2-Ant free-run/2-Ant TDMA translation, default = 42 */
|
||||
#define BT_8822B_2ANT_BT_RSSI_COEXSWITCH_THRES1 80 /* unit: % BT RSSI Threshold for 2-Ant free-run/2-Ant TDMA translation, default = 46 */
|
||||
#define BT_8822B_2ANT_WIFI_RSSI_COEXSWITCH_THRES2 40 /* unit: % WiFi RSSI Threshold for 1-Ant TDMA/1-Ant PS-TDMA translation, default = 42 */
|
||||
#define BT_8822B_2ANT_BT_RSSI_COEXSWITCH_THRES2 35 /* unit: % BT RSSI Threshold for 1-Ant TDMA/1-Ant PS-TDMA translation, default = 46 */
|
||||
#define BT_8822B_2ANT_DEFAULT_ISOLATION 15 /* unit: dB */
|
||||
#define BT_8822B_2ANT_WIFI_MAX_TX_POWER 15 /* unit: dBm */
|
||||
#define BT_8822B_2ANT_BT_MAX_TX_POWER 3 /* unit: dBm */
|
||||
#define BT_8822B_2ANT_WIFI_SIR_THRES1 -15 /* unit: dB */
|
||||
#define BT_8822B_2ANT_WIFI_SIR_THRES2 -30 /* unit: dB */
|
||||
#define BT_8822B_2ANT_BT_SIR_THRES1 -15 /* unit: dB */
|
||||
#define BT_8822B_2ANT_BT_SIR_THRES2 -30 /* unit: dB */
|
||||
|
||||
|
||||
/* for Antenna detection */
|
||||
#define BT_8822B_2ANT_ANTDET_PSDTHRES_BACKGROUND 50
|
||||
#define BT_8822B_2ANT_ANTDET_PSDTHRES_2ANT_BADISOLATION 70
|
||||
#define BT_8822B_2ANT_ANTDET_PSDTHRES_2ANT_GOODISOLATION 52
|
||||
#define BT_8822B_2ANT_ANTDET_PSDTHRES_1ANT 40
|
||||
#define BT_8822B_2ANT_ANTDET_RETRY_INTERVAL 10 /* retry timer if ant det is fail, unit: second */
|
||||
#define BT_8822B_2ANT_ANTDET_SWEEPPOINT_DELAY 60000
|
||||
#define BT_8822B_2ANT_ANTDET_ENABLE 0
|
||||
#define BT_8822B_2ANT_ANTDET_BTTXTIME 100
|
||||
#define BT_8822B_2ANT_ANTDET_BTTXCHANNEL 39
|
||||
#define BT_8822B_2ANT_ANTDET_PSD_SWWEEPCOUNT 50
|
||||
|
||||
|
||||
#define BT_8822B_2ANT_LTECOEX_INDIRECTREG_ACCESS_TIMEOUT 30000
|
||||
|
||||
enum bt_8822b_2ant_signal_state {
|
||||
BT_8822B_2ANT_SIG_STA_SET_TO_LOW = 0x0,
|
||||
BT_8822B_2ANT_SIG_STA_SET_BY_HW = 0x0,
|
||||
BT_8822B_2ANT_SIG_STA_SET_TO_HIGH = 0x1,
|
||||
BT_8822B_2ANT_SIG_STA_MAX
|
||||
};
|
||||
|
||||
enum bt_8822b_2ant_path_ctrl_owner {
|
||||
BT_8822B_2ANT_PCO_BTSIDE = 0x0,
|
||||
BT_8822B_2ANT_PCO_WLSIDE = 0x1,
|
||||
BT_8822B_2ANT_PCO_MAX
|
||||
};
|
||||
|
||||
enum bt_8822b_2ant_gnt_ctrl_type {
|
||||
BT_8822B_2ANT_GNT_TYPE_CTRL_BY_PTA = 0x0,
|
||||
BT_8822B_2ANT_GNT_TYPE_CTRL_BY_SW = 0x1,
|
||||
BT_8822B_2ANT_GNT_TYPE_MAX
|
||||
};
|
||||
|
||||
enum bt_8822b_2ant_gnt_ctrl_block {
|
||||
BT_8822B_2ANT_GNT_BLOCK_RFC_BB = 0x0,
|
||||
BT_8822B_2ANT_GNT_BLOCK_RFC = 0x1,
|
||||
BT_8822B_2ANT_GNT_BLOCK_BB = 0x2,
|
||||
BT_8822B_2ANT_GNT_BLOCK_MAX
|
||||
};
|
||||
|
||||
enum bt_8822b_2ant_lte_coex_table_type {
|
||||
BT_8822B_2ANT_CTT_WL_VS_LTE = 0x0,
|
||||
BT_8822B_2ANT_CTT_BT_VS_LTE = 0x1,
|
||||
BT_8822B_2ANT_CTT_MAX
|
||||
};
|
||||
|
||||
enum bt_8822b_2ant_lte_break_table_type {
|
||||
BT_8822B_2ANT_LBTT_WL_BREAK_LTE = 0x0,
|
||||
BT_8822B_2ANT_LBTT_BT_BREAK_LTE = 0x1,
|
||||
BT_8822B_2ANT_LBTT_LTE_BREAK_WL = 0x2,
|
||||
BT_8822B_2ANT_LBTT_LTE_BREAK_BT = 0x3,
|
||||
BT_8822B_2ANT_LBTT_MAX
|
||||
};
|
||||
|
||||
enum bt_info_src_8822b_2ant {
|
||||
BT_INFO_SRC_8822B_2ANT_WIFI_FW = 0x0,
|
||||
BT_INFO_SRC_8822B_2ANT_BT_RSP = 0x1,
|
||||
BT_INFO_SRC_8822B_2ANT_BT_ACTIVE_SEND = 0x2,
|
||||
BT_INFO_SRC_8822B_2ANT_MAX
|
||||
};
|
||||
|
||||
enum bt_8822b_2ant_bt_status {
|
||||
BT_8822B_2ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0,
|
||||
BT_8822B_2ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
|
||||
BT_8822B_2ANT_BT_STATUS_INQ_PAGE = 0x2,
|
||||
BT_8822B_2ANT_BT_STATUS_ACL_BUSY = 0x3,
|
||||
BT_8822B_2ANT_BT_STATUS_SCO_BUSY = 0x4,
|
||||
BT_8822B_2ANT_BT_STATUS_ACL_SCO_BUSY = 0x5,
|
||||
BT_8822B_2ANT_BT_STATUS_MAX
|
||||
};
|
||||
|
||||
enum bt_8822b_2ant_coex_algo {
|
||||
BT_8822B_2ANT_COEX_ALGO_UNDEFINED = 0x0,
|
||||
BT_8822B_2ANT_COEX_ALGO_SCO = 0x1,
|
||||
BT_8822B_2ANT_COEX_ALGO_HID = 0x2,
|
||||
BT_8822B_2ANT_COEX_ALGO_A2DP = 0x3,
|
||||
BT_8822B_2ANT_COEX_ALGO_A2DP_PANHS = 0x4,
|
||||
BT_8822B_2ANT_COEX_ALGO_PANEDR = 0x5,
|
||||
BT_8822B_2ANT_COEX_ALGO_PANHS = 0x6,
|
||||
BT_8822B_2ANT_COEX_ALGO_PANEDR_A2DP = 0x7,
|
||||
BT_8822B_2ANT_COEX_ALGO_PANEDR_HID = 0x8,
|
||||
BT_8822B_2ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x9,
|
||||
BT_8822B_2ANT_COEX_ALGO_HID_A2DP = 0xa,
|
||||
BT_8822B_2ANT_COEX_ALGO_NOPROFILEBUSY = 0xb,
|
||||
BT_8822B_2ANT_COEX_ALGO_MAX
|
||||
};
|
||||
|
||||
enum bt_8822b_2ant_ext_ant_switch_type {
|
||||
BT_8822B_2ANT_EXT_ANT_SWITCH_USE_DPDT = 0x0,
|
||||
BT_8822B_2ANT_EXT_ANT_SWITCH_USE_SPDT = 0x1,
|
||||
BT_8822B_2ANT_EXT_ANT_SWITCH_NONE = 0x2,
|
||||
BT_8822B_2ANT_EXT_ANT_SWITCH_MAX
|
||||
};
|
||||
|
||||
enum bt_8822b_2ant_ext_ant_switch_ctrl_type {
|
||||
BT_8822B_2ANT_EXT_ANT_SWITCH_CTRL_BY_BBSW = 0x0,
|
||||
BT_8822B_2ANT_EXT_ANT_SWITCH_CTRL_BY_PTA = 0x1,
|
||||
BT_8822B_2ANT_EXT_ANT_SWITCH_CTRL_BY_ANTDIV = 0x2,
|
||||
BT_8822B_2ANT_EXT_ANT_SWITCH_CTRL_BY_MAC = 0x3,
|
||||
BT_8822B_2ANT_EXT_ANT_SWITCH_CTRL_BY_BT = 0x4,
|
||||
BT_8822B_2ANT_EXT_ANT_SWITCH_CTRL_MAX
|
||||
};
|
||||
|
||||
enum bt_8822b_2ant_ext_ant_switch_pos_type {
|
||||
BT_8822B_2ANT_EXT_ANT_SWITCH_MAIN_TO_BT = 0x0,
|
||||
BT_8822B_2ANT_EXT_ANT_SWITCH_MAIN_TO_WLG = 0x1,
|
||||
BT_8822B_2ANT_EXT_ANT_SWITCH_MAIN_TO_WLA = 0x2,
|
||||
BT_8822B_2ANT_EXT_ANT_SWITCH_MAIN_TO_NOCARE = 0x3,
|
||||
BT_8822B_2ANT_EXT_ANT_SWITCH_MAIN_TO_MAX
|
||||
};
|
||||
|
||||
enum bt_8822b_2ant_ext_band_switch_pos_type {
|
||||
BT_8822B_2ANT_EXT_BAND_SWITCH_TO_WLG = 0x0,
|
||||
BT_8822B_2ANT_EXT_BAND_SWITCH_TO_WLA = 0x1,
|
||||
BT_8822B_2ANT_EXT_BAND_SWITCH_TO_MAX
|
||||
};
|
||||
|
||||
enum bt_8822b_2ant_int_block {
|
||||
BT_8822B_2ANT_INT_BLOCK_SWITCH_TO_WLG_OF_BTG = 0x0,
|
||||
BT_8822B_2ANT_INT_BLOCK_SWITCH_TO_WLG_OF_WLAG = 0x1,
|
||||
BT_8822B_2ANT_INT_BLOCK_SWITCH_TO_WLA_OF_WLAG = 0x2,
|
||||
BT_8822B_2ANT_INT_BLOCK_SWITCH_TO_MAX
|
||||
};
|
||||
|
||||
enum bt_8822b_2ant_phase {
|
||||
BT_8822B_2ANT_PHASE_COEX_INIT = 0x0,
|
||||
BT_8822B_2ANT_PHASE_WLANONLY_INIT = 0x1,
|
||||
BT_8822B_2ANT_PHASE_WLAN_OFF = 0x2,
|
||||
BT_8822B_2ANT_PHASE_2G_RUNTIME = 0x3,
|
||||
BT_8822B_2ANT_PHASE_5G_RUNTIME = 0x4,
|
||||
BT_8822B_2ANT_PHASE_BTMPMODE = 0x5,
|
||||
BT_8822B_2ANT_PHASE_ANTENNA_DET = 0x6,
|
||||
BT_8822B_2ANT_PHASE_COEX_POWERON = 0x7,
|
||||
BT_8822B_2ANT_PHASE_2G_RUNTIME_CONCURRENT = 0x8,
|
||||
BT_8822B_2ANT_PHASE_MAX
|
||||
};
|
||||
|
||||
/*ADD SCOREBOARD TO FIX BT LPS 32K ISSUE WHILE WL BUSY*/
|
||||
|
||||
enum bt_8822b_2ant_Scoreboard {
|
||||
BT_8822B_2ANT_SCOREBOARD_ACTIVE = BIT(0),
|
||||
BT_8822B_2ANT_SCOREBOARD_ONOFF = BIT(1),
|
||||
BT_8822B_2ANT_SCOREBOARD_SCAN = BIT(2),
|
||||
BT_8822B_2ANT_SCOREBOARD_UNDERTEST = BIT(3),
|
||||
BT_8822B_2ANT_SCOREBOARD_WLBUSY = BIT(6)
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
struct coex_dm_8822b_2ant {
|
||||
/* hw setting */
|
||||
u32 pre_ant_pos_type;
|
||||
u32 cur_ant_pos_type;
|
||||
/* 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 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;
|
||||
u32 arp_cnt;
|
||||
|
||||
u32 pre_ext_ant_switch_status;
|
||||
u32 cur_ext_ant_switch_status;
|
||||
|
||||
u8 pre_ext_band_switch_status;
|
||||
u8 cur_ext_band_switch_status;
|
||||
|
||||
u8 pre_int_block_status;
|
||||
u8 cur_int_block_status;
|
||||
};
|
||||
|
||||
struct coex_sta_8822b_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_8822B_2ANT_MAX][10];
|
||||
u32 bt_info_c2h_cnt[BT_INFO_SRC_8822B_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;
|
||||
u8 bt_info_ext2;
|
||||
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_ok_11n_vht;
|
||||
|
||||
u32 crc_err_cck;
|
||||
u32 crc_err_11g;
|
||||
u32 crc_err_11n;
|
||||
u32 crc_err_11n_agg;
|
||||
u32 crc_err_11n_vht;
|
||||
|
||||
boolean cck_lock;
|
||||
boolean pre_ccklock;
|
||||
boolean cck_ever_lock;
|
||||
|
||||
u8 coex_table_type;
|
||||
boolean force_lps_on;
|
||||
|
||||
u8 dis_ver_info_cnt;
|
||||
|
||||
u8 a2dp_bit_pool;
|
||||
u8 cut_version;
|
||||
|
||||
boolean concurrent_rx_mode_on;
|
||||
|
||||
u16 score_board;
|
||||
u8 isolation_btween_wb; /* 0~ 50 */
|
||||
u8 wifi_coex_thres;
|
||||
u8 bt_coex_thres;
|
||||
u8 wifi_coex_thres2;
|
||||
u8 bt_coex_thres2;
|
||||
|
||||
u8 num_of_profile;
|
||||
boolean acl_busy;
|
||||
boolean wl_rf_off_on_event;
|
||||
boolean bt_create_connection;
|
||||
boolean wifi_is_high_pri_task;
|
||||
u32 specific_pkt_period_cnt;
|
||||
u32 bt_coex_supported_feature;
|
||||
u32 bt_coex_supported_version;
|
||||
|
||||
u8 bt_ble_scan_type;
|
||||
u8 bt_ble_scan_para[3];
|
||||
|
||||
boolean run_time_state;
|
||||
boolean freeze_coexrun_by_btinfo;
|
||||
|
||||
boolean is_A2DP_3M;
|
||||
boolean voice_over_HOGP;
|
||||
u8 bt_info;
|
||||
boolean is_autoslot;
|
||||
u8 forbidden_slot;
|
||||
u8 hid_busy_num;
|
||||
u8 hid_pair_cnt;
|
||||
|
||||
u32 cnt_RemoteNameReq;
|
||||
u32 cnt_setupLink;
|
||||
u32 cnt_ReInit;
|
||||
u32 cnt_IgnWlanAct;
|
||||
u32 cnt_Page;
|
||||
|
||||
u16 bt_reg_vendor_ac;
|
||||
u16 bt_reg_vendor_ae;
|
||||
|
||||
boolean is_setupLink;
|
||||
u8 wl_noisy_level;
|
||||
u32 gnt_error_cnt;
|
||||
|
||||
u8 bt_afh_map[10];
|
||||
u8 bt_relink_downcount;
|
||||
};
|
||||
|
||||
|
||||
#define BT_8822B_2ANT_EXT_BAND_SWITCH_USE_DPDT 0
|
||||
#define BT_8822B_2ANT_EXT_BAND_SWITCH_USE_SPDT 1
|
||||
|
||||
|
||||
struct rfe_type_8822b_2ant {
|
||||
|
||||
u8 rfe_module_type;
|
||||
boolean ext_ant_switch_exist;
|
||||
u8 ext_ant_switch_type; /* 0:DPDT, 1:SPDT */
|
||||
u8 ext_ant_switch_ctrl_polarity; /* iF 0: DPDT_P=0, DPDT_N=1 => BTG to Main, WL_A+G to Aux */
|
||||
|
||||
boolean ext_band_switch_exist;
|
||||
u8 ext_band_switch_type; /* 0:DPDT, 1:SPDT */
|
||||
u8 ext_band_switch_ctrl_polarity;
|
||||
|
||||
boolean wlg_Locate_at_btg; /* If true: WLG at BTG, If false: WLG at WLAG */
|
||||
|
||||
boolean ext_ant_switch_diversity; /* If diversity on */
|
||||
};
|
||||
|
||||
#define BT_8822B_2ANT_ANTDET_PSD_POINTS 256 /* MAX:1024 */
|
||||
#define BT_8822B_2ANT_ANTDET_PSD_AVGNUM 1 /* MAX:3 */
|
||||
#define BT_8822B_2ANT_ANTDET_BUF_LEN 16
|
||||
|
||||
struct psdscan_sta_8822b_2ant {
|
||||
|
||||
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_8822B_2ANT_ANTDET_BUF_LEN];
|
||||
u8 ant_det_peak_freq[BT_8822B_2ANT_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_max_value2;
|
||||
u32 psd_avg_value; /* filter loop_max_value that below BT_8822B_1ANT_ANTDET_PSDTHRES_1ANT, and average the rest*/
|
||||
u32 psd_loop_max_value[BT_8822B_2ANT_ANTDET_PSD_SWWEEPCOUNT]; /*max value in each loop */
|
||||
u32 psd_start_base;
|
||||
u32 psd_avg_num; /* 1/8/16/32 */
|
||||
u32 psd_gen_count;
|
||||
boolean is_AntDet_running;
|
||||
boolean is_psd_show_max_only;
|
||||
};
|
||||
|
||||
|
||||
/* *******************************************
|
||||
* The following is interface which will notify coex module.
|
||||
* ******************************************* */
|
||||
void ex_halbtc8822b2ant_power_on_setting(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8822b2ant_pre_load_firmware(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8822b2ant_init_hw_config(IN struct btc_coexist *btcoexist,
|
||||
IN boolean wifi_only);
|
||||
void ex_halbtc8822b2ant_init_coex_dm(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8822b2ant_ips_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8822b2ant_lps_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8822b2ant_scan_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8822b2ant_switchband_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8822b2ant_connect_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8822b2ant_media_status_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8822b2ant_specific_packet_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8822b2ant_bt_info_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 *tmp_buf, IN u8 length);
|
||||
void ex_halbtc8822b2ant_rf_status_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8822b2ant_halt_notify(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8822b2ant_pnp_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 pnp_state);
|
||||
void ex_halbtc8822b2ant_periodical(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8822b2ant_display_coex_info(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8822b2ant_antenna_detection(IN struct btc_coexist *btcoexist,
|
||||
IN u32 cent_freq, IN u32 offset, IN u32 span, IN u32 seconds);
|
||||
void ex_halbtc8822b2ant_display_ant_detection(IN struct btc_coexist *btcoexist);
|
||||
|
||||
|
||||
#else
|
||||
#define ex_halbtc8822b2ant_power_on_setting(btcoexist)
|
||||
#define ex_halbtc8822b2ant_pre_load_firmware(btcoexist)
|
||||
#define ex_halbtc8822b2ant_init_hw_config(btcoexist, wifi_only)
|
||||
#define ex_halbtc8822b2ant_init_coex_dm(btcoexist)
|
||||
#define ex_halbtc8822b2ant_ips_notify(btcoexist, type)
|
||||
#define ex_halbtc8822b2ant_lps_notify(btcoexist, type)
|
||||
#define ex_halbtc8822b2ant_scan_notify(btcoexist, type)
|
||||
#define ex_halbtc8822b2ant_switchband_notify(btcoexist, type)
|
||||
#define ex_halbtc8822b2ant_connect_notify(btcoexist, type)
|
||||
#define ex_halbtc8822b2ant_media_status_notify(btcoexist, type)
|
||||
#define ex_halbtc8822b2ant_specific_packet_notify(btcoexist, type)
|
||||
#define ex_halbtc8822b2ant_bt_info_notify(btcoexist, tmp_buf, length)
|
||||
#define ex_halbtc8822b2ant_rf_status_notify(btcoexist, type)
|
||||
#define ex_halbtc8822b2ant_halt_notify(btcoexist)
|
||||
#define ex_halbtc8822b2ant_pnp_notify(btcoexist, pnp_state)
|
||||
#define ex_halbtc8822b2ant_periodical(btcoexist)
|
||||
#define ex_halbtc8822b2ant_display_coex_info(btcoexist)
|
||||
#define ex_halbtc8822b2ant_display_ant_detection(btcoexist)
|
||||
#define ex_halbtc8822b2ant_antenna_detection(btcoexist, cent_freq, offset, span, seconds)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
54
hal/btc/halbtc8822bwifionly.c
Normal file
54
hal/btc/halbtc8822bwifionly.c
Normal file
|
@ -0,0 +1,54 @@
|
|||
#include "mp_precomp.h"
|
||||
|
||||
|
||||
VOID
|
||||
ex_hal8822b_wifi_only_hw_config(
|
||||
IN struct wifi_only_cfg *pwifionlycfg
|
||||
)
|
||||
{
|
||||
/*BB control*/
|
||||
halwifionly_phy_set_bb_reg(pwifionlycfg, 0x4c, 0x01800000, 0x2);
|
||||
/*SW control*/
|
||||
halwifionly_phy_set_bb_reg(pwifionlycfg, 0xcb4, 0xff, 0x77);
|
||||
/*antenna mux switch */
|
||||
halwifionly_phy_set_bb_reg(pwifionlycfg, 0x974, 0x300, 0x3);
|
||||
|
||||
halwifionly_phy_set_bb_reg(pwifionlycfg, 0x1990, 0x300, 0x0);
|
||||
|
||||
halwifionly_phy_set_bb_reg(pwifionlycfg, 0xcbc, 0x80000, 0x0);
|
||||
/*switch to WL side controller and gnt_wl gnt_bt debug signal */
|
||||
halwifionly_phy_set_bb_reg(pwifionlycfg, 0x70, 0xff000000, 0x0e);
|
||||
/*gnt_wl=1 , gnt_bt=0*/
|
||||
halwifionly_phy_set_bb_reg(pwifionlycfg, 0x1704, 0xffffffff, 0x7700);
|
||||
halwifionly_phy_set_bb_reg(pwifionlycfg, 0x1700, 0xffffffff, 0xc00f0038);
|
||||
}
|
||||
|
||||
VOID
|
||||
ex_hal8822b_wifi_only_scannotify(
|
||||
IN struct wifi_only_cfg *pwifionlycfg,
|
||||
IN u1Byte is_5g
|
||||
)
|
||||
{
|
||||
hal8822b_wifi_only_switch_antenna(pwifionlycfg, is_5g);
|
||||
}
|
||||
|
||||
VOID
|
||||
ex_hal8822b_wifi_only_switchbandnotify(
|
||||
IN struct wifi_only_cfg *pwifionlycfg,
|
||||
IN u1Byte is_5g
|
||||
)
|
||||
{
|
||||
hal8822b_wifi_only_switch_antenna(pwifionlycfg, is_5g);
|
||||
}
|
||||
|
||||
VOID
|
||||
hal8822b_wifi_only_switch_antenna(IN struct wifi_only_cfg *pwifionlycfg,
|
||||
IN u1Byte is_5g
|
||||
)
|
||||
{
|
||||
|
||||
if (is_5g)
|
||||
halwifionly_phy_set_bb_reg(pwifionlycfg, 0xcbc, 0x300, 0x1);
|
||||
else
|
||||
halwifionly_phy_set_bb_reg(pwifionlycfg, 0xcbc, 0x300, 0x2);
|
||||
}
|
22
hal/btc/halbtc8822bwifionly.h
Normal file
22
hal/btc/halbtc8822bwifionly.h
Normal file
|
@ -0,0 +1,22 @@
|
|||
#ifndef __INC_HAL8822BWIFIONLYHWCFG_H
|
||||
#define __INC_HAL8822BWIFIONLYHWCFG_H
|
||||
|
||||
VOID
|
||||
ex_hal8822b_wifi_only_hw_config(
|
||||
IN struct wifi_only_cfg *pwifionlycfg
|
||||
);
|
||||
VOID
|
||||
ex_hal8822b_wifi_only_scannotify(
|
||||
IN struct wifi_only_cfg *pwifionlycfg,
|
||||
IN u1Byte is_5g
|
||||
);
|
||||
VOID
|
||||
ex_hal8822b_wifi_only_switchbandnotify(
|
||||
IN struct wifi_only_cfg *pwifionlycfg,
|
||||
IN u1Byte is_5g
|
||||
);
|
||||
VOID
|
||||
hal8822b_wifi_only_switch_antenna(IN struct wifi_only_cfg *pwifionlycfg,
|
||||
IN u1Byte is_5g
|
||||
);
|
||||
#endif
|
1003
hal/btc/halbtcoutsrc.h
Normal file
1003
hal/btc/halbtcoutsrc.h
Normal file
File diff suppressed because it is too large
Load diff
90
hal/btc/mp_precomp.h
Normal file
90
hal/btc/mp_precomp.h
Normal file
|
@ -0,0 +1,90 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* 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
|
||||
|
||||
#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 "halbtc8192e1ant.h"
|
||||
#include "halbtc8192e2ant.h"
|
||||
#include "halbtc8723b1ant.h"
|
||||
#include "halbtc8723b2ant.h"
|
||||
#include "halbtc8812a1ant.h"
|
||||
#include "halbtc8812a2ant.h"
|
||||
#include "halbtc8821a1ant.h"
|
||||
#include "halbtc8821a2ant.h"
|
||||
#include "halbtc8703b1ant.h"
|
||||
#include "halbtc8723d1ant.h"
|
||||
#include "halbtc8723d2ant.h"
|
||||
#include "halbtc8822b1ant.h"
|
||||
#include "halbtc8822b2ant.h"
|
||||
#include "halbtc8821c1ant.h"
|
||||
#include "halbtc8821c2ant.h"
|
||||
|
||||
/* for wifi only mode */
|
||||
#include "hal_btcoex_wifionly.h"
|
||||
#include "halbtc8723bwifionly.h"
|
||||
#include "halbtc8822bwifionly.h"
|
||||
#include "halbtc8821cwifionly.h"
|
||||
|
||||
#endif /* __MP_PRECOMP_H__ */
|
106
hal/efuse/efuse_mask.h
Normal file
106
hal/efuse/efuse_mask.h
Normal file
|
@ -0,0 +1,106 @@
|
|||
|
||||
#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_RTL8723D)
|
||||
#include "rtl8723d/HalEfuseMask8723D_USB.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8188F)
|
||||
#include "rtl8188f/HalEfuseMask8188F_USB.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8822B)
|
||||
#include "rtl8822b/HalEfuseMask8822B_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
|
||||
|
||||
#if defined(CONFIG_RTL8822B)
|
||||
#include "rtl8822b/HalEfuseMask8822B_PCIE.h"
|
||||
#endif
|
||||
#if defined(CONFIG_RTL8723D)
|
||||
#include "rtl8723d/HalEfuseMask8723D_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
|
||||
|
||||
#if defined(CONFIG_RTL8723D)
|
||||
#include "rtl8723d/HalEfuseMask8723D_SDIO.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8821C)
|
||||
#include "rtl8821c/HalEfuseMask8821C_SDIO.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8822B)
|
||||
#include "rtl8822b/HalEfuseMask8822B_SDIO.h"
|
||||
#endif
|
||||
#endif
|
101
hal/efuse/rtl8188e/HalEfuseMask8188E_PCIE.c
Normal file
101
hal/efuse/rtl8188e/HalEfuseMask8188E_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 "HalEfuseMask8188E_PCIE.h"
|
||||
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* MPCIE.TXT
|
||||
******************************************************************************/
|
||||
|
||||
u1Byte Array_MP_8188E_MPCIE[] = {
|
||||
0xFF,
|
||||
0xF3,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x0F,
|
||||
0xF1,
|
||||
0xFF,
|
||||
0xFF,
|
||||
0x70,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
|
||||
};
|
||||
|
||||
u2Byte
|
||||
EFUSE_GetArrayLen_MP_8188E_MPCIE(VOID)
|
||||
{
|
||||
return sizeof(Array_MP_8188E_MPCIE) / sizeof(u1Byte);
|
||||
}
|
||||
|
||||
VOID
|
||||
EFUSE_GetMaskArray_MP_8188E_MPCIE(
|
||||
IN OUT pu1Byte Array
|
||||
)
|
||||
{
|
||||
u2Byte len = EFUSE_GetArrayLen_MP_8188E_MPCIE(), i = 0;
|
||||
|
||||
for (i = 0; i < len; ++i)
|
||||
Array[i] = Array_MP_8188E_MPCIE[i];
|
||||
}
|
||||
BOOLEAN
|
||||
EFUSE_IsAddressMasked_MP_8188E_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_8188E_MPCIE[r] & (0x10 << c));
|
||||
else
|
||||
result = (Array_MP_8188E_MPCIE[r] & (0x01 << (c - 4)));
|
||||
|
||||
return (result > 0) ? 0 : 1;
|
||||
}
|
|
@ -1,43 +1,39 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* 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 __INC_RF_8188E_HW_IMG_H
|
||||
#define __INC_RF_8188E_HW_IMG_H
|
||||
|
||||
/* static bool CheckCondition(const u32 Condition, const u32 Hex); */
|
||||
|
||||
/******************************************************************************
|
||||
* RadioA_1T.TXT
|
||||
******************************************************************************/
|
||||
|
||||
HAL_STATUS
|
||||
ODM_ReadAndConfig_RadioA_1T_8188E(
|
||||
PDM_ODM_T pDM_Odm
|
||||
);
|
||||
/******************************************************************************
|
||||
* RadioA_1T_ICUT.TXT
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
ODM_ReadAndConfig_RadioA_1T_ICUT_8188E( /* TC: Test Chip, MP: MP Chip */
|
||||
PDM_ODM_T pDM_Odm
|
||||
);
|
||||
|
||||
#endif
|
||||
/******************************************************************************
|
||||
*
|
||||
* 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_8188E_MPCIE(VOID);
|
||||
|
||||
VOID
|
||||
EFUSE_GetMaskArray_MP_8188E_MPCIE(
|
||||
IN OUT pu1Byte Array
|
||||
);
|
||||
|
||||
BOOLEAN
|
||||
EFUSE_IsAddressMasked_MP_8188E_MPCIE(/* TC: Test Chip, MP: MP Chip */
|
||||
IN u2Byte Offset
|
||||
);
|
101
hal/efuse/rtl8188e/HalEfuseMask8188E_SDIO.c
Normal file
101
hal/efuse/rtl8188e/HalEfuseMask8188E_SDIO.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 "HalEfuseMask8188E_SDIO.h"
|
||||
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* MSDIO.TXT
|
||||
******************************************************************************/
|
||||
|
||||
u1Byte Array_MP_8188E_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_8188E_MSDIO(VOID)
|
||||
{
|
||||
return sizeof(Array_MP_8188E_MSDIO) / sizeof(u1Byte);
|
||||
}
|
||||
|
||||
VOID
|
||||
EFUSE_GetMaskArray_MP_8188E_MSDIO(
|
||||
IN OUT pu1Byte Array
|
||||
)
|
||||
{
|
||||
u2Byte len = EFUSE_GetArrayLen_MP_8188E_MSDIO(), i = 0;
|
||||
|
||||
for (i = 0; i < len; ++i)
|
||||
Array[i] = Array_MP_8188E_MSDIO[i];
|
||||
}
|
||||
BOOLEAN
|
||||
EFUSE_IsAddressMasked_MP_8188E_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_8188E_MSDIO[r] & (0x10 << c));
|
||||
else
|
||||
result = (Array_MP_8188E_MSDIO[r] & (0x01 << (c - 4)));
|
||||
|
||||
return (result > 0) ? 0 : 1;
|
||||
}
|
39
hal/efuse/rtl8188e/HalEfuseMask8188E_SDIO.h
Normal file
39
hal/efuse/rtl8188e/HalEfuseMask8188E_SDIO.h
Normal file
|
@ -0,0 +1,39 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* 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_8188E_MSDIO(VOID);
|
||||
|
||||
VOID
|
||||
EFUSE_GetMaskArray_MP_8188E_MSDIO(
|
||||
IN OUT pu1Byte Array
|
||||
);
|
||||
|
||||
BOOLEAN
|
||||
EFUSE_IsAddressMasked_MP_8188E_MSDIO(/* TC: Test Chip, MP: MP Chip */
|
||||
IN u2Byte Offset
|
||||
);
|
100
hal/efuse/rtl8188e/HalEfuseMask8188E_USB.c
Normal file
100
hal/efuse/rtl8188e/HalEfuseMask8188E_USB.c
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
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/* #include "Mp_Precomp.h" */
|
||||
/* #include "../odm_precomp.h" */
|
||||
|
||||
#include <drv_types.h>
|
||||
|
||||
#include "HalEfuseMask8188E_USB.h"
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* MUSB.TXT
|
||||
******************************************************************************/
|
||||
|
||||
u1Byte Array_MP_8188E_MUSB[] = {
|
||||
0xFF,
|
||||
0xF3,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x0F,
|
||||
0xF1,
|
||||
0xFF,
|
||||
0xFF,
|
||||
0xFF,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0xF7,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
|
||||
};
|
||||
|
||||
u2Byte
|
||||
EFUSE_GetArrayLen_MP_8188E_MUSB(VOID)
|
||||
{
|
||||
return sizeof(Array_MP_8188E_MUSB) / sizeof(u1Byte);
|
||||
}
|
||||
|
||||
VOID
|
||||
EFUSE_GetMaskArray_MP_8188E_MUSB(
|
||||
IN OUT pu1Byte Array
|
||||
)
|
||||
{
|
||||
u2Byte len = EFUSE_GetArrayLen_MP_8188E_MUSB(), i = 0;
|
||||
|
||||
for (i = 0; i < len; ++i)
|
||||
Array[i] = Array_MP_8188E_MUSB[i];
|
||||
}
|
||||
BOOLEAN
|
||||
EFUSE_IsAddressMasked_MP_8188E_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_8188E_MUSB[r] & (0x10 << c));
|
||||
else
|
||||
result = (Array_MP_8188E_MUSB[r] & (0x01 << (c - 4)));
|
||||
|
||||
return (result > 0) ? 0 : 1;
|
||||
}
|
39
hal/efuse/rtl8188e/HalEfuseMask8188E_USB.h
Normal file
39
hal/efuse/rtl8188e/HalEfuseMask8188E_USB.h
Normal file
|
@ -0,0 +1,39 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* 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_8188E_MUSB(VOID);
|
||||
|
||||
VOID
|
||||
EFUSE_GetMaskArray_MP_8188E_MUSB(
|
||||
IN OUT pu1Byte Array
|
||||
);
|
||||
|
||||
BOOLEAN
|
||||
EFUSE_IsAddressMasked_MP_8188E_MUSB(/* TC: Test Chip, MP: MP Chip */
|
||||
IN u2Byte Offset
|
||||
);
|
4474
hal/hal_btcoex.c
Normal file
4474
hal/hal_btcoex.c
Normal file
File diff suppressed because it is too large
Load diff
156
hal/hal_btcoex_wifionly.c
Normal file
156
hal/hal_btcoex_wifionly.c
Normal file
|
@ -0,0 +1,156 @@
|
|||
#include "btc/mp_precomp.h"
|
||||
#include <hal_btcoex_wifionly.h>
|
||||
|
||||
struct wifi_only_cfg GLBtCoexistWifiOnly;
|
||||
|
||||
void halwifionly_write1byte(PVOID pwifionlyContext, u32 RegAddr, u8 Data)
|
||||
{
|
||||
struct wifi_only_cfg *pwifionlycfg = (struct wifi_only_cfg *)pwifionlyContext;
|
||||
PADAPTER Adapter = pwifionlycfg->Adapter;
|
||||
|
||||
rtw_write8(Adapter, RegAddr, Data);
|
||||
}
|
||||
|
||||
void halwifionly_write2byte(PVOID pwifionlyContext, u32 RegAddr, u16 Data)
|
||||
{
|
||||
struct wifi_only_cfg *pwifionlycfg = (struct wifi_only_cfg *)pwifionlyContext;
|
||||
PADAPTER Adapter = pwifionlycfg->Adapter;
|
||||
|
||||
rtw_write16(Adapter, RegAddr, Data);
|
||||
}
|
||||
|
||||
void halwifionly_write4byte(PVOID pwifionlyContext, u32 RegAddr, u32 Data)
|
||||
{
|
||||
struct wifi_only_cfg *pwifionlycfg = (struct wifi_only_cfg *)pwifionlyContext;
|
||||
PADAPTER Adapter = pwifionlycfg->Adapter;
|
||||
|
||||
rtw_write32(Adapter, RegAddr, Data);
|
||||
}
|
||||
|
||||
u8 halwifionly_read1byte(PVOID pwifionlyContext, u32 RegAddr)
|
||||
{
|
||||
struct wifi_only_cfg *pwifionlycfg = (struct wifi_only_cfg *)pwifionlyContext;
|
||||
PADAPTER Adapter = pwifionlycfg->Adapter;
|
||||
|
||||
return rtw_read8(Adapter, RegAddr);
|
||||
}
|
||||
|
||||
u16 halwifionly_read2byte(PVOID pwifionlyContext, u32 RegAddr)
|
||||
{
|
||||
struct wifi_only_cfg *pwifionlycfg = (struct wifi_only_cfg *)pwifionlyContext;
|
||||
PADAPTER Adapter = pwifionlycfg->Adapter;
|
||||
|
||||
return rtw_read16(Adapter, RegAddr);
|
||||
}
|
||||
|
||||
u32 halwifionly_read4byte(PVOID pwifionlyContext, u32 RegAddr)
|
||||
{
|
||||
struct wifi_only_cfg *pwifionlycfg = (struct wifi_only_cfg *)pwifionlyContext;
|
||||
PADAPTER Adapter = pwifionlycfg->Adapter;
|
||||
|
||||
return rtw_read32(Adapter, RegAddr);
|
||||
}
|
||||
|
||||
void halwifionly_bitmaskwrite1byte(PVOID pwifionlyContext, u32 regAddr, u8 bitMask, u8 data)
|
||||
{
|
||||
u8 originalValue, bitShift = 0;
|
||||
u8 i;
|
||||
|
||||
struct wifi_only_cfg *pwifionlycfg = (struct wifi_only_cfg *)pwifionlyContext;
|
||||
PADAPTER Adapter = pwifionlycfg->Adapter;
|
||||
|
||||
if (bitMask != 0xff) {
|
||||
originalValue = rtw_read8(Adapter, regAddr);
|
||||
for (i = 0; i <= 7; i++) {
|
||||
if ((bitMask >> i) & 0x1)
|
||||
break;
|
||||
}
|
||||
bitShift = i;
|
||||
data = ((originalValue) & (~bitMask)) | (((data << bitShift)) & bitMask);
|
||||
}
|
||||
rtw_write8(Adapter, regAddr, data);
|
||||
}
|
||||
|
||||
void halwifionly_phy_set_rf_reg(PVOID pwifionlyContext, u8 eRFPath, u32 RegAddr, u32 BitMask, u32 Data)
|
||||
{
|
||||
struct wifi_only_cfg *pwifionlycfg = (struct wifi_only_cfg *)pwifionlyContext;
|
||||
PADAPTER Adapter = pwifionlycfg->Adapter;
|
||||
|
||||
phy_set_rf_reg(Adapter, eRFPath, RegAddr, BitMask, Data);
|
||||
}
|
||||
|
||||
void halwifionly_phy_set_bb_reg(PVOID pwifionlyContext, u32 RegAddr, u32 BitMask, u32 Data)
|
||||
{
|
||||
struct wifi_only_cfg *pwifionlycfg = (struct wifi_only_cfg *)pwifionlyContext;
|
||||
PADAPTER Adapter = pwifionlycfg->Adapter;
|
||||
|
||||
phy_set_bb_reg(Adapter, RegAddr, BitMask, Data);
|
||||
}
|
||||
|
||||
void hal_btcoex_wifionly_switchband_notify(PADAPTER padapter)
|
||||
{
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
|
||||
u8 is_5g = _FALSE;
|
||||
|
||||
if (pHalData->current_band_type == BAND_ON_5G)
|
||||
is_5g = _TRUE;
|
||||
|
||||
if (IS_HARDWARE_TYPE_8822B(padapter))
|
||||
ex_hal8822b_wifi_only_switchbandnotify(&GLBtCoexistWifiOnly, is_5g);
|
||||
else if (IS_HARDWARE_TYPE_8821C(padapter))
|
||||
ex_hal8821c_wifi_only_switchbandnotify(&GLBtCoexistWifiOnly, is_5g);
|
||||
}
|
||||
|
||||
void hal_btcoex_wifionly_scan_notify(PADAPTER padapter)
|
||||
{
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
|
||||
u8 is_5g = _FALSE;
|
||||
|
||||
if (pHalData->current_band_type == BAND_ON_5G)
|
||||
is_5g = _TRUE;
|
||||
|
||||
if (IS_HARDWARE_TYPE_8822B(padapter))
|
||||
ex_hal8822b_wifi_only_scannotify(&GLBtCoexistWifiOnly, is_5g);
|
||||
else if (IS_HARDWARE_TYPE_8821C(padapter))
|
||||
ex_hal8821c_wifi_only_scannotify(&GLBtCoexistWifiOnly, is_5g);
|
||||
}
|
||||
|
||||
void hal_btcoex_wifionly_hw_config(PADAPTER padapter)
|
||||
{
|
||||
struct wifi_only_cfg *pwifionlycfg = &GLBtCoexistWifiOnly;
|
||||
|
||||
if (IS_HARDWARE_TYPE_8723B(padapter))
|
||||
ex_hal8723b_wifi_only_hw_config(pwifionlycfg);
|
||||
else if (IS_HARDWARE_TYPE_8822B(padapter))
|
||||
ex_hal8822b_wifi_only_hw_config(pwifionlycfg);
|
||||
else if (IS_HARDWARE_TYPE_8821C(padapter))
|
||||
ex_hal8821c_wifi_only_hw_config(pwifionlycfg);
|
||||
}
|
||||
|
||||
void hal_btcoex_wifionly_initlizevariables(PADAPTER padapter)
|
||||
{
|
||||
struct wifi_only_cfg *pwifionlycfg = &GLBtCoexistWifiOnly;
|
||||
struct wifi_only_haldata *pwifionly_haldata = &pwifionlycfg->haldata_info;
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
|
||||
|
||||
_rtw_memset(&GLBtCoexistWifiOnly, 0, sizeof(GLBtCoexistWifiOnly));
|
||||
|
||||
pwifionlycfg->Adapter = padapter;
|
||||
|
||||
#ifdef CONFIG_PCI_HCI
|
||||
pwifionlycfg->chip_interface = WIFIONLY_INTF_PCI;
|
||||
#elif defined(CONFIG_USB_HCI)
|
||||
pwifionlycfg->chip_interface = WIFIONLY_INTF_USB;
|
||||
#elif defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI)
|
||||
pwifionlycfg->chip_interface = WIFIONLY_INTF_SDIO;
|
||||
#else
|
||||
pwifionlycfg->chip_interface = WIFIONLY_INTF_UNKNOWN;
|
||||
#endif
|
||||
|
||||
pwifionly_haldata->customer_id = CUSTOMER_NORMAL;
|
||||
pwifionly_haldata->efuse_pg_antnum = pHalData->EEPROMBluetoothAntNum;
|
||||
pwifionly_haldata->efuse_pg_antpath = pHalData->ant_path;
|
||||
pwifionly_haldata->rfe_type = pHalData->rfe_type;
|
||||
pwifionly_haldata->ant_div_cfg = pHalData->AntDivCfg;
|
||||
}
|
||||
|
11407
hal/hal_com.c
11407
hal/hal_com.c
File diff suppressed because it is too large
Load diff
119
hal/hal_com_c2h.h
Normal file
119
hal/hal_com_c2h.h
Normal file
|
@ -0,0 +1,119 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* 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__
|
||||
|
||||
#define C2H_TYPE_REG 0
|
||||
#define C2H_TYPE_PKT 1
|
||||
|
||||
/*
|
||||
* C2H event format:
|
||||
* Fields TRIGGER PAYLOAD SEQ PLEN ID
|
||||
* BITS [127:120] [119:16] [15:8] [7:4] [3:0]
|
||||
*/
|
||||
#define C2H_ID(_c2h) LE_BITS_TO_1BYTE(((u8*)(_c2h)), 0, 4)
|
||||
#define C2H_PLEN(_c2h) LE_BITS_TO_1BYTE(((u8*)(_c2h)), 4, 4)
|
||||
#define C2H_SEQ(_c2h) LE_BITS_TO_1BYTE(((u8*)(_c2h)) + 1, 0, 8)
|
||||
#define C2H_PAYLOAD(_c2h) (((u8*)(_c2h)) + 2)
|
||||
|
||||
#define SET_C2H_ID(_c2h, _val) SET_BITS_TO_LE_1BYTE(((u8*)(_c2h)), 0, 4, _val)
|
||||
#define SET_C2H_PLEN(_c2h, _val) SET_BITS_TO_LE_1BYTE(((u8*)(_c2h)), 4, 4, _val)
|
||||
#define SET_C2H_SEQ(_c2h, _val) SET_BITS_TO_LE_1BYTE(((u8*)(_c2h)) + 1 , 0, 8, _val)
|
||||
|
||||
/*
|
||||
* C2H event format:
|
||||
* Fields TRIGGER PLEN PAYLOAD SEQ ID
|
||||
* BITS [127:120] [119:112] [111:16] [15:8] [7:0]
|
||||
*/
|
||||
#define C2H_ID_88XX(_c2h) LE_BITS_TO_1BYTE(((u8*)(_c2h)), 0, 8)
|
||||
#define C2H_SEQ_88XX(_c2h) LE_BITS_TO_1BYTE(((u8*)(_c2h)) + 1, 0, 8)
|
||||
#define C2H_PAYLOAD_88XX(_c2h) (((u8*)(_c2h)) + 2)
|
||||
#define C2H_PLEN_88XX(_c2h) LE_BITS_TO_1BYTE(((u8*)(_c2h)) + 14, 0, 8)
|
||||
#define C2H_TRIGGER_88XX(_c2h) LE_BITS_TO_1BYTE(((u8*)(_c2h)) + 15, 0, 8)
|
||||
|
||||
#define SET_C2H_ID_88XX(_c2h, _val) SET_BITS_TO_LE_1BYTE(((u8*)(_c2h)), 0, 8, _val)
|
||||
#define SET_C2H_SEQ_88XX(_c2h, _val) SET_BITS_TO_LE_1BYTE(((u8*)(_c2h)) + 1, 0, 8, _val)
|
||||
#define SET_C2H_PLEN_88XX(_c2h, _val) SET_BITS_TO_LE_1BYTE(((u8*)(_c2h)) + 14, 0, 8, _val)
|
||||
|
||||
typedef enum _C2H_EVT {
|
||||
C2H_DBG = 0x00,
|
||||
C2H_LB = 0x01,
|
||||
C2H_TXBF = 0x02,
|
||||
C2H_CCX_TX_RPT = 0x03,
|
||||
C2H_AP_REQ_TXRPT = 0x04,
|
||||
C2H_FW_SCAN_COMPLETE = 0x7,
|
||||
C2H_BT_INFO = 0x09,
|
||||
C2H_BT_MP_INFO = 0x0B,
|
||||
C2H_RA_RPT = 0x0C,
|
||||
C2H_SPC_STAT = 0x0D,
|
||||
C2H_RA_PARA_RPT = 0x0E,
|
||||
C2H_FW_CHNL_SWITCH_COMPLETE = 0x10,
|
||||
C2H_IQK_FINISH = 0x11,
|
||||
C2H_MAILBOX_STATUS = 0x15,
|
||||
C2H_P2P_RPORT = 0x16,
|
||||
C2H_MCC = 0x17,
|
||||
C2H_MAC_HIDDEN_RPT = 0x19,
|
||||
C2H_MAC_HIDDEN_RPT_2 = 0x1A,
|
||||
C2H_BCN_EARLY_RPT = 0x1E,
|
||||
C2H_DEFEATURE_DBG = 0x22,
|
||||
C2H_CUSTOMER_STR_RPT = 0x24,
|
||||
C2H_CUSTOMER_STR_RPT_2 = 0x25,
|
||||
C2H_DEFEATURE_RSVD = 0xFD,
|
||||
C2H_EXTEND = 0xff,
|
||||
} C2H_EVT;
|
||||
|
||||
typedef enum _EXTEND_C2H_EVT {
|
||||
EXTEND_C2H_DBG_PRINT = 0
|
||||
} EXTEND_C2H_EVT;
|
||||
|
||||
#define C2H_REG_LEN 16
|
||||
|
||||
/* C2H_IQK_FINISH, 0x11 */
|
||||
#define IQK_OFFLOAD_LEN 1
|
||||
void c2h_iqk_offload(_adapter *adapter, u8 *data, u8 len);
|
||||
int c2h_iqk_offload_wait(_adapter *adapter, u32 timeout_ms);
|
||||
#define rtl8812_iqk_wait c2h_iqk_offload_wait /* TODO: remove this after phydm call c2h_iqk_offload_wait instead */
|
||||
|
||||
#ifdef CONFIG_RTW_MAC_HIDDEN_RPT
|
||||
/* C2H_MAC_HIDDEN_RPT, 0x19 */
|
||||
#define MAC_HIDDEN_RPT_LEN 8
|
||||
int c2h_mac_hidden_rpt_hdl(_adapter *adapter, u8 *data, u8 len);
|
||||
|
||||
/* C2H_MAC_HIDDEN_RPT_2, 0x1A */
|
||||
#define MAC_HIDDEN_RPT_2_LEN 5
|
||||
int c2h_mac_hidden_rpt_2_hdl(_adapter *adapter, u8 *data, u8 len);
|
||||
int hal_read_mac_hidden_rpt(_adapter *adapter);
|
||||
#endif /* CONFIG_RTW_MAC_HIDDEN_RPT */
|
||||
|
||||
/* C2H_DEFEATURE_DBG, 0x22 */
|
||||
#define DEFEATURE_DBG_LEN 1
|
||||
int c2h_defeature_dbg_hdl(_adapter *adapter, u8 *data, u8 len);
|
||||
|
||||
#ifdef CONFIG_RTW_CUSTOMER_STR
|
||||
/* C2H_CUSTOMER_STR_RPT, 0x24 */
|
||||
#define CUSTOMER_STR_RPT_LEN 8
|
||||
int c2h_customer_str_rpt_hdl(_adapter *adapter, u8 *data, u8 len);
|
||||
|
||||
/* C2H_CUSTOMER_STR_RPT_2, 0x25 */
|
||||
#define CUSTOMER_STR_RPT_2_LEN 8
|
||||
int c2h_customer_str_rpt_2_hdl(_adapter *adapter, u8 *data, u8 len);
|
||||
#endif /* CONFIG_RTW_CUSTOMER_STR */
|
||||
|
||||
#endif /* __COMMON_C2H_H__ */
|
5452
hal/hal_com_phycfg.c
Normal file
5452
hal/hal_com_phycfg.c
Normal file
File diff suppressed because it is too large
Load diff
224
hal/hal_dm.c
Normal file
224
hal/hal_dm.c
Normal file
|
@ -0,0 +1,224 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* 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. */
|
||||
enum odm_board_type_e boardType(u8 InterfaceSel)
|
||||
{
|
||||
enum 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
|
||||
/* RTW_INFO("===> 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);
|
||||
struct PHY_DM_STRUCT *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_cmn_info_init(pDM_Odm, ODM_CMNINFO_PLATFORM, ODM_CE);
|
||||
|
||||
rtw_odm_init_ic_type(adapter);
|
||||
|
||||
if (rtw_get_intf_type(adapter) == RTW_GSPI)
|
||||
odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_INTERFACE, ODM_ITRF_SDIO);
|
||||
else
|
||||
odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_INTERFACE, rtw_get_intf_type(adapter));
|
||||
|
||||
odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_MP_TEST_CHIP, IS_NORMAL_CHIP(pHalData->version_id));
|
||||
|
||||
odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_PATCH_ID, pHalData->CustomerID);
|
||||
|
||||
odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_BWIFI_TEST, adapter->registrypriv.wifi_spec);
|
||||
|
||||
|
||||
if (pHalData->rf_type == RF_1T1R)
|
||||
odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_RF_TYPE, ODM_1T1R);
|
||||
else if (pHalData->rf_type == RF_1T2R)
|
||||
odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_RF_TYPE, ODM_1T2R);
|
||||
else if (pHalData->rf_type == RF_2T2R)
|
||||
odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_RF_TYPE, ODM_2T2R);
|
||||
else if (pHalData->rf_type == RF_2T2R_GREEN)
|
||||
odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_RF_TYPE, ODM_2T2R_GREEN);
|
||||
else if (pHalData->rf_type == RF_2T3R)
|
||||
odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_RF_TYPE, ODM_2T3R);
|
||||
else if (pHalData->rf_type == RF_2T4R)
|
||||
odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_RF_TYPE, ODM_2T4R);
|
||||
else if (pHalData->rf_type == RF_3T3R)
|
||||
odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_RF_TYPE, ODM_3T3R);
|
||||
else if (pHalData->rf_type == RF_3T4R)
|
||||
odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_RF_TYPE, ODM_3T4R);
|
||||
else if (pHalData->rf_type == RF_4T4R)
|
||||
odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_RF_TYPE, ODM_4T4R);
|
||||
else
|
||||
odm_cmn_info_init(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_cmn_info_init(pDM_Odm, ODM_CMNINFO_EXT_LNA, 1);
|
||||
}
|
||||
if (pHalData->external_lna_5g != 0) {
|
||||
odm_board_type |= ODM_BOARD_EXT_LNA_5G;
|
||||
odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_5G_EXT_LNA, 1);
|
||||
}
|
||||
if (pHalData->ExternalPA_2G != 0) {
|
||||
odm_board_type |= ODM_BOARD_EXT_PA;
|
||||
odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_EXT_PA, 1);
|
||||
}
|
||||
if (pHalData->external_pa_5g != 0) {
|
||||
odm_board_type |= ODM_BOARD_EXT_PA_5G;
|
||||
odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_5G_EXT_PA, 1);
|
||||
}
|
||||
if (pHalData->EEPROMBluetoothCoexist)
|
||||
odm_board_type |= ODM_BOARD_BT;
|
||||
|
||||
odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_BOARD_TYPE, odm_board_type);
|
||||
/* 1 ============== End of BoardType ============== */
|
||||
}
|
||||
|
||||
odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_DOMAIN_CODE_2G, pHalData->Regulation2_4G);
|
||||
odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_DOMAIN_CODE_5G, pHalData->Regulation5G);
|
||||
|
||||
#ifdef CONFIG_DFS_MASTER
|
||||
odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_DFS_REGION_DOMAIN, adapter->registrypriv.dfs_region_domain);
|
||||
odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_DFS_MASTER_ENABLE, &(adapter_to_rfctl(adapter)->dfs_master_enabled));
|
||||
#endif
|
||||
|
||||
odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_GPA, pHalData->TypeGPA);
|
||||
odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_APA, pHalData->TypeAPA);
|
||||
odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_GLNA, pHalData->TypeGLNA);
|
||||
odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_ALNA, pHalData->TypeALNA);
|
||||
|
||||
odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_RFE_TYPE, pHalData->rfe_type);
|
||||
|
||||
odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_EXT_TRSW, 0);
|
||||
|
||||
/*Add by YuChen for kfree init*/
|
||||
odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_REGRFKFREEENABLE, adapter->registrypriv.RegPwrTrimEnable);
|
||||
odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_RFKFREEENABLE, pHalData->RfKFreeEnable);
|
||||
|
||||
/*Antenna diversity relative parameters*/
|
||||
odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_ANT_DIV, &(pHalData->AntDivCfg));
|
||||
odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_RF_ANTENNA_TYPE, pHalData->TRxAntDivType);
|
||||
odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_BE_FIX_TX_ANT, pHalData->b_fix_tx_ant);
|
||||
odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_WITH_EXT_ANTENNA_SWITCH, pHalData->with_extenal_ant_switch);
|
||||
|
||||
/*Add by YuChen for adaptivity init*/
|
||||
odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_ADAPTIVITY, &(adapter->registrypriv.adaptivity_en));
|
||||
phydm_adaptivity_info_init(pDM_Odm, PHYDM_ADAPINFO_CARRIER_SENSE_ENABLE, (adapter->registrypriv.adaptivity_mode != 0) ? TRUE : FALSE);
|
||||
phydm_adaptivity_info_init(pDM_Odm, PHYDM_ADAPINFO_DCBACKOFF, adapter->registrypriv.adaptivity_dc_backoff);
|
||||
phydm_adaptivity_info_init(pDM_Odm, PHYDM_ADAPINFO_DYNAMICLINKADAPTIVITY, (adapter->registrypriv.adaptivity_dml != 0) ? TRUE : FALSE);
|
||||
phydm_adaptivity_info_init(pDM_Odm, PHYDM_ADAPINFO_TH_L2H_INI, adapter->registrypriv.adaptivity_th_l2h_ini);
|
||||
phydm_adaptivity_info_init(pDM_Odm, PHYDM_ADAPINFO_TH_EDCCA_HL_DIFF, adapter->registrypriv.adaptivity_th_edcca_hl_diff);
|
||||
|
||||
#ifdef CONFIG_IQK_PA_OFF
|
||||
odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_IQKPAOFF, 1);
|
||||
#endif
|
||||
odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_IQKFWOFFLOAD, pHalData->RegIQKFWOffload);
|
||||
|
||||
/* Pointer reference */
|
||||
odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_TX_UNI, &(dvobj->traffic_stat.tx_bytes));
|
||||
odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_RX_UNI, &(dvobj->traffic_stat.rx_bytes));
|
||||
odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_WM_MODE, &(pmlmeext->cur_wireless_mode));
|
||||
odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_BAND, &(pHalData->current_band_type));
|
||||
odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_FORCED_RATE, &(pHalData->ForcedDataRate));
|
||||
odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_FORCED_IGI_LB, &(pHalData->u1ForcedIgiLb));
|
||||
|
||||
odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_SEC_CHNL_OFFSET, &(pHalData->nCur40MhzPrimeSC));
|
||||
odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_SEC_MODE, &(adapter->securitypriv.dot11PrivacyAlgrthm));
|
||||
odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_BW, &(pHalData->current_channel_bw));
|
||||
odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_CHNL, &(pHalData->current_channel));
|
||||
odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_NET_CLOSED, &(adapter->net_closed));
|
||||
odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_FORCED_IGI_LB, &(pHalData->u1ForcedIgiLb));
|
||||
|
||||
odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_SCAN, &(pmlmepriv->bScanInProcess));
|
||||
odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_POWER_SAVING, &(pwrctl->bpower_saving));
|
||||
/*Add by Yuchen for phydm beamforming*/
|
||||
odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_TX_TP, &(dvobj->traffic_stat.cur_tx_tp));
|
||||
odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_RX_TP, &(dvobj->traffic_stat.cur_rx_tp));
|
||||
odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_ANT_TEST, &(pHalData->antenna_test));
|
||||
#ifdef CONFIG_USB_HCI
|
||||
odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_HUBUSBMODE, &(dvobj->usb_speed));
|
||||
#endif
|
||||
for (i = 0; i < ODM_ASSOCIATE_ENTRY_NUM; i++)
|
||||
odm_cmn_info_ptr_array_hook(pDM_Odm, ODM_CMNINFO_STA_STATUS, i, NULL);
|
||||
|
||||
phydm_init_debug_setting(pDM_Odm);
|
||||
|
||||
/* TODO */
|
||||
/* odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_BT_OPERATION, _FALSE); */
|
||||
/* odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_BT_DISABLE_EDCA, _FALSE); */
|
||||
}
|
|
@ -17,14 +17,9 @@
|
|||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __HAL_PHY_RF_H__
|
||||
#define __HAL_PHY_RF_H__
|
||||
|
||||
#define ODM_TARGET_CHNL_NUM_2G_5G 59
|
||||
#ifndef __HAL_DM_H__
|
||||
#define __HAL_DM_H__
|
||||
|
||||
void ODM_ResetIQKResult(PDM_ODM_T pDM_Odm );
|
||||
u8 ODM_GetRightChnlPlaceforIQK(u8 chnl);
|
||||
|
||||
#endif /* #ifndef __HAL_PHY_RF_H__ */
|
||||
void Init_ODM_ComInfo(_adapter *adapter);
|
||||
|
||||
#endif /* __HAL_DM_H__ */
|
2635
hal/hal_halmac.c
Normal file
2635
hal/hal_halmac.c
Normal file
File diff suppressed because it is too large
Load diff
121
hal/hal_halmac.h
Normal file
121
hal/hal_halmac.h
Normal file
|
@ -0,0 +1,121 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2015 - 2016 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_HALMAC_H_
|
||||
#define _HAL_HALMAC_H_
|
||||
|
||||
#include <drv_types.h> /* adapter_to_dvobj(), struct intf_hdl and etc. */
|
||||
#include <hal_data.h> /* struct hal_spec_t */
|
||||
#include "halmac/halmac_api.h" /* PHALMAC_ADAPTER and etc. */
|
||||
|
||||
/* HALMAC Definition for Driver */
|
||||
#define RTW_HALMAC_H2C_MAX_SIZE HALMAC_H2C_CMD_ORIGINAL_SIZE_88XX
|
||||
#define RTW_HALMAC_BA_SSN_RPT_SIZE 4
|
||||
|
||||
#define dvobj_set_halmac(d, mac) ((d)->halmac = (mac))
|
||||
#define dvobj_to_halmac(d) ((PHALMAC_ADAPTER)((d)->halmac))
|
||||
#define adapter_to_halmac(p) dvobj_to_halmac(adapter_to_dvobj(p))
|
||||
|
||||
/* for H2C cmd */
|
||||
#define MAX_H2C_BOX_NUMS 4
|
||||
#define MESSAGE_BOX_SIZE 4
|
||||
#define EX_MESSAGE_BOX_SIZE 4
|
||||
|
||||
typedef enum _RTW_HALMAC_MODE {
|
||||
RTW_HALMAC_MODE_NORMAL,
|
||||
RTW_HALMAC_MODE_WIFI_TEST,
|
||||
} RTW_HALMAC_MODE;
|
||||
|
||||
extern HALMAC_PLATFORM_API rtw_halmac_platform_api;
|
||||
|
||||
/* HALMAC API for Driver(HAL) */
|
||||
u8 rtw_halmac_read8(struct intf_hdl *, u32 addr);
|
||||
u16 rtw_halmac_read16(struct intf_hdl *, u32 addr);
|
||||
u32 rtw_halmac_read32(struct intf_hdl *, u32 addr);
|
||||
void rtw_halmac_read_mem(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *pmem);
|
||||
#ifdef CONFIG_SDIO_INDIRECT_ACCESS
|
||||
u8 rtw_halmac_iread8(struct intf_hdl *pintfhdl, u32 addr);
|
||||
u16 rtw_halmac_iread16(struct intf_hdl *pintfhdl, u32 addr);
|
||||
u32 rtw_halmac_iread32(struct intf_hdl *pintfhdl, u32 addr);
|
||||
#endif
|
||||
int rtw_halmac_write8(struct intf_hdl *, u32 addr, u8 value);
|
||||
int rtw_halmac_write16(struct intf_hdl *, u32 addr, u16 value);
|
||||
int rtw_halmac_write32(struct intf_hdl *, u32 addr, u32 value);
|
||||
|
||||
void rtw_dump_halmac_info(void *sel);
|
||||
int rtw_halmac_init_adapter(struct dvobj_priv *, PHALMAC_PLATFORM_API);
|
||||
int rtw_halmac_deinit_adapter(struct dvobj_priv *);
|
||||
int rtw_halmac_poweron(struct dvobj_priv *);
|
||||
int rtw_halmac_poweroff(struct dvobj_priv *);
|
||||
int rtw_halmac_init_hal(struct dvobj_priv *);
|
||||
int rtw_halmac_init_hal_fw(struct dvobj_priv *, u8 *fw, u32 fwsize);
|
||||
int rtw_halmac_init_hal_fw_file(struct dvobj_priv *, u8 *fwpath);
|
||||
int rtw_halmac_deinit_hal(struct dvobj_priv *);
|
||||
int rtw_halmac_self_verify(struct dvobj_priv *);
|
||||
int rtw_halmac_dlfw(struct dvobj_priv *, u8 *fw, u32 fwsize);
|
||||
int rtw_halmac_dlfw_from_file(struct dvobj_priv *, u8 *fwpath);
|
||||
int rtw_halmac_phy_power_switch(struct dvobj_priv *, u8 enable);
|
||||
int rtw_halmac_send_h2c(struct dvobj_priv *, u8 *h2c);
|
||||
int rtw_halmac_c2h_handle(struct dvobj_priv *, u8 *c2h, u32 size);
|
||||
int rtw_halmac_get_available_efuse_size(struct dvobj_priv *d, u32 *size);
|
||||
|
||||
int rtw_halmac_get_physical_efuse_size(struct dvobj_priv *, u32 *size);
|
||||
int rtw_halmac_read_physical_efuse_map(struct dvobj_priv *, u8 *map, u32 size);
|
||||
int rtw_halmac_read_physical_efuse(struct dvobj_priv *, u32 offset, u32 cnt, u8 *data);
|
||||
int rtw_halmac_write_physical_efuse(struct dvobj_priv *, u32 offset, u32 cnt, u8 *data);
|
||||
int rtw_halmac_get_logical_efuse_size(struct dvobj_priv *, u32 *size);
|
||||
int rtw_halmac_read_logical_efuse_map(struct dvobj_priv *, u8 *map, u32 size);
|
||||
int rtw_halmac_write_logical_efuse_map(struct dvobj_priv *, u8 *map, u32 size, u8 *maskmap, u32 masksize);
|
||||
int rtw_halmac_read_logical_efuse(struct dvobj_priv *, u32 offset, u32 cnt, u8 *data);
|
||||
int rtw_halmac_write_logical_efuse(struct dvobj_priv *, u32 offset, u32 cnt, u8 *data);
|
||||
|
||||
int rtw_halmac_write_bt_physical_efuse(struct dvobj_priv *, u32 offset, u32 cnt, u8 *data);
|
||||
int rtw_halmac_read_bt_physical_efuse_map(struct dvobj_priv *, u8 *map, u32 size);
|
||||
|
||||
int rtw_halmac_config_rx_info(struct dvobj_priv *, HALMAC_DRV_INFO);
|
||||
int rtw_halmac_set_mac_address(struct dvobj_priv *, enum _hw_port, u8 *addr);
|
||||
int rtw_halmac_set_bssid(struct dvobj_priv *, enum _hw_port hwport, u8 *addr);
|
||||
|
||||
int rtw_halmac_set_bandwidth(struct dvobj_priv *, u8 channel, u8 pri_ch_idx, u8 bw);
|
||||
int rtw_halmac_dump_fifo(struct dvobj_priv *d, u8 fifo_sel, u32 addr, u32 size, u8 *buffer);
|
||||
int rtw_halmac_rx_agg_switch(struct dvobj_priv *, u8 enable);
|
||||
int rtw_halmac_get_hw_value(struct dvobj_priv *, HALMAC_HW_ID hw_id, VOID *pvalue);
|
||||
int rtw_halmac_get_wow_reason(struct dvobj_priv *, u8 *reason);
|
||||
int rtw_halmac_get_drv_info_sz(struct dvobj_priv *, u8 *sz);
|
||||
int rtw_halmac_get_rsvd_drv_pg_bndy(struct dvobj_priv *dvobj, u16 *drv_pg);
|
||||
int rtw_halmac_download_rsvd_page(struct dvobj_priv *dvobj, u8 pg_offset, u8 *pbuf, u32 size);
|
||||
int rtw_halmac_fill_hal_spec(struct dvobj_priv *, struct hal_spec_t *);
|
||||
|
||||
#ifdef CONFIG_SDIO_HCI
|
||||
int rtw_halmac_query_tx_page_num(struct dvobj_priv *);
|
||||
int rtw_halmac_get_tx_queue_page_num(struct dvobj_priv *, u8 queue, u32 *page);
|
||||
u32 rtw_halmac_sdio_get_tx_addr(struct dvobj_priv *, u8 *desc, u32 size);
|
||||
int rtw_halmac_sdio_tx_allowed(struct dvobj_priv *, u8 *buf, u32 size);
|
||||
u32 rtw_halmac_sdio_get_rx_addr(struct dvobj_priv *, u8 *seq);
|
||||
#endif /* CONFIG_SDIO_HCI */
|
||||
|
||||
#ifdef CONFIG_USB_HCI
|
||||
u8 rtw_halmac_usb_get_bulkout_id(struct dvobj_priv *, u8 *buf, u32 size);
|
||||
u8 rtw_halmac_switch_usb_mode(struct dvobj_priv *d, enum RTW_USB_SPEED usb_mode);
|
||||
#endif /* CONFIG_USB_HCI */
|
||||
|
||||
#ifdef CONFIG_SUPPORT_TRX_SHARED
|
||||
void dump_trx_share_mode(void *sel, _adapter *adapter);
|
||||
#endif
|
||||
#endif /* _HAL_HALMAC_H_ */
|
529
hal/hal_hci/hal_usb.c
Normal file
529
hal/hal_hci/hal_usb.c
Normal file
|
@ -0,0 +1,529 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* 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_USB_C_
|
||||
|
||||
#include <drv_types.h>
|
||||
#include <hal_data.h>
|
||||
|
||||
int usb_init_recv_priv(_adapter *padapter, u16 ini_in_buf_sz)
|
||||
{
|
||||
struct recv_priv *precvpriv = &padapter->recvpriv;
|
||||
int i, res = _SUCCESS;
|
||||
struct recv_buf *precvbuf;
|
||||
|
||||
#ifdef PLATFORM_LINUX
|
||||
tasklet_init(&precvpriv->recv_tasklet,
|
||||
(void(*)(unsigned long))usb_recv_tasklet,
|
||||
(unsigned long)padapter);
|
||||
#endif /* PLATFORM_LINUX */
|
||||
|
||||
#ifdef PLATFORM_FREEBSD
|
||||
#ifdef CONFIG_RX_INDICATE_QUEUE
|
||||
TASK_INIT(&precvpriv->rx_indicate_tasklet, 0, rtw_rx_indicate_tasklet, padapter);
|
||||
#endif /* CONFIG_RX_INDICATE_QUEUE */
|
||||
#endif /* PLATFORM_FREEBSD */
|
||||
|
||||
#ifdef CONFIG_USB_INTERRUPT_IN_PIPE
|
||||
#ifdef PLATFORM_LINUX
|
||||
precvpriv->int_in_urb = usb_alloc_urb(0, GFP_KERNEL);
|
||||
if (precvpriv->int_in_urb == NULL) {
|
||||
res = _FAIL;
|
||||
RTW_INFO("alloc_urb for interrupt in endpoint fail !!!!\n");
|
||||
goto exit;
|
||||
}
|
||||
#endif /* PLATFORM_LINUX */
|
||||
precvpriv->int_in_buf = rtw_zmalloc(ini_in_buf_sz);
|
||||
if (precvpriv->int_in_buf == NULL) {
|
||||
res = _FAIL;
|
||||
RTW_INFO("alloc_mem for interrupt in endpoint fail !!!!\n");
|
||||
goto exit;
|
||||
}
|
||||
#endif /* CONFIG_USB_INTERRUPT_IN_PIPE */
|
||||
|
||||
/* init recv_buf */
|
||||
_rtw_init_queue(&precvpriv->free_recv_buf_queue);
|
||||
_rtw_init_queue(&precvpriv->recv_buf_pending_queue);
|
||||
#ifndef CONFIG_USE_USB_BUFFER_ALLOC_RX
|
||||
/* this is used only when RX_IOBUF is sk_buff */
|
||||
skb_queue_head_init(&precvpriv->free_recv_skb_queue);
|
||||
#endif
|
||||
|
||||
RTW_INFO("NR_RECVBUFF: %d\n", NR_RECVBUFF);
|
||||
RTW_INFO("MAX_RECVBUF_SZ: %d\n", MAX_RECVBUF_SZ);
|
||||
precvpriv->pallocated_recv_buf = rtw_zmalloc(NR_RECVBUFF * sizeof(struct recv_buf) + 4);
|
||||
if (precvpriv->pallocated_recv_buf == NULL) {
|
||||
res = _FAIL;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
precvpriv->precv_buf = (u8 *)N_BYTE_ALIGMENT((SIZE_PTR)(precvpriv->pallocated_recv_buf), 4);
|
||||
|
||||
precvbuf = (struct recv_buf *)precvpriv->precv_buf;
|
||||
|
||||
for (i = 0; i < NR_RECVBUFF ; i++) {
|
||||
_rtw_init_listhead(&precvbuf->list);
|
||||
|
||||
_rtw_spinlock_init(&precvbuf->recvbuf_lock);
|
||||
|
||||
precvbuf->alloc_sz = MAX_RECVBUF_SZ;
|
||||
|
||||
res = rtw_os_recvbuf_resource_alloc(padapter, precvbuf);
|
||||
if (res == _FAIL)
|
||||
break;
|
||||
|
||||
precvbuf->ref_cnt = 0;
|
||||
precvbuf->adapter = padapter;
|
||||
|
||||
/* rtw_list_insert_tail(&precvbuf->list, &(precvpriv->free_recv_buf_queue.queue)); */
|
||||
|
||||
precvbuf++;
|
||||
}
|
||||
|
||||
precvpriv->free_recv_buf_queue_cnt = NR_RECVBUFF;
|
||||
|
||||
#if defined(PLATFORM_LINUX) || defined(PLATFORM_FREEBSD)
|
||||
|
||||
skb_queue_head_init(&precvpriv->rx_skb_queue);
|
||||
|
||||
#ifdef CONFIG_RX_INDICATE_QUEUE
|
||||
memset(&precvpriv->rx_indicate_queue, 0, sizeof(struct ifqueue));
|
||||
mtx_init(&precvpriv->rx_indicate_queue.ifq_mtx, "rx_indicate_queue", NULL, MTX_DEF);
|
||||
#endif /* CONFIG_RX_INDICATE_QUEUE */
|
||||
|
||||
#ifdef CONFIG_PREALLOC_RECV_SKB
|
||||
{
|
||||
int i;
|
||||
SIZE_PTR tmpaddr = 0;
|
||||
SIZE_PTR alignment = 0;
|
||||
struct sk_buff *pskb = NULL;
|
||||
|
||||
RTW_INFO("NR_PREALLOC_RECV_SKB: %d\n", NR_PREALLOC_RECV_SKB);
|
||||
#ifdef CONFIG_FIX_NR_BULKIN_BUFFER
|
||||
RTW_INFO("Enable CONFIG_FIX_NR_BULKIN_BUFFER\n");
|
||||
#endif
|
||||
|
||||
for (i = 0; i < NR_PREALLOC_RECV_SKB; i++) {
|
||||
#ifdef CONFIG_PREALLOC_RX_SKB_BUFFER
|
||||
pskb = rtw_alloc_skb_premem(MAX_RECVBUF_SZ);
|
||||
#else
|
||||
pskb = rtw_skb_alloc(MAX_RECVBUF_SZ + RECVBUFF_ALIGN_SZ);
|
||||
#endif /* CONFIG_PREALLOC_RX_SKB_BUFFER */
|
||||
|
||||
if (pskb) {
|
||||
#ifdef PLATFORM_FREEBSD
|
||||
pskb->dev = padapter->pifp;
|
||||
#else
|
||||
pskb->dev = padapter->pnetdev;
|
||||
#endif /* PLATFORM_FREEBSD */
|
||||
|
||||
#ifndef CONFIG_PREALLOC_RX_SKB_BUFFER
|
||||
tmpaddr = (SIZE_PTR)pskb->data;
|
||||
alignment = tmpaddr & (RECVBUFF_ALIGN_SZ - 1);
|
||||
skb_reserve(pskb, (RECVBUFF_ALIGN_SZ - alignment));
|
||||
#endif
|
||||
skb_queue_tail(&precvpriv->free_recv_skb_queue, pskb);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_PREALLOC_RECV_SKB */
|
||||
|
||||
#endif /* defined(PLATFORM_LINUX) || defined(PLATFORM_FREEBSD) */
|
||||
|
||||
exit:
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
void usb_free_recv_priv(_adapter *padapter, u16 ini_in_buf_sz)
|
||||
{
|
||||
int i;
|
||||
struct recv_buf *precvbuf;
|
||||
struct recv_priv *precvpriv = &padapter->recvpriv;
|
||||
|
||||
precvbuf = (struct recv_buf *)precvpriv->precv_buf;
|
||||
|
||||
for (i = 0; i < NR_RECVBUFF ; i++) {
|
||||
rtw_os_recvbuf_resource_free(padapter, precvbuf);
|
||||
precvbuf++;
|
||||
}
|
||||
|
||||
if (precvpriv->pallocated_recv_buf)
|
||||
rtw_mfree(precvpriv->pallocated_recv_buf, NR_RECVBUFF * sizeof(struct recv_buf) + 4);
|
||||
|
||||
#ifdef CONFIG_USB_INTERRUPT_IN_PIPE
|
||||
#ifdef PLATFORM_LINUX
|
||||
if (precvpriv->int_in_urb)
|
||||
usb_free_urb(precvpriv->int_in_urb);
|
||||
#endif
|
||||
if (precvpriv->int_in_buf)
|
||||
rtw_mfree(precvpriv->int_in_buf, ini_in_buf_sz);
|
||||
#endif /* CONFIG_USB_INTERRUPT_IN_PIPE */
|
||||
|
||||
#ifdef PLATFORM_LINUX
|
||||
|
||||
if (skb_queue_len(&precvpriv->rx_skb_queue))
|
||||
RTW_WARN("rx_skb_queue not empty\n");
|
||||
|
||||
rtw_skb_queue_purge(&precvpriv->rx_skb_queue);
|
||||
|
||||
if (skb_queue_len(&precvpriv->free_recv_skb_queue))
|
||||
RTW_WARN("free_recv_skb_queue not empty, %d\n", skb_queue_len(&precvpriv->free_recv_skb_queue));
|
||||
|
||||
#if !defined(CONFIG_USE_USB_BUFFER_ALLOC_RX)
|
||||
#if defined(CONFIG_PREALLOC_RECV_SKB) && defined(CONFIG_PREALLOC_RX_SKB_BUFFER)
|
||||
{
|
||||
struct sk_buff *skb;
|
||||
|
||||
while ((skb = skb_dequeue(&precvpriv->free_recv_skb_queue)) != NULL) {
|
||||
if (rtw_free_skb_premem(skb) != 0)
|
||||
rtw_skb_free(skb);
|
||||
}
|
||||
}
|
||||
#else
|
||||
rtw_skb_queue_purge(&precvpriv->free_recv_skb_queue);
|
||||
#endif /* defined(CONFIG_PREALLOC_RX_SKB_BUFFER) && defined(CONFIG_PREALLOC_RECV_SKB) */
|
||||
#endif /* !defined(CONFIG_USE_USB_BUFFER_ALLOC_RX) */
|
||||
|
||||
#endif /* PLATFORM_LINUX */
|
||||
|
||||
#ifdef PLATFORM_FREEBSD
|
||||
struct sk_buff *pskb;
|
||||
while (NULL != (pskb = skb_dequeue(&precvpriv->rx_skb_queue)))
|
||||
rtw_skb_free(pskb);
|
||||
|
||||
#if !defined(CONFIG_USE_USB_BUFFER_ALLOC_RX)
|
||||
rtw_skb_queue_purge(&precvpriv->free_recv_skb_queue);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_RX_INDICATE_QUEUE
|
||||
struct mbuf *m;
|
||||
for (;;) {
|
||||
IF_DEQUEUE(&precvpriv->rx_indicate_queue, m);
|
||||
if (m == NULL)
|
||||
break;
|
||||
m_freem(m);
|
||||
}
|
||||
mtx_destroy(&precvpriv->rx_indicate_queue.ifq_mtx);
|
||||
#endif /* CONFIG_RX_INDICATE_QUEUE */
|
||||
|
||||
#endif /* PLATFORM_FREEBSD */
|
||||
}
|
||||
|
||||
#ifdef CONFIG_FW_C2H_REG
|
||||
void usb_c2h_hisr_hdl(_adapter *adapter, u8 *buf)
|
||||
{
|
||||
u8 *c2h_evt = buf;
|
||||
u8 id, seq, plen;
|
||||
u8 *payload;
|
||||
|
||||
if (rtw_hal_c2h_reg_hdr_parse(adapter, buf, &id, &seq, &plen, &payload) != _SUCCESS)
|
||||
return;
|
||||
|
||||
if (0)
|
||||
RTW_PRINT("%s C2H == %d\n", __func__, id);
|
||||
|
||||
if (rtw_hal_c2h_id_handle_directly(adapter, id, seq, plen, payload)) {
|
||||
/* Handle directly */
|
||||
rtw_hal_c2h_handler(adapter, id, seq, plen, payload);
|
||||
|
||||
/* Replace with special pointer to trigger c2h_evt_clear only */
|
||||
if (rtw_cbuf_push(adapter->evtpriv.c2h_queue, (void*)&adapter->evtpriv) != _SUCCESS)
|
||||
RTW_ERR("%s rtw_cbuf_push fail\n", __func__);
|
||||
} else {
|
||||
c2h_evt = rtw_malloc(C2H_REG_LEN);
|
||||
if (c2h_evt != NULL) {
|
||||
_rtw_memcpy(c2h_evt, buf, C2H_REG_LEN);
|
||||
if (rtw_cbuf_push(adapter->evtpriv.c2h_queue, (void*)c2h_evt) != _SUCCESS)
|
||||
RTW_ERR("%s rtw_cbuf_push fail\n", __func__);
|
||||
} else {
|
||||
/* Error handling for malloc fail */
|
||||
if (rtw_cbuf_push(adapter->evtpriv.c2h_queue, (void*)NULL) != _SUCCESS)
|
||||
RTW_ERR("%s rtw_cbuf_push fail\n", __func__);
|
||||
}
|
||||
}
|
||||
_set_workitem(&adapter->evtpriv.c2h_wk);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USB_SUPPORT_ASYNC_VDN_REQ
|
||||
int usb_write_async(struct usb_device *udev, u32 addr, void *pdata, u16 len)
|
||||
{
|
||||
u8 request;
|
||||
u8 requesttype;
|
||||
u16 wvalue;
|
||||
u16 index;
|
||||
int ret;
|
||||
|
||||
requesttype = VENDOR_WRITE;/* write_out */
|
||||
request = REALTEK_USB_VENQT_CMD_REQ;
|
||||
index = REALTEK_USB_VENQT_CMD_IDX;/* n/a */
|
||||
|
||||
wvalue = (u16)(addr & 0x0000ffff);
|
||||
|
||||
ret = _usbctrl_vendorreq_async_write(udev, request, wvalue, index, pdata, len, requesttype);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int usb_async_write8(struct intf_hdl *pintfhdl, u32 addr, u8 val)
|
||||
{
|
||||
u8 data;
|
||||
int ret;
|
||||
struct dvobj_priv *pdvobjpriv = (struct dvobj_priv *)pintfhdl->pintf_dev;
|
||||
struct usb_device *udev = pdvobjpriv->pusbdev;
|
||||
|
||||
data = val;
|
||||
ret = usb_write_async(udev, addr, &data, 1);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int usb_async_write16(struct intf_hdl *pintfhdl, u32 addr, u16 val)
|
||||
{
|
||||
u16 data;
|
||||
int ret;
|
||||
struct dvobj_priv *pdvobjpriv = (struct dvobj_priv *)pintfhdl->pintf_dev;
|
||||
struct usb_device *udev = pdvobjpriv->pusbdev;
|
||||
|
||||
data = val;
|
||||
ret = usb_write_async(udev, addr, &data, 2);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int usb_async_write32(struct intf_hdl *pintfhdl, u32 addr, u32 val)
|
||||
{
|
||||
u32 data;
|
||||
int ret;
|
||||
struct dvobj_priv *pdvobjpriv = (struct dvobj_priv *)pintfhdl->pintf_dev;
|
||||
struct usb_device *udev = pdvobjpriv->pusbdev;
|
||||
|
||||
data = val;
|
||||
ret = usb_write_async(udev, addr, &data, 4);
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif /* CONFIG_USB_SUPPORT_ASYNC_VDN_REQ */
|
||||
|
||||
u8 usb_read8(struct intf_hdl *pintfhdl, u32 addr)
|
||||
{
|
||||
u8 request;
|
||||
u8 requesttype;
|
||||
u16 wvalue;
|
||||
u16 index;
|
||||
u16 len;
|
||||
u8 data = 0;
|
||||
|
||||
|
||||
request = 0x05;
|
||||
requesttype = 0x01;/* read_in */
|
||||
index = 0;/* n/a */
|
||||
|
||||
wvalue = (u16)(addr & 0x0000ffff);
|
||||
len = 1;
|
||||
usbctrl_vendorreq(pintfhdl, request, wvalue, index,
|
||||
&data, len, requesttype);
|
||||
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
u16 usb_read16(struct intf_hdl *pintfhdl, u32 addr)
|
||||
{
|
||||
u8 request;
|
||||
u8 requesttype;
|
||||
u16 wvalue;
|
||||
u16 index;
|
||||
u16 len;
|
||||
u16 data = 0;
|
||||
|
||||
|
||||
request = 0x05;
|
||||
requesttype = 0x01;/* read_in */
|
||||
index = 0;/* n/a */
|
||||
|
||||
wvalue = (u16)(addr & 0x0000ffff);
|
||||
len = 2;
|
||||
usbctrl_vendorreq(pintfhdl, request, wvalue, index,
|
||||
&data, len, requesttype);
|
||||
|
||||
|
||||
return data;
|
||||
|
||||
}
|
||||
|
||||
u32 usb_read32(struct intf_hdl *pintfhdl, u32 addr)
|
||||
{
|
||||
u8 request;
|
||||
u8 requesttype;
|
||||
u16 wvalue;
|
||||
u16 index;
|
||||
u16 len;
|
||||
u32 data = 0;
|
||||
|
||||
|
||||
request = 0x05;
|
||||
requesttype = 0x01;/* read_in */
|
||||
index = 0;/* n/a */
|
||||
|
||||
wvalue = (u16)(addr & 0x0000ffff);
|
||||
len = 4;
|
||||
usbctrl_vendorreq(pintfhdl, request, wvalue, index,
|
||||
&data, len, requesttype);
|
||||
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
int usb_write8(struct intf_hdl *pintfhdl, u32 addr, u8 val)
|
||||
{
|
||||
u8 request;
|
||||
u8 requesttype;
|
||||
u16 wvalue;
|
||||
u16 index;
|
||||
u16 len;
|
||||
u8 data;
|
||||
int ret;
|
||||
|
||||
|
||||
request = 0x05;
|
||||
requesttype = 0x00;/* write_out */
|
||||
index = 0;/* n/a */
|
||||
|
||||
wvalue = (u16)(addr & 0x0000ffff);
|
||||
len = 1;
|
||||
|
||||
data = val;
|
||||
ret = usbctrl_vendorreq(pintfhdl, request, wvalue, index,
|
||||
&data, len, requesttype);
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int usb_write16(struct intf_hdl *pintfhdl, u32 addr, u16 val)
|
||||
{
|
||||
u8 request;
|
||||
u8 requesttype;
|
||||
u16 wvalue;
|
||||
u16 index;
|
||||
u16 len;
|
||||
u16 data;
|
||||
int ret;
|
||||
|
||||
|
||||
request = 0x05;
|
||||
requesttype = 0x00;/* write_out */
|
||||
index = 0;/* n/a */
|
||||
|
||||
wvalue = (u16)(addr & 0x0000ffff);
|
||||
len = 2;
|
||||
|
||||
data = val;
|
||||
ret = usbctrl_vendorreq(pintfhdl, request, wvalue, index,
|
||||
&data, len, requesttype);
|
||||
|
||||
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
int usb_write32(struct intf_hdl *pintfhdl, u32 addr, u32 val)
|
||||
{
|
||||
u8 request;
|
||||
u8 requesttype;
|
||||
u16 wvalue;
|
||||
u16 index;
|
||||
u16 len;
|
||||
u32 data;
|
||||
int ret;
|
||||
|
||||
|
||||
request = 0x05;
|
||||
requesttype = 0x00;/* write_out */
|
||||
index = 0;/* n/a */
|
||||
|
||||
wvalue = (u16)(addr & 0x0000ffff);
|
||||
len = 4;
|
||||
data = val;
|
||||
ret = usbctrl_vendorreq(pintfhdl, request, wvalue, index,
|
||||
&data, len, requesttype);
|
||||
|
||||
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
int usb_writeN(struct intf_hdl *pintfhdl, u32 addr, u32 length, u8 *pdata)
|
||||
{
|
||||
u8 request;
|
||||
u8 requesttype;
|
||||
u16 wvalue;
|
||||
u16 index;
|
||||
u16 len;
|
||||
u8 buf[VENDOR_CMD_MAX_DATA_LEN] = {0};
|
||||
int ret;
|
||||
|
||||
|
||||
request = 0x05;
|
||||
requesttype = 0x00;/* write_out */
|
||||
index = 0;/* n/a */
|
||||
|
||||
wvalue = (u16)(addr & 0x0000ffff);
|
||||
len = length;
|
||||
_rtw_memcpy(buf, pdata, len);
|
||||
ret = usbctrl_vendorreq(pintfhdl, request, wvalue, index,
|
||||
buf, len, requesttype);
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void usb_set_intf_ops(_adapter *padapter, struct _io_ops *pops)
|
||||
{
|
||||
_rtw_memset((u8 *)pops, 0, sizeof(struct _io_ops));
|
||||
|
||||
pops->_read8 = &usb_read8;
|
||||
pops->_read16 = &usb_read16;
|
||||
pops->_read32 = &usb_read32;
|
||||
pops->_read_mem = &usb_read_mem;
|
||||
pops->_read_port = &usb_read_port;
|
||||
|
||||
pops->_write8 = &usb_write8;
|
||||
pops->_write16 = &usb_write16;
|
||||
pops->_write32 = &usb_write32;
|
||||
pops->_writeN = &usb_writeN;
|
||||
|
||||
#ifdef CONFIG_USB_SUPPORT_ASYNC_VDN_REQ
|
||||
pops->_write8_async = &usb_async_write8;
|
||||
pops->_write16_async = &usb_async_write16;
|
||||
pops->_write32_async = &usb_async_write32;
|
||||
#endif
|
||||
pops->_write_mem = &usb_write_mem;
|
||||
pops->_write_port = &usb_write_port;
|
||||
|
||||
pops->_read_port_cancel = &usb_read_port_cancel;
|
||||
pops->_write_port_cancel = &usb_write_port_cancel;
|
||||
|
||||
#ifdef CONFIG_USB_INTERRUPT_IN_PIPE
|
||||
pops->_read_interrupt = &usb_read_interrupt;
|
||||
#endif
|
||||
|
||||
}
|
1494
hal/hal_intf.c
1494
hal/hal_intf.c
File diff suppressed because it is too large
Load diff
1877
hal/hal_mcc.c
Normal file
1877
hal/hal_mcc.c
Normal file
File diff suppressed because it is too large
Load diff
2212
hal/hal_mp.c
Normal file
2212
hal/hal_mp.c
Normal file
File diff suppressed because it is too large
Load diff
260
hal/hal_phy.c
Normal file
260
hal/hal_phy.c
Normal file
|
@ -0,0 +1,260 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* 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;
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
} /* 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 */
|
4287
hal/led/hal_usb_led.c
Normal file
4287
hal/led/hal_usb_led.c
Normal file
File diff suppressed because it is too large
Load diff
|
@ -1,827 +0,0 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* 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 "odm_precomp.h"
|
||||
|
||||
#define READ_AND_CONFIG READ_AND_CONFIG_MP
|
||||
|
||||
#define READ_AND_CONFIG_MP(ic, txt) (ODM_ReadAndConfig##txt##ic(pDM_Odm))
|
||||
#define READ_AND_CONFIG_TC(ic, txt) (ODM_ReadAndConfig_TC##txt##ic(pDM_Odm))
|
||||
|
||||
static u8
|
||||
odm_QueryRxPwrPercentage(
|
||||
s8 AntPower
|
||||
)
|
||||
{
|
||||
if ((AntPower <= -100) || (AntPower >= 20))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else if (AntPower >= 0)
|
||||
{
|
||||
return 100;
|
||||
}
|
||||
else
|
||||
{
|
||||
return (100+AntPower);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* */
|
||||
/* 2012/01/12 MH MOve some signal strength smooth method to MP HAL layer. */
|
||||
/* IF other SW team do not support the feature, remove this section.?? */
|
||||
/* */
|
||||
static s32
|
||||
odm_SignalScaleMapping_92CSeries_patch_RT_CID_819x_Lenovo(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
s32 CurrSig
|
||||
)
|
||||
{
|
||||
s32 RetSig;
|
||||
return RetSig;
|
||||
}
|
||||
|
||||
static s32
|
||||
odm_SignalScaleMapping_92CSeries_patch_RT_CID_819x_Netcore(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
s32 CurrSig
|
||||
)
|
||||
{
|
||||
s32 RetSig;
|
||||
return RetSig;
|
||||
}
|
||||
|
||||
|
||||
static s32
|
||||
odm_SignalScaleMapping_92CSeries(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
s32 CurrSig
|
||||
)
|
||||
{
|
||||
s32 RetSig;
|
||||
#if (DEV_BUS_TYPE == RT_PCI_INTERFACE)
|
||||
if (pDM_Odm->SupportInterface == ODM_ITRF_PCIE)
|
||||
{
|
||||
/* Step 1. Scale mapping. */
|
||||
if (CurrSig >= 61 && CurrSig <= 100)
|
||||
{
|
||||
RetSig = 90 + ((CurrSig - 60) / 4);
|
||||
}
|
||||
else if (CurrSig >= 41 && CurrSig <= 60)
|
||||
{
|
||||
RetSig = 78 + ((CurrSig - 40) / 2);
|
||||
}
|
||||
else if (CurrSig >= 31 && CurrSig <= 40)
|
||||
{
|
||||
RetSig = 66 + (CurrSig - 30);
|
||||
}
|
||||
else if (CurrSig >= 21 && CurrSig <= 30)
|
||||
{
|
||||
RetSig = 54 + (CurrSig - 20);
|
||||
}
|
||||
else if (CurrSig >= 5 && CurrSig <= 20)
|
||||
{
|
||||
RetSig = 42 + (((CurrSig - 5) * 2) / 3);
|
||||
}
|
||||
else if (CurrSig == 4)
|
||||
{
|
||||
RetSig = 36;
|
||||
}
|
||||
else if (CurrSig == 3)
|
||||
{
|
||||
RetSig = 27;
|
||||
}
|
||||
else if (CurrSig == 2)
|
||||
{
|
||||
RetSig = 18;
|
||||
}
|
||||
else if (CurrSig == 1)
|
||||
{
|
||||
RetSig = 9;
|
||||
}
|
||||
else
|
||||
{
|
||||
RetSig = CurrSig;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ((DEV_BUS_TYPE == RT_USB_INTERFACE) ||(DEV_BUS_TYPE == RT_SDIO_INTERFACE))
|
||||
if ((pDM_Odm->SupportInterface == ODM_ITRF_USB) || (pDM_Odm->SupportInterface == ODM_ITRF_SDIO) )
|
||||
{
|
||||
if (CurrSig >= 51 && CurrSig <= 100)
|
||||
{
|
||||
RetSig = 100;
|
||||
}
|
||||
else if (CurrSig >= 41 && CurrSig <= 50)
|
||||
{
|
||||
RetSig = 80 + ((CurrSig - 40)*2);
|
||||
}
|
||||
else if (CurrSig >= 31 && CurrSig <= 40)
|
||||
{
|
||||
RetSig = 66 + (CurrSig - 30);
|
||||
}
|
||||
else if (CurrSig >= 21 && CurrSig <= 30)
|
||||
{
|
||||
RetSig = 54 + (CurrSig - 20);
|
||||
}
|
||||
else if (CurrSig >= 10 && CurrSig <= 20)
|
||||
{
|
||||
RetSig = 42 + (((CurrSig - 10) * 2) / 3);
|
||||
}
|
||||
else if (CurrSig >= 5 && CurrSig <= 9)
|
||||
{
|
||||
RetSig = 22 + (((CurrSig - 5) * 3) / 2);
|
||||
}
|
||||
else if (CurrSig >= 1 && CurrSig <= 4)
|
||||
{
|
||||
RetSig = 6 + (((CurrSig - 1) * 3) / 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
RetSig = CurrSig;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return RetSig;
|
||||
}
|
||||
static s32 odm_SignalScaleMapping(PDM_ODM_T pDM_Odm, s32 CurrSig)
|
||||
{
|
||||
return odm_SignalScaleMapping_92CSeries(pDM_Odm,CurrSig);
|
||||
}
|
||||
|
||||
/* pMgntInfo->CustomerID == RT_CID_819x_Lenovo */
|
||||
static u8 odm_SQ_process_patch_RT_CID_819x_Lenovo(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
u8 isCCKrate,
|
||||
u8 PWDB_ALL,
|
||||
u8 path,
|
||||
u8 RSSI
|
||||
)
|
||||
{
|
||||
u8 SQ;
|
||||
return SQ;
|
||||
}
|
||||
|
||||
static u8
|
||||
odm_EVMdbToPercentage(
|
||||
s8 Value
|
||||
)
|
||||
{
|
||||
/* */
|
||||
/* -33dB~0dB to 0%~99% */
|
||||
/* */
|
||||
s8 ret_val;
|
||||
|
||||
ret_val = Value;
|
||||
/* ret_val /= 2; */
|
||||
|
||||
/* ODM_RTPRINT(FRX, RX_PHY_SQ, ("EVMdbToPercentage92C Value=%d / %x\n", ret_val, ret_val)); */
|
||||
|
||||
if (ret_val >= 0)
|
||||
ret_val = 0;
|
||||
if (ret_val <= -33)
|
||||
ret_val = -33;
|
||||
|
||||
ret_val = 0 - ret_val;
|
||||
ret_val*=3;
|
||||
|
||||
if (ret_val == 99)
|
||||
ret_val = 100;
|
||||
|
||||
return(ret_val);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
odm_RxPhyStatus92CSeries_Parsing(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
PODM_PHY_INFO_T pPhyInfo,
|
||||
u8 * pPhyStatus,
|
||||
PODM_PACKET_INFO_T pPktinfo
|
||||
)
|
||||
{
|
||||
SWAT_T *pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table;
|
||||
u8 i, Max_spatial_stream;
|
||||
s8 rx_pwr[4], rx_pwr_all=0;
|
||||
u8 EVM, PWDB_ALL = 0, PWDB_ALL_BT;
|
||||
u8 RSSI, total_rssi=0;
|
||||
u8 isCCKrate=0;
|
||||
u8 rf_rx_num = 0;
|
||||
u8 cck_highpwr = 0;
|
||||
u8 LNA_idx, VGA_idx;
|
||||
|
||||
PPHY_STATUS_RPT_8192CD_T pPhyStaRpt = (PPHY_STATUS_RPT_8192CD_T)pPhyStatus;
|
||||
|
||||
isCCKrate = (pPktinfo->Rate <= DESC92C_RATE11M) ? true : false;
|
||||
|
||||
pPhyInfo->RxMIMOSignalQuality[RF_PATH_A] = -1;
|
||||
pPhyInfo->RxMIMOSignalQuality[RF_PATH_B] = -1;
|
||||
|
||||
|
||||
if (isCCKrate) {
|
||||
u8 report;
|
||||
u8 cck_agc_rpt;
|
||||
|
||||
pDM_Odm->PhyDbgInfo.NumQryPhyStatusCCK++;
|
||||
/* (1)Hardware does not provide RSSI for CCK */
|
||||
/* (2)PWDB, Average PWDB cacluated by hardware (for rate adaptive) */
|
||||
|
||||
cck_highpwr = pDM_Odm->bCckHighPower;
|
||||
|
||||
cck_agc_rpt = pPhyStaRpt->cck_agc_rpt_ofdm_cfosho_a ;
|
||||
|
||||
/* 2011.11.28 LukeLee: 88E use different LNA & VGA gain table */
|
||||
/* The RSSI formula should be modified according to the gain table */
|
||||
/* In 88E, cck_highpwr is always set to 1 */
|
||||
if (pDM_Odm->SupportICType & (ODM_RTL8188E|ODM_RTL8812)) {
|
||||
LNA_idx = ((cck_agc_rpt & 0xE0) >>5);
|
||||
VGA_idx = (cck_agc_rpt & 0x1F);
|
||||
switch (LNA_idx) {
|
||||
case 7:
|
||||
if (VGA_idx <= 27)
|
||||
rx_pwr_all = -100 + 2*(27-VGA_idx); /* VGA_idx = 27~2 */
|
||||
else
|
||||
rx_pwr_all = -100;
|
||||
break;
|
||||
case 6:
|
||||
rx_pwr_all = -48 + 2*(2-VGA_idx); /* VGA_idx = 2~0 */
|
||||
break;
|
||||
case 5:
|
||||
rx_pwr_all = -42 + 2*(7-VGA_idx); /* VGA_idx = 7~5 */
|
||||
break;
|
||||
case 4:
|
||||
rx_pwr_all = -36 + 2*(7-VGA_idx); /* VGA_idx = 7~4 */
|
||||
break;
|
||||
case 3:
|
||||
rx_pwr_all = -24 + 2*(7-VGA_idx); /* VGA_idx = 7~0 */
|
||||
break;
|
||||
case 2:
|
||||
if (cck_highpwr)
|
||||
rx_pwr_all = -12 + 2*(5-VGA_idx); /* VGA_idx = 5~0 */
|
||||
else
|
||||
rx_pwr_all = -6+ 2*(5-VGA_idx);
|
||||
break;
|
||||
case 1:
|
||||
rx_pwr_all = 8-2*VGA_idx;
|
||||
break;
|
||||
case 0:
|
||||
rx_pwr_all = 14-2*VGA_idx;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
rx_pwr_all += 6;
|
||||
PWDB_ALL = odm_QueryRxPwrPercentage(rx_pwr_all);
|
||||
if (cck_highpwr == false) {
|
||||
if (PWDB_ALL >= 80)
|
||||
PWDB_ALL = ((PWDB_ALL-80)<<1)+((PWDB_ALL-80)>>1)+80;
|
||||
else if ((PWDB_ALL <= 78) && (PWDB_ALL >= 20))
|
||||
PWDB_ALL += 3;
|
||||
if (PWDB_ALL>100)
|
||||
PWDB_ALL = 100;
|
||||
}
|
||||
} else {
|
||||
if (!cck_highpwr) {
|
||||
report =( cck_agc_rpt & 0xc0 )>>6;
|
||||
switch (report) {
|
||||
/* 03312009 modified by cosa */
|
||||
/* Modify the RF RNA gain value to -40, -20, -2, 14 by Jenyu's suggestion */
|
||||
/* Note: different RF with the different RNA gain. */
|
||||
case 0x3:
|
||||
rx_pwr_all = -46 - (cck_agc_rpt & 0x3e);
|
||||
break;
|
||||
case 0x2:
|
||||
rx_pwr_all = -26 - (cck_agc_rpt & 0x3e);
|
||||
break;
|
||||
case 0x1:
|
||||
rx_pwr_all = -12 - (cck_agc_rpt & 0x3e);
|
||||
break;
|
||||
case 0x0:
|
||||
rx_pwr_all = 16 - (cck_agc_rpt & 0x3e);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
/* report = pDrvInfo->cfosho[0] & 0x60; */
|
||||
/* report = pPhyStaRpt->cck_agc_rpt_ofdm_cfosho_a& 0x60; */
|
||||
|
||||
report = (cck_agc_rpt & 0x60)>>5;
|
||||
switch (report)
|
||||
{
|
||||
case 0x3:
|
||||
rx_pwr_all = -46 - ((cck_agc_rpt & 0x1f)<<1) ;
|
||||
break;
|
||||
case 0x2:
|
||||
rx_pwr_all = -26 - ((cck_agc_rpt & 0x1f)<<1);
|
||||
break;
|
||||
case 0x1:
|
||||
rx_pwr_all = -12 - ((cck_agc_rpt & 0x1f)<<1) ;
|
||||
break;
|
||||
case 0x0:
|
||||
rx_pwr_all = 16 - ((cck_agc_rpt & 0x1f)<<1) ;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
PWDB_ALL = odm_QueryRxPwrPercentage(rx_pwr_all);
|
||||
|
||||
/* Modification for ext-LNA board */
|
||||
if (pDM_Odm->BoardType & (ODM_BOARD_EXT_LNA | ODM_BOARD_EXT_PA)) {
|
||||
if ((cck_agc_rpt>>7) == 0) {
|
||||
PWDB_ALL = (PWDB_ALL>94)?100:(PWDB_ALL +6);
|
||||
} else {
|
||||
if (PWDB_ALL > 38)
|
||||
PWDB_ALL -= 16;
|
||||
else
|
||||
PWDB_ALL = (PWDB_ALL<=16)?(PWDB_ALL>>2):(PWDB_ALL -12);
|
||||
}
|
||||
|
||||
/* CCK modification */
|
||||
if (PWDB_ALL > 25 && PWDB_ALL <= 60)
|
||||
PWDB_ALL += 6;
|
||||
/* else if (PWDB_ALL <= 25) */
|
||||
/* PWDB_ALL += 8; */
|
||||
} else { /* Modification for int-LNA board */
|
||||
if (PWDB_ALL > 99)
|
||||
PWDB_ALL -= 8;
|
||||
else if (PWDB_ALL > 50 && PWDB_ALL <= 68)
|
||||
PWDB_ALL += 4;
|
||||
}
|
||||
}
|
||||
|
||||
pPhyInfo->RxPWDBAll = PWDB_ALL;
|
||||
pPhyInfo->BTRxRSSIPercentage = PWDB_ALL;
|
||||
pPhyInfo->RecvSignalPower = rx_pwr_all;
|
||||
/* */
|
||||
/* (3) Get Signal Quality (EVM) */
|
||||
/* */
|
||||
if (pPktinfo->bPacketMatchBSSID) {
|
||||
u8 SQ,SQ_rpt;
|
||||
|
||||
if (pPhyInfo->RxPWDBAll > 40 && !pDM_Odm->bInHctTest) {
|
||||
SQ = 100;
|
||||
} else {
|
||||
SQ_rpt = pPhyStaRpt->cck_sig_qual_ofdm_pwdb_all;
|
||||
|
||||
if (SQ_rpt > 64)
|
||||
SQ = 0;
|
||||
else if (SQ_rpt < 20)
|
||||
SQ = 100;
|
||||
else
|
||||
SQ = ((64-SQ_rpt) * 100) / 44;
|
||||
|
||||
}
|
||||
/* DbgPrint("cck SQ = %d\n", SQ); */
|
||||
pPhyInfo->SignalQuality = SQ;
|
||||
pPhyInfo->RxMIMOSignalQuality[RF_PATH_A] = SQ;
|
||||
pPhyInfo->RxMIMOSignalQuality[RF_PATH_B] = -1;
|
||||
}
|
||||
} else { /* is OFDM rate */
|
||||
pDM_Odm->PhyDbgInfo.NumQryPhyStatusOFDM++;
|
||||
|
||||
/* (1)Get RSSI for HT rate */
|
||||
for (i = RF_PATH_A; i < RF_PATH_MAX; i++) {
|
||||
/* 2008/01/30 MH we will judge RF RX path now. */
|
||||
if (pDM_Odm->RFPathRxEnable & BIT(i))
|
||||
rf_rx_num++;
|
||||
|
||||
rx_pwr[i] = ((pPhyStaRpt->path_agc[i].gain& 0x3F)*2) - 110;
|
||||
pPhyInfo->RxPwr[i] = rx_pwr[i];
|
||||
|
||||
/* Translate DBM to percentage. */
|
||||
RSSI = odm_QueryRxPwrPercentage(rx_pwr[i]);
|
||||
total_rssi += RSSI;
|
||||
/* RTPRINT(FRX, RX_PHY_SS, ("RF-%d RXPWR=%x RSSI=%d\n", i, rx_pwr[i], RSSI)); */
|
||||
|
||||
/* Modification for ext-LNA board */
|
||||
if (pDM_Odm->BoardType & (ODM_BOARD_EXT_LNA | ODM_BOARD_EXT_PA)) {
|
||||
if ((pPhyStaRpt->path_agc[i].trsw) == 1)
|
||||
RSSI = (RSSI>94)?100:(RSSI +6);
|
||||
else
|
||||
RSSI = (RSSI<=16)?(RSSI>>3):(RSSI -16);
|
||||
|
||||
if ((RSSI <= 34) && (RSSI >=4))
|
||||
RSSI -= 4;
|
||||
}
|
||||
|
||||
pPhyInfo->RxMIMOSignalStrength[i] =(u8) RSSI;
|
||||
|
||||
/* Get Rx snr value in DB */
|
||||
pPhyInfo->RxSNR[i] = pDM_Odm->PhyDbgInfo.RxSNRdB[i] = (s32)(pPhyStaRpt->path_rxsnr[i]/2);
|
||||
}
|
||||
|
||||
|
||||
/* */
|
||||
/* (2)PWDB, Average PWDB cacluated by hardware (for rate adaptive) */
|
||||
/* */
|
||||
rx_pwr_all = (((pPhyStaRpt->cck_sig_qual_ofdm_pwdb_all) >> 1 )& 0x7f) -110;
|
||||
|
||||
PWDB_ALL_BT = PWDB_ALL = odm_QueryRxPwrPercentage(rx_pwr_all);
|
||||
|
||||
pPhyInfo->RxPWDBAll = PWDB_ALL;
|
||||
pPhyInfo->BTRxRSSIPercentage = PWDB_ALL_BT;
|
||||
pPhyInfo->RxPower = rx_pwr_all;
|
||||
pPhyInfo->RecvSignalPower = rx_pwr_all;
|
||||
|
||||
/* */
|
||||
/* (3)EVM of HT rate */
|
||||
/* */
|
||||
if (pPktinfo->Rate >=DESC92C_RATEMCS8 && pPktinfo->Rate <=DESC92C_RATEMCS15)
|
||||
Max_spatial_stream = 2; /* both spatial stream make sense */
|
||||
else
|
||||
Max_spatial_stream = 1; /* only spatial stream 1 makes sense */
|
||||
|
||||
for (i=0; i<Max_spatial_stream; i++) {
|
||||
/* Do not use shift operation like "rx_evmX >>= 1" because the compilor of free build environment */
|
||||
/* fill most significant bit to "zero" when doing shifting operation which may change a negative */
|
||||
/* value to positive one, then the dbm value (which is supposed to be negative) is not correct anymore. */
|
||||
EVM = odm_EVMdbToPercentage( (pPhyStaRpt->stream_rxevm[i] )); /* dbm */
|
||||
|
||||
/* RTPRINT(FRX, RX_PHY_SQ, ("RXRATE=%x RXEVM=%x EVM=%s%d\n", */
|
||||
/* GET_RX_STATUS_DESC_RX_MCS(pDesc), pDrvInfo->rxevm[i], "%", EVM)); */
|
||||
|
||||
if (pPktinfo->bPacketMatchBSSID)
|
||||
{
|
||||
if (i==RF_PATH_A) /* Fill value in RFD, Get the first spatial stream only */
|
||||
{
|
||||
pPhyInfo->SignalQuality = (u8)(EVM & 0xff);
|
||||
}
|
||||
pPhyInfo->RxMIMOSignalQuality[i] = (u8)(EVM & 0xff);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/* UI BSS List signal strength(in percentage), make it good looking, from 0~100. */
|
||||
/* It is assigned to the BSS List in GetValueFromBeaconOrProbeRsp(). */
|
||||
if (isCCKrate) {
|
||||
pPhyInfo->SignalStrength = (u8)(odm_SignalScaleMapping(pDM_Odm, PWDB_ALL));/* PWDB_ALL; */
|
||||
} else {
|
||||
if (rf_rx_num != 0)
|
||||
pPhyInfo->SignalStrength = (u8)(odm_SignalScaleMapping(pDM_Odm, total_rssi/=rf_rx_num));
|
||||
}
|
||||
|
||||
/* For 92C/92D HW (Hybrid) Antenna Diversity */
|
||||
pDM_SWAT_Table->antsel = pPhyStaRpt->ant_sel;
|
||||
/* For 88E HW Antenna Diversity */
|
||||
pDM_Odm->DM_FatTable.antsel_rx_keep_0 = pPhyStaRpt->ant_sel;
|
||||
pDM_Odm->DM_FatTable.antsel_rx_keep_1 = pPhyStaRpt->ant_sel_b;
|
||||
pDM_Odm->DM_FatTable.antsel_rx_keep_2 = pPhyStaRpt->antsel_rx_keep_2;
|
||||
}
|
||||
|
||||
void
|
||||
odm_Init_RSSIForDM(
|
||||
PDM_ODM_T pDM_Odm
|
||||
)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
odm_Process_RSSIForDM(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
PODM_PHY_INFO_T pPhyInfo,
|
||||
PODM_PACKET_INFO_T pPktinfo
|
||||
)
|
||||
{
|
||||
|
||||
s32 UndecoratedSmoothedPWDB, UndecoratedSmoothedCCK, UndecoratedSmoothedOFDM, RSSI_Ave;
|
||||
u8 isCCKrate=0;
|
||||
u8 RSSI_max, RSSI_min, i;
|
||||
u32 OFDM_pkt=0;
|
||||
u32 Weighting=0;
|
||||
|
||||
PSTA_INFO_T pEntry;
|
||||
|
||||
if (pPktinfo->StationID == 0xFF)
|
||||
return;
|
||||
|
||||
pEntry = pDM_Odm->pODM_StaInfo[pPktinfo->StationID];
|
||||
if (!IS_STA_VALID(pEntry))
|
||||
return;
|
||||
if ((!pPktinfo->bPacketMatchBSSID) )
|
||||
return;
|
||||
|
||||
isCCKrate = (pPktinfo->Rate <= DESC92C_RATE11M) ? true : false;
|
||||
if (pPktinfo->bPacketBeacon)
|
||||
pDM_Odm->PhyDbgInfo.NumQryBeaconPkt++;
|
||||
|
||||
pDM_Odm->RxRate = pPktinfo->Rate;
|
||||
/* Smart Antenna Debug Message------------------ */
|
||||
if (pDM_Odm->SupportICType == ODM_RTL8188E)
|
||||
{
|
||||
u8 antsel_tr_mux;
|
||||
pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable;
|
||||
|
||||
if (pDM_Odm->AntDivType == CG_TRX_SMART_ANTDIV)
|
||||
{
|
||||
if (pDM_FatTable->FAT_State == FAT_TRAINING_STATE)
|
||||
{
|
||||
if (pPktinfo->bPacketToSelf) /* pPktinfo->bPacketMatchBSSID && (!pPktinfo->bPacketBeacon)) */
|
||||
{
|
||||
antsel_tr_mux = (pDM_FatTable->antsel_rx_keep_2<<2) |(pDM_FatTable->antsel_rx_keep_1 <<1) |pDM_FatTable->antsel_rx_keep_0;
|
||||
pDM_FatTable->antSumRSSI[antsel_tr_mux] += pPhyInfo->RxPWDBAll;
|
||||
pDM_FatTable->antRSSIcnt[antsel_tr_mux]++;
|
||||
}
|
||||
}
|
||||
} else if ((pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV)||(pDM_Odm->AntDivType == CGCS_RX_HW_ANTDIV)) {
|
||||
if (pPktinfo->bPacketToSelf || pPktinfo->bPacketBeacon) {
|
||||
antsel_tr_mux = (pDM_FatTable->antsel_rx_keep_2<<2) |(pDM_FatTable->antsel_rx_keep_1 <<1) |pDM_FatTable->antsel_rx_keep_0;
|
||||
ODM_AntselStatistics_88E(pDM_Odm, antsel_tr_mux, pPktinfo->StationID, pPhyInfo->RxPWDBAll);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/* Smart Antenna Debug Message------------------ */
|
||||
|
||||
UndecoratedSmoothedCCK = pEntry->rssi_stat.UndecoratedSmoothedCCK;
|
||||
UndecoratedSmoothedOFDM = pEntry->rssi_stat.UndecoratedSmoothedOFDM;
|
||||
UndecoratedSmoothedPWDB = pEntry->rssi_stat.UndecoratedSmoothedPWDB;
|
||||
|
||||
if (pPktinfo->bPacketToSelf || pPktinfo->bPacketBeacon)
|
||||
{
|
||||
|
||||
if (!isCCKrate)/* ofdm rate */
|
||||
{
|
||||
if (pPhyInfo->RxMIMOSignalStrength[RF_PATH_B] == 0) {
|
||||
RSSI_Ave = pPhyInfo->RxMIMOSignalStrength[RF_PATH_A];
|
||||
pDM_Odm->RSSI_A = pPhyInfo->RxMIMOSignalStrength[RF_PATH_A];
|
||||
pDM_Odm->RSSI_B = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* DbgPrint("pRfd->Status.RxMIMOSignalStrength[0] = %d, pRfd->Status.RxMIMOSignalStrength[1] = %d\n", */
|
||||
/* pRfd->Status.RxMIMOSignalStrength[0], pRfd->Status.RxMIMOSignalStrength[1]); */
|
||||
pDM_Odm->RSSI_A = pPhyInfo->RxMIMOSignalStrength[RF_PATH_A];
|
||||
pDM_Odm->RSSI_B = pPhyInfo->RxMIMOSignalStrength[RF_PATH_B];
|
||||
|
||||
if (pPhyInfo->RxMIMOSignalStrength[RF_PATH_A] > pPhyInfo->RxMIMOSignalStrength[RF_PATH_B])
|
||||
{
|
||||
RSSI_max = pPhyInfo->RxMIMOSignalStrength[RF_PATH_A];
|
||||
RSSI_min = pPhyInfo->RxMIMOSignalStrength[RF_PATH_B];
|
||||
}
|
||||
else
|
||||
{
|
||||
RSSI_max = pPhyInfo->RxMIMOSignalStrength[RF_PATH_B];
|
||||
RSSI_min = pPhyInfo->RxMIMOSignalStrength[RF_PATH_A];
|
||||
}
|
||||
if ((RSSI_max -RSSI_min) < 3)
|
||||
RSSI_Ave = RSSI_max;
|
||||
else if ((RSSI_max -RSSI_min) < 6)
|
||||
RSSI_Ave = RSSI_max - 1;
|
||||
else if ((RSSI_max -RSSI_min) < 10)
|
||||
RSSI_Ave = RSSI_max - 2;
|
||||
else
|
||||
RSSI_Ave = RSSI_max - 3;
|
||||
}
|
||||
|
||||
/* 1 Process OFDM RSSI */
|
||||
if (UndecoratedSmoothedOFDM <= 0) /* initialize */
|
||||
{
|
||||
UndecoratedSmoothedOFDM = pPhyInfo->RxPWDBAll;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pPhyInfo->RxPWDBAll > (u32)UndecoratedSmoothedOFDM)
|
||||
{
|
||||
UndecoratedSmoothedOFDM =
|
||||
( ((UndecoratedSmoothedOFDM)*(Rx_Smooth_Factor-1)) +
|
||||
(RSSI_Ave)) /(Rx_Smooth_Factor);
|
||||
UndecoratedSmoothedOFDM = UndecoratedSmoothedOFDM + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
UndecoratedSmoothedOFDM =
|
||||
( ((UndecoratedSmoothedOFDM)*(Rx_Smooth_Factor-1)) +
|
||||
(RSSI_Ave)) /(Rx_Smooth_Factor);
|
||||
}
|
||||
}
|
||||
|
||||
pEntry->rssi_stat.PacketMap = (pEntry->rssi_stat.PacketMap<<1) | BIT0;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
RSSI_Ave = pPhyInfo->RxPWDBAll;
|
||||
pDM_Odm->RSSI_A = (u8) pPhyInfo->RxPWDBAll;
|
||||
pDM_Odm->RSSI_B = 0xFF;
|
||||
|
||||
/* 1 Process CCK RSSI */
|
||||
if (UndecoratedSmoothedCCK <= 0) /* initialize */
|
||||
{
|
||||
UndecoratedSmoothedCCK = pPhyInfo->RxPWDBAll;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pPhyInfo->RxPWDBAll > (u32)UndecoratedSmoothedCCK)
|
||||
{
|
||||
UndecoratedSmoothedCCK =
|
||||
( ((UndecoratedSmoothedCCK)*(Rx_Smooth_Factor-1)) +
|
||||
(pPhyInfo->RxPWDBAll)) /(Rx_Smooth_Factor);
|
||||
UndecoratedSmoothedCCK = UndecoratedSmoothedCCK + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
UndecoratedSmoothedCCK =
|
||||
( ((UndecoratedSmoothedCCK)*(Rx_Smooth_Factor-1)) +
|
||||
(pPhyInfo->RxPWDBAll)) /(Rx_Smooth_Factor);
|
||||
}
|
||||
}
|
||||
pEntry->rssi_stat.PacketMap = pEntry->rssi_stat.PacketMap<<1;
|
||||
}
|
||||
|
||||
/* if (pEntry) */
|
||||
{
|
||||
/* 2011.07.28 LukeLee: modified to prevent unstable CCK RSSI */
|
||||
if (pEntry->rssi_stat.ValidBit >= 64)
|
||||
pEntry->rssi_stat.ValidBit = 64;
|
||||
else
|
||||
pEntry->rssi_stat.ValidBit++;
|
||||
|
||||
for (i=0; i<pEntry->rssi_stat.ValidBit; i++)
|
||||
OFDM_pkt += (u8)(pEntry->rssi_stat.PacketMap>>i)&BIT0;
|
||||
|
||||
if (pEntry->rssi_stat.ValidBit == 64)
|
||||
{
|
||||
Weighting = ((OFDM_pkt<<4) > 64)?64:(OFDM_pkt<<4);
|
||||
UndecoratedSmoothedPWDB = (Weighting*UndecoratedSmoothedOFDM+(64-Weighting)*UndecoratedSmoothedCCK)>>6;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pEntry->rssi_stat.ValidBit != 0)
|
||||
UndecoratedSmoothedPWDB = (OFDM_pkt*UndecoratedSmoothedOFDM+(pEntry->rssi_stat.ValidBit-OFDM_pkt)*UndecoratedSmoothedCCK)/pEntry->rssi_stat.ValidBit;
|
||||
else
|
||||
UndecoratedSmoothedPWDB = 0;
|
||||
}
|
||||
|
||||
pEntry->rssi_stat.UndecoratedSmoothedCCK = UndecoratedSmoothedCCK;
|
||||
pEntry->rssi_stat.UndecoratedSmoothedOFDM = UndecoratedSmoothedOFDM;
|
||||
pEntry->rssi_stat.UndecoratedSmoothedPWDB = UndecoratedSmoothedPWDB;
|
||||
|
||||
/* DbgPrint("OFDM_pkt=%d, Weighting=%d\n", OFDM_pkt, Weighting); */
|
||||
/* DbgPrint("UndecoratedSmoothedOFDM=%d, UndecoratedSmoothedPWDB=%d, UndecoratedSmoothedCCK=%d\n", */
|
||||
/* UndecoratedSmoothedOFDM, UndecoratedSmoothedPWDB, UndecoratedSmoothedCCK); */
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/* */
|
||||
/* Endianness before calling this API */
|
||||
/* */
|
||||
static void
|
||||
ODM_PhyStatusQuery_92CSeries(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
PODM_PHY_INFO_T pPhyInfo,
|
||||
u8 * pPhyStatus,
|
||||
PODM_PACKET_INFO_T pPktinfo
|
||||
)
|
||||
{
|
||||
|
||||
odm_RxPhyStatus92CSeries_Parsing(
|
||||
pDM_Odm,
|
||||
pPhyInfo,
|
||||
pPhyStatus,
|
||||
pPktinfo);
|
||||
|
||||
if ( pDM_Odm->RSSI_test == true) {
|
||||
/* Select the packets to do RSSI checking for antenna switching. */
|
||||
if (pPktinfo->bPacketToSelf || pPktinfo->bPacketBeacon )
|
||||
ODM_SwAntDivChkPerPktRssi(pDM_Odm,pPktinfo->StationID,pPhyInfo);
|
||||
} else {
|
||||
odm_Process_RSSIForDM(pDM_Odm,pPhyInfo,pPktinfo);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* */
|
||||
/* Endianness before calling this API */
|
||||
/* */
|
||||
static void
|
||||
ODM_PhyStatusQuery_JaguarSeries(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
PODM_PHY_INFO_T pPhyInfo,
|
||||
u8 * pPhyStatus,
|
||||
PODM_PACKET_INFO_T pPktinfo
|
||||
)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
ODM_PhyStatusQuery(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
PODM_PHY_INFO_T pPhyInfo,
|
||||
u8 * pPhyStatus,
|
||||
PODM_PACKET_INFO_T pPktinfo
|
||||
)
|
||||
{
|
||||
ODM_PhyStatusQuery_92CSeries(pDM_Odm,pPhyInfo,pPhyStatus,pPktinfo);
|
||||
}
|
||||
|
||||
/* For future use. */
|
||||
void
|
||||
ODM_MacStatusQuery(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
u8 * pMacStatus,
|
||||
u8 MacID,
|
||||
bool bPacketMatchBSSID,
|
||||
bool bPacketToSelf,
|
||||
bool bPacketBeacon
|
||||
)
|
||||
{
|
||||
/* 2011/10/19 Driver team will handle in the future. */
|
||||
|
||||
}
|
||||
|
||||
HAL_STATUS
|
||||
ODM_ConfigRFWithHeaderFile(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
enum rf_radio_path Content,
|
||||
enum rf_radio_path eRFPath
|
||||
)
|
||||
{
|
||||
/* RT_STATUS rtStatus = RT_STATUS_SUCCESS; */
|
||||
|
||||
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, ("===>ODM_ConfigRFWithHeaderFile\n"));
|
||||
if (pDM_Odm->SupportICType == ODM_RTL8188E)
|
||||
{
|
||||
if (IS_VENDOR_8188E_I_CUT_SERIES(pDM_Odm->Adapter))
|
||||
READ_AND_CONFIG(8188E,_RadioA_1T_ICUT_);
|
||||
else
|
||||
READ_AND_CONFIG(8188E,_RadioA_1T_);
|
||||
|
||||
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, (" ===> ODM_ConfigRFWithHeaderFile() Radio_A:Rtl8188ERadioA_1TArray\n"));
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, (" ===> ODM_ConfigRFWithHeaderFile() Radio_B:Rtl8188ERadioB_1TArray\n"));
|
||||
}
|
||||
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("ODM_ConfigRFWithHeaderFile: Radio No %x\n", eRFPath));
|
||||
return HAL_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
HAL_STATUS
|
||||
ODM_ConfigBBWithHeaderFile(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
ODM_BB_Config_Type ConfigType
|
||||
)
|
||||
{
|
||||
if (pDM_Odm->SupportICType == ODM_RTL8188E) {
|
||||
if (ConfigType == CONFIG_BB_PHY_REG) {
|
||||
if (IS_VENDOR_8188E_I_CUT_SERIES(pDM_Odm->Adapter))
|
||||
READ_AND_CONFIG(8188E,_PHY_REG_1T_ICUT_);
|
||||
else
|
||||
READ_AND_CONFIG(8188E,_PHY_REG_1T_);
|
||||
} else if (ConfigType == CONFIG_BB_AGC_TAB) {
|
||||
if (IS_VENDOR_8188E_I_CUT_SERIES(pDM_Odm->Adapter))
|
||||
READ_AND_CONFIG(8188E,_AGC_TAB_1T_ICUT_);
|
||||
else
|
||||
READ_AND_CONFIG(8188E,_AGC_TAB_1T_);
|
||||
} else if (ConfigType == CONFIG_BB_PHY_REG_PG) {
|
||||
READ_AND_CONFIG(8188E,_PHY_REG_PG_);
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_INIT, ODM_DBG_LOUD, (" ===> phy_ConfigBBWithHeaderFile() agc:Rtl8188EPHY_REG_PGArray\n"));
|
||||
}
|
||||
}
|
||||
return HAL_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
HAL_STATUS
|
||||
ODM_ConfigMACWithHeaderFile(
|
||||
PDM_ODM_T pDM_Odm
|
||||
)
|
||||
{
|
||||
u8 result = HAL_STATUS_SUCCESS;
|
||||
if (pDM_Odm->SupportICType == ODM_RTL8188E) {
|
||||
if (IS_VENDOR_8188E_I_CUT_SERIES(pDM_Odm->Adapter))
|
||||
READ_AND_CONFIG(8188E,_MAC_REG_ICUT_);
|
||||
else
|
||||
result =READ_AND_CONFIG(8188E,_MAC_REG_);
|
||||
}
|
||||
return result;
|
||||
}
|
|
@ -1,191 +0,0 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* 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__
|
||||
|
||||
#include "Hal8188EPhyCfg.h"
|
||||
|
||||
/* Definition */
|
||||
|
||||
/* CCK Rates, TxHT = 0 */
|
||||
#define DESC92C_RATE1M 0x00
|
||||
#define DESC92C_RATE2M 0x01
|
||||
#define DESC92C_RATE5_5M 0x02
|
||||
#define DESC92C_RATE11M 0x03
|
||||
|
||||
/* OFDM Rates, TxHT = 0 */
|
||||
#define DESC92C_RATE6M 0x04
|
||||
#define DESC92C_RATE9M 0x05
|
||||
#define DESC92C_RATE12M 0x06
|
||||
#define DESC92C_RATE18M 0x07
|
||||
#define DESC92C_RATE24M 0x08
|
||||
#define DESC92C_RATE36M 0x09
|
||||
#define DESC92C_RATE48M 0x0a
|
||||
#define DESC92C_RATE54M 0x0b
|
||||
|
||||
/* MCS Rates, TxHT = 1 */
|
||||
#define DESC92C_RATEMCS0 0x0c
|
||||
#define DESC92C_RATEMCS1 0x0d
|
||||
#define DESC92C_RATEMCS2 0x0e
|
||||
#define DESC92C_RATEMCS3 0x0f
|
||||
#define DESC92C_RATEMCS4 0x10
|
||||
#define DESC92C_RATEMCS5 0x11
|
||||
#define DESC92C_RATEMCS6 0x12
|
||||
#define DESC92C_RATEMCS7 0x13
|
||||
#define DESC92C_RATEMCS8 0x14
|
||||
#define DESC92C_RATEMCS9 0x15
|
||||
#define DESC92C_RATEMCS10 0x16
|
||||
#define DESC92C_RATEMCS11 0x17
|
||||
#define DESC92C_RATEMCS12 0x18
|
||||
#define DESC92C_RATEMCS13 0x19
|
||||
#define DESC92C_RATEMCS14 0x1a
|
||||
#define DESC92C_RATEMCS15 0x1b
|
||||
#define DESC92C_RATEMCS15_SG 0x1c
|
||||
#define DESC92C_RATEMCS32 0x20
|
||||
|
||||
|
||||
/* */
|
||||
/* structure and define */
|
||||
/* */
|
||||
|
||||
typedef struct _Phy_Rx_AGC_Info
|
||||
{
|
||||
#ifdef __LITTLE_ENDIAN
|
||||
u8 gain:7,trsw:1;
|
||||
#else
|
||||
u8 trsw:1,gain:7;
|
||||
#endif
|
||||
} PHY_RX_AGC_INFO_T,*pPHY_RX_AGC_INFO_T;
|
||||
|
||||
typedef struct _Phy_Status_Rpt_8192cd
|
||||
{
|
||||
PHY_RX_AGC_INFO_T path_agc[2];
|
||||
u8 ch_corr[2];
|
||||
u8 cck_sig_qual_ofdm_pwdb_all;
|
||||
u8 cck_agc_rpt_ofdm_cfosho_a;
|
||||
u8 cck_rpt_b_ofdm_cfosho_b;
|
||||
u8 rsvd_1;/* ch_corr_msb; */
|
||||
u8 noise_power_db_msb;
|
||||
u8 path_cfotail[2];
|
||||
u8 pcts_mask[2];
|
||||
s8 stream_rxevm[2];
|
||||
u8 path_rxsnr[2];
|
||||
u8 noise_power_db_lsb;
|
||||
u8 rsvd_2[3];
|
||||
u8 stream_csi[2];
|
||||
u8 stream_target_csi[2];
|
||||
s8 sig_evm;
|
||||
u8 rsvd_3;
|
||||
|
||||
#ifdef __LITTLE_ENDIAN
|
||||
u8 antsel_rx_keep_2:1; /* ex_intf_flg:1; */
|
||||
u8 sgi_en:1;
|
||||
u8 rxsc:2;
|
||||
u8 idle_long:1;
|
||||
u8 r_ant_train_en:1;
|
||||
u8 ant_sel_b:1;
|
||||
u8 ant_sel:1;
|
||||
#else /* _BIG_ENDIAN_ */
|
||||
u8 ant_sel:1;
|
||||
u8 ant_sel_b:1;
|
||||
u8 r_ant_train_en:1;
|
||||
u8 idle_long:1;
|
||||
u8 rxsc:2;
|
||||
u8 sgi_en:1;
|
||||
u8 antsel_rx_keep_2:1; /* ex_intf_flg:1; */
|
||||
#endif
|
||||
} PHY_STATUS_RPT_8192CD_T,*PPHY_STATUS_RPT_8192CD_T;
|
||||
|
||||
|
||||
typedef struct _Phy_Status_Rpt_8195
|
||||
{
|
||||
PHY_RX_AGC_INFO_T path_agc[2];
|
||||
u8 ch_num[2];
|
||||
u8 cck_sig_qual_ofdm_pwdb_all;
|
||||
u8 cck_agc_rpt_ofdm_cfosho_a;
|
||||
u8 cck_bb_pwr_ofdm_cfosho_b;
|
||||
u8 cck_rx_path; /* CCK_RX_PATH [3:0] (with regA07[3:0] definition) */
|
||||
u8 rsvd_1;
|
||||
u8 path_cfotail[2];
|
||||
u8 pcts_mask[2];
|
||||
s8 stream_rxevm[2];
|
||||
u8 path_rxsnr[2];
|
||||
u8 rsvd_2[2];
|
||||
u8 stream_snr[2];
|
||||
u8 stream_csi[2];
|
||||
u8 rsvd_3[2];
|
||||
s8 sig_evm;
|
||||
u8 rsvd_4;
|
||||
#ifdef __LITTLE_ENDIAN
|
||||
u8 antidx_anta:3;
|
||||
u8 antidx_antb:3;
|
||||
u8 rsvd_5:2;
|
||||
#else /* _BIG_ENDIAN_ */
|
||||
u8 rsvd_5:2;
|
||||
u8 antidx_antb:3;
|
||||
u8 antidx_anta:3;
|
||||
#endif
|
||||
} PHY_STATUS_RPT_8195_T,*pPHY_STATUS_RPT_8195_T;
|
||||
|
||||
|
||||
void
|
||||
odm_Init_RSSIForDM(
|
||||
PDM_ODM_T pDM_Odm
|
||||
);
|
||||
|
||||
void
|
||||
ODM_PhyStatusQuery(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
PODM_PHY_INFO_T pPhyInfo,
|
||||
u8 * pPhyStatus,
|
||||
PODM_PACKET_INFO_T pPktinfo
|
||||
);
|
||||
|
||||
void
|
||||
ODM_MacStatusQuery(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
u8 * pMacStatus,
|
||||
u8 MacID,
|
||||
bool bPacketMatchBSSID,
|
||||
bool bPacketToSelf,
|
||||
bool bPacketBeacon
|
||||
);
|
||||
HAL_STATUS
|
||||
ODM_ConfigRFWithHeaderFile(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
enum rf_radio_path Content,
|
||||
enum rf_radio_path eRFPath
|
||||
);
|
||||
|
||||
HAL_STATUS
|
||||
ODM_ConfigBBWithHeaderFile(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
ODM_BB_Config_Type ConfigType
|
||||
);
|
||||
|
||||
HAL_STATUS
|
||||
ODM_ConfigMACWithHeaderFile(
|
||||
PDM_ODM_T pDM_Odm
|
||||
);
|
||||
|
||||
|
||||
#endif
|
|
@ -1,549 +0,0 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* 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 "odm_precomp.h"
|
||||
|
||||
void
|
||||
ODM_DIG_LowerBound_88E(
|
||||
PDM_ODM_T pDM_Odm
|
||||
)
|
||||
{
|
||||
pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable;
|
||||
|
||||
if (pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV)
|
||||
{
|
||||
pDM_DigTable->rx_gain_range_min = (u8) pDM_DigTable->AntDiv_RSSI_max;
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("ODM_DIG_LowerBound_88E(): pDM_DigTable->AntDiv_RSSI_max=%d\n",pDM_DigTable->AntDiv_RSSI_max));
|
||||
}
|
||||
/* If only one Entry connected */
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
odm_RX_HWAntDivInit(
|
||||
PDM_ODM_T pDM_Odm
|
||||
)
|
||||
{
|
||||
u32 value32;
|
||||
struct adapter * Adapter = pDM_Odm->Adapter;
|
||||
#if (MP_DRIVER == 1)
|
||||
if (*(pDM_Odm->mp_mode) == 1)
|
||||
{
|
||||
pDM_Odm->AntDivType = CGCS_RX_SW_ANTDIV;
|
||||
ODM_SetBBReg(pDM_Odm, ODM_REG_IGI_A_11N , BIT7, 0); /* disable HW AntDiv */
|
||||
ODM_SetBBReg(pDM_Odm, ODM_REG_LNA_SWITCH_11N , BIT31, 1); /* 1:CG, 0:CS */
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("odm_RX_HWAntDivInit()\n"));
|
||||
|
||||
/* MAC Setting */
|
||||
value32 = ODM_GetMACReg(pDM_Odm, ODM_REG_ANTSEL_PIN_11N, bMaskDWord);
|
||||
ODM_SetMACReg(pDM_Odm, ODM_REG_ANTSEL_PIN_11N, bMaskDWord, value32|(BIT23|BIT25)); /* Reg4C[25]=1, Reg4C[23]=1 for pin output */
|
||||
/* Pin Settings */
|
||||
ODM_SetBBReg(pDM_Odm, ODM_REG_PIN_CTRL_11N , BIT9|BIT8, 0);/* Reg870[8]=1'b0, Reg870[9]=1'b0antsel antselb by HW */
|
||||
ODM_SetBBReg(pDM_Odm, ODM_REG_RX_ANT_CTRL_11N , BIT10, 0); /* Reg864[10]=1'b0 antsel2 by HW */
|
||||
ODM_SetBBReg(pDM_Odm, ODM_REG_LNA_SWITCH_11N , BIT22, 1); /* Regb2c[22]=1'b0 disable CS/CG switch */
|
||||
ODM_SetBBReg(pDM_Odm, ODM_REG_LNA_SWITCH_11N , BIT31, 1); /* Regb2c[31]=1'b1 output at CG only */
|
||||
/* OFDM Settings */
|
||||
ODM_SetBBReg(pDM_Odm, ODM_REG_ANTDIV_PARA1_11N , bMaskDWord, 0x000000a0);
|
||||
/* CCK Settings */
|
||||
ODM_SetBBReg(pDM_Odm, ODM_REG_BB_PWR_SAV4_11N , BIT7, 1); /* Fix CCK PHY status report issue */
|
||||
ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_ANTDIV_PARA2_11N , BIT4, 1); /* CCK complete HW AntDiv within 64 samples */
|
||||
ODM_UpdateRxIdleAnt_88E(pDM_Odm, MAIN_ANT);
|
||||
ODM_SetBBReg(pDM_Odm, ODM_REG_ANT_MAPPING1_11N , 0xFFFF, 0x0201); /* antenna mapping table */
|
||||
|
||||
/* ODM_SetBBReg(pDM_Odm, 0xc50 , BIT7, 1); Enable HW AntDiv */
|
||||
/* ODM_SetBBReg(pDM_Odm, 0xa00 , BIT15, 1); Enable CCK AntDiv */
|
||||
}
|
||||
|
||||
static void
|
||||
odm_TRX_HWAntDivInit(
|
||||
PDM_ODM_T pDM_Odm
|
||||
)
|
||||
{
|
||||
u32 value32;
|
||||
struct adapter * Adapter = pDM_Odm->Adapter;
|
||||
|
||||
#if (MP_DRIVER == 1)
|
||||
if (*(pDM_Odm->mp_mode) == 1)
|
||||
{
|
||||
pDM_Odm->AntDivType = CGCS_RX_SW_ANTDIV;
|
||||
ODM_SetBBReg(pDM_Odm, ODM_REG_IGI_A_11N , BIT7, 0); /* disable HW AntDiv */
|
||||
ODM_SetBBReg(pDM_Odm, ODM_REG_RX_ANT_CTRL_11N , BIT5|BIT4|BIT3, 0); /* Default RX (0/1) */
|
||||
return;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("odm_TRX_HWAntDivInit()\n"));
|
||||
|
||||
/* MAC Setting */
|
||||
value32 = ODM_GetMACReg(pDM_Odm, ODM_REG_ANTSEL_PIN_11N, bMaskDWord);
|
||||
ODM_SetMACReg(pDM_Odm, ODM_REG_ANTSEL_PIN_11N, bMaskDWord, value32|(BIT23|BIT25)); /* Reg4C[25]=1, Reg4C[23]=1 for pin output */
|
||||
/* Pin Settings */
|
||||
ODM_SetBBReg(pDM_Odm, ODM_REG_PIN_CTRL_11N , BIT9|BIT8, 0);/* Reg870[8]=1'b0, Reg870[9]=1'b0 antsel antselb by HW */
|
||||
ODM_SetBBReg(pDM_Odm, ODM_REG_RX_ANT_CTRL_11N , BIT10, 0); /* Reg864[10]=1'b0 antsel2 by HW */
|
||||
ODM_SetBBReg(pDM_Odm, ODM_REG_LNA_SWITCH_11N , BIT22, 0); /* Regb2c[22]=1'b0 disable CS/CG switch */
|
||||
ODM_SetBBReg(pDM_Odm, ODM_REG_LNA_SWITCH_11N , BIT31, 1); /* Regb2c[31]=1'b1 output at CG only */
|
||||
/* OFDM Settings */
|
||||
ODM_SetBBReg(pDM_Odm, ODM_REG_ANTDIV_PARA1_11N , bMaskDWord, 0x000000a0);
|
||||
/* CCK Settings */
|
||||
ODM_SetBBReg(pDM_Odm, ODM_REG_BB_PWR_SAV4_11N , BIT7, 1); /* Fix CCK PHY status report issue */
|
||||
ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_ANTDIV_PARA2_11N , BIT4, 1); /* CCK complete HW AntDiv within 64 samples */
|
||||
/* Tx Settings */
|
||||
ODM_SetBBReg(pDM_Odm, ODM_REG_TX_ANT_CTRL_11N , BIT21, 0); /* Reg80c[21]=1'b0 from TX Reg */
|
||||
ODM_UpdateRxIdleAnt_88E(pDM_Odm, MAIN_ANT);
|
||||
|
||||
/* antenna mapping table */
|
||||
if (!pDM_Odm->bIsMPChip) /* testchip */
|
||||
{
|
||||
ODM_SetBBReg(pDM_Odm, ODM_REG_RX_DEFUALT_A_11N , BIT10|BIT9|BIT8, 1); /* Reg858[10:8]=3'b001 */
|
||||
ODM_SetBBReg(pDM_Odm, ODM_REG_RX_DEFUALT_A_11N , BIT13|BIT12|BIT11, 2); /* Reg858[13:11]=3'b010 */
|
||||
}
|
||||
else /* MPchip */
|
||||
ODM_SetBBReg(pDM_Odm, ODM_REG_ANT_MAPPING1_11N , bMaskDWord, 0x0201); /* Reg914=3'b010, Reg915=3'b001 */
|
||||
|
||||
/* ODM_SetBBReg(pDM_Odm, 0xc50 , BIT7, 1); Enable HW AntDiv */
|
||||
/* ODM_SetBBReg(pDM_Odm, 0xa00 , BIT15, 1); Enable CCK AntDiv */
|
||||
}
|
||||
|
||||
void
|
||||
odm_FastAntTrainingInit(
|
||||
PDM_ODM_T pDM_Odm
|
||||
)
|
||||
{
|
||||
u32 value32, i;
|
||||
pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable;
|
||||
u32 AntCombination = 2;
|
||||
struct adapter * Adapter = pDM_Odm->Adapter;
|
||||
|
||||
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("odm_FastAntTrainingInit()\n"));
|
||||
|
||||
#if (MP_DRIVER == 1)
|
||||
if (*(pDM_Odm->mp_mode) == 1) {
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, ("pDM_Odm->AntDivType: %d\n", pDM_Odm->AntDivType));
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
for (i=0; i<6; i++) {
|
||||
pDM_FatTable->Bssid[i] = 0;
|
||||
pDM_FatTable->antSumRSSI[i] = 0;
|
||||
pDM_FatTable->antRSSIcnt[i] = 0;
|
||||
pDM_FatTable->antAveRSSI[i] = 0;
|
||||
}
|
||||
pDM_FatTable->TrainIdx = 0;
|
||||
pDM_FatTable->FAT_State = FAT_NORMAL_STATE;
|
||||
|
||||
/* MAC Setting */
|
||||
value32 = ODM_GetMACReg(pDM_Odm, 0x4c, bMaskDWord);
|
||||
ODM_SetMACReg(pDM_Odm, 0x4c, bMaskDWord, value32|(BIT23|BIT25)); /* Reg4C[25]=1, Reg4C[23]=1 for pin output */
|
||||
value32 = ODM_GetMACReg(pDM_Odm, 0x7B4, bMaskDWord);
|
||||
ODM_SetMACReg(pDM_Odm, 0x7b4, bMaskDWord, value32|(BIT16|BIT17)); /* Reg7B4[16]=1 enable antenna training, Reg7B4[17]=1 enable A2 match */
|
||||
/* value32 = PlatformEFIORead4Byte(Adapter, 0x7B4); */
|
||||
/* PlatformEFIOWrite4Byte(Adapter, 0x7b4, value32|BIT18); append MACID in reponse packet */
|
||||
|
||||
/* Match MAC ADDR */
|
||||
ODM_SetMACReg(pDM_Odm, 0x7b4, 0xFFFF, 0);
|
||||
ODM_SetMACReg(pDM_Odm, 0x7b0, bMaskDWord, 0);
|
||||
|
||||
ODM_SetBBReg(pDM_Odm, 0x870 , BIT9|BIT8, 0);/* Reg870[8]=1'b0, Reg870[9]=1'b0 antsel antselb by HW */
|
||||
ODM_SetBBReg(pDM_Odm, 0x864 , BIT10, 0); /* Reg864[10]=1'b0 antsel2 by HW */
|
||||
ODM_SetBBReg(pDM_Odm, 0xb2c , BIT22, 0); /* Regb2c[22]=1'b0 disable CS/CG switch */
|
||||
ODM_SetBBReg(pDM_Odm, 0xb2c , BIT31, 1); /* Regb2c[31]=1'b1 output at CG only */
|
||||
ODM_SetBBReg(pDM_Odm, 0xca4 , bMaskDWord, 0x000000a0);
|
||||
|
||||
/* antenna mapping table */
|
||||
if (AntCombination == 2)
|
||||
{
|
||||
if (!pDM_Odm->bIsMPChip) /* testchip */
|
||||
{
|
||||
ODM_SetBBReg(pDM_Odm, 0x858 , BIT10|BIT9|BIT8, 1); /* Reg858[10:8]=3'b001 */
|
||||
ODM_SetBBReg(pDM_Odm, 0x858 , BIT13|BIT12|BIT11, 2); /* Reg858[13:11]=3'b010 */
|
||||
}
|
||||
else /* MPchip */
|
||||
{
|
||||
ODM_SetBBReg(pDM_Odm, 0x914 , bMaskByte0, 1);
|
||||
ODM_SetBBReg(pDM_Odm, 0x914 , bMaskByte1, 2);
|
||||
}
|
||||
}
|
||||
else if (AntCombination == 7)
|
||||
{
|
||||
if (!pDM_Odm->bIsMPChip) /* testchip */
|
||||
{
|
||||
ODM_SetBBReg(pDM_Odm, 0x858 , BIT10|BIT9|BIT8, 0); /* Reg858[10:8]=3'b000 */
|
||||
ODM_SetBBReg(pDM_Odm, 0x858 , BIT13|BIT12|BIT11, 1); /* Reg858[13:11]=3'b001 */
|
||||
ODM_SetBBReg(pDM_Odm, 0x878 , BIT16, 0);
|
||||
ODM_SetBBReg(pDM_Odm, 0x858 , BIT15|BIT14, 2); /* Reg878[0],Reg858[14:15])=3'b010 */
|
||||
ODM_SetBBReg(pDM_Odm, 0x878 , BIT19|BIT18|BIT17, 3);/* Reg878[3:1]=3b'011 */
|
||||
ODM_SetBBReg(pDM_Odm, 0x878 , BIT22|BIT21|BIT20, 4);/* Reg878[6:4]=3b'100 */
|
||||
ODM_SetBBReg(pDM_Odm, 0x878 , BIT25|BIT24|BIT23, 5);/* Reg878[9:7]=3b'101 */
|
||||
ODM_SetBBReg(pDM_Odm, 0x878 , BIT28|BIT27|BIT26, 6);/* Reg878[12:10]=3b'110 */
|
||||
ODM_SetBBReg(pDM_Odm, 0x878 , BIT31|BIT30|BIT29, 7);/* Reg878[15:13]=3b'111 */
|
||||
}
|
||||
else /* MPchip */
|
||||
{
|
||||
ODM_SetBBReg(pDM_Odm, 0x914 , bMaskByte0, 0);
|
||||
ODM_SetBBReg(pDM_Odm, 0x914 , bMaskByte1, 1);
|
||||
ODM_SetBBReg(pDM_Odm, 0x914 , bMaskByte2, 2);
|
||||
ODM_SetBBReg(pDM_Odm, 0x914 , bMaskByte3, 3);
|
||||
ODM_SetBBReg(pDM_Odm, 0x918 , bMaskByte0, 4);
|
||||
ODM_SetBBReg(pDM_Odm, 0x918 , bMaskByte1, 5);
|
||||
ODM_SetBBReg(pDM_Odm, 0x918 , bMaskByte2, 6);
|
||||
ODM_SetBBReg(pDM_Odm, 0x918 , bMaskByte3, 7);
|
||||
}
|
||||
}
|
||||
|
||||
/* Default Ant Setting when no fast training */
|
||||
ODM_SetBBReg(pDM_Odm, 0x80c , BIT21, 1); /* Reg80c[21]=1'b1 from TX Info */
|
||||
ODM_SetBBReg(pDM_Odm, 0x864 , BIT5|BIT4|BIT3, 0); /* Default RX */
|
||||
ODM_SetBBReg(pDM_Odm, 0x864 , BIT8|BIT7|BIT6, 1); /* Optional RX */
|
||||
|
||||
/* Enter Traing state */
|
||||
ODM_SetBBReg(pDM_Odm, 0x864 , BIT2|BIT1|BIT0, (AntCombination-1)); /* Reg864[2:0]=3'd6 ant combination=reg864[2:0]+1 */
|
||||
ODM_SetBBReg(pDM_Odm, 0xc50 , BIT7, 1); /* RegC50[7]=1'b1 enable HW AntDiv */
|
||||
|
||||
/* SW Control */
|
||||
/* PHY_SetBBReg(Adapter, 0x864 , BIT10, 1); */
|
||||
/* PHY_SetBBReg(Adapter, 0x870 , BIT9, 1); */
|
||||
/* PHY_SetBBReg(Adapter, 0x870 , BIT8, 1); */
|
||||
/* PHY_SetBBReg(Adapter, 0x864 , BIT11, 1); */
|
||||
/* PHY_SetBBReg(Adapter, 0x860 , BIT9, 0); */
|
||||
/* PHY_SetBBReg(Adapter, 0x860 , BIT8, 0); */
|
||||
}
|
||||
|
||||
void
|
||||
ODM_AntennaDiversityInit_88E(
|
||||
PDM_ODM_T pDM_Odm
|
||||
)
|
||||
{
|
||||
if (pDM_Odm->SupportICType != ODM_RTL8188E)
|
||||
return;
|
||||
|
||||
/* ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("pDM_Odm->AntDivType=%d, pHalData->AntDivCfg=%d\n", */
|
||||
/* pDM_Odm->AntDivType, pHalData->AntDivCfg)); */
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("pDM_Odm->AntDivType=%d\n",pDM_Odm->AntDivType));
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("pDM_Odm->bIsMPChip=%s\n",(pDM_Odm->bIsMPChip?"true":"false")));
|
||||
|
||||
if (pDM_Odm->AntDivType == CGCS_RX_HW_ANTDIV)
|
||||
odm_RX_HWAntDivInit(pDM_Odm);
|
||||
else if (pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV)
|
||||
odm_TRX_HWAntDivInit(pDM_Odm);
|
||||
else if (pDM_Odm->AntDivType == CG_TRX_SMART_ANTDIV)
|
||||
odm_FastAntTrainingInit(pDM_Odm);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ODM_UpdateRxIdleAnt_88E(PDM_ODM_T pDM_Odm, u8 Ant)
|
||||
{
|
||||
pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable;
|
||||
u32 DefaultAnt, OptionalAnt;
|
||||
|
||||
if (pDM_FatTable->RxIdleAnt != Ant)
|
||||
{
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Need to Update Rx Idle Ant\n"));
|
||||
if (Ant == MAIN_ANT)
|
||||
{
|
||||
DefaultAnt = (pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV)?MAIN_ANT_CG_TRX:MAIN_ANT_CGCS_RX;
|
||||
OptionalAnt = (pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV)?AUX_ANT_CG_TRX:AUX_ANT_CGCS_RX;
|
||||
}
|
||||
else
|
||||
{
|
||||
DefaultAnt = (pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV)?AUX_ANT_CG_TRX:AUX_ANT_CGCS_RX;
|
||||
OptionalAnt = (pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV)?MAIN_ANT_CG_TRX:MAIN_ANT_CGCS_RX;
|
||||
}
|
||||
|
||||
if (pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV)
|
||||
{
|
||||
ODM_SetBBReg(pDM_Odm, ODM_REG_RX_ANT_CTRL_11N , BIT5|BIT4|BIT3, DefaultAnt); /* Default RX */
|
||||
ODM_SetBBReg(pDM_Odm, ODM_REG_RX_ANT_CTRL_11N , BIT8|BIT7|BIT6, OptionalAnt); /* Optional RX */
|
||||
ODM_SetBBReg(pDM_Odm, ODM_REG_ANTSEL_CTRL_11N , BIT14|BIT13|BIT12, DefaultAnt); /* Default TX */
|
||||
ODM_SetMACReg(pDM_Odm, ODM_REG_RESP_TX_11N , BIT6|BIT7, DefaultAnt); /* Resp Tx */
|
||||
|
||||
}
|
||||
else if (pDM_Odm->AntDivType == CGCS_RX_HW_ANTDIV)
|
||||
{
|
||||
ODM_SetBBReg(pDM_Odm, ODM_REG_RX_ANT_CTRL_11N , BIT5|BIT4|BIT3, DefaultAnt); /* Default RX */
|
||||
ODM_SetBBReg(pDM_Odm, ODM_REG_RX_ANT_CTRL_11N , BIT8|BIT7|BIT6, OptionalAnt); /* Optional RX */
|
||||
}
|
||||
}
|
||||
pDM_FatTable->RxIdleAnt = Ant;
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("RxIdleAnt=%s\n",(Ant==MAIN_ANT)?"MAIN_ANT":"AUX_ANT"));
|
||||
printk("RxIdleAnt=%s\n",(Ant==MAIN_ANT)?"MAIN_ANT":"AUX_ANT");
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
odm_UpdateTxAnt_88E(PDM_ODM_T pDM_Odm, u8 Ant, u32 MacId)
|
||||
{
|
||||
pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable;
|
||||
u8 TargetAnt;
|
||||
|
||||
if (Ant == MAIN_ANT)
|
||||
TargetAnt = MAIN_ANT_CG_TRX;
|
||||
else
|
||||
TargetAnt = AUX_ANT_CG_TRX;
|
||||
|
||||
pDM_FatTable->antsel_a[MacId] = TargetAnt&BIT0;
|
||||
pDM_FatTable->antsel_b[MacId] = (TargetAnt&BIT1)>>1;
|
||||
pDM_FatTable->antsel_c[MacId] = (TargetAnt&BIT2)>>2;
|
||||
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Tx from TxInfo, TargetAnt=%s\n",
|
||||
(Ant==MAIN_ANT)?"MAIN_ANT":"AUX_ANT"));
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD,("antsel_tr_mux=3'b%d%d%d\n",
|
||||
pDM_FatTable->antsel_c[MacId] , pDM_FatTable->antsel_b[MacId] , pDM_FatTable->antsel_a[MacId] ));
|
||||
}
|
||||
|
||||
void
|
||||
ODM_SetTxAntByTxInfo_88E(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
u8 * pDesc,
|
||||
u8 macId
|
||||
)
|
||||
{
|
||||
pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable;
|
||||
|
||||
if ((pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV)||(pDM_Odm->AntDivType == CG_TRX_SMART_ANTDIV))
|
||||
{
|
||||
SET_TX_DESC_ANTSEL_A_88E(pDesc, pDM_FatTable->antsel_a[macId]);
|
||||
SET_TX_DESC_ANTSEL_B_88E(pDesc, pDM_FatTable->antsel_b[macId]);
|
||||
SET_TX_DESC_ANTSEL_C_88E(pDesc, pDM_FatTable->antsel_c[macId]);
|
||||
/* ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("ODM_SetTxAntByTxInfo_88E_WIN(): MacID=%d, antsel_tr_mux=3'b%d%d%d\n", */
|
||||
/* macId, pDM_FatTable->antsel_c[macId], pDM_FatTable->antsel_b[macId], pDM_FatTable->antsel_a[macId])); */
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ODM_AntselStatistics_88E(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
u8 antsel_tr_mux,
|
||||
u32 MacId,
|
||||
u8 RxPWDBAll
|
||||
)
|
||||
{
|
||||
pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable;
|
||||
if (pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV)
|
||||
{
|
||||
if (antsel_tr_mux == MAIN_ANT_CG_TRX)
|
||||
{
|
||||
|
||||
pDM_FatTable->MainAnt_Sum[MacId]+=RxPWDBAll;
|
||||
pDM_FatTable->MainAnt_Cnt[MacId]++;
|
||||
}
|
||||
else
|
||||
{
|
||||
pDM_FatTable->AuxAnt_Sum[MacId]+=RxPWDBAll;
|
||||
pDM_FatTable->AuxAnt_Cnt[MacId]++;
|
||||
|
||||
}
|
||||
}
|
||||
else if (pDM_Odm->AntDivType == CGCS_RX_HW_ANTDIV)
|
||||
{
|
||||
if (antsel_tr_mux == MAIN_ANT_CGCS_RX)
|
||||
{
|
||||
|
||||
pDM_FatTable->MainAnt_Sum[MacId]+=RxPWDBAll;
|
||||
pDM_FatTable->MainAnt_Cnt[MacId]++;
|
||||
}
|
||||
else
|
||||
{
|
||||
pDM_FatTable->AuxAnt_Sum[MacId]+=RxPWDBAll;
|
||||
pDM_FatTable->AuxAnt_Cnt[MacId]++;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define TX_BY_REG 0
|
||||
static void
|
||||
odm_HWAntDiv(
|
||||
PDM_ODM_T pDM_Odm
|
||||
)
|
||||
{
|
||||
u32 i, MinRSSI=0xFF, AntDivMaxRSSI=0, MaxRSSI=0, LocalMinRSSI, LocalMaxRSSI;
|
||||
u32 Main_RSSI, Aux_RSSI;
|
||||
u8 RxIdleAnt=0, TargetAnt=7;
|
||||
pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable;
|
||||
pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable;
|
||||
bool bMatchBSSID;
|
||||
bool bPktFilterMacth = false;
|
||||
PSTA_INFO_T pEntry;
|
||||
|
||||
for (i=0; i<ODM_ASSOCIATE_ENTRY_NUM; i++)
|
||||
{
|
||||
pEntry = pDM_Odm->pODM_StaInfo[i];
|
||||
if (IS_STA_VALID(pEntry))
|
||||
{
|
||||
/* 2 Caculate RSSI per Antenna */
|
||||
Main_RSSI = (pDM_FatTable->MainAnt_Cnt[i]!=0)?(pDM_FatTable->MainAnt_Sum[i]/pDM_FatTable->MainAnt_Cnt[i]):0;
|
||||
Aux_RSSI = (pDM_FatTable->AuxAnt_Cnt[i]!=0)?(pDM_FatTable->AuxAnt_Sum[i]/pDM_FatTable->AuxAnt_Cnt[i]):0;
|
||||
TargetAnt = (Main_RSSI>=Aux_RSSI)?MAIN_ANT:AUX_ANT;
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("MacID=%d, MainAnt_Sum=%d, MainAnt_Cnt=%d\n", i, pDM_FatTable->MainAnt_Sum[i], pDM_FatTable->MainAnt_Cnt[i]));
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("MacID=%d, AuxAnt_Sum=%d, AuxAnt_Cnt=%d\n",i, pDM_FatTable->AuxAnt_Sum[i], pDM_FatTable->AuxAnt_Cnt[i]));
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("MacID=%d, Main_RSSI= %d, Aux_RSSI= %d\n", i, Main_RSSI, Aux_RSSI));
|
||||
|
||||
/* 2 Select MaxRSSI for DIG */
|
||||
LocalMaxRSSI = (Main_RSSI>Aux_RSSI)?Main_RSSI:Aux_RSSI;
|
||||
if ((LocalMaxRSSI > AntDivMaxRSSI) && (LocalMaxRSSI < 40))
|
||||
AntDivMaxRSSI = LocalMaxRSSI;
|
||||
if (LocalMaxRSSI > MaxRSSI)
|
||||
MaxRSSI = LocalMaxRSSI;
|
||||
|
||||
/* 2 Select RX Idle Antenna */
|
||||
if ((pDM_FatTable->RxIdleAnt == MAIN_ANT) && (Main_RSSI == 0))
|
||||
Main_RSSI = Aux_RSSI;
|
||||
else if ((pDM_FatTable->RxIdleAnt == AUX_ANT) && (Aux_RSSI == 0))
|
||||
Aux_RSSI = Main_RSSI;
|
||||
|
||||
LocalMinRSSI = (Main_RSSI>Aux_RSSI)?Aux_RSSI:Main_RSSI;
|
||||
if (LocalMinRSSI < MinRSSI)
|
||||
{
|
||||
MinRSSI = LocalMinRSSI;
|
||||
RxIdleAnt = TargetAnt;
|
||||
}
|
||||
#if TX_BY_REG
|
||||
|
||||
#else
|
||||
/* 2 Select TRX Antenna */
|
||||
if (pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV)
|
||||
odm_UpdateTxAnt_88E(pDM_Odm, TargetAnt, i);
|
||||
#endif
|
||||
}
|
||||
pDM_FatTable->MainAnt_Sum[i] = 0;
|
||||
pDM_FatTable->AuxAnt_Sum[i] = 0;
|
||||
pDM_FatTable->MainAnt_Cnt[i] = 0;
|
||||
pDM_FatTable->AuxAnt_Cnt[i] = 0;
|
||||
}
|
||||
|
||||
/* 2 Set RX Idle Antenna */
|
||||
ODM_UpdateRxIdleAnt_88E(pDM_Odm, RxIdleAnt);
|
||||
|
||||
pDM_DigTable->AntDiv_RSSI_max = AntDivMaxRSSI;
|
||||
pDM_DigTable->RSSI_max = MaxRSSI;
|
||||
}
|
||||
|
||||
void
|
||||
ODM_AntennaDiversity_88E(
|
||||
PDM_ODM_T pDM_Odm
|
||||
)
|
||||
{
|
||||
pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable;
|
||||
if ((pDM_Odm->SupportICType != ODM_RTL8188E) || (!(pDM_Odm->SupportAbility & ODM_BB_ANT_DIV)))
|
||||
{
|
||||
/* ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("ODM_AntennaDiversity_88E: Not Support 88E AntDiv\n")); */
|
||||
return;
|
||||
}
|
||||
|
||||
if (!pDM_Odm->bLinked)
|
||||
{
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("ODM_AntennaDiversity_88E(): No Link.\n"));
|
||||
if (pDM_FatTable->bBecomeLinked == true)
|
||||
{
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Need to Turn off HW AntDiv\n"));
|
||||
ODM_SetBBReg(pDM_Odm, ODM_REG_IGI_A_11N , BIT7, 0); /* RegC50[7]=1'b1 enable HW AntDiv */
|
||||
ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_ANTDIV_PARA1_11N , BIT15, 0); /* Enable CCK AntDiv */
|
||||
if (pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV)
|
||||
ODM_SetBBReg(pDM_Odm, ODM_REG_TX_ANT_CTRL_11N , BIT21, 0); /* Reg80c[21]=1'b0 from TX Reg */
|
||||
pDM_FatTable->bBecomeLinked = pDM_Odm->bLinked;
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
if (pDM_FatTable->bBecomeLinked ==false) {
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Need to Turn on HW AntDiv\n"));
|
||||
/* Because HW AntDiv is disabled before Link, we enable HW AntDiv after link */
|
||||
ODM_SetBBReg(pDM_Odm, ODM_REG_IGI_A_11N , BIT7, 1); /* RegC50[7]=1'b1 enable HW AntDiv */
|
||||
ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_ANTDIV_PARA1_11N , BIT15, 1); /* Enable CCK AntDiv */
|
||||
if (pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV) {
|
||||
#if TX_BY_REG
|
||||
ODM_SetBBReg(pDM_Odm, ODM_REG_TX_ANT_CTRL_11N , BIT21, 0); /* Reg80c[21]=1'b0 from Reg */
|
||||
#else
|
||||
ODM_SetBBReg(pDM_Odm, ODM_REG_TX_ANT_CTRL_11N , BIT21, 1); /* Reg80c[21]=1'b1 from TX Info */
|
||||
#endif
|
||||
}
|
||||
pDM_FatTable->bBecomeLinked = pDM_Odm->bLinked;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ((pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV)||(pDM_Odm->AntDivType == CGCS_RX_HW_ANTDIV))
|
||||
odm_HWAntDiv(pDM_Odm);
|
||||
}
|
||||
|
||||
/* 3============================================================ */
|
||||
/* 3 Dynamic Primary CCA */
|
||||
/* 3============================================================ */
|
||||
|
||||
void
|
||||
odm_PrimaryCCA_Init(
|
||||
PDM_ODM_T pDM_Odm)
|
||||
{
|
||||
pPri_CCA_T PrimaryCCA = &pDM_Odm->DM_PriCCA;
|
||||
PrimaryCCA->DupRTS_flag = 0;
|
||||
PrimaryCCA->intf_flag = 0;
|
||||
PrimaryCCA->intf_type = 0;
|
||||
PrimaryCCA->Monitor_flag = 0;
|
||||
PrimaryCCA->PriCCA_flag = 0;
|
||||
}
|
||||
|
||||
bool
|
||||
ODM_DynamicPrimaryCCA_DupRTS(
|
||||
PDM_ODM_T pDM_Odm
|
||||
)
|
||||
{
|
||||
pPri_CCA_T PrimaryCCA = &pDM_Odm->DM_PriCCA;
|
||||
|
||||
return PrimaryCCA->DupRTS_flag;
|
||||
}
|
||||
|
||||
void
|
||||
odm_DynamicPrimaryCCA(
|
||||
PDM_ODM_T pDM_Odm
|
||||
)
|
||||
{
|
||||
struct adapter *Adapter = pDM_Odm->Adapter; /* for NIC */
|
||||
prtl8192cd_priv priv = pDM_Odm->priv; /* for AP */
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
|
||||
Pfalse_ALARM_STATISTICS FalseAlmCnt = &pDM_Odm->FalseAlmCnt;
|
||||
pPri_CCA_T PrimaryCCA = &pDM_Odm->DM_PriCCA;
|
||||
bool Is40MHz;
|
||||
bool Client_40MHz = false, Client_tmp = false; /* connected client BW */
|
||||
bool bConnected = false; /* connected or not */
|
||||
static u8 Client_40MHz_pre = 0;
|
||||
static u64 lastTxOkCnt = 0;
|
||||
static u64 lastRxOkCnt = 0;
|
||||
static u32 Counter = 0;
|
||||
static u8 Delay = 1;
|
||||
u64 curTxOkCnt;
|
||||
u64 curRxOkCnt;
|
||||
u8 SecCHOffset;
|
||||
u8 i;
|
||||
|
||||
return;
|
||||
}
|
|
@ -1,185 +0,0 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* 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 "odm_precomp.h"
|
||||
|
||||
void
|
||||
odm_ConfigRFReg_8188E(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
u32 Addr,
|
||||
u32 Data,
|
||||
enum rf_radio_path RF_PATH,
|
||||
u32 RegAddr
|
||||
)
|
||||
{
|
||||
if (Addr == 0xffe)
|
||||
{
|
||||
ODM_sleep_ms(50);
|
||||
}
|
||||
else if (Addr == 0xfd)
|
||||
{
|
||||
ODM_delay_ms(5);
|
||||
}
|
||||
else if (Addr == 0xfc)
|
||||
{
|
||||
ODM_delay_ms(1);
|
||||
}
|
||||
else if (Addr == 0xfb)
|
||||
{
|
||||
ODM_delay_us(50);
|
||||
}
|
||||
else if (Addr == 0xfa)
|
||||
{
|
||||
ODM_delay_us(5);
|
||||
}
|
||||
else if (Addr == 0xf9)
|
||||
{
|
||||
ODM_delay_us(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
ODM_SetRFReg(pDM_Odm, RF_PATH, RegAddr, bRFRegOffsetMask, Data);
|
||||
/* Add 1us delay between BB/RF register setting. */
|
||||
ODM_delay_us(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
odm_ConfigRF_RadioA_8188E(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
u32 Addr,
|
||||
u32 Data
|
||||
)
|
||||
{
|
||||
u32 content = 0x1000; /* RF_Content: radioa_txt */
|
||||
u32 maskforPhySet= (u32)(content&0xE000);
|
||||
|
||||
odm_ConfigRFReg_8188E(pDM_Odm, Addr, Data, RF_PATH_A, Addr|maskforPhySet);
|
||||
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ConfigRFWithHeaderFile: [RadioA] %08X %08X\n", Addr, Data));
|
||||
}
|
||||
|
||||
void
|
||||
odm_ConfigRF_RadioB_8188E(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
u32 Addr,
|
||||
u32 Data
|
||||
)
|
||||
{
|
||||
u32 content = 0x1001; /* RF_Content: radiob_txt */
|
||||
u32 maskforPhySet= (u32)(content&0xE000);
|
||||
|
||||
odm_ConfigRFReg_8188E(pDM_Odm, Addr, Data, RF_PATH_B, Addr|maskforPhySet);
|
||||
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ConfigRFWithHeaderFile: [RadioB] %08X %08X\n", Addr, Data));
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
odm_ConfigMAC_8188E(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
u32 Addr,
|
||||
u8 Data
|
||||
)
|
||||
{
|
||||
ODM_Write1Byte(pDM_Odm, Addr, Data);
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ConfigMACWithHeaderFile: [MAC_REG] %08X %08X\n", Addr, Data));
|
||||
}
|
||||
|
||||
void
|
||||
odm_ConfigBB_AGC_8188E(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
u32 Addr,
|
||||
u32 Bitmask,
|
||||
u32 Data
|
||||
)
|
||||
{
|
||||
ODM_SetBBReg(pDM_Odm, Addr, Bitmask, Data);
|
||||
/* Add 1us delay between BB/RF register setting. */
|
||||
ODM_delay_us(1);
|
||||
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ConfigBBWithHeaderFile: [AGC_TAB] %08X %08X\n", Addr, Data));
|
||||
}
|
||||
|
||||
void
|
||||
odm_ConfigBB_PHY_REG_PG_8188E(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
u32 Addr,
|
||||
u32 Bitmask,
|
||||
u32 Data
|
||||
)
|
||||
{
|
||||
if (Addr == 0xfe) {
|
||||
ODM_sleep_ms(50);
|
||||
} else if (Addr == 0xfd) {
|
||||
ODM_delay_ms(5);
|
||||
} else if (Addr == 0xfc) {
|
||||
ODM_delay_ms(1);
|
||||
} else if (Addr == 0xfb) {
|
||||
ODM_delay_us(50);
|
||||
} else if (Addr == 0xfa) {
|
||||
ODM_delay_us(5);
|
||||
} else if (Addr == 0xf9) {
|
||||
ODM_delay_us(1);
|
||||
} else {
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_INIT, ODM_DBG_LOUD, ("===> @@@@@@@ ODM_ConfigBBWithHeaderFile: [PHY_REG] %08X %08X %08X\n", Addr, Bitmask, Data));
|
||||
|
||||
storePwrIndexDiffRateOffset(pDM_Odm->Adapter, Addr, Bitmask, Data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
odm_ConfigBB_PHY_8188E(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
u32 Addr,
|
||||
u32 Bitmask,
|
||||
u32 Data
|
||||
)
|
||||
{
|
||||
if (Addr == 0xfe) {
|
||||
ODM_sleep_ms(50);
|
||||
}
|
||||
else if (Addr == 0xfd) {
|
||||
ODM_delay_ms(5);
|
||||
}
|
||||
else if (Addr == 0xfc) {
|
||||
ODM_delay_ms(1);
|
||||
}
|
||||
else if (Addr == 0xfb) {
|
||||
ODM_delay_us(50);
|
||||
}
|
||||
else if (Addr == 0xfa) {
|
||||
ODM_delay_us(5);
|
||||
}
|
||||
else if (Addr == 0xf9) {
|
||||
ODM_delay_us(1);
|
||||
}
|
||||
else {
|
||||
if (Addr == 0xa24)
|
||||
pDM_Odm->RFCalibrateInfo.RegA24 = Data;
|
||||
ODM_SetBBReg(pDM_Odm, Addr, Bitmask, Data);
|
||||
|
||||
/* Add 1us delay between BB/RF register setting. */
|
||||
ODM_delay_us(1);
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ConfigBBWithHeaderFile: [PHY_REG] %08X %08X\n", Addr, Data));
|
||||
}
|
||||
}
|
|
@ -1,66 +0,0 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* 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 "odm_precomp.h"
|
||||
|
||||
void
|
||||
ODM_InitDebugSetting(
|
||||
PDM_ODM_T pDM_Odm
|
||||
)
|
||||
{
|
||||
pDM_Odm->DebugLevel = ODM_DBG_TRACE;
|
||||
|
||||
pDM_Odm->DebugComponents =
|
||||
\
|
||||
#if DBG
|
||||
/* BB Functions */
|
||||
/* ODM_COMP_DIG | */
|
||||
/* ODM_COMP_RA_MASK | */
|
||||
/* ODM_COMP_DYNAMIC_TXPWR | */
|
||||
/* ODM_COMP_FA_CNT | */
|
||||
/* ODM_COMP_RSSI_MONITOR | */
|
||||
/* ODM_COMP_CCK_PD | */
|
||||
/* ODM_COMP_ANT_DIV | */
|
||||
/* ODM_COMP_PWR_SAVE | */
|
||||
/* ODM_COMP_PWR_TRAIN | */
|
||||
/* ODM_COMP_RATE_ADAPTIVE | */
|
||||
/* ODM_COMP_PATH_DIV | */
|
||||
/* ODM_COMP_DYNAMIC_PRICCA | */
|
||||
/* ODM_COMP_RXHP | */
|
||||
|
||||
/* MAC Functions */
|
||||
/* ODM_COMP_EDCA_TURBO | */
|
||||
/* ODM_COMP_EARLY_MODE | */
|
||||
/* RF Functions */
|
||||
/* ODM_COMP_TX_PWR_TRACK | */
|
||||
/* ODM_COMP_RX_GAIN_TRACK | */
|
||||
/* ODM_COMP_CALIBRATION | */
|
||||
/* Common */
|
||||
/* ODM_COMP_COMMON | */
|
||||
/* ODM_COMP_INIT | */
|
||||
#endif
|
||||
0;
|
||||
}
|
||||
|
||||
|
170
hal/odm_debug.h
170
hal/odm_debug.h
|
@ -1,170 +0,0 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* 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 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
|
||||
|
||||
/* */
|
||||
/* 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
|
||||
/* MAC Functions */
|
||||
#define ODM_COMP_EDCA_TURBO BIT16
|
||||
#define ODM_COMP_EARLY_MODE BIT17
|
||||
/* 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_COMP_COMMON BIT30
|
||||
#define ODM_COMP_INIT BIT31
|
||||
|
||||
/*------------------------Export Marco Definition---------------------------*/
|
||||
#define DbgPrint printk
|
||||
#define RT_PRINTK(fmt, args...) DbgPrint( "%s(): " fmt, __FUNCTION__, ## args);
|
||||
#ifndef ASSERT
|
||||
#define ASSERT(expr)
|
||||
#endif
|
||||
|
||||
#if DBG
|
||||
#define ODM_RT_TRACE(pDM_Odm, comp, level, fmt) \
|
||||
if (((comp) & pDM_Odm->DebugComponents) && (level <= pDM_Odm->DebugLevel)) \
|
||||
{ \
|
||||
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_RTL8812) \
|
||||
DbgPrint("[ODM-8812] "); \
|
||||
else if (pDM_Odm->SupportICType == ODM_RTL8821) \
|
||||
DbgPrint("[ODM-8821] "); \
|
||||
RT_PRINTK fmt; \
|
||||
}
|
||||
|
||||
#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; \
|
||||
u8 * __ptr = (u8 *)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
|
||||
ODM_InitDebugSetting(
|
||||
PDM_ODM_T pDM_Odm
|
||||
);
|
||||
|
||||
#endif /* __ODM_DBG_H__ */
|
||||
|
|
@ -1,362 +0,0 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* 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 "odm_precomp.h"
|
||||
#include "Hal8188EPhyCfg.h"
|
||||
|
||||
/* ODM IO Relative API. */
|
||||
|
||||
u8
|
||||
ODM_Read1Byte(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
u32 RegAddr
|
||||
)
|
||||
{
|
||||
struct adapter * Adapter = pDM_Odm->Adapter;
|
||||
return rtw_read8(Adapter,RegAddr);
|
||||
}
|
||||
|
||||
|
||||
u16
|
||||
ODM_Read2Byte(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
u32 RegAddr
|
||||
)
|
||||
{
|
||||
struct adapter * Adapter = pDM_Odm->Adapter;
|
||||
return rtw_read16(Adapter,RegAddr);
|
||||
}
|
||||
|
||||
u32
|
||||
ODM_Read4Byte(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
u32 RegAddr
|
||||
)
|
||||
{
|
||||
struct adapter * Adapter = pDM_Odm->Adapter;
|
||||
return rtw_read32(Adapter,RegAddr);
|
||||
}
|
||||
|
||||
void
|
||||
ODM_Write1Byte(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
u32 RegAddr,
|
||||
u8 Data
|
||||
)
|
||||
{
|
||||
struct adapter * Adapter = pDM_Odm->Adapter;
|
||||
rtw_write8(Adapter,RegAddr, Data);
|
||||
}
|
||||
|
||||
void
|
||||
ODM_Write2Byte(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
u32 RegAddr,
|
||||
u16 Data
|
||||
)
|
||||
{
|
||||
struct adapter * Adapter = pDM_Odm->Adapter;
|
||||
rtw_write16(Adapter,RegAddr, Data);
|
||||
}
|
||||
|
||||
void
|
||||
ODM_Write4Byte(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
u32 RegAddr,
|
||||
u32 Data
|
||||
)
|
||||
{
|
||||
struct adapter * Adapter = pDM_Odm->Adapter;
|
||||
rtw_write32(Adapter,RegAddr, Data);
|
||||
}
|
||||
|
||||
void
|
||||
ODM_SetMACReg(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
u32 RegAddr,
|
||||
u32 BitMask,
|
||||
u32 Data
|
||||
)
|
||||
{
|
||||
struct adapter * Adapter = pDM_Odm->Adapter;
|
||||
PHY_SetBBReg(Adapter, RegAddr, BitMask, Data);
|
||||
}
|
||||
|
||||
u32
|
||||
ODM_GetMACReg(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
u32 RegAddr,
|
||||
u32 BitMask
|
||||
)
|
||||
{
|
||||
struct adapter * Adapter = pDM_Odm->Adapter;
|
||||
return PHY_QueryBBReg(Adapter, RegAddr, BitMask);
|
||||
}
|
||||
|
||||
void
|
||||
ODM_SetBBReg(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
u32 RegAddr,
|
||||
u32 BitMask,
|
||||
u32 Data
|
||||
)
|
||||
{
|
||||
struct adapter * Adapter = pDM_Odm->Adapter;
|
||||
PHY_SetBBReg(Adapter, RegAddr, BitMask, Data);
|
||||
}
|
||||
|
||||
|
||||
u32
|
||||
ODM_GetBBReg(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
u32 RegAddr,
|
||||
u32 BitMask
|
||||
)
|
||||
{
|
||||
struct adapter * Adapter = pDM_Odm->Adapter;
|
||||
return PHY_QueryBBReg(Adapter, RegAddr, BitMask);
|
||||
}
|
||||
|
||||
void
|
||||
ODM_SetRFReg(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
enum rf_radio_path eRFPath,
|
||||
u32 RegAddr,
|
||||
u32 BitMask,
|
||||
u32 Data
|
||||
)
|
||||
{
|
||||
struct adapter * Adapter = pDM_Odm->Adapter;
|
||||
PHY_SetRFReg(Adapter, (enum rf_radio_path)eRFPath, RegAddr, BitMask, Data);
|
||||
}
|
||||
|
||||
u32
|
||||
ODM_GetRFReg(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
enum rf_radio_path eRFPath,
|
||||
u32 RegAddr,
|
||||
u32 BitMask
|
||||
)
|
||||
{
|
||||
struct adapter * Adapter = pDM_Odm->Adapter;
|
||||
|
||||
return PHY_QueryRFReg(Adapter, (enum rf_radio_path)eRFPath,
|
||||
RegAddr, BitMask);
|
||||
}
|
||||
|
||||
/* */
|
||||
/* ODM Memory relative API. */
|
||||
/* */
|
||||
void
|
||||
ODM_AllocateMemory(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
void * *pPtr,
|
||||
u32 length
|
||||
)
|
||||
{
|
||||
*pPtr = rtw_zvmalloc(length);
|
||||
}
|
||||
|
||||
/* length could be ignored, used to detect memory leakage. */
|
||||
void
|
||||
ODM_FreeMemory(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
void * pPtr,
|
||||
u32 length
|
||||
)
|
||||
{
|
||||
rtw_vmfree(pPtr, length);
|
||||
}
|
||||
|
||||
s32 ODM_CompareMemory(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
void * pBuf1,
|
||||
void * pBuf2,
|
||||
u32 length
|
||||
)
|
||||
{
|
||||
return _rtw_memcmp(pBuf1,pBuf2,length);
|
||||
}
|
||||
|
||||
/* */
|
||||
/* ODM MISC relative API. */
|
||||
/* */
|
||||
void
|
||||
ODM_AcquireSpinLock(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
RT_SPINLOCK_TYPE type
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ODM_ReleaseSpinLock(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
RT_SPINLOCK_TYPE type
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
/* */
|
||||
/* Work item relative API. FOr MP driver only~! */
|
||||
/* */
|
||||
void
|
||||
ODM_InitializeWorkItem(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
PRT_WORK_ITEM pRtWorkItem,
|
||||
RT_WORKITEM_CALL_BACK RtWorkItemCallback,
|
||||
void * pContext,
|
||||
const char* szID
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ODM_StartWorkItem(
|
||||
PRT_WORK_ITEM pRtWorkItem
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ODM_StopWorkItem(
|
||||
PRT_WORK_ITEM pRtWorkItem
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ODM_FreeWorkItem(
|
||||
PRT_WORK_ITEM pRtWorkItem
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ODM_ScheduleWorkItem(
|
||||
PRT_WORK_ITEM pRtWorkItem
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ODM_IsWorkItemScheduled(
|
||||
PRT_WORK_ITEM pRtWorkItem
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
/* */
|
||||
/* ODM Timer relative API. */
|
||||
/* */
|
||||
void
|
||||
ODM_StallExecution(
|
||||
u32 usDelay
|
||||
)
|
||||
{
|
||||
rtw_udelay_os(usDelay);
|
||||
}
|
||||
|
||||
void
|
||||
ODM_delay_ms(u32 ms)
|
||||
{
|
||||
rtw_mdelay_os(ms);
|
||||
}
|
||||
|
||||
void
|
||||
ODM_delay_us(u32 us)
|
||||
{
|
||||
rtw_udelay_os(us);
|
||||
}
|
||||
|
||||
void
|
||||
ODM_sleep_ms(u32 ms)
|
||||
{
|
||||
rtw_msleep_os(ms);
|
||||
}
|
||||
|
||||
void
|
||||
ODM_sleep_us(u32 us)
|
||||
{
|
||||
rtw_usleep_os(us);
|
||||
}
|
||||
|
||||
void
|
||||
ODM_SetTimer(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
PRT_TIMER pTimer,
|
||||
u32 msDelay
|
||||
)
|
||||
{
|
||||
_set_timer(pTimer,msDelay ); /* ms */
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
|
||||
void
|
||||
ODM_InitializeTimer(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
PRT_TIMER pTimer,
|
||||
RT_TIMER_CALL_BACK CallBackFunc,
|
||||
void * pContext,
|
||||
const char* szID
|
||||
)
|
||||
{
|
||||
struct adapter *Adapter = pDM_Odm->Adapter;
|
||||
_init_timer(pTimer,Adapter->pnetdev,CallBackFunc,pDM_Odm);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
ODM_CancelTimer(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
PRT_TIMER pTimer
|
||||
)
|
||||
{
|
||||
_cancel_timer_ex(pTimer);
|
||||
}
|
||||
|
||||
void
|
||||
ODM_ReleaseTimer(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
PRT_TIMER pTimer
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
/* */
|
||||
/* ODM FW relative API. */
|
||||
/* */
|
||||
u32
|
||||
ODM_FillH2CCmd(
|
||||
u8 * pH2CBuffer,
|
||||
u32 H2CBufferLen,
|
||||
u32 CmdNum,
|
||||
u32 * pElementID,
|
||||
u32 * pCmdLen,
|
||||
u8 ** pCmbBuffer,
|
||||
u8 * CmdStartSeq
|
||||
)
|
||||
{
|
||||
return true;
|
||||
}
|
|
@ -1,321 +0,0 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* 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__
|
||||
|
||||
|
||||
|
||||
/* */
|
||||
/* =========== 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
|
||||
|
||||
/*===================================
|
||||
|
||||
#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
|
||||
|
||||
#define _cat(_name, _ic_type, _func) \
|
||||
( \
|
||||
((_ic_type) & ODM_IC_11N_SERIES)? _func##_11N(_name): \
|
||||
_func##_11AC(_name) \
|
||||
)
|
||||
|
||||
/* _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. */
|
||||
#define ODM_REG(_name, _pDM_Odm) _cat(_name, _pDM_Odm->SupportICType, _reg)
|
||||
#define ODM_BIT(_name, _pDM_Odm) _cat(_name, _pDM_Odm->SupportICType, _bit)
|
||||
|
||||
typedef enum _ODM_H2C_CMD
|
||||
{
|
||||
ODM_H2C_RSSI_REPORT = 0,
|
||||
ODM_H2C_PSD_RESULT=1,
|
||||
ODM_H2C_PathDiv = 2,
|
||||
ODM_MAX_H2CCMD
|
||||
}ODM_H2C_CMD;
|
||||
|
||||
|
||||
/* */
|
||||
/* 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. */
|
||||
/* */
|
||||
typedef void *PRT_WORK_ITEM ;
|
||||
typedef void RT_WORKITEM_HANDLE,*PRT_WORKITEM_HANDLE;
|
||||
typedef void (*RT_WORKITEM_CALL_BACK)(void * pContext);
|
||||
|
||||
/* */
|
||||
/* =========== Extern Variable ??? It should be forbidden. */
|
||||
/* */
|
||||
|
||||
|
||||
/* */
|
||||
/* =========== EXtern Function Prototype */
|
||||
/* */
|
||||
|
||||
|
||||
u8
|
||||
ODM_Read1Byte(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
u32 RegAddr
|
||||
);
|
||||
|
||||
u16
|
||||
ODM_Read2Byte(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
u32 RegAddr
|
||||
);
|
||||
|
||||
u32
|
||||
ODM_Read4Byte(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
u32 RegAddr
|
||||
);
|
||||
|
||||
void
|
||||
ODM_Write1Byte(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
u32 RegAddr,
|
||||
u8 Data
|
||||
);
|
||||
|
||||
void
|
||||
ODM_Write2Byte(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
u32 RegAddr,
|
||||
u16 Data
|
||||
);
|
||||
|
||||
void
|
||||
ODM_Write4Byte(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
u32 RegAddr,
|
||||
u32 Data
|
||||
);
|
||||
|
||||
void
|
||||
ODM_SetMACReg(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
u32 RegAddr,
|
||||
u32 BitMask,
|
||||
u32 Data
|
||||
);
|
||||
|
||||
u32
|
||||
ODM_GetMACReg(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
u32 RegAddr,
|
||||
u32 BitMask
|
||||
);
|
||||
|
||||
void
|
||||
ODM_SetBBReg(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
u32 RegAddr,
|
||||
u32 BitMask,
|
||||
u32 Data
|
||||
);
|
||||
|
||||
u32
|
||||
ODM_GetBBReg(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
u32 RegAddr,
|
||||
u32 BitMask
|
||||
);
|
||||
|
||||
void
|
||||
ODM_SetRFReg(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
enum rf_radio_path eRFPath,
|
||||
u32 RegAddr,
|
||||
u32 BitMask,
|
||||
u32 Data
|
||||
);
|
||||
|
||||
u32
|
||||
ODM_GetRFReg(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
enum rf_radio_path eRFPath,
|
||||
u32 RegAddr,
|
||||
u32 BitMask
|
||||
);
|
||||
|
||||
|
||||
/* */
|
||||
/* Memory Relative Function. */
|
||||
/* */
|
||||
void
|
||||
ODM_AllocateMemory(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
void * *pPtr,
|
||||
u32 length
|
||||
);
|
||||
void
|
||||
ODM_FreeMemory(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
void * pPtr,
|
||||
u32 length
|
||||
);
|
||||
|
||||
s32 ODM_CompareMemory(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
void * pBuf1,
|
||||
void * pBuf2,
|
||||
u32 length
|
||||
);
|
||||
|
||||
/* */
|
||||
/* ODM MISC-spin lock relative API. */
|
||||
/* */
|
||||
void
|
||||
ODM_AcquireSpinLock(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
RT_SPINLOCK_TYPE type
|
||||
);
|
||||
|
||||
void
|
||||
ODM_ReleaseSpinLock(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
RT_SPINLOCK_TYPE type
|
||||
);
|
||||
|
||||
|
||||
/* */
|
||||
/* ODM MISC-workitem relative API. */
|
||||
/* */
|
||||
void
|
||||
ODM_InitializeWorkItem(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
PRT_WORK_ITEM pRtWorkItem,
|
||||
RT_WORKITEM_CALL_BACK RtWorkItemCallback,
|
||||
void * pContext,
|
||||
const char* szID
|
||||
);
|
||||
|
||||
void
|
||||
ODM_StartWorkItem(
|
||||
PRT_WORK_ITEM pRtWorkItem
|
||||
);
|
||||
|
||||
void
|
||||
ODM_StopWorkItem(
|
||||
PRT_WORK_ITEM pRtWorkItem
|
||||
);
|
||||
|
||||
void
|
||||
ODM_FreeWorkItem(
|
||||
PRT_WORK_ITEM pRtWorkItem
|
||||
);
|
||||
|
||||
void
|
||||
ODM_ScheduleWorkItem(
|
||||
PRT_WORK_ITEM pRtWorkItem
|
||||
);
|
||||
|
||||
void
|
||||
ODM_IsWorkItemScheduled(
|
||||
PRT_WORK_ITEM pRtWorkItem
|
||||
);
|
||||
|
||||
/* */
|
||||
/* ODM Timer relative API. */
|
||||
/* */
|
||||
void
|
||||
ODM_StallExecution(
|
||||
u32 usDelay
|
||||
);
|
||||
|
||||
void
|
||||
ODM_delay_ms(u32 ms);
|
||||
|
||||
|
||||
void
|
||||
ODM_delay_us(u32 us);
|
||||
|
||||
void
|
||||
ODM_sleep_ms(u32 ms);
|
||||
|
||||
void
|
||||
ODM_sleep_us(u32 us);
|
||||
|
||||
void
|
||||
ODM_SetTimer(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
PRT_TIMER pTimer,
|
||||
u32 msDelay
|
||||
);
|
||||
|
||||
void
|
||||
ODM_InitializeTimer(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
PRT_TIMER pTimer,
|
||||
RT_TIMER_CALL_BACK CallBackFunc,
|
||||
void * pContext,
|
||||
const char* szID
|
||||
);
|
||||
|
||||
void
|
||||
ODM_CancelTimer(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
PRT_TIMER pTimer
|
||||
);
|
||||
|
||||
void
|
||||
ODM_ReleaseTimer(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
PRT_TIMER pTimer
|
||||
);
|
||||
|
||||
|
||||
/* */
|
||||
/* ODM FW relative API. */
|
||||
/* */
|
||||
u32
|
||||
ODM_FillH2CCmd(
|
||||
u8 * pH2CBuffer,
|
||||
u32 H2CBufferLen,
|
||||
u32 CmdNum,
|
||||
u32 * pElementID,
|
||||
u32 * pCmdLen,
|
||||
u8 ** pCmbBuffer,
|
||||
u8 * CmdStartSeq
|
||||
);
|
||||
|
||||
#endif /* __ODM_INTERFACE_H__ */
|
|
@ -1,60 +0,0 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* 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 "odm_types.h"
|
||||
|
||||
#define TEST_FALG___ 1
|
||||
|
||||
/* 2 Config Flags and Structs - defined by each ODM Type */
|
||||
|
||||
#include <drv_conf.h>
|
||||
#include <osdep_service.h>
|
||||
#include <drv_types.h>
|
||||
#include <hal_intf.h>
|
||||
|
||||
/* 2 OutSrc Header Files */
|
||||
|
||||
#include "odm.h"
|
||||
#include "odm_HWConfig.h"
|
||||
#include "odm_debug.h"
|
||||
#include "odm_RegDefine11AC.h"
|
||||
#include "odm_RegDefine11N.h"
|
||||
|
||||
#include "HalPhyRf.h"
|
||||
#include "HalPhyRf_8188e.h"/* for IQK,LCK,Power-tracking */
|
||||
#include "Hal8188ERateAdaptive.h"/* for RA,Power training */
|
||||
#include "rtl8188e_hal.h"
|
||||
|
||||
#include "odm_interface.h"
|
||||
#include "odm_reg.h"
|
||||
|
||||
#include "HalHWImg8188E_MAC.h"
|
||||
#include "HalHWImg8188E_RF.h"
|
||||
#include "HalHWImg8188E_BB.h"
|
||||
#include "Hal8188EReg.h"
|
||||
|
||||
#include "odm_RegConfig8188E.h"
|
||||
#include "odm_RTL8188E.h"
|
||||
|
||||
#endif /* __ODM_PRECOMP_H__ */
|
||||
|
120
hal/odm_reg.h
120
hal/odm_reg.h
|
@ -1,120 +0,0 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
/* */
|
||||
/* File Name: odm_reg.h */
|
||||
/* */
|
||||
/* Description: */
|
||||
/* */
|
||||
/* This file is for general register definition. */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
#ifndef __HAL_ODM_REG_H__
|
||||
#define __HAL_ODM_REG_H__
|
||||
|
||||
/* */
|
||||
/* Register Definition */
|
||||
/* */
|
||||
|
||||
/* MAC REG */
|
||||
#define ODM_BB_RESET 0x002
|
||||
#define ODM_DUMMY 0x4fe
|
||||
#define ODM_EDCA_VO_PARAM 0x500
|
||||
#define ODM_EDCA_VI_PARAM 0x504
|
||||
#define ODM_EDCA_BE_PARAM 0x508
|
||||
#define ODM_EDCA_BK_PARAM 0x50C
|
||||
#define ODM_TXPAUSE 0x522
|
||||
|
||||
/* BB REG */
|
||||
#define ODM_FPGA_PHY0_PAGE8 0x800
|
||||
#define ODM_PSD_SETTING 0x808
|
||||
#define ODM_AFE_SETTING 0x818
|
||||
#define ODM_TXAGC_B_6_18 0x830
|
||||
#define ODM_TXAGC_B_24_54 0x834
|
||||
#define ODM_TXAGC_B_MCS32_5 0x838
|
||||
#define ODM_TXAGC_B_MCS0_MCS3 0x83c
|
||||
#define ODM_TXAGC_B_MCS4_MCS7 0x848
|
||||
#define ODM_TXAGC_B_MCS8_MCS11 0x84c
|
||||
#define ODM_ANALOG_REGISTER 0x85c
|
||||
#define ODM_RF_INTERFACE_OUTPUT 0x860
|
||||
#define ODM_TXAGC_B_MCS12_MCS15 0x868
|
||||
#define ODM_TXAGC_B_11_A_2_11 0x86c
|
||||
#define ODM_AD_DA_LSB_MASK 0x874
|
||||
#define ODM_ENABLE_3_WIRE 0x88c
|
||||
#define ODM_PSD_REPORT 0x8b4
|
||||
#define ODM_R_ANT_SELECT 0x90c
|
||||
#define ODM_CCK_ANT_SELECT 0xa07
|
||||
#define ODM_CCK_PD_THRESH 0xa0a
|
||||
#define ODM_CCK_RF_REG1 0xa11
|
||||
#define ODM_CCK_MATCH_FILTER 0xa20
|
||||
#define ODM_CCK_RAKE_MAC 0xa2e
|
||||
#define ODM_CCK_CNT_RESET 0xa2d
|
||||
#define ODM_CCK_TX_DIVERSITY 0xa2f
|
||||
#define ODM_CCK_FA_CNT_MSB 0xa5b
|
||||
#define ODM_CCK_FA_CNT_LSB 0xa5c
|
||||
#define ODM_CCK_NEW_FUNCTION 0xa75
|
||||
#define ODM_OFDM_PHY0_PAGE_C 0xc00
|
||||
#define ODM_OFDM_RX_ANT 0xc04
|
||||
#define ODM_R_A_RXIQI 0xc14
|
||||
#define ODM_R_A_AGC_CORE1 0xc50
|
||||
#define ODM_R_A_AGC_CORE2 0xc54
|
||||
#define ODM_R_B_AGC_CORE1 0xc58
|
||||
#define ODM_R_AGC_PAR 0xc70
|
||||
#define ODM_R_HTSTF_AGC_PAR 0xc7c
|
||||
#define ODM_TX_PWR_TRAINING_A 0xc90
|
||||
#define ODM_TX_PWR_TRAINING_B 0xc98
|
||||
#define ODM_OFDM_FA_CNT1 0xcf0
|
||||
#define ODM_OFDM_PHY0_PAGE_D 0xd00
|
||||
#define ODM_OFDM_FA_CNT2 0xda0
|
||||
#define ODM_OFDM_FA_CNT3 0xda4
|
||||
#define ODM_OFDM_FA_CNT4 0xda8
|
||||
#define ODM_TXAGC_A_6_18 0xe00
|
||||
#define ODM_TXAGC_A_24_54 0xe04
|
||||
#define ODM_TXAGC_A_1_MCS32 0xe08
|
||||
#define ODM_TXAGC_A_MCS0_MCS3 0xe10
|
||||
#define ODM_TXAGC_A_MCS4_MCS7 0xe14
|
||||
#define ODM_TXAGC_A_MCS8_MCS11 0xe18
|
||||
#define ODM_TXAGC_A_MCS12_MCS15 0xe1c
|
||||
|
||||
/* RF REG */
|
||||
#define ODM_GAIN_SETTING 0x00
|
||||
#define ODM_CHANNEL 0x18
|
||||
|
||||
/* Ant Detect Reg */
|
||||
#define ODM_DPDT 0x300
|
||||
|
||||
/* PSD Init */
|
||||
#define ODM_PSDREG 0x808
|
||||
|
||||
/* 92D Path Div */
|
||||
#define PATHDIV_REG 0xB30
|
||||
#define PATHDIV_TRI 0xBA0
|
||||
|
||||
|
||||
/* */
|
||||
/* Bitmap Definition */
|
||||
/* */
|
||||
|
||||
#define BIT_FA_RESET BIT0
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -1,88 +0,0 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* 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_TYPES_H__
|
||||
#define __ODM_TYPES_H__
|
||||
|
||||
/* */
|
||||
/* Define Different SW team support */
|
||||
/* */
|
||||
#define ODM_AP 0x01 /* BIT0 */
|
||||
#define ODM_ADSL 0x02 /* BIT1 */
|
||||
#define ODM_CE 0x04 /* BIT2 */
|
||||
|
||||
/* Deifne HW endian support */
|
||||
#define ODM_ENDIAN_BIG 0
|
||||
#define ODM_ENDIAN_LITTLE 1
|
||||
|
||||
#define RT_PCI_INTERFACE 1
|
||||
#define RT_USB_INTERFACE 2
|
||||
#define RT_SDIO_INTERFACE 3
|
||||
|
||||
typedef enum _HAL_STATUS{
|
||||
HAL_STATUS_SUCCESS,
|
||||
HAL_STATUS_FAILURE,
|
||||
/*RT_STATUS_PENDING,
|
||||
RT_STATUS_RESOURCE,
|
||||
RT_STATUS_INVALID_CONTEXT,
|
||||
RT_STATUS_INVALID_PARAMETER,
|
||||
RT_STATUS_NOT_SUPPORT,
|
||||
RT_STATUS_OS_API_FAILED,*/
|
||||
}HAL_STATUS,*PHAL_STATUS;
|
||||
|
||||
typedef enum _RT_SPINLOCK_TYPE{
|
||||
RT_TEMP =1,
|
||||
}RT_SPINLOCK_TYPE;
|
||||
|
||||
#include <basic_types.h>
|
||||
|
||||
#define DEV_BUS_TYPE RT_USB_INTERFACE
|
||||
|
||||
#if defined(__LITTLE_ENDIAN)
|
||||
#define ODM_ENDIAN_TYPE ODM_ENDIAN_LITTLE
|
||||
#elif defined (__BIG_ENDIAN)
|
||||
#define ODM_ENDIAN_TYPE ODM_ENDIAN_BIG
|
||||
#endif
|
||||
|
||||
typedef struct timer_list RT_TIMER, *PRT_TIMER;
|
||||
typedef void * RT_TIMER_CALL_BACK;
|
||||
#define STA_INFO_T struct sta_info
|
||||
#define PSTA_INFO_T struct sta_info *
|
||||
|
||||
|
||||
|
||||
#define true true
|
||||
#define false false
|
||||
|
||||
|
||||
#define SET_TX_DESC_ANTSEL_A_88E(__pTxDesc, __Value) \
|
||||
SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 24, 1, __Value)
|
||||
#define SET_TX_DESC_ANTSEL_B_88E(__pTxDesc, __Value) \
|
||||
SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 25, 1, __Value)
|
||||
#define SET_TX_DESC_ANTSEL_C_88E(__pTxDesc, __Value) \
|
||||
SET_BITS_TO_LE_4BYTE(__pTxDesc+28, 29, 1, __Value)
|
||||
|
||||
/* define useless flag to avoid compile warning */
|
||||
#define USE_WORKITEM 0
|
||||
#define FOR_BRAZIL_PRETEST 0
|
||||
#define BT_30_SUPPORT 0
|
||||
#define FPGA_TWO_MAC_VERIFICATION 0
|
||||
|
||||
|
||||
#endif /* __ODM_TYPES_H__ */
|
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 */
|
2665
hal/phydm/halphyrf_ap.c
Normal file
2665
hal/phydm/halphyrf_ap.c
Normal file
File diff suppressed because it is too large
Load diff
178
hal/phydm/halphyrf_ap.h
Normal file
178
hal/phydm/halphyrf_ap.h
Normal file
|
@ -0,0 +1,178 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* 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
|
||||
|
||||
#if (RTL8821C_SUPPORT == 1)
|
||||
#include "rtl8822b/phydm_iqk_8821c.h"
|
||||
#endif
|
||||
|
||||
enum pwrtrack_method {
|
||||
BBSWING,
|
||||
TXAGC,
|
||||
MIX_MODE,
|
||||
TSSI_MODE
|
||||
};
|
||||
|
||||
typedef void (*func_set_pwr)(void *, enum pwrtrack_method, u8, u8);
|
||||
typedef void(*func_iqk)(void *, u8, u8, u8);
|
||||
typedef void (*func_lck)(void *);
|
||||
/* refine by YuChen for 8814A */
|
||||
typedef void (*func_swing)(void *, u8 **, u8 **, u8 **, u8 **);
|
||||
typedef void (*func_swing8814only)(void *, u8 **, u8 **, u8 **, u8 **);
|
||||
typedef void (*func_all_swing)(void *, u8 **, u8 **, u8 **, u8 **, u8 **, u8 **, u8 **, u8 **);
|
||||
|
||||
|
||||
struct _TXPWRTRACK_CFG {
|
||||
u8 swing_table_size_cck;
|
||||
u8 swing_table_size_ofdm;
|
||||
u8 threshold_iqk;
|
||||
u8 threshold_dpk;
|
||||
u8 average_thermal_num;
|
||||
u8 rf_path_count;
|
||||
u32 thermal_reg_addr;
|
||||
func_set_pwr odm_tx_pwr_track_set_pwr;
|
||||
func_iqk do_iqk;
|
||||
func_lck phy_lc_calibrate;
|
||||
func_swing get_delta_swing_table;
|
||||
func_swing8814only get_delta_swing_table8814only;
|
||||
func_all_swing get_delta_all_swing_table;
|
||||
};
|
||||
|
||||
void
|
||||
configure_txpower_track(
|
||||
void *p_dm_void,
|
||||
struct _TXPWRTRACK_CFG *p_config
|
||||
);
|
||||
|
||||
|
||||
void
|
||||
odm_txpowertracking_callback_thermal_meter(
|
||||
#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
|
||||
void *p_dm_void
|
||||
#else
|
||||
struct _ADAPTER *adapter
|
||||
#endif
|
||||
);
|
||||
|
||||
#if (RTL8192E_SUPPORT == 1)
|
||||
void
|
||||
odm_txpowertracking_callback_thermal_meter_92e(
|
||||
#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
|
||||
void *p_dm_void
|
||||
#else
|
||||
struct _ADAPTER *adapter
|
||||
#endif
|
||||
);
|
||||
#endif
|
||||
|
||||
#if (RTL8814A_SUPPORT == 1)
|
||||
void
|
||||
odm_txpowertracking_callback_thermal_meter_jaguar_series2(
|
||||
#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
|
||||
void *p_dm_void
|
||||
#else
|
||||
struct _ADAPTER *adapter
|
||||
#endif
|
||||
);
|
||||
|
||||
#elif ODM_IC_11AC_SERIES_SUPPORT
|
||||
void
|
||||
odm_txpowertracking_callback_thermal_meter_jaguar_series(
|
||||
#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
|
||||
void *p_dm_void
|
||||
#else
|
||||
struct _ADAPTER *adapter
|
||||
#endif
|
||||
);
|
||||
|
||||
#elif (RTL8197F_SUPPORT == 1 || RTL8822B_SUPPORT == 1)
|
||||
void
|
||||
odm_txpowertracking_callback_thermal_meter_jaguar_series3(
|
||||
#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
|
||||
void *p_dm_void
|
||||
#else
|
||||
struct _ADAPTER *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_set_monitor_mode8192c(struct _ADAPTER *p_adapter,
|
||||
bool is_enable_monitor_mode);
|
||||
|
||||
/*
|
||||
* IQ calibrate
|
||||
* */
|
||||
void
|
||||
phy_iq_calibrate_8192c(struct _ADAPTER *p_adapter,
|
||||
bool is_recovery);
|
||||
|
||||
/*
|
||||
* LC calibrate
|
||||
* */
|
||||
void
|
||||
phy_lc_calibrate_8192c(struct _ADAPTER *p_adapter);
|
||||
|
||||
/*
|
||||
* AP calibrate
|
||||
* */
|
||||
void
|
||||
phy_ap_calibrate_8192c(struct _ADAPTER *p_adapter,
|
||||
s8 delta);
|
||||
#endif
|
||||
|
||||
#define ODM_TARGET_CHNL_NUM_2G_5G 59
|
||||
|
||||
|
||||
void
|
||||
odm_reset_iqk_result(
|
||||
void *p_dm_void
|
||||
);
|
||||
u8
|
||||
odm_get_right_chnl_place_for_iqk(
|
||||
u8 chnl
|
||||
);
|
||||
|
||||
void phydm_rf_init(void *p_dm_void);
|
||||
void phydm_rf_watchdog(void *p_dm_void);
|
||||
|
||||
#endif /* #ifndef __HAL_PHY_RF_H__ */
|
799
hal/phydm/halphyrf_ce.c
Normal file
799
hal/phydm/halphyrf_ce.c
Normal file
|
@ -0,0 +1,799 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* 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, _delta_thermal) \
|
||||
do {\
|
||||
for (_offset = 0; _offset < _size; _offset++) { \
|
||||
\
|
||||
if (_delta_thermal < thermal_threshold[_direction][_offset]) { \
|
||||
\
|
||||
if (_offset != 0)\
|
||||
_offset--;\
|
||||
break;\
|
||||
} \
|
||||
} \
|
||||
if (_offset >= _size)\
|
||||
_offset = _size-1;\
|
||||
} while (0)
|
||||
|
||||
void configure_txpower_track(
|
||||
void *p_dm_void,
|
||||
struct _TXPWRTRACK_CFG *p_config
|
||||
)
|
||||
{
|
||||
struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
|
||||
|
||||
#if RTL8192E_SUPPORT
|
||||
if (p_dm_odm->support_ic_type == ODM_RTL8192E)
|
||||
configure_txpower_track_8192e(p_config);
|
||||
#endif
|
||||
#if RTL8821A_SUPPORT
|
||||
if (p_dm_odm->support_ic_type == ODM_RTL8821)
|
||||
configure_txpower_track_8821a(p_config);
|
||||
#endif
|
||||
#if RTL8812A_SUPPORT
|
||||
if (p_dm_odm->support_ic_type == ODM_RTL8812)
|
||||
configure_txpower_track_8812a(p_config);
|
||||
#endif
|
||||
#if RTL8188E_SUPPORT
|
||||
if (p_dm_odm->support_ic_type == ODM_RTL8188E)
|
||||
configure_txpower_track_8188e(p_config);
|
||||
#endif
|
||||
|
||||
#if RTL8723B_SUPPORT
|
||||
if (p_dm_odm->support_ic_type == ODM_RTL8723B)
|
||||
configure_txpower_track_8723b(p_config);
|
||||
#endif
|
||||
|
||||
#if RTL8814A_SUPPORT
|
||||
if (p_dm_odm->support_ic_type == ODM_RTL8814A)
|
||||
configure_txpower_track_8814a(p_config);
|
||||
#endif
|
||||
|
||||
#if RTL8703B_SUPPORT
|
||||
if (p_dm_odm->support_ic_type == ODM_RTL8703B)
|
||||
configure_txpower_track_8703b(p_config);
|
||||
#endif
|
||||
|
||||
#if RTL8188F_SUPPORT
|
||||
if (p_dm_odm->support_ic_type == ODM_RTL8188F)
|
||||
configure_txpower_track_8188f(p_config);
|
||||
#endif
|
||||
#if RTL8723D_SUPPORT
|
||||
if (p_dm_odm->support_ic_type == ODM_RTL8723D)
|
||||
configure_txpower_track_8723d(p_config);
|
||||
#endif
|
||||
#if RTL8822B_SUPPORT
|
||||
if (p_dm_odm->support_ic_type == ODM_RTL8822B)
|
||||
configure_txpower_track_8822b(p_config);
|
||||
#endif
|
||||
#if RTL8821C_SUPPORT
|
||||
if (p_dm_odm->support_ic_type == ODM_RTL8821C)
|
||||
configure_txpower_track_8821c(p_config);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
/* **********************************************************************
|
||||
* <20121113, Kordan> This function should be called when tx_agc 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_clear_txpowertracking_state(
|
||||
void *p_dm_void
|
||||
)
|
||||
{
|
||||
struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
|
||||
PHAL_DATA_TYPE p_hal_data = GET_HAL_DATA(p_dm_odm->adapter);
|
||||
u8 p = 0;
|
||||
struct odm_rf_calibration_structure *p_rf_calibrate_info = &(p_dm_odm->rf_calibrate_info);
|
||||
|
||||
p_rf_calibrate_info->bb_swing_idx_cck_base = p_rf_calibrate_info->default_cck_index;
|
||||
p_rf_calibrate_info->bb_swing_idx_cck = p_rf_calibrate_info->default_cck_index;
|
||||
p_dm_odm->rf_calibrate_info.CCK_index = 0;
|
||||
|
||||
for (p = ODM_RF_PATH_A; p < MAX_RF_PATH; ++p) {
|
||||
p_rf_calibrate_info->bb_swing_idx_ofdm_base[p] = p_rf_calibrate_info->default_ofdm_index;
|
||||
p_rf_calibrate_info->bb_swing_idx_ofdm[p] = p_rf_calibrate_info->default_ofdm_index;
|
||||
p_rf_calibrate_info->OFDM_index[p] = p_rf_calibrate_info->default_ofdm_index;
|
||||
|
||||
p_rf_calibrate_info->power_index_offset[p] = 0;
|
||||
p_rf_calibrate_info->delta_power_index[p] = 0;
|
||||
p_rf_calibrate_info->delta_power_index_last[p] = 0;
|
||||
|
||||
p_rf_calibrate_info->absolute_ofdm_swing_idx[p] = 0; /* Initial Mix mode power tracking*/
|
||||
p_rf_calibrate_info->remnant_ofdm_swing_idx[p] = 0;
|
||||
p_rf_calibrate_info->kfree_offset[p] = 0;
|
||||
}
|
||||
|
||||
p_rf_calibrate_info->modify_tx_agc_flag_path_a = false; /*Initial at Modify Tx Scaling mode*/
|
||||
p_rf_calibrate_info->modify_tx_agc_flag_path_b = false; /*Initial at Modify Tx Scaling mode*/
|
||||
p_rf_calibrate_info->modify_tx_agc_flag_path_c = false; /*Initial at Modify Tx Scaling mode*/
|
||||
p_rf_calibrate_info->modify_tx_agc_flag_path_d = false; /*Initial at Modify Tx Scaling mode*/
|
||||
p_rf_calibrate_info->remnant_cck_swing_idx = 0;
|
||||
p_rf_calibrate_info->thermal_value = p_hal_data->eeprom_thermal_meter;
|
||||
|
||||
p_rf_calibrate_info->modify_tx_agc_value_cck = 0; /* modify by Mingzhi.Guo */
|
||||
p_rf_calibrate_info->modify_tx_agc_value_ofdm = 0; /* modify by Mingzhi.Guo */
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
odm_txpowertracking_callback_thermal_meter(
|
||||
#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
|
||||
struct PHY_DM_STRUCT *p_dm_odm
|
||||
#else
|
||||
struct _ADAPTER *adapter
|
||||
#endif
|
||||
)
|
||||
{
|
||||
|
||||
#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
|
||||
HAL_DATA_TYPE *p_hal_data = GET_HAL_DATA(adapter);
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
|
||||
struct PHY_DM_STRUCT *p_dm_odm = &p_hal_data->DM_OutSrc;
|
||||
#elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
|
||||
struct PHY_DM_STRUCT *p_dm_odm = &p_hal_data->odmpriv;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
struct odm_rf_calibration_structure *p_rf_calibrate_info = &(p_dm_odm->rf_calibrate_info);
|
||||
|
||||
u8 thermal_value = 0, delta, delta_LCK, delta_IQK, p = 0, i = 0;
|
||||
s8 diff_DPK[4] = {0};
|
||||
u8 thermal_value_avg_count = 0;
|
||||
u32 thermal_value_avg = 0, regc80, regcd0, regcd4, regab4;
|
||||
|
||||
u8 OFDM_min_index = 0; /* OFDM BB Swing should be less than +3.0dB, which is required by Arthur */
|
||||
u8 indexforchannel = 0; /* get_right_chnl_place_for_iqk(p_hal_data->current_channel) */
|
||||
u8 power_tracking_type = p_hal_data->rf_power_tracking_type;
|
||||
u8 xtal_offset_eanble = 0;
|
||||
|
||||
struct _TXPWRTRACK_CFG c;
|
||||
|
||||
/* 4 1. The following TWO tables decide the final index of OFDM/CCK swing table. */
|
||||
u8 *delta_swing_table_idx_tup_a = NULL;
|
||||
u8 *delta_swing_table_idx_tdown_a = NULL;
|
||||
u8 *delta_swing_table_idx_tup_b = NULL;
|
||||
u8 *delta_swing_table_idx_tdown_b = NULL;
|
||||
/*for 8814 add by Yu Chen*/
|
||||
u8 *delta_swing_table_idx_tup_c = NULL;
|
||||
u8 *delta_swing_table_idx_tdown_c = NULL;
|
||||
u8 *delta_swing_table_idx_tup_d = NULL;
|
||||
u8 *delta_swing_table_idx_tdown_d = NULL;
|
||||
/*for Xtal Offset by James.Tung*/
|
||||
s8 *delta_swing_table_xtal_up = NULL;
|
||||
s8 *delta_swing_table_xtal_down = NULL;
|
||||
|
||||
/* 4 2. Initilization ( 7 steps in total ) */
|
||||
|
||||
configure_txpower_track(p_dm_odm, &c);
|
||||
|
||||
(*c.get_delta_swing_table)(p_dm_odm, (u8 **)&delta_swing_table_idx_tup_a, (u8 **)&delta_swing_table_idx_tdown_a,
|
||||
(u8 **)&delta_swing_table_idx_tup_b, (u8 **)&delta_swing_table_idx_tdown_b);
|
||||
|
||||
if (p_dm_odm->support_ic_type & ODM_RTL8814A) /*for 8814 path C & D*/
|
||||
(*c.get_delta_swing_table8814only)(p_dm_odm, (u8 **)&delta_swing_table_idx_tup_c, (u8 **)&delta_swing_table_idx_tdown_c,
|
||||
(u8 **)&delta_swing_table_idx_tup_d, (u8 **)&delta_swing_table_idx_tdown_d);
|
||||
|
||||
if (p_dm_odm->support_ic_type & (ODM_RTL8703B | ODM_RTL8723D)) /*for Xtal Offset*/
|
||||
(*c.get_delta_swing_xtal_table)(p_dm_odm, (s8 **)&delta_swing_table_xtal_up, (s8 **)&delta_swing_table_xtal_down);
|
||||
|
||||
p_rf_calibrate_info->txpowertracking_callback_cnt++; /*cosa add for debug*/
|
||||
p_rf_calibrate_info->is_txpowertracking_init = true;
|
||||
|
||||
/*p_rf_calibrate_info->txpowertrack_control = p_hal_data->txpowertrack_control;
|
||||
<Kordan> We should keep updating the control variable according to HalData.
|
||||
<Kordan> rf_calibrate_info.rega24 will be initialized when ODM HW configuring, but MP configures with para files. */
|
||||
#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
|
||||
#if (MP_DRIVER == 1)
|
||||
p_rf_calibrate_info->rega24 = 0x090e1317;
|
||||
#endif
|
||||
#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
|
||||
if (p_dm_odm->mp_mode == true)
|
||||
p_rf_calibrate_info->rega24 = 0x090e1317;
|
||||
#endif
|
||||
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("===>odm_txpowertracking_callback_thermal_meter\n p_rf_calibrate_info->bb_swing_idx_cck_base: %d, p_rf_calibrate_info->bb_swing_idx_ofdm_base[A]: %d, p_rf_calibrate_info->default_ofdm_index: %d\n",
|
||||
p_rf_calibrate_info->bb_swing_idx_cck_base, p_rf_calibrate_info->bb_swing_idx_ofdm_base[ODM_RF_PATH_A], p_rf_calibrate_info->default_ofdm_index));
|
||||
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("p_rf_calibrate_info->txpowertrack_control=%d, p_hal_data->eeprom_thermal_meter %d\n", p_rf_calibrate_info->txpowertrack_control, p_hal_data->eeprom_thermal_meter));
|
||||
thermal_value = (u8)odm_get_rf_reg(p_dm_odm, ODM_RF_PATH_A, c.thermal_reg_addr, 0xfc00); /* 0x42: RF Reg[15:10] 88E */
|
||||
|
||||
/*add log by zhao he, check c80/c94/c14/ca0 value*/
|
||||
if (p_dm_odm->support_ic_type == ODM_RTL8723D) {
|
||||
regc80 = odm_get_bb_reg(p_dm_odm, 0xc80, MASKDWORD);
|
||||
regcd0 = odm_get_bb_reg(p_dm_odm, 0xcd0, MASKDWORD);
|
||||
regcd4 = odm_get_bb_reg(p_dm_odm, 0xcd4, MASKDWORD);
|
||||
regab4 = odm_get_bb_reg(p_dm_odm, 0xab4, 0x000007FF);
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xc80 = 0x%x 0xcd0 = 0x%x 0xcd4 = 0x%x 0xab4 = 0x%x\n", regc80, regcd0, regcd4, regab4));
|
||||
}
|
||||
|
||||
if (!p_rf_calibrate_info->txpowertrack_control)
|
||||
return;
|
||||
|
||||
|
||||
/*4 3. Initialize ThermalValues of rf_calibrate_info*/
|
||||
|
||||
if (p_rf_calibrate_info->is_reloadtxpowerindex)
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("reload ofdm index for band switch\n"));
|
||||
|
||||
/*4 4. Calculate average thermal meter*/
|
||||
|
||||
p_rf_calibrate_info->thermal_value_avg[p_rf_calibrate_info->thermal_value_avg_index] = thermal_value;
|
||||
p_rf_calibrate_info->thermal_value_avg_index++;
|
||||
if (p_rf_calibrate_info->thermal_value_avg_index == c.average_thermal_num) /*Average times = c.average_thermal_num*/
|
||||
p_rf_calibrate_info->thermal_value_avg_index = 0;
|
||||
|
||||
for (i = 0; i < c.average_thermal_num; i++) {
|
||||
if (p_rf_calibrate_info->thermal_value_avg[i]) {
|
||||
thermal_value_avg += p_rf_calibrate_info->thermal_value_avg[i];
|
||||
thermal_value_avg_count++;
|
||||
}
|
||||
}
|
||||
|
||||
if (thermal_value_avg_count) { /* Calculate Average thermal_value after average enough times */
|
||||
thermal_value = (u8)(thermal_value_avg / thermal_value_avg_count);
|
||||
p_rf_calibrate_info->thermal_value_delta = thermal_value - p_hal_data->eeprom_thermal_meter;
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("AVG Thermal Meter = 0x%X, EFUSE Thermal base = 0x%X\n", thermal_value, p_hal_data->eeprom_thermal_meter));
|
||||
}
|
||||
|
||||
/* 4 5. Calculate delta, delta_LCK, delta_IQK. */
|
||||
|
||||
/* "delta" here is used to determine whether thermal value changes or not. */
|
||||
delta = (thermal_value > p_rf_calibrate_info->thermal_value) ? (thermal_value - p_rf_calibrate_info->thermal_value) : (p_rf_calibrate_info->thermal_value - thermal_value);
|
||||
delta_LCK = (thermal_value > p_rf_calibrate_info->thermal_value_lck) ? (thermal_value - p_rf_calibrate_info->thermal_value_lck) : (p_rf_calibrate_info->thermal_value_lck - thermal_value);
|
||||
delta_IQK = (thermal_value > p_rf_calibrate_info->thermal_value_iqk) ? (thermal_value - p_rf_calibrate_info->thermal_value_iqk) : (p_rf_calibrate_info->thermal_value_iqk - thermal_value);
|
||||
|
||||
if (p_rf_calibrate_info->thermal_value_iqk == 0xff) { /*no PG, use thermal value for IQK*/
|
||||
p_rf_calibrate_info->thermal_value_iqk = thermal_value;
|
||||
delta_IQK = (thermal_value > p_rf_calibrate_info->thermal_value_iqk) ? (thermal_value - p_rf_calibrate_info->thermal_value_iqk) : (p_rf_calibrate_info->thermal_value_iqk - thermal_value);
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("no PG, use thermal_value for IQK\n"));
|
||||
}
|
||||
|
||||
for (p = ODM_RF_PATH_A; p < c.rf_path_count; p++)
|
||||
diff_DPK[p] = (s8)thermal_value - (s8)p_rf_calibrate_info->dpk_thermal[p];
|
||||
|
||||
/*4 6. If necessary, do LCK.*/
|
||||
|
||||
if (!(p_dm_odm->support_ic_type & ODM_RTL8821)) { /*no PG, do LCK at initial status*/
|
||||
if (p_rf_calibrate_info->thermal_value_lck == 0xff) {
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("no PG, do LCK\n"));
|
||||
p_rf_calibrate_info->thermal_value_lck = thermal_value;
|
||||
|
||||
/*Use RTLCK, so close power tracking driver LCK*/
|
||||
if (!(p_dm_odm->support_ic_type & ODM_RTL8814A)) {
|
||||
if (c.phy_lc_calibrate)
|
||||
(*c.phy_lc_calibrate)(p_dm_odm);
|
||||
}
|
||||
|
||||
delta_LCK = (thermal_value > p_rf_calibrate_info->thermal_value_lck) ? (thermal_value - p_rf_calibrate_info->thermal_value_lck) : (p_rf_calibrate_info->thermal_value_lck - thermal_value);
|
||||
}
|
||||
|
||||
ODM_RT_TRACE(p_dm_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(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("delta_LCK(%d) >= threshold_iqk(%d)\n", delta_LCK, c.threshold_iqk));
|
||||
p_rf_calibrate_info->thermal_value_lck = thermal_value;
|
||||
|
||||
/*Use RTLCK, so close power tracking driver LCK*/
|
||||
if (!(p_dm_odm->support_ic_type & ODM_RTL8814A)) {
|
||||
if (c.phy_lc_calibrate)
|
||||
(*c.phy_lc_calibrate)(p_dm_odm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*3 7. If necessary, move the index of swing table to adjust Tx power.*/
|
||||
|
||||
if (delta > 0 && p_rf_calibrate_info->txpowertrack_control) {
|
||||
/* "delta" here is used to record the absolute value of differrence. */
|
||||
#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
|
||||
delta = thermal_value > p_hal_data->eeprom_thermal_meter ? (thermal_value - p_hal_data->eeprom_thermal_meter) : (p_hal_data->eeprom_thermal_meter - thermal_value);
|
||||
#else
|
||||
delta = (thermal_value > p_dm_odm->priv->pmib->dot11RFEntry.ther) ? (thermal_value - p_dm_odm->priv->pmib->dot11RFEntry.ther) : (p_dm_odm->priv->pmib->dot11RFEntry.ther - thermal_value);
|
||||
#endif
|
||||
if (delta >= TXPWR_TRACK_TABLE_SIZE)
|
||||
delta = TXPWR_TRACK_TABLE_SIZE - 1;
|
||||
|
||||
/*4 7.1 The Final Power index = BaseIndex + power_index_offset*/
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
|
||||
if (thermal_value > p_hal_data->eeprom_thermal_meter) {
|
||||
#else
|
||||
if (thermal_value > p_dm_odm->priv->pmib->dot11RFEntry.ther) {
|
||||
#endif
|
||||
|
||||
for (p = ODM_RF_PATH_A; p < c.rf_path_count; p++) {
|
||||
p_rf_calibrate_info->delta_power_index_last[p] = p_rf_calibrate_info->delta_power_index[p]; /*recording poer index offset*/
|
||||
switch (p) {
|
||||
case ODM_RF_PATH_B:
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("delta_swing_table_idx_tup_b[%d] = %d\n", delta, delta_swing_table_idx_tup_b[delta]));
|
||||
|
||||
p_rf_calibrate_info->delta_power_index[p] = delta_swing_table_idx_tup_b[delta];
|
||||
p_rf_calibrate_info->absolute_ofdm_swing_idx[p] = delta_swing_table_idx_tup_b[delta]; /*Record delta swing for mix mode power tracking*/
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("******Temp is higher and p_rf_calibrate_info->absolute_ofdm_swing_idx[ODM_RF_PATH_B] = %d\n", p_rf_calibrate_info->absolute_ofdm_swing_idx[p]));
|
||||
break;
|
||||
|
||||
case ODM_RF_PATH_C:
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("delta_swing_table_idx_tup_c[%d] = %d\n", delta, delta_swing_table_idx_tup_c[delta]));
|
||||
|
||||
p_rf_calibrate_info->delta_power_index[p] = delta_swing_table_idx_tup_c[delta];
|
||||
p_rf_calibrate_info->absolute_ofdm_swing_idx[p] = delta_swing_table_idx_tup_c[delta]; /*Record delta swing for mix mode power tracking*/
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("******Temp is higher and p_rf_calibrate_info->absolute_ofdm_swing_idx[ODM_RF_PATH_C] = %d\n", p_rf_calibrate_info->absolute_ofdm_swing_idx[p]));
|
||||
break;
|
||||
|
||||
case ODM_RF_PATH_D:
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("delta_swing_table_idx_tup_d[%d] = %d\n", delta, delta_swing_table_idx_tup_d[delta]));
|
||||
|
||||
p_rf_calibrate_info->delta_power_index[p] = delta_swing_table_idx_tup_d[delta];
|
||||
p_rf_calibrate_info->absolute_ofdm_swing_idx[p] = delta_swing_table_idx_tup_d[delta]; /*Record delta swing for mix mode power tracking*/
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("******Temp is higher and p_rf_calibrate_info->absolute_ofdm_swing_idx[ODM_RF_PATH_D] = %d\n", p_rf_calibrate_info->absolute_ofdm_swing_idx[p]));
|
||||
break;
|
||||
|
||||
default:
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("delta_swing_table_idx_tup_a[%d] = %d\n", delta, delta_swing_table_idx_tup_a[delta]));
|
||||
|
||||
p_rf_calibrate_info->delta_power_index[p] = delta_swing_table_idx_tup_a[delta];
|
||||
p_rf_calibrate_info->absolute_ofdm_swing_idx[p] = delta_swing_table_idx_tup_a[delta]; /*Record delta swing for mix mode power tracking*/
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("******Temp is higher and p_rf_calibrate_info->absolute_ofdm_swing_idx[ODM_RF_PATH_A] = %d\n", p_rf_calibrate_info->absolute_ofdm_swing_idx[p]));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (p_dm_odm->support_ic_type & (ODM_RTL8703B | ODM_RTL8723D)) {
|
||||
/*Save xtal_offset from Xtal table*/
|
||||
p_rf_calibrate_info->xtal_offset_last = p_rf_calibrate_info->xtal_offset; /*recording last Xtal offset*/
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("[Xtal] delta_swing_table_xtal_up[%d] = %d\n", delta, delta_swing_table_xtal_up[delta]));
|
||||
p_rf_calibrate_info->xtal_offset = delta_swing_table_xtal_up[delta];
|
||||
|
||||
if (p_rf_calibrate_info->xtal_offset_last == p_rf_calibrate_info->xtal_offset)
|
||||
xtal_offset_eanble = 0;
|
||||
else
|
||||
xtal_offset_eanble = 1;
|
||||
}
|
||||
|
||||
} else {
|
||||
for (p = ODM_RF_PATH_A; p < c.rf_path_count; p++) {
|
||||
p_rf_calibrate_info->delta_power_index_last[p] = p_rf_calibrate_info->delta_power_index[p]; /*recording poer index offset*/
|
||||
|
||||
switch (p) {
|
||||
case ODM_RF_PATH_B:
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("delta_swing_table_idx_tdown_b[%d] = %d\n", delta, delta_swing_table_idx_tdown_b[delta]));
|
||||
p_rf_calibrate_info->delta_power_index[p] = -1 * delta_swing_table_idx_tdown_b[delta];
|
||||
p_rf_calibrate_info->absolute_ofdm_swing_idx[p] = -1 * delta_swing_table_idx_tdown_b[delta]; /*Record delta swing for mix mode power tracking*/
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("******Temp is lower and p_rf_calibrate_info->absolute_ofdm_swing_idx[ODM_RF_PATH_B] = %d\n", p_rf_calibrate_info->absolute_ofdm_swing_idx[p]));
|
||||
break;
|
||||
|
||||
case ODM_RF_PATH_C:
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("delta_swing_table_idx_tdown_c[%d] = %d\n", delta, delta_swing_table_idx_tdown_c[delta]));
|
||||
p_rf_calibrate_info->delta_power_index[p] = -1 * delta_swing_table_idx_tdown_c[delta];
|
||||
p_rf_calibrate_info->absolute_ofdm_swing_idx[p] = -1 * delta_swing_table_idx_tdown_c[delta]; /*Record delta swing for mix mode power tracking*/
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("******Temp is lower and p_rf_calibrate_info->absolute_ofdm_swing_idx[ODM_RF_PATH_C] = %d\n", p_rf_calibrate_info->absolute_ofdm_swing_idx[p]));
|
||||
break;
|
||||
|
||||
case ODM_RF_PATH_D:
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("delta_swing_table_idx_tdown_d[%d] = %d\n", delta, delta_swing_table_idx_tdown_d[delta]));
|
||||
p_rf_calibrate_info->delta_power_index[p] = -1 * delta_swing_table_idx_tdown_d[delta];
|
||||
p_rf_calibrate_info->absolute_ofdm_swing_idx[p] = -1 * delta_swing_table_idx_tdown_d[delta]; /*Record delta swing for mix mode power tracking*/
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("******Temp is lower and p_rf_calibrate_info->absolute_ofdm_swing_idx[ODM_RF_PATH_D] = %d\n", p_rf_calibrate_info->absolute_ofdm_swing_idx[p]));
|
||||
break;
|
||||
|
||||
default:
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("delta_swing_table_idx_tdown_a[%d] = %d\n", delta, delta_swing_table_idx_tdown_a[delta]));
|
||||
p_rf_calibrate_info->delta_power_index[p] = -1 * delta_swing_table_idx_tdown_a[delta];
|
||||
p_rf_calibrate_info->absolute_ofdm_swing_idx[p] = -1 * delta_swing_table_idx_tdown_a[delta]; /*Record delta swing for mix mode power tracking*/
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("******Temp is lower and p_rf_calibrate_info->absolute_ofdm_swing_idx[ODM_RF_PATH_A] = %d\n", p_rf_calibrate_info->absolute_ofdm_swing_idx[p]));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (p_dm_odm->support_ic_type & (ODM_RTL8703B | ODM_RTL8723D)) {
|
||||
/*Save xtal_offset from Xtal table*/
|
||||
p_rf_calibrate_info->xtal_offset_last = p_rf_calibrate_info->xtal_offset; /*recording last Xtal offset*/
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("[Xtal] delta_swing_table_xtal_down[%d] = %d\n", delta, delta_swing_table_xtal_down[delta]));
|
||||
p_rf_calibrate_info->xtal_offset = delta_swing_table_xtal_down[delta];
|
||||
|
||||
if (p_rf_calibrate_info->xtal_offset_last == p_rf_calibrate_info->xtal_offset)
|
||||
xtal_offset_eanble = 0;
|
||||
else
|
||||
xtal_offset_eanble = 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for (p = ODM_RF_PATH_A; p < c.rf_path_count; p++) {
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("\n\n=========================== [path-%d] Calculating power_index_offset===========================\n", p));
|
||||
|
||||
if (p_rf_calibrate_info->delta_power_index[p] == p_rf_calibrate_info->delta_power_index_last[p]) /*If Thermal value changes but lookup table value still the same*/
|
||||
p_rf_calibrate_info->power_index_offset[p] = 0;
|
||||
else
|
||||
p_rf_calibrate_info->power_index_offset[p] = p_rf_calibrate_info->delta_power_index[p] - p_rf_calibrate_info->delta_power_index_last[p]; /*Power index diff between 2 times Power Tracking*/
|
||||
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("[path-%d] power_index_offset(%d) = delta_power_index(%d) - delta_power_index_last(%d)\n", p, p_rf_calibrate_info->power_index_offset[p], p_rf_calibrate_info->delta_power_index[p], p_rf_calibrate_info->delta_power_index_last[p]));
|
||||
|
||||
p_rf_calibrate_info->OFDM_index[p] = p_rf_calibrate_info->bb_swing_idx_ofdm_base[p] + p_rf_calibrate_info->power_index_offset[p];
|
||||
p_rf_calibrate_info->CCK_index = p_rf_calibrate_info->bb_swing_idx_cck_base + p_rf_calibrate_info->power_index_offset[p];
|
||||
|
||||
p_rf_calibrate_info->bb_swing_idx_cck = p_rf_calibrate_info->CCK_index;
|
||||
p_rf_calibrate_info->bb_swing_idx_ofdm[p] = p_rf_calibrate_info->OFDM_index[p];
|
||||
|
||||
/*************Print BB Swing base and index Offset*************/
|
||||
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("The 'CCK' final index(%d) = BaseIndex(%d) + power_index_offset(%d)\n", p_rf_calibrate_info->bb_swing_idx_cck, p_rf_calibrate_info->bb_swing_idx_cck_base, p_rf_calibrate_info->power_index_offset[p]));
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("The 'OFDM' final index(%d) = BaseIndex[%d](%d) + power_index_offset(%d)\n", p_rf_calibrate_info->bb_swing_idx_ofdm[p], p, p_rf_calibrate_info->bb_swing_idx_ofdm_base[p], p_rf_calibrate_info->power_index_offset[p]));
|
||||
|
||||
/*4 7.1 Handle boundary conditions of index.*/
|
||||
|
||||
if (p_rf_calibrate_info->OFDM_index[p] > c.swing_table_size_ofdm - 1)
|
||||
p_rf_calibrate_info->OFDM_index[p] = c.swing_table_size_ofdm - 1;
|
||||
else if (p_rf_calibrate_info->OFDM_index[p] <= OFDM_min_index)
|
||||
p_rf_calibrate_info->OFDM_index[p] = OFDM_min_index;
|
||||
}
|
||||
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("\n\n========================================================================================================\n"));
|
||||
|
||||
if (p_rf_calibrate_info->CCK_index > c.swing_table_size_cck - 1)
|
||||
p_rf_calibrate_info->CCK_index = c.swing_table_size_cck - 1;
|
||||
else if (p_rf_calibrate_info->CCK_index <= 0)
|
||||
p_rf_calibrate_info->CCK_index = 0;
|
||||
} else {
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("The thermal meter is unchanged or TxPowerTracking OFF(%d): thermal_value: %d, p_rf_calibrate_info->thermal_value: %d\n",
|
||||
p_rf_calibrate_info->txpowertrack_control, thermal_value, p_rf_calibrate_info->thermal_value));
|
||||
|
||||
for (p = ODM_RF_PATH_A; p < c.rf_path_count; p++)
|
||||
p_rf_calibrate_info->power_index_offset[p] = 0;
|
||||
}
|
||||
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("TxPowerTracking: [CCK] Swing Current index: %d, Swing base index: %d\n",
|
||||
p_rf_calibrate_info->CCK_index, p_rf_calibrate_info->bb_swing_idx_cck_base)); /*Print Swing base & current*/
|
||||
|
||||
for (p = ODM_RF_PATH_A; p < c.rf_path_count; p++) {
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("TxPowerTracking: [OFDM] Swing Current index: %d, Swing base index[%d]: %d\n",
|
||||
p_rf_calibrate_info->OFDM_index[p], p, p_rf_calibrate_info->bb_swing_idx_ofdm_base[p]));
|
||||
}
|
||||
|
||||
if ((p_dm_odm->support_ic_type & ODM_RTL8814A)) {
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("power_tracking_type=%d\n", power_tracking_type));
|
||||
|
||||
if (power_tracking_type == 0) {
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("**********Enter POWER Tracking MIX_MODE**********\n"));
|
||||
for (p = ODM_RF_PATH_A; p < c.rf_path_count; p++)
|
||||
(*c.odm_tx_pwr_track_set_pwr)(p_dm_odm, MIX_MODE, p, 0);
|
||||
} else if (power_tracking_type == 1) {
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("**********Enter POWER Tracking MIX(2G) TSSI(5G) MODE**********\n"));
|
||||
for (p = ODM_RF_PATH_A; p < c.rf_path_count; p++)
|
||||
(*c.odm_tx_pwr_track_set_pwr)(p_dm_odm, MIX_2G_TSSI_5G_MODE, p, 0);
|
||||
} else if (power_tracking_type == 2) {
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("**********Enter POWER Tracking MIX(5G) TSSI(2G)MODE**********\n"));
|
||||
for (p = ODM_RF_PATH_A; p < c.rf_path_count; p++)
|
||||
(*c.odm_tx_pwr_track_set_pwr)(p_dm_odm, MIX_5G_TSSI_2G_MODE, p, 0);
|
||||
} else if (power_tracking_type == 3) {
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("**********Enter POWER Tracking TSSI MODE**********\n"));
|
||||
for (p = ODM_RF_PATH_A; p < c.rf_path_count; p++)
|
||||
(*c.odm_tx_pwr_track_set_pwr)(p_dm_odm, TSSI_MODE, p, 0);
|
||||
}
|
||||
p_rf_calibrate_info->thermal_value = thermal_value; /*Record last Power Tracking Thermal value*/
|
||||
|
||||
} else if ((p_rf_calibrate_info->power_index_offset[ODM_RF_PATH_A] != 0 ||
|
||||
p_rf_calibrate_info->power_index_offset[ODM_RF_PATH_B] != 0 ||
|
||||
p_rf_calibrate_info->power_index_offset[ODM_RF_PATH_C] != 0 ||
|
||||
p_rf_calibrate_info->power_index_offset[ODM_RF_PATH_D] != 0) &&
|
||||
p_rf_calibrate_info->txpowertrack_control && (p_hal_data->eeprom_thermal_meter != 0xff)) {
|
||||
/* 4 7.2 Configure the Swing Table to adjust Tx Power. */
|
||||
|
||||
p_rf_calibrate_info->is_tx_power_changed = 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 (thermal_value > p_rf_calibrate_info->thermal_value) {
|
||||
for (p = ODM_RF_PATH_A; p < c.rf_path_count; p++) {
|
||||
ODM_RT_TRACE(p_dm_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, p_rf_calibrate_info->power_index_offset[p], delta, thermal_value, p_hal_data->eeprom_thermal_meter, p_rf_calibrate_info->thermal_value));
|
||||
}
|
||||
} else if (thermal_value < p_rf_calibrate_info->thermal_value) { /*Low temperature*/
|
||||
for (p = ODM_RF_PATH_A; p < c.rf_path_count; p++) {
|
||||
ODM_RT_TRACE(p_dm_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, p_rf_calibrate_info->power_index_offset[p], delta, thermal_value, p_hal_data->eeprom_thermal_meter, p_rf_calibrate_info->thermal_value));
|
||||
}
|
||||
}
|
||||
|
||||
#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
|
||||
if (thermal_value > p_hal_data->eeprom_thermal_meter)
|
||||
#else
|
||||
if (thermal_value > p_dm_odm->priv->pmib->dot11RFEntry.ther)
|
||||
#endif
|
||||
{
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("Temperature(%d) higher than PG value(%d)\n", thermal_value, p_hal_data->eeprom_thermal_meter));
|
||||
|
||||
if (p_dm_odm->support_ic_type == ODM_RTL8188E || p_dm_odm->support_ic_type == ODM_RTL8192E || p_dm_odm->support_ic_type == ODM_RTL8821 ||
|
||||
p_dm_odm->support_ic_type == ODM_RTL8812 || p_dm_odm->support_ic_type == ODM_RTL8723B || p_dm_odm->support_ic_type == ODM_RTL8814A ||
|
||||
p_dm_odm->support_ic_type == ODM_RTL8703B || p_dm_odm->support_ic_type == ODM_RTL8188F || p_dm_odm->support_ic_type == ODM_RTL8822B ||
|
||||
p_dm_odm->support_ic_type == ODM_RTL8723D || p_dm_odm->support_ic_type == ODM_RTL8821C) {
|
||||
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("**********Enter POWER Tracking MIX_MODE**********\n"));
|
||||
for (p = ODM_RF_PATH_A; p < c.rf_path_count; p++)
|
||||
(*c.odm_tx_pwr_track_set_pwr)(p_dm_odm, MIX_MODE, p, 0);
|
||||
} else {
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("**********Enter POWER Tracking BBSWING_MODE**********\n"));
|
||||
for (p = ODM_RF_PATH_A; p < c.rf_path_count; p++)
|
||||
(*c.odm_tx_pwr_track_set_pwr)(p_dm_odm, BBSWING, p, indexforchannel);
|
||||
}
|
||||
} else {
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("Temperature(%d) lower than PG value(%d)\n", thermal_value, p_hal_data->eeprom_thermal_meter));
|
||||
|
||||
if (p_dm_odm->support_ic_type == ODM_RTL8188E || p_dm_odm->support_ic_type == ODM_RTL8192E || p_dm_odm->support_ic_type == ODM_RTL8821 ||
|
||||
p_dm_odm->support_ic_type == ODM_RTL8812 || p_dm_odm->support_ic_type == ODM_RTL8723B || p_dm_odm->support_ic_type == ODM_RTL8814A ||
|
||||
p_dm_odm->support_ic_type == ODM_RTL8703B || p_dm_odm->support_ic_type == ODM_RTL8188F || p_dm_odm->support_ic_type == ODM_RTL8822B ||
|
||||
p_dm_odm->support_ic_type == ODM_RTL8723D || p_dm_odm->support_ic_type == ODM_RTL8821C) {
|
||||
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("**********Enter POWER Tracking MIX_MODE**********\n"));
|
||||
for (p = ODM_RF_PATH_A; p < c.rf_path_count; p++)
|
||||
(*c.odm_tx_pwr_track_set_pwr)(p_dm_odm, MIX_MODE, p, indexforchannel);
|
||||
} else {
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("**********Enter POWER Tracking BBSWING_MODE**********\n"));
|
||||
for (p = ODM_RF_PATH_A; p < c.rf_path_count; p++)
|
||||
(*c.odm_tx_pwr_track_set_pwr)(p_dm_odm, BBSWING, p, indexforchannel);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
p_rf_calibrate_info->bb_swing_idx_cck_base = p_rf_calibrate_info->bb_swing_idx_cck; /*Record last time Power Tracking result as base.*/
|
||||
for (p = ODM_RF_PATH_A; p < c.rf_path_count; p++)
|
||||
p_rf_calibrate_info->bb_swing_idx_ofdm_base[p] = p_rf_calibrate_info->bb_swing_idx_ofdm[p];
|
||||
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("p_rf_calibrate_info->thermal_value = %d thermal_value= %d\n", p_rf_calibrate_info->thermal_value, thermal_value));
|
||||
|
||||
p_rf_calibrate_info->thermal_value = thermal_value; /*Record last Power Tracking Thermal value*/
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (p_dm_odm->support_ic_type == ODM_RTL8703B || p_dm_odm->support_ic_type == ODM_RTL8723D) {
|
||||
|
||||
if (xtal_offset_eanble != 0 && p_rf_calibrate_info->txpowertrack_control && (p_hal_data->eeprom_thermal_meter != 0xff)) {
|
||||
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("**********Enter Xtal Tracking**********\n"));
|
||||
|
||||
#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
|
||||
if (thermal_value > p_hal_data->eeprom_thermal_meter) {
|
||||
#else
|
||||
if (thermal_value > p_dm_odm->priv->pmib->dot11RFEntry.ther) {
|
||||
#endif
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("Temperature(%d) higher than PG value(%d)\n", thermal_value, p_hal_data->eeprom_thermal_meter));
|
||||
(*c.odm_txxtaltrack_set_xtal)(p_dm_odm);
|
||||
} else {
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("Temperature(%d) lower than PG value(%d)\n", thermal_value, p_hal_data->eeprom_thermal_meter));
|
||||
(*c.odm_txxtaltrack_set_xtal)(p_dm_odm);
|
||||
}
|
||||
}
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("**********End Xtal Tracking**********\n"));
|
||||
}
|
||||
|
||||
#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) {
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("delta_IQK(%d) >= threshold_iqk(%d)\n", delta_IQK, c.threshold_iqk));
|
||||
if (!p_rf_calibrate_info->is_iqk_in_progress)
|
||||
(*c.do_iqk)(p_dm_odm, delta_IQK, thermal_value, 8);
|
||||
}
|
||||
}
|
||||
if (p_rf_calibrate_info->dpk_thermal[ODM_RF_PATH_A] != 0) {
|
||||
if (diff_DPK[ODM_RF_PATH_A] >= c.threshold_dpk) {
|
||||
odm_set_bb_reg(p_dm_odm, 0x82c, BIT(31), 0x1);
|
||||
odm_set_bb_reg(p_dm_odm, 0xcc4, BIT(14) | BIT(13) | BIT(12) | BIT(11) | BIT(10), (diff_DPK[ODM_RF_PATH_A] / c.threshold_dpk));
|
||||
odm_set_bb_reg(p_dm_odm, 0x82c, BIT(31), 0x0);
|
||||
} else if ((diff_DPK[ODM_RF_PATH_A] <= -1 * c.threshold_dpk)) {
|
||||
s32 value = 0x20 + (diff_DPK[ODM_RF_PATH_A] / c.threshold_dpk);
|
||||
|
||||
odm_set_bb_reg(p_dm_odm, 0x82c, BIT(31), 0x1);
|
||||
odm_set_bb_reg(p_dm_odm, 0xcc4, BIT(14) | BIT(13) | BIT(12) | BIT(11) | BIT(10), value);
|
||||
odm_set_bb_reg(p_dm_odm, 0x82c, BIT(31), 0x0);
|
||||
} else {
|
||||
odm_set_bb_reg(p_dm_odm, 0x82c, BIT(31), 0x1);
|
||||
odm_set_bb_reg(p_dm_odm, 0xcc4, BIT(14) | BIT(13) | BIT(12) | BIT(11) | BIT(10), 0);
|
||||
odm_set_bb_reg(p_dm_odm, 0x82c, BIT(31), 0x0);
|
||||
}
|
||||
}
|
||||
if (p_rf_calibrate_info->dpk_thermal[ODM_RF_PATH_B] != 0) {
|
||||
if (diff_DPK[ODM_RF_PATH_B] >= c.threshold_dpk) {
|
||||
odm_set_bb_reg(p_dm_odm, 0x82c, BIT(31), 0x1);
|
||||
odm_set_bb_reg(p_dm_odm, 0xec4, BIT(14) | BIT(13) | BIT(12) | BIT(11) | BIT(10), (diff_DPK[ODM_RF_PATH_B] / c.threshold_dpk));
|
||||
odm_set_bb_reg(p_dm_odm, 0x82c, BIT(31), 0x0);
|
||||
} else if ((diff_DPK[ODM_RF_PATH_B] <= -1 * c.threshold_dpk)) {
|
||||
s32 value = 0x20 + (diff_DPK[ODM_RF_PATH_B] / c.threshold_dpk);
|
||||
|
||||
odm_set_bb_reg(p_dm_odm, 0x82c, BIT(31), 0x1);
|
||||
odm_set_bb_reg(p_dm_odm, 0xec4, BIT(14) | BIT(13) | BIT(12) | BIT(11) | BIT(10), value);
|
||||
odm_set_bb_reg(p_dm_odm, 0x82c, BIT(31), 0x0);
|
||||
} else {
|
||||
odm_set_bb_reg(p_dm_odm, 0x82c, BIT(31), 0x1);
|
||||
odm_set_bb_reg(p_dm_odm, 0xec4, BIT(14) | BIT(13) | BIT(12) | BIT(11) | BIT(10), 0);
|
||||
odm_set_bb_reg(p_dm_odm, 0x82c, BIT(31), 0x0);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("<===odm_txpowertracking_callback_thermal_meter\n"));
|
||||
|
||||
p_rf_calibrate_info->tx_powercount = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* 3============================================================
|
||||
* 3 IQ Calibration
|
||||
* 3============================================================ */
|
||||
|
||||
void
|
||||
odm_reset_iqk_result(
|
||||
void *p_dm_void
|
||||
)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
|
||||
u8 odm_get_right_chnl_place_for_iqk(u8 chnl)
|
||||
{
|
||||
u8 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
|
||||
};
|
||||
u8 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_iq_calibrate(
|
||||
struct PHY_DM_STRUCT *p_dm_odm
|
||||
)
|
||||
{
|
||||
struct _ADAPTER *adapter = p_dm_odm->adapter;
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
|
||||
if (*p_dm_odm->p_is_fcs_mode_enable)
|
||||
return;
|
||||
#endif
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE & (ODM_CE))
|
||||
if (IS_HARDWARE_TYPE_8812AU(adapter))
|
||||
return;
|
||||
#endif
|
||||
|
||||
if (p_dm_odm->is_linked) {
|
||||
if ((*p_dm_odm->p_channel != p_dm_odm->pre_channel) && (!*p_dm_odm->p_is_scan_in_process)) {
|
||||
p_dm_odm->pre_channel = *p_dm_odm->p_channel;
|
||||
p_dm_odm->linked_interval = 0;
|
||||
}
|
||||
|
||||
if (p_dm_odm->linked_interval < 3)
|
||||
p_dm_odm->linked_interval++;
|
||||
|
||||
if (p_dm_odm->linked_interval == 2) {
|
||||
if (IS_HARDWARE_TYPE_8814A(adapter)) {
|
||||
#if (RTL8814A_SUPPORT == 1)
|
||||
phy_iq_calibrate_8814a(p_dm_odm, false);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if (RTL8822B_SUPPORT == 1)
|
||||
else if (IS_HARDWARE_TYPE_8822B(adapter))
|
||||
phy_iq_calibrate_8822b(p_dm_odm, false);
|
||||
#endif
|
||||
|
||||
#if (RTL8821C_SUPPORT == 1)
|
||||
else if (IS_HARDWARE_TYPE_8821C(adapter))
|
||||
phy_iq_calibrate_8821c(p_dm_odm, false);
|
||||
#endif
|
||||
|
||||
#if (RTL8821A_SUPPORT == 1)
|
||||
else if (IS_HARDWARE_TYPE_8821(adapter))
|
||||
phy_iq_calibrate_8821a(p_dm_odm, false);
|
||||
#endif
|
||||
}
|
||||
} else
|
||||
p_dm_odm->linked_interval = 0;
|
||||
}
|
||||
|
||||
void phydm_rf_init(void *p_dm_void)
|
||||
{
|
||||
struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
|
||||
odm_txpowertracking_init(p_dm_odm);
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
|
||||
odm_clear_txpowertracking_state(p_dm_odm);
|
||||
#endif
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
|
||||
#if (RTL8814A_SUPPORT == 1)
|
||||
if (p_dm_odm->support_ic_type & ODM_RTL8814A)
|
||||
phy_iq_calibrate_8814a_init(p_dm_odm);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void phydm_rf_watchdog(void *p_dm_void)
|
||||
{
|
||||
struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
|
||||
#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
|
||||
odm_txpowertracking_check(p_dm_odm);
|
||||
if (p_dm_odm->support_ic_type & ODM_IC_11AC_SERIES)
|
||||
odm_iq_calibrate(p_dm_odm);
|
||||
#endif
|
||||
}
|
117
hal/phydm/halphyrf_ce.h
Normal file
117
hal/phydm/halphyrf_ce.h
Normal file
|
@ -0,0 +1,117 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* 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
|
||||
|
||||
#if (RTL8821C_SUPPORT == 1)
|
||||
#include "rtl8821c/phydm_iqk_8821c.h"
|
||||
#endif
|
||||
|
||||
#include "phydm_powertracking_ce.h"
|
||||
|
||||
|
||||
enum spur_cal_method {
|
||||
PLL_RESET,
|
||||
AFE_PHASE_SEL
|
||||
};
|
||||
|
||||
enum pwrtrack_method {
|
||||
BBSWING,
|
||||
TXAGC,
|
||||
MIX_MODE,
|
||||
TSSI_MODE,
|
||||
MIX_2G_TSSI_5G_MODE,
|
||||
MIX_5G_TSSI_2G_MODE
|
||||
};
|
||||
|
||||
typedef void (*func_set_pwr)(void *, enum pwrtrack_method, u8, u8);
|
||||
typedef void(*func_iqk)(void *, u8, u8, u8);
|
||||
typedef void (*func_lck)(void *);
|
||||
typedef void (*func_swing)(void *, u8 **, u8 **, u8 **, u8 **);
|
||||
typedef void (*func_swing8814only)(void *, u8 **, u8 **, u8 **, u8 **);
|
||||
typedef void(*func_swing_xtal)(void *, s8 **, s8 **);
|
||||
typedef void(*func_set_xtal)(void *);
|
||||
|
||||
struct _TXPWRTRACK_CFG {
|
||||
u8 swing_table_size_cck;
|
||||
u8 swing_table_size_ofdm;
|
||||
u8 threshold_iqk;
|
||||
u8 threshold_dpk;
|
||||
u8 average_thermal_num;
|
||||
u8 rf_path_count;
|
||||
u32 thermal_reg_addr;
|
||||
func_set_pwr odm_tx_pwr_track_set_pwr;
|
||||
func_iqk do_iqk;
|
||||
func_lck phy_lc_calibrate;
|
||||
func_swing get_delta_swing_table;
|
||||
func_swing8814only get_delta_swing_table8814only;
|
||||
func_swing_xtal get_delta_swing_xtal_table;
|
||||
func_set_xtal odm_txxtaltrack_set_xtal;
|
||||
};
|
||||
|
||||
void
|
||||
configure_txpower_track(
|
||||
void *p_dm_void,
|
||||
struct _TXPWRTRACK_CFG *p_config
|
||||
);
|
||||
|
||||
|
||||
void
|
||||
odm_clear_txpowertracking_state(
|
||||
void *p_dm_void
|
||||
);
|
||||
|
||||
void
|
||||
odm_txpowertracking_callback_thermal_meter(
|
||||
#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
|
||||
void *p_dm_void
|
||||
#else
|
||||
struct _ADAPTER *adapter
|
||||
#endif
|
||||
);
|
||||
|
||||
|
||||
|
||||
#define ODM_TARGET_CHNL_NUM_2G_5G 59
|
||||
|
||||
|
||||
void
|
||||
odm_reset_iqk_result(
|
||||
void *p_dm_void
|
||||
);
|
||||
u8
|
||||
odm_get_right_chnl_place_for_iqk(
|
||||
u8 chnl
|
||||
);
|
||||
|
||||
void phydm_rf_init(void *p_dm_void);
|
||||
void phydm_rf_watchdog(void *p_dm_void);
|
||||
|
||||
#endif /* #ifndef __HAL_PHY_RF_H__ */
|
784
hal/phydm/halphyrf_win.c
Normal file
784
hal/phydm/halphyrf_win.c
Normal file
|
@ -0,0 +1,784 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* 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, _delta_thermal) \
|
||||
do {\
|
||||
for (_offset = 0; _offset < _size; _offset++) { \
|
||||
\
|
||||
if (_delta_thermal < thermal_threshold[_direction][_offset]) { \
|
||||
\
|
||||
if (_offset != 0)\
|
||||
_offset--;\
|
||||
break;\
|
||||
} \
|
||||
} \
|
||||
if (_offset >= _size)\
|
||||
_offset = _size-1;\
|
||||
} while (0)
|
||||
|
||||
void configure_txpower_track(
|
||||
struct PHY_DM_STRUCT *p_dm_odm,
|
||||
struct _TXPWRTRACK_CFG *p_config
|
||||
)
|
||||
{
|
||||
#if RTL8192E_SUPPORT
|
||||
if (p_dm_odm->support_ic_type == ODM_RTL8192E)
|
||||
configure_txpower_track_8192e(p_config);
|
||||
#endif
|
||||
#if RTL8821A_SUPPORT
|
||||
if (p_dm_odm->support_ic_type == ODM_RTL8821)
|
||||
configure_txpower_track_8821a(p_config);
|
||||
#endif
|
||||
#if RTL8812A_SUPPORT
|
||||
if (p_dm_odm->support_ic_type == ODM_RTL8812)
|
||||
configure_txpower_track_8812a(p_config);
|
||||
#endif
|
||||
#if RTL8188E_SUPPORT
|
||||
if (p_dm_odm->support_ic_type == ODM_RTL8188E)
|
||||
configure_txpower_track_8188e(p_config);
|
||||
#endif
|
||||
|
||||
#if RTL8188F_SUPPORT
|
||||
if (p_dm_odm->support_ic_type == ODM_RTL8188F)
|
||||
configure_txpower_track_8188f(p_config);
|
||||
#endif
|
||||
|
||||
#if RTL8723B_SUPPORT
|
||||
if (p_dm_odm->support_ic_type == ODM_RTL8723B)
|
||||
configure_txpower_track_8723b(p_config);
|
||||
#endif
|
||||
|
||||
#if RTL8814A_SUPPORT
|
||||
if (p_dm_odm->support_ic_type == ODM_RTL8814A)
|
||||
configure_txpower_track_8814a(p_config);
|
||||
#endif
|
||||
|
||||
#if RTL8703B_SUPPORT
|
||||
if (p_dm_odm->support_ic_type == ODM_RTL8703B)
|
||||
configure_txpower_track_8703b(p_config);
|
||||
#endif
|
||||
|
||||
#if RTL8822B_SUPPORT
|
||||
if (p_dm_odm->support_ic_type == ODM_RTL8822B)
|
||||
configure_txpower_track_8822b(p_config);
|
||||
#endif
|
||||
|
||||
#if RTL8723D_SUPPORT
|
||||
if (p_dm_odm->support_ic_type == ODM_RTL8723D)
|
||||
configure_txpower_track_8723d(p_config);
|
||||
#endif
|
||||
|
||||
#if RTL8821C_SUPPORT
|
||||
if (p_dm_odm->support_ic_type == ODM_RTL8821C)
|
||||
configure_txpower_track_8821c(p_config);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
/* **********************************************************************
|
||||
* <20121113, Kordan> This function should be called when tx_agc 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_clear_txpowertracking_state(
|
||||
struct PHY_DM_STRUCT *p_dm_odm
|
||||
)
|
||||
{
|
||||
PHAL_DATA_TYPE p_hal_data = GET_HAL_DATA(p_dm_odm->adapter);
|
||||
u8 p = 0;
|
||||
struct odm_rf_calibration_structure *p_rf_calibrate_info = &(p_dm_odm->rf_calibrate_info);
|
||||
|
||||
p_rf_calibrate_info->bb_swing_idx_cck_base = p_rf_calibrate_info->default_cck_index;
|
||||
p_rf_calibrate_info->bb_swing_idx_cck = p_rf_calibrate_info->default_cck_index;
|
||||
p_rf_calibrate_info->CCK_index = 0;
|
||||
|
||||
for (p = ODM_RF_PATH_A; p < MAX_RF_PATH; ++p) {
|
||||
p_rf_calibrate_info->bb_swing_idx_ofdm_base[p] = p_rf_calibrate_info->default_ofdm_index;
|
||||
p_rf_calibrate_info->bb_swing_idx_ofdm[p] = p_rf_calibrate_info->default_ofdm_index;
|
||||
p_rf_calibrate_info->OFDM_index[p] = p_rf_calibrate_info->default_ofdm_index;
|
||||
|
||||
p_rf_calibrate_info->power_index_offset[p] = 0;
|
||||
p_rf_calibrate_info->delta_power_index[p] = 0;
|
||||
p_rf_calibrate_info->delta_power_index_last[p] = 0;
|
||||
|
||||
p_rf_calibrate_info->absolute_ofdm_swing_idx[p] = 0; /* Initial Mix mode power tracking*/
|
||||
p_rf_calibrate_info->remnant_ofdm_swing_idx[p] = 0;
|
||||
p_rf_calibrate_info->kfree_offset[p] = 0;
|
||||
}
|
||||
|
||||
p_rf_calibrate_info->modify_tx_agc_flag_path_a = false; /*Initial at Modify Tx Scaling mode*/
|
||||
p_rf_calibrate_info->modify_tx_agc_flag_path_b = false; /*Initial at Modify Tx Scaling mode*/
|
||||
p_rf_calibrate_info->modify_tx_agc_flag_path_c = false; /*Initial at Modify Tx Scaling mode*/
|
||||
p_rf_calibrate_info->modify_tx_agc_flag_path_d = false; /*Initial at Modify Tx Scaling mode*/
|
||||
p_rf_calibrate_info->remnant_cck_swing_idx = 0;
|
||||
p_rf_calibrate_info->thermal_value = p_hal_data->eeprom_thermal_meter;
|
||||
|
||||
p_rf_calibrate_info->modify_tx_agc_value_cck = 0; /* modify by Mingzhi.Guo */
|
||||
p_rf_calibrate_info->modify_tx_agc_value_ofdm = 0; /* modify by Mingzhi.Guo */
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
odm_txpowertracking_callback_thermal_meter(
|
||||
#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
|
||||
struct PHY_DM_STRUCT *p_dm_odm
|
||||
#else
|
||||
struct _ADAPTER *adapter
|
||||
#endif
|
||||
)
|
||||
{
|
||||
#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
|
||||
HAL_DATA_TYPE *p_hal_data = GET_HAL_DATA(adapter);
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
|
||||
struct PHY_DM_STRUCT *p_dm_odm = &p_hal_data->DM_OutSrc;
|
||||
#elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
|
||||
struct PHY_DM_STRUCT *p_dm_odm = &p_hal_data->odmpriv;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
struct odm_rf_calibration_structure *p_rf_calibrate_info = &(p_dm_odm->rf_calibrate_info);
|
||||
|
||||
u8 thermal_value = 0, delta, delta_LCK, delta_IQK, p = 0, i = 0;
|
||||
s8 diff_DPK[4] = {0};
|
||||
u8 thermal_value_avg_count = 0;
|
||||
u32 thermal_value_avg = 0, regc80, regcd0, regcd4, regab4;
|
||||
|
||||
u8 OFDM_min_index = 0; /* OFDM BB Swing should be less than +3.0dB, which is required by Arthur */
|
||||
u8 indexforchannel = 0; /* get_right_chnl_place_for_iqk(p_hal_data->current_channel) */
|
||||
u8 power_tracking_type = p_hal_data->RfPowerTrackingType;
|
||||
u8 xtal_offset_eanble = 0;
|
||||
|
||||
struct _TXPWRTRACK_CFG c;
|
||||
|
||||
/* 4 1. The following TWO tables decide the final index of OFDM/CCK swing table. */
|
||||
u8 *delta_swing_table_idx_tup_a = NULL;
|
||||
u8 *delta_swing_table_idx_tdown_a = NULL;
|
||||
u8 *delta_swing_table_idx_tup_b = NULL;
|
||||
u8 *delta_swing_table_idx_tdown_b = NULL;
|
||||
/*for 8814 add by Yu Chen*/
|
||||
u8 *delta_swing_table_idx_tup_c = NULL;
|
||||
u8 *delta_swing_table_idx_tdown_c = NULL;
|
||||
u8 *delta_swing_table_idx_tup_d = NULL;
|
||||
u8 *delta_swing_table_idx_tdown_d = NULL;
|
||||
/*for Xtal Offset by James.Tung*/
|
||||
s8 *delta_swing_table_xtal_up = NULL;
|
||||
s8 *delta_swing_table_xtal_down = NULL;
|
||||
|
||||
/* 4 2. Initilization ( 7 steps in total ) */
|
||||
|
||||
configure_txpower_track(p_dm_odm, &c);
|
||||
|
||||
(*c.get_delta_swing_table)(p_dm_odm, (u8 **)&delta_swing_table_idx_tup_a, (u8 **)&delta_swing_table_idx_tdown_a,
|
||||
(u8 **)&delta_swing_table_idx_tup_b, (u8 **)&delta_swing_table_idx_tdown_b);
|
||||
|
||||
if (p_dm_odm->support_ic_type & ODM_RTL8814A) /*for 8814 path C & D*/
|
||||
(*c.get_delta_swing_table8814only)(p_dm_odm, (u8 **)&delta_swing_table_idx_tup_c, (u8 **)&delta_swing_table_idx_tdown_c,
|
||||
(u8 **)&delta_swing_table_idx_tup_d, (u8 **)&delta_swing_table_idx_tdown_d);
|
||||
|
||||
if (p_dm_odm->support_ic_type & (ODM_RTL8703B | ODM_RTL8723D)) /*for Xtal Offset*/
|
||||
(*c.get_delta_swing_xtal_table)(p_dm_odm, (s8 **)&delta_swing_table_xtal_up, (s8 **)&delta_swing_table_xtal_down);
|
||||
|
||||
|
||||
p_rf_calibrate_info->txpowertracking_callback_cnt++; /*cosa add for debug*/
|
||||
p_rf_calibrate_info->is_txpowertracking_init = true;
|
||||
|
||||
/*p_rf_calibrate_info->txpowertrack_control = p_hal_data->txpowertrack_control;
|
||||
<Kordan> We should keep updating the control variable according to HalData.
|
||||
<Kordan> rf_calibrate_info.rega24 will be initialized when ODM HW configuring, but MP configures with para files. */
|
||||
#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
|
||||
#if (MP_DRIVER == 1)
|
||||
p_rf_calibrate_info->rega24 = 0x090e1317;
|
||||
#endif
|
||||
#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
|
||||
if (p_dm_odm->mp_mode == true)
|
||||
p_rf_calibrate_info->rega24 = 0x090e1317;
|
||||
#endif
|
||||
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("===>odm_txpowertracking_callback_thermal_meter\n p_rf_calibrate_info->bb_swing_idx_cck_base: %d, p_rf_calibrate_info->bb_swing_idx_ofdm_base[A]: %d, p_rf_calibrate_info->default_ofdm_index: %d\n",
|
||||
p_rf_calibrate_info->bb_swing_idx_cck_base, p_rf_calibrate_info->bb_swing_idx_ofdm_base[ODM_RF_PATH_A], p_rf_calibrate_info->default_ofdm_index));
|
||||
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("p_rf_calibrate_info->txpowertrack_control=%d, p_hal_data->eeprom_thermal_meter %d\n", p_rf_calibrate_info->txpowertrack_control, p_hal_data->eeprom_thermal_meter));
|
||||
thermal_value = (u8)odm_get_rf_reg(p_dm_odm, ODM_RF_PATH_A, c.thermal_reg_addr, 0xfc00); /* 0x42: RF Reg[15:10] 88E */
|
||||
|
||||
/*add log by zhao he, check c80/c94/c14/ca0 value*/
|
||||
if (p_dm_odm->support_ic_type == ODM_RTL8723D) {
|
||||
regc80 = odm_get_bb_reg(p_dm_odm, 0xc80, MASKDWORD);
|
||||
regcd0 = odm_get_bb_reg(p_dm_odm, 0xcd0, MASKDWORD);
|
||||
regcd4 = odm_get_bb_reg(p_dm_odm, 0xcd4, MASKDWORD);
|
||||
regab4 = odm_get_bb_reg(p_dm_odm, 0xab4, 0x000007FF);
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xc80 = 0x%x 0xcd0 = 0x%x 0xcd4 = 0x%x 0xab4 = 0x%x\n", regc80, regcd0, regcd4, regab4));
|
||||
}
|
||||
|
||||
if (!p_rf_calibrate_info->txpowertrack_control)
|
||||
return;
|
||||
|
||||
|
||||
/*4 3. Initialize ThermalValues of rf_calibrate_info*/
|
||||
|
||||
if (p_rf_calibrate_info->is_reloadtxpowerindex)
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("reload ofdm index for band switch\n"));
|
||||
|
||||
/*4 4. Calculate average thermal meter*/
|
||||
|
||||
p_rf_calibrate_info->thermal_value_avg[p_rf_calibrate_info->thermal_value_avg_index] = thermal_value;
|
||||
p_rf_calibrate_info->thermal_value_avg_index++;
|
||||
if (p_rf_calibrate_info->thermal_value_avg_index == c.average_thermal_num) /*Average times = c.average_thermal_num*/
|
||||
p_rf_calibrate_info->thermal_value_avg_index = 0;
|
||||
|
||||
for (i = 0; i < c.average_thermal_num; i++) {
|
||||
if (p_rf_calibrate_info->thermal_value_avg[i]) {
|
||||
thermal_value_avg += p_rf_calibrate_info->thermal_value_avg[i];
|
||||
thermal_value_avg_count++;
|
||||
}
|
||||
}
|
||||
|
||||
if (thermal_value_avg_count) { /* Calculate Average thermal_value after average enough times */
|
||||
thermal_value = (u8)(thermal_value_avg / thermal_value_avg_count);
|
||||
p_rf_calibrate_info->thermal_value_delta = thermal_value - p_hal_data->eeprom_thermal_meter;
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("AVG Thermal Meter = 0x%X, EFUSE Thermal base = 0x%X\n", thermal_value, p_hal_data->eeprom_thermal_meter));
|
||||
}
|
||||
|
||||
/* 4 5. Calculate delta, delta_LCK, delta_IQK. */
|
||||
|
||||
/* "delta" here is used to determine whether thermal value changes or not. */
|
||||
delta = (thermal_value > p_rf_calibrate_info->thermal_value) ? (thermal_value - p_rf_calibrate_info->thermal_value) : (p_rf_calibrate_info->thermal_value - thermal_value);
|
||||
delta_LCK = (thermal_value > p_rf_calibrate_info->thermal_value_lck) ? (thermal_value - p_rf_calibrate_info->thermal_value_lck) : (p_rf_calibrate_info->thermal_value_lck - thermal_value);
|
||||
delta_IQK = (thermal_value > p_rf_calibrate_info->thermal_value_iqk) ? (thermal_value - p_rf_calibrate_info->thermal_value_iqk) : (p_rf_calibrate_info->thermal_value_iqk - thermal_value);
|
||||
|
||||
if (p_rf_calibrate_info->thermal_value_iqk == 0xff) { /*no PG, use thermal value for IQK*/
|
||||
p_rf_calibrate_info->thermal_value_iqk = thermal_value;
|
||||
delta_IQK = (thermal_value > p_rf_calibrate_info->thermal_value_iqk) ? (thermal_value - p_rf_calibrate_info->thermal_value_iqk) : (p_rf_calibrate_info->thermal_value_iqk - thermal_value);
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("no PG, use thermal_value for IQK\n"));
|
||||
}
|
||||
|
||||
for (p = ODM_RF_PATH_A; p < c.rf_path_count; p++)
|
||||
diff_DPK[p] = (s8)thermal_value - (s8)p_rf_calibrate_info->dpk_thermal[p];
|
||||
|
||||
/*4 6. If necessary, do LCK.*/
|
||||
|
||||
if (!(p_dm_odm->support_ic_type & ODM_RTL8821)) { /*no PG, do LCK at initial status*/
|
||||
if (p_rf_calibrate_info->thermal_value_lck == 0xff) {
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("no PG, do LCK\n"));
|
||||
p_rf_calibrate_info->thermal_value_lck = thermal_value;
|
||||
|
||||
/*Use RTLCK, so close power tracking driver LCK*/
|
||||
if (!(p_dm_odm->support_ic_type & ODM_RTL8814A)) {
|
||||
if (c.phy_lc_calibrate)
|
||||
(*c.phy_lc_calibrate)(p_dm_odm);
|
||||
}
|
||||
|
||||
delta_LCK = (thermal_value > p_rf_calibrate_info->thermal_value_lck) ? (thermal_value - p_rf_calibrate_info->thermal_value_lck) : (p_rf_calibrate_info->thermal_value_lck - thermal_value);
|
||||
}
|
||||
|
||||
ODM_RT_TRACE(p_dm_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(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("delta_LCK(%d) >= threshold_iqk(%d)\n", delta_LCK, c.threshold_iqk));
|
||||
p_rf_calibrate_info->thermal_value_lck = thermal_value;
|
||||
|
||||
/*Use RTLCK, so close power tracking driver LCK*/
|
||||
if (!(p_dm_odm->support_ic_type & ODM_RTL8814A)) {
|
||||
if (c.phy_lc_calibrate)
|
||||
(*c.phy_lc_calibrate)(p_dm_odm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*3 7. If necessary, move the index of swing table to adjust Tx power.*/
|
||||
|
||||
if (delta > 0 && p_rf_calibrate_info->txpowertrack_control) {
|
||||
/* "delta" here is used to record the absolute value of differrence. */
|
||||
#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
|
||||
delta = thermal_value > p_hal_data->eeprom_thermal_meter ? (thermal_value - p_hal_data->eeprom_thermal_meter) : (p_hal_data->eeprom_thermal_meter - thermal_value);
|
||||
#else
|
||||
delta = (thermal_value > p_dm_odm->priv->pmib->dot11RFEntry.ther) ? (thermal_value - p_dm_odm->priv->pmib->dot11RFEntry.ther) : (p_dm_odm->priv->pmib->dot11RFEntry.ther - thermal_value);
|
||||
#endif
|
||||
if (delta >= TXPWR_TRACK_TABLE_SIZE)
|
||||
delta = TXPWR_TRACK_TABLE_SIZE - 1;
|
||||
|
||||
/*4 7.1 The Final Power index = BaseIndex + power_index_offset*/
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
|
||||
if (thermal_value > p_hal_data->eeprom_thermal_meter) {
|
||||
#else
|
||||
if (thermal_value > p_dm_odm->priv->pmib->dot11RFEntry.ther) {
|
||||
#endif
|
||||
|
||||
for (p = ODM_RF_PATH_A; p < c.rf_path_count; p++) {
|
||||
p_rf_calibrate_info->delta_power_index_last[p] = p_rf_calibrate_info->delta_power_index[p]; /*recording poer index offset*/
|
||||
switch (p) {
|
||||
case ODM_RF_PATH_B:
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("delta_swing_table_idx_tup_b[%d] = %d\n", delta, delta_swing_table_idx_tup_b[delta]));
|
||||
|
||||
p_rf_calibrate_info->delta_power_index[p] = delta_swing_table_idx_tup_b[delta];
|
||||
p_rf_calibrate_info->absolute_ofdm_swing_idx[p] = delta_swing_table_idx_tup_b[delta]; /*Record delta swing for mix mode power tracking*/
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("******Temp is higher and p_rf_calibrate_info->absolute_ofdm_swing_idx[ODM_RF_PATH_B] = %d\n", p_rf_calibrate_info->absolute_ofdm_swing_idx[p]));
|
||||
break;
|
||||
|
||||
case ODM_RF_PATH_C:
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("delta_swing_table_idx_tup_c[%d] = %d\n", delta, delta_swing_table_idx_tup_c[delta]));
|
||||
|
||||
p_rf_calibrate_info->delta_power_index[p] = delta_swing_table_idx_tup_c[delta];
|
||||
p_rf_calibrate_info->absolute_ofdm_swing_idx[p] = delta_swing_table_idx_tup_c[delta]; /*Record delta swing for mix mode power tracking*/
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("******Temp is higher and p_rf_calibrate_info->absolute_ofdm_swing_idx[ODM_RF_PATH_C] = %d\n", p_rf_calibrate_info->absolute_ofdm_swing_idx[p]));
|
||||
break;
|
||||
|
||||
case ODM_RF_PATH_D:
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("delta_swing_table_idx_tup_d[%d] = %d\n", delta, delta_swing_table_idx_tup_d[delta]));
|
||||
|
||||
p_rf_calibrate_info->delta_power_index[p] = delta_swing_table_idx_tup_d[delta];
|
||||
p_rf_calibrate_info->absolute_ofdm_swing_idx[p] = delta_swing_table_idx_tup_d[delta]; /*Record delta swing for mix mode power tracking*/
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("******Temp is higher and p_rf_calibrate_info->absolute_ofdm_swing_idx[ODM_RF_PATH_D] = %d\n", p_rf_calibrate_info->absolute_ofdm_swing_idx[p]));
|
||||
break;
|
||||
|
||||
default:
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("delta_swing_table_idx_tup_a[%d] = %d\n", delta, delta_swing_table_idx_tup_a[delta]));
|
||||
|
||||
p_rf_calibrate_info->delta_power_index[p] = delta_swing_table_idx_tup_a[delta];
|
||||
p_rf_calibrate_info->absolute_ofdm_swing_idx[p] = delta_swing_table_idx_tup_a[delta]; /*Record delta swing for mix mode power tracking*/
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("******Temp is higher and p_rf_calibrate_info->absolute_ofdm_swing_idx[ODM_RF_PATH_A] = %d\n", p_rf_calibrate_info->absolute_ofdm_swing_idx[p]));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (p_dm_odm->support_ic_type & (ODM_RTL8703B | ODM_RTL8723D)) {
|
||||
/*Save xtal_offset from Xtal table*/
|
||||
p_rf_calibrate_info->xtal_offset_last = p_rf_calibrate_info->xtal_offset; /*recording last Xtal offset*/
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("[Xtal] delta_swing_table_xtal_up[%d] = %d\n", delta, delta_swing_table_xtal_up[delta]));
|
||||
p_rf_calibrate_info->xtal_offset = delta_swing_table_xtal_up[delta];
|
||||
|
||||
if (p_rf_calibrate_info->xtal_offset_last == p_rf_calibrate_info->xtal_offset)
|
||||
xtal_offset_eanble = 0;
|
||||
else
|
||||
xtal_offset_eanble = 1;
|
||||
}
|
||||
|
||||
} else {
|
||||
for (p = ODM_RF_PATH_A; p < c.rf_path_count; p++) {
|
||||
p_rf_calibrate_info->delta_power_index_last[p] = p_rf_calibrate_info->delta_power_index[p]; /*recording poer index offset*/
|
||||
|
||||
switch (p) {
|
||||
case ODM_RF_PATH_B:
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("delta_swing_table_idx_tdown_b[%d] = %d\n", delta, delta_swing_table_idx_tdown_b[delta]));
|
||||
p_rf_calibrate_info->delta_power_index[p] = -1 * delta_swing_table_idx_tdown_b[delta];
|
||||
p_rf_calibrate_info->absolute_ofdm_swing_idx[p] = -1 * delta_swing_table_idx_tdown_b[delta]; /*Record delta swing for mix mode power tracking*/
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("******Temp is lower and p_rf_calibrate_info->absolute_ofdm_swing_idx[ODM_RF_PATH_B] = %d\n", p_rf_calibrate_info->absolute_ofdm_swing_idx[p]));
|
||||
break;
|
||||
|
||||
case ODM_RF_PATH_C:
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("delta_swing_table_idx_tdown_c[%d] = %d\n", delta, delta_swing_table_idx_tdown_c[delta]));
|
||||
p_rf_calibrate_info->delta_power_index[p] = -1 * delta_swing_table_idx_tdown_c[delta];
|
||||
p_rf_calibrate_info->absolute_ofdm_swing_idx[p] = -1 * delta_swing_table_idx_tdown_c[delta]; /*Record delta swing for mix mode power tracking*/
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("******Temp is lower and p_rf_calibrate_info->absolute_ofdm_swing_idx[ODM_RF_PATH_C] = %d\n", p_rf_calibrate_info->absolute_ofdm_swing_idx[p]));
|
||||
break;
|
||||
|
||||
case ODM_RF_PATH_D:
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("delta_swing_table_idx_tdown_d[%d] = %d\n", delta, delta_swing_table_idx_tdown_d[delta]));
|
||||
p_rf_calibrate_info->delta_power_index[p] = -1 * delta_swing_table_idx_tdown_d[delta];
|
||||
p_rf_calibrate_info->absolute_ofdm_swing_idx[p] = -1 * delta_swing_table_idx_tdown_d[delta]; /*Record delta swing for mix mode power tracking*/
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("******Temp is lower and p_rf_calibrate_info->absolute_ofdm_swing_idx[ODM_RF_PATH_D] = %d\n", p_rf_calibrate_info->absolute_ofdm_swing_idx[p]));
|
||||
break;
|
||||
|
||||
default:
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("delta_swing_table_idx_tdown_a[%d] = %d\n", delta, delta_swing_table_idx_tdown_a[delta]));
|
||||
p_rf_calibrate_info->delta_power_index[p] = -1 * delta_swing_table_idx_tdown_a[delta];
|
||||
p_rf_calibrate_info->absolute_ofdm_swing_idx[p] = -1 * delta_swing_table_idx_tdown_a[delta]; /*Record delta swing for mix mode power tracking*/
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("******Temp is lower and p_rf_calibrate_info->absolute_ofdm_swing_idx[ODM_RF_PATH_A] = %d\n", p_rf_calibrate_info->absolute_ofdm_swing_idx[p]));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (p_dm_odm->support_ic_type & (ODM_RTL8703B | ODM_RTL8723D)) {
|
||||
/*Save xtal_offset from Xtal table*/
|
||||
p_rf_calibrate_info->xtal_offset_last = p_rf_calibrate_info->xtal_offset; /*recording last Xtal offset*/
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("[Xtal] delta_swing_table_xtal_down[%d] = %d\n", delta, delta_swing_table_xtal_down[delta]));
|
||||
p_rf_calibrate_info->xtal_offset = delta_swing_table_xtal_down[delta];
|
||||
|
||||
if (p_rf_calibrate_info->xtal_offset_last == p_rf_calibrate_info->xtal_offset)
|
||||
xtal_offset_eanble = 0;
|
||||
else
|
||||
xtal_offset_eanble = 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for (p = ODM_RF_PATH_A; p < c.rf_path_count; p++) {
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("\n\n=========================== [path-%d] Calculating power_index_offset===========================\n", p));
|
||||
|
||||
if (p_rf_calibrate_info->delta_power_index[p] == p_rf_calibrate_info->delta_power_index_last[p]) /*If Thermal value changes but lookup table value still the same*/
|
||||
p_rf_calibrate_info->power_index_offset[p] = 0;
|
||||
else
|
||||
p_rf_calibrate_info->power_index_offset[p] = p_rf_calibrate_info->delta_power_index[p] - p_rf_calibrate_info->delta_power_index_last[p]; /*Power index diff between 2 times Power Tracking*/
|
||||
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("[path-%d] power_index_offset(%d) = delta_power_index(%d) - delta_power_index_last(%d)\n", p, p_rf_calibrate_info->power_index_offset[p], p_rf_calibrate_info->delta_power_index[p], p_rf_calibrate_info->delta_power_index_last[p]));
|
||||
|
||||
p_rf_calibrate_info->OFDM_index[p] = p_rf_calibrate_info->bb_swing_idx_ofdm_base[p] + p_rf_calibrate_info->power_index_offset[p];
|
||||
p_rf_calibrate_info->CCK_index = p_rf_calibrate_info->bb_swing_idx_cck_base + p_rf_calibrate_info->power_index_offset[p];
|
||||
|
||||
p_rf_calibrate_info->bb_swing_idx_cck = p_rf_calibrate_info->CCK_index;
|
||||
p_rf_calibrate_info->bb_swing_idx_ofdm[p] = p_rf_calibrate_info->OFDM_index[p];
|
||||
|
||||
/*************Print BB Swing base and index Offset*************/
|
||||
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("The 'CCK' final index(%d) = BaseIndex(%d) + power_index_offset(%d)\n", p_rf_calibrate_info->bb_swing_idx_cck, p_rf_calibrate_info->bb_swing_idx_cck_base, p_rf_calibrate_info->power_index_offset[p]));
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("The 'OFDM' final index(%d) = BaseIndex[%d](%d) + power_index_offset(%d)\n", p_rf_calibrate_info->bb_swing_idx_ofdm[p], p, p_rf_calibrate_info->bb_swing_idx_ofdm_base[p], p_rf_calibrate_info->power_index_offset[p]));
|
||||
|
||||
/*4 7.1 Handle boundary conditions of index.*/
|
||||
|
||||
if (p_rf_calibrate_info->OFDM_index[p] > c.swing_table_size_ofdm - 1)
|
||||
p_rf_calibrate_info->OFDM_index[p] = c.swing_table_size_ofdm - 1;
|
||||
else if (p_rf_calibrate_info->OFDM_index[p] <= OFDM_min_index)
|
||||
p_rf_calibrate_info->OFDM_index[p] = OFDM_min_index;
|
||||
}
|
||||
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("\n\n========================================================================================================\n"));
|
||||
|
||||
if (p_rf_calibrate_info->CCK_index > c.swing_table_size_cck - 1)
|
||||
p_rf_calibrate_info->CCK_index = c.swing_table_size_cck - 1;
|
||||
else if (p_rf_calibrate_info->CCK_index <= 0)
|
||||
p_rf_calibrate_info->CCK_index = 0;
|
||||
} else {
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("The thermal meter is unchanged or TxPowerTracking OFF(%d): thermal_value: %d, p_rf_calibrate_info->thermal_value: %d\n",
|
||||
p_rf_calibrate_info->txpowertrack_control, thermal_value, p_rf_calibrate_info->thermal_value));
|
||||
|
||||
for (p = ODM_RF_PATH_A; p < c.rf_path_count; p++)
|
||||
p_rf_calibrate_info->power_index_offset[p] = 0;
|
||||
}
|
||||
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("TxPowerTracking: [CCK] Swing Current index: %d, Swing base index: %d\n",
|
||||
p_rf_calibrate_info->CCK_index, p_rf_calibrate_info->bb_swing_idx_cck_base)); /*Print Swing base & current*/
|
||||
|
||||
for (p = ODM_RF_PATH_A; p < c.rf_path_count; p++) {
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("TxPowerTracking: [OFDM] Swing Current index: %d, Swing base index[%d]: %d\n",
|
||||
p_rf_calibrate_info->OFDM_index[p], p, p_rf_calibrate_info->bb_swing_idx_ofdm_base[p]));
|
||||
}
|
||||
|
||||
if ((p_dm_odm->support_ic_type & ODM_RTL8814A)) {
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("power_tracking_type=%d\n", power_tracking_type));
|
||||
|
||||
if (power_tracking_type == 0) {
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("**********Enter POWER Tracking MIX_MODE**********\n"));
|
||||
for (p = ODM_RF_PATH_A; p < c.rf_path_count; p++)
|
||||
(*c.odm_tx_pwr_track_set_pwr)(p_dm_odm, MIX_MODE, p, 0);
|
||||
} else if (power_tracking_type == 1) {
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("**********Enter POWER Tracking MIX(2G) TSSI(5G) MODE**********\n"));
|
||||
for (p = ODM_RF_PATH_A; p < c.rf_path_count; p++)
|
||||
(*c.odm_tx_pwr_track_set_pwr)(p_dm_odm, MIX_2G_TSSI_5G_MODE, p, 0);
|
||||
} else if (power_tracking_type == 2) {
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("**********Enter POWER Tracking MIX(5G) TSSI(2G)MODE**********\n"));
|
||||
for (p = ODM_RF_PATH_A; p < c.rf_path_count; p++)
|
||||
(*c.odm_tx_pwr_track_set_pwr)(p_dm_odm, MIX_5G_TSSI_2G_MODE, p, 0);
|
||||
} else if (power_tracking_type == 3) {
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("**********Enter POWER Tracking TSSI MODE**********\n"));
|
||||
for (p = ODM_RF_PATH_A; p < c.rf_path_count; p++)
|
||||
(*c.odm_tx_pwr_track_set_pwr)(p_dm_odm, TSSI_MODE, p, 0);
|
||||
}
|
||||
p_rf_calibrate_info->thermal_value = thermal_value; /*Record last Power Tracking Thermal value*/
|
||||
|
||||
} else if ((p_rf_calibrate_info->power_index_offset[ODM_RF_PATH_A] != 0 ||
|
||||
p_rf_calibrate_info->power_index_offset[ODM_RF_PATH_B] != 0 ||
|
||||
p_rf_calibrate_info->power_index_offset[ODM_RF_PATH_C] != 0 ||
|
||||
p_rf_calibrate_info->power_index_offset[ODM_RF_PATH_D] != 0) &&
|
||||
p_rf_calibrate_info->txpowertrack_control && (p_hal_data->eeprom_thermal_meter != 0xff)) {
|
||||
/* 4 7.2 Configure the Swing Table to adjust Tx Power. */
|
||||
|
||||
p_rf_calibrate_info->is_tx_power_changed = 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 (thermal_value > p_rf_calibrate_info->thermal_value) {
|
||||
for (p = ODM_RF_PATH_A; p < c.rf_path_count; p++) {
|
||||
ODM_RT_TRACE(p_dm_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, p_rf_calibrate_info->power_index_offset[p], delta, thermal_value, p_hal_data->eeprom_thermal_meter, p_rf_calibrate_info->thermal_value));
|
||||
}
|
||||
} else if (thermal_value < p_rf_calibrate_info->thermal_value) { /*Low temperature*/
|
||||
for (p = ODM_RF_PATH_A; p < c.rf_path_count; p++) {
|
||||
ODM_RT_TRACE(p_dm_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, p_rf_calibrate_info->power_index_offset[p], delta, thermal_value, p_hal_data->eeprom_thermal_meter, p_rf_calibrate_info->thermal_value));
|
||||
}
|
||||
}
|
||||
|
||||
#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
|
||||
if (thermal_value > p_hal_data->eeprom_thermal_meter)
|
||||
#else
|
||||
if (thermal_value > p_dm_odm->priv->pmib->dot11RFEntry.ther)
|
||||
#endif
|
||||
{
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("Temperature(%d) higher than PG value(%d)\n", thermal_value, p_hal_data->eeprom_thermal_meter));
|
||||
|
||||
if (p_dm_odm->support_ic_type == ODM_RTL8188E || p_dm_odm->support_ic_type == ODM_RTL8192E || p_dm_odm->support_ic_type == ODM_RTL8821 ||
|
||||
p_dm_odm->support_ic_type == ODM_RTL8812 || p_dm_odm->support_ic_type == ODM_RTL8723B || p_dm_odm->support_ic_type == ODM_RTL8814A ||
|
||||
p_dm_odm->support_ic_type == ODM_RTL8703B || p_dm_odm->support_ic_type == ODM_RTL8188F || p_dm_odm->support_ic_type == ODM_RTL8822B ||
|
||||
p_dm_odm->support_ic_type == ODM_RTL8723D || p_dm_odm->support_ic_type == ODM_RTL8821C) {
|
||||
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("**********Enter POWER Tracking MIX_MODE**********\n"));
|
||||
for (p = ODM_RF_PATH_A; p < c.rf_path_count; p++)
|
||||
(*c.odm_tx_pwr_track_set_pwr)(p_dm_odm, MIX_MODE, p, 0);
|
||||
} else {
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("**********Enter POWER Tracking BBSWING_MODE**********\n"));
|
||||
for (p = ODM_RF_PATH_A; p < c.rf_path_count; p++)
|
||||
(*c.odm_tx_pwr_track_set_pwr)(p_dm_odm, BBSWING, p, indexforchannel);
|
||||
}
|
||||
} else {
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("Temperature(%d) lower than PG value(%d)\n", thermal_value, p_hal_data->eeprom_thermal_meter));
|
||||
|
||||
if (p_dm_odm->support_ic_type == ODM_RTL8188E || p_dm_odm->support_ic_type == ODM_RTL8192E || p_dm_odm->support_ic_type == ODM_RTL8821 ||
|
||||
p_dm_odm->support_ic_type == ODM_RTL8812 || p_dm_odm->support_ic_type == ODM_RTL8723B || p_dm_odm->support_ic_type == ODM_RTL8814A ||
|
||||
p_dm_odm->support_ic_type == ODM_RTL8703B || p_dm_odm->support_ic_type == ODM_RTL8188F || p_dm_odm->support_ic_type == ODM_RTL8822B ||
|
||||
p_dm_odm->support_ic_type == ODM_RTL8723D || p_dm_odm->support_ic_type == ODM_RTL8821C) {
|
||||
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("**********Enter POWER Tracking MIX_MODE**********\n"));
|
||||
for (p = ODM_RF_PATH_A; p < c.rf_path_count; p++)
|
||||
(*c.odm_tx_pwr_track_set_pwr)(p_dm_odm, MIX_MODE, p, indexforchannel);
|
||||
} else {
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("**********Enter POWER Tracking BBSWING_MODE**********\n"));
|
||||
for (p = ODM_RF_PATH_A; p < c.rf_path_count; p++)
|
||||
(*c.odm_tx_pwr_track_set_pwr)(p_dm_odm, BBSWING, p, indexforchannel);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
p_rf_calibrate_info->bb_swing_idx_cck_base = p_rf_calibrate_info->bb_swing_idx_cck; /*Record last time Power Tracking result as base.*/
|
||||
for (p = ODM_RF_PATH_A; p < c.rf_path_count; p++)
|
||||
p_rf_calibrate_info->bb_swing_idx_ofdm_base[p] = p_rf_calibrate_info->bb_swing_idx_ofdm[p];
|
||||
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("p_rf_calibrate_info->thermal_value = %d thermal_value= %d\n", p_rf_calibrate_info->thermal_value, thermal_value));
|
||||
|
||||
p_rf_calibrate_info->thermal_value = thermal_value; /*Record last Power Tracking Thermal value*/
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (p_dm_odm->support_ic_type == ODM_RTL8703B || p_dm_odm->support_ic_type == ODM_RTL8723D) {
|
||||
|
||||
if (xtal_offset_eanble != 0 && p_rf_calibrate_info->txpowertrack_control && (p_hal_data->eeprom_thermal_meter != 0xff)) {
|
||||
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("**********Enter Xtal Tracking**********\n"));
|
||||
|
||||
#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
|
||||
if (thermal_value > p_hal_data->eeprom_thermal_meter) {
|
||||
#else
|
||||
if (thermal_value > p_dm_odm->priv->pmib->dot11RFEntry.ther) {
|
||||
#endif
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("Temperature(%d) higher than PG value(%d)\n", thermal_value, p_hal_data->eeprom_thermal_meter));
|
||||
(*c.odm_txxtaltrack_set_xtal)(p_dm_odm);
|
||||
} else {
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
|
||||
("Temperature(%d) lower than PG value(%d)\n", thermal_value, p_hal_data->eeprom_thermal_meter));
|
||||
(*c.odm_txxtaltrack_set_xtal)(p_dm_odm);
|
||||
}
|
||||
}
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("**********End Xtal Tracking**********\n"));
|
||||
}
|
||||
|
||||
#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) {
|
||||
p_rf_calibrate_info->thermal_value_iqk = thermal_value;
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("delta_IQK(%d) >= threshold_iqk(%d)\n", delta_IQK, c.threshold_iqk));
|
||||
if (!p_rf_calibrate_info->is_iqk_in_progress)
|
||||
(*c.do_iqk)(p_dm_odm, delta_IQK, thermal_value, 8);
|
||||
}
|
||||
}
|
||||
if (p_rf_calibrate_info->dpk_thermal[ODM_RF_PATH_A] != 0) {
|
||||
if (diff_DPK[ODM_RF_PATH_A] >= c.threshold_dpk) {
|
||||
odm_set_bb_reg(p_dm_odm, 0x82c, BIT(31), 0x1);
|
||||
odm_set_bb_reg(p_dm_odm, 0xcc4, BIT(14) | BIT(13) | BIT(12) | BIT(11) | BIT(10), (diff_DPK[ODM_RF_PATH_A] / c.threshold_dpk));
|
||||
odm_set_bb_reg(p_dm_odm, 0x82c, BIT(31), 0x0);
|
||||
} else if ((diff_DPK[ODM_RF_PATH_A] <= -1 * c.threshold_dpk)) {
|
||||
s32 value = 0x20 + (diff_DPK[ODM_RF_PATH_A] / c.threshold_dpk);
|
||||
|
||||
odm_set_bb_reg(p_dm_odm, 0x82c, BIT(31), 0x1);
|
||||
odm_set_bb_reg(p_dm_odm, 0xcc4, BIT(14) | BIT(13) | BIT(12) | BIT(11) | BIT(10), value);
|
||||
odm_set_bb_reg(p_dm_odm, 0x82c, BIT(31), 0x0);
|
||||
} else {
|
||||
odm_set_bb_reg(p_dm_odm, 0x82c, BIT(31), 0x1);
|
||||
odm_set_bb_reg(p_dm_odm, 0xcc4, BIT(14) | BIT(13) | BIT(12) | BIT(11) | BIT(10), 0);
|
||||
odm_set_bb_reg(p_dm_odm, 0x82c, BIT(31), 0x0);
|
||||
}
|
||||
}
|
||||
if (p_rf_calibrate_info->dpk_thermal[ODM_RF_PATH_B] != 0) {
|
||||
if (diff_DPK[ODM_RF_PATH_B] >= c.threshold_dpk) {
|
||||
odm_set_bb_reg(p_dm_odm, 0x82c, BIT(31), 0x1);
|
||||
odm_set_bb_reg(p_dm_odm, 0xec4, BIT(14) | BIT(13) | BIT(12) | BIT(11) | BIT(10), (diff_DPK[ODM_RF_PATH_B] / c.threshold_dpk));
|
||||
odm_set_bb_reg(p_dm_odm, 0x82c, BIT(31), 0x0);
|
||||
} else if ((diff_DPK[ODM_RF_PATH_B] <= -1 * c.threshold_dpk)) {
|
||||
s32 value = 0x20 + (diff_DPK[ODM_RF_PATH_B] / c.threshold_dpk);
|
||||
|
||||
odm_set_bb_reg(p_dm_odm, 0x82c, BIT(31), 0x1);
|
||||
odm_set_bb_reg(p_dm_odm, 0xec4, BIT(14) | BIT(13) | BIT(12) | BIT(11) | BIT(10), value);
|
||||
odm_set_bb_reg(p_dm_odm, 0x82c, BIT(31), 0x0);
|
||||
} else {
|
||||
odm_set_bb_reg(p_dm_odm, 0x82c, BIT(31), 0x1);
|
||||
odm_set_bb_reg(p_dm_odm, 0xec4, BIT(14) | BIT(13) | BIT(12) | BIT(11) | BIT(10), 0);
|
||||
odm_set_bb_reg(p_dm_odm, 0x82c, BIT(31), 0x0);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("<===odm_txpowertracking_callback_thermal_meter\n"));
|
||||
|
||||
p_rf_calibrate_info->tx_powercount = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* 3============================================================
|
||||
* 3 IQ Calibration
|
||||
* 3============================================================ */
|
||||
|
||||
void
|
||||
odm_reset_iqk_result(
|
||||
struct PHY_DM_STRUCT *p_dm_odm
|
||||
)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
|
||||
u8 odm_get_right_chnl_place_for_iqk(u8 chnl)
|
||||
{
|
||||
u8 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
|
||||
};
|
||||
u8 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_iq_calibrate(
|
||||
struct PHY_DM_STRUCT *p_dm_odm
|
||||
)
|
||||
{
|
||||
struct _ADAPTER *adapter = p_dm_odm->adapter;
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(adapter);
|
||||
|
||||
RT_TRACE(COMP_SCAN, ODM_DBG_LOUD, ("=>%s\n" , __FUNCTION__));
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
|
||||
if (*p_dm_odm->p_is_fcs_mode_enable)
|
||||
return;
|
||||
#endif
|
||||
|
||||
if (p_dm_odm->is_linked) {
|
||||
RT_TRACE(COMP_SCAN, ODM_DBG_LOUD, ("interval=%d ch=%d prech=%d scan=%s\n", p_dm_odm->linked_interval,
|
||||
*p_dm_odm->p_channel, p_dm_odm->pre_channel, *p_dm_odm->p_is_scan_in_process == TRUE ? "TRUE":"FALSE"));
|
||||
|
||||
if (*p_dm_odm->p_channel != p_dm_odm->pre_channel) {
|
||||
p_dm_odm->pre_channel = *p_dm_odm->p_channel;
|
||||
p_dm_odm->linked_interval = 0;
|
||||
}
|
||||
|
||||
if ((p_dm_odm->linked_interval < 3) && (!*p_dm_odm->p_is_scan_in_process))
|
||||
p_dm_odm->linked_interval++;
|
||||
|
||||
if (p_dm_odm->linked_interval == 2)
|
||||
PHY_IQCalibrate(adapter, false);
|
||||
} else
|
||||
p_dm_odm->linked_interval = 0;
|
||||
|
||||
RT_TRACE(COMP_SCAN, ODM_DBG_LOUD, ("<=%s interval=%d ch=%d prech=%d scan=%s\n", __FUNCTION__, p_dm_odm->linked_interval,
|
||||
*p_dm_odm->p_channel, p_dm_odm->pre_channel, *p_dm_odm->p_is_scan_in_process == TRUE?"TRUE":"FALSE"));
|
||||
}
|
||||
|
||||
void phydm_rf_init(struct PHY_DM_STRUCT *p_dm_odm)
|
||||
{
|
||||
|
||||
odm_txpowertracking_init(p_dm_odm);
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
|
||||
odm_clear_txpowertracking_state(p_dm_odm);
|
||||
#endif
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
|
||||
#if (RTL8814A_SUPPORT == 1)
|
||||
if (p_dm_odm->support_ic_type & ODM_RTL8814A)
|
||||
phy_iq_calibrate_8814a_init(p_dm_odm);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void phydm_rf_watchdog(struct PHY_DM_STRUCT *p_dm_odm)
|
||||
{
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
|
||||
odm_txpowertracking_check(p_dm_odm);
|
||||
if (p_dm_odm->support_ic_type & ODM_IC_11AC_SERIES)
|
||||
odm_iq_calibrate(p_dm_odm);
|
||||
#endif
|
||||
}
|
119
hal/phydm/halphyrf_win.h
Normal file
119
hal/phydm/halphyrf_win.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 __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"
|
||||
#include "../mac/Halmac_type.h"
|
||||
#endif
|
||||
#include "phydm_powertracking_win.h"
|
||||
|
||||
#if (RTL8821C_SUPPORT == 1)
|
||||
#include "rtl8821c/phydm_iqk_8821c.h"
|
||||
#endif
|
||||
|
||||
enum spur_cal_method {
|
||||
PLL_RESET,
|
||||
AFE_PHASE_SEL
|
||||
};
|
||||
|
||||
enum pwrtrack_method {
|
||||
BBSWING,
|
||||
TXAGC,
|
||||
MIX_MODE,
|
||||
TSSI_MODE,
|
||||
MIX_2G_TSSI_5G_MODE,
|
||||
MIX_5G_TSSI_2G_MODE
|
||||
};
|
||||
|
||||
typedef void(*func_set_pwr)(void *, enum pwrtrack_method, u8, u8);
|
||||
typedef void(*func_iqk)(void *, u8, u8, u8);
|
||||
typedef void(*func_lck)(void *);
|
||||
typedef void(*func_swing)(void *, u8 **, u8 **, u8 **, u8 **);
|
||||
typedef void(*func_swing8814only)(void *, u8 **, u8 **, u8 **, u8 **);
|
||||
typedef void (*func_swing_xtal)(void *, s8 **, s8 **);
|
||||
typedef void (*func_set_xtal)(void *);
|
||||
typedef void(*func_all_swing)(void *, u8 **, u8 **, u8 **, u8 **, u8 **, u8 **, u8 **, u8 **);
|
||||
|
||||
struct _TXPWRTRACK_CFG {
|
||||
u8 swing_table_size_cck;
|
||||
u8 swing_table_size_ofdm;
|
||||
u8 threshold_iqk;
|
||||
u8 threshold_dpk;
|
||||
u8 average_thermal_num;
|
||||
u8 rf_path_count;
|
||||
u32 thermal_reg_addr;
|
||||
func_set_pwr odm_tx_pwr_track_set_pwr;
|
||||
func_iqk do_iqk;
|
||||
func_lck phy_lc_calibrate;
|
||||
func_swing get_delta_swing_table;
|
||||
func_swing8814only get_delta_swing_table8814only;
|
||||
func_swing_xtal get_delta_swing_xtal_table;
|
||||
func_set_xtal odm_txxtaltrack_set_xtal;
|
||||
func_all_swing get_delta_all_swing_table;
|
||||
};
|
||||
|
||||
void
|
||||
configure_txpower_track(
|
||||
struct PHY_DM_STRUCT *p_dm_odm,
|
||||
struct _TXPWRTRACK_CFG *p_config
|
||||
);
|
||||
|
||||
|
||||
void
|
||||
odm_clear_txpowertracking_state(
|
||||
struct PHY_DM_STRUCT *p_dm_odm
|
||||
);
|
||||
|
||||
void
|
||||
odm_txpowertracking_callback_thermal_meter(
|
||||
#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
|
||||
struct PHY_DM_STRUCT *p_dm_odm
|
||||
#else
|
||||
struct _ADAPTER *adapter
|
||||
#endif
|
||||
);
|
||||
|
||||
|
||||
|
||||
#define ODM_TARGET_CHNL_NUM_2G_5G 59
|
||||
|
||||
|
||||
void
|
||||
odm_reset_iqk_result(
|
||||
struct PHY_DM_STRUCT *p_dm_odm
|
||||
);
|
||||
u8
|
||||
odm_get_right_chnl_place_for_iqk(
|
||||
u8 chnl
|
||||
);
|
||||
|
||||
void odm_iq_calibrate(struct PHY_DM_STRUCT *p_dm_odm);
|
||||
void phydm_rf_init(struct PHY_DM_STRUCT *p_dm_odm);
|
||||
void phydm_rf_watchdog(struct PHY_DM_STRUCT *p_dm_odm);
|
||||
|
||||
#endif /* #ifndef __HAL_PHY_RF_H__ */
|
19
hal/phydm/mp_precomp.h
Normal file
19
hal/phydm/mp_precomp.h
Normal file
|
@ -0,0 +1,19 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
3425
hal/phydm/phydm.c
Normal file
3425
hal/phydm/phydm.c
Normal file
File diff suppressed because it is too large
Load diff
1336
hal/phydm/phydm.h
Normal file
1336
hal/phydm/phydm.h
Normal file
File diff suppressed because it is too large
Load diff
1154
hal/phydm/phydm_acs.c
Normal file
1154
hal/phydm/phydm_acs.c
Normal file
File diff suppressed because it is too large
Load diff
105
hal/phydm/phydm_acs.h
Normal file
105
hal/phydm/phydm_acs.h
Normal file
|
@ -0,0 +1,105 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* 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.1" /*20150729 by YuChen*/
|
||||
#define CLM_VERSION "1.0"
|
||||
|
||||
#define ODM_MAX_CHANNEL_2G 14
|
||||
#define ODM_MAX_CHANNEL_5G 24
|
||||
|
||||
/* For phydm_auto_channel_select_setting_ap() */
|
||||
#define STORE_DEFAULT_NHM_SETTING 0
|
||||
#define RESTORE_DEFAULT_NHM_SETTING 1
|
||||
#define ACS_NHM_SETTING 2
|
||||
|
||||
struct _ACS_ {
|
||||
bool is_force_acs_result;
|
||||
u8 clean_channel_2g;
|
||||
u8 clean_channel_5g;
|
||||
u16 channel_info_2g[2][ODM_MAX_CHANNEL_2G]; /* Channel_Info[1]: channel score, Channel_Info[2]:Channel_Scan_Times */
|
||||
u16 channel_info_5g[2][ODM_MAX_CHANNEL_5G];
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
|
||||
u8 acs_step;
|
||||
/* NHM count 0-11 */
|
||||
u8 nhm_cnt[14][11];
|
||||
|
||||
/* AC-Series, for storing previous setting */
|
||||
u32 reg0x990;
|
||||
u32 reg0x994;
|
||||
u32 reg0x998;
|
||||
u32 reg0x99c;
|
||||
u8 reg0x9a0; /* u8 */
|
||||
|
||||
/* N-Series, for storing previous setting */
|
||||
u32 reg0x890;
|
||||
u32 reg0x894;
|
||||
u32 reg0x898;
|
||||
u32 reg0x89c;
|
||||
u8 reg0xe28; /* u8 */
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
|
||||
void
|
||||
odm_auto_channel_select_init(
|
||||
void *p_dm_void
|
||||
);
|
||||
|
||||
void
|
||||
odm_auto_channel_select_reset(
|
||||
void *p_dm_void
|
||||
);
|
||||
|
||||
void
|
||||
odm_auto_channel_select(
|
||||
void *p_dm_void,
|
||||
u8 channel
|
||||
);
|
||||
|
||||
u8
|
||||
odm_get_auto_channel_select_result(
|
||||
void *p_dm_void,
|
||||
u8 band
|
||||
);
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
|
||||
|
||||
void
|
||||
phydm_auto_channel_select_setting_ap(
|
||||
void *p_dm_void,
|
||||
u32 setting, /* 0: STORE_DEFAULT_NHM_SETTING; 1: RESTORE_DEFAULT_NHM_SETTING, 2: ACS_NHM_SETTING */
|
||||
u32 acs_step
|
||||
);
|
||||
|
||||
void
|
||||
phydm_get_nhm_statistics_ap(
|
||||
void *p_dm_void,
|
||||
u32 idx, /* @ 2G, Real channel number = idx+1 */
|
||||
u32 acs_step
|
||||
);
|
||||
|
||||
#endif /* #if ( DM_ODM_SUPPORT_TYPE & ODM_AP ) */
|
||||
|
||||
#endif /* #ifndef __PHYDMACS_H__ */
|
1130
hal/phydm/phydm_adaptivity.c
Normal file
1130
hal/phydm/phydm_adaptivity.c
Normal file
File diff suppressed because it is too large
Load diff
219
hal/phydm/phydm_adaptivity.h
Normal file
219
hal/phydm/phydm_adaptivity.h
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
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __PHYDMADAPTIVITY_H__
|
||||
#define __PHYDMADAPTIVITY_H__
|
||||
|
||||
#define ADAPTIVITY_VERSION "9.3.5" /*20160902 changed by Kevin, refine method for searching pwdb lower bound*/
|
||||
|
||||
#define pwdb_upper_bound 7
|
||||
#define dfir_loss 5
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN))
|
||||
enum phydm_regulation_type {
|
||||
REGULATION_FCC = 0,
|
||||
REGULATION_MKK = 1,
|
||||
REGULATION_ETSI = 2,
|
||||
REGULATION_WW = 3,
|
||||
|
||||
MAX_REGULATION_NUM = 4
|
||||
};
|
||||
#endif
|
||||
|
||||
enum phydm_adapinfo_e {
|
||||
PHYDM_ADAPINFO_CARRIER_SENSE_ENABLE = 0,
|
||||
PHYDM_ADAPINFO_DCBACKOFF,
|
||||
PHYDM_ADAPINFO_DYNAMICLINKADAPTIVITY,
|
||||
PHYDM_ADAPINFO_TH_L2H_INI,
|
||||
PHYDM_ADAPINFO_TH_EDCCA_HL_DIFF,
|
||||
PHYDM_ADAPINFO_AP_NUM_TH
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
enum phydm_set_lna {
|
||||
phydm_disable_lna = 0,
|
||||
phydm_enable_lna = 1,
|
||||
};
|
||||
|
||||
|
||||
enum phydm_trx_mux_type {
|
||||
phydm_shutdown = 0,
|
||||
phydm_standby_mode = 1,
|
||||
phydm_tx_mode = 2,
|
||||
phydm_rx_mode = 3
|
||||
};
|
||||
|
||||
enum phydm_mac_edcca_type {
|
||||
phydm_ignore_edcca = 0,
|
||||
phydm_dont_ignore_edcca = 1
|
||||
};
|
||||
|
||||
struct _ADAPTIVITY_STATISTICS {
|
||||
s8 th_l2h_ini_backup;
|
||||
s8 th_edcca_hl_diff_backup;
|
||||
s8 igi_base;
|
||||
u8 igi_target;
|
||||
u8 nhm_wait;
|
||||
s8 h2l_lb;
|
||||
s8 l2h_lb;
|
||||
bool is_first_link;
|
||||
bool is_check;
|
||||
bool dynamic_link_adaptivity;
|
||||
u8 ap_num_th;
|
||||
u8 adajust_igi_level;
|
||||
bool acs_for_adaptivity;
|
||||
s8 backup_l2h;
|
||||
s8 backup_h2l;
|
||||
bool is_stop_edcca;
|
||||
#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
|
||||
RT_WORK_ITEM phydm_pause_edcca_work_item;
|
||||
RT_WORK_ITEM phydm_resume_edcca_work_item;
|
||||
#endif
|
||||
};
|
||||
|
||||
void
|
||||
phydm_pause_edcca(
|
||||
void *p_dm_void,
|
||||
bool is_pasue_edcca
|
||||
);
|
||||
|
||||
void
|
||||
phydm_check_adaptivity(
|
||||
void *p_dm_void
|
||||
);
|
||||
|
||||
void
|
||||
phydm_check_environment(
|
||||
void *p_dm_void
|
||||
);
|
||||
|
||||
void
|
||||
phydm_nhm_counter_statistics_init(
|
||||
void *p_dm_void
|
||||
);
|
||||
|
||||
void
|
||||
phydm_nhm_counter_statistics(
|
||||
void *p_dm_void
|
||||
);
|
||||
|
||||
void
|
||||
phydm_nhm_counter_statistics_reset(
|
||||
void *p_dm_void
|
||||
);
|
||||
|
||||
void
|
||||
phydm_get_nhm_counter_statistics(
|
||||
void *p_dm_void
|
||||
);
|
||||
|
||||
void
|
||||
phydm_mac_edcca_state(
|
||||
void *p_dm_void,
|
||||
enum phydm_mac_edcca_type state
|
||||
);
|
||||
|
||||
void
|
||||
phydm_set_edcca_threshold(
|
||||
void *p_dm_void,
|
||||
s8 H2L,
|
||||
s8 L2H
|
||||
);
|
||||
|
||||
void
|
||||
phydm_set_trx_mux(
|
||||
void *p_dm_void,
|
||||
enum phydm_trx_mux_type tx_mode,
|
||||
enum phydm_trx_mux_type rx_mode
|
||||
);
|
||||
|
||||
bool
|
||||
phydm_cal_nhm_cnt(
|
||||
void *p_dm_void
|
||||
);
|
||||
|
||||
void
|
||||
phydm_search_pwdb_lower_bound(
|
||||
void *p_dm_void
|
||||
);
|
||||
|
||||
void
|
||||
phydm_adaptivity_info_init(
|
||||
void *p_dm_void,
|
||||
enum phydm_adapinfo_e cmn_info,
|
||||
u32 value
|
||||
);
|
||||
|
||||
void
|
||||
phydm_adaptivity_init(
|
||||
void *p_dm_void
|
||||
);
|
||||
|
||||
void
|
||||
phydm_adaptivity(
|
||||
void *p_dm_void
|
||||
);
|
||||
|
||||
void
|
||||
phydm_set_edcca_threshold_api(
|
||||
void *p_dm_void,
|
||||
u8 IGI
|
||||
);
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
|
||||
void
|
||||
phydm_disable_edcca(
|
||||
void *p_dm_void
|
||||
);
|
||||
|
||||
void
|
||||
phydm_dynamic_edcca(
|
||||
void *p_dm_void
|
||||
);
|
||||
|
||||
void
|
||||
phydm_adaptivity_bsod(
|
||||
void *p_dm_void
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
void
|
||||
phydm_pause_edcca_work_item_callback(
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
|
||||
struct _ADAPTER *adapter
|
||||
#else
|
||||
void *p_dm_void
|
||||
#endif
|
||||
);
|
||||
|
||||
void
|
||||
phydm_resume_edcca_work_item_callback(
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
|
||||
struct _ADAPTER *adapter
|
||||
#else
|
||||
void *p_dm_void
|
||||
#endif
|
||||
);
|
||||
|
||||
#endif
|
764
hal/phydm/phydm_adc_sampling.c
Normal file
764
hal/phydm/phydm_adc_sampling.c
Normal file
|
@ -0,0 +1,764 @@
|
|||
#include "mp_precomp.h"
|
||||
#include "phydm_precomp.h"
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
|
||||
#if ((RTL8197F_SUPPORT == 1) || (RTL8822B_SUPPORT == 1))
|
||||
#include "rtl8197f/Hal8197FPhyReg.h"
|
||||
#include "WlanHAL/HalMac88XX/halmac_reg2.h"
|
||||
#else
|
||||
#include "WlanHAL/HalHeader/HalComReg.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if (PHYDM_LA_MODE_SUPPORT == 1)
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
|
||||
|
||||
#if WPP_SOFTWARE_TRACE
|
||||
#include "phydm_adc_sampling.tmh"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
|
||||
bool
|
||||
phydm_la_buffer_allocate(
|
||||
void *p_dm_void
|
||||
)
|
||||
{
|
||||
struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
|
||||
struct _RT_ADCSMP *adc_smp = &(p_dm_odm->adcsmp);
|
||||
struct _ADAPTER *adapter = p_dm_odm->adapter;
|
||||
struct _RT_ADCSMP_STRING *adc_smp_buf = &(adc_smp->adc_smp_buf);
|
||||
bool ret = false;
|
||||
|
||||
dbg_print("[LA mode BufferAllocate]\n");
|
||||
|
||||
if (adc_smp_buf->length == 0) {
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
|
||||
if (PlatformAllocateMemoryWithZero(adapter, (void **)&(adc_smp_buf->octet), adc_smp_buf->buffer_size) != RT_STATUS_SUCCESS) {
|
||||
#else
|
||||
odm_allocate_memory(p_dm_odm, (void **)&adc_smp_buf->octet, adc_smp_buf->buffer_size);
|
||||
if (!adc_smp_buf->octet) {
|
||||
#endif
|
||||
ret = false;
|
||||
} else
|
||||
adc_smp_buf->length = adc_smp_buf->buffer_size;
|
||||
ret = true;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
phydm_la_get_tx_pkt_buf(
|
||||
void *p_dm_void
|
||||
)
|
||||
{
|
||||
struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
|
||||
struct _RT_ADCSMP *adc_smp = &(p_dm_odm->adcsmp);
|
||||
struct _RT_ADCSMP_STRING *adc_smp_buf = &(adc_smp->adc_smp_buf);
|
||||
u32 i = 0, value32, data_l = 0, data_h = 0;
|
||||
u32 addr, finish_addr;
|
||||
u32 end_addr = (adc_smp_buf->start_pos + adc_smp_buf->buffer_size) - 1; /*end_addr = 0x3ffff;*/
|
||||
bool is_round_up;
|
||||
static u32 page = 0xFF;
|
||||
u32 smp_cnt = 0, smp_number = 0, addr_8byte = 0;
|
||||
|
||||
odm_memory_set(p_dm_odm, adc_smp_buf->octet, 0, adc_smp_buf->length);
|
||||
odm_write_1byte(p_dm_odm, 0x0106, 0x69);
|
||||
|
||||
dbg_print("GetTxPktBuf\n");
|
||||
|
||||
value32 = odm_read_4byte(p_dm_odm, 0x7c0);
|
||||
is_round_up = (bool)((value32 & BIT(31)) >> 31);
|
||||
finish_addr = (value32 & 0x7FFF0000) >> 16; /*Reg7C0[30:16]: finish addr (unit: 8byte)*/
|
||||
|
||||
if (is_round_up) {
|
||||
addr = (finish_addr + 1) << 3;
|
||||
dbg_print("is_round_up = ((%d)), finish_addr=((0x%x)), 0x7c0=((0x%x))\n", is_round_up, finish_addr, value32);
|
||||
smp_number = ((adc_smp_buf->buffer_size) >> 3); /*Byte to 64Byte*/
|
||||
} else {
|
||||
addr = adc_smp_buf->start_pos;
|
||||
|
||||
addr_8byte = addr >> 3;
|
||||
if (addr_8byte > finish_addr)
|
||||
smp_number = addr_8byte - finish_addr;
|
||||
else
|
||||
smp_number = finish_addr - addr_8byte;
|
||||
|
||||
dbg_print("is_round_up = ((%d)), finish_addr=((0x%x * 8Byte)), Start_Addr = ((0x%x * 8Byte)), smp_number = ((%d))\n", is_round_up, finish_addr, addr_8byte, smp_number);
|
||||
|
||||
}
|
||||
/*
|
||||
dbg_print("is_round_up = %d, finish_addr=0x%x, value32=0x%x\n", is_round_up, finish_addr, value32);
|
||||
dbg_print("end_addr = %x, adc_smp_buf->start_pos = 0x%x, adc_smp_buf->buffer_size = 0x%x\n", end_addr, adc_smp_buf->start_pos, adc_smp_buf->buffer_size);
|
||||
*/
|
||||
#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
|
||||
watchdog_stop(p_dm_odm->priv);
|
||||
#endif
|
||||
|
||||
if (p_dm_odm->support_ic_type & ODM_RTL8197F) {
|
||||
for (addr = 0x0, i = 0; addr < end_addr; addr += 8, i += 2) { /*64K byte*/
|
||||
if ((addr & 0xfff) == 0)
|
||||
odm_set_bb_reg(p_dm_odm, 0x0140, MASKLWORD, 0x780 + (addr >> 12));
|
||||
data_l = odm_get_bb_reg(p_dm_odm, 0x8000 + (addr & 0xfff), MASKDWORD);
|
||||
data_h = odm_get_bb_reg(p_dm_odm, 0x8000 + (addr & 0xfff) + 4, MASKDWORD);
|
||||
|
||||
dbg_print("%08x%08x\n", data_h, data_l);
|
||||
}
|
||||
} else {
|
||||
while (addr != (finish_addr << 3)) {
|
||||
if (page != (addr >> 12)) {
|
||||
/*Reg140=0x780+(addr>>12), addr=0x30~0x3F, total 16 pages*/
|
||||
page = (addr >> 12);
|
||||
}
|
||||
odm_set_bb_reg(p_dm_odm, 0x0140, MASKLWORD, 0x780 + page);
|
||||
|
||||
/*pDataL = 0x8000+(addr&0xfff);*/
|
||||
data_l = odm_get_bb_reg(p_dm_odm, 0x8000 + (addr & 0xfff), MASKDWORD);
|
||||
data_h = odm_get_bb_reg(p_dm_odm, 0x8000 + (addr & 0xfff) + 4, MASKDWORD);
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
|
||||
adc_smp_buf->octet[i] = data_h;
|
||||
adc_smp_buf->octet[i + 1] = data_l;
|
||||
#endif
|
||||
|
||||
#if DBG
|
||||
dbg_print("%08x%08x\n", data_h, data_l);
|
||||
#else
|
||||
#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
|
||||
RT_TRACE_EX(COMP_LA_MODE, DBG_LOUD, ("%08x%08x\n", adc_smp_buf->octet[i], adc_smp_buf->octet[i + 1]));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
i = i + 2;
|
||||
|
||||
if ((addr + 8) >= end_addr)
|
||||
addr = adc_smp_buf->start_pos;
|
||||
else
|
||||
addr = addr + 8;
|
||||
|
||||
smp_cnt++;
|
||||
if (smp_cnt >= (smp_number - 1))
|
||||
break;
|
||||
}
|
||||
dbg_print("smp_cnt = ((%d))\n", smp_cnt);
|
||||
#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
|
||||
RT_TRACE_EX(COMP_LA_MODE, DBG_LOUD, ("smp_cnt = ((%d))\n", smp_cnt));
|
||||
#endif
|
||||
}
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
|
||||
watchdog_resume(p_dm_odm->priv);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
phydm_la_mode_set_mac_iq_dump(
|
||||
void *p_dm_void
|
||||
)
|
||||
{
|
||||
struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
|
||||
struct _RT_ADCSMP *adc_smp = &(p_dm_odm->adcsmp);
|
||||
u32 reg_value;
|
||||
|
||||
odm_write_1byte(p_dm_odm, 0x7c0, 0); /*clear all 0x7c0*/
|
||||
odm_set_mac_reg(p_dm_odm, 0x7c0, BIT(0), 1); /*Enable LA mode HW block*/
|
||||
|
||||
if (adc_smp->la_trig_mode == PHYDM_MAC_TRIG) {
|
||||
|
||||
adc_smp->is_bb_trigger = 0;
|
||||
odm_set_mac_reg(p_dm_odm, 0x7c0, BIT(2), 1); /*polling bit for MAC mode*/
|
||||
odm_set_mac_reg(p_dm_odm, 0x7c0, BIT(4) | BIT3, adc_smp->la_trigger_edge); /*trigger mode for MAC*/
|
||||
|
||||
dbg_print("[MAC_trig] ref_mask = ((0x%x)), ref_value = ((0x%x)), dbg_port = ((0x%x))\n", adc_smp->la_mac_ref_mask, adc_smp->la_trig_sig_sel, adc_smp->la_dbg_port);
|
||||
/*[Set MAC Debug Port]*/
|
||||
odm_set_mac_reg(p_dm_odm, 0xF4, BIT(16), 1);
|
||||
odm_set_mac_reg(p_dm_odm, 0x38, 0xff0000, adc_smp->la_dbg_port);
|
||||
odm_set_mac_reg(p_dm_odm, 0x7c4, MASKDWORD, adc_smp->la_mac_ref_mask);
|
||||
odm_set_mac_reg(p_dm_odm, 0x7c8, MASKDWORD, adc_smp->la_trig_sig_sel);
|
||||
|
||||
} else {
|
||||
|
||||
adc_smp->is_bb_trigger = 1;
|
||||
odm_set_mac_reg(p_dm_odm, 0x7c0, BIT(1), 1); /*polling bit for BB ADC mode*/
|
||||
|
||||
if (adc_smp->la_trig_mode == PHYDM_ADC_MAC_TRIG) {
|
||||
|
||||
odm_set_mac_reg(p_dm_odm, 0x7c0, BIT(3), 1); /*polling bit for MAC trigger event*/
|
||||
odm_set_mac_reg(p_dm_odm, 0x7c0, BIT(7) | BIT(6), adc_smp->la_trig_sig_sel);
|
||||
|
||||
if (adc_smp->la_trig_sig_sel == ADCSMP_TRIG_REG)
|
||||
odm_set_mac_reg(p_dm_odm, 0x7c0, BIT(5), 1); /* manual trigger 0x7C0[5] = 0->1*/
|
||||
}
|
||||
}
|
||||
|
||||
reg_value = odm_get_bb_reg(p_dm_odm, 0x7c0, 0xff);
|
||||
dbg_print("4. [Set MAC IQ dump] 0x7c0[7:0] = ((0x%x))\n", reg_value);
|
||||
#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
|
||||
RT_TRACE_EX(COMP_LA_MODE, DBG_LOUD, ("4. [Set MAC IQ dump] 0x7c0[7:0] = ((0x%x))\n", reg_value));
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
phydm_la_mode_set_dma_type(
|
||||
void *p_dm_void,
|
||||
u8 la_dma_type
|
||||
)
|
||||
{
|
||||
struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
|
||||
|
||||
dbg_print("2. [LA mode DMA setting] Dma_type = ((%d))\n", la_dma_type);
|
||||
#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
|
||||
RT_TRACE_EX(COMP_LA_MODE, DBG_LOUD, ("2. [LA mode DMA setting] Dma_type = ((%d))\n", la_dma_type));
|
||||
#endif
|
||||
|
||||
if (p_dm_odm->support_ic_type & ODM_N_ANTDIV_SUPPORT)
|
||||
odm_set_bb_reg(p_dm_odm, 0x9a0, 0xf00, la_dma_type); /*0x9A0[11:8]*/
|
||||
else
|
||||
odm_set_bb_reg(p_dm_odm, odm_adc_trigger_jaguar2, 0xf00, la_dma_type); /*0x95C[11:8]*/
|
||||
}
|
||||
|
||||
void
|
||||
phydm_adc_smp_start(
|
||||
void *p_dm_void
|
||||
)
|
||||
{
|
||||
struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
|
||||
struct _RT_ADCSMP *adc_smp = &(p_dm_odm->adcsmp);
|
||||
u8 tmp_u1b;
|
||||
u8 backup_DMA, while_cnt = 0;
|
||||
u8 polling_ok = false, target_polling_bit;
|
||||
|
||||
phydm_la_mode_bb_setting(p_dm_odm);
|
||||
phydm_la_mode_set_dma_type(p_dm_odm, adc_smp->la_dma_type);
|
||||
phydm_la_mode_set_trigger_time(p_dm_odm, adc_smp->la_trigger_time);
|
||||
|
||||
if (p_dm_odm->support_ic_type & ODM_RTL8197F)
|
||||
odm_set_bb_reg(p_dm_odm, 0xd00, BIT(26), 0x1);
|
||||
else { /*for 8814A and 8822B?*/
|
||||
odm_write_1byte(p_dm_odm, 0x198c, 0x7);
|
||||
odm_write_1byte(p_dm_odm, 0x8b4, 0x80);
|
||||
/* odm_set_bb_reg(p_dm_odm, 0x8b4, BIT7, 1); */
|
||||
}
|
||||
|
||||
phydm_la_mode_set_mac_iq_dump(p_dm_odm);
|
||||
/* return; */
|
||||
#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
|
||||
watchdog_stop(p_dm_odm->priv);
|
||||
#endif
|
||||
|
||||
target_polling_bit = (adc_smp->is_bb_trigger) ? BIT(1) : BIT(2);
|
||||
do { /*Polling time always use 100ms, when it exceed 2s, break while loop*/
|
||||
tmp_u1b = odm_read_1byte(p_dm_odm, 0x7c0);
|
||||
|
||||
if (adc_smp->adc_smp_state != ADCSMP_STATE_SET) {
|
||||
dbg_print("[state Error] adc_smp_state != ADCSMP_STATE_SET\n");
|
||||
break;
|
||||
|
||||
} else if (tmp_u1b & target_polling_bit) {
|
||||
ODM_delay_ms(100);
|
||||
while_cnt = while_cnt + 1;
|
||||
continue;
|
||||
} else {
|
||||
dbg_print("[LA Query OK] polling_bit=((0x%x))\n", target_polling_bit);
|
||||
polling_ok = true;
|
||||
if (p_dm_odm->support_ic_type & ODM_RTL8197F)
|
||||
odm_set_bb_reg(p_dm_odm, 0x7c0, BIT(0), 0x0);
|
||||
break;
|
||||
}
|
||||
} while (while_cnt < 20);
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
|
||||
watchdog_resume(p_dm_odm->priv);
|
||||
#if (RTL8197F_SUPPORT)
|
||||
if (p_dm_odm->support_ic_type & ODM_RTL8197F) {
|
||||
/*Stop DMA*/
|
||||
backup_DMA = odm_get_mac_reg(p_dm_odm, 0x300, MASKLWORD);
|
||||
odm_set_mac_reg(p_dm_odm, 0x300, 0x7fff, backup_DMA | 0x7fff);
|
||||
|
||||
/*move LA mode content from IMEM to TxPktBuffer
|
||||
Src : OCPBASE_IMEM 0x00000000
|
||||
Dest : OCPBASE_TXBUF 0x18780000
|
||||
Len : 64K*/
|
||||
GET_HAL_INTERFACE(p_dm_odm->priv)->init_ddma_handler(p_dm_odm->priv, OCPBASE_IMEM, OCPBASE_TXBUF, 0x10000);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (adc_smp->adc_smp_state == ADCSMP_STATE_SET) {
|
||||
|
||||
if (polling_ok)
|
||||
phydm_la_get_tx_pkt_buf(p_dm_odm);
|
||||
else
|
||||
dbg_print("[Polling timeout]\n");
|
||||
}
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
|
||||
if (p_dm_odm->support_ic_type & ODM_RTL8197F)
|
||||
odm_set_mac_reg(p_dm_odm, 0x300, 0x7fff, backup_DMA); /*Resume DMA*/
|
||||
#endif
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
|
||||
if (adc_smp->adc_smp_state == ADCSMP_STATE_SET)
|
||||
adc_smp->adc_smp_state = ADCSMP_STATE_QUERY;
|
||||
#endif
|
||||
|
||||
dbg_print("[LA mode] LA_pattern_count = ((%d))\n", adc_smp->la_count);
|
||||
#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
|
||||
RT_TRACE_EX(COMP_LA_MODE, DBG_LOUD, ("[LA mode] la_count = ((%d))\n", adc_smp->la_count));
|
||||
#endif
|
||||
|
||||
|
||||
adc_smp_stop(p_dm_odm);
|
||||
|
||||
if (adc_smp->la_count == 0) {
|
||||
dbg_print("LA Dump finished ---------->\n\n\n");
|
||||
/**/
|
||||
} else {
|
||||
adc_smp->la_count--;
|
||||
dbg_print("LA Dump more ---------->\n\n\n");
|
||||
adc_smp_set(p_dm_odm, adc_smp->la_trig_mode, adc_smp->la_trig_sig_sel, adc_smp->la_dma_type, adc_smp->la_trigger_time, 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
|
||||
void
|
||||
adc_smp_work_item_callback(
|
||||
void *p_context
|
||||
)
|
||||
{
|
||||
struct _ADAPTER *adapter = (struct _ADAPTER *)p_context;
|
||||
PHAL_DATA_TYPE p_hal_data = GET_HAL_DATA(adapter);
|
||||
struct PHY_DM_STRUCT *p_dm_odm = &p_hal_data->DM_OutSrc;
|
||||
struct _RT_ADCSMP *adc_smp = &(p_dm_odm->adcsmp);
|
||||
|
||||
dbg_print("[WorkItem Call back] LA_State=((%d))\n", adc_smp->adc_smp_state);
|
||||
phydm_adc_smp_start(p_dm_odm);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
adc_smp_set(
|
||||
void *p_dm_void,
|
||||
u8 trig_mode,
|
||||
u32 trig_sig_sel,
|
||||
u8 dma_data_sig_sel,
|
||||
u32 trigger_time,
|
||||
u16 polling_time
|
||||
)
|
||||
{
|
||||
struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
|
||||
bool is_set_success = true;
|
||||
struct _RT_ADCSMP *adc_smp = &(p_dm_odm->adcsmp);
|
||||
|
||||
adc_smp->la_trig_mode = trig_mode;
|
||||
adc_smp->la_trig_sig_sel = trig_sig_sel;
|
||||
adc_smp->la_dma_type = dma_data_sig_sel;
|
||||
adc_smp->la_trigger_time = trigger_time;
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
|
||||
if (adc_smp->adc_smp_state != ADCSMP_STATE_IDLE)
|
||||
is_set_success = false;
|
||||
else if (adc_smp->adc_smp_buf.length == 0)
|
||||
is_set_success = phydm_la_buffer_allocate(p_dm_odm);
|
||||
#endif
|
||||
|
||||
if (is_set_success) {
|
||||
adc_smp->adc_smp_state = ADCSMP_STATE_SET;
|
||||
|
||||
dbg_print("[LA Set Success] LA_State=((%d))\n", adc_smp->adc_smp_state);
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
|
||||
|
||||
dbg_print("ADCSmp_work_item_index = ((%d))\n", adc_smp->la_work_item_index);
|
||||
if (adc_smp->la_work_item_index != 0) {
|
||||
odm_schedule_work_item(&(adc_smp->adc_smp_work_item_1));
|
||||
adc_smp->la_work_item_index = 0;
|
||||
} else {
|
||||
odm_schedule_work_item(&(adc_smp->adc_smp_work_item));
|
||||
adc_smp->la_work_item_index = 1;
|
||||
}
|
||||
#else
|
||||
phydm_adc_smp_start(p_dm_odm);
|
||||
#endif
|
||||
} else
|
||||
dbg_print("[LA Set Fail] LA_State=((%d))\n", adc_smp->adc_smp_state);
|
||||
|
||||
|
||||
}
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
|
||||
enum rt_status
|
||||
adc_smp_query(
|
||||
void *p_dm_void,
|
||||
ULONG information_buffer_length,
|
||||
void *information_buffer,
|
||||
PULONG bytes_written
|
||||
)
|
||||
{
|
||||
struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
|
||||
struct _RT_ADCSMP *adc_smp = &(p_dm_odm->adcsmp);
|
||||
enum rt_status ret_status = RT_STATUS_SUCCESS;
|
||||
struct _RT_ADCSMP_STRING *adc_smp_buf = &(adc_smp->adc_smp_buf);
|
||||
|
||||
dbg_print("[%s] LA_State=((%d))", __func__, adc_smp->adc_smp_state);
|
||||
|
||||
if (information_buffer_length != adc_smp_buf->buffer_size) {
|
||||
*bytes_written = 0;
|
||||
ret_status = RT_STATUS_RESOURCE;
|
||||
} else if (adc_smp_buf->length != adc_smp_buf->buffer_size) {
|
||||
*bytes_written = 0;
|
||||
ret_status = RT_STATUS_RESOURCE;
|
||||
} else if (adc_smp->adc_smp_state != ADCSMP_STATE_QUERY) {
|
||||
*bytes_written = 0;
|
||||
ret_status = RT_STATUS_PENDING;
|
||||
} else {
|
||||
odm_move_memory(p_dm_odm, information_buffer, adc_smp_buf->octet, adc_smp_buf->buffer_size);
|
||||
*bytes_written = adc_smp_buf->buffer_size;
|
||||
|
||||
adc_smp->adc_smp_state = ADCSMP_STATE_IDLE;
|
||||
}
|
||||
|
||||
dbg_print("Return status %d\n", ret_status);
|
||||
|
||||
return ret_status;
|
||||
}
|
||||
#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
|
||||
|
||||
void
|
||||
adc_smp_query(
|
||||
void *p_dm_void,
|
||||
void *output,
|
||||
u32 out_len,
|
||||
u32 *pused
|
||||
)
|
||||
{
|
||||
struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
|
||||
struct _RT_ADCSMP *adc_smp = &(p_dm_odm->adcsmp);
|
||||
struct _RT_ADCSMP_STRING *adc_smp_buf = &(adc_smp->adc_smp_buf);
|
||||
u32 used = *pused;
|
||||
u32 i;
|
||||
/* struct timespec t; */
|
||||
/* rtw_get_current_timespec(&t); */
|
||||
|
||||
dbg_print("%s adc_smp_state %d", __func__, adc_smp->adc_smp_state);
|
||||
|
||||
for (i = 0; i < (adc_smp_buf->length >> 2) - 2; i += 2) {
|
||||
PHYDM_SNPRINTF((output + used, out_len - used,
|
||||
"%08x%08x\n", adc_smp_buf->octet[i], adc_smp_buf->octet[i + 1]));
|
||||
}
|
||||
|
||||
PHYDM_SNPRINTF((output + used, out_len - used, "\n"));
|
||||
/* PHYDM_SNPRINTF((output+used, out_len-used, "\n[%lu.%06lu]\n", t.tv_sec, t.tv_nsec)); */
|
||||
*pused = used;
|
||||
}
|
||||
|
||||
s32
|
||||
adc_smp_get_sample_counts(
|
||||
void *p_dm_void
|
||||
)
|
||||
{
|
||||
struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
|
||||
struct _RT_ADCSMP *adc_smp = &(p_dm_odm->adcsmp);
|
||||
struct _RT_ADCSMP_STRING *adc_smp_buf = &(adc_smp->adc_smp_buf);
|
||||
|
||||
return (adc_smp_buf->length >> 2) - 2;
|
||||
}
|
||||
|
||||
s32
|
||||
adc_smp_query_single_data(
|
||||
void *p_dm_void,
|
||||
void *output,
|
||||
u32 out_len,
|
||||
u32 index
|
||||
)
|
||||
{
|
||||
struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
|
||||
struct _RT_ADCSMP *adc_smp = &(p_dm_odm->adcsmp);
|
||||
struct _RT_ADCSMP_STRING *adc_smp_buf = &(adc_smp->adc_smp_buf);
|
||||
u32 used = 0;
|
||||
|
||||
/* dbg_print("%s adc_smp_state %d\n", __func__, adc_smp->adc_smp_state); */
|
||||
if (adc_smp->adc_smp_state != ADCSMP_STATE_QUERY) {
|
||||
PHYDM_SNPRINTF((output + used, out_len - used,
|
||||
"Error: la data is not ready yet ...\n"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (index < ((adc_smp_buf->length >> 2) - 2)) {
|
||||
PHYDM_SNPRINTF((output + used, out_len - used, "%08x%08x\n",
|
||||
adc_smp_buf->octet[index], adc_smp_buf->octet[index + 1]));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void
|
||||
adc_smp_stop(
|
||||
void *p_dm_void
|
||||
)
|
||||
{
|
||||
struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
|
||||
struct _RT_ADCSMP *adc_smp = &(p_dm_odm->adcsmp);
|
||||
|
||||
adc_smp->adc_smp_state = ADCSMP_STATE_IDLE;
|
||||
dbg_print("[LA_Stop] LA_state = ((%d))\n", adc_smp->adc_smp_state);
|
||||
}
|
||||
|
||||
void
|
||||
adc_smp_init(
|
||||
void *p_dm_void
|
||||
)
|
||||
{
|
||||
struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
|
||||
struct _RT_ADCSMP *adc_smp = &(p_dm_odm->adcsmp);
|
||||
struct _RT_ADCSMP_STRING *adc_smp_buf = &(adc_smp->adc_smp_buf);
|
||||
|
||||
adc_smp->adc_smp_state = ADCSMP_STATE_IDLE;
|
||||
|
||||
if (p_dm_odm->support_ic_type & ODM_RTL8814A) {
|
||||
adc_smp_buf->start_pos = 0x30000;
|
||||
adc_smp_buf->buffer_size = 0x10000;
|
||||
} else if (p_dm_odm->support_ic_type & ODM_RTL8822B) {
|
||||
adc_smp_buf->start_pos = 0x20000;
|
||||
adc_smp_buf->buffer_size = 0x20000;
|
||||
} else if (p_dm_odm->support_ic_type & ODM_RTL8197F) {
|
||||
adc_smp_buf->start_pos = 0x00000;
|
||||
adc_smp_buf->buffer_size = 0x10000;
|
||||
} else if (p_dm_odm->support_ic_type & ODM_RTL8821C) {
|
||||
adc_smp_buf->start_pos = 0x8000;
|
||||
adc_smp_buf->buffer_size = 0x8000;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
|
||||
void
|
||||
adc_smp_de_init(
|
||||
void *p_dm_void
|
||||
)
|
||||
{
|
||||
struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
|
||||
struct _RT_ADCSMP *adc_smp = &(p_dm_odm->adcsmp);
|
||||
struct _RT_ADCSMP_STRING *adc_smp_buf = &(adc_smp->adc_smp_buf);
|
||||
|
||||
adc_smp_stop(p_dm_odm);
|
||||
|
||||
if (adc_smp_buf->length != 0x0) {
|
||||
odm_free_memory(p_dm_odm, adc_smp_buf->octet, adc_smp_buf->length);
|
||||
adc_smp_buf->length = 0x0;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
void
|
||||
phydm_la_mode_bb_setting(
|
||||
void *p_dm_void
|
||||
)
|
||||
{
|
||||
struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
|
||||
struct _RT_ADCSMP *adc_smp = &(p_dm_odm->adcsmp);
|
||||
|
||||
u8 trig_mode = adc_smp->la_trig_mode;
|
||||
u32 trig_sig_sel = adc_smp->la_trig_sig_sel;
|
||||
u32 dbg_port = adc_smp->la_dbg_port;
|
||||
u8 is_trigger_edge = adc_smp->la_trigger_edge;
|
||||
u8 sampling_rate = adc_smp->la_smp_rate;
|
||||
|
||||
dbg_print("1. [LA mode bb_setting] trig_mode = ((%d)), dbg_port = ((0x%x)), Trig_Edge = ((%d)), smp_rate = ((%d)), Trig_Sel = ((0x%x))\n",
|
||||
trig_mode, dbg_port, is_trigger_edge, sampling_rate, trig_sig_sel);
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
|
||||
RT_TRACE_EX(COMP_LA_MODE, DBG_LOUD, ("1. [LA mode bb_setting]trig_mode = ((%d)), dbg_port = ((0x%x)), Trig_Edge = ((%d)), smp_rate = ((%d)), Trig_Sel = ((0x%x))\n",
|
||||
trig_mode, dbg_port, is_trigger_edge, sampling_rate, trig_sig_sel));
|
||||
#endif
|
||||
|
||||
if (trig_mode == PHYDM_MAC_TRIG)
|
||||
trig_sig_sel = 0; /*ignore this setting*/
|
||||
|
||||
if (p_dm_odm->support_ic_type & ODM_IC_11AC_SERIES) {
|
||||
|
||||
if (trig_mode == PHYDM_ADC_RF0_TRIG) {
|
||||
odm_set_bb_reg(p_dm_odm, 0x8f8, BIT(25) | BIT24 | BIT23 | BIT22, 9); /*DBGOUT_RFC_a[31:0]*/
|
||||
} else if (trig_mode == PHYDM_ADC_RF1_TRIG) {
|
||||
odm_set_bb_reg(p_dm_odm, 0x8f8, BIT(25) | BIT24 | BIT23 | BIT22, 8); /*DBGOUT_RFC_b[31:0]*/
|
||||
} else
|
||||
odm_set_bb_reg(p_dm_odm, 0x8f8, BIT(25) | BIT(24) | BIT(23) | BIT(22), 0);
|
||||
/*
|
||||
(0:) '{ofdm_dbg[31:0]}'
|
||||
(1:) '{cca,crc32_fail,dbg_ofdm[29:0]}'
|
||||
(2:) '{vbon,crc32_fail,dbg_ofdm[29:0]}'
|
||||
(3:) '{cca,crc32_ok,dbg_ofdm[29:0]}'
|
||||
(4:) '{vbon,crc32_ok,dbg_ofdm[29:0]}'
|
||||
(5:) '{dbg_iqk_anta}'
|
||||
(6:) '{cca,ofdm_crc_ok,dbg_dp_anta[29:0]}'
|
||||
(7:) '{dbg_iqk_antb}'
|
||||
(8:) '{DBGOUT_RFC_b[31:0]}'
|
||||
(9:) '{DBGOUT_RFC_a[31:0]}'
|
||||
(a:) '{dbg_ofdm}'
|
||||
(b:) '{dbg_cck}'
|
||||
*/
|
||||
|
||||
odm_set_bb_reg(p_dm_odm, 0x198C, BIT(2) | BIT1 | BIT0, 7); /*disable dbg clk gating*/
|
||||
|
||||
/*dword= odm_get_bb_reg(p_dm_odm, 0x8FC, MASKDWORD);*/
|
||||
/*dbg_print("dbg_port = ((0x%x))\n", dword);*/
|
||||
odm_set_bb_reg(p_dm_odm, 0x95C, 0x1f, trig_sig_sel); /*0x95C[4:0], BB debug port bit*/
|
||||
odm_set_bb_reg(p_dm_odm, 0x8FC, MASKDWORD, dbg_port);
|
||||
odm_set_bb_reg(p_dm_odm, 0x95C, BIT(31), is_trigger_edge); /*0: posedge, 1: negedge*/
|
||||
odm_set_bb_reg(p_dm_odm, 0x95c, 0xe0, sampling_rate);
|
||||
/* (0:) '80MHz'
|
||||
(1:) '40MHz'
|
||||
(2:) '20MHz'
|
||||
(3:) '10MHz'
|
||||
(4:) '5MHz'
|
||||
(5:) '2.5MHz'
|
||||
(6:) '1.25MHz'
|
||||
(7:) '160MHz (for BW160 ic)'
|
||||
*/
|
||||
} else {
|
||||
odm_set_bb_reg(p_dm_odm, 0x9a0, 0x1f, trig_sig_sel); /*0x9A0[4:0], BB debug port bit*/
|
||||
odm_set_bb_reg(p_dm_odm, 0x908, MASKDWORD, dbg_port);
|
||||
odm_set_bb_reg(p_dm_odm, 0x9A0, BIT(31), is_trigger_edge); /*0: posedge, 1: negedge*/
|
||||
odm_set_bb_reg(p_dm_odm, 0x9A0, 0xe0, sampling_rate);
|
||||
/* (0:) '80MHz'
|
||||
(1:) '40MHz'
|
||||
(2:) '20MHz'
|
||||
(3:) '10MHz'
|
||||
(4:) '5MHz'
|
||||
(5:) '2.5MHz'
|
||||
(6:) '1.25MHz'
|
||||
(7:) '160MHz (for BW160 ic)'
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
phydm_la_mode_set_trigger_time(
|
||||
void *p_dm_void,
|
||||
u32 trigger_time_mu_sec
|
||||
)
|
||||
{
|
||||
struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
|
||||
u8 trigger_time_unit_num;
|
||||
u32 time_unit = 0;
|
||||
|
||||
if (trigger_time_mu_sec < 128) {
|
||||
time_unit = 0; /*unit: 1mu sec*/
|
||||
} else if (trigger_time_mu_sec < 256) {
|
||||
time_unit = 1; /*unit: 2mu sec*/
|
||||
} else if (trigger_time_mu_sec < 512) {
|
||||
time_unit = 2; /*unit: 4mu sec*/
|
||||
} else if (trigger_time_mu_sec < 1024) {
|
||||
time_unit = 3; /*unit: 8mu sec*/
|
||||
} else if (trigger_time_mu_sec < 2048) {
|
||||
time_unit = 4; /*unit: 16mu sec*/
|
||||
} else if (trigger_time_mu_sec < 4096) {
|
||||
time_unit = 5; /*unit: 32mu sec*/
|
||||
} else if (trigger_time_mu_sec < 8192) {
|
||||
time_unit = 6; /*unit: 64mu sec*/
|
||||
}
|
||||
|
||||
trigger_time_unit_num = (u8)(trigger_time_mu_sec >> time_unit);
|
||||
|
||||
dbg_print("3. [Set Trigger Time] Trig_Time = ((%d)) * unit = ((2^%d us))\n", trigger_time_unit_num, time_unit);
|
||||
#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
|
||||
RT_TRACE_EX(COMP_LA_MODE, DBG_LOUD, ("3. [Set Trigger Time] Trig_Time = ((%d)) * unit = ((2^%d us))\n", trigger_time_unit_num, time_unit));
|
||||
#endif
|
||||
|
||||
odm_set_mac_reg(p_dm_odm, 0x7cc, BIT(20) | BIT(19) | BIT(18), time_unit);
|
||||
odm_set_mac_reg(p_dm_odm, 0x7c0, 0x7f00, (trigger_time_unit_num & 0x7f));
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
phydm_lamode_trigger_setting(
|
||||
void *p_dm_void,
|
||||
char input[][16],
|
||||
u32 *_used,
|
||||
char *output,
|
||||
u32 *_out_len,
|
||||
u32 input_num
|
||||
)
|
||||
{
|
||||
struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
|
||||
struct _RT_ADCSMP *adc_smp = &(p_dm_odm->adcsmp);
|
||||
u8 trig_mode, dma_data_sig_sel;
|
||||
u32 trig_sig_sel;
|
||||
bool is_enable_la_mode, is_trigger_edge;
|
||||
u32 dbg_port, trigger_time_mu_sec;
|
||||
u32 mac_ref_signal_mask;
|
||||
u8 sampling_rate = 0, i;
|
||||
char help[] = "-h";
|
||||
u32 var1[10] = {0};
|
||||
u32 used = *_used;
|
||||
u32 out_len = *_out_len;
|
||||
|
||||
if (p_dm_odm->support_ic_type & PHYDM_IC_SUPPORT_LA_MODE) {
|
||||
|
||||
PHYDM_SSCANF(input[1], DCMD_DECIMAL, &var1[0]);
|
||||
is_enable_la_mode = (bool)var1[0];
|
||||
/*dbg_print("echo cmd input_num = %d\n", input_num);*/
|
||||
|
||||
if ((strcmp(input[1], help) == 0)) {
|
||||
PHYDM_SNPRINTF((output + used, out_len - used, "{En} {0:BB,1:BB_MAC,2:RF0,3:RF1,4:MAC} \n {BB:dbg_port[bit],BB_MAC:0-ok/1-fail/2-cca,MAC:ref} {DMA type} {TrigTime} \n {polling_time/ref_mask} {dbg_port} {0:P_Edge, 1:N_Edge} {SpRate:0-80M,1-40M,2-20M} {Capture num}\n"));
|
||||
/**/
|
||||
} else if ((is_enable_la_mode == 1)) {
|
||||
|
||||
PHYDM_SSCANF(input[2], DCMD_DECIMAL, &var1[1]);
|
||||
|
||||
trig_mode = (u8)var1[1];
|
||||
|
||||
if (trig_mode == PHYDM_MAC_TRIG)
|
||||
PHYDM_SSCANF(input[3], DCMD_HEX, &var1[2]);
|
||||
else
|
||||
PHYDM_SSCANF(input[3], DCMD_DECIMAL, &var1[2]);
|
||||
trig_sig_sel = var1[2];
|
||||
|
||||
PHYDM_SSCANF(input[4], DCMD_DECIMAL, &var1[3]);
|
||||
PHYDM_SSCANF(input[5], DCMD_DECIMAL, &var1[4]);
|
||||
PHYDM_SSCANF(input[6], DCMD_HEX, &var1[5]);
|
||||
PHYDM_SSCANF(input[7], DCMD_HEX, &var1[6]);
|
||||
PHYDM_SSCANF(input[8], DCMD_DECIMAL, &var1[7]);
|
||||
PHYDM_SSCANF(input[9], DCMD_DECIMAL, &var1[8]);
|
||||
PHYDM_SSCANF(input[10], DCMD_DECIMAL, &var1[9]);
|
||||
|
||||
dma_data_sig_sel = (u8)var1[3];
|
||||
trigger_time_mu_sec = var1[4]; /*unit: us*/
|
||||
|
||||
adc_smp->la_mac_ref_mask = var1[5];
|
||||
adc_smp->la_dbg_port = var1[6];
|
||||
adc_smp->la_trigger_edge = (u8) var1[7];
|
||||
adc_smp->la_smp_rate = (u8)(var1[8] & 0x7);
|
||||
adc_smp->la_count = var1[9];
|
||||
|
||||
|
||||
dbg_print("echo lamode %d %d %d %d %d %d %x %d %d %d\n", var1[0], var1[1], var1[2], var1[3], var1[4], var1[5], var1[6], var1[7], var1[8], var1[9]);
|
||||
#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
|
||||
RT_TRACE_EX(COMP_LA_MODE, DBG_LOUD, ("echo lamode %d %d %d %d %d %d %x %d %d %d\n", var1[0], var1[1], var1[2], var1[3], var1[4], var1[5], var1[6], var1[7], var1[8], var1[9]));
|
||||
#endif
|
||||
|
||||
PHYDM_SNPRINTF((output + used, out_len - used, "a.En= ((1)), b.mode = ((%d)), c.Trig_Sel = ((0x%x)), d.Dma_type = ((%d))\n", trig_mode, trig_sig_sel, dma_data_sig_sel));
|
||||
PHYDM_SNPRINTF((output + used, out_len - used, "e.Trig_Time = ((%dus)), f.mac_ref_mask = ((0x%x)), g.dbg_port = ((0x%x))\n", trigger_time_mu_sec, adc_smp->la_mac_ref_mask, adc_smp->la_dbg_port));
|
||||
PHYDM_SNPRINTF((output + used, out_len - used, "h.Trig_edge = ((%d)), i.smp rate = ((%d MHz)), j.Cap_num = ((%d))\n", adc_smp->la_trigger_edge, (80 >> adc_smp->la_smp_rate), adc_smp->la_count));
|
||||
|
||||
adc_smp_set(p_dm_odm, trig_mode, trig_sig_sel, dma_data_sig_sel, trigger_time_mu_sec, 0);
|
||||
|
||||
} else {
|
||||
adc_smp_stop(p_dm_odm);
|
||||
PHYDM_SNPRINTF((output + used, out_len - used, "Disable LA mode\n"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*endif PHYDM_LA_MODE_SUPPORT == 1*/
|
147
hal/phydm/phydm_adc_sampling.h
Normal file
147
hal/phydm/phydm_adc_sampling.h
Normal file
|
@ -0,0 +1,147 @@
|
|||
#ifndef __INC_ADCSMP_H
|
||||
#define __INC_ADCSMP_H
|
||||
|
||||
#define DYNAMIC_LA_MODE "1.0" /*2016.07.15 Dino */
|
||||
|
||||
#if (PHYDM_LA_MODE_SUPPORT == 1)
|
||||
|
||||
struct _RT_ADCSMP_STRING {
|
||||
u32 *octet;
|
||||
u32 length;
|
||||
u32 buffer_size;
|
||||
u32 start_pos;
|
||||
};
|
||||
|
||||
|
||||
enum rt_adcsmp_trig_sel {
|
||||
PHYDM_ADC_BB_TRIG = 0,
|
||||
PHYDM_ADC_MAC_TRIG = 1,
|
||||
PHYDM_ADC_RF0_TRIG = 2,
|
||||
PHYDM_ADC_RF1_TRIG = 3,
|
||||
PHYDM_MAC_TRIG = 4
|
||||
};
|
||||
|
||||
|
||||
enum rt_adcsmp_trig_sig_sel {
|
||||
ADCSMP_TRIG_CRCOK = 0,
|
||||
ADCSMP_TRIG_CRCFAIL = 1,
|
||||
ADCSMP_TRIG_CCA = 2,
|
||||
ADCSMP_TRIG_REG = 3
|
||||
};
|
||||
|
||||
|
||||
enum rt_adcsmp_state {
|
||||
ADCSMP_STATE_IDLE = 0,
|
||||
ADCSMP_STATE_SET = 1,
|
||||
ADCSMP_STATE_QUERY = 2
|
||||
};
|
||||
|
||||
|
||||
struct _RT_ADCSMP {
|
||||
struct _RT_ADCSMP_STRING adc_smp_buf;
|
||||
enum rt_adcsmp_state adc_smp_state;
|
||||
u8 la_trig_mode;
|
||||
u32 la_trig_sig_sel;
|
||||
u8 la_dma_type;
|
||||
u32 la_trigger_time;
|
||||
u32 la_mac_ref_mask;
|
||||
u32 la_dbg_port;
|
||||
u8 la_trigger_edge;
|
||||
u8 la_smp_rate;
|
||||
u32 la_count;
|
||||
u8 is_bb_trigger;
|
||||
u8 la_work_item_index;
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
|
||||
RT_WORK_ITEM adc_smp_work_item;
|
||||
RT_WORK_ITEM adc_smp_work_item_1;
|
||||
#endif
|
||||
};
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
|
||||
void
|
||||
adc_smp_work_item_callback(
|
||||
void *p_context
|
||||
);
|
||||
#endif
|
||||
|
||||
void
|
||||
adc_smp_set(
|
||||
void *p_dm_void,
|
||||
u8 trig_mode,
|
||||
u32 trig_sig_sel,
|
||||
u8 dma_data_sig_sel,
|
||||
u32 trigger_time,
|
||||
u16 polling_time
|
||||
);
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
|
||||
enum rt_status
|
||||
adc_smp_query(
|
||||
void *p_dm_void,
|
||||
ULONG information_buffer_length,
|
||||
void *information_buffer,
|
||||
PULONG bytes_written
|
||||
);
|
||||
#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
|
||||
void
|
||||
adc_smp_query(
|
||||
void *p_dm_void,
|
||||
void *output,
|
||||
u32 out_len,
|
||||
u32 *pused
|
||||
);
|
||||
|
||||
s32
|
||||
adc_smp_get_sample_counts(
|
||||
void *p_dm_void
|
||||
);
|
||||
|
||||
s32
|
||||
adc_smp_query_single_data(
|
||||
void *p_dm_void,
|
||||
void *output,
|
||||
u32 out_len,
|
||||
u32 index
|
||||
);
|
||||
|
||||
#endif
|
||||
void
|
||||
adc_smp_stop(
|
||||
void *p_dm_void
|
||||
);
|
||||
|
||||
void
|
||||
adc_smp_init(
|
||||
void *p_dm_void
|
||||
);
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
|
||||
void
|
||||
adc_smp_de_init(
|
||||
void *p_dm_void
|
||||
);
|
||||
#endif
|
||||
|
||||
void
|
||||
phydm_la_mode_bb_setting(
|
||||
void *p_dm_void
|
||||
);
|
||||
|
||||
void
|
||||
phydm_la_mode_set_trigger_time(
|
||||
void *p_dm_void,
|
||||
u32 trigger_time_mu_sec
|
||||
);
|
||||
|
||||
void
|
||||
phydm_lamode_trigger_setting(
|
||||
void *p_dm_void,
|
||||
char input[][16],
|
||||
u32 *_used,
|
||||
char *output,
|
||||
u32 *_out_len,
|
||||
u32 input_num
|
||||
);
|
||||
#endif
|
||||
#endif
|
864
hal/phydm/phydm_antdect.c
Normal file
864
hal/phydm/phydm_antdect.c
Normal file
|
@ -0,0 +1,864 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* 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 |ODM_CE)) */
|
||||
#if (defined(CONFIG_ANT_DETECTION))
|
||||
|
||||
/* IS_ANT_DETECT_SUPPORT_SINGLE_TONE(adapter)
|
||||
* IS_ANT_DETECT_SUPPORT_RSSI(adapter)
|
||||
* IS_ANT_DETECT_SUPPORT_PSD(adapter) */
|
||||
|
||||
/* 1 [1. Single Tone method] =================================================== */
|
||||
|
||||
/*
|
||||
* Description:
|
||||
* Set Single/Dual Antenna default setting for products that do not do detection in advance.
|
||||
*
|
||||
* Added by Joseph, 2012.03.22
|
||||
* */
|
||||
void
|
||||
odm_single_dual_antenna_default_setting(
|
||||
void *p_dm_void
|
||||
)
|
||||
{
|
||||
struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
|
||||
struct _sw_antenna_switch_ *p_dm_swat_table = &p_dm_odm->dm_swat_table;
|
||||
struct _ADAPTER *p_adapter = p_dm_odm->adapter;
|
||||
|
||||
u8 bt_ant_num = BT_GetPgAntNum(p_adapter);
|
||||
/* Set default antenna A and B status */
|
||||
if (bt_ant_num == 2) {
|
||||
p_dm_swat_table->ANTA_ON = true;
|
||||
p_dm_swat_table->ANTB_ON = true;
|
||||
|
||||
} else if (bt_ant_num == 1) {
|
||||
/* Set antenna A as default */
|
||||
p_dm_swat_table->ANTA_ON = true;
|
||||
p_dm_swat_table->ANTB_ON = false;
|
||||
|
||||
} else
|
||||
RT_ASSERT(false, ("Incorrect antenna number!!\n"));
|
||||
}
|
||||
|
||||
|
||||
/* 2 8723A ANT DETECT
|
||||
*
|
||||
* Description:
|
||||
* Implement IQK single tone for RF DPK loopback and BB PSD scanning.
|
||||
* This function is cooperated with BB team Neil.
|
||||
*
|
||||
* Added by Roger, 2011.12.15
|
||||
* */
|
||||
bool
|
||||
odm_single_dual_antenna_detection(
|
||||
void *p_dm_void,
|
||||
u8 mode
|
||||
)
|
||||
{
|
||||
struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
|
||||
struct _ADAPTER *p_adapter = p_dm_odm->adapter;
|
||||
struct _sw_antenna_switch_ *p_dm_swat_table = &p_dm_odm->dm_swat_table;
|
||||
u32 current_channel, rf_loop_reg;
|
||||
u8 n;
|
||||
u32 reg88c, regc08, reg874, regc50, reg948, regb2c, reg92c, reg930, reg064, afe_rrx_wait_cca;
|
||||
u8 initial_gain = 0x5a;
|
||||
u32 PSD_report_tmp;
|
||||
u32 ant_a_report = 0x0, ant_b_report = 0x0, ant_0_report = 0x0;
|
||||
bool is_result = true;
|
||||
u32 afe_backup[16];
|
||||
u32 AFE_REG_8723A[16] = {
|
||||
REG_RX_WAIT_CCA, REG_TX_CCK_RFON,
|
||||
REG_TX_CCK_BBON, REG_TX_OFDM_RFON,
|
||||
REG_TX_OFDM_BBON, REG_TX_TO_RX,
|
||||
REG_TX_TO_TX, REG_RX_CCK,
|
||||
REG_RX_OFDM, REG_RX_WAIT_RIFS,
|
||||
REG_RX_TO_RX, REG_STANDBY,
|
||||
REG_SLEEP, REG_PMPD_ANAEN,
|
||||
REG_FPGA0_XCD_SWITCH_CONTROL, REG_BLUE_TOOTH
|
||||
};
|
||||
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("odm_single_dual_antenna_detection()============>\n"));
|
||||
|
||||
|
||||
if (!(p_dm_odm->support_ic_type & ODM_RTL8723B))
|
||||
return is_result;
|
||||
|
||||
/* Retrieve antenna detection registry info, added by Roger, 2012.11.27. */
|
||||
if (!IS_ANT_DETECT_SUPPORT_SINGLE_TONE(p_adapter))
|
||||
return is_result;
|
||||
|
||||
/* 1 Backup Current RF/BB Settings */
|
||||
|
||||
current_channel = odm_get_rf_reg(p_dm_odm, ODM_RF_PATH_A, ODM_CHANNEL, RFREGOFFSETMASK);
|
||||
rf_loop_reg = odm_get_rf_reg(p_dm_odm, ODM_RF_PATH_A, 0x00, RFREGOFFSETMASK);
|
||||
if (p_dm_odm->support_ic_type & ODM_RTL8723B) {
|
||||
reg92c = odm_get_bb_reg(p_dm_odm, REG_DPDT_CONTROL, MASKDWORD);
|
||||
reg930 = odm_get_bb_reg(p_dm_odm, rfe_ctrl_anta_src, MASKDWORD);
|
||||
reg948 = odm_get_bb_reg(p_dm_odm, REG_S0_S1_PATH_SWITCH, MASKDWORD);
|
||||
regb2c = odm_get_bb_reg(p_dm_odm, REG_AGC_TABLE_SELECT, MASKDWORD);
|
||||
reg064 = odm_get_mac_reg(p_dm_odm, REG_SYM_WLBT_PAPE_SEL, BIT(29));
|
||||
odm_set_bb_reg(p_dm_odm, REG_DPDT_CONTROL, 0x3, 0x1);
|
||||
odm_set_bb_reg(p_dm_odm, rfe_ctrl_anta_src, 0xff, 0x77);
|
||||
odm_set_mac_reg(p_dm_odm, REG_SYM_WLBT_PAPE_SEL, BIT(29), 0x1); /* dbg 7 */
|
||||
odm_set_bb_reg(p_dm_odm, REG_S0_S1_PATH_SWITCH, 0x3c0, 0x0);/* dbg 8 */
|
||||
odm_set_bb_reg(p_dm_odm, REG_AGC_TABLE_SELECT, BIT(31), 0x0);
|
||||
}
|
||||
|
||||
odm_stall_execution(10);
|
||||
|
||||
/* Store A path Register 88c, c08, 874, c50 */
|
||||
reg88c = odm_get_bb_reg(p_dm_odm, REG_FPGA0_ANALOG_PARAMETER4, MASKDWORD);
|
||||
regc08 = odm_get_bb_reg(p_dm_odm, REG_OFDM_0_TR_MUX_PAR, MASKDWORD);
|
||||
reg874 = odm_get_bb_reg(p_dm_odm, REG_FPGA0_XCD_RF_INTERFACE_SW, MASKDWORD);
|
||||
regc50 = odm_get_bb_reg(p_dm_odm, REG_OFDM_0_XA_AGC_CORE1, MASKDWORD);
|
||||
|
||||
/* Store AFE Registers */
|
||||
if (p_dm_odm->support_ic_type & ODM_RTL8723B)
|
||||
afe_rrx_wait_cca = odm_get_bb_reg(p_dm_odm, REG_RX_WAIT_CCA, MASKDWORD);
|
||||
|
||||
/* Set PSD 128 pts */
|
||||
odm_set_bb_reg(p_dm_odm, REG_FPGA0_PSD_FUNCTION, BIT(14) | BIT15, 0x0); /* 128 pts */
|
||||
|
||||
/* To SET CH1 to do */
|
||||
odm_set_rf_reg(p_dm_odm, ODM_RF_PATH_A, ODM_CHANNEL, RFREGOFFSETMASK, 0x7401); /* channel 1 */
|
||||
|
||||
/* AFE all on step */
|
||||
if (p_dm_odm->support_ic_type & ODM_RTL8723B)
|
||||
odm_set_bb_reg(p_dm_odm, REG_RX_WAIT_CCA, MASKDWORD, 0x01c00016);
|
||||
|
||||
/* 3 wire Disable */
|
||||
odm_set_bb_reg(p_dm_odm, REG_FPGA0_ANALOG_PARAMETER4, MASKDWORD, 0xCCF000C0);
|
||||
|
||||
/* BB IQK setting */
|
||||
odm_set_bb_reg(p_dm_odm, REG_OFDM_0_TR_MUX_PAR, MASKDWORD, 0x000800E4);
|
||||
odm_set_bb_reg(p_dm_odm, REG_FPGA0_XCD_RF_INTERFACE_SW, MASKDWORD, 0x22208000);
|
||||
|
||||
/* IQK setting tone@ 4.34Mhz */
|
||||
odm_set_bb_reg(p_dm_odm, REG_TX_IQK_TONE_A, MASKDWORD, 0x10008C1C);
|
||||
odm_set_bb_reg(p_dm_odm, REG_TX_IQK, MASKDWORD, 0x01007c00);
|
||||
|
||||
/* Page B init */
|
||||
odm_set_bb_reg(p_dm_odm, REG_CONFIG_ANT_A, MASKDWORD, 0x00080000);
|
||||
odm_set_bb_reg(p_dm_odm, REG_CONFIG_ANT_A, MASKDWORD, 0x0f600000);
|
||||
odm_set_bb_reg(p_dm_odm, REG_RX_IQK, MASKDWORD, 0x01004800);
|
||||
odm_set_bb_reg(p_dm_odm, REG_RX_IQK_TONE_A, MASKDWORD, 0x10008c1f);
|
||||
if (p_dm_odm->support_ic_type & ODM_RTL8723B) {
|
||||
odm_set_bb_reg(p_dm_odm, REG_TX_IQK_PI_A, MASKDWORD, 0x82150016);
|
||||
odm_set_bb_reg(p_dm_odm, REG_RX_IQK_PI_A, MASKDWORD, 0x28150016);
|
||||
}
|
||||
odm_set_bb_reg(p_dm_odm, REG_IQK_AGC_RSP, MASKDWORD, 0x001028d0);
|
||||
odm_set_bb_reg(p_dm_odm, REG_OFDM_0_XA_AGC_CORE1, 0x7f, initial_gain);
|
||||
|
||||
/* IQK Single tone start */
|
||||
odm_set_bb_reg(p_dm_odm, REG_FPGA0_IQK, 0xffffff00, 0x808000);
|
||||
odm_set_bb_reg(p_dm_odm, REG_IQK_AGC_PTS, MASKDWORD, 0xf9000000);
|
||||
odm_set_bb_reg(p_dm_odm, REG_IQK_AGC_PTS, MASKDWORD, 0xf8000000);
|
||||
|
||||
odm_stall_execution(10000);
|
||||
|
||||
/* PSD report of antenna A */
|
||||
PSD_report_tmp = 0x0;
|
||||
for (n = 0; n < 2; n++) {
|
||||
PSD_report_tmp = get_psd_data(p_dm_odm, 14, initial_gain);
|
||||
if (PSD_report_tmp > ant_a_report)
|
||||
ant_a_report = PSD_report_tmp;
|
||||
}
|
||||
|
||||
/* change to Antenna B */
|
||||
if (p_dm_odm->support_ic_type & ODM_RTL8723B) {
|
||||
/* odm_set_bb_reg(p_dm_odm, REG_DPDT_CONTROL, 0x3, 0x2); */
|
||||
odm_set_bb_reg(p_dm_odm, REG_S0_S1_PATH_SWITCH, 0xfff, 0x280);
|
||||
odm_set_bb_reg(p_dm_odm, REG_AGC_TABLE_SELECT, BIT(31), 0x1);
|
||||
}
|
||||
|
||||
odm_stall_execution(10);
|
||||
|
||||
/* PSD report of antenna B */
|
||||
PSD_report_tmp = 0x0;
|
||||
for (n = 0; n < 2; n++) {
|
||||
PSD_report_tmp = get_psd_data(p_dm_odm, 14, initial_gain);
|
||||
if (PSD_report_tmp > ant_b_report)
|
||||
ant_b_report = PSD_report_tmp;
|
||||
}
|
||||
|
||||
/* Close IQK Single Tone function */
|
||||
odm_set_bb_reg(p_dm_odm, REG_FPGA0_IQK, 0xffffff00, 0x000000);
|
||||
|
||||
/* 1 Return to antanna A */
|
||||
if (p_dm_odm->support_ic_type & ODM_RTL8723B) {
|
||||
/* external DPDT */
|
||||
odm_set_bb_reg(p_dm_odm, REG_DPDT_CONTROL, MASKDWORD, reg92c);
|
||||
|
||||
/* internal S0/S1 */
|
||||
odm_set_bb_reg(p_dm_odm, REG_S0_S1_PATH_SWITCH, MASKDWORD, reg948);
|
||||
odm_set_bb_reg(p_dm_odm, REG_AGC_TABLE_SELECT, MASKDWORD, regb2c);
|
||||
odm_set_bb_reg(p_dm_odm, rfe_ctrl_anta_src, MASKDWORD, reg930);
|
||||
odm_set_mac_reg(p_dm_odm, REG_SYM_WLBT_PAPE_SEL, BIT(29), reg064);
|
||||
}
|
||||
|
||||
odm_set_bb_reg(p_dm_odm, REG_FPGA0_ANALOG_PARAMETER4, MASKDWORD, reg88c);
|
||||
odm_set_bb_reg(p_dm_odm, REG_OFDM_0_TR_MUX_PAR, MASKDWORD, regc08);
|
||||
odm_set_bb_reg(p_dm_odm, REG_FPGA0_XCD_RF_INTERFACE_SW, MASKDWORD, reg874);
|
||||
odm_set_bb_reg(p_dm_odm, REG_OFDM_0_XA_AGC_CORE1, 0x7F, 0x40);
|
||||
odm_set_bb_reg(p_dm_odm, REG_OFDM_0_XA_AGC_CORE1, MASKDWORD, regc50);
|
||||
odm_set_rf_reg(p_dm_odm, ODM_RF_PATH_A, RF_CHNLBW, RFREGOFFSETMASK, current_channel);
|
||||
odm_set_rf_reg(p_dm_odm, ODM_RF_PATH_A, 0x00, RFREGOFFSETMASK, rf_loop_reg);
|
||||
|
||||
/* Reload AFE Registers */
|
||||
if (p_dm_odm->support_ic_type & ODM_RTL8723B)
|
||||
odm_set_bb_reg(p_dm_odm, REG_RX_WAIT_CCA, MASKDWORD, afe_rrx_wait_cca);
|
||||
|
||||
if (p_dm_odm->support_ic_type & ODM_RTL8723B) {
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("psd_report_A[%d]= %d\n", 2416, ant_a_report));
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("psd_report_B[%d]= %d\n", 2416, ant_b_report));
|
||||
|
||||
/* 2 Test ant B based on ant A is ON */
|
||||
if ((ant_a_report >= 100) && (ant_b_report >= 100) && (ant_a_report <= 135) && (ant_b_report <= 135)) {
|
||||
u8 TH1 = 2, TH2 = 6;
|
||||
|
||||
if ((ant_a_report - ant_b_report < TH1) || (ant_b_report - ant_a_report < TH1)) {
|
||||
p_dm_swat_table->ANTA_ON = true;
|
||||
p_dm_swat_table->ANTB_ON = true;
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("odm_single_dual_antenna_detection(): Dual Antenna\n"));
|
||||
} else if (((ant_a_report - ant_b_report >= TH1) && (ant_a_report - ant_b_report <= TH2)) ||
|
||||
((ant_b_report - ant_a_report >= TH1) && (ant_b_report - ant_a_report <= TH2))) {
|
||||
p_dm_swat_table->ANTA_ON = false;
|
||||
p_dm_swat_table->ANTB_ON = false;
|
||||
is_result = false;
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("odm_single_dual_antenna_detection(): Need to check again\n"));
|
||||
} else {
|
||||
p_dm_swat_table->ANTA_ON = true;
|
||||
p_dm_swat_table->ANTB_ON = false;
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("odm_single_dual_antenna_detection(): Single Antenna\n"));
|
||||
}
|
||||
p_dm_odm->ant_detected_info.is_ant_detected = true;
|
||||
p_dm_odm->ant_detected_info.db_for_ant_a = ant_a_report;
|
||||
p_dm_odm->ant_detected_info.db_for_ant_b = ant_b_report;
|
||||
p_dm_odm->ant_detected_info.db_for_ant_o = ant_0_report;
|
||||
|
||||
} else {
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("return false!!\n"));
|
||||
is_result = false;
|
||||
}
|
||||
}
|
||||
return is_result;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* 1 [2. Scan AP RSSI method] ================================================== */
|
||||
|
||||
|
||||
|
||||
|
||||
bool
|
||||
odm_sw_ant_div_check_before_link(
|
||||
void *p_dm_void
|
||||
)
|
||||
{
|
||||
|
||||
#if (RT_MEM_SIZE_LEVEL != RT_MEM_SIZE_MINIMUM)
|
||||
|
||||
struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
|
||||
struct _ADAPTER *adapter = p_dm_odm->adapter;
|
||||
HAL_DATA_TYPE *p_hal_data = GET_HAL_DATA(adapter);
|
||||
PMGNT_INFO p_mgnt_info = &adapter->MgntInfo;
|
||||
struct _sw_antenna_switch_ *p_dm_swat_table = &p_dm_odm->dm_swat_table;
|
||||
struct _FAST_ANTENNA_TRAINNING_ *p_dm_fat_table = &p_dm_odm->dm_fat_table;
|
||||
s8 score = 0;
|
||||
PRT_WLAN_BSS p_tmp_bss_desc, p_test_bss_desc;
|
||||
u8 power_target_L = 9, power_target_H = 16;
|
||||
u8 tmp_power_diff = 0, power_diff = 0, avg_power_diff = 0, max_power_diff = 0, min_power_diff = 0xff;
|
||||
u16 index, counter = 0;
|
||||
static u8 scan_channel;
|
||||
u32 tmp_swas_no_link_bk_reg948;
|
||||
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("ANTA_ON = (( %d )) , ANTB_ON = (( %d ))\n", p_dm_odm->dm_swat_table.ANTA_ON, p_dm_odm->dm_swat_table.ANTB_ON));
|
||||
|
||||
/* if(HP id) */
|
||||
{
|
||||
if (p_dm_odm->dm_swat_table.rssi_ant_dect_result == true && p_dm_odm->support_ic_type == ODM_RTL8723B) {
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("8723B RSSI-based Antenna Detection is done\n"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (p_dm_odm->support_ic_type == ODM_RTL8723B) {
|
||||
if (p_dm_swat_table->swas_no_link_bk_reg948 == 0xff)
|
||||
p_dm_swat_table->swas_no_link_bk_reg948 = odm_read_4byte(p_dm_odm, REG_S0_S1_PATH_SWITCH);
|
||||
}
|
||||
}
|
||||
|
||||
if (p_dm_odm->adapter == NULL) { /* For BSOD when plug/unplug fast. //By YJ,120413 */
|
||||
/* The ODM structure is not initialized. */
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Retrieve antenna detection registry info, added by Roger, 2012.11.27. */
|
||||
if (!IS_ANT_DETECT_SUPPORT_RSSI(adapter))
|
||||
return false;
|
||||
else
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Antenna Detection: RSSI method\n"));
|
||||
|
||||
/* Since driver is going to set BB register, it shall check if there is another thread controlling BB/RF. */
|
||||
odm_acquire_spin_lock(p_dm_odm, RT_RF_STATE_SPINLOCK);
|
||||
if (p_hal_data->eRFPowerState != eRfOn || p_mgnt_info->RFChangeInProgress || p_mgnt_info->bMediaConnect) {
|
||||
odm_release_spin_lock(p_dm_odm, RT_RF_STATE_SPINLOCK);
|
||||
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD,
|
||||
("odm_sw_ant_div_check_before_link(): rf_change_in_progress(%x), e_rf_power_state(%x)\n",
|
||||
p_mgnt_info->RFChangeInProgress, p_hal_data->eRFPowerState));
|
||||
|
||||
p_dm_swat_table->swas_no_link_state = 0;
|
||||
|
||||
return false;
|
||||
} else
|
||||
odm_release_spin_lock(p_dm_odm, RT_RF_STATE_SPINLOCK);
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("p_dm_swat_table->swas_no_link_state = %d\n", p_dm_swat_table->swas_no_link_state));
|
||||
/* 1 Run AntDiv mechanism "Before Link" part. */
|
||||
if (p_dm_swat_table->swas_no_link_state == 0) {
|
||||
/* 1 Prepare to do Scan again to check current antenna state. */
|
||||
|
||||
/* Set check state to next step. */
|
||||
p_dm_swat_table->swas_no_link_state = 1;
|
||||
|
||||
/* Copy Current Scan list. */
|
||||
p_mgnt_info->tmpNumBssDesc = p_mgnt_info->NumBssDesc;
|
||||
PlatformMoveMemory((void *)adapter->MgntInfo.tmpbssDesc, (void *)p_mgnt_info->bssDesc, sizeof(RT_WLAN_BSS) * MAX_BSS_DESC);
|
||||
|
||||
/* Go back to scan function again. */
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("odm_sw_ant_div_check_before_link: Scan one more time\n"));
|
||||
p_mgnt_info->ScanStep = 0;
|
||||
p_mgnt_info->bScanAntDetect = true;
|
||||
scan_channel = odm_sw_ant_div_select_scan_chnl(adapter);
|
||||
|
||||
|
||||
if (p_dm_odm->support_ic_type & (ODM_RTL8188E | ODM_RTL8821)) {
|
||||
if (p_dm_fat_table->rx_idle_ant == MAIN_ANT)
|
||||
odm_update_rx_idle_ant(p_dm_odm, AUX_ANT);
|
||||
else
|
||||
odm_update_rx_idle_ant(p_dm_odm, MAIN_ANT);
|
||||
if (scan_channel == 0) {
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD,
|
||||
("odm_sw_ant_div_check_before_link(): No AP List Avaiable, Using ant(%s)\n", (p_dm_fat_table->rx_idle_ant == MAIN_ANT) ? "AUX_ANT" : "MAIN_ANT"));
|
||||
|
||||
if (IS_5G_WIRELESS_MODE(p_mgnt_info->dot11CurrentWirelessMode)) {
|
||||
p_dm_swat_table->ant_5g = p_dm_fat_table->rx_idle_ant;
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("p_dm_swat_table->ant_5g=%s\n", (p_dm_fat_table->rx_idle_ant == MAIN_ANT) ? "MAIN_ANT" : "AUX_ANT"));
|
||||
} else {
|
||||
p_dm_swat_table->ant_2g = p_dm_fat_table->rx_idle_ant;
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("p_dm_swat_table->ant_2g=%s\n", (p_dm_fat_table->rx_idle_ant == MAIN_ANT) ? "MAIN_ANT" : "AUX_ANT"));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD,
|
||||
("odm_sw_ant_div_check_before_link: Change to %s for testing.\n", ((p_dm_fat_table->rx_idle_ant == MAIN_ANT) ? "MAIN_ANT" : "AUX_ANT")));
|
||||
} else if (p_dm_odm->support_ic_type & (ODM_RTL8723B)) {
|
||||
/*Switch Antenna to another one.*/
|
||||
|
||||
tmp_swas_no_link_bk_reg948 = odm_read_4byte(p_dm_odm, REG_S0_S1_PATH_SWITCH);
|
||||
|
||||
if ((p_dm_swat_table->cur_antenna == MAIN_ANT) && (tmp_swas_no_link_bk_reg948 == 0x200)) {
|
||||
odm_set_bb_reg(p_dm_odm, REG_S0_S1_PATH_SWITCH, 0xfff, 0x280);
|
||||
odm_set_bb_reg(p_dm_odm, REG_AGC_TABLE_SELECT, BIT(31), 0x1);
|
||||
p_dm_swat_table->cur_antenna = AUX_ANT;
|
||||
} else {
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Reg[948]= (( %x )) was in wrong state\n", tmp_swas_no_link_bk_reg948));
|
||||
return false;
|
||||
}
|
||||
odm_stall_execution(10);
|
||||
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("odm_sw_ant_div_check_before_link: Change to (( %s-ant)) for testing.\n", (p_dm_swat_table->cur_antenna == MAIN_ANT) ? "MAIN" : "AUX"));
|
||||
}
|
||||
|
||||
odm_sw_ant_div_construct_scan_chnl(adapter, scan_channel);
|
||||
PlatformSetTimer(adapter, &p_mgnt_info->ScanTimer, 5);
|
||||
|
||||
return true;
|
||||
} else { /* p_dm_swat_table->swas_no_link_state == 1 */
|
||||
/* 1 ScanComple() is called after antenna swiched. */
|
||||
/* 1 Check scan result and determine which antenna is going */
|
||||
/* 1 to be used. */
|
||||
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, (" tmp_num_bss_desc= (( %d ))\n", p_mgnt_info->tmpNumBssDesc)); /* debug for Dino */
|
||||
|
||||
for (index = 0; index < p_mgnt_info->tmpNumBssDesc; index++) {
|
||||
p_tmp_bss_desc = &(p_mgnt_info->tmpbssDesc[index]); /* Antenna 1 */
|
||||
p_test_bss_desc = &(p_mgnt_info->bssDesc[index]); /* Antenna 2 */
|
||||
|
||||
if (PlatformCompareMemory(p_test_bss_desc->bdBssIdBuf, p_tmp_bss_desc->bdBssIdBuf, 6) != 0) {
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("odm_sw_ant_div_check_before_link(): ERROR!! This shall not happen.\n"));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (p_dm_odm->support_ic_type != ODM_RTL8723B) {
|
||||
if (p_tmp_bss_desc->ChannelNumber == scan_channel) {
|
||||
if (p_tmp_bss_desc->RecvSignalPower > p_test_bss_desc->RecvSignalPower) {
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("odm_sw_ant_div_check_before_link: Compare scan entry: score++\n"));
|
||||
RT_PRINT_STR(COMP_SCAN, DBG_WARNING, "GetScanInfo(): new Bss SSID:", p_tmp_bss_desc->bdSsIdBuf, p_tmp_bss_desc->bdSsIdLen);
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("at ch %d, Original: %d, Test: %d\n\n", p_tmp_bss_desc->ChannelNumber, p_tmp_bss_desc->RecvSignalPower, p_test_bss_desc->RecvSignalPower));
|
||||
|
||||
score++;
|
||||
PlatformMoveMemory(p_test_bss_desc, p_tmp_bss_desc, sizeof(RT_WLAN_BSS));
|
||||
} else if (p_tmp_bss_desc->RecvSignalPower < p_test_bss_desc->RecvSignalPower) {
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("odm_sw_ant_div_check_before_link: Compare scan entry: score--\n"));
|
||||
RT_PRINT_STR(COMP_SCAN, DBG_WARNING, "GetScanInfo(): new Bss SSID:", p_tmp_bss_desc->bdSsIdBuf, p_tmp_bss_desc->bdSsIdLen);
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("at ch %d, Original: %d, Test: %d\n\n", p_tmp_bss_desc->ChannelNumber, p_tmp_bss_desc->RecvSignalPower, p_test_bss_desc->RecvSignalPower));
|
||||
score--;
|
||||
} else {
|
||||
if (p_test_bss_desc->bdTstamp - p_tmp_bss_desc->bdTstamp < 5000) {
|
||||
RT_PRINT_STR(COMP_SCAN, DBG_WARNING, "GetScanInfo(): new Bss SSID:", p_tmp_bss_desc->bdSsIdBuf, p_tmp_bss_desc->bdSsIdLen);
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("at ch %d, Original: %d, Test: %d\n", p_tmp_bss_desc->ChannelNumber, p_tmp_bss_desc->RecvSignalPower, p_test_bss_desc->RecvSignalPower));
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("The 2nd Antenna didn't get this AP\n\n"));
|
||||
}
|
||||
}
|
||||
}
|
||||
} else { /* 8723B */
|
||||
if (p_tmp_bss_desc->ChannelNumber == scan_channel) {
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("channel_number == scan_channel->(( %d ))\n", p_tmp_bss_desc->ChannelNumber));
|
||||
|
||||
if (p_tmp_bss_desc->RecvSignalPower > p_test_bss_desc->RecvSignalPower) { /* Pow(Ant1) > Pow(Ant2) */
|
||||
counter++;
|
||||
tmp_power_diff = (u8)(p_tmp_bss_desc->RecvSignalPower - p_test_bss_desc->RecvSignalPower);
|
||||
power_diff = power_diff + tmp_power_diff;
|
||||
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Original: %d, Test: %d\n", p_tmp_bss_desc->RecvSignalPower, p_test_bss_desc->RecvSignalPower));
|
||||
ODM_PRINT_ADDR(p_dm_odm, ODM_COMP_ANT_DIV, DBG_LOUD, ("SSID:"), p_tmp_bss_desc->bdSsIdBuf);
|
||||
ODM_PRINT_ADDR(p_dm_odm, ODM_COMP_ANT_DIV, DBG_LOUD, ("BSSID:"), p_tmp_bss_desc->bdSsIdBuf);
|
||||
|
||||
/* ODM_RT_TRACE(p_dm_odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("tmp_power_diff: (( %d)),max_power_diff: (( %d)),min_power_diff: (( %d))\n", tmp_power_diff,max_power_diff,min_power_diff)); */
|
||||
if (tmp_power_diff > max_power_diff)
|
||||
max_power_diff = tmp_power_diff;
|
||||
if (tmp_power_diff < min_power_diff)
|
||||
min_power_diff = tmp_power_diff;
|
||||
/* ODM_RT_TRACE(p_dm_odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("max_power_diff: (( %d)),min_power_diff: (( %d))\n",max_power_diff,min_power_diff)); */
|
||||
|
||||
PlatformMoveMemory(p_test_bss_desc, p_tmp_bss_desc, sizeof(RT_WLAN_BSS));
|
||||
} else if (p_test_bss_desc->RecvSignalPower > p_tmp_bss_desc->RecvSignalPower) { /* Pow(Ant1) < Pow(Ant2) */
|
||||
counter++;
|
||||
tmp_power_diff = (u8)(p_test_bss_desc->RecvSignalPower - p_tmp_bss_desc->RecvSignalPower);
|
||||
power_diff = power_diff + tmp_power_diff;
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Original: %d, Test: %d\n", p_tmp_bss_desc->RecvSignalPower, p_test_bss_desc->RecvSignalPower));
|
||||
ODM_PRINT_ADDR(p_dm_odm, ODM_COMP_ANT_DIV, DBG_LOUD, ("SSID:"), p_tmp_bss_desc->bdSsIdBuf);
|
||||
ODM_PRINT_ADDR(p_dm_odm, ODM_COMP_ANT_DIV, DBG_LOUD, ("BSSID:"), p_tmp_bss_desc->bdSsIdBuf);
|
||||
if (tmp_power_diff > max_power_diff)
|
||||
max_power_diff = tmp_power_diff;
|
||||
if (tmp_power_diff < min_power_diff)
|
||||
min_power_diff = tmp_power_diff;
|
||||
} else { /* Pow(Ant1) = Pow(Ant2) */
|
||||
if (p_test_bss_desc->bdTstamp > p_tmp_bss_desc->bdTstamp) { /* Stamp(Ant1) < Stamp(Ant2) */
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("time_diff: %lld\n", (p_test_bss_desc->bdTstamp - p_tmp_bss_desc->bdTstamp) / 1000));
|
||||
if (p_test_bss_desc->bdTstamp - p_tmp_bss_desc->bdTstamp > 5000) {
|
||||
counter++;
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Original: %d, Test: %d\n", p_tmp_bss_desc->RecvSignalPower, p_test_bss_desc->RecvSignalPower));
|
||||
ODM_PRINT_ADDR(p_dm_odm, ODM_COMP_ANT_DIV, DBG_LOUD, ("SSID:"), p_tmp_bss_desc->bdSsIdBuf);
|
||||
ODM_PRINT_ADDR(p_dm_odm, ODM_COMP_ANT_DIV, DBG_LOUD, ("BSSID:"), p_tmp_bss_desc->bdSsIdBuf);
|
||||
min_power_diff = 0;
|
||||
}
|
||||
} else
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[Error !!!]: Time_diff: %lld\n", (p_test_bss_desc->bdTstamp - p_tmp_bss_desc->bdTstamp) / 1000));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (p_dm_odm->support_ic_type & (ODM_RTL8188E | ODM_RTL8821)) {
|
||||
if (p_mgnt_info->NumBssDesc != 0 && score < 0) {
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD,
|
||||
("odm_sw_ant_div_check_before_link(): Using ant(%s)\n", (p_dm_fat_table->rx_idle_ant == MAIN_ANT) ? "MAIN_ANT" : "AUX_ANT"));
|
||||
} else {
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD,
|
||||
("odm_sw_ant_div_check_before_link(): Remain ant(%s)\n", (p_dm_fat_table->rx_idle_ant == MAIN_ANT) ? "AUX_ANT" : "MAIN_ANT"));
|
||||
|
||||
if (p_dm_fat_table->rx_idle_ant == MAIN_ANT)
|
||||
odm_update_rx_idle_ant(p_dm_odm, AUX_ANT);
|
||||
else
|
||||
odm_update_rx_idle_ant(p_dm_odm, MAIN_ANT);
|
||||
}
|
||||
|
||||
if (IS_5G_WIRELESS_MODE(p_mgnt_info->dot11CurrentWirelessMode)) {
|
||||
p_dm_swat_table->ant_5g = p_dm_fat_table->rx_idle_ant;
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("p_dm_swat_table->ant_5g=%s\n", (p_dm_fat_table->rx_idle_ant == MAIN_ANT) ? "MAIN_ANT" : "AUX_ANT"));
|
||||
} else {
|
||||
p_dm_swat_table->ant_2g = p_dm_fat_table->rx_idle_ant;
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("p_dm_swat_table->ant_2g=%s\n", (p_dm_fat_table->rx_idle_ant == MAIN_ANT) ? "MAIN_ANT" : "AUX_ANT"));
|
||||
}
|
||||
} else if (p_dm_odm->support_ic_type == ODM_RTL8723B) {
|
||||
if (counter == 0) {
|
||||
if (p_dm_odm->dm_swat_table.pre_aux_fail_detec == false) {
|
||||
p_dm_odm->dm_swat_table.pre_aux_fail_detec = true;
|
||||
p_dm_odm->dm_swat_table.rssi_ant_dect_result = false;
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("counter=(( 0 )) , [[ Cannot find any AP with Aux-ant ]] -> Scan Target-channel again\n"));
|
||||
|
||||
/* 3 [ Scan again ] */
|
||||
odm_sw_ant_div_construct_scan_chnl(adapter, scan_channel);
|
||||
PlatformSetTimer(adapter, &p_mgnt_info->ScanTimer, 5);
|
||||
return true;
|
||||
} else { /* pre_aux_fail_detec == true */
|
||||
/* 2 [ Single Antenna ] */
|
||||
p_dm_odm->dm_swat_table.pre_aux_fail_detec = false;
|
||||
p_dm_odm->dm_swat_table.rssi_ant_dect_result = true;
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("counter=(( 0 )) , [[ Still cannot find any AP ]]\n"));
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("odm_sw_ant_div_check_before_link(): Single antenna\n"));
|
||||
}
|
||||
p_dm_odm->dm_swat_table.aux_fail_detec_counter++;
|
||||
} else {
|
||||
p_dm_odm->dm_swat_table.pre_aux_fail_detec = false;
|
||||
|
||||
if (counter == 3) {
|
||||
avg_power_diff = ((power_diff - max_power_diff - min_power_diff) >> 1) + ((max_power_diff + min_power_diff) >> 2);
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("counter: (( %d )) , power_diff: (( %d ))\n", counter, power_diff));
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ counter==3 ] Modified avg_power_diff: (( %d )) , max_power_diff: (( %d )) , min_power_diff: (( %d ))\n", avg_power_diff, max_power_diff, min_power_diff));
|
||||
} else if (counter >= 4) {
|
||||
avg_power_diff = (power_diff - max_power_diff - min_power_diff) / (counter - 2);
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("counter: (( %d )) , power_diff: (( %d ))\n", counter, power_diff));
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ counter>=4 ] Modified avg_power_diff: (( %d )) , max_power_diff: (( %d )) , min_power_diff: (( %d ))\n", avg_power_diff, max_power_diff, min_power_diff));
|
||||
|
||||
} else { /* counter==1,2 */
|
||||
avg_power_diff = power_diff / counter;
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("avg_power_diff: (( %d )) , counter: (( %d )) , power_diff: (( %d ))\n", avg_power_diff, counter, power_diff));
|
||||
}
|
||||
|
||||
/* 2 [ Retry ] */
|
||||
if ((avg_power_diff >= power_target_L) && (avg_power_diff <= power_target_H)) {
|
||||
p_dm_odm->dm_swat_table.retry_counter++;
|
||||
|
||||
if (p_dm_odm->dm_swat_table.retry_counter <= 3) {
|
||||
p_dm_odm->dm_swat_table.rssi_ant_dect_result = false;
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[[ Low confidence result ]] avg_power_diff= (( %d )) -> Scan Target-channel again ]]\n", avg_power_diff));
|
||||
|
||||
/* 3 [ Scan again ] */
|
||||
odm_sw_ant_div_construct_scan_chnl(adapter, scan_channel);
|
||||
PlatformSetTimer(adapter, &p_mgnt_info->ScanTimer, 5);
|
||||
return true;
|
||||
} else {
|
||||
p_dm_odm->dm_swat_table.rssi_ant_dect_result = true;
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[[ Still Low confidence result ]] (( retry_counter > 3 ))\n"));
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("odm_sw_ant_div_check_before_link(): Single antenna\n"));
|
||||
}
|
||||
|
||||
}
|
||||
/* 2 [ Dual Antenna ] */
|
||||
else if ((p_mgnt_info->NumBssDesc != 0) && (avg_power_diff < power_target_L)) {
|
||||
p_dm_odm->dm_swat_table.rssi_ant_dect_result = true;
|
||||
if (p_dm_odm->dm_swat_table.ANTB_ON == false) {
|
||||
p_dm_odm->dm_swat_table.ANTA_ON = true;
|
||||
p_dm_odm->dm_swat_table.ANTB_ON = true;
|
||||
}
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("odm_sw_ant_div_check_before_link(): Dual antenna\n"));
|
||||
p_dm_odm->dm_swat_table.dual_ant_counter++;
|
||||
|
||||
/* set bt coexDM from 1ant coexDM to 2ant coexDM */
|
||||
BT_SetBtCoexAntNum(adapter, BT_COEX_ANT_TYPE_DETECTED, 2);
|
||||
|
||||
/* 3 [ Init antenna diversity ] */
|
||||
p_dm_odm->support_ability |= ODM_BB_ANT_DIV;
|
||||
odm_ant_div_init(p_dm_odm);
|
||||
}
|
||||
/* 2 [ Single Antenna ] */
|
||||
else if (avg_power_diff > power_target_H) {
|
||||
p_dm_odm->dm_swat_table.rssi_ant_dect_result = true;
|
||||
if (p_dm_odm->dm_swat_table.ANTB_ON == true) {
|
||||
p_dm_odm->dm_swat_table.ANTA_ON = true;
|
||||
p_dm_odm->dm_swat_table.ANTB_ON = false;
|
||||
/* bt_set_bt_coex_ant_num(adapter, BT_COEX_ANT_TYPE_DETECTED, 1); */
|
||||
}
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("odm_sw_ant_div_check_before_link(): Single antenna\n"));
|
||||
p_dm_odm->dm_swat_table.single_ant_counter++;
|
||||
}
|
||||
}
|
||||
/* ODM_RT_TRACE(p_dm_odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("is_result=(( %d ))\n",p_dm_odm->dm_swat_table.rssi_ant_dect_result)); */
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("dual_ant_counter = (( %d )), single_ant_counter = (( %d )) , retry_counter = (( %d )) , aux_fail_detec_counter = (( %d ))\n\n\n",
|
||||
p_dm_odm->dm_swat_table.dual_ant_counter, p_dm_odm->dm_swat_table.single_ant_counter, p_dm_odm->dm_swat_table.retry_counter, p_dm_odm->dm_swat_table.aux_fail_detec_counter));
|
||||
|
||||
/* 2 recover the antenna setting */
|
||||
|
||||
if (p_dm_odm->dm_swat_table.ANTB_ON == false)
|
||||
odm_set_bb_reg(p_dm_odm, REG_S0_S1_PATH_SWITCH, 0xfff, (p_dm_swat_table->swas_no_link_bk_reg948));
|
||||
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("is_result=(( %d )), Recover Reg[948]= (( %x )) \n\n", p_dm_odm->dm_swat_table.rssi_ant_dect_result, p_dm_swat_table->swas_no_link_bk_reg948));
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* Check state reset to default and wait for next time. */
|
||||
p_dm_swat_table->swas_no_link_state = 0;
|
||||
p_mgnt_info->bScanAntDetect = false;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* 1 [3. PSD method] ========================================================== */
|
||||
|
||||
|
||||
|
||||
|
||||
u32
|
||||
odm_get_psd_data(
|
||||
void *p_dm_void,
|
||||
u16 point,
|
||||
u8 initial_gain)
|
||||
{
|
||||
struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
|
||||
u32 psd_report;
|
||||
|
||||
odm_set_bb_reg(p_dm_odm, 0x808, 0x3FF, point);
|
||||
odm_set_bb_reg(p_dm_odm, 0x808, BIT(22), 1); /* Start PSD calculation, Reg808[22]=0->1 */
|
||||
odm_stall_execution(150);/* Wait for HW PSD report */
|
||||
odm_set_bb_reg(p_dm_odm, 0x808, BIT(22), 0);/* Stop PSD calculation, Reg808[22]=1->0 */
|
||||
psd_report = odm_get_bb_reg(p_dm_odm, 0x8B4, MASKDWORD) & 0x0000FFFF; /* Read PSD report, Reg8B4[15:0] */
|
||||
|
||||
psd_report = (u32)(odm_convert_to_db(psd_report)); /* +(u32)(initial_gain); */
|
||||
return psd_report;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
odm_single_dual_antenna_detection_psd(
|
||||
void *p_dm_void
|
||||
)
|
||||
{
|
||||
struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
|
||||
u32 channel_ori;
|
||||
u8 initial_gain = 0x36;
|
||||
u8 tone_idx;
|
||||
u8 tone_lenth_1 = 7, tone_lenth_2 = 4;
|
||||
u16 tone_idx_1[7] = {88, 104, 120, 8, 24, 40, 56};
|
||||
u16 tone_idx_2[4] = {8, 24, 40, 56};
|
||||
u32 psd_report_main[11] = {0}, psd_report_aux[11] = {0};
|
||||
/* u8 tone_lenth_1=4, tone_lenth_2=2; */
|
||||
/* u16 tone_idx_1[4]={88, 120, 24, 56}; */
|
||||
/* u16 tone_idx_2[2]={ 24, 56}; */
|
||||
/* u32 psd_report_main[6]={0}, psd_report_aux[6]={0}; */
|
||||
|
||||
u32 PSD_report_temp, max_psd_report_main = 0, max_psd_report_aux = 0;
|
||||
u32 PSD_power_threshold;
|
||||
u32 main_psd_result = 0, aux_psd_result = 0;
|
||||
u32 regc50, reg948, regb2c, regc14, reg908;
|
||||
u32 i = 0, test_num = 8;
|
||||
|
||||
|
||||
if (p_dm_odm->support_ic_type != ODM_RTL8723B)
|
||||
return;
|
||||
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("odm_single_dual_antenna_detection_psd()============>\n"));
|
||||
|
||||
/* 2 [ Backup Current RF/BB Settings ] */
|
||||
|
||||
channel_ori = odm_get_rf_reg(p_dm_odm, ODM_RF_PATH_A, ODM_CHANNEL, RFREGOFFSETMASK);
|
||||
reg948 = odm_get_bb_reg(p_dm_odm, REG_S0_S1_PATH_SWITCH, MASKDWORD);
|
||||
regb2c = odm_get_bb_reg(p_dm_odm, REG_AGC_TABLE_SELECT, MASKDWORD);
|
||||
regc50 = odm_get_bb_reg(p_dm_odm, REG_OFDM_0_XA_AGC_CORE1, MASKDWORD);
|
||||
regc14 = odm_get_bb_reg(p_dm_odm, 0xc14, MASKDWORD);
|
||||
reg908 = odm_get_bb_reg(p_dm_odm, 0x908, MASKDWORD);
|
||||
|
||||
/* 2 [ setting for doing PSD function (CH4)] */
|
||||
odm_set_bb_reg(p_dm_odm, REG_FPGA0_RFMOD, BIT(24), 0); /* disable whole CCK block */
|
||||
odm_write_1byte(p_dm_odm, REG_TXPAUSE, 0xFF); /* Turn off TX -> Pause TX Queue */
|
||||
odm_set_bb_reg(p_dm_odm, 0xC14, MASKDWORD, 0x0); /* [ Set IQK Matrix = 0 ] equivalent to [ Turn off CCA] */
|
||||
|
||||
/* PHYTXON while loop */
|
||||
odm_set_bb_reg(p_dm_odm, 0x908, MASKDWORD, 0x803);
|
||||
while (odm_get_bb_reg(p_dm_odm, 0xdf4, BIT(6))) {
|
||||
i++;
|
||||
if (i > 1000000) {
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Wait in %s() more than %d times!\n", __FUNCTION__, i));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
odm_set_bb_reg(p_dm_odm, 0xc50, 0x7f, initial_gain);
|
||||
odm_set_rf_reg(p_dm_odm, ODM_RF_PATH_A, ODM_CHANNEL, 0x7ff, 0x04); /* Set RF to CH4 & 40M */
|
||||
odm_set_bb_reg(p_dm_odm, REG_FPGA0_ANALOG_PARAMETER4, 0xf00000, 0xf); /* 3 wire Disable 88c[23:20]=0xf */
|
||||
odm_set_bb_reg(p_dm_odm, REG_FPGA0_PSD_FUNCTION, BIT(14) | BIT15, 0x0); /* 128 pt */ /* Set PSD 128 ptss */
|
||||
odm_stall_execution(3000);
|
||||
|
||||
|
||||
/* 2 [ Doing PSD Function in (CH4)] */
|
||||
|
||||
/* Antenna A */
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Switch to Main-ant (CH4)\n"));
|
||||
odm_set_bb_reg(p_dm_odm, 0x948, 0xfff, 0x200);
|
||||
odm_stall_execution(10);
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("dbg\n"));
|
||||
for (i = 0; i < test_num; i++) {
|
||||
for (tone_idx = 0; tone_idx < tone_lenth_1; tone_idx++) {
|
||||
PSD_report_temp = odm_get_psd_data(p_dm_odm, tone_idx_1[tone_idx], initial_gain);
|
||||
/* if( PSD_report_temp>psd_report_main[tone_idx] ) */
|
||||
psd_report_main[tone_idx] += PSD_report_temp;
|
||||
}
|
||||
}
|
||||
/* Antenna B */
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Switch to Aux-ant (CH4)\n"));
|
||||
odm_set_bb_reg(p_dm_odm, 0x948, 0xfff, 0x280);
|
||||
odm_stall_execution(10);
|
||||
for (i = 0; i < test_num; i++) {
|
||||
for (tone_idx = 0; tone_idx < tone_lenth_1; tone_idx++) {
|
||||
PSD_report_temp = odm_get_psd_data(p_dm_odm, tone_idx_1[tone_idx], initial_gain);
|
||||
/* if( PSD_report_temp>psd_report_aux[tone_idx] ) */
|
||||
psd_report_aux[tone_idx] += PSD_report_temp;
|
||||
}
|
||||
}
|
||||
/* 2 [ Doing PSD Function in (CH8)] */
|
||||
|
||||
odm_set_bb_reg(p_dm_odm, REG_FPGA0_ANALOG_PARAMETER4, 0xf00000, 0x0); /* 3 wire enable 88c[23:20]=0x0 */
|
||||
odm_stall_execution(3000);
|
||||
|
||||
odm_set_bb_reg(p_dm_odm, 0xc50, 0x7f, initial_gain);
|
||||
odm_set_rf_reg(p_dm_odm, ODM_RF_PATH_A, ODM_CHANNEL, 0x7ff, 0x04); /* Set RF to CH8 & 40M */
|
||||
|
||||
odm_set_bb_reg(p_dm_odm, REG_FPGA0_ANALOG_PARAMETER4, 0xf00000, 0xf); /* 3 wire Disable 88c[23:20]=0xf */
|
||||
odm_stall_execution(3000);
|
||||
|
||||
/* Antenna A */
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Switch to Main-ant (CH8)\n"));
|
||||
odm_set_bb_reg(p_dm_odm, 0x948, 0xfff, 0x200);
|
||||
odm_stall_execution(10);
|
||||
|
||||
for (i = 0; i < test_num; i++) {
|
||||
for (tone_idx = 0; tone_idx < tone_lenth_2; tone_idx++) {
|
||||
PSD_report_temp = odm_get_psd_data(p_dm_odm, tone_idx_2[tone_idx], initial_gain);
|
||||
/* if( PSD_report_temp>psd_report_main[tone_idx] ) */
|
||||
psd_report_main[tone_lenth_1 + tone_idx] += PSD_report_temp;
|
||||
}
|
||||
}
|
||||
|
||||
/* Antenna B */
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Switch to Aux-ant (CH8)\n"));
|
||||
odm_set_bb_reg(p_dm_odm, 0x948, 0xfff, 0x280);
|
||||
odm_stall_execution(10);
|
||||
|
||||
for (i = 0; i < test_num; i++) {
|
||||
for (tone_idx = 0; tone_idx < tone_lenth_2; tone_idx++) {
|
||||
PSD_report_temp = odm_get_psd_data(p_dm_odm, tone_idx_2[tone_idx], initial_gain);
|
||||
/* if( PSD_report_temp>psd_report_aux[tone_idx] ) */
|
||||
psd_report_aux[tone_lenth_1 + tone_idx] += PSD_report_temp;
|
||||
}
|
||||
}
|
||||
|
||||
/* 2 [ Calculate Result ] */
|
||||
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("\nMain PSD Result: (ALL)\n"));
|
||||
for (tone_idx = 0; tone_idx < (tone_lenth_1 + tone_lenth_2); tone_idx++) {
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[Tone-%d]: %d,\n", (tone_idx + 1), psd_report_main[tone_idx]));
|
||||
main_psd_result += psd_report_main[tone_idx];
|
||||
if (psd_report_main[tone_idx] > max_psd_report_main)
|
||||
max_psd_report_main = psd_report_main[tone_idx];
|
||||
}
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("--------------------------- \nTotal_Main= (( %d ))\n", main_psd_result));
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("MAX_Main = (( %d ))\n", max_psd_report_main));
|
||||
|
||||
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("\nAux PSD Result: (ALL)\n"));
|
||||
for (tone_idx = 0; tone_idx < (tone_lenth_1 + tone_lenth_2); tone_idx++) {
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[Tone-%d]: %d,\n", (tone_idx + 1), psd_report_aux[tone_idx]));
|
||||
aux_psd_result += psd_report_aux[tone_idx];
|
||||
if (psd_report_aux[tone_idx] > max_psd_report_aux)
|
||||
max_psd_report_aux = psd_report_aux[tone_idx];
|
||||
}
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("--------------------------- \nTotal_Aux= (( %d ))\n", aux_psd_result));
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("MAX_Aux = (( %d ))\n\n", max_psd_report_aux));
|
||||
|
||||
/* main_psd_result=main_psd_result-max_psd_report_main; */
|
||||
/* aux_psd_result=aux_psd_result-max_psd_report_aux; */
|
||||
PSD_power_threshold = (main_psd_result * 7) >> 3;
|
||||
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ Main_result, Aux_result ] = [ %d , %d ], PSD_power_threshold=(( %d ))\n", main_psd_result, aux_psd_result, PSD_power_threshold));
|
||||
|
||||
/* 3 [ Dual Antenna ] */
|
||||
if (aux_psd_result >= PSD_power_threshold) {
|
||||
if (p_dm_odm->dm_swat_table.ANTB_ON == false) {
|
||||
p_dm_odm->dm_swat_table.ANTA_ON = true;
|
||||
p_dm_odm->dm_swat_table.ANTB_ON = true;
|
||||
}
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("odm_sw_ant_div_check_before_link(): Dual antenna\n"));
|
||||
|
||||
/* set bt coexDM from 1ant coexDM to 2ant coexDM */
|
||||
/* bt_set_bt_coex_ant_num(p_adapter, BT_COEX_ANT_TYPE_DETECTED, 2); */
|
||||
|
||||
/* Init antenna diversity */
|
||||
p_dm_odm->support_ability |= ODM_BB_ANT_DIV;
|
||||
odm_ant_div_init(p_dm_odm);
|
||||
}
|
||||
/* 3 [ Single Antenna ] */
|
||||
else {
|
||||
if (p_dm_odm->dm_swat_table.ANTB_ON == true) {
|
||||
p_dm_odm->dm_swat_table.ANTA_ON = true;
|
||||
p_dm_odm->dm_swat_table.ANTB_ON = false;
|
||||
}
|
||||
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("odm_sw_ant_div_check_before_link(): Single antenna\n"));
|
||||
}
|
||||
|
||||
/* 2 [ Recover all parameters ] */
|
||||
|
||||
odm_set_rf_reg(p_dm_odm, ODM_RF_PATH_A, RF_CHNLBW, RFREGOFFSETMASK, channel_ori);
|
||||
odm_set_bb_reg(p_dm_odm, REG_FPGA0_ANALOG_PARAMETER4, 0xf00000, 0x0); /* 3 wire enable 88c[23:20]=0x0 */
|
||||
odm_set_bb_reg(p_dm_odm, 0xc50, 0x7f, regc50);
|
||||
|
||||
odm_set_bb_reg(p_dm_odm, REG_S0_S1_PATH_SWITCH, MASKDWORD, reg948);
|
||||
odm_set_bb_reg(p_dm_odm, REG_AGC_TABLE_SELECT, MASKDWORD, regb2c);
|
||||
|
||||
odm_set_bb_reg(p_dm_odm, REG_FPGA0_RFMOD, BIT(24), 1); /* enable whole CCK block */
|
||||
odm_write_1byte(p_dm_odm, REG_TXPAUSE, 0x0); /* Turn on TX */ /* Resume TX Queue */
|
||||
odm_set_bb_reg(p_dm_odm, 0xC14, MASKDWORD, regc14); /* [ Set IQK Matrix = 0 ] equivalent to [ Turn on CCA] */
|
||||
odm_set_bb_reg(p_dm_odm, 0x908, MASKDWORD, reg908);
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
void
|
||||
odm_sw_ant_detect_init(
|
||||
void *p_dm_void
|
||||
)
|
||||
{
|
||||
#if (defined(CONFIG_ANT_DETECTION))
|
||||
struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
|
||||
struct _sw_antenna_switch_ *p_dm_swat_table = &p_dm_odm->dm_swat_table;
|
||||
|
||||
/* p_dm_swat_table->pre_antenna = MAIN_ANT; */
|
||||
/* p_dm_swat_table->cur_antenna = MAIN_ANT; */
|
||||
p_dm_swat_table->swas_no_link_state = 0;
|
||||
p_dm_swat_table->pre_aux_fail_detec = false;
|
||||
p_dm_swat_table->swas_no_link_bk_reg948 = 0xff;
|
||||
#endif
|
||||
}
|
95
hal/phydm/phydm_antdect.h
Normal file
95
hal/phydm/phydm_antdect.h
Normal file
|
@ -0,0 +1,95 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* 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.1" /*2015.07.29 by YuChen*/
|
||||
|
||||
#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
|
||||
|
||||
|
||||
struct _ANT_DETECTED_INFO {
|
||||
bool is_ant_detected;
|
||||
u32 db_for_ant_a;
|
||||
u32 db_for_ant_b;
|
||||
u32 db_for_ant_o;
|
||||
};
|
||||
|
||||
|
||||
enum dm_swas_e {
|
||||
antenna_a = 1,
|
||||
antenna_b = 2,
|
||||
antenna_max = 3,
|
||||
};
|
||||
|
||||
|
||||
|
||||
/* 1 [1. Single Tone method] =================================================== */
|
||||
|
||||
|
||||
|
||||
void
|
||||
odm_single_dual_antenna_default_setting(
|
||||
void *p_dm_void
|
||||
);
|
||||
|
||||
bool
|
||||
odm_single_dual_antenna_detection(
|
||||
void *p_dm_void,
|
||||
u8 mode
|
||||
);
|
||||
|
||||
/* 1 [2. Scan AP RSSI method] ================================================== */
|
||||
|
||||
#define sw_ant_div_check_before_link odm_sw_ant_div_check_before_link
|
||||
|
||||
bool
|
||||
odm_sw_ant_div_check_before_link(
|
||||
void *p_dm_void
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
/* 1 [3. PSD method] ========================================================== */
|
||||
|
||||
|
||||
void
|
||||
odm_single_dual_antenna_detection_psd(
|
||||
void *p_dm_void
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
void
|
||||
odm_sw_ant_detect_init(
|
||||
void *p_dm_void
|
||||
);
|
||||
|
||||
|
||||
#endif
|
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