staging: rtl8188eu: Rework function phy_CalculateBitShift()
Rename CamelCase variables and function name. Signed-off-by: navin patidar <navin.patidar@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
c2ebf58ba0
commit
6e264feb6a
|
@ -24,48 +24,18 @@
|
||||||
#include <rtw_iol.h>
|
#include <rtw_iol.h>
|
||||||
#include <rtl8188e_hal.h>
|
#include <rtl8188e_hal.h>
|
||||||
|
|
||||||
/*---------------------------Define Local Constant---------------------------*/
|
|
||||||
/* Channel switch:The size of command tables for switch channel*/
|
|
||||||
#define MAX_PRECMD_CNT 16
|
#define MAX_PRECMD_CNT 16
|
||||||
#define MAX_RFDEPENDCMD_CNT 16
|
#define MAX_RFDEPENDCMD_CNT 16
|
||||||
#define MAX_POSTCMD_CNT 16
|
#define MAX_POSTCMD_CNT 16
|
||||||
|
|
||||||
#define MAX_DOZE_WAITING_TIMES_9x 64
|
#define MAX_DOZE_WAITING_TIMES_9x 64
|
||||||
|
|
||||||
/*---------------------------Define Local Constant---------------------------*/
|
static u32 cal_bit_shift(u32 bitmask)
|
||||||
|
|
||||||
|
|
||||||
/*------------------------Define global variable-----------------------------*/
|
|
||||||
|
|
||||||
/*------------------------Define local variable------------------------------*/
|
|
||||||
|
|
||||||
|
|
||||||
/*--------------------Define export function prototype-----------------------*/
|
|
||||||
/* Please refer to header file */
|
|
||||||
/*--------------------Define export function prototype-----------------------*/
|
|
||||||
|
|
||||||
/*----------------------------Function Body----------------------------------*/
|
|
||||||
/* */
|
|
||||||
/* 1. BB register R/W API */
|
|
||||||
/* */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function: phy_CalculateBitShift
|
|
||||||
*
|
|
||||||
* OverView: Get shifted position of the BitMask
|
|
||||||
*
|
|
||||||
* Input:
|
|
||||||
* u32 BitMask,
|
|
||||||
*
|
|
||||||
* Output: none
|
|
||||||
* Return: u32 Return the shift bit bit position of the mask
|
|
||||||
*/
|
|
||||||
static u32 phy_CalculateBitShift(u32 BitMask)
|
|
||||||
{
|
{
|
||||||
u32 i;
|
u32 i;
|
||||||
|
|
||||||
for (i = 0; i <= 31; i++) {
|
for (i = 0; i <= 31; i++) {
|
||||||
if (((BitMask>>i) & 0x1) == 1)
|
if (((bitmask >> i) & 0x1) == 1)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return i;
|
return i;
|
||||||
|
@ -95,7 +65,7 @@ rtl8188e_PHY_QueryBBReg(
|
||||||
u32 ReturnValue = 0, OriginalValue, BitShift;
|
u32 ReturnValue = 0, OriginalValue, BitShift;
|
||||||
|
|
||||||
OriginalValue = usb_read32(Adapter, RegAddr);
|
OriginalValue = usb_read32(Adapter, RegAddr);
|
||||||
BitShift = phy_CalculateBitShift(BitMask);
|
BitShift = cal_bit_shift(BitMask);
|
||||||
ReturnValue = (OriginalValue & BitMask) >> BitShift;
|
ReturnValue = (OriginalValue & BitMask) >> BitShift;
|
||||||
return ReturnValue;
|
return ReturnValue;
|
||||||
}
|
}
|
||||||
|
@ -125,7 +95,7 @@ void rtl8188e_PHY_SetBBReg(struct adapter *Adapter, u32 RegAddr, u32 BitMask, u3
|
||||||
|
|
||||||
if (BitMask != bMaskDWord) { /* if not "double word" write */
|
if (BitMask != bMaskDWord) { /* if not "double word" write */
|
||||||
OriginalValue = usb_read32(Adapter, RegAddr);
|
OriginalValue = usb_read32(Adapter, RegAddr);
|
||||||
BitShift = phy_CalculateBitShift(BitMask);
|
BitShift = cal_bit_shift(BitMask);
|
||||||
Data = ((OriginalValue & (~BitMask)) | (Data << BitShift));
|
Data = ((OriginalValue & (~BitMask)) | (Data << BitShift));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -310,7 +280,7 @@ u32 rtl8188e_PHY_QueryRFReg(struct adapter *Adapter, enum rf_radio_path eRFPath,
|
||||||
|
|
||||||
Original_Value = phy_RFSerialRead(Adapter, eRFPath, RegAddr);
|
Original_Value = phy_RFSerialRead(Adapter, eRFPath, RegAddr);
|
||||||
|
|
||||||
BitShift = phy_CalculateBitShift(BitMask);
|
BitShift = cal_bit_shift(BitMask);
|
||||||
Readback_Value = (Original_Value & BitMask) >> BitShift;
|
Readback_Value = (Original_Value & BitMask) >> BitShift;
|
||||||
return Readback_Value;
|
return Readback_Value;
|
||||||
}
|
}
|
||||||
|
@ -347,7 +317,7 @@ rtl8188e_PHY_SetRFReg(
|
||||||
/* RF data is 12 bits only */
|
/* RF data is 12 bits only */
|
||||||
if (BitMask != bRFRegOffsetMask) {
|
if (BitMask != bRFRegOffsetMask) {
|
||||||
Original_Value = phy_RFSerialRead(Adapter, eRFPath, RegAddr);
|
Original_Value = phy_RFSerialRead(Adapter, eRFPath, RegAddr);
|
||||||
BitShift = phy_CalculateBitShift(BitMask);
|
BitShift = cal_bit_shift(BitMask);
|
||||||
Data = ((Original_Value & (~BitMask)) | (Data << BitShift));
|
Data = ((Original_Value & (~BitMask)) | (Data << BitShift));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue