mirror of
https://github.com/Mange/rtl8192eu-linux-driver
synced 2025-12-10 00:04:17 +00:00
Add version v5.6.4
This commit is contained in:
148
hal/hal_phy.c
148
hal/hal_phy.c
@@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* Copyright(c) 2007 - 2017 Realtek Corporation.
|
||||
*
|
||||
* 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.
|
||||
@@ -11,29 +11,18 @@
|
||||
* 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,
|
||||
* u4Byte BitMask,
|
||||
*
|
||||
* Output: none
|
||||
* Return: u4Byte Return the shift bit bit position of the mask
|
||||
@@ -41,24 +30,30 @@ static RF_SHADOW_T RF_Shadow[RF6052_MAX_PATH][RF6052_MAX_REG];
|
||||
u32
|
||||
PHY_CalculateBitShift(
|
||||
u32 BitMask
|
||||
)
|
||||
)
|
||||
{
|
||||
u32 i;
|
||||
|
||||
for(i=0; i<=31; i++)
|
||||
{
|
||||
if ( ((BitMask>>i) & 0x1 ) == 1)
|
||||
for (i = 0; i <= 31; i++) {
|
||||
if (((BitMask >> i) & 0x1) == 1)
|
||||
break;
|
||||
}
|
||||
|
||||
return (i);
|
||||
return i;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// ==> RF shadow Operation API Code Section!!!
|
||||
//
|
||||
/*-----------------------------------------------------------------------------
|
||||
#ifdef CONFIG_RF_SHADOW_RW
|
||||
/* ********************************************************************************
|
||||
* Constant.
|
||||
* ********************************************************************************
|
||||
* 2008/11/20 MH For Debug only, RF */
|
||||
static RF_SHADOW_T RF_Shadow[RF6052_MAX_PATH][RF6052_MAX_REG];
|
||||
|
||||
/*
|
||||
* ==> RF shadow Operation API Code Section!!!
|
||||
*
|
||||
*-----------------------------------------------------------------------------
|
||||
* Function: PHY_RFShadowRead
|
||||
* PHY_RFShadowWrite
|
||||
* PHY_RFShadowCompare
|
||||
@@ -80,13 +75,13 @@ PHY_CalculateBitShift(
|
||||
*
|
||||
* Revised History:
|
||||
* When Who Remark
|
||||
* 11/20/2008 MHC Create Version 0.
|
||||
* 11/20/2008 MHC Create Version 0.
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
u32
|
||||
PHY_RFShadowRead(
|
||||
IN PADAPTER Adapter,
|
||||
IN u8 eRFPath,
|
||||
IN enum rf_path eRFPath,
|
||||
IN u32 Offset)
|
||||
{
|
||||
return RF_Shadow[eRFPath][Offset].Value;
|
||||
@@ -97,7 +92,7 @@ PHY_RFShadowRead(
|
||||
VOID
|
||||
PHY_RFShadowWrite(
|
||||
IN PADAPTER Adapter,
|
||||
IN u8 eRFPath,
|
||||
IN enum rf_path eRFPath,
|
||||
IN u32 Offset,
|
||||
IN u32 Data)
|
||||
{
|
||||
@@ -110,22 +105,17 @@ PHY_RFShadowWrite(
|
||||
BOOLEAN
|
||||
PHY_RFShadowCompare(
|
||||
IN PADAPTER Adapter,
|
||||
IN u8 eRFPath,
|
||||
IN enum rf_path eRFPath,
|
||||
IN u32 Offset)
|
||||
{
|
||||
u32 reg;
|
||||
// Check if we need to check the register
|
||||
if (RF_Shadow[eRFPath][Offset].Compare == _TRUE)
|
||||
{
|
||||
/* 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.
|
||||
/* Compare shadow and real rf register for 20bits!! */
|
||||
if (RF_Shadow[eRFPath][Offset].Value != reg) {
|
||||
/* Locate error position. */
|
||||
RF_Shadow[eRFPath][Offset].ErrorOrNot = _TRUE;
|
||||
//RT_TRACE(COMP_INIT, DBG_LOUD,
|
||||
//("PHY_RFShadowCompare RF-%d Addr%02lx Err = %05lx\n",
|
||||
//eRFPath, Offset, reg));
|
||||
}
|
||||
return RF_Shadow[eRFPath][Offset].ErrorOrNot ;
|
||||
}
|
||||
@@ -136,20 +126,15 @@ PHY_RFShadowCompare(
|
||||
VOID
|
||||
PHY_RFShadowRecorver(
|
||||
IN PADAPTER Adapter,
|
||||
IN u8 eRFPath,
|
||||
IN enum rf_path 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)
|
||||
{
|
||||
/* Check if the address is error */
|
||||
if (RF_Shadow[eRFPath][Offset].ErrorOrNot == _TRUE) {
|
||||
/* Check if we need to recorver the register. */
|
||||
if (RF_Shadow[eRFPath][Offset].Recorver == _TRUE) {
|
||||
rtw_hal_write_rfreg(Adapter, eRFPath, Offset, bRFRegOffsetMask,
|
||||
RF_Shadow[eRFPath][Offset].Value);
|
||||
//RT_TRACE(COMP_INIT, DBG_LOUD,
|
||||
//("PHY_RFShadowRecorver RF-%d Addr%02lx=%05lx",
|
||||
//eRFPath, Offset, RF_Shadow[eRFPath][Offset].Value));
|
||||
RF_Shadow[eRFPath][Offset].Value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,15 +145,12 @@ VOID
|
||||
PHY_RFShadowCompareAll(
|
||||
IN PADAPTER Adapter)
|
||||
{
|
||||
u8 eRFPath = 0 ;
|
||||
u32 Offset = 0, maxReg= GET_RF6052_REAL_MAX_REG(Adapter);
|
||||
enum rf_path eRFPath = RF_PATH_A;
|
||||
u32 Offset = 0, maxReg = GET_RF6052_REAL_MAX_REG(Adapter);
|
||||
|
||||
for (eRFPath = 0; eRFPath < RF6052_MAX_PATH; eRFPath++)
|
||||
{
|
||||
for (eRFPath = 0; eRFPath < RF6052_MAX_PATH; eRFPath++) {
|
||||
for (Offset = 0; Offset < maxReg; Offset++)
|
||||
{
|
||||
PHY_RFShadowCompare(Adapter, eRFPath, Offset);
|
||||
}
|
||||
}
|
||||
|
||||
} /* PHY_RFShadowCompareAll */
|
||||
@@ -178,15 +160,12 @@ VOID
|
||||
PHY_RFShadowRecorverAll(
|
||||
IN PADAPTER Adapter)
|
||||
{
|
||||
u8 eRFPath =0;
|
||||
u32 Offset = 0, maxReg= GET_RF6052_REAL_MAX_REG(Adapter);
|
||||
enum rf_path eRFPath = RF_PATH_A;
|
||||
u32 Offset = 0, maxReg = GET_RF6052_REAL_MAX_REG(Adapter);
|
||||
|
||||
for (eRFPath = 0; eRFPath < RF6052_MAX_PATH; eRFPath++)
|
||||
{
|
||||
for (eRFPath = 0; eRFPath < RF6052_MAX_PATH; eRFPath++) {
|
||||
for (Offset = 0; Offset < maxReg; Offset++)
|
||||
{
|
||||
PHY_RFShadowRecorver(Adapter, eRFPath, Offset);
|
||||
}
|
||||
}
|
||||
|
||||
} /* PHY_RFShadowRecorverAll */
|
||||
@@ -195,11 +174,11 @@ PHY_RFShadowRecorverAll(
|
||||
VOID
|
||||
PHY_RFShadowCompareFlagSet(
|
||||
IN PADAPTER Adapter,
|
||||
IN u8 eRFPath,
|
||||
IN enum rf_path eRFPath,
|
||||
IN u32 Offset,
|
||||
IN u8 Type)
|
||||
{
|
||||
// Set True or False!!!
|
||||
/* Set True or False!!! */
|
||||
RF_Shadow[eRFPath][Offset].Compare = Type;
|
||||
|
||||
} /* PHY_RFShadowCompareFlagSet */
|
||||
@@ -208,12 +187,12 @@ PHY_RFShadowCompareFlagSet(
|
||||
VOID
|
||||
PHY_RFShadowRecorverFlagSet(
|
||||
IN PADAPTER Adapter,
|
||||
IN u8 eRFPath,
|
||||
IN enum rf_path eRFPath,
|
||||
IN u32 Offset,
|
||||
IN u8 Type)
|
||||
{
|
||||
// Set True or False!!!
|
||||
RF_Shadow[eRFPath][Offset].Recorver= Type;
|
||||
/* Set True or False!!! */
|
||||
RF_Shadow[eRFPath][Offset].Recorver = Type;
|
||||
|
||||
} /* PHY_RFShadowRecorverFlagSet */
|
||||
|
||||
@@ -222,14 +201,12 @@ VOID
|
||||
PHY_RFShadowCompareFlagSetAll(
|
||||
IN PADAPTER Adapter)
|
||||
{
|
||||
u8 eRFPath = 0;
|
||||
u32 Offset = 0, maxReg= GET_RF6052_REAL_MAX_REG(Adapter);
|
||||
enum rf_path eRFPath = RF_PATH_A;
|
||||
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!!!!
|
||||
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
|
||||
@@ -244,14 +221,12 @@ VOID
|
||||
PHY_RFShadowRecorverFlagSetAll(
|
||||
IN PADAPTER Adapter)
|
||||
{
|
||||
u8 eRFPath = 0;
|
||||
u32 Offset = 0, maxReg= GET_RF6052_REAL_MAX_REG(Adapter);
|
||||
enum rf_path eRFPath = RF_PATH_A;
|
||||
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!!!!
|
||||
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
|
||||
@@ -265,13 +240,11 @@ VOID
|
||||
PHY_RFShadowRefresh(
|
||||
IN PADAPTER Adapter)
|
||||
{
|
||||
u8 eRFPath = 0;
|
||||
u32 Offset = 0, maxReg= GET_RF6052_REAL_MAX_REG(Adapter);
|
||||
enum rf_path eRFPath = RF_PATH_A;
|
||||
u32 Offset = 0, maxReg = GET_RF6052_REAL_MAX_REG(Adapter);
|
||||
|
||||
for (eRFPath = 0; eRFPath < RF6052_MAX_PATH; eRFPath++)
|
||||
{
|
||||
for (Offset = 0; Offset < maxReg; Offset++)
|
||||
{
|
||||
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;
|
||||
@@ -281,5 +254,4 @@ PHY_RFShadowRefresh(
|
||||
}
|
||||
|
||||
} /* PHY_RFShadowRead */
|
||||
|
||||
|
||||
#endif /*CONFIG_RF_SHADOW_RW*/
|
||||
|
||||
Reference in New Issue
Block a user