staging: Remove rtl8723au driver
This driver is superseded by rtl8xxxu and has been marked as scheduled for deletion since 4.6 Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
b1fa6d8acb
commit
b49f6ab951
|
@ -11210,13 +11210,6 @@ M: Florian Schilhabel <florian.c.schilhabel@googlemail.com>.
|
|||
S: Odd Fixes
|
||||
F: drivers/staging/rtl8712/
|
||||
|
||||
STAGING - REALTEK RTL8723U WIRELESS DRIVER
|
||||
M: Larry Finger <Larry.Finger@lwfinger.net>
|
||||
M: Jes Sorensen <Jes.Sorensen@redhat.com>
|
||||
L: linux-wireless@vger.kernel.org
|
||||
S: Maintained
|
||||
F: drivers/staging/rtl8723au/
|
||||
|
||||
STAGING - SILICON MOTION SM750 FRAME BUFFER DRIVER
|
||||
M: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
|
||||
M: Teddy Wang <teddy.wang@siliconmotion.com>
|
||||
|
|
|
@ -40,8 +40,6 @@ source "drivers/staging/rtl8712/Kconfig"
|
|||
|
||||
source "drivers/staging/rtl8188eu/Kconfig"
|
||||
|
||||
source "drivers/staging/rtl8723au/Kconfig"
|
||||
|
||||
source "drivers/staging/rts5208/Kconfig"
|
||||
|
||||
source "drivers/staging/octeon/Kconfig"
|
||||
|
|
|
@ -9,7 +9,6 @@ obj-$(CONFIG_RTL8192U) += rtl8192u/
|
|||
obj-$(CONFIG_RTL8192E) += rtl8192e/
|
||||
obj-$(CONFIG_R8712U) += rtl8712/
|
||||
obj-$(CONFIG_R8188EU) += rtl8188eu/
|
||||
obj-$(CONFIG_R8723AU) += rtl8723au/
|
||||
obj-$(CONFIG_RTS5208) += rts5208/
|
||||
obj-$(CONFIG_NETLOGIC_XLR_NET) += netlogic/
|
||||
obj-$(CONFIG_OCTEON_ETHERNET) += octeon/
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
config R8723AU
|
||||
tristate "Realtek RTL8723AU Wireless LAN NIC driver (deprecated)"
|
||||
depends on USB && WLAN && RFKILL
|
||||
select WIRELESS_EXT
|
||||
select WEXT_PRIV
|
||||
select CFG80211
|
||||
default n
|
||||
---help---
|
||||
This option adds the Realtek RTL8723AU USB device such as found in
|
||||
the Lenovo Yoga 13 tablet. If built as a module, it will be called r8723au.
|
||||
|
||||
Note: This driver is deprecated and scheduled to be removed in a
|
||||
future kernel release. Please use rtl8xxxu instead.
|
||||
|
||||
if R8723AU
|
||||
|
||||
config 8723AU_AP_MODE
|
||||
bool "Realtek RTL8723AU AP mode"
|
||||
default y
|
||||
---help---
|
||||
This option enables Access Point mode. Unless you know that your system
|
||||
will never be used as an AP, or the target system has limited memory,
|
||||
"Y" should be selected.
|
||||
|
||||
config 8723AU_BT_COEXIST
|
||||
bool "Realtek RTL8723AU BlueTooth Coexistence"
|
||||
default y
|
||||
---help---
|
||||
This option enables icoexistence with BlueTooth communications for the r8723au driver.
|
||||
Unless you know that this driver will never by used with BT, or the target system has
|
||||
limited memory, "Y" should be selected.
|
||||
|
||||
endif
|
|
@ -1,53 +0,0 @@
|
|||
r8723au-y := \
|
||||
core/rtw_cmd.o \
|
||||
core/rtw_efuse.o \
|
||||
core/rtw_ieee80211.o \
|
||||
core/rtw_mlme.o \
|
||||
core/rtw_mlme_ext.o \
|
||||
core/rtw_pwrctrl.o \
|
||||
core/rtw_recv.o \
|
||||
core/rtw_security.o \
|
||||
core/rtw_sreset.o \
|
||||
core/rtw_sta_mgt.o \
|
||||
core/rtw_xmit.o \
|
||||
core/rtw_wlan_util.o \
|
||||
hal/hal_com.o \
|
||||
hal/hal_intf.o \
|
||||
hal/Hal8723PwrSeq.o \
|
||||
hal/Hal8723UHWImg_CE.o \
|
||||
hal/HalDMOutSrc8723A_CE.o \
|
||||
hal/HalHWImg8723A_BB.o \
|
||||
hal/HalHWImg8723A_MAC.o \
|
||||
hal/HalHWImg8723A_RF.o \
|
||||
hal/HalPwrSeqCmd.o \
|
||||
hal/odm_RegConfig8723A.o \
|
||||
hal/odm_debug.o \
|
||||
hal/odm_interface.o \
|
||||
hal/odm_HWConfig.o \
|
||||
hal/odm.o \
|
||||
hal/rtl8723a_cmd.o \
|
||||
hal/rtl8723a_dm.o \
|
||||
hal/rtl8723a_hal_init.o \
|
||||
hal/rtl8723a_phycfg.o \
|
||||
hal/rtl8723a_rf6052.o \
|
||||
hal/rtl8723a_rxdesc.o \
|
||||
hal/rtl8723a_sreset.o \
|
||||
hal/rtl8723au_recv.o \
|
||||
hal/rtl8723au_xmit.o \
|
||||
hal/usb_halinit.o \
|
||||
hal/usb_ops_linux.o \
|
||||
os_dep/ioctl_cfg80211.o \
|
||||
os_dep/mlme_linux.o \
|
||||
os_dep/os_intfs.o \
|
||||
os_dep/recv_linux.o \
|
||||
os_dep/usb_intf.o \
|
||||
os_dep/usb_ops_linux.o \
|
||||
os_dep/xmit_linux.o
|
||||
|
||||
r8723au-$(CONFIG_8723AU_BT_COEXIST) += hal/rtl8723a_bt-coexist.o
|
||||
r8723au-$(CONFIG_8723AU_AP_MODE) += core/rtw_ap.o
|
||||
|
||||
obj-$(CONFIG_R8723AU) := r8723au.o
|
||||
|
||||
ccflags-y += $(call cc-option,-Wtype-limits,)
|
||||
ccflags-y += -D__CHECK_ENDIAN__ -I$(src)/include
|
|
@ -1,16 +0,0 @@
|
|||
TODO:
|
||||
- find and remove code valid only for 5 HGz. Many of the obvious
|
||||
ones have been removed, but things like channel > 14 still exist.
|
||||
- find and remove any code for other chips that is left over
|
||||
- convert any remaining unusual variable types
|
||||
- find codes that can use %pM and %Nph formatting
|
||||
- checkpatch.pl fixes - most of the remaining ones are lines too long. Many
|
||||
of them will require refactoring
|
||||
- merge Realtek's bugfixes and new features into the driver
|
||||
- switch to use MAC80211
|
||||
|
||||
A mac80211 driver for this hardware already was integrated at
|
||||
drivers/net/wireless/realtek/rtl8xxxu/
|
||||
|
||||
Please send any patches to Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
|
||||
Jes Sorensen <Jes.Sorensen@redhat.com>, and Larry Finger <Larry.Finger@lwfinger.net>.
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,538 +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.
|
||||
*
|
||||
******************************************************************************/
|
||||
#define _RTW_EFUSE_C_
|
||||
|
||||
#include <osdep_service.h>
|
||||
#include <drv_types.h>
|
||||
|
||||
#include <rtw_efuse.h>
|
||||
#include <rtl8723a_hal.h>
|
||||
#include <usb_ops_linux.h>
|
||||
|
||||
#define REG_EFUSE_CTRL 0x0030
|
||||
#define EFUSE_CTRL REG_EFUSE_CTRL /* E-Fuse Control */
|
||||
|
||||
#define VOLTAGE_V25 0x03
|
||||
#define LDOE25_SHIFT 28
|
||||
|
||||
/*
|
||||
* When we want to enable write operation, we should change to
|
||||
* pwr on state. When we stop write, we should switch to 500k mode
|
||||
* and disable LDO 2.5V.
|
||||
*/
|
||||
static void Efuse_PowerSwitch(struct rtw_adapter *padapter,
|
||||
u8 bWrite, u8 PwrState)
|
||||
{
|
||||
u8 tempval;
|
||||
u16 tmpV16;
|
||||
|
||||
if (PwrState == true) {
|
||||
rtl8723au_write8(padapter, REG_EFUSE_ACCESS, EFUSE_ACCESS_ON);
|
||||
|
||||
/*
|
||||
* 1.2V Power: From VDDON with Power
|
||||
* Cut(0x0000h[15]), default valid
|
||||
*/
|
||||
tmpV16 = rtl8723au_read16(padapter, REG_SYS_ISO_CTRL);
|
||||
if (!(tmpV16 & PWC_EV12V)) {
|
||||
tmpV16 |= PWC_EV12V;
|
||||
rtl8723au_write16(padapter, REG_SYS_ISO_CTRL, tmpV16);
|
||||
}
|
||||
/* Reset: 0x0000h[28], default valid */
|
||||
tmpV16 = rtl8723au_read16(padapter, REG_SYS_FUNC_EN);
|
||||
if (!(tmpV16 & FEN_ELDR)) {
|
||||
tmpV16 |= FEN_ELDR;
|
||||
rtl8723au_write16(padapter, REG_SYS_FUNC_EN, tmpV16);
|
||||
}
|
||||
|
||||
/*
|
||||
* Clock: Gated(0x0008h[5]) 8M(0x0008h[1])
|
||||
* clock from ANA, default valid
|
||||
*/
|
||||
tmpV16 = rtl8723au_read16(padapter, REG_SYS_CLKR);
|
||||
if ((!(tmpV16 & LOADER_CLK_EN)) || (!(tmpV16 & ANA8M))) {
|
||||
tmpV16 |= (LOADER_CLK_EN | ANA8M);
|
||||
rtl8723au_write16(padapter, REG_SYS_CLKR, tmpV16);
|
||||
}
|
||||
|
||||
if (bWrite == true) {
|
||||
/* Enable LDO 2.5V before read/write action */
|
||||
tempval = rtl8723au_read8(padapter, EFUSE_TEST + 3);
|
||||
tempval &= 0x0F;
|
||||
tempval |= (VOLTAGE_V25 << 4);
|
||||
rtl8723au_write8(padapter, EFUSE_TEST + 3,
|
||||
tempval | 0x80);
|
||||
}
|
||||
} else {
|
||||
rtl8723au_write8(padapter, REG_EFUSE_ACCESS, EFUSE_ACCESS_OFF);
|
||||
|
||||
if (bWrite == true) {
|
||||
/* Disable LDO 2.5V after read/write action */
|
||||
tempval = rtl8723au_read8(padapter, EFUSE_TEST + 3);
|
||||
rtl8723au_write8(padapter, EFUSE_TEST + 3,
|
||||
tempval & 0x7F);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
u16 Efuse_GetCurrentSize23a(struct rtw_adapter *pAdapter, u8 efuseType)
|
||||
{
|
||||
u16 ret = 0;
|
||||
|
||||
if (efuseType == EFUSE_WIFI)
|
||||
ret = rtl8723a_EfuseGetCurrentSize_WiFi(pAdapter);
|
||||
else
|
||||
ret = rtl8723a_EfuseGetCurrentSize_BT(pAdapter);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Get current efuse area enabled word */
|
||||
u8 Efuse_CalculateWordCnts23a(u8 word_en)
|
||||
{
|
||||
return hweight8((~word_en) & 0xf);
|
||||
}
|
||||
|
||||
/*
|
||||
* Description: Execute E-Fuse read byte operation.
|
||||
*
|
||||
* Assumptions: 1. Boot from E-Fuse and successfully auto-load.
|
||||
* 2. PASSIVE_LEVEL (USB interface)
|
||||
*/
|
||||
void ReadEFuseByte23a(struct rtw_adapter *Adapter, u16 _offset, u8 *pbuf)
|
||||
{
|
||||
u32 value32;
|
||||
u8 readbyte;
|
||||
u16 retry;
|
||||
|
||||
/* Write Address */
|
||||
rtl8723au_write8(Adapter, EFUSE_CTRL+1, (_offset & 0xff));
|
||||
readbyte = rtl8723au_read8(Adapter, EFUSE_CTRL+2);
|
||||
rtl8723au_write8(Adapter, EFUSE_CTRL+2,
|
||||
((_offset >> 8) & 0x03) | (readbyte & 0xfc));
|
||||
|
||||
/* Write bit 32 0 */
|
||||
readbyte = rtl8723au_read8(Adapter, EFUSE_CTRL+3);
|
||||
rtl8723au_write8(Adapter, EFUSE_CTRL+3, readbyte & 0x7f);
|
||||
|
||||
/* Check bit 32 read-ready */
|
||||
retry = 0;
|
||||
value32 = rtl8723au_read32(Adapter, EFUSE_CTRL);
|
||||
while (!((value32 >> 24) & 0x80) && retry < 10000) {
|
||||
value32 = rtl8723au_read32(Adapter, EFUSE_CTRL);
|
||||
retry++;
|
||||
}
|
||||
|
||||
/*
|
||||
* Added suggested delay. This fixes the problem that
|
||||
* Efuse read error in high temperature condition.
|
||||
* Designer says that there shall be some delay after
|
||||
* ready bit is set, or the result will always stay
|
||||
* on last data we read.
|
||||
*/
|
||||
udelay(50);
|
||||
value32 = rtl8723au_read32(Adapter, EFUSE_CTRL);
|
||||
|
||||
*pbuf = (u8)(value32 & 0xff);
|
||||
}
|
||||
|
||||
void EFUSE_GetEfuseDefinition23a(struct rtw_adapter *pAdapter, u8 efuseType,
|
||||
u8 type, void *pOut)
|
||||
{
|
||||
u8 *pu1Tmp;
|
||||
u16 *pu2Tmp;
|
||||
u8 *pMax_section;
|
||||
|
||||
switch (type) {
|
||||
case TYPE_EFUSE_MAX_SECTION:
|
||||
pMax_section = pOut;
|
||||
|
||||
if (efuseType == EFUSE_WIFI)
|
||||
*pMax_section = EFUSE_MAX_SECTION_8723A;
|
||||
else
|
||||
*pMax_section = EFUSE_BT_MAX_SECTION;
|
||||
break;
|
||||
|
||||
case TYPE_EFUSE_REAL_CONTENT_LEN:
|
||||
pu2Tmp = pOut;
|
||||
|
||||
if (efuseType == EFUSE_WIFI)
|
||||
*pu2Tmp = EFUSE_REAL_CONTENT_LEN_8723A;
|
||||
else
|
||||
*pu2Tmp = EFUSE_BT_REAL_CONTENT_LEN;
|
||||
break;
|
||||
|
||||
case TYPE_AVAILABLE_EFUSE_BYTES_BANK:
|
||||
pu2Tmp = pOut;
|
||||
|
||||
if (efuseType == EFUSE_WIFI)
|
||||
*pu2Tmp = (EFUSE_REAL_CONTENT_LEN_8723A -
|
||||
EFUSE_OOB_PROTECT_BYTES);
|
||||
else
|
||||
*pu2Tmp = (EFUSE_BT_REAL_BANK_CONTENT_LEN -
|
||||
EFUSE_PROTECT_BYTES_BANK);
|
||||
break;
|
||||
|
||||
case TYPE_AVAILABLE_EFUSE_BYTES_TOTAL:
|
||||
pu2Tmp = pOut;
|
||||
|
||||
if (efuseType == EFUSE_WIFI)
|
||||
*pu2Tmp = (EFUSE_REAL_CONTENT_LEN_8723A -
|
||||
EFUSE_OOB_PROTECT_BYTES);
|
||||
else
|
||||
*pu2Tmp = (EFUSE_BT_REAL_CONTENT_LEN -
|
||||
(EFUSE_PROTECT_BYTES_BANK * 3));
|
||||
break;
|
||||
|
||||
case TYPE_EFUSE_MAP_LEN:
|
||||
pu2Tmp = pOut;
|
||||
|
||||
if (efuseType == EFUSE_WIFI)
|
||||
*pu2Tmp = EFUSE_MAP_LEN_8723A;
|
||||
else
|
||||
*pu2Tmp = EFUSE_BT_MAP_LEN;
|
||||
break;
|
||||
|
||||
case TYPE_EFUSE_PROTECT_BYTES_BANK:
|
||||
pu1Tmp = pOut;
|
||||
|
||||
if (efuseType == EFUSE_WIFI)
|
||||
*pu1Tmp = EFUSE_OOB_PROTECT_BYTES;
|
||||
else
|
||||
*pu1Tmp = EFUSE_PROTECT_BYTES_BANK;
|
||||
break;
|
||||
|
||||
case TYPE_EFUSE_CONTENT_LEN_BANK:
|
||||
pu2Tmp = pOut;
|
||||
|
||||
if (efuseType == EFUSE_WIFI)
|
||||
*pu2Tmp = EFUSE_REAL_CONTENT_LEN_8723A;
|
||||
else
|
||||
*pu2Tmp = EFUSE_BT_REAL_BANK_CONTENT_LEN;
|
||||
break;
|
||||
|
||||
default:
|
||||
pu1Tmp = pOut;
|
||||
*pu1Tmp = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Copy from WMAC for EFUSE read 1 byte. */
|
||||
u8 EFUSE_Read1Byte23a(struct rtw_adapter *Adapter, u16 Address)
|
||||
{
|
||||
u8 data;
|
||||
u8 Bytetemp = {0x00};
|
||||
u8 temp = {0x00};
|
||||
u32 k = 0;
|
||||
u16 contentLen = 0;
|
||||
|
||||
EFUSE_GetEfuseDefinition23a(Adapter, EFUSE_WIFI,
|
||||
TYPE_EFUSE_REAL_CONTENT_LEN,
|
||||
(void *)&contentLen);
|
||||
|
||||
if (Address < contentLen) { /* E-fuse 512Byte */
|
||||
/* Write E-fuse Register address bit0~7 */
|
||||
temp = Address & 0xFF;
|
||||
rtl8723au_write8(Adapter, EFUSE_CTRL+1, temp);
|
||||
Bytetemp = rtl8723au_read8(Adapter, EFUSE_CTRL+2);
|
||||
/* Write E-fuse Register address bit8~9 */
|
||||
temp = ((Address >> 8) & 0x03) | (Bytetemp & 0xFC);
|
||||
rtl8723au_write8(Adapter, EFUSE_CTRL+2, temp);
|
||||
|
||||
/* Write 0x30[31]= 0 */
|
||||
Bytetemp = rtl8723au_read8(Adapter, EFUSE_CTRL+3);
|
||||
temp = Bytetemp & 0x7F;
|
||||
rtl8723au_write8(Adapter, EFUSE_CTRL+3, temp);
|
||||
|
||||
/* Wait Write-ready (0x30[31]= 1) */
|
||||
Bytetemp = rtl8723au_read8(Adapter, EFUSE_CTRL+3);
|
||||
while (!(Bytetemp & 0x80)) {
|
||||
Bytetemp = rtl8723au_read8(Adapter, EFUSE_CTRL+3);
|
||||
k++;
|
||||
if (k == 1000) {
|
||||
k = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
data = rtl8723au_read8(Adapter, EFUSE_CTRL);
|
||||
return data;
|
||||
}
|
||||
return 0xFF;
|
||||
}
|
||||
|
||||
/* Read one byte from real Efuse. */
|
||||
int efuse_OneByteRead23a(struct rtw_adapter *pAdapter, u16 addr, u8 *data)
|
||||
{
|
||||
u8 tmpidx = 0;
|
||||
int bResult;
|
||||
|
||||
/* -----------------e-fuse reg ctrl ---------------------------- */
|
||||
/* address */
|
||||
rtl8723au_write8(pAdapter, EFUSE_CTRL + 1, (u8)(addr & 0xff));
|
||||
rtl8723au_write8(pAdapter, EFUSE_CTRL + 2,
|
||||
((u8)((addr >> 8) & 0x03)) |
|
||||
(rtl8723au_read8(pAdapter, EFUSE_CTRL + 2) & 0xFC));
|
||||
|
||||
rtl8723au_write8(pAdapter, EFUSE_CTRL + 3, 0x72); /* read cmd */
|
||||
|
||||
while (!(0x80 & rtl8723au_read8(pAdapter, EFUSE_CTRL + 3)) &&
|
||||
(tmpidx < 100))
|
||||
tmpidx++;
|
||||
if (tmpidx < 100) {
|
||||
*data = rtl8723au_read8(pAdapter, EFUSE_CTRL);
|
||||
bResult = _SUCCESS;
|
||||
} else {
|
||||
*data = 0xff;
|
||||
bResult = _FAIL;
|
||||
}
|
||||
return bResult;
|
||||
}
|
||||
|
||||
/* Write one byte to reald Efuse. */
|
||||
int efuse_OneByteWrite23a(struct rtw_adapter *pAdapter, u16 addr, u8 data)
|
||||
{
|
||||
u8 tmpidx = 0;
|
||||
int bResult;
|
||||
|
||||
/* return 0; */
|
||||
|
||||
/* -----------------e-fuse reg ctrl ------------------------- */
|
||||
/* address */
|
||||
rtl8723au_write8(pAdapter, EFUSE_CTRL + 1, (u8)(addr & 0xff));
|
||||
rtl8723au_write8(pAdapter, EFUSE_CTRL + 2,
|
||||
(rtl8723au_read8(pAdapter, EFUSE_CTRL + 2) & 0xFC) |
|
||||
(u8)((addr >> 8) & 0x03));
|
||||
rtl8723au_write8(pAdapter, EFUSE_CTRL, data); /* data */
|
||||
|
||||
rtl8723au_write8(pAdapter, EFUSE_CTRL + 3, 0xF2); /* write cmd */
|
||||
|
||||
while ((0x80 & rtl8723au_read8(pAdapter, EFUSE_CTRL + 3)) &&
|
||||
(tmpidx < 100)) {
|
||||
tmpidx++;
|
||||
}
|
||||
|
||||
if (tmpidx < 100)
|
||||
bResult = _SUCCESS;
|
||||
else
|
||||
bResult = _FAIL;
|
||||
|
||||
return bResult;
|
||||
}
|
||||
|
||||
/* Read allowed word in current efuse section data. */
|
||||
void efuse_WordEnableDataRead23a(u8 word_en, u8 *sourdata, u8 *targetdata)
|
||||
{
|
||||
if (!(word_en&BIT(0))) {
|
||||
targetdata[0] = sourdata[0];
|
||||
targetdata[1] = sourdata[1];
|
||||
}
|
||||
if (!(word_en&BIT(1))) {
|
||||
targetdata[2] = sourdata[2];
|
||||
targetdata[3] = sourdata[3];
|
||||
}
|
||||
if (!(word_en&BIT(2))) {
|
||||
targetdata[4] = sourdata[4];
|
||||
targetdata[5] = sourdata[5];
|
||||
}
|
||||
if (!(word_en&BIT(3))) {
|
||||
targetdata[6] = sourdata[6];
|
||||
targetdata[7] = sourdata[7];
|
||||
}
|
||||
}
|
||||
|
||||
static int efuse_read8(struct rtw_adapter *padapter, u16 address, u8 *value)
|
||||
{
|
||||
return efuse_OneByteRead23a(padapter, address, value);
|
||||
}
|
||||
|
||||
static int efuse_write8(struct rtw_adapter *padapter, u16 address, u8 *value)
|
||||
{
|
||||
return efuse_OneByteWrite23a(padapter, address, *value);
|
||||
}
|
||||
|
||||
/* read/write raw efuse data */
|
||||
int rtw_efuse_access23a(struct rtw_adapter *padapter, u8 bWrite, u16 start_addr,
|
||||
u16 cnts, u8 *data)
|
||||
{
|
||||
int i = 0;
|
||||
u16 real_content_len = 0, max_available_size = 0;
|
||||
int res = _FAIL;
|
||||
int (*rw8)(struct rtw_adapter *, u16, u8*);
|
||||
|
||||
EFUSE_GetEfuseDefinition23a(padapter, EFUSE_WIFI,
|
||||
TYPE_EFUSE_REAL_CONTENT_LEN,
|
||||
(void *)&real_content_len);
|
||||
EFUSE_GetEfuseDefinition23a(padapter, EFUSE_WIFI,
|
||||
TYPE_AVAILABLE_EFUSE_BYTES_TOTAL,
|
||||
(void *)&max_available_size);
|
||||
|
||||
if (start_addr > real_content_len)
|
||||
return _FAIL;
|
||||
|
||||
if (true == bWrite) {
|
||||
if ((start_addr + cnts) > max_available_size)
|
||||
return _FAIL;
|
||||
rw8 = &efuse_write8;
|
||||
} else
|
||||
rw8 = &efuse_read8;
|
||||
|
||||
Efuse_PowerSwitch(padapter, bWrite, true);
|
||||
|
||||
/* e-fuse one byte read/write */
|
||||
for (i = 0; i < cnts; i++) {
|
||||
if (start_addr >= real_content_len) {
|
||||
res = _FAIL;
|
||||
break;
|
||||
}
|
||||
|
||||
res = rw8(padapter, start_addr++, data++);
|
||||
if (res == _FAIL)
|
||||
break;
|
||||
}
|
||||
|
||||
Efuse_PowerSwitch(padapter, bWrite, false);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
u16 efuse_GetMaxSize23a(struct rtw_adapter *padapter)
|
||||
{
|
||||
u16 max_size;
|
||||
|
||||
EFUSE_GetEfuseDefinition23a(padapter, EFUSE_WIFI,
|
||||
TYPE_AVAILABLE_EFUSE_BYTES_TOTAL,
|
||||
(void *)&max_size);
|
||||
return max_size;
|
||||
}
|
||||
|
||||
int rtw_efuse_map_read23a(struct rtw_adapter *padapter,
|
||||
u16 addr, u16 cnts, u8 *data)
|
||||
{
|
||||
u16 mapLen = 0;
|
||||
|
||||
EFUSE_GetEfuseDefinition23a(padapter, EFUSE_WIFI,
|
||||
TYPE_EFUSE_MAP_LEN, (void *)&mapLen);
|
||||
|
||||
if ((addr + cnts) > mapLen)
|
||||
return _FAIL;
|
||||
|
||||
Efuse_PowerSwitch(padapter, false, true);
|
||||
|
||||
rtl8723a_readefuse(padapter, EFUSE_WIFI, addr, cnts, data);
|
||||
|
||||
Efuse_PowerSwitch(padapter, false, false);
|
||||
|
||||
return _SUCCESS;
|
||||
}
|
||||
|
||||
int rtw_BT_efuse_map_read23a(struct rtw_adapter *padapter,
|
||||
u16 addr, u16 cnts, u8 *data)
|
||||
{
|
||||
u16 mapLen = 0;
|
||||
|
||||
EFUSE_GetEfuseDefinition23a(padapter, EFUSE_BT,
|
||||
TYPE_EFUSE_MAP_LEN, (void *)&mapLen);
|
||||
|
||||
if ((addr + cnts) > mapLen)
|
||||
return _FAIL;
|
||||
|
||||
Efuse_PowerSwitch(padapter, false, true);
|
||||
|
||||
rtl8723a_readefuse(padapter, EFUSE_BT, addr, cnts, data);
|
||||
|
||||
Efuse_PowerSwitch(padapter, false, false);
|
||||
|
||||
return _SUCCESS;
|
||||
}
|
||||
|
||||
/* Read All Efuse content */
|
||||
static void Efuse_ReadAllMap(struct rtw_adapter *pAdapter, u8 efuseType,
|
||||
u8 *Efuse)
|
||||
{
|
||||
u16 mapLen = 0;
|
||||
|
||||
Efuse_PowerSwitch(pAdapter, false, true);
|
||||
|
||||
EFUSE_GetEfuseDefinition23a(pAdapter, efuseType, TYPE_EFUSE_MAP_LEN,
|
||||
(void *)&mapLen);
|
||||
|
||||
rtl8723a_readefuse(pAdapter, efuseType, 0, mapLen, Efuse);
|
||||
|
||||
Efuse_PowerSwitch(pAdapter, false, false);
|
||||
}
|
||||
|
||||
/*
|
||||
* Functions: efuse_ShadowRead1Byte
|
||||
* efuse_ShadowRead2Byte
|
||||
* efuse_ShadowRead4Byte
|
||||
*
|
||||
* Read from efuse init map by one/two/four bytes
|
||||
*/
|
||||
static void efuse_ShadowRead1Byte(struct rtw_adapter *pAdapter, u16 Offset,
|
||||
u8 *Value)
|
||||
{
|
||||
struct eeprom_priv *pEEPROM = GET_EEPROM_EFUSE_PRIV(pAdapter);
|
||||
|
||||
*Value = pEEPROM->efuse_eeprom_data[Offset];
|
||||
}
|
||||
|
||||
static void efuse_ShadowRead2Byte(struct rtw_adapter *pAdapter, u16 Offset,
|
||||
u16 *Value)
|
||||
{
|
||||
struct eeprom_priv *pEEPROM = GET_EEPROM_EFUSE_PRIV(pAdapter);
|
||||
|
||||
*Value = pEEPROM->efuse_eeprom_data[Offset];
|
||||
*Value |= pEEPROM->efuse_eeprom_data[Offset+1]<<8;
|
||||
}
|
||||
|
||||
static void efuse_ShadowRead4Byte(struct rtw_adapter *pAdapter, u16 Offset,
|
||||
u32 *Value)
|
||||
{
|
||||
struct eeprom_priv *pEEPROM = GET_EEPROM_EFUSE_PRIV(pAdapter);
|
||||
|
||||
*Value = pEEPROM->efuse_eeprom_data[Offset];
|
||||
*Value |= pEEPROM->efuse_eeprom_data[Offset+1]<<8;
|
||||
*Value |= pEEPROM->efuse_eeprom_data[Offset+2]<<16;
|
||||
*Value |= pEEPROM->efuse_eeprom_data[Offset+3]<<24;
|
||||
}
|
||||
|
||||
/* Transfer current EFUSE content to shadow init and modify map. */
|
||||
void EFUSE_ShadowMapUpdate23a(struct rtw_adapter *pAdapter, u8 efuseType)
|
||||
{
|
||||
struct eeprom_priv *pEEPROM = GET_EEPROM_EFUSE_PRIV(pAdapter);
|
||||
u16 mapLen = 0;
|
||||
|
||||
EFUSE_GetEfuseDefinition23a(pAdapter, efuseType,
|
||||
TYPE_EFUSE_MAP_LEN, (void *)&mapLen);
|
||||
|
||||
if (pEEPROM->bautoload_fail_flag == true)
|
||||
memset(pEEPROM->efuse_eeprom_data, 0xFF, mapLen);
|
||||
else
|
||||
Efuse_ReadAllMap(pAdapter, efuseType,
|
||||
pEEPROM->efuse_eeprom_data);
|
||||
}
|
||||
|
||||
/* Read from efuse init map */
|
||||
void EFUSE_ShadowRead23a(struct rtw_adapter *pAdapter, u8 Type,
|
||||
u16 Offset, u32 *Value)
|
||||
{
|
||||
if (Type == 1)
|
||||
efuse_ShadowRead1Byte(pAdapter, Offset, (u8 *)Value);
|
||||
else if (Type == 2)
|
||||
efuse_ShadowRead2Byte(pAdapter, Offset, (u16 *)Value);
|
||||
else if (Type == 4)
|
||||
efuse_ShadowRead4Byte(pAdapter, Offset, (u32 *)Value);
|
||||
}
|
|
@ -1,855 +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.
|
||||
*
|
||||
******************************************************************************/
|
||||
#define _IEEE80211_C
|
||||
|
||||
#include <drv_types.h>
|
||||
#include <linux/ieee80211.h>
|
||||
#include <ieee80211.h>
|
||||
#include <wifi.h>
|
||||
#include <osdep_service.h>
|
||||
#include <wlan_bssdef.h>
|
||||
|
||||
u8 RTW_WPA_OUI23A_TYPE[] = { 0x00, 0x50, 0xf2, 1 };
|
||||
u16 RTW_WPA_VERSION23A = 1;
|
||||
u8 WPA_AUTH_KEY_MGMT_NONE23A[] = { 0x00, 0x50, 0xf2, 0 };
|
||||
u8 WPA_AUTH_KEY_MGMT_UNSPEC_802_1X23A[] = { 0x00, 0x50, 0xf2, 1 };
|
||||
u8 WPA_AUTH_KEY_MGMT_PSK_OVER_802_1X23A[] = { 0x00, 0x50, 0xf2, 2 };
|
||||
u8 WPA_CIPHER_SUITE_NONE23A[] = { 0x00, 0x50, 0xf2, 0 };
|
||||
u8 WPA_CIPHER_SUITE_WEP4023A[] = { 0x00, 0x50, 0xf2, 1 };
|
||||
u8 WPA_CIPHER_SUITE_TKIP23A[] = { 0x00, 0x50, 0xf2, 2 };
|
||||
u8 WPA_CIPHER_SUITE_WRAP23A[] = { 0x00, 0x50, 0xf2, 3 };
|
||||
u8 WPA_CIPHER_SUITE_CCMP23A[] = { 0x00, 0x50, 0xf2, 4 };
|
||||
u8 WPA_CIPHER_SUITE_WEP10423A[] = { 0x00, 0x50, 0xf2, 5 };
|
||||
|
||||
u8 RSN_AUTH_KEY_MGMT_UNSPEC_802_1X23A[] = { 0x00, 0x0f, 0xac, 1 };
|
||||
u8 RSN_AUTH_KEY_MGMT_PSK_OVER_802_1X23A[] = { 0x00, 0x0f, 0xac, 2 };
|
||||
u8 RSN_CIPHER_SUITE_NONE23A[] = { 0x00, 0x0f, 0xac, 0 };
|
||||
u8 RSN_CIPHER_SUITE_WEP4023A[] = { 0x00, 0x0f, 0xac, 1 };
|
||||
u8 RSN_CIPHER_SUITE_TKIP23A[] = { 0x00, 0x0f, 0xac, 2 };
|
||||
u8 RSN_CIPHER_SUITE_WRAP23A[] = { 0x00, 0x0f, 0xac, 3 };
|
||||
u8 RSN_CIPHER_SUITE_CCMP23A[] = { 0x00, 0x0f, 0xac, 4 };
|
||||
u8 RSN_CIPHER_SUITE_WEP10423A[] = { 0x00, 0x0f, 0xac, 5 };
|
||||
/* */
|
||||
/* for adhoc-master to generate ie and provide supported-rate to fw */
|
||||
/* */
|
||||
|
||||
static u8 WIFI_CCKRATES[] = {
|
||||
IEEE80211_CCK_RATE_1MB | IEEE80211_BASIC_RATE_MASK,
|
||||
IEEE80211_CCK_RATE_2MB | IEEE80211_BASIC_RATE_MASK,
|
||||
IEEE80211_CCK_RATE_5MB | IEEE80211_BASIC_RATE_MASK,
|
||||
IEEE80211_CCK_RATE_11MB | IEEE80211_BASIC_RATE_MASK
|
||||
};
|
||||
|
||||
static u8 WIFI_OFDMRATES[] = {
|
||||
IEEE80211_OFDM_RATE_6MB,
|
||||
IEEE80211_OFDM_RATE_9MB,
|
||||
IEEE80211_OFDM_RATE_12MB,
|
||||
IEEE80211_OFDM_RATE_18MB,
|
||||
IEEE80211_OFDM_RATE_24MB,
|
||||
IEEE80211_OFDM_RATE_36MB,
|
||||
IEEE80211_OFDM_RATE_48MB,
|
||||
IEEE80211_OFDM_RATE_54MB
|
||||
};
|
||||
|
||||
int rtw_get_bit_value_from_ieee_value23a(u8 val)
|
||||
{
|
||||
unsigned char dot11_rate_table[] =
|
||||
{2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108, 0};
|
||||
|
||||
int i = 0;
|
||||
|
||||
while (dot11_rate_table[i] != 0) {
|
||||
if (dot11_rate_table[i] == val)
|
||||
return BIT(i);
|
||||
i++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool rtw_is_cckrates_included(u8 *rate)
|
||||
{
|
||||
u32 i = 0;
|
||||
|
||||
while (rate[i]) {
|
||||
if ((rate[i] & 0x7f) == 2 || (rate[i] & 0x7f) == 4 ||
|
||||
(rate[i] & 0x7f) == 11 || (rate[i] & 0x7f) == 22)
|
||||
return true;
|
||||
i++;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool rtw_is_cckratesonly_included(u8 *rate)
|
||||
{
|
||||
u32 i = 0;
|
||||
|
||||
while (rate[i]) {
|
||||
if ((rate[i] & 0x7f) != 2 && (rate[i] & 0x7f) != 4 &&
|
||||
(rate[i] & 0x7f) != 11 && (rate[i] & 0x7f) != 22)
|
||||
return false;
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int rtw_check_network_type23a(unsigned char *rate, int ratelen, int channel)
|
||||
{
|
||||
if (channel > 14) {
|
||||
if (rtw_is_cckrates_included(rate))
|
||||
return WIRELESS_INVALID;
|
||||
else
|
||||
return WIRELESS_11A;
|
||||
} else { /* could be pure B, pure G, or B/G */
|
||||
if (rtw_is_cckratesonly_included(rate))
|
||||
return WIRELESS_11B;
|
||||
else if (rtw_is_cckrates_included(rate))
|
||||
return WIRELESS_11BG;
|
||||
else
|
||||
return WIRELESS_11G;
|
||||
}
|
||||
}
|
||||
|
||||
/* rtw_set_ie23a will update frame length */
|
||||
u8 *rtw_set_ie23a(u8 *pbuf, int index, uint len, const u8 *source, uint *frlen)
|
||||
{
|
||||
|
||||
*pbuf = (u8)index;
|
||||
|
||||
*(pbuf + 1) = (u8)len;
|
||||
|
||||
if (len > 0)
|
||||
memcpy((void *)(pbuf + 2), (void *)source, len);
|
||||
|
||||
*frlen = *frlen + (len + 2);
|
||||
|
||||
return pbuf + len + 2;
|
||||
}
|
||||
|
||||
inline u8 *rtw_set_ie23a_ch_switch(u8 *buf, u32 *buf_len, u8 ch_switch_mode,
|
||||
u8 new_ch, u8 ch_switch_cnt)
|
||||
{
|
||||
u8 ie_data[3];
|
||||
|
||||
ie_data[0] = ch_switch_mode;
|
||||
ie_data[1] = new_ch;
|
||||
ie_data[2] = ch_switch_cnt;
|
||||
return rtw_set_ie23a(buf, WLAN_EID_CHANNEL_SWITCH, 3, ie_data, buf_len);
|
||||
}
|
||||
|
||||
inline u8 hal_ch_offset_to_secondary_ch_offset23a(u8 ch_offset)
|
||||
{
|
||||
if (ch_offset == HAL_PRIME_CHNL_OFFSET_LOWER)
|
||||
return IEEE80211_HT_PARAM_CHA_SEC_BELOW;
|
||||
else if (ch_offset == HAL_PRIME_CHNL_OFFSET_UPPER)
|
||||
return IEEE80211_HT_PARAM_CHA_SEC_ABOVE;
|
||||
|
||||
return IEEE80211_HT_PARAM_CHA_SEC_NONE;
|
||||
}
|
||||
|
||||
inline u8 *rtw_set_ie23a_secondary_ch_offset(u8 *buf, u32 *buf_len,
|
||||
u8 secondary_ch_offset)
|
||||
{
|
||||
return rtw_set_ie23a(buf, WLAN_EID_SECONDARY_CHANNEL_OFFSET,
|
||||
1, &secondary_ch_offset, buf_len);
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
index: the information element id index, limit is the limit for search
|
||||
-----------------------------------------------------------------------------*/
|
||||
u8 *rtw_get_ie23a(u8 *pbuf, int index, int *len, int limit)
|
||||
{
|
||||
int tmp, i;
|
||||
u8 *p;
|
||||
|
||||
if (limit < 1) {
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
p = pbuf;
|
||||
i = 0;
|
||||
*len = 0;
|
||||
while (1) {
|
||||
if (*p == index) {
|
||||
*len = *(p + 1);
|
||||
return p;
|
||||
} else {
|
||||
tmp = *(p + 1);
|
||||
p += (tmp + 2);
|
||||
i += (tmp + 2);
|
||||
}
|
||||
if (i >= limit)
|
||||
break;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* rtw_get_ie23a_ex - Search specific IE from a series of IEs
|
||||
* @in_ie: Address of IEs to search
|
||||
* @in_len: Length limit from in_ie
|
||||
* @eid: Element ID to match
|
||||
* @oui: OUI to match
|
||||
* @oui_len: OUI length
|
||||
* @ie: If not NULL and the specific IE is found, the IE will be copied
|
||||
* to the buf starting from the specific IE
|
||||
* @ielen: If not NULL and the specific IE is found, will set to the length
|
||||
* of the entire IE
|
||||
*
|
||||
* Returns: The address of the specific IE found, or NULL
|
||||
*/
|
||||
u8 *rtw_get_ie23a_ex(u8 *in_ie, uint in_len, u8 eid, u8 *oui, u8 oui_len,
|
||||
u8 *ie, uint *ielen)
|
||||
{
|
||||
uint cnt;
|
||||
u8 *target_ie = NULL;
|
||||
|
||||
if (ielen)
|
||||
*ielen = 0;
|
||||
|
||||
if (!in_ie || in_len <= 0)
|
||||
return target_ie;
|
||||
|
||||
cnt = 0;
|
||||
|
||||
while (cnt < in_len) {
|
||||
if (eid == in_ie[cnt] &&
|
||||
(!oui || !memcmp(&in_ie[cnt + 2], oui, oui_len))) {
|
||||
target_ie = &in_ie[cnt];
|
||||
|
||||
if (ie)
|
||||
memcpy(ie, &in_ie[cnt], in_ie[cnt + 1] + 2);
|
||||
|
||||
if (ielen)
|
||||
*ielen = in_ie[cnt + 1] + 2;
|
||||
break;
|
||||
} else {
|
||||
cnt += in_ie[cnt + 1] + 2; /* goto next */
|
||||
}
|
||||
}
|
||||
|
||||
return target_ie;
|
||||
}
|
||||
|
||||
/**
|
||||
* rtw_ies_remove_ie23a - Find matching IEs and remove
|
||||
* @ies: Address of IEs to search
|
||||
* @ies_len: Pointer of length of ies, will update to new length
|
||||
* @offset: The offset to start search
|
||||
* @eid: Element ID to match
|
||||
* @oui: OUI to match
|
||||
* @oui_len: OUI length
|
||||
*
|
||||
* Returns: _SUCCESS: ies is updated, _FAIL: not updated
|
||||
*/
|
||||
int rtw_ies_remove_ie23a(u8 *ies, uint *ies_len, uint offset, u8 eid,
|
||||
u8 *oui, u8 oui_len)
|
||||
{
|
||||
int ret = _FAIL;
|
||||
u8 *target_ie;
|
||||
u32 target_ielen;
|
||||
u8 *start;
|
||||
uint search_len;
|
||||
|
||||
if (!ies || !ies_len || *ies_len <= offset)
|
||||
goto exit;
|
||||
|
||||
start = ies + offset;
|
||||
search_len = *ies_len - offset;
|
||||
|
||||
while (1) {
|
||||
target_ie = rtw_get_ie23a_ex(start, search_len, eid, oui, oui_len,
|
||||
NULL, &target_ielen);
|
||||
if (target_ie && target_ielen) {
|
||||
u8 buf[MAX_IE_SZ] = {0};
|
||||
u8 *remain_ies = target_ie + target_ielen;
|
||||
uint remain_len = search_len - (remain_ies - start);
|
||||
|
||||
memcpy(buf, remain_ies, remain_len);
|
||||
memcpy(target_ie, buf, remain_len);
|
||||
*ies_len = *ies_len - target_ielen;
|
||||
ret = _SUCCESS;
|
||||
|
||||
start = target_ie;
|
||||
search_len = remain_len;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
exit:
|
||||
return ret;
|
||||
}
|
||||
|
||||
void rtw_set_supported_rate23a(u8 *SupportedRates, uint mode)
|
||||
{
|
||||
|
||||
|
||||
memset(SupportedRates, 0, NDIS_802_11_LENGTH_RATES_EX);
|
||||
|
||||
switch (mode) {
|
||||
case WIRELESS_11B:
|
||||
memcpy(SupportedRates, WIFI_CCKRATES, IEEE80211_CCK_RATE_LEN);
|
||||
break;
|
||||
|
||||
case WIRELESS_11G:
|
||||
case WIRELESS_11A:
|
||||
case WIRELESS_11_5N:
|
||||
case WIRELESS_11A_5N:/* Todo: no basic rate for ofdm ? */
|
||||
memcpy(SupportedRates, WIFI_OFDMRATES,
|
||||
IEEE80211_NUM_OFDM_RATESLEN);
|
||||
break;
|
||||
|
||||
case WIRELESS_11BG:
|
||||
case WIRELESS_11G_24N:
|
||||
case WIRELESS_11_24N:
|
||||
case WIRELESS_11BG_24N:
|
||||
memcpy(SupportedRates, WIFI_CCKRATES, IEEE80211_CCK_RATE_LEN);
|
||||
memcpy(SupportedRates + IEEE80211_CCK_RATE_LEN, WIFI_OFDMRATES,
|
||||
IEEE80211_NUM_OFDM_RATESLEN);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
uint rtw_get_rateset_len23a(u8 *rateset)
|
||||
{
|
||||
uint i = 0;
|
||||
|
||||
while (1) {
|
||||
if (rateset[i] == 0)
|
||||
break;
|
||||
|
||||
if (i > 12)
|
||||
break;
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
int rtw_generate_ie23a(struct registry_priv *pregistrypriv)
|
||||
{
|
||||
u8 wireless_mode;
|
||||
int sz = 0, rateLen;
|
||||
struct wlan_bssid_ex *pdev_network = &pregistrypriv->dev_network;
|
||||
u8 *ie = pdev_network->IEs;
|
||||
u16 cap;
|
||||
|
||||
pdev_network->tsf = 0;
|
||||
|
||||
cap = WLAN_CAPABILITY_IBSS;
|
||||
|
||||
if (pregistrypriv->preamble == PREAMBLE_SHORT)
|
||||
cap |= WLAN_CAPABILITY_SHORT_PREAMBLE;
|
||||
|
||||
if (pdev_network->Privacy)
|
||||
cap |= WLAN_CAPABILITY_PRIVACY;
|
||||
|
||||
pdev_network->capability = cap;
|
||||
|
||||
/* SSID */
|
||||
ie = rtw_set_ie23a(ie, WLAN_EID_SSID, pdev_network->Ssid.ssid_len,
|
||||
pdev_network->Ssid.ssid, &sz);
|
||||
|
||||
/* supported rates */
|
||||
if (pregistrypriv->wireless_mode == WIRELESS_11ABGN) {
|
||||
if (pdev_network->DSConfig > 14)
|
||||
wireless_mode = WIRELESS_11A_5N;
|
||||
else
|
||||
wireless_mode = WIRELESS_11BG_24N;
|
||||
} else {
|
||||
wireless_mode = pregistrypriv->wireless_mode;
|
||||
}
|
||||
|
||||
rtw_set_supported_rate23a(pdev_network->SupportedRates, wireless_mode);
|
||||
|
||||
rateLen = rtw_get_rateset_len23a(pdev_network->SupportedRates);
|
||||
|
||||
if (rateLen > 8) {
|
||||
ie = rtw_set_ie23a(ie, WLAN_EID_SUPP_RATES, 8,
|
||||
pdev_network->SupportedRates, &sz);
|
||||
/* ie = rtw_set_ie23a(ie, _EXT_SUPPORTEDRATES_IE_, (rateLen - 8), (pdev_network->SupportedRates + 8), &sz); */
|
||||
} else {
|
||||
ie = rtw_set_ie23a(ie, WLAN_EID_SUPP_RATES, rateLen,
|
||||
pdev_network->SupportedRates, &sz);
|
||||
}
|
||||
|
||||
/* DS parameter set */
|
||||
ie = rtw_set_ie23a(ie, WLAN_EID_DS_PARAMS, 1,
|
||||
(u8 *)&pdev_network->DSConfig, &sz);
|
||||
|
||||
/* IBSS Parameter Set */
|
||||
|
||||
ie = rtw_set_ie23a(ie, WLAN_EID_IBSS_PARAMS, 2,
|
||||
(u8 *)&pdev_network->ATIMWindow, &sz);
|
||||
|
||||
if (rateLen > 8) {
|
||||
ie = rtw_set_ie23a(ie, WLAN_EID_EXT_SUPP_RATES, (rateLen - 8),
|
||||
(pdev_network->SupportedRates + 8), &sz);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* return _SUCCESS; */
|
||||
|
||||
return sz;
|
||||
}
|
||||
|
||||
static int rtw_get_wpa_cipher_suite(const u8 *s)
|
||||
{
|
||||
if (!memcmp(s, WPA_CIPHER_SUITE_NONE23A, WPA_SELECTOR_LEN))
|
||||
return WPA_CIPHER_NONE;
|
||||
if (!memcmp(s, WPA_CIPHER_SUITE_WEP4023A, WPA_SELECTOR_LEN))
|
||||
return WPA_CIPHER_WEP40;
|
||||
if (!memcmp(s, WPA_CIPHER_SUITE_TKIP23A, WPA_SELECTOR_LEN))
|
||||
return WPA_CIPHER_TKIP;
|
||||
if (!memcmp(s, WPA_CIPHER_SUITE_CCMP23A, WPA_SELECTOR_LEN))
|
||||
return WPA_CIPHER_CCMP;
|
||||
if (!memcmp(s, WPA_CIPHER_SUITE_WEP10423A, WPA_SELECTOR_LEN))
|
||||
return WPA_CIPHER_WEP104;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rtw_get_wpa2_cipher_suite(const u8 *s)
|
||||
{
|
||||
if (!memcmp(s, RSN_CIPHER_SUITE_NONE23A, RSN_SELECTOR_LEN))
|
||||
return WPA_CIPHER_NONE;
|
||||
if (!memcmp(s, RSN_CIPHER_SUITE_WEP4023A, RSN_SELECTOR_LEN))
|
||||
return WPA_CIPHER_WEP40;
|
||||
if (!memcmp(s, RSN_CIPHER_SUITE_TKIP23A, RSN_SELECTOR_LEN))
|
||||
return WPA_CIPHER_TKIP;
|
||||
if (!memcmp(s, RSN_CIPHER_SUITE_CCMP23A, RSN_SELECTOR_LEN))
|
||||
return WPA_CIPHER_CCMP;
|
||||
if (!memcmp(s, RSN_CIPHER_SUITE_WEP10423A, RSN_SELECTOR_LEN))
|
||||
return WPA_CIPHER_WEP104;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int rtw_parse_wpa_ie23a(const u8 *wpa_ie, int wpa_ie_len, int *group_cipher,
|
||||
int *pairwise_cipher, int *is_8021x)
|
||||
{
|
||||
int i, ret = _SUCCESS;
|
||||
int left, count;
|
||||
const u8 *pos;
|
||||
|
||||
if (wpa_ie_len <= 0) {
|
||||
/* No WPA IE - fail silently */
|
||||
return _FAIL;
|
||||
}
|
||||
|
||||
if (wpa_ie[1] != (u8)(wpa_ie_len - 2))
|
||||
return _FAIL;
|
||||
|
||||
pos = wpa_ie;
|
||||
|
||||
pos += 8;
|
||||
left = wpa_ie_len - 8;
|
||||
|
||||
/* group_cipher */
|
||||
if (left >= WPA_SELECTOR_LEN) {
|
||||
|
||||
*group_cipher = rtw_get_wpa_cipher_suite(pos);
|
||||
|
||||
pos += WPA_SELECTOR_LEN;
|
||||
left -= WPA_SELECTOR_LEN;
|
||||
} else if (left > 0) {
|
||||
RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_,
|
||||
"%s: ie length mismatch, %u too much\n",
|
||||
__func__, left);
|
||||
|
||||
return _FAIL;
|
||||
}
|
||||
|
||||
/* pairwise_cipher */
|
||||
if (left >= 2) {
|
||||
/* count = le16_to_cpu(*(u16*)pos); */
|
||||
count = get_unaligned_le16(pos);
|
||||
pos += 2;
|
||||
left -= 2;
|
||||
|
||||
if (count == 0 || left < count * WPA_SELECTOR_LEN) {
|
||||
RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_,
|
||||
"%s: ie count botch (pairwise), count %u left %u\n",
|
||||
__func__, count, left);
|
||||
return _FAIL;
|
||||
}
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
*pairwise_cipher |= rtw_get_wpa_cipher_suite(pos);
|
||||
|
||||
pos += WPA_SELECTOR_LEN;
|
||||
left -= WPA_SELECTOR_LEN;
|
||||
}
|
||||
} else if (left == 1) {
|
||||
RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_,
|
||||
"%s: ie too short (for key mgmt)\n", __func__);
|
||||
return _FAIL;
|
||||
}
|
||||
|
||||
if (is_8021x) {
|
||||
if (left >= 6) {
|
||||
pos += 2;
|
||||
if (!memcmp(pos, RTW_WPA_OUI23A_TYPE, 4)) {
|
||||
RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_,
|
||||
"%s : there has 802.1x auth\n",
|
||||
__func__);
|
||||
*is_8021x = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int rtw_parse_wpa2_ie23a(const u8 *rsn_ie, int rsn_ie_len, int *group_cipher,
|
||||
int *pairwise_cipher, int *is_8021x)
|
||||
{
|
||||
int i, ret = _SUCCESS;
|
||||
int left, count;
|
||||
const u8 *pos;
|
||||
u8 SUITE_1X[4] = {0x00, 0x0f, 0xac, 0x01};
|
||||
|
||||
if (rsn_ie_len <= 0) {
|
||||
/* No RSN IE - fail silently */
|
||||
return _FAIL;
|
||||
}
|
||||
|
||||
if (*rsn_ie != WLAN_EID_RSN || *(rsn_ie + 1) != (u8)(rsn_ie_len - 2)) {
|
||||
return _FAIL;
|
||||
}
|
||||
|
||||
pos = rsn_ie;
|
||||
pos += 4;
|
||||
left = rsn_ie_len - 4;
|
||||
|
||||
/* group_cipher */
|
||||
if (left >= RSN_SELECTOR_LEN) {
|
||||
*group_cipher = rtw_get_wpa2_cipher_suite(pos);
|
||||
|
||||
pos += RSN_SELECTOR_LEN;
|
||||
left -= RSN_SELECTOR_LEN;
|
||||
} else if (left > 0) {
|
||||
RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_,
|
||||
"%s: ie length mismatch, %u too much\n",
|
||||
__func__, left);
|
||||
return _FAIL;
|
||||
}
|
||||
|
||||
/* pairwise_cipher */
|
||||
if (left >= 2) {
|
||||
/* count = le16_to_cpu(*(u16*)pos); */
|
||||
count = get_unaligned_le16(pos);
|
||||
pos += 2;
|
||||
left -= 2;
|
||||
|
||||
if (count == 0 || left < count * RSN_SELECTOR_LEN) {
|
||||
RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_,
|
||||
"%s: ie count botch (pairwise), count %u left %u\n",
|
||||
__func__, count, left);
|
||||
return _FAIL;
|
||||
}
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
*pairwise_cipher |= rtw_get_wpa2_cipher_suite(pos);
|
||||
|
||||
pos += RSN_SELECTOR_LEN;
|
||||
left -= RSN_SELECTOR_LEN;
|
||||
}
|
||||
} else if (left == 1) {
|
||||
RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_,
|
||||
"%s: ie too short (for key mgmt)\n", __func__);
|
||||
|
||||
return _FAIL;
|
||||
}
|
||||
|
||||
if (is_8021x) {
|
||||
if (left >= 6) {
|
||||
pos += 2;
|
||||
if (!memcmp(pos, SUITE_1X, 4)) {
|
||||
RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_,
|
||||
"%s (): there has 802.1x auth\n",
|
||||
__func__);
|
||||
*is_8021x = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* rtw_get_wps_attr23a - Search a specific WPS attribute from a given WPS IE
|
||||
* @wps_ie: Address of WPS IE to search
|
||||
* @wps_ielen: Length limit from wps_ie
|
||||
* @target_attr_id: The attribute ID of WPS attribute to search
|
||||
* @buf_attr: If not NULL and the WPS attribute is found, WPS attribute
|
||||
* will be copied to the buf starting from buf_attr
|
||||
* @len_attr: If not NULL and the WPS attribute is found, will set to the
|
||||
* length of the entire WPS attribute
|
||||
*
|
||||
* Returns: the address of the specific WPS attribute found, or NULL
|
||||
*/
|
||||
const u8 *rtw_get_wps_attr23a(const u8 *wps_ie, uint wps_ielen,
|
||||
u16 target_attr_id, u8 *buf_attr, u32 *len_attr)
|
||||
{
|
||||
const u8 *attr_ptr = NULL;
|
||||
const u8 *target_attr_ptr = NULL;
|
||||
u8 wps_oui[4] = {0x00, 0x50, 0xF2, 0x04};
|
||||
|
||||
if (len_attr)
|
||||
*len_attr = 0;
|
||||
|
||||
if (wps_ie[0] != WLAN_EID_VENDOR_SPECIFIC ||
|
||||
memcmp(wps_ie + 2, wps_oui, 4)) {
|
||||
return attr_ptr;
|
||||
}
|
||||
|
||||
/* 6 = 1(Element ID) + 1(Length) + 4(WPS OUI) */
|
||||
attr_ptr = wps_ie + 6; /* goto first attr */
|
||||
|
||||
while (attr_ptr - wps_ie < wps_ielen) {
|
||||
/* 4 = 2(Attribute ID) + 2(Length) */
|
||||
u16 attr_id = get_unaligned_be16(attr_ptr);
|
||||
u16 attr_data_len = get_unaligned_be16(attr_ptr + 2);
|
||||
u16 attr_len = attr_data_len + 4;
|
||||
|
||||
/* DBG_8723A("%s attr_ptr:%p, id:%u, length:%u\n", __func__, attr_ptr, attr_id, attr_data_len); */
|
||||
if (attr_id == target_attr_id) {
|
||||
target_attr_ptr = attr_ptr;
|
||||
|
||||
if (buf_attr)
|
||||
memcpy(buf_attr, attr_ptr, attr_len);
|
||||
|
||||
if (len_attr)
|
||||
*len_attr = attr_len;
|
||||
|
||||
break;
|
||||
} else {
|
||||
attr_ptr += attr_len; /* goto next */
|
||||
}
|
||||
}
|
||||
|
||||
return target_attr_ptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* rtw_get_wps_attr_content23a - Search a specific WPS attribute content
|
||||
* from a given WPS IE
|
||||
* @wps_ie: Address of WPS IE to search
|
||||
* @wps_ielen: Length limit from wps_ie
|
||||
* @target_attr_id: The attribute ID of WPS attribute to search
|
||||
* @buf_content: If not NULL and the WPS attribute is found, WPS attribute
|
||||
* content will be copied to the buf starting from buf_content
|
||||
* @len_content: If not NULL and the WPS attribute is found, will set to the
|
||||
* length of the WPS attribute content
|
||||
*
|
||||
* Returns: the address of the specific WPS attribute content found, or NULL
|
||||
*/
|
||||
const u8 *rtw_get_wps_attr_content23a(const u8 *wps_ie, uint wps_ielen,
|
||||
u16 target_attr_id, u8 *buf_content)
|
||||
{
|
||||
const u8 *attr_ptr;
|
||||
u32 attr_len;
|
||||
|
||||
attr_ptr = rtw_get_wps_attr23a(wps_ie, wps_ielen, target_attr_id,
|
||||
NULL, &attr_len);
|
||||
|
||||
if (attr_ptr && attr_len) {
|
||||
if (buf_content)
|
||||
memcpy(buf_content, attr_ptr + 4, attr_len - 4);
|
||||
|
||||
return attr_ptr + 4;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int rtw_get_cipher_info(struct wlan_network *pnetwork)
|
||||
{
|
||||
const u8 *pbuf;
|
||||
int group_cipher = 0, pairwise_cipher = 0, is8021x = 0;
|
||||
int ret = _FAIL;
|
||||
int r, plen;
|
||||
char *pie;
|
||||
|
||||
pie = pnetwork->network.IEs;
|
||||
plen = pnetwork->network.IELength;
|
||||
|
||||
pbuf = cfg80211_find_vendor_ie(WLAN_OUI_MICROSOFT,
|
||||
WLAN_OUI_TYPE_MICROSOFT_WPA, pie, plen);
|
||||
|
||||
if (pbuf && pbuf[1] > 0) {
|
||||
RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_,
|
||||
"rtw_get_cipher_info: wpa_ielen: %d\n", pbuf[1]);
|
||||
r = rtw_parse_wpa_ie23a(pbuf, pbuf[1] + 2, &group_cipher,
|
||||
&pairwise_cipher, &is8021x);
|
||||
if (r == _SUCCESS) {
|
||||
pnetwork->BcnInfo.pairwise_cipher = pairwise_cipher;
|
||||
pnetwork->BcnInfo.group_cipher = group_cipher;
|
||||
pnetwork->BcnInfo.is_8021x = is8021x;
|
||||
RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_,
|
||||
"%s: pnetwork->pairwise_cipher: %d, is_8021x is %d\n",
|
||||
__func__, pnetwork->BcnInfo.pairwise_cipher,
|
||||
pnetwork->BcnInfo.is_8021x);
|
||||
ret = _SUCCESS;
|
||||
}
|
||||
} else {
|
||||
pbuf = cfg80211_find_ie(WLAN_EID_RSN, pie, plen);
|
||||
|
||||
if (pbuf && pbuf[1] > 0) {
|
||||
RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_,
|
||||
"get RSN IE\n");
|
||||
r = rtw_parse_wpa2_ie23a(pbuf, pbuf[1] + 2,
|
||||
&group_cipher, &pairwise_cipher,
|
||||
&is8021x);
|
||||
if (r == _SUCCESS) {
|
||||
RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_,
|
||||
"get RSN IE OK!!!\n");
|
||||
pnetwork->BcnInfo.pairwise_cipher =
|
||||
pairwise_cipher;
|
||||
pnetwork->BcnInfo.group_cipher = group_cipher;
|
||||
pnetwork->BcnInfo.is_8021x = is8021x;
|
||||
RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_,
|
||||
"%s: pnetwork->pairwise_cipher: %d,pnetwork->group_cipher is %d, is_8021x is %d\n",
|
||||
__func__,
|
||||
pnetwork->BcnInfo.pairwise_cipher,
|
||||
pnetwork->BcnInfo.group_cipher,
|
||||
pnetwork->BcnInfo.is_8021x);
|
||||
ret = _SUCCESS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void rtw_get_bcn_info23a(struct wlan_network *pnetwork)
|
||||
{
|
||||
u8 bencrypt = 0;
|
||||
int pie_len;
|
||||
u8 *pie;
|
||||
const u8 *p;
|
||||
|
||||
if (pnetwork->network.capability & WLAN_CAPABILITY_PRIVACY) {
|
||||
bencrypt = 1;
|
||||
pnetwork->network.Privacy = 1;
|
||||
} else
|
||||
pnetwork->BcnInfo.encryp_protocol = ENCRYP_PROTOCOL_OPENSYS;
|
||||
|
||||
RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_,
|
||||
"%s: ssid =%s\n", __func__, pnetwork->network.Ssid.ssid);
|
||||
|
||||
pie = pnetwork->network.IEs;
|
||||
pie_len = pnetwork->network.IELength;
|
||||
|
||||
p = cfg80211_find_ie(WLAN_EID_RSN, pie, pie_len);
|
||||
if (p && p[1]) {
|
||||
pnetwork->BcnInfo.encryp_protocol = ENCRYP_PROTOCOL_WPA2;
|
||||
} else if (cfg80211_find_vendor_ie(WLAN_OUI_MICROSOFT,
|
||||
WLAN_OUI_TYPE_MICROSOFT_WPA,
|
||||
pie, pie_len)) {
|
||||
pnetwork->BcnInfo.encryp_protocol = ENCRYP_PROTOCOL_WPA;
|
||||
} else {
|
||||
if (bencrypt)
|
||||
pnetwork->BcnInfo.encryp_protocol = ENCRYP_PROTOCOL_WEP;
|
||||
}
|
||||
RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_,
|
||||
"%s: pnetwork->encryp_protocol is %x\n", __func__,
|
||||
pnetwork->BcnInfo.encryp_protocol);
|
||||
RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_,
|
||||
"%s: pnetwork->encryp_protocol is %x\n", __func__,
|
||||
pnetwork->BcnInfo.encryp_protocol);
|
||||
rtw_get_cipher_info(pnetwork);
|
||||
|
||||
/* get bwmode and ch_offset */
|
||||
}
|
||||
|
||||
/* show MCS rate, unit: 100Kbps */
|
||||
u16 rtw_mcs_rate23a(u8 rf_type, u8 bw_40MHz, u8 short_GI_20, u8 short_GI_40,
|
||||
struct ieee80211_mcs_info *mcs)
|
||||
{
|
||||
u16 max_rate = 0;
|
||||
|
||||
if (rf_type == RF_1T1R) {
|
||||
if (mcs->rx_mask[0] & BIT(7))
|
||||
max_rate = (bw_40MHz) ? ((short_GI_40) ? 1500 : 1350) :
|
||||
((short_GI_20) ? 722 : 650);
|
||||
else if (mcs->rx_mask[0] & BIT(6))
|
||||
max_rate = (bw_40MHz) ? ((short_GI_40) ? 1350 : 1215) :
|
||||
((short_GI_20) ? 650 : 585);
|
||||
else if (mcs->rx_mask[0] & BIT(5))
|
||||
max_rate = (bw_40MHz) ? ((short_GI_40) ? 1200 : 1080) :
|
||||
((short_GI_20) ? 578 : 520);
|
||||
else if (mcs->rx_mask[0] & BIT(4))
|
||||
max_rate = (bw_40MHz) ? ((short_GI_40) ? 900 : 810) :
|
||||
((short_GI_20) ? 433 : 390);
|
||||
else if (mcs->rx_mask[0] & BIT(3))
|
||||
max_rate = (bw_40MHz) ? ((short_GI_40) ? 600 : 540) :
|
||||
((short_GI_20) ? 289 : 260);
|
||||
else if (mcs->rx_mask[0] & BIT(2))
|
||||
max_rate = (bw_40MHz) ? ((short_GI_40) ? 450 : 405) :
|
||||
((short_GI_20) ? 217 : 195);
|
||||
else if (mcs->rx_mask[0] & BIT(1))
|
||||
max_rate = (bw_40MHz) ? ((short_GI_40) ? 300 : 270) :
|
||||
((short_GI_20) ? 144 : 130);
|
||||
else if (mcs->rx_mask[0] & BIT(0))
|
||||
max_rate = (bw_40MHz) ? ((short_GI_40) ? 150 : 135) :
|
||||
((short_GI_20) ? 72 : 65);
|
||||
} else {
|
||||
if (mcs->rx_mask[1]) {
|
||||
if (mcs->rx_mask[1] & BIT(7))
|
||||
max_rate = (bw_40MHz) ? ((short_GI_40) ? 3000 : 2700) : ((short_GI_20) ? 1444 : 1300);
|
||||
else if (mcs->rx_mask[1] & BIT(6))
|
||||
max_rate = (bw_40MHz) ? ((short_GI_40) ? 2700 : 2430) : ((short_GI_20) ? 1300 : 1170);
|
||||
else if (mcs->rx_mask[1] & BIT(5))
|
||||
max_rate = (bw_40MHz) ? ((short_GI_40) ? 2400 : 2160) : ((short_GI_20) ? 1156 : 1040);
|
||||
else if (mcs->rx_mask[1] & BIT(4))
|
||||
max_rate = (bw_40MHz) ? ((short_GI_40) ? 1800 : 1620) : ((short_GI_20) ? 867 : 780);
|
||||
else if (mcs->rx_mask[1] & BIT(3))
|
||||
max_rate = (bw_40MHz) ? ((short_GI_40) ? 1200 : 1080) : ((short_GI_20) ? 578 : 520);
|
||||
else if (mcs->rx_mask[1] & BIT(2))
|
||||
max_rate = (bw_40MHz) ? ((short_GI_40) ? 900 : 810) : ((short_GI_20) ? 433 : 390);
|
||||
else if (mcs->rx_mask[1] & BIT(1))
|
||||
max_rate = (bw_40MHz) ? ((short_GI_40) ? 600 : 540) : ((short_GI_20) ? 289 : 260);
|
||||
else if (mcs->rx_mask[1] & BIT(0))
|
||||
max_rate = (bw_40MHz) ? ((short_GI_40) ? 300 : 270) : ((short_GI_20) ? 144 : 130);
|
||||
} else {
|
||||
if (mcs->rx_mask[0] & BIT(7))
|
||||
max_rate = (bw_40MHz) ? ((short_GI_40) ? 1500 : 1350) : ((short_GI_20) ? 722 : 650);
|
||||
else if (mcs->rx_mask[0] & BIT(6))
|
||||
max_rate = (bw_40MHz) ? ((short_GI_40) ? 1350 : 1215) : ((short_GI_20) ? 650 : 585);
|
||||
else if (mcs->rx_mask[0] & BIT(5))
|
||||
max_rate = (bw_40MHz) ? ((short_GI_40) ? 1200 : 1080) : ((short_GI_20) ? 578 : 520);
|
||||
else if (mcs->rx_mask[0] & BIT(4))
|
||||
max_rate = (bw_40MHz) ? ((short_GI_40) ? 900 : 810) : ((short_GI_20) ? 433 : 390);
|
||||
else if (mcs->rx_mask[0] & BIT(3))
|
||||
max_rate = (bw_40MHz) ? ((short_GI_40) ? 600 : 540) : ((short_GI_20) ? 289 : 260);
|
||||
else if (mcs->rx_mask[0] & BIT(2))
|
||||
max_rate = (bw_40MHz) ? ((short_GI_40) ? 450 : 405) : ((short_GI_20) ? 217 : 195);
|
||||
else if (mcs->rx_mask[0] & BIT(1))
|
||||
max_rate = (bw_40MHz) ? ((short_GI_40) ? 300 : 270) : ((short_GI_20) ? 144 : 130);
|
||||
else if (mcs->rx_mask[0] & BIT(0))
|
||||
max_rate = (bw_40MHz) ? ((short_GI_40) ? 150 : 135) : ((short_GI_20) ? 72 : 65);
|
||||
}
|
||||
}
|
||||
return max_rate;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,607 +0,0 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
#define _RTW_PWRCTRL_C_
|
||||
|
||||
#include <linux/mutex.h>
|
||||
#include <osdep_service.h>
|
||||
#include <drv_types.h>
|
||||
#include <osdep_intf.h>
|
||||
#include <rtl8723a_cmd.h>
|
||||
#include <rtw_sreset.h>
|
||||
|
||||
#include <rtl8723a_bt_intf.h>
|
||||
#include <usb_ops_linux.h>
|
||||
|
||||
void ips_enter23a(struct rtw_adapter *padapter)
|
||||
{
|
||||
struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv;
|
||||
|
||||
mutex_lock(&pwrpriv->mutex_lock);
|
||||
|
||||
pwrpriv->bips_processing = true;
|
||||
|
||||
/* syn ips_mode with request */
|
||||
pwrpriv->ips_mode = pwrpriv->ips_mode_req;
|
||||
|
||||
pwrpriv->ips_enter23a_cnts++;
|
||||
DBG_8723A("==>ips_enter23a cnts:%d\n", pwrpriv->ips_enter23a_cnts);
|
||||
rtl8723a_BT_disable_coexist(padapter);
|
||||
|
||||
if (pwrpriv->change_rfpwrstate == rf_off) {
|
||||
pwrpriv->bpower_saving = true;
|
||||
DBG_8723A_LEVEL(_drv_always_, "nolinked power save enter\n");
|
||||
|
||||
if (pwrpriv->ips_mode == IPS_LEVEL_2)
|
||||
pwrpriv->bkeepfwalive = true;
|
||||
|
||||
rtw_ips_pwr_down23a(padapter);
|
||||
pwrpriv->rf_pwrstate = rf_off;
|
||||
}
|
||||
pwrpriv->bips_processing = false;
|
||||
|
||||
mutex_unlock(&pwrpriv->mutex_lock);
|
||||
}
|
||||
|
||||
int ips_leave23a(struct rtw_adapter *padapter)
|
||||
{
|
||||
struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv;
|
||||
struct security_priv *psecuritypriv = &padapter->securitypriv;
|
||||
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
||||
int result = _SUCCESS;
|
||||
int keyid;
|
||||
|
||||
mutex_lock(&pwrpriv->mutex_lock);
|
||||
|
||||
if (pwrpriv->rf_pwrstate == rf_off && !pwrpriv->bips_processing) {
|
||||
pwrpriv->bips_processing = true;
|
||||
pwrpriv->change_rfpwrstate = rf_on;
|
||||
pwrpriv->ips_leave23a_cnts++;
|
||||
DBG_8723A("==>ips_leave23a cnts:%d\n",
|
||||
pwrpriv->ips_leave23a_cnts);
|
||||
|
||||
result = rtw_ips_pwr_up23a(padapter);
|
||||
if (result == _SUCCESS)
|
||||
pwrpriv->rf_pwrstate = rf_on;
|
||||
|
||||
DBG_8723A_LEVEL(_drv_always_, "nolinked power save leave\n");
|
||||
|
||||
if (psecuritypriv->dot11PrivacyAlgrthm ==
|
||||
WLAN_CIPHER_SUITE_WEP40 ||
|
||||
psecuritypriv->dot11PrivacyAlgrthm ==
|
||||
WLAN_CIPHER_SUITE_WEP104) {
|
||||
DBG_8723A("==>%s, channel(%d), processing(%x)\n",
|
||||
__func__, padapter->mlmeextpriv.cur_channel,
|
||||
pwrpriv->bips_processing);
|
||||
set_channel_bwmode23a(padapter,
|
||||
padapter->mlmeextpriv.cur_channel,
|
||||
HAL_PRIME_CHNL_OFFSET_DONT_CARE,
|
||||
HT_CHANNEL_WIDTH_20);
|
||||
for (keyid = 0; keyid < 4; keyid++) {
|
||||
if (pmlmepriv->key_mask & BIT(keyid)) {
|
||||
if (keyid ==
|
||||
psecuritypriv->dot11PrivacyKeyIndex)
|
||||
result = rtw_set_key23a(padapter, psecuritypriv, keyid, 1);
|
||||
else
|
||||
result = rtw_set_key23a(padapter, psecuritypriv, keyid, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DBG_8723A("==> ips_leave23a.....LED(0x%08x)...\n",
|
||||
rtl8723au_read32(padapter, 0x4c));
|
||||
pwrpriv->bips_processing = false;
|
||||
|
||||
pwrpriv->bkeepfwalive = false;
|
||||
pwrpriv->bpower_saving = false;
|
||||
}
|
||||
|
||||
mutex_unlock(&pwrpriv->mutex_lock);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
static bool rtw_pwr_unassociated_idle(struct rtw_adapter *adapter)
|
||||
{
|
||||
struct mlme_priv *pmlmepriv = &adapter->mlmepriv;
|
||||
struct xmit_priv *pxmit_priv = &adapter->xmitpriv;
|
||||
|
||||
bool ret = false;
|
||||
|
||||
if (time_after_eq(adapter->pwrctrlpriv.ips_deny_time, jiffies))
|
||||
goto exit;
|
||||
|
||||
if (check_fwstate(pmlmepriv, WIFI_ASOC_STATE|WIFI_SITE_MONITOR) ||
|
||||
check_fwstate(pmlmepriv, WIFI_UNDER_LINKING|WIFI_UNDER_WPS) ||
|
||||
check_fwstate(pmlmepriv, WIFI_AP_STATE) ||
|
||||
check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE|WIFI_ADHOC_STATE)){
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (pxmit_priv->free_xmitbuf_cnt != NR_XMITBUFF ||
|
||||
pxmit_priv->free_xmit_extbuf_cnt != NR_XMIT_EXTBUFF) {
|
||||
DBG_8723A_LEVEL(_drv_always_,
|
||||
"There are some pkts to transmit\n");
|
||||
DBG_8723A_LEVEL(_drv_info_, "free_xmitbuf_cnt: %d, "
|
||||
"free_xmit_extbuf_cnt: %d\n",
|
||||
pxmit_priv->free_xmitbuf_cnt,
|
||||
pxmit_priv->free_xmit_extbuf_cnt);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
ret = true;
|
||||
|
||||
exit:
|
||||
return ret;
|
||||
}
|
||||
|
||||
void rtw_ps_processor23a(struct rtw_adapter *padapter)
|
||||
{
|
||||
struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv;
|
||||
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
||||
|
||||
pwrpriv->ps_processing = true;
|
||||
|
||||
if (pwrpriv->bips_processing == true)
|
||||
goto exit;
|
||||
|
||||
if (pwrpriv->ips_mode_req == IPS_NONE)
|
||||
goto exit;
|
||||
|
||||
if (!rtw_pwr_unassociated_idle(padapter))
|
||||
goto exit;
|
||||
|
||||
if (pwrpriv->rf_pwrstate == rf_on &&
|
||||
(pwrpriv->pwr_state_check_cnts % 4) == 0) {
|
||||
DBG_8723A("==>%s .fw_state(%x)\n", __func__,
|
||||
get_fwstate(pmlmepriv));
|
||||
pwrpriv->change_rfpwrstate = rf_off;
|
||||
ips_enter23a(padapter);
|
||||
}
|
||||
exit:
|
||||
rtw_set_pwr_state_check_timer(&padapter->pwrctrlpriv);
|
||||
pwrpriv->ps_processing = false;
|
||||
}
|
||||
|
||||
static void pwr_state_check_handler(unsigned long data)
|
||||
{
|
||||
struct rtw_adapter *padapter = (struct rtw_adapter *)data;
|
||||
|
||||
rtw_ps_cmd23a(padapter);
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* Parameters
|
||||
* padapter
|
||||
* pslv power state level, only could be PS_STATE_S0 ~ PS_STATE_S4
|
||||
*
|
||||
*/
|
||||
void rtw_set_rpwm23a(struct rtw_adapter *padapter, u8 pslv)
|
||||
{
|
||||
u8 rpwm;
|
||||
struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv;
|
||||
|
||||
pslv = PS_STATE(pslv);
|
||||
|
||||
if (pwrpriv->btcoex_rfon) {
|
||||
if (pslv < PS_STATE_S4)
|
||||
pslv = PS_STATE_S3;
|
||||
}
|
||||
|
||||
if (pwrpriv->rpwm == pslv) {
|
||||
RT_TRACE(_module_rtl871x_pwrctrl_c_, _drv_err_,
|
||||
"%s: Already set rpwm[0x%02X], new = 0x%02X!\n",
|
||||
__func__, pwrpriv->rpwm, pslv);
|
||||
return;
|
||||
}
|
||||
|
||||
if (padapter->bSurpriseRemoved == true ||
|
||||
padapter->hw_init_completed == false) {
|
||||
RT_TRACE(_module_rtl871x_pwrctrl_c_, _drv_err_,
|
||||
"%s: SurpriseRemoved(%d) hw_init_completed(%d)\n",
|
||||
__func__, padapter->bSurpriseRemoved,
|
||||
padapter->hw_init_completed);
|
||||
|
||||
pwrpriv->cpwm = PS_STATE_S4;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (padapter->bDriverStopped == true) {
|
||||
RT_TRACE(_module_rtl871x_pwrctrl_c_, _drv_err_,
|
||||
"%s: change power state(0x%02X) when DriverStopped\n",
|
||||
__func__, pslv);
|
||||
|
||||
if (pslv < PS_STATE_S2) {
|
||||
RT_TRACE(_module_rtl871x_pwrctrl_c_, _drv_err_,
|
||||
"%s: Reject to enter PS_STATE(0x%02X) lower than S2 when DriverStopped!!\n",
|
||||
__func__, pslv);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
rpwm = pslv | pwrpriv->tog;
|
||||
RT_TRACE(_module_rtl871x_pwrctrl_c_, _drv_notice_,
|
||||
"rtw_set_rpwm23a: rpwm = 0x%02x cpwm = 0x%02x\n",
|
||||
rpwm, pwrpriv->cpwm);
|
||||
|
||||
pwrpriv->rpwm = pslv;
|
||||
|
||||
rtl8723a_set_rpwm(padapter, rpwm);
|
||||
|
||||
pwrpriv->tog += 0x80;
|
||||
pwrpriv->cpwm = pslv;
|
||||
}
|
||||
|
||||
static bool PS_RDY_CHECK(struct rtw_adapter *padapter)
|
||||
{
|
||||
unsigned long delta_time;
|
||||
struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv;
|
||||
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
||||
|
||||
delta_time = jiffies - pwrpriv->DelayLPSLastTimeStamp;
|
||||
|
||||
if (delta_time < LPS_DELAY_TIME)
|
||||
return false;
|
||||
|
||||
if (!check_fwstate(pmlmepriv, _FW_LINKED) ||
|
||||
check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) ||
|
||||
check_fwstate(pmlmepriv, WIFI_AP_STATE) ||
|
||||
check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) ||
|
||||
check_fwstate(pmlmepriv, WIFI_ADHOC_STATE))
|
||||
return false;
|
||||
if (pwrpriv->bInSuspend)
|
||||
return false;
|
||||
if (padapter->securitypriv.dot11AuthAlgrthm == dot11AuthAlgrthm_8021X &&
|
||||
!padapter->securitypriv.binstallGrpkey) {
|
||||
DBG_8723A("Group handshake still in progress !!!\n");
|
||||
return false;
|
||||
}
|
||||
if (!rtw_cfg80211_pwr_mgmt(padapter))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void rtw_set_ps_mode23a(struct rtw_adapter *padapter, u8 ps_mode,
|
||||
u8 smart_ps, u8 bcn_ant_mode)
|
||||
{
|
||||
struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv;
|
||||
|
||||
RT_TRACE(_module_rtl871x_pwrctrl_c_, _drv_notice_,
|
||||
"%s: PowerMode =%d Smart_PS =%d\n",
|
||||
__func__, ps_mode, smart_ps);
|
||||
|
||||
if (ps_mode > PM_Card_Disable) {
|
||||
RT_TRACE(_module_rtl871x_pwrctrl_c_, _drv_err_,
|
||||
"ps_mode:%d error\n", ps_mode);
|
||||
return;
|
||||
}
|
||||
|
||||
if (pwrpriv->pwr_mode == ps_mode) {
|
||||
if (PS_MODE_ACTIVE == ps_mode)
|
||||
return;
|
||||
|
||||
if (pwrpriv->smart_ps == smart_ps &&
|
||||
pwrpriv->bcn_ant_mode == bcn_ant_mode)
|
||||
return;
|
||||
}
|
||||
|
||||
if (ps_mode == PS_MODE_ACTIVE) {
|
||||
DBG_8723A("rtw_set_ps_mode23a: Leave 802.11 power save\n");
|
||||
|
||||
pwrpriv->pwr_mode = ps_mode;
|
||||
rtw_set_rpwm23a(padapter, PS_STATE_S4);
|
||||
rtl8723a_set_FwPwrMode_cmd(padapter, ps_mode);
|
||||
pwrpriv->bFwCurrentInPSMode = false;
|
||||
} else {
|
||||
if (PS_RDY_CHECK(padapter) ||
|
||||
rtl8723a_BT_using_antenna_1(padapter)) {
|
||||
DBG_8723A("%s: Enter 802.11 power save\n", __func__);
|
||||
|
||||
pwrpriv->bFwCurrentInPSMode = true;
|
||||
pwrpriv->pwr_mode = ps_mode;
|
||||
pwrpriv->smart_ps = smart_ps;
|
||||
pwrpriv->bcn_ant_mode = bcn_ant_mode;
|
||||
rtl8723a_set_FwPwrMode_cmd(padapter, ps_mode);
|
||||
|
||||
rtw_set_rpwm23a(padapter, PS_STATE_S2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Return:
|
||||
* 0: Leave OK
|
||||
* -1: Timeout
|
||||
* -2: Other error
|
||||
*/
|
||||
s32 LPS_RF_ON_check23a(struct rtw_adapter *padapter, u32 delay_ms)
|
||||
{
|
||||
unsigned long start_time, end_time;
|
||||
u8 bAwake = false;
|
||||
s32 err = 0;
|
||||
|
||||
start_time = jiffies;
|
||||
end_time = start_time + msecs_to_jiffies(delay_ms);
|
||||
|
||||
while (1) {
|
||||
bAwake = rtl8723a_get_fwlps_rf_on(padapter);
|
||||
if (bAwake == true)
|
||||
break;
|
||||
|
||||
if (padapter->bSurpriseRemoved == true) {
|
||||
err = -2;
|
||||
DBG_8723A("%s: device surprise removed!!\n", __func__);
|
||||
break;
|
||||
}
|
||||
|
||||
if (time_after(jiffies, end_time)) {
|
||||
err = -1;
|
||||
DBG_8723A("%s: Wait for FW LPS leave more than %u "
|
||||
"ms!\n", __func__, delay_ms);
|
||||
break;
|
||||
}
|
||||
udelay(100);
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
/* Description: */
|
||||
/* Enter the leisure power save mode. */
|
||||
void LPS_Enter23a(struct rtw_adapter *padapter)
|
||||
{
|
||||
struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv;
|
||||
|
||||
if (!PS_RDY_CHECK(padapter))
|
||||
return;
|
||||
|
||||
if (pwrpriv->bLeisurePs) {
|
||||
/* Idle for a while if we connect to AP a while ago. */
|
||||
if (pwrpriv->LpsIdleCount >= 2) { /* 4 Sec */
|
||||
if (pwrpriv->pwr_mode == PS_MODE_ACTIVE) {
|
||||
pwrpriv->bpower_saving = true;
|
||||
DBG_8723A("%s smart_ps:%d\n", __func__,
|
||||
pwrpriv->smart_ps);
|
||||
/* For Tenda W311R IOT issue */
|
||||
rtw_set_ps_mode23a(padapter,
|
||||
pwrpriv->power_mgnt,
|
||||
pwrpriv->smart_ps, 0);
|
||||
}
|
||||
} else
|
||||
pwrpriv->LpsIdleCount++;
|
||||
}
|
||||
}
|
||||
|
||||
/* Description: */
|
||||
/* Leave the leisure power save mode. */
|
||||
void LPS_Leave23a(struct rtw_adapter *padapter)
|
||||
{
|
||||
#define LPS_LEAVE_TIMEOUT_MS 100
|
||||
|
||||
struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv;
|
||||
|
||||
if (pwrpriv->bLeisurePs) {
|
||||
if (pwrpriv->pwr_mode != PS_MODE_ACTIVE) {
|
||||
rtw_set_ps_mode23a(padapter, PS_MODE_ACTIVE, 0, 0);
|
||||
|
||||
if (pwrpriv->pwr_mode == PS_MODE_ACTIVE)
|
||||
LPS_RF_ON_check23a(padapter,
|
||||
LPS_LEAVE_TIMEOUT_MS);
|
||||
}
|
||||
}
|
||||
|
||||
pwrpriv->bpower_saving = false;
|
||||
}
|
||||
|
||||
/* Description: Leave all power save mode: LPS, FwLPS, IPS if needed. */
|
||||
/* Move code to function by tynli. 2010.03.26. */
|
||||
void LeaveAllPowerSaveMode23a(struct rtw_adapter *Adapter)
|
||||
{
|
||||
struct mlme_priv *pmlmepriv = &Adapter->mlmepriv;
|
||||
u8 enqueue = 0;
|
||||
|
||||
/* DBG_8723A("%s.....\n", __func__); */
|
||||
if (check_fwstate(pmlmepriv, _FW_LINKED))
|
||||
rtw_lps_ctrl_wk_cmd23a(Adapter, LPS_CTRL_LEAVE, enqueue);
|
||||
}
|
||||
|
||||
void rtw_init_pwrctrl_priv23a(struct rtw_adapter *padapter)
|
||||
{
|
||||
struct pwrctrl_priv *pwrctrlpriv = &padapter->pwrctrlpriv;
|
||||
|
||||
mutex_init(&pwrctrlpriv->mutex_lock);
|
||||
pwrctrlpriv->rf_pwrstate = rf_on;
|
||||
pwrctrlpriv->ips_enter23a_cnts = 0;
|
||||
pwrctrlpriv->ips_leave23a_cnts = 0;
|
||||
pwrctrlpriv->bips_processing = false;
|
||||
|
||||
pwrctrlpriv->ips_mode = padapter->registrypriv.ips_mode;
|
||||
pwrctrlpriv->ips_mode_req = padapter->registrypriv.ips_mode;
|
||||
|
||||
pwrctrlpriv->pwr_state_check_interval = RTW_PWR_STATE_CHK_INTERVAL;
|
||||
pwrctrlpriv->pwr_state_check_cnts = 0;
|
||||
pwrctrlpriv->bInSuspend = false;
|
||||
pwrctrlpriv->bkeepfwalive = false;
|
||||
|
||||
pwrctrlpriv->LpsIdleCount = 0;
|
||||
|
||||
/* PS_MODE_MIN; */
|
||||
pwrctrlpriv->power_mgnt = padapter->registrypriv.power_mgnt;
|
||||
pwrctrlpriv->bLeisurePs =
|
||||
(PS_MODE_ACTIVE != pwrctrlpriv->power_mgnt)?true:false;
|
||||
|
||||
pwrctrlpriv->bFwCurrentInPSMode = false;
|
||||
|
||||
pwrctrlpriv->rpwm = 0;
|
||||
pwrctrlpriv->cpwm = PS_STATE_S4;
|
||||
|
||||
pwrctrlpriv->pwr_mode = PS_MODE_ACTIVE;
|
||||
pwrctrlpriv->smart_ps = padapter->registrypriv.smart_ps;
|
||||
pwrctrlpriv->bcn_ant_mode = 0;
|
||||
|
||||
pwrctrlpriv->tog = 0x80;
|
||||
|
||||
pwrctrlpriv->btcoex_rfon = false;
|
||||
|
||||
setup_timer(&pwrctrlpriv->pwr_state_check_timer,
|
||||
pwr_state_check_handler, (unsigned long)padapter);
|
||||
}
|
||||
|
||||
void rtw_free_pwrctrl_priv(struct rtw_adapter *adapter)
|
||||
{
|
||||
}
|
||||
|
||||
inline void rtw_set_ips_deny23a(struct rtw_adapter *padapter, u32 ms)
|
||||
{
|
||||
struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv;
|
||||
|
||||
pwrpriv->ips_deny_time = jiffies + msecs_to_jiffies(ms);
|
||||
}
|
||||
|
||||
/*
|
||||
* rtw_pwr_wakeup - Wake the NIC up from: 1)IPS. 2)USB autosuspend
|
||||
* @adapter: pointer to _adapter structure
|
||||
* @ips_deffer_ms: the ms will prevent from falling into IPS after wakeup
|
||||
* Return _SUCCESS or _FAIL
|
||||
*/
|
||||
|
||||
int _rtw_pwr_wakeup23a(struct rtw_adapter *padapter, u32 ips_deffer_ms, const char *caller)
|
||||
{
|
||||
struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv;
|
||||
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
||||
int ret = _SUCCESS;
|
||||
unsigned long start = jiffies;
|
||||
unsigned long new_deny_time;
|
||||
|
||||
new_deny_time = jiffies + msecs_to_jiffies(ips_deffer_ms);
|
||||
|
||||
if (time_before(pwrpriv->ips_deny_time, new_deny_time))
|
||||
pwrpriv->ips_deny_time = new_deny_time;
|
||||
|
||||
if (pwrpriv->ps_processing) {
|
||||
DBG_8723A("%s wait ps_processing...\n", __func__);
|
||||
while (pwrpriv->ps_processing &&
|
||||
jiffies_to_msecs(jiffies - start) <= 3000)
|
||||
msleep(10);
|
||||
if (pwrpriv->ps_processing)
|
||||
DBG_8723A("%s wait ps_processing timeout\n", __func__);
|
||||
else
|
||||
DBG_8723A("%s wait ps_processing done\n", __func__);
|
||||
}
|
||||
|
||||
if (rtw_sreset_inprogress(padapter)) {
|
||||
DBG_8723A("%s wait sreset_inprogress...\n", __func__);
|
||||
while (rtw_sreset_inprogress(padapter) &&
|
||||
jiffies_to_msecs(jiffies - start) <= 4000)
|
||||
msleep(10);
|
||||
if (rtw_sreset_inprogress(padapter))
|
||||
DBG_8723A("%s wait sreset_inprogress timeout\n",
|
||||
__func__);
|
||||
else
|
||||
DBG_8723A("%s wait sreset_inprogress done\n", __func__);
|
||||
}
|
||||
|
||||
if (pwrpriv->bInSuspend) {
|
||||
DBG_8723A("%s wait bInSuspend...\n", __func__);
|
||||
while (pwrpriv->bInSuspend &&
|
||||
(jiffies_to_msecs(jiffies - start) <= 3000)) {
|
||||
msleep(10);
|
||||
}
|
||||
if (pwrpriv->bInSuspend)
|
||||
DBG_8723A("%s wait bInSuspend timeout\n", __func__);
|
||||
else
|
||||
DBG_8723A("%s wait bInSuspend done\n", __func__);
|
||||
}
|
||||
|
||||
/* System suspend is not allowed to wakeup */
|
||||
if (pwrpriv->bInSuspend) {
|
||||
ret = _FAIL;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
/* I think this should be check in IPS, LPS, autosuspend functions... */
|
||||
if (check_fwstate(pmlmepriv, _FW_LINKED)) {
|
||||
ret = _SUCCESS;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (rf_off == pwrpriv->rf_pwrstate) {
|
||||
DBG_8723A("%s call ips_leave23a....\n", __func__);
|
||||
if (ips_leave23a(padapter)== _FAIL) {
|
||||
DBG_8723A("======> ips_leave23a fail.............\n");
|
||||
ret = _FAIL;
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
|
||||
/* TODO: the following checking need to be merged... */
|
||||
if (padapter->bDriverStopped || !padapter->bup ||
|
||||
!padapter->hw_init_completed) {
|
||||
DBG_8723A("%s: bDriverStopped =%d, bup =%d, hw_init_completed "
|
||||
"=%u\n", caller, padapter->bDriverStopped,
|
||||
padapter->bup, padapter->hw_init_completed);
|
||||
ret = _FAIL;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
exit:
|
||||
new_deny_time = jiffies + msecs_to_jiffies(ips_deffer_ms);
|
||||
if (time_before(pwrpriv->ips_deny_time, new_deny_time))
|
||||
pwrpriv->ips_deny_time = new_deny_time;
|
||||
return ret;
|
||||
}
|
||||
|
||||
int rtw_pm_set_lps23a(struct rtw_adapter *padapter, u8 mode)
|
||||
{
|
||||
int ret = 0;
|
||||
struct pwrctrl_priv *pwrctrlpriv = &padapter->pwrctrlpriv;
|
||||
|
||||
if (mode < PS_MODE_NUM) {
|
||||
if (pwrctrlpriv->power_mgnt != mode) {
|
||||
if (PS_MODE_ACTIVE == mode)
|
||||
LeaveAllPowerSaveMode23a(padapter);
|
||||
else
|
||||
pwrctrlpriv->LpsIdleCount = 2;
|
||||
pwrctrlpriv->power_mgnt = mode;
|
||||
pwrctrlpriv->bLeisurePs =
|
||||
(PS_MODE_ACTIVE != pwrctrlpriv->power_mgnt) ?
|
||||
true:false;
|
||||
}
|
||||
} else
|
||||
ret = -EINVAL;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int rtw_pm_set_ips23a(struct rtw_adapter *padapter, u8 mode)
|
||||
{
|
||||
struct pwrctrl_priv *pwrctrlpriv = &padapter->pwrctrlpriv;
|
||||
|
||||
if (mode != IPS_NORMAL && mode != IPS_LEVEL_2 && mode != IPS_NONE)
|
||||
return -EINVAL;
|
||||
|
||||
pwrctrlpriv->ips_mode_req = mode;
|
||||
if (mode == IPS_NONE) {
|
||||
DBG_8723A("%s %s\n", __func__, "IPS_NONE");
|
||||
if (padapter->bSurpriseRemoved == 0 &&
|
||||
rtw_pwr_wakeup(padapter) == _FAIL)
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,214 +0,0 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#include <rtw_sreset.h>
|
||||
#include <usb_ops_linux.h>
|
||||
|
||||
void rtw_sreset_init(struct rtw_adapter *padapter)
|
||||
{
|
||||
struct hal_data_8723a *pHalData = GET_HAL_DATA(padapter);
|
||||
struct sreset_priv *psrtpriv = &pHalData->srestpriv;
|
||||
|
||||
mutex_init(&psrtpriv->silentreset_mutex);
|
||||
psrtpriv->silent_reset_inprogress = false;
|
||||
psrtpriv->last_tx_time = 0;
|
||||
psrtpriv->last_tx_complete_time = 0;
|
||||
}
|
||||
|
||||
void rtw_sreset_reset_value(struct rtw_adapter *padapter)
|
||||
{
|
||||
struct hal_data_8723a *pHalData = GET_HAL_DATA(padapter);
|
||||
struct sreset_priv *psrtpriv = &pHalData->srestpriv;
|
||||
|
||||
psrtpriv->silent_reset_inprogress = false;
|
||||
psrtpriv->last_tx_time = 0;
|
||||
psrtpriv->last_tx_complete_time = 0;
|
||||
}
|
||||
|
||||
bool rtw_sreset_inprogress(struct rtw_adapter *padapter)
|
||||
{
|
||||
struct rtw_adapter *primary_adapter = GET_PRIMARY_ADAPTER(padapter);
|
||||
struct hal_data_8723a *pHalData = GET_HAL_DATA(primary_adapter);
|
||||
|
||||
return pHalData->srestpriv.silent_reset_inprogress;
|
||||
}
|
||||
|
||||
static void sreset_restore_security_station(struct rtw_adapter *padapter)
|
||||
{
|
||||
struct mlme_priv *mlmepriv = &padapter->mlmepriv;
|
||||
struct sta_priv *pstapriv = &padapter->stapriv;
|
||||
struct sta_info *psta;
|
||||
struct mlme_ext_info *pmlmeinfo = &padapter->mlmeextpriv.mlmext_info;
|
||||
u8 val8;
|
||||
|
||||
if (pmlmeinfo->auth_algo == dot11AuthAlgrthm_8021X)
|
||||
val8 = 0xcc;
|
||||
else
|
||||
val8 = 0xcf;
|
||||
|
||||
rtl8723a_set_sec_cfg(padapter, val8);
|
||||
|
||||
if (padapter->securitypriv.dot11PrivacyAlgrthm ==
|
||||
WLAN_CIPHER_SUITE_TKIP ||
|
||||
padapter->securitypriv.dot11PrivacyAlgrthm ==
|
||||
WLAN_CIPHER_SUITE_CCMP) {
|
||||
psta = rtw_get_stainfo23a(pstapriv, get_bssid(mlmepriv));
|
||||
if (psta == NULL) {
|
||||
/* DEBUG_ERR(("Set wpa_set_encryption: Obtain Sta_info fail\n")); */
|
||||
} else {
|
||||
/* pairwise key */
|
||||
rtw_setstakey_cmd23a(padapter, (unsigned char *)psta, true);
|
||||
/* group key */
|
||||
rtw_set_key23a(padapter,&padapter->securitypriv, padapter->securitypriv.dot118021XGrpKeyid, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void sreset_restore_network_station(struct rtw_adapter *padapter)
|
||||
{
|
||||
struct mlme_priv *mlmepriv = &padapter->mlmepriv;
|
||||
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
|
||||
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
|
||||
u8 threshold;
|
||||
|
||||
rtw_setopmode_cmd23a(padapter, NL80211_IFTYPE_STATION);
|
||||
|
||||
/* TH = 1 => means that invalidate usb rx aggregation */
|
||||
/* TH = 0 => means that validate usb rx aggregation, use init value. */
|
||||
if (mlmepriv->htpriv.ht_option) {
|
||||
if (padapter->registrypriv.wifi_spec == 1)
|
||||
threshold = 1;
|
||||
else
|
||||
threshold = 0;
|
||||
} else
|
||||
threshold = 1;
|
||||
|
||||
rtl8723a_set_rxdma_agg_pg_th(padapter, threshold);
|
||||
|
||||
set_channel_bwmode23a(padapter, pmlmeext->cur_channel,
|
||||
pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode);
|
||||
|
||||
hw_var_set_bssid(padapter, pmlmeinfo->network.MacAddress);
|
||||
hw_var_set_mlme_join(padapter, 0);
|
||||
|
||||
rtl8723a_set_media_status(padapter, pmlmeinfo->state & 0x3);
|
||||
|
||||
mlmeext_joinbss_event_callback23a(padapter, 1);
|
||||
/* restore Sequence No. */
|
||||
rtl8723au_write8(padapter, REG_NQOS_SEQ, padapter->xmitpriv.nqos_ssn);
|
||||
|
||||
sreset_restore_security_station(padapter);
|
||||
}
|
||||
|
||||
static void sreset_restore_network_status(struct rtw_adapter *padapter)
|
||||
{
|
||||
struct mlme_priv *mlmepriv = &padapter->mlmepriv;
|
||||
|
||||
if (check_fwstate(mlmepriv, WIFI_STATION_STATE)) {
|
||||
DBG_8723A("%s(%s): fwstate:0x%08x - WIFI_STATION_STATE\n",
|
||||
__func__, padapter->pnetdev->name,
|
||||
get_fwstate(mlmepriv));
|
||||
sreset_restore_network_station(padapter);
|
||||
#ifdef CONFIG_8723AU_AP_MODE
|
||||
} else if (check_fwstate(mlmepriv, WIFI_AP_STATE)) {
|
||||
DBG_8723A("%s(%s): fwstate:0x%08x - WIFI_AP_STATE\n",
|
||||
__func__, padapter->pnetdev->name,
|
||||
get_fwstate(mlmepriv));
|
||||
rtw_ap_restore_network(padapter);
|
||||
#endif
|
||||
} else if (check_fwstate(mlmepriv, WIFI_ADHOC_STATE)) {
|
||||
DBG_8723A("%s(%s): fwstate:0x%08x - WIFI_ADHOC_STATE\n",
|
||||
__func__, padapter->pnetdev->name,
|
||||
get_fwstate(mlmepriv));
|
||||
} else {
|
||||
DBG_8723A("%s(%s): fwstate:0x%08x - ???\n", __func__,
|
||||
padapter->pnetdev->name, get_fwstate(mlmepriv));
|
||||
}
|
||||
}
|
||||
|
||||
static void sreset_stop_adapter(struct rtw_adapter *padapter)
|
||||
{
|
||||
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
||||
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
|
||||
|
||||
if (padapter == NULL)
|
||||
return;
|
||||
|
||||
DBG_8723A("%s(%s)\n", __func__, padapter->pnetdev->name);
|
||||
|
||||
if (!rtw_netif_queue_stopped(padapter->pnetdev))
|
||||
netif_tx_stop_all_queues(padapter->pnetdev);
|
||||
|
||||
rtw_cancel_all_timer23a(padapter);
|
||||
|
||||
/* TODO: OS and HCI independent */
|
||||
tasklet_kill(&pxmitpriv->xmit_tasklet);
|
||||
|
||||
if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY))
|
||||
rtw_scan_abort23a(padapter);
|
||||
|
||||
if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING))
|
||||
rtw23a_join_to_handler((unsigned long)padapter);
|
||||
}
|
||||
|
||||
static void sreset_start_adapter(struct rtw_adapter *padapter)
|
||||
{
|
||||
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
||||
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
|
||||
|
||||
if (padapter == NULL)
|
||||
return;
|
||||
|
||||
DBG_8723A("%s(%s)\n", __func__, padapter->pnetdev->name);
|
||||
|
||||
if (check_fwstate(pmlmepriv, _FW_LINKED))
|
||||
sreset_restore_network_status(padapter);
|
||||
|
||||
/* TODO: OS and HCI independent */
|
||||
tasklet_hi_schedule(&pxmitpriv->xmit_tasklet);
|
||||
|
||||
mod_timer(&padapter->mlmepriv.dynamic_chk_timer,
|
||||
jiffies + msecs_to_jiffies(2000));
|
||||
|
||||
if (rtw_netif_queue_stopped(padapter->pnetdev))
|
||||
netif_tx_wake_all_queues(padapter->pnetdev);
|
||||
}
|
||||
|
||||
void rtw_sreset_reset(struct rtw_adapter *active_adapter)
|
||||
{
|
||||
struct rtw_adapter *padapter = GET_PRIMARY_ADAPTER(active_adapter);
|
||||
struct hal_data_8723a *pHalData = GET_HAL_DATA(padapter);
|
||||
struct sreset_priv *psrtpriv = &pHalData->srestpriv;
|
||||
struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv;
|
||||
unsigned long start = jiffies;
|
||||
|
||||
DBG_8723A("%s\n", __func__);
|
||||
|
||||
mutex_lock(&psrtpriv->silentreset_mutex);
|
||||
psrtpriv->silent_reset_inprogress = true;
|
||||
pwrpriv->change_rfpwrstate = rf_off;
|
||||
|
||||
sreset_stop_adapter(padapter);
|
||||
|
||||
ips_enter23a(padapter);
|
||||
ips_leave23a(padapter);
|
||||
|
||||
sreset_start_adapter(padapter);
|
||||
psrtpriv->silent_reset_inprogress = false;
|
||||
mutex_unlock(&psrtpriv->silentreset_mutex);
|
||||
|
||||
DBG_8723A("%s done in %d ms\n", __func__,
|
||||
jiffies_to_msecs(jiffies - start));
|
||||
}
|
|
@ -1,439 +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.
|
||||
*
|
||||
******************************************************************************/
|
||||
#define _RTW_STA_MGT_C_
|
||||
|
||||
#include <osdep_service.h>
|
||||
#include <drv_types.h>
|
||||
#include <recv_osdep.h>
|
||||
#include <xmit_osdep.h>
|
||||
#include <mlme_osdep.h>
|
||||
#include <sta_info.h>
|
||||
#include <rtl8723a_hal.h>
|
||||
|
||||
static const u8 bc_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
|
||||
|
||||
static void _rtw_init_stainfo(struct sta_info *psta)
|
||||
{
|
||||
memset((u8 *)psta, 0, sizeof(struct sta_info));
|
||||
spin_lock_init(&psta->lock);
|
||||
INIT_LIST_HEAD(&psta->list);
|
||||
INIT_LIST_HEAD(&psta->hash_list);
|
||||
_rtw_init_queue23a(&psta->sleep_q);
|
||||
psta->sleepq_len = 0;
|
||||
_rtw_init_sta_xmit_priv23a(&psta->sta_xmitpriv);
|
||||
_rtw_init_sta_recv_priv23a(&psta->sta_recvpriv);
|
||||
#ifdef CONFIG_8723AU_AP_MODE
|
||||
INIT_LIST_HEAD(&psta->asoc_list);
|
||||
INIT_LIST_HEAD(&psta->auth_list);
|
||||
psta->expire_to = 0;
|
||||
psta->flags = 0;
|
||||
psta->capability = 0;
|
||||
psta->bpairwise_key_installed = false;
|
||||
psta->nonerp_set = 0;
|
||||
psta->no_short_slot_time_set = 0;
|
||||
psta->no_short_preamble_set = 0;
|
||||
psta->no_ht_gf_set = 0;
|
||||
psta->no_ht_set = 0;
|
||||
psta->ht_20mhz_set = 0;
|
||||
psta->keep_alive_trycnt = 0;
|
||||
#endif /* CONFIG_8723AU_AP_MODE */
|
||||
}
|
||||
|
||||
int _rtw_init_sta_priv23a(struct sta_priv *pstapriv)
|
||||
{
|
||||
int i;
|
||||
|
||||
spin_lock_init(&pstapriv->sta_hash_lock);
|
||||
pstapriv->asoc_sta_count = 0;
|
||||
for (i = 0; i < NUM_STA; i++)
|
||||
INIT_LIST_HEAD(&pstapriv->sta_hash[i]);
|
||||
|
||||
#ifdef CONFIG_8723AU_AP_MODE
|
||||
pstapriv->sta_dz_bitmap = 0;
|
||||
pstapriv->tim_bitmap = 0;
|
||||
INIT_LIST_HEAD(&pstapriv->asoc_list);
|
||||
INIT_LIST_HEAD(&pstapriv->auth_list);
|
||||
spin_lock_init(&pstapriv->asoc_list_lock);
|
||||
spin_lock_init(&pstapriv->auth_list_lock);
|
||||
pstapriv->asoc_list_cnt = 0;
|
||||
pstapriv->auth_list_cnt = 0;
|
||||
pstapriv->auth_to = 3; /* 3*2 = 6 sec */
|
||||
pstapriv->assoc_to = 3;
|
||||
/* pstapriv->expire_to = 900; 900*2 = 1800 sec = 30 min,
|
||||
expire after no any traffic. */
|
||||
/* pstapriv->expire_to = 30; 30*2 = 60 sec = 1 min,
|
||||
expire after no any traffic. */
|
||||
pstapriv->expire_to = 3; /* 3*2 = 6 sec */
|
||||
pstapriv->max_num_sta = NUM_STA;
|
||||
#endif
|
||||
return _SUCCESS;
|
||||
}
|
||||
|
||||
int _rtw_free_sta_priv23a(struct sta_priv *pstapriv)
|
||||
{
|
||||
struct list_head *phead;
|
||||
struct sta_info *psta, *ptmp;
|
||||
struct recv_reorder_ctrl *preorder_ctrl;
|
||||
int index;
|
||||
|
||||
if (pstapriv) {
|
||||
/* delete all reordering_ctrl_timer */
|
||||
spin_lock_bh(&pstapriv->sta_hash_lock);
|
||||
for (index = 0; index < NUM_STA; index++) {
|
||||
phead = &pstapriv->sta_hash[index];
|
||||
list_for_each_entry_safe(psta, ptmp, phead, hash_list) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 16 ; i++) {
|
||||
preorder_ctrl = &psta->recvreorder_ctrl[i];
|
||||
del_timer_sync(&preorder_ctrl->reordering_ctrl_timer);
|
||||
}
|
||||
}
|
||||
}
|
||||
spin_unlock_bh(&pstapriv->sta_hash_lock);
|
||||
/*===============================*/
|
||||
}
|
||||
return _SUCCESS;
|
||||
}
|
||||
|
||||
struct sta_info *
|
||||
rtw_alloc_stainfo23a(struct sta_priv *pstapriv, const u8 *hwaddr, gfp_t gfp)
|
||||
{
|
||||
struct list_head *phash_list;
|
||||
struct sta_info *psta;
|
||||
struct recv_reorder_ctrl *preorder_ctrl;
|
||||
s32 index;
|
||||
int i = 0;
|
||||
u16 wRxSeqInitialValue = 0xffff;
|
||||
|
||||
psta = kmalloc(sizeof(struct sta_info), gfp);
|
||||
if (!psta)
|
||||
return NULL;
|
||||
|
||||
spin_lock_bh(&pstapriv->sta_hash_lock);
|
||||
|
||||
_rtw_init_stainfo(psta);
|
||||
|
||||
psta->padapter = pstapriv->padapter;
|
||||
|
||||
ether_addr_copy(psta->hwaddr, hwaddr);
|
||||
|
||||
index = wifi_mac_hash(hwaddr);
|
||||
|
||||
RT_TRACE(_module_rtl871x_sta_mgt_c_, _drv_info_,
|
||||
"rtw_alloc_stainfo23a: index = %x\n", index);
|
||||
if (index >= NUM_STA) {
|
||||
RT_TRACE(_module_rtl871x_sta_mgt_c_, _drv_err_,
|
||||
"ERROR => rtw_alloc_stainfo23a: index >= NUM_STA\n");
|
||||
psta = NULL;
|
||||
goto exit;
|
||||
}
|
||||
phash_list = &pstapriv->sta_hash[index];
|
||||
|
||||
list_add_tail(&psta->hash_list, phash_list);
|
||||
|
||||
pstapriv->asoc_sta_count++;
|
||||
|
||||
/* For the SMC router, the sequence number of first packet of WPS
|
||||
handshake will be 0. */
|
||||
/* In this case, this packet will be dropped by recv_decache function
|
||||
if we use the 0x00 as the default value for tid_rxseq variable. */
|
||||
/* So, we initialize the tid_rxseq variable as the 0xffff. */
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
memcpy(&psta->sta_recvpriv.rxcache.tid_rxseq[i],
|
||||
&wRxSeqInitialValue, 2);
|
||||
|
||||
RT_TRACE(_module_rtl871x_sta_mgt_c_, _drv_info_,
|
||||
"alloc number_%d stainfo with hwaddr = %pM\n",
|
||||
pstapriv->asoc_sta_count, hwaddr);
|
||||
|
||||
init_addba_retry_timer23a(psta);
|
||||
|
||||
/* for A-MPDU Rx reordering buffer control */
|
||||
for (i = 0; i < 16; i++) {
|
||||
preorder_ctrl = &psta->recvreorder_ctrl[i];
|
||||
|
||||
preorder_ctrl->padapter = pstapriv->padapter;
|
||||
|
||||
preorder_ctrl->enable = false;
|
||||
|
||||
preorder_ctrl->indicate_seq = 0xffff;
|
||||
preorder_ctrl->wend_b = 0xffff;
|
||||
/* preorder_ctrl->wsize_b = (NR_RECVBUFF-2); */
|
||||
preorder_ctrl->wsize_b = 64;/* 64; */
|
||||
|
||||
_rtw_init_queue23a(&preorder_ctrl->pending_recvframe_queue);
|
||||
|
||||
rtw_init_recv_timer23a(preorder_ctrl);
|
||||
}
|
||||
/* init for DM */
|
||||
psta->rssi_stat.UndecoratedSmoothedPWDB = (-1);
|
||||
psta->rssi_stat.UndecoratedSmoothedCCK = (-1);
|
||||
|
||||
/* init for the sequence number of received management frame */
|
||||
psta->RxMgmtFrameSeqNum = 0xffff;
|
||||
exit:
|
||||
spin_unlock_bh(&pstapriv->sta_hash_lock);
|
||||
return psta;
|
||||
}
|
||||
|
||||
/* using pstapriv->sta_hash_lock to protect */
|
||||
int rtw_free_stainfo23a(struct rtw_adapter *padapter, struct sta_info *psta)
|
||||
{
|
||||
struct recv_reorder_ctrl *preorder_ctrl;
|
||||
struct sta_xmit_priv *pstaxmitpriv;
|
||||
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
|
||||
struct sta_priv *pstapriv = &padapter->stapriv;
|
||||
struct hw_xmit *phwxmit;
|
||||
int i;
|
||||
|
||||
if (!psta)
|
||||
goto exit;
|
||||
|
||||
spin_lock_bh(&psta->lock);
|
||||
psta->state &= ~_FW_LINKED;
|
||||
spin_unlock_bh(&psta->lock);
|
||||
|
||||
pstaxmitpriv = &psta->sta_xmitpriv;
|
||||
|
||||
spin_lock_bh(&pxmitpriv->lock);
|
||||
|
||||
rtw_free_xmitframe_queue23a(pxmitpriv, &psta->sleep_q);
|
||||
psta->sleepq_len = 0;
|
||||
|
||||
/* vo */
|
||||
rtw_free_xmitframe_queue23a(pxmitpriv, &pstaxmitpriv->vo_q.sta_pending);
|
||||
list_del_init(&pstaxmitpriv->vo_q.tx_pending);
|
||||
phwxmit = pxmitpriv->hwxmits;
|
||||
phwxmit->accnt -= pstaxmitpriv->vo_q.qcnt;
|
||||
pstaxmitpriv->vo_q.qcnt = 0;
|
||||
|
||||
/* vi */
|
||||
rtw_free_xmitframe_queue23a(pxmitpriv, &pstaxmitpriv->vi_q.sta_pending);
|
||||
list_del_init(&pstaxmitpriv->vi_q.tx_pending);
|
||||
phwxmit = pxmitpriv->hwxmits+1;
|
||||
phwxmit->accnt -= pstaxmitpriv->vi_q.qcnt;
|
||||
pstaxmitpriv->vi_q.qcnt = 0;
|
||||
|
||||
/* be */
|
||||
rtw_free_xmitframe_queue23a(pxmitpriv, &pstaxmitpriv->be_q.sta_pending);
|
||||
list_del_init(&pstaxmitpriv->be_q.tx_pending);
|
||||
phwxmit = pxmitpriv->hwxmits+2;
|
||||
phwxmit->accnt -= pstaxmitpriv->be_q.qcnt;
|
||||
pstaxmitpriv->be_q.qcnt = 0;
|
||||
|
||||
/* bk */
|
||||
rtw_free_xmitframe_queue23a(pxmitpriv, &pstaxmitpriv->bk_q.sta_pending);
|
||||
list_del_init(&pstaxmitpriv->bk_q.tx_pending);
|
||||
phwxmit = pxmitpriv->hwxmits+3;
|
||||
phwxmit->accnt -= pstaxmitpriv->bk_q.qcnt;
|
||||
pstaxmitpriv->bk_q.qcnt = 0;
|
||||
|
||||
spin_unlock_bh(&pxmitpriv->lock);
|
||||
|
||||
list_del_init(&psta->hash_list);
|
||||
RT_TRACE(_module_rtl871x_sta_mgt_c_, _drv_err_,
|
||||
"free number_%d stainfo with hwaddr = %pM\n",
|
||||
pstapriv->asoc_sta_count, psta->hwaddr);
|
||||
pstapriv->asoc_sta_count--;
|
||||
|
||||
/* re-init sta_info; 20061114 will be init in alloc_stainfo */
|
||||
/* _rtw_init_sta_xmit_priv23a(&psta->sta_xmitpriv); */
|
||||
/* _rtw_init_sta_recv_priv23a(&psta->sta_recvpriv); */
|
||||
|
||||
del_timer_sync(&psta->addba_retry_timer);
|
||||
|
||||
/* for A-MPDU Rx reordering buffer control,
|
||||
cancel reordering_ctrl_timer */
|
||||
for (i = 0; i < 16; i++) {
|
||||
struct list_head *phead, *plist;
|
||||
struct recv_frame *prframe;
|
||||
struct rtw_queue *ppending_recvframe_queue;
|
||||
|
||||
preorder_ctrl = &psta->recvreorder_ctrl[i];
|
||||
|
||||
del_timer_sync(&preorder_ctrl->reordering_ctrl_timer);
|
||||
|
||||
ppending_recvframe_queue =
|
||||
&preorder_ctrl->pending_recvframe_queue;
|
||||
|
||||
spin_lock_bh(&ppending_recvframe_queue->lock);
|
||||
phead = get_list_head(ppending_recvframe_queue);
|
||||
plist = phead->next;
|
||||
|
||||
while (!list_empty(phead)) {
|
||||
prframe = container_of(plist, struct recv_frame, list);
|
||||
plist = plist->next;
|
||||
list_del_init(&prframe->list);
|
||||
rtw_free_recvframe23a(prframe);
|
||||
}
|
||||
spin_unlock_bh(&ppending_recvframe_queue->lock);
|
||||
}
|
||||
if (!(psta->state & WIFI_AP_STATE))
|
||||
rtl8723a_SetHalODMVar(padapter, HAL_ODM_STA_INFO, psta, false);
|
||||
#ifdef CONFIG_8723AU_AP_MODE
|
||||
spin_lock_bh(&pstapriv->auth_list_lock);
|
||||
if (!list_empty(&psta->auth_list)) {
|
||||
list_del_init(&psta->auth_list);
|
||||
pstapriv->auth_list_cnt--;
|
||||
}
|
||||
spin_unlock_bh(&pstapriv->auth_list_lock);
|
||||
|
||||
psta->expire_to = 0;
|
||||
|
||||
psta->sleepq_ac_len = 0;
|
||||
psta->qos_info = 0;
|
||||
|
||||
psta->max_sp_len = 0;
|
||||
psta->uapsd_bk = 0;
|
||||
psta->uapsd_be = 0;
|
||||
psta->uapsd_vi = 0;
|
||||
psta->uapsd_vo = 0;
|
||||
|
||||
psta->has_legacy_ac = 0;
|
||||
|
||||
pstapriv->sta_dz_bitmap &= ~CHKBIT(psta->aid);
|
||||
pstapriv->tim_bitmap &= ~CHKBIT(psta->aid);
|
||||
|
||||
if ((psta->aid > 0) && (pstapriv->sta_aid[psta->aid - 1] == psta)) {
|
||||
pstapriv->sta_aid[psta->aid - 1] = NULL;
|
||||
psta->aid = 0;
|
||||
}
|
||||
#endif /* CONFIG_8723AU_AP_MODE */
|
||||
|
||||
kfree(psta);
|
||||
exit:
|
||||
return _SUCCESS;
|
||||
}
|
||||
|
||||
/* free all stainfo which in sta_hash[all] */
|
||||
void rtw_free_all_stainfo23a(struct rtw_adapter *padapter)
|
||||
{
|
||||
struct list_head *phead;
|
||||
struct sta_info *psta, *ptmp;
|
||||
struct sta_priv *pstapriv = &padapter->stapriv;
|
||||
struct sta_info *pbcmc_stainfo = rtw_get_bcmc_stainfo23a(padapter);
|
||||
s32 index;
|
||||
|
||||
if (pstapriv->asoc_sta_count == 1)
|
||||
return;
|
||||
|
||||
spin_lock_bh(&pstapriv->sta_hash_lock);
|
||||
for (index = 0; index < NUM_STA; index++) {
|
||||
phead = &pstapriv->sta_hash[index];
|
||||
list_for_each_entry_safe(psta, ptmp, phead, hash_list) {
|
||||
if (pbcmc_stainfo != psta)
|
||||
rtw_free_stainfo23a(padapter, psta);
|
||||
}
|
||||
}
|
||||
spin_unlock_bh(&pstapriv->sta_hash_lock);
|
||||
}
|
||||
|
||||
/* any station allocated can be searched by hash list */
|
||||
struct sta_info *rtw_get_stainfo23a(struct sta_priv *pstapriv, const u8 *hwaddr)
|
||||
{
|
||||
struct list_head *phead;
|
||||
struct sta_info *pos, *psta = NULL;
|
||||
u32 index;
|
||||
const u8 *addr;
|
||||
|
||||
if (!hwaddr)
|
||||
return NULL;
|
||||
|
||||
if (is_multicast_ether_addr(hwaddr))
|
||||
addr = bc_addr;
|
||||
else
|
||||
addr = hwaddr;
|
||||
|
||||
index = wifi_mac_hash(addr);
|
||||
|
||||
spin_lock_bh(&pstapriv->sta_hash_lock);
|
||||
phead = &pstapriv->sta_hash[index];
|
||||
list_for_each_entry(pos, phead, hash_list) {
|
||||
psta = pos;
|
||||
|
||||
/* if found the matched address */
|
||||
if (ether_addr_equal(psta->hwaddr, addr))
|
||||
break;
|
||||
|
||||
psta = NULL;
|
||||
}
|
||||
spin_unlock_bh(&pstapriv->sta_hash_lock);
|
||||
return psta;
|
||||
}
|
||||
|
||||
int rtw_init_bcmc_stainfo23a(struct rtw_adapter *padapter)
|
||||
{
|
||||
struct sta_priv *pstapriv = &padapter->stapriv;
|
||||
struct sta_info *psta;
|
||||
struct tx_servq *ptxservq;
|
||||
int res = _SUCCESS;
|
||||
|
||||
psta = rtw_alloc_stainfo23a(pstapriv, bc_addr, GFP_KERNEL);
|
||||
if (!psta) {
|
||||
res = _FAIL;
|
||||
RT_TRACE(_module_rtl871x_sta_mgt_c_, _drv_err_,
|
||||
"rtw_alloc_stainfo23a fail\n");
|
||||
return res;
|
||||
}
|
||||
/* default broadcast & multicast use macid 1 */
|
||||
psta->mac_id = 1;
|
||||
|
||||
ptxservq = &psta->sta_xmitpriv.be_q;
|
||||
return _SUCCESS;
|
||||
}
|
||||
|
||||
struct sta_info *rtw_get_bcmc_stainfo23a(struct rtw_adapter *padapter)
|
||||
{
|
||||
struct sta_info *psta;
|
||||
struct sta_priv *pstapriv = &padapter->stapriv;
|
||||
|
||||
psta = rtw_get_stainfo23a(pstapriv, bc_addr);
|
||||
return psta;
|
||||
}
|
||||
|
||||
bool rtw_access_ctrl23a(struct rtw_adapter *padapter, u8 *mac_addr)
|
||||
{
|
||||
bool res = true;
|
||||
#ifdef CONFIG_8723AU_AP_MODE
|
||||
struct list_head *phead;
|
||||
struct rtw_wlan_acl_node *paclnode;
|
||||
bool match = false;
|
||||
struct sta_priv *pstapriv = &padapter->stapriv;
|
||||
struct wlan_acl_pool *pacl_list = &pstapriv->acl_list;
|
||||
struct rtw_queue *pacl_node_q = &pacl_list->acl_node_q;
|
||||
|
||||
spin_lock_bh(&pacl_node_q->lock);
|
||||
phead = get_list_head(pacl_node_q);
|
||||
list_for_each_entry(paclnode, phead, list) {
|
||||
if (ether_addr_equal(paclnode->addr, mac_addr)) {
|
||||
if (paclnode->valid) {
|
||||
match = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
spin_unlock_bh(&pacl_node_q->lock);
|
||||
|
||||
if (pacl_list->mode == 1)/* accept unless in deny list */
|
||||
res = (match) ? false : true;
|
||||
else if (pacl_list->mode == 2)/* deny unless in accept list */
|
||||
res = (match) ? true : false;
|
||||
else
|
||||
res = true;
|
||||
#endif
|
||||
return res;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,80 +0,0 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#include "Hal8723PwrSeq.h"
|
||||
|
||||
/*
|
||||
drivers should parse below arrays and do the corresponding actions
|
||||
*/
|
||||
/* 3 Power on Array */
|
||||
struct wlan_pwr_cfg rtl8723AU_power_on_flow[RTL8723A_TRANS_CARDEMU_TO_ACT_STEPS+RTL8723A_TRANS_END_STEPS] = {
|
||||
RTL8723A_TRANS_CARDEMU_TO_ACT
|
||||
RTL8723A_TRANS_END
|
||||
};
|
||||
|
||||
/* 3 Radio off GPIO Array */
|
||||
struct wlan_pwr_cfg rtl8723AU_radio_off_flow[RTL8723A_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723A_TRANS_END_STEPS] = {
|
||||
RTL8723A_TRANS_ACT_TO_CARDEMU
|
||||
RTL8723A_TRANS_END
|
||||
};
|
||||
|
||||
/* 3 Card Disable Array */
|
||||
struct wlan_pwr_cfg rtl8723AU_card_disable_flow[RTL8723A_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723A_TRANS_CARDEMU_TO_PDN_STEPS+RTL8723A_TRANS_END_STEPS] = {
|
||||
RTL8723A_TRANS_ACT_TO_CARDEMU
|
||||
RTL8723A_TRANS_CARDEMU_TO_CARDDIS
|
||||
RTL8723A_TRANS_END
|
||||
};
|
||||
|
||||
/* 3 Card Enable Array */
|
||||
struct wlan_pwr_cfg rtl8723AU_card_enable_flow[RTL8723A_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723A_TRANS_CARDEMU_TO_PDN_STEPS+RTL8723A_TRANS_END_STEPS] = {
|
||||
RTL8723A_TRANS_CARDDIS_TO_CARDEMU
|
||||
RTL8723A_TRANS_CARDEMU_TO_ACT
|
||||
RTL8723A_TRANS_END
|
||||
};
|
||||
|
||||
/* 3 Suspend Array */
|
||||
struct wlan_pwr_cfg rtl8723AU_suspend_flow[RTL8723A_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723A_TRANS_CARDEMU_TO_SUS_STEPS+RTL8723A_TRANS_END_STEPS] = {
|
||||
RTL8723A_TRANS_ACT_TO_CARDEMU
|
||||
RTL8723A_TRANS_CARDEMU_TO_SUS
|
||||
RTL8723A_TRANS_END
|
||||
};
|
||||
|
||||
/* 3 Resume Array */
|
||||
struct wlan_pwr_cfg rtl8723AU_resume_flow[RTL8723A_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723A_TRANS_CARDEMU_TO_SUS_STEPS+RTL8723A_TRANS_END_STEPS] = {
|
||||
RTL8723A_TRANS_SUS_TO_CARDEMU
|
||||
RTL8723A_TRANS_CARDEMU_TO_ACT
|
||||
RTL8723A_TRANS_END
|
||||
};
|
||||
|
||||
/* 3 HWPDN Array */
|
||||
struct wlan_pwr_cfg rtl8723AU_hwpdn_flow[RTL8723A_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723A_TRANS_CARDEMU_TO_PDN_STEPS+RTL8723A_TRANS_END_STEPS] = {
|
||||
RTL8723A_TRANS_ACT_TO_CARDEMU
|
||||
RTL8723A_TRANS_CARDEMU_TO_PDN
|
||||
RTL8723A_TRANS_END
|
||||
};
|
||||
|
||||
/* 3 Enter LPS */
|
||||
struct wlan_pwr_cfg rtl8723AU_enter_lps_flow[RTL8723A_TRANS_ACT_TO_LPS_STEPS+RTL8723A_TRANS_END_STEPS] = {
|
||||
/* FW behavior */
|
||||
RTL8723A_TRANS_ACT_TO_LPS
|
||||
RTL8723A_TRANS_END
|
||||
};
|
||||
|
||||
/* 3 Leave LPS */
|
||||
struct wlan_pwr_cfg rtl8723AU_leave_lps_flow[RTL8723A_TRANS_LPS_TO_ACT_STEPS+RTL8723A_TRANS_END_STEPS] = {
|
||||
/* FW behavior */
|
||||
RTL8723A_TRANS_LPS_TO_ACT
|
||||
RTL8723A_TRANS_END
|
||||
};
|
|
@ -1,136 +0,0 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/*Created on 2013/01/14, 15:51*/
|
||||
#include "odm_precomp.h"
|
||||
|
||||
u32 Rtl8723UPHY_REG_Array_PG[Rtl8723UPHY_REG_Array_PGLength] = {
|
||||
0xe00, 0xffffffff, 0x0a0c0c0c,
|
||||
0xe04, 0xffffffff, 0x02040608,
|
||||
0xe08, 0x0000ff00, 0x00000000,
|
||||
0x86c, 0xffffff00, 0x00000000,
|
||||
0xe10, 0xffffffff, 0x0a0c0d0e,
|
||||
0xe14, 0xffffffff, 0x02040608,
|
||||
0xe18, 0xffffffff, 0x0a0c0d0e,
|
||||
0xe1c, 0xffffffff, 0x02040608,
|
||||
0x830, 0xffffffff, 0x0a0c0c0c,
|
||||
0x834, 0xffffffff, 0x02040608,
|
||||
0x838, 0xffffff00, 0x00000000,
|
||||
0x86c, 0x000000ff, 0x00000000,
|
||||
0x83c, 0xffffffff, 0x0a0c0d0e,
|
||||
0x848, 0xffffffff, 0x02040608,
|
||||
0x84c, 0xffffffff, 0x0a0c0d0e,
|
||||
0x868, 0xffffffff, 0x02040608,
|
||||
0xe00, 0xffffffff, 0x00000000,
|
||||
0xe04, 0xffffffff, 0x00000000,
|
||||
0xe08, 0x0000ff00, 0x00000000,
|
||||
0x86c, 0xffffff00, 0x00000000,
|
||||
0xe10, 0xffffffff, 0x00000000,
|
||||
0xe14, 0xffffffff, 0x00000000,
|
||||
0xe18, 0xffffffff, 0x00000000,
|
||||
0xe1c, 0xffffffff, 0x00000000,
|
||||
0x830, 0xffffffff, 0x00000000,
|
||||
0x834, 0xffffffff, 0x00000000,
|
||||
0x838, 0xffffff00, 0x00000000,
|
||||
0x86c, 0x000000ff, 0x00000000,
|
||||
0x83c, 0xffffffff, 0x00000000,
|
||||
0x848, 0xffffffff, 0x00000000,
|
||||
0x84c, 0xffffffff, 0x00000000,
|
||||
0x868, 0xffffffff, 0x00000000,
|
||||
0xe00, 0xffffffff, 0x04040404,
|
||||
0xe04, 0xffffffff, 0x00020204,
|
||||
0xe08, 0x0000ff00, 0x00000000,
|
||||
0x86c, 0xffffff00, 0x00000000,
|
||||
0xe10, 0xffffffff, 0x06060606,
|
||||
0xe14, 0xffffffff, 0x00020406,
|
||||
0xe18, 0xffffffff, 0x00000000,
|
||||
0xe1c, 0xffffffff, 0x00000000,
|
||||
0x830, 0xffffffff, 0x04040404,
|
||||
0x834, 0xffffffff, 0x00020204,
|
||||
0x838, 0xffffff00, 0x00000000,
|
||||
0x86c, 0x000000ff, 0x00000000,
|
||||
0x83c, 0xffffffff, 0x06060606,
|
||||
0x848, 0xffffffff, 0x00020406,
|
||||
0x84c, 0xffffffff, 0x00000000,
|
||||
0x868, 0xffffffff, 0x00000000,
|
||||
0xe00, 0xffffffff, 0x00000000,
|
||||
0xe04, 0xffffffff, 0x00000000,
|
||||
0xe08, 0x0000ff00, 0x00000000,
|
||||
0x86c, 0xffffff00, 0x00000000,
|
||||
0xe10, 0xffffffff, 0x00000000,
|
||||
0xe14, 0xffffffff, 0x00000000,
|
||||
0xe18, 0xffffffff, 0x00000000,
|
||||
0xe1c, 0xffffffff, 0x00000000,
|
||||
0x830, 0xffffffff, 0x00000000,
|
||||
0x834, 0xffffffff, 0x00000000,
|
||||
0x838, 0xffffff00, 0x00000000,
|
||||
0x86c, 0x000000ff, 0x00000000,
|
||||
0x83c, 0xffffffff, 0x00000000,
|
||||
0x848, 0xffffffff, 0x00000000,
|
||||
0x84c, 0xffffffff, 0x00000000,
|
||||
0x868, 0xffffffff, 0x00000000,
|
||||
0xe00, 0xffffffff, 0x00000000,
|
||||
0xe04, 0xffffffff, 0x00000000,
|
||||
0xe08, 0x0000ff00, 0x00000000,
|
||||
0x86c, 0xffffff00, 0x00000000,
|
||||
0xe10, 0xffffffff, 0x00000000,
|
||||
0xe14, 0xffffffff, 0x00000000,
|
||||
0xe18, 0xffffffff, 0x00000000,
|
||||
0xe1c, 0xffffffff, 0x00000000,
|
||||
0x830, 0xffffffff, 0x00000000,
|
||||
0x834, 0xffffffff, 0x00000000,
|
||||
0x838, 0xffffff00, 0x00000000,
|
||||
0x86c, 0x000000ff, 0x00000000,
|
||||
0x83c, 0xffffffff, 0x00000000,
|
||||
0x848, 0xffffffff, 0x00000000,
|
||||
0x84c, 0xffffffff, 0x00000000,
|
||||
0x868, 0xffffffff, 0x00000000,
|
||||
0xe00, 0xffffffff, 0x04040404,
|
||||
0xe04, 0xffffffff, 0x00020204,
|
||||
0xe08, 0x0000ff00, 0x00000000,
|
||||
0x86c, 0xffffff00, 0x00000000,
|
||||
0xe10, 0xffffffff, 0x00000000,
|
||||
0xe14, 0xffffffff, 0x00000000,
|
||||
0xe18, 0xffffffff, 0x00000000,
|
||||
0xe1c, 0xffffffff, 0x00000000,
|
||||
0x830, 0xffffffff, 0x04040404,
|
||||
0x834, 0xffffffff, 0x00020204,
|
||||
0x838, 0xffffff00, 0x00000000,
|
||||
0x86c, 0x000000ff, 0x00000000,
|
||||
0x83c, 0xffffffff, 0x00000000,
|
||||
0x848, 0xffffffff, 0x00000000,
|
||||
0x84c, 0xffffffff, 0x00000000,
|
||||
0x868, 0xffffffff, 0x00000000,
|
||||
0xe00, 0xffffffff, 0x00000000,
|
||||
0xe04, 0xffffffff, 0x00000000,
|
||||
0xe08, 0x0000ff00, 0x00000000,
|
||||
0x86c, 0xffffff00, 0x00000000,
|
||||
0xe10, 0xffffffff, 0x00000000,
|
||||
0xe14, 0xffffffff, 0x00000000,
|
||||
0xe18, 0xffffffff, 0x00000000,
|
||||
0xe1c, 0xffffffff, 0x00000000,
|
||||
0x830, 0xffffffff, 0x00000000,
|
||||
0x834, 0xffffffff, 0x00000000,
|
||||
0x838, 0xffffff00, 0x00000000,
|
||||
0x86c, 0x000000ff, 0x00000000,
|
||||
0x83c, 0xffffffff, 0x00000000,
|
||||
0x848, 0xffffffff, 0x00000000,
|
||||
0x84c, 0xffffffff, 0x00000000,
|
||||
0x868, 0xffffffff, 0x00000000,
|
||||
};
|
||||
|
||||
u32 Rtl8723UMACPHY_Array_PG[Rtl8723UMACPHY_Array_PGLength] = {
|
||||
0x0,
|
||||
};
|
File diff suppressed because it is too large
Load Diff
|
@ -1,565 +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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#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 != 0x00)
|
||||
return false;
|
||||
|
||||
cond = Condition & 0x0000FF00;
|
||||
cond >>= 8;
|
||||
if ((_interface & cond) == 0 && cond != 0x07)
|
||||
return false;
|
||||
|
||||
cond = Condition & 0x00FF0000;
|
||||
cond >>= 16;
|
||||
if ((_platform & cond) == 0 && cond != 0x0F)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* AGC_TAB_1T.TXT
|
||||
******************************************************************************/
|
||||
|
||||
static u32 Array_AGC_TAB_1T_8723A[] = {
|
||||
0xC78, 0x7B000001,
|
||||
0xC78, 0x7B010001,
|
||||
0xC78, 0x7B020001,
|
||||
0xC78, 0x7B030001,
|
||||
0xC78, 0x7B040001,
|
||||
0xC78, 0x7B050001,
|
||||
0xC78, 0x7A060001,
|
||||
0xC78, 0x79070001,
|
||||
0xC78, 0x78080001,
|
||||
0xC78, 0x77090001,
|
||||
0xC78, 0x760A0001,
|
||||
0xC78, 0x750B0001,
|
||||
0xC78, 0x740C0001,
|
||||
0xC78, 0x730D0001,
|
||||
0xC78, 0x720E0001,
|
||||
0xC78, 0x710F0001,
|
||||
0xC78, 0x70100001,
|
||||
0xC78, 0x6F110001,
|
||||
0xC78, 0x6E120001,
|
||||
0xC78, 0x6D130001,
|
||||
0xC78, 0x6C140001,
|
||||
0xC78, 0x6B150001,
|
||||
0xC78, 0x6A160001,
|
||||
0xC78, 0x69170001,
|
||||
0xC78, 0x68180001,
|
||||
0xC78, 0x67190001,
|
||||
0xC78, 0x661A0001,
|
||||
0xC78, 0x651B0001,
|
||||
0xC78, 0x641C0001,
|
||||
0xC78, 0x631D0001,
|
||||
0xC78, 0x621E0001,
|
||||
0xC78, 0x611F0001,
|
||||
0xC78, 0x60200001,
|
||||
0xC78, 0x49210001,
|
||||
0xC78, 0x48220001,
|
||||
0xC78, 0x47230001,
|
||||
0xC78, 0x46240001,
|
||||
0xC78, 0x45250001,
|
||||
0xC78, 0x44260001,
|
||||
0xC78, 0x43270001,
|
||||
0xC78, 0x42280001,
|
||||
0xC78, 0x41290001,
|
||||
0xC78, 0x402A0001,
|
||||
0xC78, 0x262B0001,
|
||||
0xC78, 0x252C0001,
|
||||
0xC78, 0x242D0001,
|
||||
0xC78, 0x232E0001,
|
||||
0xC78, 0x222F0001,
|
||||
0xC78, 0x21300001,
|
||||
0xC78, 0x20310001,
|
||||
0xC78, 0x06320001,
|
||||
0xC78, 0x05330001,
|
||||
0xC78, 0x04340001,
|
||||
0xC78, 0x03350001,
|
||||
0xC78, 0x02360001,
|
||||
0xC78, 0x01370001,
|
||||
0xC78, 0x00380001,
|
||||
0xC78, 0x00390001,
|
||||
0xC78, 0x003A0001,
|
||||
0xC78, 0x003B0001,
|
||||
0xC78, 0x003C0001,
|
||||
0xC78, 0x003D0001,
|
||||
0xC78, 0x003E0001,
|
||||
0xC78, 0x003F0001,
|
||||
0xC78, 0x7B400001,
|
||||
0xC78, 0x7B410001,
|
||||
0xC78, 0x7B420001,
|
||||
0xC78, 0x7B430001,
|
||||
0xC78, 0x7B440001,
|
||||
0xC78, 0x7B450001,
|
||||
0xC78, 0x7A460001,
|
||||
0xC78, 0x79470001,
|
||||
0xC78, 0x78480001,
|
||||
0xC78, 0x77490001,
|
||||
0xC78, 0x764A0001,
|
||||
0xC78, 0x754B0001,
|
||||
0xC78, 0x744C0001,
|
||||
0xC78, 0x734D0001,
|
||||
0xC78, 0x724E0001,
|
||||
0xC78, 0x714F0001,
|
||||
0xC78, 0x70500001,
|
||||
0xC78, 0x6F510001,
|
||||
0xC78, 0x6E520001,
|
||||
0xC78, 0x6D530001,
|
||||
0xC78, 0x6C540001,
|
||||
0xC78, 0x6B550001,
|
||||
0xC78, 0x6A560001,
|
||||
0xC78, 0x69570001,
|
||||
0xC78, 0x68580001,
|
||||
0xC78, 0x67590001,
|
||||
0xC78, 0x665A0001,
|
||||
0xC78, 0x655B0001,
|
||||
0xC78, 0x645C0001,
|
||||
0xC78, 0x635D0001,
|
||||
0xC78, 0x625E0001,
|
||||
0xC78, 0x615F0001,
|
||||
0xC78, 0x60600001,
|
||||
0xC78, 0x49610001,
|
||||
0xC78, 0x48620001,
|
||||
0xC78, 0x47630001,
|
||||
0xC78, 0x46640001,
|
||||
0xC78, 0x45650001,
|
||||
0xC78, 0x44660001,
|
||||
0xC78, 0x43670001,
|
||||
0xC78, 0x42680001,
|
||||
0xC78, 0x41690001,
|
||||
0xC78, 0x406A0001,
|
||||
0xC78, 0x266B0001,
|
||||
0xC78, 0x256C0001,
|
||||
0xC78, 0x246D0001,
|
||||
0xC78, 0x236E0001,
|
||||
0xC78, 0x226F0001,
|
||||
0xC78, 0x21700001,
|
||||
0xC78, 0x20710001,
|
||||
0xC78, 0x06720001,
|
||||
0xC78, 0x05730001,
|
||||
0xC78, 0x04740001,
|
||||
0xC78, 0x03750001,
|
||||
0xC78, 0x02760001,
|
||||
0xC78, 0x01770001,
|
||||
0xC78, 0x00780001,
|
||||
0xC78, 0x00790001,
|
||||
0xC78, 0x007A0001,
|
||||
0xC78, 0x007B0001,
|
||||
0xC78, 0x007C0001,
|
||||
0xC78, 0x007D0001,
|
||||
0xC78, 0x007E0001,
|
||||
0xC78, 0x007F0001,
|
||||
0xC78, 0x3800001E,
|
||||
0xC78, 0x3801001E,
|
||||
0xC78, 0x3802001E,
|
||||
0xC78, 0x3803001E,
|
||||
0xC78, 0x3804001E,
|
||||
0xC78, 0x3805001E,
|
||||
0xC78, 0x3806001E,
|
||||
0xC78, 0x3807001E,
|
||||
0xC78, 0x3808001E,
|
||||
0xC78, 0x3C09001E,
|
||||
0xC78, 0x3E0A001E,
|
||||
0xC78, 0x400B001E,
|
||||
0xC78, 0x440C001E,
|
||||
0xC78, 0x480D001E,
|
||||
0xC78, 0x4C0E001E,
|
||||
0xC78, 0x500F001E,
|
||||
0xC78, 0x5210001E,
|
||||
0xC78, 0x5611001E,
|
||||
0xC78, 0x5A12001E,
|
||||
0xC78, 0x5E13001E,
|
||||
0xC78, 0x6014001E,
|
||||
0xC78, 0x6015001E,
|
||||
0xC78, 0x6016001E,
|
||||
0xC78, 0x6217001E,
|
||||
0xC78, 0x6218001E,
|
||||
0xC78, 0x6219001E,
|
||||
0xC78, 0x621A001E,
|
||||
0xC78, 0x621B001E,
|
||||
0xC78, 0x621C001E,
|
||||
0xC78, 0x621D001E,
|
||||
0xC78, 0x621E001E,
|
||||
0xC78, 0x621F001E,
|
||||
};
|
||||
|
||||
#define READ_NEXT_PAIR(v1, v2, i) \
|
||||
do { \
|
||||
i += 2; v1 = Array[i]; v2 = Array[i+1]; \
|
||||
} while (0)
|
||||
|
||||
void ODM_ReadAndConfig_AGC_TAB_1T_8723A(struct dm_odm_t *pDM_Odm)
|
||||
{
|
||||
u32 hex;
|
||||
u32 i;
|
||||
u8 platform = 0x04;
|
||||
u8 board = pDM_Odm->BoardType;
|
||||
u32 ArrayLen = ARRAY_SIZE(Array_AGC_TAB_1T_8723A);
|
||||
u32 *Array = Array_AGC_TAB_1T_8723A;
|
||||
|
||||
hex = board;
|
||||
hex += ODM_ITRF_USB << 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_ConfigBB_AGC_8723A(pDM_Odm, v1, v2);
|
||||
continue;
|
||||
} else {
|
||||
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_ConfigBB_AGC_8723A(pDM_Odm, v1, v2);
|
||||
READ_NEXT_PAIR(v1, v2, i);
|
||||
}
|
||||
while (v2 != 0xDEAD && i < ArrayLen - 2)
|
||||
READ_NEXT_PAIR(v1, v2, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* PHY_REG_1T.TXT
|
||||
******************************************************************************/
|
||||
|
||||
static u32 Array_PHY_REG_1T_8723A[] = {
|
||||
0x800, 0x80040000,
|
||||
0x804, 0x00000003,
|
||||
0x808, 0x0000FC00,
|
||||
0x80C, 0x0000000A,
|
||||
0x810, 0x10001331,
|
||||
0x814, 0x020C3D10,
|
||||
0x818, 0x02200385,
|
||||
0x81C, 0x00000000,
|
||||
0x820, 0x01000100,
|
||||
0x824, 0x00390004,
|
||||
0x828, 0x00000000,
|
||||
0x82C, 0x00000000,
|
||||
0x830, 0x00000000,
|
||||
0x834, 0x00000000,
|
||||
0x838, 0x00000000,
|
||||
0x83C, 0x00000000,
|
||||
0x840, 0x00010000,
|
||||
0x844, 0x00000000,
|
||||
0x848, 0x00000000,
|
||||
0x84C, 0x00000000,
|
||||
0x850, 0x00000000,
|
||||
0x854, 0x00000000,
|
||||
0x858, 0x569A569A,
|
||||
0x85C, 0x001B25A4,
|
||||
0x860, 0x66F60110,
|
||||
0x864, 0x061F0130,
|
||||
0x868, 0x00000000,
|
||||
0x86C, 0x32323200,
|
||||
0x870, 0x07000760,
|
||||
0x874, 0x22004000,
|
||||
0x878, 0x00000808,
|
||||
0x87C, 0x00000000,
|
||||
0x880, 0xC0083070,
|
||||
0x884, 0x000004D5,
|
||||
0x888, 0x00000000,
|
||||
0x88C, 0xCCC000C0,
|
||||
0x890, 0x00000800,
|
||||
0x894, 0xFFFFFFFE,
|
||||
0x898, 0x40302010,
|
||||
0x89C, 0x00706050,
|
||||
0x900, 0x00000000,
|
||||
0x904, 0x00000023,
|
||||
0x908, 0x00000000,
|
||||
0x90C, 0x81121111,
|
||||
0xA00, 0x00D047C8,
|
||||
0xA04, 0x80FF000C,
|
||||
0xA08, 0x8C838300,
|
||||
0xA0C, 0x2E68120F,
|
||||
0xA10, 0x9500BB78,
|
||||
0xA14, 0x11144028,
|
||||
0xA18, 0x00881117,
|
||||
0xA1C, 0x89140F00,
|
||||
0xA20, 0x1A1B0000,
|
||||
0xA24, 0x090E1317,
|
||||
0xA28, 0x00000204,
|
||||
0xA2C, 0x00D30000,
|
||||
0xA70, 0x101FBF00,
|
||||
0xA74, 0x00000007,
|
||||
0xA78, 0x00000900,
|
||||
0xC00, 0x48071D40,
|
||||
0xC04, 0x03A05611,
|
||||
0xC08, 0x000000E4,
|
||||
0xC0C, 0x6C6C6C6C,
|
||||
0xC10, 0x08800000,
|
||||
0xC14, 0x40000100,
|
||||
0xC18, 0x08800000,
|
||||
0xC1C, 0x40000100,
|
||||
0xC20, 0x00000000,
|
||||
0xC24, 0x00000000,
|
||||
0xC28, 0x00000000,
|
||||
0xC2C, 0x00000000,
|
||||
0xC30, 0x69E9AC44,
|
||||
0xFF0F011F, 0xABCD,
|
||||
0xC34, 0x469652CF,
|
||||
0xCDCDCDCD, 0xCDCD,
|
||||
0xC34, 0x469652AF,
|
||||
0xFF0F011F, 0xDEAD,
|
||||
0xC38, 0x49795994,
|
||||
0xC3C, 0x0A97971C,
|
||||
0xC40, 0x1F7C403F,
|
||||
0xC44, 0x000100B7,
|
||||
0xC48, 0xEC020107,
|
||||
0xC4C, 0x007F037F,
|
||||
0xC50, 0x69543420,
|
||||
0xC54, 0x43BC0094,
|
||||
0xC58, 0x69543420,
|
||||
0xC5C, 0x433C0094,
|
||||
0xC60, 0x00000000,
|
||||
0xFF0F011F, 0xABCD,
|
||||
0xC64, 0x7116848B,
|
||||
0xCDCDCDCD, 0xCDCD,
|
||||
0xC64, 0x7112848B,
|
||||
0xFF0F011F, 0xDEAD,
|
||||
0xC68, 0x47C00BFF,
|
||||
0xC6C, 0x00000036,
|
||||
0xC70, 0x2C7F000D,
|
||||
0xC74, 0x018610DB,
|
||||
0xC78, 0x0000001F,
|
||||
0xC7C, 0x00B91612,
|
||||
0xC80, 0x40000100,
|
||||
0xC84, 0x20F60000,
|
||||
0xC88, 0x40000100,
|
||||
0xC8C, 0x20200000,
|
||||
0xC90, 0x00121820,
|
||||
0xC94, 0x00000000,
|
||||
0xC98, 0x00121820,
|
||||
0xC9C, 0x00007F7F,
|
||||
0xCA0, 0x00000000,
|
||||
0xCA4, 0x00000080,
|
||||
0xCA8, 0x00000000,
|
||||
0xCAC, 0x00000000,
|
||||
0xCB0, 0x00000000,
|
||||
0xCB4, 0x00000000,
|
||||
0xCB8, 0x00000000,
|
||||
0xCBC, 0x28000000,
|
||||
0xCC0, 0x00000000,
|
||||
0xCC4, 0x00000000,
|
||||
0xCC8, 0x00000000,
|
||||
0xCCC, 0x00000000,
|
||||
0xCD0, 0x00000000,
|
||||
0xCD4, 0x00000000,
|
||||
0xCD8, 0x64B22427,
|
||||
0xCDC, 0x00766932,
|
||||
0xCE0, 0x00222222,
|
||||
0xCE4, 0x00000000,
|
||||
0xCE8, 0x37644302,
|
||||
0xCEC, 0x2F97D40C,
|
||||
0xD00, 0x00080740,
|
||||
0xD04, 0x00020401,
|
||||
0xD08, 0x0000907F,
|
||||
0xD0C, 0x20010201,
|
||||
0xD10, 0xA0633333,
|
||||
0xD14, 0x3333BC43,
|
||||
0xD18, 0x7A8F5B6B,
|
||||
0xD2C, 0xCC979975,
|
||||
0xD30, 0x00000000,
|
||||
0xD34, 0x80608000,
|
||||
0xD38, 0x00000000,
|
||||
0xD3C, 0x00027293,
|
||||
0xD40, 0x00000000,
|
||||
0xD44, 0x00000000,
|
||||
0xD48, 0x00000000,
|
||||
0xD4C, 0x00000000,
|
||||
0xD50, 0x6437140A,
|
||||
0xD54, 0x00000000,
|
||||
0xD58, 0x00000000,
|
||||
0xD5C, 0x30032064,
|
||||
0xD60, 0x4653DE68,
|
||||
0xD64, 0x04518A3C,
|
||||
0xD68, 0x00002101,
|
||||
0xD6C, 0x2A201C16,
|
||||
0xD70, 0x1812362E,
|
||||
0xD74, 0x322C2220,
|
||||
0xD78, 0x000E3C24,
|
||||
0xE00, 0x2A2A2A2A,
|
||||
0xE04, 0x2A2A2A2A,
|
||||
0xE08, 0x03902A2A,
|
||||
0xE10, 0x2A2A2A2A,
|
||||
0xE14, 0x2A2A2A2A,
|
||||
0xE18, 0x2A2A2A2A,
|
||||
0xE1C, 0x2A2A2A2A,
|
||||
0xE28, 0x00000000,
|
||||
0xE30, 0x1000DC1F,
|
||||
0xE34, 0x10008C1F,
|
||||
0xE38, 0x02140102,
|
||||
0xE3C, 0x681604C2,
|
||||
0xE40, 0x01007C00,
|
||||
0xE44, 0x01004800,
|
||||
0xE48, 0xFB000000,
|
||||
0xE4C, 0x000028D1,
|
||||
0xE50, 0x1000DC1F,
|
||||
0xE54, 0x10008C1F,
|
||||
0xE58, 0x02140102,
|
||||
0xE5C, 0x28160D05,
|
||||
0xE60, 0x00000008,
|
||||
0xE68, 0x001B25A4,
|
||||
0xE6C, 0x631B25A0,
|
||||
0xE70, 0x631B25A0,
|
||||
0xE74, 0x081B25A0,
|
||||
0xE78, 0x081B25A0,
|
||||
0xE7C, 0x081B25A0,
|
||||
0xE80, 0x081B25A0,
|
||||
0xE84, 0x631B25A0,
|
||||
0xE88, 0x081B25A0,
|
||||
0xE8C, 0x631B25A0,
|
||||
0xED0, 0x631B25A0,
|
||||
0xED4, 0x631B25A0,
|
||||
0xED8, 0x631B25A0,
|
||||
0xEDC, 0x001B25A0,
|
||||
0xEE0, 0x001B25A0,
|
||||
0xEEC, 0x6B1B25A0,
|
||||
0xF14, 0x00000003,
|
||||
0xF4C, 0x00000000,
|
||||
0xF00, 0x00000300,
|
||||
};
|
||||
|
||||
void ODM_ReadAndConfig_PHY_REG_1T_8723A(struct dm_odm_t *pDM_Odm)
|
||||
{
|
||||
u32 hex = 0;
|
||||
u32 i = 0;
|
||||
u8 platform = 0x04;
|
||||
u8 board = pDM_Odm->BoardType;
|
||||
u32 ArrayLen = ARRAY_SIZE(Array_PHY_REG_1T_8723A);
|
||||
u32 *Array = Array_PHY_REG_1T_8723A;
|
||||
|
||||
hex += board;
|
||||
hex += ODM_ITRF_USB << 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_ConfigBB_PHY_8723A(pDM_Odm, v1, v2);
|
||||
continue;
|
||||
} else {
|
||||
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_ConfigBB_PHY_8723A(pDM_Odm, v1, v2);
|
||||
READ_NEXT_PAIR(v1, v2, i);
|
||||
}
|
||||
while (v2 != 0xDEAD && i < ArrayLen - 2)
|
||||
READ_NEXT_PAIR(v1, v2, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* PHY_REG_MP.TXT
|
||||
******************************************************************************/
|
||||
|
||||
static u32 Array_PHY_REG_MP_8723A[] = {
|
||||
0xC30, 0x69E9AC4A,
|
||||
0xC3C, 0x0A979718,
|
||||
};
|
||||
|
||||
void ODM_ReadAndConfig_PHY_REG_MP_8723A(struct dm_odm_t *pDM_Odm)
|
||||
{
|
||||
u32 hex = 0;
|
||||
u32 i;
|
||||
u8 platform = 0x04;
|
||||
u8 board = pDM_Odm->BoardType;
|
||||
u32 ArrayLen = ARRAY_SIZE(Array_PHY_REG_MP_8723A);
|
||||
u32 *Array = Array_PHY_REG_MP_8723A;
|
||||
|
||||
hex += board;
|
||||
hex += ODM_ITRF_USB << 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_ConfigBB_PHY_8723A(pDM_Odm, v1, v2);
|
||||
continue;
|
||||
} else {
|
||||
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_ConfigBB_PHY_8723A(pDM_Odm, v1, v2);
|
||||
READ_NEXT_PAIR(v1, v2, i);
|
||||
}
|
||||
while (v2 != 0xDEAD && i < ArrayLen - 2)
|
||||
READ_NEXT_PAIR(v1, v2, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,187 +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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#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 != 0x00)
|
||||
return false;
|
||||
|
||||
cond = Condition & 0x0000FF00;
|
||||
cond >>= 8;
|
||||
if ((_interface & cond) == 0 && cond != 0x07)
|
||||
return false;
|
||||
|
||||
cond = Condition & 0x00FF0000;
|
||||
cond >>= 16;
|
||||
if ((_platform & cond) == 0 && cond != 0x0F)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* MAC_REG.TXT
|
||||
******************************************************************************/
|
||||
|
||||
static u32 Array_MAC_REG_8723A[] = {
|
||||
0x420, 0x00000080,
|
||||
0x423, 0x00000000,
|
||||
0x430, 0x00000000,
|
||||
0x431, 0x00000000,
|
||||
0x432, 0x00000000,
|
||||
0x433, 0x00000001,
|
||||
0x434, 0x00000004,
|
||||
0x435, 0x00000005,
|
||||
0x436, 0x00000006,
|
||||
0x437, 0x00000007,
|
||||
0x438, 0x00000000,
|
||||
0x439, 0x00000000,
|
||||
0x43A, 0x00000000,
|
||||
0x43B, 0x00000001,
|
||||
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,
|
||||
0x462, 0x00000008,
|
||||
0x463, 0x00000003,
|
||||
0x4C8, 0x000000FF,
|
||||
0x4C9, 0x00000008,
|
||||
0x4CC, 0x000000FF,
|
||||
0x4CD, 0x000000FF,
|
||||
0x4CE, 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,
|
||||
0x515, 0x00000010,
|
||||
0x516, 0x0000000A,
|
||||
0x517, 0x00000010,
|
||||
0x51A, 0x00000016,
|
||||
0x524, 0x0000000F,
|
||||
0x525, 0x0000004F,
|
||||
0x546, 0x00000040,
|
||||
0x547, 0x00000000,
|
||||
0x550, 0x00000010,
|
||||
0x551, 0x00000010,
|
||||
0x559, 0x00000002,
|
||||
0x55A, 0x00000002,
|
||||
0x55D, 0x000000FF,
|
||||
0x605, 0x00000030,
|
||||
0x608, 0x0000000E,
|
||||
0x609, 0x0000002A,
|
||||
0x652, 0x00000020,
|
||||
0x63C, 0x0000000A,
|
||||
0x63D, 0x0000000A,
|
||||
0x63E, 0x0000000E,
|
||||
0x63F, 0x0000000E,
|
||||
0x66E, 0x00000005,
|
||||
0x700, 0x00000021,
|
||||
0x701, 0x00000043,
|
||||
0x702, 0x00000065,
|
||||
0x703, 0x00000087,
|
||||
0x708, 0x00000021,
|
||||
0x709, 0x00000043,
|
||||
0x70A, 0x00000065,
|
||||
0x70B, 0x00000087,
|
||||
};
|
||||
|
||||
void ODM_ReadAndConfig_MAC_REG_8723A(struct dm_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;
|
||||
u8 platform = 0x04;
|
||||
u8 board = pDM_Odm->BoardType;
|
||||
u32 ArrayLen = ARRAY_SIZE(Array_MAC_REG_8723A);
|
||||
u32 *Array = Array_MAC_REG_8723A;
|
||||
|
||||
hex += board;
|
||||
hex += ODM_ITRF_USB << 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_8723A(pDM_Odm, v1, (u8)v2);
|
||||
continue;
|
||||
} else {
|
||||
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_8723A(pDM_Odm, v1, (u8)v2);
|
||||
READ_NEXT_PAIR(v1, v2, i);
|
||||
}
|
||||
|
||||
while (v2 != 0xDEAD && i < ArrayLen - 2)
|
||||
READ_NEXT_PAIR(v1, v2, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,259 +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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#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 != 0x00)
|
||||
return false;
|
||||
|
||||
cond = Condition & 0x0000FF00;
|
||||
cond >>= 8;
|
||||
if ((_interface & cond) == 0 && cond != 0x07)
|
||||
return false;
|
||||
|
||||
cond = Condition & 0x00FF0000;
|
||||
cond >>= 16;
|
||||
if ((_platform & cond) == 0 && cond != 0x0F)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* RadioA_1T.TXT
|
||||
******************************************************************************/
|
||||
|
||||
static u32 Array_RadioA_1T_8723A[] = {
|
||||
0x000, 0x00030159,
|
||||
0x001, 0x00031284,
|
||||
0x002, 0x00098000,
|
||||
0xFF0F011F, 0xABCD,
|
||||
0x003, 0x00018C63,
|
||||
0xCDCDCDCD, 0xCDCD,
|
||||
0x003, 0x00039C63,
|
||||
0xFF0F011F, 0xDEAD,
|
||||
0x004, 0x000210E7,
|
||||
0x009, 0x0002044F,
|
||||
0x00A, 0x0001A3F1,
|
||||
0x00B, 0x00014787,
|
||||
0x00C, 0x000896FE,
|
||||
0x00D, 0x0000E02C,
|
||||
0x00E, 0x00039CE7,
|
||||
0x00F, 0x00000451,
|
||||
0x019, 0x00000000,
|
||||
0x01A, 0x00030355,
|
||||
0x01B, 0x00060A00,
|
||||
0x01C, 0x000FC378,
|
||||
0x01D, 0x000A1250,
|
||||
0x01E, 0x0000024F,
|
||||
0x01F, 0x00000000,
|
||||
0x020, 0x0000B614,
|
||||
0x021, 0x0006C000,
|
||||
0x022, 0x00000000,
|
||||
0x023, 0x00001558,
|
||||
0x024, 0x00000060,
|
||||
0x025, 0x00000483,
|
||||
0x026, 0x0004F000,
|
||||
0x027, 0x000EC7D9,
|
||||
0x028, 0x00057730,
|
||||
0x029, 0x00004783,
|
||||
0x02A, 0x00000001,
|
||||
0x02B, 0x00021334,
|
||||
0x02A, 0x00000000,
|
||||
0x02B, 0x00000054,
|
||||
0x02A, 0x00000001,
|
||||
0x02B, 0x00000808,
|
||||
0x02B, 0x00053333,
|
||||
0x02C, 0x0000000C,
|
||||
0x02A, 0x00000002,
|
||||
0x02B, 0x00000808,
|
||||
0x02B, 0x0005B333,
|
||||
0x02C, 0x0000000D,
|
||||
0x02A, 0x00000003,
|
||||
0x02B, 0x00000808,
|
||||
0x02B, 0x00063333,
|
||||
0x02C, 0x0000000D,
|
||||
0x02A, 0x00000004,
|
||||
0x02B, 0x00000808,
|
||||
0x02B, 0x0006B333,
|
||||
0x02C, 0x0000000D,
|
||||
0x02A, 0x00000005,
|
||||
0x02B, 0x00000808,
|
||||
0x02B, 0x00073333,
|
||||
0x02C, 0x0000000D,
|
||||
0x02A, 0x00000006,
|
||||
0x02B, 0x00000709,
|
||||
0x02B, 0x0005B333,
|
||||
0x02C, 0x0000000D,
|
||||
0x02A, 0x00000007,
|
||||
0x02B, 0x00000709,
|
||||
0x02B, 0x00063333,
|
||||
0x02C, 0x0000000D,
|
||||
0x02A, 0x00000008,
|
||||
0x02B, 0x0000060A,
|
||||
0x02B, 0x0004B333,
|
||||
0x02C, 0x0000000D,
|
||||
0x02A, 0x00000009,
|
||||
0x02B, 0x0000060A,
|
||||
0x02B, 0x00053333,
|
||||
0x02C, 0x0000000D,
|
||||
0x02A, 0x0000000A,
|
||||
0x02B, 0x0000060A,
|
||||
0x02B, 0x0005B333,
|
||||
0x02C, 0x0000000D,
|
||||
0x02A, 0x0000000B,
|
||||
0x02B, 0x0000060A,
|
||||
0x02B, 0x00063333,
|
||||
0x02C, 0x0000000D,
|
||||
0x02A, 0x0000000C,
|
||||
0x02B, 0x0000060A,
|
||||
0x02B, 0x0006B333,
|
||||
0x02C, 0x0000000D,
|
||||
0x02A, 0x0000000D,
|
||||
0x02B, 0x0000060A,
|
||||
0x02B, 0x00073333,
|
||||
0x02C, 0x0000000D,
|
||||
0x02A, 0x0000000E,
|
||||
0x02B, 0x0000050B,
|
||||
0x02B, 0x00066666,
|
||||
0x02C, 0x0000001A,
|
||||
0x02A, 0x000E0000,
|
||||
0x010, 0x0004000F,
|
||||
0x011, 0x000E31FC,
|
||||
0x010, 0x0006000F,
|
||||
0x011, 0x000FF9F8,
|
||||
0x010, 0x0002000F,
|
||||
0x011, 0x000203F9,
|
||||
0x010, 0x0003000F,
|
||||
0x011, 0x000FF500,
|
||||
0x010, 0x00000000,
|
||||
0x011, 0x00000000,
|
||||
0x010, 0x0008000F,
|
||||
0x011, 0x0003F100,
|
||||
0x010, 0x0009000F,
|
||||
0x011, 0x00023100,
|
||||
0x012, 0x00032000,
|
||||
0x012, 0x00071000,
|
||||
0x012, 0x000B0000,
|
||||
0x012, 0x000FC000,
|
||||
0x013, 0x000287B3,
|
||||
0x013, 0x000244B7,
|
||||
0x013, 0x000204AB,
|
||||
0x013, 0x0001C49F,
|
||||
0x013, 0x00018493,
|
||||
0x013, 0x0001429B,
|
||||
0x013, 0x00010299,
|
||||
0x013, 0x0000C29C,
|
||||
0x013, 0x000081A0,
|
||||
0x013, 0x000040AC,
|
||||
0x013, 0x00000020,
|
||||
0x014, 0x0001944C,
|
||||
0x014, 0x00059444,
|
||||
0x014, 0x0009944C,
|
||||
0x014, 0x000D9444,
|
||||
0xFF0F011F, 0xABCD,
|
||||
0x015, 0x0000F424,
|
||||
0x015, 0x0004F424,
|
||||
0x015, 0x0008F424,
|
||||
0x015, 0x000CF424,
|
||||
0xCDCDCDCD, 0xCDCD,
|
||||
0x015, 0x0000F474,
|
||||
0x015, 0x0004F477,
|
||||
0x015, 0x0008F455,
|
||||
0x015, 0x000CF455,
|
||||
0xFF0F011F, 0xDEAD,
|
||||
0x016, 0x00000339,
|
||||
0x016, 0x00040339,
|
||||
0x016, 0x00080339,
|
||||
0xFF0F011F, 0xABCD,
|
||||
0x016, 0x000C0356,
|
||||
0xCDCDCDCD, 0xCDCD,
|
||||
0x016, 0x000C0366,
|
||||
0xFF0F011F, 0xDEAD,
|
||||
0x000, 0x00010159,
|
||||
0x018, 0x0000F401,
|
||||
0x0FE, 0x00000000,
|
||||
0x0FE, 0x00000000,
|
||||
0x01F, 0x00000003,
|
||||
0x0FE, 0x00000000,
|
||||
0x0FE, 0x00000000,
|
||||
0x01E, 0x00000247,
|
||||
0x01F, 0x00000000,
|
||||
0x000, 0x00030159,
|
||||
};
|
||||
|
||||
void ODM_ReadAndConfig_RadioA_1T_8723A(struct dm_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;
|
||||
u8 platform = 0x04;
|
||||
u8 board = pDM_Odm->BoardType;
|
||||
u32 ArrayLen = ARRAY_SIZE(Array_RadioA_1T_8723A);
|
||||
u32 *Array = Array_RadioA_1T_8723A;
|
||||
|
||||
hex += board;
|
||||
hex += ODM_ITRF_USB << 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_ConfigRFReg_8723A(pDM_Odm, v1, v2, RF_PATH_A, v1);
|
||||
continue;
|
||||
} else {
|
||||
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_ConfigRFReg_8723A(pDM_Odm, v1, v2,
|
||||
RF_PATH_A, v1);
|
||||
READ_NEXT_PAIR(v1, v2, i);
|
||||
}
|
||||
|
||||
while (v2 != 0xDEAD && i < ArrayLen - 2)
|
||||
READ_NEXT_PAIR(v1, v2, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,156 +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.
|
||||
*
|
||||
******************************************************************************/
|
||||
/*++
|
||||
Copyright (c) Realtek Semiconductor Corp. All rights reserved.
|
||||
|
||||
Module Name:
|
||||
HalPwrSeqCmd.c
|
||||
|
||||
Abstract:
|
||||
Implement HW Power sequence configuration CMD handling routine for
|
||||
Realtek devices.
|
||||
|
||||
Major Change History:
|
||||
When Who What
|
||||
---------- --------------- -------------------------------
|
||||
2011-10-26 Lucas Modify to be compatible with SD4-CE driver.
|
||||
2011-07-07 Roger Create.
|
||||
|
||||
--*/
|
||||
#include <HalPwrSeqCmd.h>
|
||||
#include <usb_ops_linux.h>
|
||||
|
||||
/* */
|
||||
/* Description: */
|
||||
/* This routine deal with the Power Configuration CMDs parsing
|
||||
for RTL8723/RTL8188E Series IC. */
|
||||
/* */
|
||||
/* Assumption: */
|
||||
/* We should follow specific format which was released from
|
||||
HW SD. */
|
||||
/* */
|
||||
/* 2011.07.07, added by Roger. */
|
||||
/* */
|
||||
u8 HalPwrSeqCmdParsing23a(struct rtw_adapter *padapter, u8 CutVersion,
|
||||
u8 FabVersion, u8 InterfaceType,
|
||||
struct wlan_pwr_cfg PwrSeqCmd[])
|
||||
{
|
||||
struct wlan_pwr_cfg PwrCfgCmd;
|
||||
u8 bPollingBit;
|
||||
u32 AryIdx = 0;
|
||||
u8 value;
|
||||
u32 offset;
|
||||
u32 pollingCount = 0; /* polling autoload done. */
|
||||
u32 maxPollingCnt = 5000;
|
||||
|
||||
do {
|
||||
PwrCfgCmd = PwrSeqCmd[AryIdx];
|
||||
|
||||
RT_TRACE(_module_hal_init_c_, _drv_info_,
|
||||
"HalPwrSeqCmdParsing23a: 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_,
|
||||
"HalPwrSeqCmdParsing23a: PWR_CMD_READ\n");
|
||||
break;
|
||||
|
||||
case PWR_CMD_WRITE:
|
||||
RT_TRACE(_module_hal_init_c_, _drv_info_,
|
||||
"HalPwrSeqCmdParsing23a: PWR_CMD_WRITE\n");
|
||||
offset = GET_PWR_CFG_OFFSET(PwrCfgCmd);
|
||||
|
||||
/* Read the value from system register */
|
||||
value = rtl8723au_read8(padapter, offset);
|
||||
|
||||
value &= ~(GET_PWR_CFG_MASK(PwrCfgCmd));
|
||||
value |= (GET_PWR_CFG_VALUE(PwrCfgCmd) &
|
||||
GET_PWR_CFG_MASK(PwrCfgCmd));
|
||||
|
||||
/* Write the value back to system register */
|
||||
rtl8723au_write8(padapter, offset, value);
|
||||
break;
|
||||
|
||||
case PWR_CMD_POLLING:
|
||||
RT_TRACE(_module_hal_init_c_, _drv_info_,
|
||||
"HalPwrSeqCmdParsing23a: PWR_CMD_POLLING\n");
|
||||
|
||||
bPollingBit = false;
|
||||
offset = GET_PWR_CFG_OFFSET(PwrCfgCmd);
|
||||
do {
|
||||
value = rtl8723au_read8(padapter,
|
||||
offset);
|
||||
|
||||
value &= GET_PWR_CFG_MASK(PwrCfgCmd);
|
||||
if (value ==
|
||||
(GET_PWR_CFG_VALUE(PwrCfgCmd) &
|
||||
GET_PWR_CFG_MASK(PwrCfgCmd)))
|
||||
bPollingBit = true;
|
||||
else
|
||||
udelay(10);
|
||||
|
||||
if (pollingCount++ > maxPollingCnt) {
|
||||
DBG_8723A("Fail to polling "
|
||||
"Offset[%#x]\n",
|
||||
offset);
|
||||
return false;
|
||||
}
|
||||
} while (!bPollingBit);
|
||||
|
||||
break;
|
||||
|
||||
case PWR_CMD_DELAY:
|
||||
RT_TRACE(_module_hal_init_c_, _drv_info_,
|
||||
"HalPwrSeqCmdParsing23a: PWR_CMD_DELAY\n");
|
||||
if (GET_PWR_CFG_VALUE(PwrCfgCmd) ==
|
||||
PWRSEQ_DELAY_US)
|
||||
udelay(GET_PWR_CFG_OFFSET(PwrCfgCmd));
|
||||
else
|
||||
udelay(GET_PWR_CFG_OFFSET(PwrCfgCmd) *
|
||||
1000);
|
||||
break;
|
||||
|
||||
case PWR_CMD_END:
|
||||
/* When this command is parsed, end
|
||||
the process */
|
||||
RT_TRACE(_module_hal_init_c_, _drv_info_,
|
||||
"HalPwrSeqCmdParsing23a: PWR_CMD_END\n");
|
||||
return true;
|
||||
|
||||
default:
|
||||
RT_TRACE(_module_hal_init_c_, _drv_err_,
|
||||
"HalPwrSeqCmdParsing23a: Unknown CMD!!\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
AryIdx++; /* Add Array Index */
|
||||
} while (1);
|
||||
|
||||
return true;
|
||||
}
|
|
@ -1,853 +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.
|
||||
*
|
||||
******************************************************************************/
|
||||
#include <osdep_service.h>
|
||||
#include <drv_types.h>
|
||||
|
||||
#include <hal_intf.h>
|
||||
#include <hal_com.h>
|
||||
#include <rtl8723a_hal.h>
|
||||
#include <usb_ops_linux.h>
|
||||
|
||||
#define _HAL_INIT_C_
|
||||
|
||||
#define EEPROM_CHANNEL_PLAN_BY_HW_MASK 0x80
|
||||
|
||||
/* return the final channel plan decision */
|
||||
/* hw_channel_plan: channel plan from HW (efuse/eeprom) */
|
||||
/* sw_channel_plan: channel plan from SW (registry/module param) */
|
||||
/* def_channel_plan: channel plan used when the former two is invalid */
|
||||
u8 hal_com_get_channel_plan23a(struct rtw_adapter *padapter, u8 hw_channel_plan,
|
||||
u8 sw_channel_plan, u8 def_channel_plan,
|
||||
bool AutoLoadFail)
|
||||
{
|
||||
u8 swConfig;
|
||||
u8 chnlPlan;
|
||||
|
||||
swConfig = true;
|
||||
if (!AutoLoadFail) {
|
||||
if (!rtw_is_channel_plan_valid(sw_channel_plan))
|
||||
swConfig = false;
|
||||
if (hw_channel_plan & EEPROM_CHANNEL_PLAN_BY_HW_MASK)
|
||||
swConfig = false;
|
||||
}
|
||||
|
||||
if (swConfig == true)
|
||||
chnlPlan = sw_channel_plan;
|
||||
else
|
||||
chnlPlan = hw_channel_plan & (~EEPROM_CHANNEL_PLAN_BY_HW_MASK);
|
||||
|
||||
if (!rtw_is_channel_plan_valid(chnlPlan))
|
||||
chnlPlan = def_channel_plan;
|
||||
|
||||
return chnlPlan;
|
||||
}
|
||||
|
||||
u8 MRateToHwRate23a(u8 rate)
|
||||
{
|
||||
u8 ret = DESC_RATE1M;
|
||||
|
||||
switch (rate) {
|
||||
/* CCK and OFDM non-HT rates */
|
||||
case IEEE80211_CCK_RATE_1MB:
|
||||
ret = DESC_RATE1M;
|
||||
break;
|
||||
case IEEE80211_CCK_RATE_2MB:
|
||||
ret = DESC_RATE2M;
|
||||
break;
|
||||
case IEEE80211_CCK_RATE_5MB:
|
||||
ret = DESC_RATE5_5M;
|
||||
break;
|
||||
case IEEE80211_CCK_RATE_11MB:
|
||||
ret = DESC_RATE11M;
|
||||
break;
|
||||
case IEEE80211_OFDM_RATE_6MB:
|
||||
ret = DESC_RATE6M;
|
||||
break;
|
||||
case IEEE80211_OFDM_RATE_9MB:
|
||||
ret = DESC_RATE9M;
|
||||
break;
|
||||
case IEEE80211_OFDM_RATE_12MB:
|
||||
ret = DESC_RATE12M;
|
||||
break;
|
||||
case IEEE80211_OFDM_RATE_18MB:
|
||||
ret = DESC_RATE18M;
|
||||
break;
|
||||
case IEEE80211_OFDM_RATE_24MB:
|
||||
ret = DESC_RATE24M;
|
||||
break;
|
||||
case IEEE80211_OFDM_RATE_36MB:
|
||||
ret = DESC_RATE36M;
|
||||
break;
|
||||
case IEEE80211_OFDM_RATE_48MB:
|
||||
ret = DESC_RATE48M;
|
||||
break;
|
||||
case IEEE80211_OFDM_RATE_54MB:
|
||||
ret = DESC_RATE54M;
|
||||
break;
|
||||
|
||||
/* HT rates since here */
|
||||
/* case MGN_MCS0: ret = DESC_RATEMCS0; break; */
|
||||
/* case MGN_MCS1: ret = DESC_RATEMCS1; break; */
|
||||
/* case MGN_MCS2: ret = DESC_RATEMCS2; break; */
|
||||
/* case MGN_MCS3: ret = DESC_RATEMCS3; break; */
|
||||
/* case MGN_MCS4: ret = DESC_RATEMCS4; break; */
|
||||
/* case MGN_MCS5: ret = DESC_RATEMCS5; break; */
|
||||
/* case MGN_MCS6: ret = DESC_RATEMCS6; break; */
|
||||
/* case MGN_MCS7: ret = DESC_RATEMCS7; break; */
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void HalSetBrateCfg23a(struct rtw_adapter *padapter, u8 *mBratesOS)
|
||||
{
|
||||
struct hal_data_8723a *pHalData = GET_HAL_DATA(padapter);
|
||||
u8 i, is_brate, brate;
|
||||
u16 brate_cfg = 0;
|
||||
u8 rate_index;
|
||||
|
||||
for (i = 0; i < NDIS_802_11_LENGTH_RATES_EX; i++) {
|
||||
is_brate = mBratesOS[i] & IEEE80211_BASIC_RATE_MASK;
|
||||
brate = mBratesOS[i] & 0x7f;
|
||||
|
||||
if (is_brate) {
|
||||
switch (brate) {
|
||||
case IEEE80211_CCK_RATE_1MB:
|
||||
brate_cfg |= RATE_1M;
|
||||
break;
|
||||
case IEEE80211_CCK_RATE_2MB:
|
||||
brate_cfg |= RATE_2M;
|
||||
break;
|
||||
case IEEE80211_CCK_RATE_5MB:
|
||||
brate_cfg |= RATE_5_5M;
|
||||
break;
|
||||
case IEEE80211_CCK_RATE_11MB:
|
||||
brate_cfg |= RATE_11M;
|
||||
break;
|
||||
case IEEE80211_OFDM_RATE_6MB:
|
||||
brate_cfg |= RATE_6M;
|
||||
break;
|
||||
case IEEE80211_OFDM_RATE_9MB:
|
||||
brate_cfg |= RATE_9M;
|
||||
break;
|
||||
case IEEE80211_OFDM_RATE_12MB:
|
||||
brate_cfg |= RATE_12M;
|
||||
break;
|
||||
case IEEE80211_OFDM_RATE_18MB:
|
||||
brate_cfg |= RATE_18M;
|
||||
break;
|
||||
case IEEE80211_OFDM_RATE_24MB:
|
||||
brate_cfg |= RATE_24M;
|
||||
break;
|
||||
case IEEE80211_OFDM_RATE_36MB:
|
||||
brate_cfg |= RATE_36M;
|
||||
break;
|
||||
case IEEE80211_OFDM_RATE_48MB:
|
||||
brate_cfg |= RATE_48M;
|
||||
break;
|
||||
case IEEE80211_OFDM_RATE_54MB:
|
||||
brate_cfg |= RATE_54M;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 2007.01.16, by Emily */
|
||||
/* Select RRSR (in Legacy-OFDM and CCK) */
|
||||
/* For 8190, we select only 24M, 12M, 6M, 11M, 5.5M, 2M,
|
||||
and 1M from the Basic rate. */
|
||||
/* We do not use other rates. */
|
||||
/* 2011.03.30 add by Luke Lee */
|
||||
/* CCK 2M ACK should be disabled for some BCM and Atheros AP IOT */
|
||||
/* because CCK 2M has poor TXEVM */
|
||||
/* CCK 5.5M & 11M ACK should be enabled for better
|
||||
performance */
|
||||
|
||||
brate_cfg = (brate_cfg | 0xd) & 0x15d;
|
||||
pHalData->BasicRateSet = brate_cfg;
|
||||
brate_cfg |= 0x01; /* default enable 1M ACK rate */
|
||||
DBG_8723A("HW_VAR_BASIC_RATE: BrateCfg(%#x)\n", brate_cfg);
|
||||
|
||||
/* Set RRSR rate table. */
|
||||
rtl8723au_write8(padapter, REG_RRSR, brate_cfg & 0xff);
|
||||
rtl8723au_write8(padapter, REG_RRSR + 1, (brate_cfg >> 8) & 0xff);
|
||||
rtl8723au_write8(padapter, REG_RRSR + 2,
|
||||
rtl8723au_read8(padapter, REG_RRSR + 2) & 0xf0);
|
||||
|
||||
rate_index = 0;
|
||||
/* Set RTS initial rate */
|
||||
while (brate_cfg > 0x1) {
|
||||
brate_cfg >>= 1;
|
||||
rate_index++;
|
||||
}
|
||||
/* Ziv - Check */
|
||||
rtl8723au_write8(padapter, REG_INIRTS_RATE_SEL, rate_index);
|
||||
}
|
||||
|
||||
static void _OneOutPipeMapping(struct rtw_adapter *pAdapter)
|
||||
{
|
||||
struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(pAdapter);
|
||||
|
||||
pdvobjpriv->Queue2Pipe[0] = pdvobjpriv->RtOutPipe[0]; /* VO */
|
||||
pdvobjpriv->Queue2Pipe[1] = pdvobjpriv->RtOutPipe[0]; /* VI */
|
||||
pdvobjpriv->Queue2Pipe[2] = pdvobjpriv->RtOutPipe[0]; /* BE */
|
||||
pdvobjpriv->Queue2Pipe[3] = pdvobjpriv->RtOutPipe[0]; /* BK */
|
||||
|
||||
pdvobjpriv->Queue2Pipe[4] = pdvobjpriv->RtOutPipe[0]; /* BCN */
|
||||
pdvobjpriv->Queue2Pipe[5] = pdvobjpriv->RtOutPipe[0]; /* MGT */
|
||||
pdvobjpriv->Queue2Pipe[6] = pdvobjpriv->RtOutPipe[0]; /* HIGH */
|
||||
pdvobjpriv->Queue2Pipe[7] = pdvobjpriv->RtOutPipe[0]; /* TXCMD */
|
||||
}
|
||||
|
||||
static void _TwoOutPipeMapping(struct rtw_adapter *pAdapter, bool bWIFICfg)
|
||||
{
|
||||
struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(pAdapter);
|
||||
|
||||
if (bWIFICfg) { /* WMM */
|
||||
/* BK, BE, VI, VO, BCN, CMD, MGT, HIGH, HCCA */
|
||||
/* 0, 1, 0, 1, 0, 0, 0, 0, 0 }; */
|
||||
/* 0:H, 1:L */
|
||||
pdvobjpriv->Queue2Pipe[0] = pdvobjpriv->RtOutPipe[1]; /* VO */
|
||||
pdvobjpriv->Queue2Pipe[1] = pdvobjpriv->RtOutPipe[0]; /* VI */
|
||||
pdvobjpriv->Queue2Pipe[2] = pdvobjpriv->RtOutPipe[1]; /* BE */
|
||||
pdvobjpriv->Queue2Pipe[3] = pdvobjpriv->RtOutPipe[0]; /* BK */
|
||||
|
||||
pdvobjpriv->Queue2Pipe[4] = pdvobjpriv->RtOutPipe[0]; /* BCN */
|
||||
pdvobjpriv->Queue2Pipe[5] = pdvobjpriv->RtOutPipe[0]; /* MGT */
|
||||
pdvobjpriv->Queue2Pipe[6] = pdvobjpriv->RtOutPipe[0]; /* HIGH */
|
||||
pdvobjpriv->Queue2Pipe[7] = pdvobjpriv->RtOutPipe[0]; /* TXCMD*/
|
||||
} else { /* typical setting */
|
||||
/* BK, BE, VI, VO, BCN, CMD, MGT, HIGH, HCCA */
|
||||
/* 1, 1, 0, 0, 0, 0, 0, 0, 0 }; */
|
||||
/* 0:H, 1:L */
|
||||
pdvobjpriv->Queue2Pipe[0] = pdvobjpriv->RtOutPipe[0]; /* VO */
|
||||
pdvobjpriv->Queue2Pipe[1] = pdvobjpriv->RtOutPipe[0]; /* VI */
|
||||
pdvobjpriv->Queue2Pipe[2] = pdvobjpriv->RtOutPipe[1]; /* BE */
|
||||
pdvobjpriv->Queue2Pipe[3] = pdvobjpriv->RtOutPipe[1]; /* BK */
|
||||
|
||||
pdvobjpriv->Queue2Pipe[4] = pdvobjpriv->RtOutPipe[0]; /* BCN */
|
||||
pdvobjpriv->Queue2Pipe[5] = pdvobjpriv->RtOutPipe[0]; /* MGT */
|
||||
pdvobjpriv->Queue2Pipe[6] = pdvobjpriv->RtOutPipe[0]; /* HIGH */
|
||||
pdvobjpriv->Queue2Pipe[7] = pdvobjpriv->RtOutPipe[0]; /* TXCMD*/
|
||||
}
|
||||
}
|
||||
|
||||
static void _ThreeOutPipeMapping(struct rtw_adapter *pAdapter, bool bWIFICfg)
|
||||
{
|
||||
struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(pAdapter);
|
||||
|
||||
if (bWIFICfg) { /* for WMM */
|
||||
/* BK, BE, VI, VO, BCN, CMD, MGT, HIGH, HCCA */
|
||||
/* 1, 2, 1, 0, 0, 0, 0, 0, 0 }; */
|
||||
/* 0:H, 1:N, 2:L */
|
||||
pdvobjpriv->Queue2Pipe[0] = pdvobjpriv->RtOutPipe[0]; /* VO */
|
||||
pdvobjpriv->Queue2Pipe[1] = pdvobjpriv->RtOutPipe[1]; /* VI */
|
||||
pdvobjpriv->Queue2Pipe[2] = pdvobjpriv->RtOutPipe[2]; /* BE */
|
||||
pdvobjpriv->Queue2Pipe[3] = pdvobjpriv->RtOutPipe[1]; /* BK */
|
||||
|
||||
pdvobjpriv->Queue2Pipe[4] = pdvobjpriv->RtOutPipe[0]; /* BCN */
|
||||
pdvobjpriv->Queue2Pipe[5] = pdvobjpriv->RtOutPipe[0]; /* MGT */
|
||||
pdvobjpriv->Queue2Pipe[6] = pdvobjpriv->RtOutPipe[0]; /* HIGH */
|
||||
pdvobjpriv->Queue2Pipe[7] = pdvobjpriv->RtOutPipe[0]; /* TXCMD*/
|
||||
} else { /* typical setting */
|
||||
/* BK, BE, VI, VO, BCN, CMD, MGT, HIGH, HCCA */
|
||||
/* 2, 2, 1, 0, 0, 0, 0, 0, 0 }; */
|
||||
/* 0:H, 1:N, 2:L */
|
||||
pdvobjpriv->Queue2Pipe[0] = pdvobjpriv->RtOutPipe[0]; /* VO */
|
||||
pdvobjpriv->Queue2Pipe[1] = pdvobjpriv->RtOutPipe[1]; /* VI */
|
||||
pdvobjpriv->Queue2Pipe[2] = pdvobjpriv->RtOutPipe[2]; /* BE */
|
||||
pdvobjpriv->Queue2Pipe[3] = pdvobjpriv->RtOutPipe[2]; /* BK */
|
||||
|
||||
pdvobjpriv->Queue2Pipe[4] = pdvobjpriv->RtOutPipe[0]; /* BCN */
|
||||
pdvobjpriv->Queue2Pipe[5] = pdvobjpriv->RtOutPipe[0]; /* MGT */
|
||||
pdvobjpriv->Queue2Pipe[6] = pdvobjpriv->RtOutPipe[0]; /* HIGH */
|
||||
pdvobjpriv->Queue2Pipe[7] = pdvobjpriv->RtOutPipe[0]; /* TXCMD*/
|
||||
}
|
||||
}
|
||||
|
||||
bool Hal_MappingOutPipe23a(struct rtw_adapter *pAdapter, u8 NumOutPipe)
|
||||
{
|
||||
struct registry_priv *pregistrypriv = &pAdapter->registrypriv;
|
||||
bool bWIFICfg = (pregistrypriv->wifi_spec) ? true : false;
|
||||
bool result = true;
|
||||
|
||||
switch (NumOutPipe) {
|
||||
case 2:
|
||||
_TwoOutPipeMapping(pAdapter, bWIFICfg);
|
||||
break;
|
||||
case 3:
|
||||
_ThreeOutPipeMapping(pAdapter, bWIFICfg);
|
||||
break;
|
||||
case 1:
|
||||
_OneOutPipeMapping(pAdapter);
|
||||
break;
|
||||
default:
|
||||
result = false;
|
||||
break;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* C2H event format:
|
||||
* Field TRIGGER CONTENT CMD_SEQ CMD_LEN CMD_ID
|
||||
* BITS [127:120] [119:16] [15:8] [7:4] [3:0]
|
||||
*/
|
||||
|
||||
void c2h_evt_clear23a(struct rtw_adapter *adapter)
|
||||
{
|
||||
rtl8723au_write8(adapter, REG_C2HEVT_CLEAR, C2H_EVT_HOST_CLOSE);
|
||||
}
|
||||
|
||||
int c2h_evt_read23a(struct rtw_adapter *adapter, u8 *buf)
|
||||
{
|
||||
int ret = _FAIL;
|
||||
struct c2h_evt_hdr *c2h_evt;
|
||||
int i;
|
||||
u8 trigger;
|
||||
|
||||
if (buf == NULL)
|
||||
goto exit;
|
||||
|
||||
trigger = rtl8723au_read8(adapter, REG_C2HEVT_CLEAR);
|
||||
|
||||
if (trigger == C2H_EVT_HOST_CLOSE)
|
||||
goto exit; /* Not ready */
|
||||
if (trigger != C2H_EVT_FW_CLOSE)
|
||||
goto clear_evt; /* Not a valid value */
|
||||
|
||||
c2h_evt = (struct c2h_evt_hdr *)buf;
|
||||
|
||||
memset(c2h_evt, 0, 16);
|
||||
|
||||
*buf = rtl8723au_read8(adapter, REG_C2HEVT_MSG_NORMAL);
|
||||
*(buf + 1) = rtl8723au_read8(adapter, REG_C2HEVT_MSG_NORMAL + 1);
|
||||
|
||||
RT_PRINT_DATA(_module_hal_init_c_, _drv_info_, "c2h_evt_read23a(): ",
|
||||
&c2h_evt, sizeof(c2h_evt));
|
||||
|
||||
if (0) {
|
||||
DBG_8723A("%s id:%u, len:%u, seq:%u, trigger:0x%02x\n",
|
||||
__func__, c2h_evt->id, c2h_evt->plen, c2h_evt->seq,
|
||||
trigger);
|
||||
}
|
||||
|
||||
/* Read the content */
|
||||
for (i = 0; i < c2h_evt->plen; i++)
|
||||
c2h_evt->payload[i] = rtl8723au_read8(adapter,
|
||||
REG_C2HEVT_MSG_NORMAL +
|
||||
sizeof(*c2h_evt) + i);
|
||||
|
||||
RT_PRINT_DATA(_module_hal_init_c_, _drv_info_,
|
||||
"c2h_evt_read23a(): Command Content:\n", c2h_evt->payload,
|
||||
c2h_evt->plen);
|
||||
|
||||
ret = _SUCCESS;
|
||||
|
||||
clear_evt:
|
||||
/*
|
||||
* Clear event to notify FW we have read the command.
|
||||
* If this field isn't clear, the FW won't update the
|
||||
* next command message.
|
||||
*/
|
||||
c2h_evt_clear23a(adapter);
|
||||
exit:
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
rtl8723a_set_ampdu_min_space(struct rtw_adapter *padapter, u8 MinSpacingToSet)
|
||||
{
|
||||
u8 SecMinSpace;
|
||||
|
||||
if (MinSpacingToSet <= 7) {
|
||||
switch (padapter->securitypriv.dot11PrivacyAlgrthm) {
|
||||
case 0:
|
||||
case WLAN_CIPHER_SUITE_CCMP:
|
||||
SecMinSpace = 0;
|
||||
break;
|
||||
|
||||
case WLAN_CIPHER_SUITE_WEP40:
|
||||
case WLAN_CIPHER_SUITE_WEP104:
|
||||
case WLAN_CIPHER_SUITE_TKIP:
|
||||
SecMinSpace = 6;
|
||||
break;
|
||||
default:
|
||||
SecMinSpace = 7;
|
||||
break;
|
||||
}
|
||||
|
||||
if (MinSpacingToSet < SecMinSpace)
|
||||
MinSpacingToSet = SecMinSpace;
|
||||
|
||||
MinSpacingToSet |=
|
||||
rtl8723au_read8(padapter, REG_AMPDU_MIN_SPACE) & 0xf8;
|
||||
rtl8723au_write8(padapter, REG_AMPDU_MIN_SPACE,
|
||||
MinSpacingToSet);
|
||||
}
|
||||
}
|
||||
|
||||
void rtl8723a_set_ampdu_factor(struct rtw_adapter *padapter, u8 FactorToSet)
|
||||
{
|
||||
u8 RegToSet_Normal[4] = { 0x41, 0xa8, 0x72, 0xb9 };
|
||||
u8 MaxAggNum;
|
||||
u8 *pRegToSet;
|
||||
u8 index = 0;
|
||||
|
||||
pRegToSet = RegToSet_Normal; /* 0xb972a841; */
|
||||
|
||||
if (rtl8723a_BT_enabled(padapter) &&
|
||||
rtl8723a_BT_using_antenna_1(padapter))
|
||||
MaxAggNum = 0x8;
|
||||
else
|
||||
MaxAggNum = 0xF;
|
||||
|
||||
if (FactorToSet <= 3) {
|
||||
FactorToSet = 1 << (FactorToSet + 2);
|
||||
if (FactorToSet > MaxAggNum)
|
||||
FactorToSet = MaxAggNum;
|
||||
|
||||
for (index = 0; index < 4; index++) {
|
||||
if ((pRegToSet[index] & 0xf0) > (FactorToSet << 4))
|
||||
pRegToSet[index] = (pRegToSet[index] & 0x0f) |
|
||||
(FactorToSet << 4);
|
||||
|
||||
if ((pRegToSet[index] & 0x0f) > FactorToSet)
|
||||
pRegToSet[index] = (pRegToSet[index] & 0xf0) |
|
||||
FactorToSet;
|
||||
|
||||
rtl8723au_write8(padapter, REG_AGGLEN_LMT + index,
|
||||
pRegToSet[index]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void rtl8723a_set_acm_ctrl(struct rtw_adapter *padapter, u8 ctrl)
|
||||
{
|
||||
u8 hwctrl = 0;
|
||||
|
||||
if (ctrl != 0) {
|
||||
hwctrl |= AcmHw_HwEn;
|
||||
|
||||
if (ctrl & BIT(1)) /* BE */
|
||||
hwctrl |= AcmHw_BeqEn;
|
||||
|
||||
if (ctrl & BIT(2)) /* VI */
|
||||
hwctrl |= AcmHw_ViqEn;
|
||||
|
||||
if (ctrl & BIT(3)) /* VO */
|
||||
hwctrl |= AcmHw_VoqEn;
|
||||
}
|
||||
|
||||
DBG_8723A("[HW_VAR_ACM_CTRL] Write 0x%02X\n", hwctrl);
|
||||
rtl8723au_write8(padapter, REG_ACMHWCTRL, hwctrl);
|
||||
}
|
||||
|
||||
void rtl8723a_set_media_status(struct rtw_adapter *padapter, u8 status)
|
||||
{
|
||||
u8 val8;
|
||||
|
||||
val8 = rtl8723au_read8(padapter, MSR) & 0x0c;
|
||||
val8 |= status;
|
||||
rtl8723au_write8(padapter, MSR, val8);
|
||||
}
|
||||
|
||||
void rtl8723a_set_media_status1(struct rtw_adapter *padapter, u8 status)
|
||||
{
|
||||
u8 val8;
|
||||
|
||||
val8 = rtl8723au_read8(padapter, MSR) & 0x03;
|
||||
val8 |= status << 2;
|
||||
rtl8723au_write8(padapter, MSR, val8);
|
||||
}
|
||||
|
||||
void rtl8723a_set_bcn_func(struct rtw_adapter *padapter, u8 val)
|
||||
{
|
||||
if (val)
|
||||
SetBcnCtrlReg23a(padapter, EN_BCN_FUNCTION | EN_TXBCN_RPT, 0);
|
||||
else
|
||||
SetBcnCtrlReg23a(padapter, 0, EN_BCN_FUNCTION | EN_TXBCN_RPT);
|
||||
}
|
||||
|
||||
void rtl8723a_check_bssid(struct rtw_adapter *padapter, u8 val)
|
||||
{
|
||||
u32 val32;
|
||||
|
||||
val32 = rtl8723au_read32(padapter, REG_RCR);
|
||||
if (val)
|
||||
val32 |= RCR_CBSSID_DATA | RCR_CBSSID_BCN;
|
||||
else
|
||||
val32 &= ~(RCR_CBSSID_DATA | RCR_CBSSID_BCN);
|
||||
rtl8723au_write32(padapter, REG_RCR, val32);
|
||||
}
|
||||
|
||||
void rtl8723a_mlme_sitesurvey(struct rtw_adapter *padapter, u8 flag)
|
||||
{
|
||||
if (flag) { /* under sitesurvey */
|
||||
u32 v32;
|
||||
|
||||
/* config RCR to receive different BSSID & not
|
||||
to receive data frame */
|
||||
v32 = rtl8723au_read32(padapter, REG_RCR);
|
||||
v32 &= ~(RCR_CBSSID_BCN);
|
||||
rtl8723au_write32(padapter, REG_RCR, v32);
|
||||
/* reject all data frame */
|
||||
rtl8723au_write16(padapter, REG_RXFLTMAP2, 0);
|
||||
|
||||
/* disable update TSF */
|
||||
SetBcnCtrlReg23a(padapter, DIS_TSF_UDT, 0);
|
||||
} else { /* sitesurvey done */
|
||||
|
||||
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
|
||||
struct mlme_ext_info *pmlmeinfo;
|
||||
u32 v32;
|
||||
|
||||
pmlmeinfo = &pmlmeext->mlmext_info;
|
||||
|
||||
if ((is_client_associated_to_ap23a(padapter) == true) ||
|
||||
((pmlmeinfo->state & 0x03) == MSR_ADHOC) ||
|
||||
((pmlmeinfo->state & 0x03) == MSR_AP)) {
|
||||
/* enable to rx data frame */
|
||||
rtl8723au_write16(padapter, REG_RXFLTMAP2, 0xFFFF);
|
||||
|
||||
/* enable update TSF */
|
||||
SetBcnCtrlReg23a(padapter, 0, DIS_TSF_UDT);
|
||||
}
|
||||
|
||||
v32 = rtl8723au_read32(padapter, REG_RCR);
|
||||
v32 |= RCR_CBSSID_BCN;
|
||||
rtl8723au_write32(padapter, REG_RCR, v32);
|
||||
}
|
||||
|
||||
rtl8723a_BT_wifiscan_notify(padapter, flag ? true : false);
|
||||
}
|
||||
|
||||
void rtl8723a_on_rcr_am(struct rtw_adapter *padapter)
|
||||
{
|
||||
rtl8723au_write32(padapter, REG_RCR,
|
||||
rtl8723au_read32(padapter, REG_RCR) | RCR_AM);
|
||||
DBG_8723A("%s, %d, RCR = %x\n", __func__, __LINE__,
|
||||
rtl8723au_read32(padapter, REG_RCR));
|
||||
}
|
||||
|
||||
void rtl8723a_off_rcr_am(struct rtw_adapter *padapter)
|
||||
{
|
||||
rtl8723au_write32(padapter, REG_RCR,
|
||||
rtl8723au_read32(padapter, REG_RCR) & (~RCR_AM));
|
||||
DBG_8723A("%s, %d, RCR = %x\n", __func__, __LINE__,
|
||||
rtl8723au_read32(padapter, REG_RCR));
|
||||
}
|
||||
|
||||
void rtl8723a_set_slot_time(struct rtw_adapter *padapter, u8 slottime)
|
||||
{
|
||||
u8 u1bAIFS, aSifsTime;
|
||||
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
|
||||
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
|
||||
|
||||
rtl8723au_write8(padapter, REG_SLOT, slottime);
|
||||
|
||||
if (pmlmeinfo->WMM_enable == 0) {
|
||||
if (pmlmeext->cur_wireless_mode == WIRELESS_11B)
|
||||
aSifsTime = 10;
|
||||
else
|
||||
aSifsTime = 16;
|
||||
|
||||
u1bAIFS = aSifsTime + (2 * pmlmeinfo->slotTime);
|
||||
|
||||
/* <Roger_EXP> Temporary removed, 2008.06.20. */
|
||||
rtl8723au_write8(padapter, REG_EDCA_VO_PARAM, u1bAIFS);
|
||||
rtl8723au_write8(padapter, REG_EDCA_VI_PARAM, u1bAIFS);
|
||||
rtl8723au_write8(padapter, REG_EDCA_BE_PARAM, u1bAIFS);
|
||||
rtl8723au_write8(padapter, REG_EDCA_BK_PARAM, u1bAIFS);
|
||||
}
|
||||
}
|
||||
|
||||
void rtl8723a_ack_preamble(struct rtw_adapter *padapter, u8 bShortPreamble)
|
||||
{
|
||||
struct hal_data_8723a *pHalData = GET_HAL_DATA(padapter);
|
||||
u8 regTmp;
|
||||
|
||||
/* Joseph marked out for Netgear 3500 TKIP
|
||||
channel 7 issue.(Temporarily) */
|
||||
regTmp = (pHalData->nCur40MhzPrimeSC) << 5;
|
||||
/* regTmp = 0; */
|
||||
if (bShortPreamble)
|
||||
regTmp |= 0x80;
|
||||
rtl8723au_write8(padapter, REG_RRSR + 2, regTmp);
|
||||
}
|
||||
|
||||
void rtl8723a_set_sec_cfg(struct rtw_adapter *padapter, u8 sec)
|
||||
{
|
||||
rtl8723au_write8(padapter, REG_SECCFG, sec);
|
||||
}
|
||||
|
||||
void rtl8723a_cam_empty_entry(struct rtw_adapter *padapter, u8 ucIndex)
|
||||
{
|
||||
u8 i;
|
||||
u32 ulCommand = 0;
|
||||
u32 ulContent = 0;
|
||||
u32 ulEncAlgo = CAM_AES;
|
||||
|
||||
for (i = 0; i < CAM_CONTENT_COUNT; i++) {
|
||||
/* filled id in CAM config 2 byte */
|
||||
if (i == 0) {
|
||||
ulContent |= (ucIndex & 0x03) |
|
||||
((u16) (ulEncAlgo) << 2);
|
||||
/* ulContent |= CAM_VALID; */
|
||||
} else {
|
||||
ulContent = 0;
|
||||
}
|
||||
/* polling bit, and No Write enable, and address */
|
||||
ulCommand = CAM_CONTENT_COUNT * ucIndex + i;
|
||||
ulCommand = ulCommand | CAM_POLLINIG | CAM_WRITE;
|
||||
/* write content 0 is equall to mark invalid */
|
||||
/* delay_ms(40); */
|
||||
rtl8723au_write32(padapter, WCAMI, ulContent);
|
||||
/* delay_ms(40); */
|
||||
rtl8723au_write32(padapter, REG_CAMCMD, ulCommand);
|
||||
}
|
||||
}
|
||||
|
||||
void rtl8723a_cam_invalidate_all(struct rtw_adapter *padapter)
|
||||
{
|
||||
rtl8723au_write32(padapter, REG_CAMCMD, CAM_POLLINIG | BIT(30));
|
||||
}
|
||||
|
||||
void rtl8723a_cam_write(struct rtw_adapter *padapter,
|
||||
u8 entry, u16 ctrl, const u8 *mac, const u8 *key)
|
||||
{
|
||||
u32 cmd;
|
||||
unsigned int i, val, addr;
|
||||
int j;
|
||||
|
||||
addr = entry << 3;
|
||||
|
||||
for (j = 5; j >= 0; j--) {
|
||||
switch (j) {
|
||||
case 0:
|
||||
val = ctrl | (mac[0] << 16) | (mac[1] << 24);
|
||||
break;
|
||||
case 1:
|
||||
val = mac[2] | (mac[3] << 8) |
|
||||
(mac[4] << 16) | (mac[5] << 24);
|
||||
break;
|
||||
default:
|
||||
i = (j - 2) << 2;
|
||||
val = key[i] | (key[i+1] << 8) |
|
||||
(key[i+2] << 16) | (key[i+3] << 24);
|
||||
break;
|
||||
}
|
||||
|
||||
rtl8723au_write32(padapter, WCAMI, val);
|
||||
cmd = CAM_POLLINIG | CAM_WRITE | (addr + j);
|
||||
rtl8723au_write32(padapter, REG_CAMCMD, cmd);
|
||||
|
||||
/* DBG_8723A("%s => cam write: %x, %x\n", __func__, cmd, val);*/
|
||||
}
|
||||
}
|
||||
|
||||
void rtl8723a_fifo_cleanup(struct rtw_adapter *padapter)
|
||||
{
|
||||
#define RW_RELEASE_EN BIT(18)
|
||||
#define RXDMA_IDLE BIT(17)
|
||||
|
||||
struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv;
|
||||
u8 trycnt = 100;
|
||||
|
||||
/* pause tx */
|
||||
rtl8723au_write8(padapter, REG_TXPAUSE, 0xff);
|
||||
|
||||
/* keep sn */
|
||||
padapter->xmitpriv.nqos_ssn = rtl8723au_read8(padapter, REG_NQOS_SEQ);
|
||||
|
||||
if (pwrpriv->bkeepfwalive != true) {
|
||||
u32 v32;
|
||||
|
||||
/* RX DMA stop */
|
||||
v32 = rtl8723au_read32(padapter, REG_RXPKT_NUM);
|
||||
v32 |= RW_RELEASE_EN;
|
||||
rtl8723au_write32(padapter, REG_RXPKT_NUM, v32);
|
||||
do {
|
||||
v32 = rtl8723au_read32(padapter,
|
||||
REG_RXPKT_NUM) & RXDMA_IDLE;
|
||||
if (!v32)
|
||||
break;
|
||||
} while (trycnt--);
|
||||
if (trycnt == 0)
|
||||
DBG_8723A("Stop RX DMA failed......\n");
|
||||
|
||||
/* RQPN Load 0 */
|
||||
rtl8723au_write16(padapter, REG_RQPN_NPQ, 0);
|
||||
rtl8723au_write32(padapter, REG_RQPN, 0x80000000);
|
||||
mdelay(10);
|
||||
}
|
||||
}
|
||||
|
||||
void rtl8723a_bcn_valid(struct rtw_adapter *padapter)
|
||||
{
|
||||
/* BCN_VALID, BIT16 of REG_TDECTRL = BIT0 of REG_TDECTRL+2,
|
||||
write 1 to clear, Clear by sw */
|
||||
rtl8723au_write8(padapter, REG_TDECTRL + 2,
|
||||
rtl8723au_read8(padapter, REG_TDECTRL + 2) | BIT(0));
|
||||
}
|
||||
|
||||
bool rtl8723a_get_bcn_valid(struct rtw_adapter *padapter)
|
||||
{
|
||||
bool retval;
|
||||
|
||||
retval = (rtl8723au_read8(padapter, REG_TDECTRL + 2) & BIT(0)) ? true : false;
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
void rtl8723a_set_beacon_interval(struct rtw_adapter *padapter, u16 interval)
|
||||
{
|
||||
rtl8723au_write16(padapter, REG_BCN_INTERVAL, interval);
|
||||
}
|
||||
|
||||
void rtl8723a_set_resp_sifs(struct rtw_adapter *padapter,
|
||||
u8 r2t1, u8 r2t2, u8 t2t1, u8 t2t2)
|
||||
{
|
||||
/* SIFS_Timer = 0x0a0a0808; */
|
||||
/* RESP_SIFS for CCK */
|
||||
/* SIFS_T2T_CCK (0x08) */
|
||||
rtl8723au_write8(padapter, REG_R2T_SIFS, r2t1);
|
||||
/* SIFS_R2T_CCK(0x08) */
|
||||
rtl8723au_write8(padapter, REG_R2T_SIFS + 1, r2t2);
|
||||
/* RESP_SIFS for OFDM */
|
||||
/* SIFS_T2T_OFDM (0x0a) */
|
||||
rtl8723au_write8(padapter, REG_T2T_SIFS, t2t1);
|
||||
/* SIFS_R2T_OFDM(0x0a) */
|
||||
rtl8723au_write8(padapter, REG_T2T_SIFS + 1, t2t2);
|
||||
}
|
||||
|
||||
void rtl8723a_set_ac_param_vo(struct rtw_adapter *padapter, u32 vo)
|
||||
{
|
||||
rtl8723au_write32(padapter, REG_EDCA_VO_PARAM, vo);
|
||||
}
|
||||
|
||||
void rtl8723a_set_ac_param_vi(struct rtw_adapter *padapter, u32 vi)
|
||||
{
|
||||
rtl8723au_write32(padapter, REG_EDCA_VI_PARAM, vi);
|
||||
}
|
||||
|
||||
void rtl8723a_set_ac_param_be(struct rtw_adapter *padapter, u32 be)
|
||||
{
|
||||
struct hal_data_8723a *pHalData = GET_HAL_DATA(padapter);
|
||||
|
||||
pHalData->AcParam_BE = be;
|
||||
rtl8723au_write32(padapter, REG_EDCA_BE_PARAM, be);
|
||||
}
|
||||
|
||||
void rtl8723a_set_ac_param_bk(struct rtw_adapter *padapter, u32 bk)
|
||||
{
|
||||
rtl8723au_write32(padapter, REG_EDCA_BK_PARAM, bk);
|
||||
}
|
||||
|
||||
void rtl8723a_set_rxdma_agg_pg_th(struct rtw_adapter *padapter, u8 val)
|
||||
{
|
||||
rtl8723au_write8(padapter, REG_RXDMA_AGG_PG_TH, val);
|
||||
}
|
||||
|
||||
void rtl8723a_set_initial_gain(struct rtw_adapter *padapter, u32 rx_gain)
|
||||
{
|
||||
struct hal_data_8723a *pHalData = GET_HAL_DATA(padapter);
|
||||
struct dig_t *pDigTable = &pHalData->odmpriv.DM_DigTable;
|
||||
|
||||
if (rx_gain == 0xff) /* restore rx gain */
|
||||
ODM_Write_DIG23a(&pHalData->odmpriv, pDigTable->BackupIGValue);
|
||||
else {
|
||||
pDigTable->BackupIGValue = pDigTable->CurIGValue;
|
||||
ODM_Write_DIG23a(&pHalData->odmpriv, rx_gain);
|
||||
}
|
||||
}
|
||||
|
||||
void rtl8723a_odm_support_ability_restore(struct rtw_adapter *padapter)
|
||||
{
|
||||
struct hal_data_8723a *pHalData = GET_HAL_DATA(padapter);
|
||||
|
||||
pHalData->odmpriv.SupportAbility = pHalData->odmpriv.BK_SupportAbility;
|
||||
}
|
||||
|
||||
void rtl8723a_odm_support_ability_backup(struct rtw_adapter *padapter)
|
||||
{
|
||||
struct hal_data_8723a *pHalData = GET_HAL_DATA(padapter);
|
||||
|
||||
pHalData->odmpriv.BK_SupportAbility = pHalData->odmpriv.SupportAbility;
|
||||
}
|
||||
|
||||
void rtl8723a_odm_support_ability_set(struct rtw_adapter *padapter, u32 val)
|
||||
{
|
||||
struct hal_data_8723a *pHalData = GET_HAL_DATA(padapter);
|
||||
|
||||
if (val == DYNAMIC_ALL_FUNC_ENABLE)
|
||||
pHalData->odmpriv.SupportAbility = pHalData->dmpriv.InitODMFlag;
|
||||
else
|
||||
pHalData->odmpriv.SupportAbility |= val;
|
||||
}
|
||||
|
||||
void rtl8723a_odm_support_ability_clr(struct rtw_adapter *padapter, u32 val)
|
||||
{
|
||||
struct hal_data_8723a *pHalData = GET_HAL_DATA(padapter);
|
||||
|
||||
pHalData->odmpriv.SupportAbility &= val;
|
||||
}
|
||||
|
||||
void rtl8723a_set_rpwm(struct rtw_adapter *padapter, u8 val)
|
||||
{
|
||||
rtl8723au_write8(padapter, REG_USB_HRPWM, val);
|
||||
}
|
||||
|
||||
u8 rtl8723a_get_rf_type(struct rtw_adapter *padapter)
|
||||
{
|
||||
struct hal_data_8723a *pHalData = GET_HAL_DATA(padapter);
|
||||
|
||||
return pHalData->rf_type;
|
||||
}
|
||||
|
||||
bool rtl8723a_get_fwlps_rf_on(struct rtw_adapter *padapter)
|
||||
{
|
||||
bool retval;
|
||||
u32 valRCR;
|
||||
|
||||
/* When we halt NIC, we should check if FW LPS is leave. */
|
||||
|
||||
if ((padapter->bSurpriseRemoved == true) ||
|
||||
(padapter->pwrctrlpriv.rf_pwrstate == rf_off)) {
|
||||
/* If it is in HW/SW Radio OFF or IPS state, we do
|
||||
not check Fw LPS Leave, because Fw is unload. */
|
||||
retval = true;
|
||||
} else {
|
||||
valRCR = rtl8723au_read32(padapter, REG_RCR);
|
||||
if (valRCR & 0x00070000)
|
||||
retval = false;
|
||||
else
|
||||
retval = true;
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
bool rtl8723a_chk_hi_queue_empty(struct rtw_adapter *padapter)
|
||||
{
|
||||
u32 hgq;
|
||||
|
||||
hgq = rtl8723au_read32(padapter, REG_HGQ_INFORMATION);
|
||||
|
||||
return ((hgq & 0x0000ff00) == 0) ? true : false;
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#define _HAL_INTF_C_
|
||||
#include <osdep_service.h>
|
||||
#include <drv_types.h>
|
||||
|
||||
#include <hal_intf.h>
|
||||
|
||||
#include <rtl8723a_hal.h>
|
||||
|
||||
void rtw_hal_update_ra_mask23a(struct sta_info *psta, u8 rssi_level)
|
||||
{
|
||||
struct rtw_adapter *padapter;
|
||||
struct mlme_priv *pmlmepriv;
|
||||
|
||||
if (!psta)
|
||||
return;
|
||||
|
||||
padapter = psta->padapter;
|
||||
|
||||
pmlmepriv = &padapter->mlmepriv;
|
||||
|
||||
if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) {
|
||||
#ifdef CONFIG_8723AU_AP_MODE
|
||||
add_RATid23a(padapter, psta, rssi_level);
|
||||
#endif
|
||||
} else
|
||||
rtl8723a_update_ramask(padapter, psta->mac_id, rssi_level);
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -1,396 +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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/* */
|
||||
/* include files */
|
||||
/* */
|
||||
|
||||
#include "odm_precomp.h"
|
||||
|
||||
static u8 odm_QueryRxPwrPercentage(s8 AntPower)
|
||||
{
|
||||
if ((AntPower <= -100) || (AntPower >= 20))
|
||||
return 0;
|
||||
else if (AntPower >= 0)
|
||||
return 100;
|
||||
else
|
||||
return 100 + AntPower;
|
||||
}
|
||||
|
||||
static s32 odm_SignalScaleMapping_92CSeries(struct dm_odm_t *pDM_Odm, s32 CurrSig)
|
||||
{
|
||||
s32 RetSig = 0;
|
||||
|
||||
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;
|
||||
|
||||
return RetSig;
|
||||
}
|
||||
|
||||
static s32 odm_SignalScaleMapping(struct dm_odm_t *pDM_Odm, s32 CurrSig)
|
||||
{
|
||||
return odm_SignalScaleMapping_92CSeries(pDM_Odm, CurrSig);
|
||||
}
|
||||
|
||||
static u8
|
||||
odm_EVMdbToPercentage(
|
||||
s8 Value
|
||||
)
|
||||
{
|
||||
/* */
|
||||
/* -33dB~0dB to 0%~99% */
|
||||
/* */
|
||||
s8 ret_val;
|
||||
|
||||
ret_val = Value;
|
||||
|
||||
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(struct dm_odm_t *pDM_Odm,
|
||||
struct phy_info *pPhyInfo,
|
||||
u8 *pPhyStatus,
|
||||
struct odm_packet_info *pPktinfo)
|
||||
{
|
||||
struct phy_status_rpt *pPhyStaRpt = (struct phy_status_rpt *)pPhyStatus;
|
||||
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;
|
||||
|
||||
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;
|
||||
|
||||
/* The RSSI formula should be modified according to the gain table */
|
||||
if (!cck_highpwr) {
|
||||
report = (cck_agc_rpt & 0xc0)>>6;
|
||||
switch (report) {
|
||||
/* 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 = (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_HIGHPWR) {
|
||||
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 { /* 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;
|
||||
|
||||
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;
|
||||
|
||||
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;
|
||||
|
||||
/* Modification for ext-LNA board */
|
||||
if (pDM_Odm->BoardType == ODM_BOARD_HIGHPWR) {
|
||||
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 = odm_QueryRxPwrPercentage(rx_pwr_all);
|
||||
PWDB_ALL_BT = PWDB_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 */
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
static void odm_Process_RSSIForDM(struct dm_odm_t *pDM_Odm,
|
||||
struct phy_info *pPhyInfo,
|
||||
struct odm_packet_info *pPktinfo)
|
||||
{
|
||||
s32 UndecoratedSmoothedPWDB, UndecoratedSmoothedCCK;
|
||||
s32 UndecoratedSmoothedOFDM, RSSI_Ave;
|
||||
u8 isCCKrate = 0;
|
||||
u8 RSSI_max, RSSI_min, i;
|
||||
u32 OFDM_pkt = 0;
|
||||
u32 Weighting = 0;
|
||||
struct sta_info *pEntry;
|
||||
|
||||
if (pPktinfo->StationID == 0xFF)
|
||||
return;
|
||||
|
||||
pEntry = pDM_Odm->pODM_StaInfo[pPktinfo->StationID];
|
||||
if (!pEntry)
|
||||
return;
|
||||
if ((!pPktinfo->bPacketMatchBSSID))
|
||||
return;
|
||||
|
||||
isCCKrate = (pPktinfo->Rate <= DESC92C_RATE11M) ? true : false;
|
||||
|
||||
/* 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];
|
||||
} else {
|
||||
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) | BIT(0);
|
||||
} else {
|
||||
RSSI_Ave = pPhyInfo->RxPWDBAll;
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
/* 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) & BIT(0);
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
void ODM_PhyStatusQuery23a(struct dm_odm_t *pDM_Odm, struct phy_info *pPhyInfo,
|
||||
u8 *pPhyStatus, struct odm_packet_info *pPktinfo)
|
||||
{
|
||||
odm_RxPhyStatus92CSeries_Parsing(pDM_Odm, pPhyInfo,
|
||||
pPhyStatus, pPktinfo);
|
||||
|
||||
odm_Process_RSSIForDM(pDM_Odm, pPhyInfo, pPktinfo);
|
||||
}
|
|
@ -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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#include "odm_precomp.h"
|
||||
#include "usb_ops_linux.h"
|
||||
|
||||
void
|
||||
odm_ConfigRFReg_8723A(
|
||||
struct dm_odm_t *pDM_Odm,
|
||||
u32 Addr,
|
||||
u32 Data,
|
||||
enum RF_RADIO_PATH RF_PATH,
|
||||
u32 RegAddr
|
||||
)
|
||||
{
|
||||
if (Addr == 0xfe) {
|
||||
msleep(50);
|
||||
} else if (Addr == 0xfd) {
|
||||
mdelay(5);
|
||||
} else if (Addr == 0xfc) {
|
||||
mdelay(1);
|
||||
} else if (Addr == 0xfb) {
|
||||
udelay(50);
|
||||
} else if (Addr == 0xfa) {
|
||||
udelay(5);
|
||||
} else if (Addr == 0xf9) {
|
||||
udelay(1);
|
||||
} else {
|
||||
ODM_SetRFReg(pDM_Odm, RF_PATH, RegAddr, bRFRegOffsetMask, Data);
|
||||
/* Add 1us delay between BB/RF register setting. */
|
||||
udelay(1);
|
||||
}
|
||||
}
|
||||
|
||||
void odm_ConfigMAC_8723A(struct dm_odm_t *pDM_Odm, u32 addr, u8 data)
|
||||
{
|
||||
rtl8723au_write8(pDM_Odm->Adapter, addr, data);
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD,
|
||||
("===> %s: [MAC_REG] %08X %08X\n", __func__, addr, data));
|
||||
}
|
||||
|
||||
void odm_ConfigBB_AGC_8723A(struct dm_odm_t *pDM_Odm, u32 addr, u32 data)
|
||||
{
|
||||
rtl8723au_write32(pDM_Odm->Adapter, addr, data);
|
||||
/* Add 1us delay between BB/RF register setting. */
|
||||
udelay(1);
|
||||
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD,
|
||||
("===> %s: [AGC_TAB] %08X %08X\n", __func__, addr, data));
|
||||
}
|
||||
|
||||
void
|
||||
odm_ConfigBB_PHY_8723A(struct dm_odm_t *pDM_Odm, u32 addr, u32 data)
|
||||
{
|
||||
if (addr == 0xfe)
|
||||
msleep(50);
|
||||
else if (addr == 0xfd)
|
||||
mdelay(5);
|
||||
else if (addr == 0xfc)
|
||||
mdelay(1);
|
||||
else if (addr == 0xfb)
|
||||
udelay(50);
|
||||
else if (addr == 0xfa)
|
||||
udelay(5);
|
||||
else if (addr == 0xf9)
|
||||
udelay(1);
|
||||
else if (addr == 0xa24)
|
||||
pDM_Odm->RFCalibrateInfo.RegA24 = data;
|
||||
rtl8723au_write32(pDM_Odm->Adapter, addr, data);
|
||||
|
||||
/* Add 1us delay between BB/RF register setting. */
|
||||
udelay(1);
|
||||
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD,
|
||||
("===> %s: [PHY_REG] %08X %08X\n", __func__, addr, data));
|
||||
}
|
|
@ -1,39 +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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#include "odm_precomp.h"
|
||||
|
||||
void ODM_InitDebugSetting23a(struct dm_odm_t *pDM_Odm)
|
||||
{
|
||||
pDM_Odm->DebugLevel = ODM_DBG_TRACE;
|
||||
pDM_Odm->DebugComponents = 0;
|
||||
}
|
||||
|
||||
u32 GlobalDebugLevel23A;
|
||||
|
||||
void rt_trace(int comp, int level, const char *fmt, ...)
|
||||
{
|
||||
struct va_format vaf;
|
||||
va_list args;
|
||||
|
||||
va_start(args, fmt);
|
||||
|
||||
vaf.fmt = fmt;
|
||||
vaf.va = &args;
|
||||
|
||||
pr_info(DRIVER_PREFIX " [0x%08x,%d] %pV", comp, level, &vaf);
|
||||
|
||||
va_end(args);
|
||||
}
|
|
@ -1,49 +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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/* */
|
||||
/* include files */
|
||||
/* */
|
||||
|
||||
#include "odm_precomp.h"
|
||||
/* */
|
||||
/* ODM IO Relative API. */
|
||||
/* */
|
||||
#include <usb_ops_linux.h>
|
||||
|
||||
void ODM_SetRFReg(
|
||||
struct dm_odm_t *pDM_Odm,
|
||||
enum RF_RADIO_PATH eRFPath,
|
||||
u32 RegAddr,
|
||||
u32 BitMask,
|
||||
u32 Data
|
||||
)
|
||||
{
|
||||
struct rtw_adapter *Adapter = pDM_Odm->Adapter;
|
||||
|
||||
PHY_SetRFReg(Adapter, eRFPath, RegAddr, BitMask, Data);
|
||||
}
|
||||
|
||||
u32 ODM_GetRFReg(
|
||||
struct dm_odm_t *pDM_Odm,
|
||||
enum RF_RADIO_PATH eRFPath,
|
||||
u32 RegAddr,
|
||||
u32 BitMask
|
||||
)
|
||||
{
|
||||
struct rtw_adapter *Adapter = pDM_Odm->Adapter;
|
||||
|
||||
return PHY_QueryRFReg(Adapter, eRFPath, RegAddr, BitMask);
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -1,755 +0,0 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
#define _RTL8723A_CMD_C_
|
||||
|
||||
#include <osdep_service.h>
|
||||
#include <drv_types.h>
|
||||
#include <recv_osdep.h>
|
||||
#include <mlme_osdep.h>
|
||||
#include <rtl8723a_hal.h>
|
||||
#include <usb_ops_linux.h>
|
||||
|
||||
#define RTL92C_MAX_H2C_BOX_NUMS 4
|
||||
#define RTL92C_MAX_CMD_LEN 5
|
||||
#define MESSAGE_BOX_SIZE 4
|
||||
#define EX_MESSAGE_BOX_SIZE 2
|
||||
|
||||
static u8 _is_fw_read_cmd_down(struct rtw_adapter *padapter, u8 msgbox_num)
|
||||
{
|
||||
u8 read_down = false;
|
||||
int retry_cnts = 100;
|
||||
u8 valid;
|
||||
|
||||
do {
|
||||
valid = rtl8723au_read8(padapter, REG_HMETFR) & BIT(msgbox_num);
|
||||
if (0 == valid)
|
||||
read_down = true;
|
||||
} while ((!read_down) && (retry_cnts--));
|
||||
|
||||
return read_down;
|
||||
}
|
||||
|
||||
/*****************************************
|
||||
* H2C Msg format :
|
||||
*| 31 - 8 |7 | 6 - 0 |
|
||||
*| h2c_msg |Ext_bit |CMD_ID |
|
||||
*
|
||||
******************************************/
|
||||
int FillH2CCmd(struct rtw_adapter *padapter, u8 ElementID, u32 CmdLen,
|
||||
u8 *pCmdBuffer)
|
||||
{
|
||||
u8 bcmd_down = false;
|
||||
s32 retry_cnts = 100;
|
||||
u8 h2c_box_num;
|
||||
u32 msgbox_addr;
|
||||
u32 msgbox_ex_addr;
|
||||
struct hal_data_8723a *pHalData;
|
||||
u32 h2c_cmd = 0;
|
||||
u16 h2c_cmd_ex = 0;
|
||||
int ret = _FAIL;
|
||||
|
||||
padapter = GET_PRIMARY_ADAPTER(padapter);
|
||||
pHalData = GET_HAL_DATA(padapter);
|
||||
|
||||
mutex_lock(&adapter_to_dvobj(padapter)->h2c_fwcmd_mutex);
|
||||
|
||||
if (!pCmdBuffer)
|
||||
goto exit;
|
||||
if (CmdLen > RTL92C_MAX_CMD_LEN)
|
||||
goto exit;
|
||||
if (padapter->bSurpriseRemoved == true)
|
||||
goto exit;
|
||||
|
||||
/* pay attention to if race condition happened in H2C cmd setting. */
|
||||
do {
|
||||
h2c_box_num = pHalData->LastHMEBoxNum;
|
||||
|
||||
if (!_is_fw_read_cmd_down(padapter, h2c_box_num)) {
|
||||
DBG_8723A(" fw read cmd failed...\n");
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (CmdLen <= 3) {
|
||||
memcpy((u8 *)(&h2c_cmd)+1, pCmdBuffer, CmdLen);
|
||||
} else {
|
||||
memcpy((u8 *)(&h2c_cmd_ex), pCmdBuffer, EX_MESSAGE_BOX_SIZE);
|
||||
memcpy((u8 *)(&h2c_cmd)+1, pCmdBuffer+2, (CmdLen-EX_MESSAGE_BOX_SIZE));
|
||||
*(u8 *)(&h2c_cmd) |= BIT(7);
|
||||
}
|
||||
|
||||
*(u8 *)(&h2c_cmd) |= ElementID;
|
||||
|
||||
if (h2c_cmd & BIT(7)) {
|
||||
msgbox_ex_addr = REG_HMEBOX_EXT_0 + (h2c_box_num * EX_MESSAGE_BOX_SIZE);
|
||||
h2c_cmd_ex = le16_to_cpu(h2c_cmd_ex);
|
||||
rtl8723au_write16(padapter, msgbox_ex_addr, h2c_cmd_ex);
|
||||
}
|
||||
msgbox_addr = REG_HMEBOX_0 + (h2c_box_num * MESSAGE_BOX_SIZE);
|
||||
h2c_cmd = le32_to_cpu(h2c_cmd);
|
||||
rtl8723au_write32(padapter, msgbox_addr, h2c_cmd);
|
||||
|
||||
bcmd_down = true;
|
||||
|
||||
pHalData->LastHMEBoxNum = (h2c_box_num+1) % RTL92C_MAX_H2C_BOX_NUMS;
|
||||
|
||||
} while ((!bcmd_down) && (retry_cnts--));
|
||||
|
||||
ret = _SUCCESS;
|
||||
|
||||
exit:
|
||||
mutex_unlock(&adapter_to_dvobj(padapter)->h2c_fwcmd_mutex);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int rtl8723a_set_rssi_cmd(struct rtw_adapter *padapter, u32 param)
|
||||
{
|
||||
__le32 cmd = cpu_to_le32(param);
|
||||
|
||||
FillH2CCmd(padapter, RSSI_SETTING_EID, 3, (void *)&cmd);
|
||||
|
||||
return _SUCCESS;
|
||||
}
|
||||
|
||||
int rtl8723a_set_raid_cmd(struct rtw_adapter *padapter, u32 mask, u8 arg)
|
||||
{
|
||||
u8 buf[5];
|
||||
|
||||
memset(buf, 0, 5);
|
||||
put_unaligned_le32(mask, buf);
|
||||
buf[4] = arg;
|
||||
|
||||
FillH2CCmd(padapter, MACID_CONFIG_EID, 5, buf);
|
||||
|
||||
return _SUCCESS;
|
||||
}
|
||||
|
||||
/* bitmap[0:27] = tx_rate_bitmap */
|
||||
/* bitmap[28:31]= Rate Adaptive id */
|
||||
/* arg[0:4] = macid */
|
||||
/* arg[5] = Short GI */
|
||||
void rtl8723a_add_rateatid(struct rtw_adapter *pAdapter, u32 bitmap, u8 arg, u8 rssi_level)
|
||||
{
|
||||
struct hal_data_8723a *pHalData = GET_HAL_DATA(pAdapter);
|
||||
u8 macid = arg & 0x1f;
|
||||
u32 raid = bitmap & 0xf0000000;
|
||||
|
||||
bitmap &= 0x0fffffff;
|
||||
if (rssi_level != DM_RATR_STA_INIT)
|
||||
bitmap = ODM_Get_Rate_Bitmap23a(pHalData, macid, bitmap,
|
||||
rssi_level);
|
||||
|
||||
bitmap |= raid;
|
||||
|
||||
rtl8723a_set_raid_cmd(pAdapter, bitmap, arg);
|
||||
}
|
||||
|
||||
void rtl8723a_set_FwPwrMode_cmd(struct rtw_adapter *padapter, u8 Mode)
|
||||
{
|
||||
struct setpwrmode_parm H2CSetPwrMode;
|
||||
struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv;
|
||||
struct hal_data_8723a *pHalData = GET_HAL_DATA(padapter);
|
||||
|
||||
DBG_8723A("%s: Mode =%d SmartPS =%d UAPSD =%d BcnMode = 0x%02x\n", __func__,
|
||||
Mode, pwrpriv->smart_ps, padapter->registrypriv.uapsd_enable, pwrpriv->bcn_ant_mode);
|
||||
|
||||
/* Forece leave RF low power mode for 1T1R to
|
||||
prevent conficting setting in Fw power */
|
||||
/* saving sequence. 2010.06.07. Added by tynli.
|
||||
Suggested by SD3 yschang. */
|
||||
if (Mode != PS_MODE_ACTIVE && pHalData->rf_type != RF_2T2R)
|
||||
ODM_RF_Saving23a(&pHalData->odmpriv, true);
|
||||
|
||||
H2CSetPwrMode.Mode = Mode;
|
||||
H2CSetPwrMode.SmartPS = pwrpriv->smart_ps;
|
||||
H2CSetPwrMode.AwakeInterval = 1;
|
||||
H2CSetPwrMode.bAllQueueUAPSD = padapter->registrypriv.uapsd_enable;
|
||||
H2CSetPwrMode.BcnAntMode = pwrpriv->bcn_ant_mode;
|
||||
|
||||
FillH2CCmd(padapter, SET_PWRMODE_EID, sizeof(H2CSetPwrMode), (u8 *)&H2CSetPwrMode);
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
ConstructBeacon(struct rtw_adapter *padapter, u8 *pframe, u32 *pLength)
|
||||
{
|
||||
struct ieee80211_mgmt *mgmt;
|
||||
u32 rate_len, pktlen;
|
||||
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
|
||||
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
|
||||
struct wlan_bssid_ex *cur_network = &pmlmeinfo->network;
|
||||
u8 bc_addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
|
||||
|
||||
/* DBG_8723A("%s\n", __func__); */
|
||||
|
||||
mgmt = (struct ieee80211_mgmt *)pframe;
|
||||
|
||||
mgmt->frame_control =
|
||||
cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_BEACON);
|
||||
|
||||
ether_addr_copy(mgmt->da, bc_addr);
|
||||
ether_addr_copy(mgmt->sa, myid(&padapter->eeprompriv));
|
||||
ether_addr_copy(mgmt->bssid, get_my_bssid23a(cur_network));
|
||||
|
||||
/* A Beacon frame shouldn't have fragment bits set */
|
||||
mgmt->seq_ctrl = 0;
|
||||
|
||||
/* timestamp will be inserted by hardware */
|
||||
|
||||
put_unaligned_le16(cur_network->beacon_interval,
|
||||
&mgmt->u.beacon.beacon_int);
|
||||
|
||||
put_unaligned_le16(cur_network->capability,
|
||||
&mgmt->u.beacon.capab_info);
|
||||
|
||||
pframe = mgmt->u.beacon.variable;
|
||||
pktlen = offsetof(struct ieee80211_mgmt, u.beacon.variable);
|
||||
|
||||
if ((pmlmeinfo->state&0x03) == MSR_AP) {
|
||||
/* DBG_8723A("ie len =%d\n", cur_network->IELength); */
|
||||
pktlen += cur_network->IELength;
|
||||
memcpy(pframe, cur_network->IEs, pktlen);
|
||||
|
||||
goto _ConstructBeacon;
|
||||
}
|
||||
|
||||
/* below for ad-hoc mode */
|
||||
|
||||
/* SSID */
|
||||
pframe = rtw_set_ie23a(pframe, WLAN_EID_SSID,
|
||||
cur_network->Ssid.ssid_len,
|
||||
cur_network->Ssid.ssid, &pktlen);
|
||||
|
||||
/* supported rates... */
|
||||
rate_len = rtw_get_rateset_len23a(cur_network->SupportedRates);
|
||||
pframe = rtw_set_ie23a(pframe, WLAN_EID_SUPP_RATES, ((rate_len > 8) ?
|
||||
8 : rate_len), cur_network->SupportedRates, &pktlen);
|
||||
|
||||
/* DS parameter set */
|
||||
pframe = rtw_set_ie23a(pframe, WLAN_EID_DS_PARAMS, 1, (unsigned char *)
|
||||
&cur_network->DSConfig, &pktlen);
|
||||
|
||||
if ((pmlmeinfo->state&0x03) == MSR_ADHOC) {
|
||||
u32 ATIMWindow;
|
||||
/* IBSS Parameter Set... */
|
||||
/* ATIMWindow = cur->ATIMWindow; */
|
||||
ATIMWindow = 0;
|
||||
pframe = rtw_set_ie23a(pframe, WLAN_EID_IBSS_PARAMS, 2,
|
||||
(unsigned char *)&ATIMWindow, &pktlen);
|
||||
}
|
||||
|
||||
/* todo: ERP IE */
|
||||
|
||||
/* EXTERNDED SUPPORTED RATE */
|
||||
if (rate_len > 8)
|
||||
pframe = rtw_set_ie23a(pframe, WLAN_EID_EXT_SUPP_RATES,
|
||||
(rate_len - 8),
|
||||
(cur_network->SupportedRates + 8),
|
||||
&pktlen);
|
||||
|
||||
/* todo:HT for adhoc */
|
||||
|
||||
_ConstructBeacon:
|
||||
|
||||
if ((pktlen + TXDESC_SIZE) > 512) {
|
||||
DBG_8723A("beacon frame too large\n");
|
||||
return;
|
||||
}
|
||||
|
||||
*pLength = pktlen;
|
||||
|
||||
/* DBG_8723A("%s bcn_sz =%d\n", __func__, pktlen); */
|
||||
|
||||
}
|
||||
|
||||
static void ConstructPSPoll(struct rtw_adapter *padapter,
|
||||
u8 *pframe, u32 *pLength)
|
||||
{
|
||||
struct ieee80211_hdr *pwlanhdr;
|
||||
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
|
||||
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
|
||||
|
||||
pwlanhdr = (struct ieee80211_hdr *)pframe;
|
||||
|
||||
/* Frame control. */
|
||||
pwlanhdr->frame_control =
|
||||
cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_PSPOLL);
|
||||
pwlanhdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PM);
|
||||
|
||||
/* AID. */
|
||||
pwlanhdr->duration_id = cpu_to_le16(pmlmeinfo->aid | 0xc000);
|
||||
|
||||
/* BSSID. */
|
||||
memcpy(pwlanhdr->addr1, get_my_bssid23a(&pmlmeinfo->network), ETH_ALEN);
|
||||
|
||||
/* TA. */
|
||||
memcpy(pwlanhdr->addr2, myid(&padapter->eeprompriv), ETH_ALEN);
|
||||
|
||||
*pLength = 16;
|
||||
}
|
||||
|
||||
static void
|
||||
ConstructNullFunctionData(struct rtw_adapter *padapter, u8 *pframe,
|
||||
u32 *pLength, u8 *StaAddr, u8 bQoS, u8 AC,
|
||||
u8 bEosp, u8 bForcePowerSave)
|
||||
{
|
||||
struct ieee80211_hdr *pwlanhdr;
|
||||
u32 pktlen;
|
||||
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
||||
struct wlan_network *cur_network = &pmlmepriv->cur_network;
|
||||
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
|
||||
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
|
||||
|
||||
pwlanhdr = (struct ieee80211_hdr *)pframe;
|
||||
|
||||
pwlanhdr->frame_control = 0;
|
||||
pwlanhdr->seq_ctrl = 0;
|
||||
|
||||
if (bForcePowerSave)
|
||||
pwlanhdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PM);
|
||||
|
||||
switch (cur_network->network.ifmode) {
|
||||
case NL80211_IFTYPE_P2P_CLIENT:
|
||||
case NL80211_IFTYPE_STATION:
|
||||
pwlanhdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_TODS);
|
||||
memcpy(pwlanhdr->addr1,
|
||||
get_my_bssid23a(&pmlmeinfo->network), ETH_ALEN);
|
||||
memcpy(pwlanhdr->addr2, myid(&padapter->eeprompriv),
|
||||
ETH_ALEN);
|
||||
memcpy(pwlanhdr->addr3, StaAddr, ETH_ALEN);
|
||||
break;
|
||||
case NL80211_IFTYPE_P2P_GO:
|
||||
case NL80211_IFTYPE_AP:
|
||||
pwlanhdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_FROMDS);
|
||||
memcpy(pwlanhdr->addr1, StaAddr, ETH_ALEN);
|
||||
memcpy(pwlanhdr->addr2,
|
||||
get_my_bssid23a(&pmlmeinfo->network), ETH_ALEN);
|
||||
memcpy(pwlanhdr->addr3, myid(&padapter->eeprompriv),
|
||||
ETH_ALEN);
|
||||
break;
|
||||
case NL80211_IFTYPE_ADHOC:
|
||||
default:
|
||||
memcpy(pwlanhdr->addr1, StaAddr, ETH_ALEN);
|
||||
memcpy(pwlanhdr->addr2, myid(&padapter->eeprompriv), ETH_ALEN);
|
||||
memcpy(pwlanhdr->addr3,
|
||||
get_my_bssid23a(&pmlmeinfo->network), ETH_ALEN);
|
||||
break;
|
||||
}
|
||||
|
||||
if (bQoS == true) {
|
||||
struct ieee80211_qos_hdr *qoshdr;
|
||||
qoshdr = (struct ieee80211_qos_hdr *)pframe;
|
||||
|
||||
qoshdr->frame_control |=
|
||||
cpu_to_le16(IEEE80211_FTYPE_DATA |
|
||||
IEEE80211_STYPE_QOS_NULLFUNC);
|
||||
|
||||
qoshdr->qos_ctrl = cpu_to_le16(AC & IEEE80211_QOS_CTL_TID_MASK);
|
||||
if (bEosp)
|
||||
qoshdr->qos_ctrl |= cpu_to_le16(IEEE80211_QOS_CTL_EOSP);
|
||||
|
||||
pktlen = sizeof(struct ieee80211_qos_hdr);
|
||||
} else {
|
||||
pwlanhdr->frame_control |=
|
||||
cpu_to_le16(IEEE80211_FTYPE_DATA |
|
||||
IEEE80211_STYPE_NULLFUNC);
|
||||
|
||||
pktlen = sizeof(struct ieee80211_hdr_3addr);
|
||||
}
|
||||
|
||||
*pLength = pktlen;
|
||||
}
|
||||
|
||||
static void ConstructProbeRsp(struct rtw_adapter *padapter, u8 *pframe,
|
||||
u32 *pLength, u8 *StaAddr, bool bHideSSID)
|
||||
{
|
||||
struct ieee80211_mgmt *mgmt;
|
||||
u8 *mac, *bssid;
|
||||
u32 pktlen;
|
||||
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
|
||||
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
|
||||
struct wlan_bssid_ex *cur_network = &pmlmeinfo->network;
|
||||
|
||||
/* DBG_8723A("%s\n", __func__); */
|
||||
|
||||
mgmt = (struct ieee80211_mgmt *)pframe;
|
||||
|
||||
mac = myid(&padapter->eeprompriv);
|
||||
bssid = cur_network->MacAddress;
|
||||
|
||||
mgmt->frame_control =
|
||||
cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_RESP);
|
||||
|
||||
mgmt->seq_ctrl = 0;
|
||||
|
||||
memcpy(mgmt->da, StaAddr, ETH_ALEN);
|
||||
memcpy(mgmt->sa, mac, ETH_ALEN);
|
||||
memcpy(mgmt->bssid, bssid, ETH_ALEN);
|
||||
|
||||
put_unaligned_le64(cur_network->tsf,
|
||||
&mgmt->u.probe_resp.timestamp);
|
||||
put_unaligned_le16(cur_network->beacon_interval,
|
||||
&mgmt->u.probe_resp.beacon_int);
|
||||
put_unaligned_le16(cur_network->capability,
|
||||
&mgmt->u.probe_resp.capab_info);
|
||||
|
||||
pktlen = offsetof(struct ieee80211_mgmt, u.probe_resp.variable);
|
||||
|
||||
if (cur_network->IELength > MAX_IE_SZ)
|
||||
return;
|
||||
|
||||
memcpy(mgmt->u.probe_resp.variable, cur_network->IEs,
|
||||
cur_network->IELength);
|
||||
pktlen += (cur_network->IELength);
|
||||
|
||||
*pLength = pktlen;
|
||||
}
|
||||
|
||||
/* */
|
||||
/* Description: Fill the reserved packets that FW will use to RSVD page. */
|
||||
/* Now we just send 4 types packet to rsvd page. */
|
||||
/* (1)Beacon, (2)Ps-poll, (3)Null data, (4)ProbeRsp. */
|
||||
/* Input: */
|
||||
/* bDLFinished - false: At the first time we will send all the packets as a large packet to Hw, */
|
||||
/* so we need to set the packet length to total lengh. */
|
||||
/* true: At the second time, we should send the first packet (default:beacon) */
|
||||
/* to Hw again and set the lengh in descriptor to the real beacon lengh. */
|
||||
/* 2009.10.15 by tynli. */
|
||||
static void SetFwRsvdPagePkt(struct rtw_adapter *padapter, bool bDLFinished)
|
||||
{
|
||||
struct hal_data_8723a *pHalData;
|
||||
struct xmit_frame *pmgntframe;
|
||||
struct pkt_attrib *pattrib;
|
||||
struct xmit_priv *pxmitpriv;
|
||||
struct mlme_ext_priv *pmlmeext;
|
||||
struct mlme_ext_info *pmlmeinfo;
|
||||
u32 BeaconLength = 0, ProbeRspLength = 0, PSPollLength;
|
||||
u32 NullDataLength, QosNullLength, BTQosNullLength;
|
||||
u8 *ReservedPagePacket;
|
||||
u8 PageNum, PageNeed, TxDescLen;
|
||||
u16 BufIndex;
|
||||
u32 TotalPacketLen;
|
||||
struct rsvdpage_loc RsvdPageLoc;
|
||||
|
||||
DBG_8723A("%s\n", __func__);
|
||||
|
||||
ReservedPagePacket = kzalloc(1000, GFP_KERNEL);
|
||||
if (ReservedPagePacket == NULL) {
|
||||
DBG_8723A("%s: alloc ReservedPagePacket fail!\n", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
pHalData = GET_HAL_DATA(padapter);
|
||||
pxmitpriv = &padapter->xmitpriv;
|
||||
pmlmeext = &padapter->mlmeextpriv;
|
||||
pmlmeinfo = &pmlmeext->mlmext_info;
|
||||
|
||||
TxDescLen = TXDESC_SIZE;
|
||||
PageNum = 0;
|
||||
|
||||
/* 3 (1) beacon */
|
||||
BufIndex = TXDESC_OFFSET;
|
||||
ConstructBeacon(padapter, &ReservedPagePacket[BufIndex], &BeaconLength);
|
||||
|
||||
/* When we count the first page size, we need to reserve description size for the RSVD */
|
||||
/* packet, it will be filled in front of the packet in TXPKTBUF. */
|
||||
PageNeed = (u8)PageNum_128(TxDescLen + BeaconLength);
|
||||
/* To reserved 2 pages for beacon buffer. 2010.06.24. */
|
||||
if (PageNeed == 1)
|
||||
PageNeed += 1;
|
||||
PageNum += PageNeed;
|
||||
pHalData->FwRsvdPageStartOffset = PageNum;
|
||||
|
||||
BufIndex += PageNeed*128;
|
||||
|
||||
/* 3 (2) ps-poll */
|
||||
RsvdPageLoc.LocPsPoll = PageNum;
|
||||
ConstructPSPoll(padapter, &ReservedPagePacket[BufIndex], &PSPollLength);
|
||||
rtl8723a_fill_fake_txdesc(padapter, &ReservedPagePacket[BufIndex-TxDescLen], PSPollLength, true, false);
|
||||
|
||||
PageNeed = (u8)PageNum_128(TxDescLen + PSPollLength);
|
||||
PageNum += PageNeed;
|
||||
|
||||
BufIndex += PageNeed*128;
|
||||
|
||||
/* 3 (3) null data */
|
||||
RsvdPageLoc.LocNullData = PageNum;
|
||||
ConstructNullFunctionData(padapter, &ReservedPagePacket[BufIndex],
|
||||
&NullDataLength,
|
||||
get_my_bssid23a(&pmlmeinfo->network),
|
||||
false, 0, 0, false);
|
||||
rtl8723a_fill_fake_txdesc(padapter,
|
||||
&ReservedPagePacket[BufIndex-TxDescLen],
|
||||
NullDataLength, false, false);
|
||||
|
||||
PageNeed = (u8)PageNum_128(TxDescLen + NullDataLength);
|
||||
PageNum += PageNeed;
|
||||
|
||||
BufIndex += PageNeed*128;
|
||||
|
||||
/* 3 (4) probe response */
|
||||
RsvdPageLoc.LocProbeRsp = PageNum;
|
||||
ConstructProbeRsp(
|
||||
padapter,
|
||||
&ReservedPagePacket[BufIndex],
|
||||
&ProbeRspLength,
|
||||
get_my_bssid23a(&pmlmeinfo->network),
|
||||
false);
|
||||
rtl8723a_fill_fake_txdesc(padapter, &ReservedPagePacket[BufIndex-TxDescLen], ProbeRspLength, false, false);
|
||||
|
||||
PageNeed = (u8)PageNum_128(TxDescLen + ProbeRspLength);
|
||||
PageNum += PageNeed;
|
||||
|
||||
BufIndex += PageNeed*128;
|
||||
|
||||
/* 3 (5) Qos null data */
|
||||
RsvdPageLoc.LocQosNull = PageNum;
|
||||
ConstructNullFunctionData(
|
||||
padapter,
|
||||
&ReservedPagePacket[BufIndex],
|
||||
&QosNullLength,
|
||||
get_my_bssid23a(&pmlmeinfo->network),
|
||||
true, 0, 0, false);
|
||||
rtl8723a_fill_fake_txdesc(padapter, &ReservedPagePacket[BufIndex-TxDescLen], QosNullLength, false, false);
|
||||
|
||||
PageNeed = (u8)PageNum_128(TxDescLen + QosNullLength);
|
||||
PageNum += PageNeed;
|
||||
|
||||
BufIndex += PageNeed*128;
|
||||
|
||||
/* 3 (6) BT Qos null data */
|
||||
RsvdPageLoc.LocBTQosNull = PageNum;
|
||||
ConstructNullFunctionData(
|
||||
padapter,
|
||||
&ReservedPagePacket[BufIndex],
|
||||
&BTQosNullLength,
|
||||
get_my_bssid23a(&pmlmeinfo->network),
|
||||
true, 0, 0, false);
|
||||
rtl8723a_fill_fake_txdesc(padapter, &ReservedPagePacket[BufIndex-TxDescLen], BTQosNullLength, false, true);
|
||||
|
||||
TotalPacketLen = BufIndex + BTQosNullLength;
|
||||
|
||||
pmgntframe = alloc_mgtxmitframe23a(pxmitpriv);
|
||||
if (pmgntframe == NULL)
|
||||
goto exit;
|
||||
|
||||
/* update attribute */
|
||||
pattrib = &pmgntframe->attrib;
|
||||
update_mgntframe_attrib23a(padapter, pattrib);
|
||||
pattrib->qsel = 0x10;
|
||||
pattrib->pktlen = pattrib->last_txcmdsz = TotalPacketLen - TXDESC_OFFSET;
|
||||
memcpy(pmgntframe->buf_addr, ReservedPagePacket, TotalPacketLen);
|
||||
|
||||
rtl8723au_mgnt_xmit(padapter, pmgntframe);
|
||||
|
||||
DBG_8723A("%s: Set RSVD page location to Fw\n", __func__);
|
||||
FillH2CCmd(padapter, RSVD_PAGE_EID, sizeof(RsvdPageLoc), (u8 *)&RsvdPageLoc);
|
||||
|
||||
exit:
|
||||
kfree(ReservedPagePacket);
|
||||
}
|
||||
|
||||
void rtl8723a_set_FwJoinBssReport_cmd(struct rtw_adapter *padapter, u8 mstatus)
|
||||
{
|
||||
struct joinbssrpt_parm JoinBssRptParm;
|
||||
struct hal_data_8723a *pHalData = GET_HAL_DATA(padapter);
|
||||
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
|
||||
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
|
||||
|
||||
DBG_8723A("%s mstatus(%x)\n", __func__, mstatus);
|
||||
|
||||
if (mstatus == 1) {
|
||||
bool bRecover = false;
|
||||
u8 v8;
|
||||
|
||||
/* We should set AID, correct TSF, HW seq enable before set JoinBssReport to Fw in 88/92C. */
|
||||
/* Suggested by filen. Added by tynli. */
|
||||
rtl8723au_write16(padapter, REG_BCN_PSR_RPT,
|
||||
0xC000|pmlmeinfo->aid);
|
||||
/* Do not set TSF again here or vWiFi beacon DMA INT will not work. */
|
||||
/* correct_TSF23a(padapter, pmlmeext); */
|
||||
/* Hw sequende enable by dedault. 2010.06.23. by tynli. */
|
||||
/* rtl8723au_write16(padapter, REG_NQOS_SEQ, ((pmlmeext->mgnt_seq+100)&0xFFF)); */
|
||||
/* rtl8723au_write8(padapter, REG_HWSEQ_CTRL, 0xFF); */
|
||||
|
||||
/* set REG_CR bit 8 */
|
||||
v8 = rtl8723au_read8(padapter, REG_CR+1);
|
||||
v8 |= BIT(0); /* ENSWBCN */
|
||||
rtl8723au_write8(padapter, REG_CR+1, v8);
|
||||
|
||||
/* Disable Hw protection for a time which revserd for Hw sending beacon. */
|
||||
/* Fix download reserved page packet fail that access collision with the protection time. */
|
||||
/* 2010.05.11. Added by tynli. */
|
||||
/* SetBcnCtrlReg23a(padapter, 0, BIT(3)); */
|
||||
/* SetBcnCtrlReg23a(padapter, BIT(4), 0); */
|
||||
SetBcnCtrlReg23a(padapter, BIT(4), BIT(3));
|
||||
|
||||
/* Set FWHW_TXQ_CTRL 0x422[6]= 0 to tell Hw the packet is not a real beacon frame. */
|
||||
if (pHalData->RegFwHwTxQCtrl & BIT(6))
|
||||
bRecover = true;
|
||||
|
||||
/* To tell Hw the packet is not a real beacon frame. */
|
||||
/* U1bTmp = rtl8723au_read8(padapter, REG_FWHW_TXQ_CTRL+2); */
|
||||
rtl8723au_write8(padapter, REG_FWHW_TXQ_CTRL + 2,
|
||||
pHalData->RegFwHwTxQCtrl & ~BIT(6));
|
||||
pHalData->RegFwHwTxQCtrl &= ~BIT(6);
|
||||
SetFwRsvdPagePkt(padapter, 0);
|
||||
|
||||
/* 2010.05.11. Added by tynli. */
|
||||
SetBcnCtrlReg23a(padapter, BIT(3), BIT(4));
|
||||
|
||||
/* To make sure that if there exists an adapter which would like to send beacon. */
|
||||
/* If exists, the origianl value of 0x422[6] will be 1, we should check this to */
|
||||
/* prevent from setting 0x422[6] to 0 after download reserved page, or it will cause */
|
||||
/* the beacon cannot be sent by HW. */
|
||||
/* 2010.06.23. Added by tynli. */
|
||||
if (bRecover) {
|
||||
rtl8723au_write8(padapter, REG_FWHW_TXQ_CTRL + 2,
|
||||
pHalData->RegFwHwTxQCtrl | BIT(6));
|
||||
pHalData->RegFwHwTxQCtrl |= BIT(6);
|
||||
}
|
||||
|
||||
/* Clear CR[8] or beacon packet will not be send to TxBuf anymore. */
|
||||
v8 = rtl8723au_read8(padapter, REG_CR+1);
|
||||
v8 &= ~BIT(0); /* ~ENSWBCN */
|
||||
rtl8723au_write8(padapter, REG_CR+1, v8);
|
||||
}
|
||||
|
||||
JoinBssRptParm.OpMode = mstatus;
|
||||
|
||||
FillH2CCmd(padapter, JOINBSS_RPT_EID, sizeof(JoinBssRptParm), (u8 *)&JoinBssRptParm);
|
||||
|
||||
}
|
||||
|
||||
#ifdef CONFIG_8723AU_BT_COEXIST
|
||||
static void SetFwRsvdPagePkt_BTCoex(struct rtw_adapter *padapter)
|
||||
{
|
||||
struct hal_data_8723a *pHalData;
|
||||
struct xmit_frame *pmgntframe;
|
||||
struct pkt_attrib *pattrib;
|
||||
struct xmit_priv *pxmitpriv;
|
||||
struct mlme_ext_priv *pmlmeext;
|
||||
struct mlme_ext_info *pmlmeinfo;
|
||||
u8 fakemac[6] = {0x00, 0xe0, 0x4c, 0x00, 0x00, 0x00};
|
||||
u32 NullDataLength, BTQosNullLength;
|
||||
u8 *ReservedPagePacket;
|
||||
u8 PageNum, PageNeed, TxDescLen;
|
||||
u16 BufIndex;
|
||||
u32 TotalPacketLen;
|
||||
struct rsvdpage_loc RsvdPageLoc;
|
||||
|
||||
DBG_8723A("+%s\n", __func__);
|
||||
|
||||
ReservedPagePacket = kzalloc(1024, GFP_KERNEL);
|
||||
if (ReservedPagePacket == NULL) {
|
||||
DBG_8723A("%s: alloc ReservedPagePacket fail!\n", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
pHalData = GET_HAL_DATA(padapter);
|
||||
pxmitpriv = &padapter->xmitpriv;
|
||||
pmlmeext = &padapter->mlmeextpriv;
|
||||
pmlmeinfo = &pmlmeext->mlmext_info;
|
||||
|
||||
TxDescLen = TXDESC_SIZE;
|
||||
PageNum = 0;
|
||||
|
||||
/* 3 (1) beacon */
|
||||
BufIndex = TXDESC_OFFSET;
|
||||
/* skip Beacon Packet */
|
||||
PageNeed = 3;
|
||||
|
||||
PageNum += PageNeed;
|
||||
pHalData->FwRsvdPageStartOffset = PageNum;
|
||||
|
||||
BufIndex += PageNeed*128;
|
||||
|
||||
/* 3 (3) null data */
|
||||
RsvdPageLoc.LocNullData = PageNum;
|
||||
ConstructNullFunctionData(
|
||||
padapter,
|
||||
&ReservedPagePacket[BufIndex],
|
||||
&NullDataLength,
|
||||
fakemac,
|
||||
false, 0, 0, false);
|
||||
rtl8723a_fill_fake_txdesc(padapter, &ReservedPagePacket[BufIndex-TxDescLen], NullDataLength, false, false);
|
||||
|
||||
PageNeed = (u8)PageNum_128(TxDescLen + NullDataLength);
|
||||
PageNum += PageNeed;
|
||||
|
||||
BufIndex += PageNeed*128;
|
||||
|
||||
/* 3 (6) BT Qos null data */
|
||||
RsvdPageLoc.LocBTQosNull = PageNum;
|
||||
ConstructNullFunctionData(
|
||||
padapter,
|
||||
&ReservedPagePacket[BufIndex],
|
||||
&BTQosNullLength,
|
||||
fakemac,
|
||||
true, 0, 0, false);
|
||||
rtl8723a_fill_fake_txdesc(padapter, &ReservedPagePacket[BufIndex-TxDescLen], BTQosNullLength, false, true);
|
||||
|
||||
TotalPacketLen = BufIndex + BTQosNullLength;
|
||||
|
||||
pmgntframe = alloc_mgtxmitframe23a(pxmitpriv);
|
||||
if (pmgntframe == NULL)
|
||||
goto exit;
|
||||
|
||||
/* update attribute */
|
||||
pattrib = &pmgntframe->attrib;
|
||||
update_mgntframe_attrib23a(padapter, pattrib);
|
||||
pattrib->qsel = 0x10;
|
||||
pattrib->pktlen = pattrib->last_txcmdsz = TotalPacketLen - TXDESC_OFFSET;
|
||||
memcpy(pmgntframe->buf_addr, ReservedPagePacket, TotalPacketLen);
|
||||
|
||||
rtl8723au_mgnt_xmit(padapter, pmgntframe);
|
||||
|
||||
DBG_8723A("%s: Set RSVD page location to Fw\n", __func__);
|
||||
FillH2CCmd(padapter, RSVD_PAGE_EID, sizeof(RsvdPageLoc), (u8 *)&RsvdPageLoc);
|
||||
|
||||
exit:
|
||||
kfree(ReservedPagePacket);
|
||||
}
|
||||
|
||||
void rtl8723a_set_BTCoex_AP_mode_FwRsvdPkt_cmd(struct rtw_adapter *padapter)
|
||||
{
|
||||
struct hal_data_8723a *pHalData;
|
||||
u8 bRecover = false;
|
||||
|
||||
DBG_8723A("+%s\n", __func__);
|
||||
|
||||
pHalData = GET_HAL_DATA(padapter);
|
||||
|
||||
/* Set FWHW_TXQ_CTRL 0x422[6]= 0 to tell Hw the packet is not a real beacon frame. */
|
||||
if (pHalData->RegFwHwTxQCtrl & BIT(6))
|
||||
bRecover = true;
|
||||
|
||||
/* To tell Hw the packet is not a real beacon frame. */
|
||||
pHalData->RegFwHwTxQCtrl &= ~BIT(6);
|
||||
rtl8723au_write8(padapter, REG_FWHW_TXQ_CTRL + 2,
|
||||
pHalData->RegFwHwTxQCtrl);
|
||||
SetFwRsvdPagePkt_BTCoex(padapter);
|
||||
|
||||
/* To make sure that if there exists an adapter which would like to send beacon. */
|
||||
/* If exists, the origianl value of 0x422[6] will be 1, we should check this to */
|
||||
/* prevent from setting 0x422[6] to 0 after download reserved page, or it will cause */
|
||||
/* the beacon cannot be sent by HW. */
|
||||
/* 2010.06.23. Added by tynli. */
|
||||
if (bRecover) {
|
||||
pHalData->RegFwHwTxQCtrl |= BIT(6);
|
||||
rtl8723au_write8(padapter, REG_FWHW_TXQ_CTRL + 2,
|
||||
pHalData->RegFwHwTxQCtrl);
|
||||
}
|
||||
}
|
||||
#endif
|
|
@ -1,194 +0,0 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
/* */
|
||||
/* Description: */
|
||||
/* */
|
||||
/* This file is for 92CE/92CU dynamic mechanism only */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
#define _RTL8723A_DM_C_
|
||||
|
||||
/* */
|
||||
/* include files */
|
||||
/* */
|
||||
#include <osdep_service.h>
|
||||
#include <drv_types.h>
|
||||
|
||||
#include <rtl8723a_hal.h>
|
||||
#include <usb_ops_linux.h>
|
||||
|
||||
/* */
|
||||
/* Global var */
|
||||
/* */
|
||||
|
||||
static void dm_CheckPbcGPIO(struct rtw_adapter *padapter)
|
||||
{
|
||||
u8 tmp1byte;
|
||||
u8 bPbcPressed = false;
|
||||
|
||||
if (!padapter->registrypriv.hw_wps_pbc)
|
||||
return;
|
||||
|
||||
tmp1byte = rtl8723au_read8(padapter, GPIO_IO_SEL);
|
||||
tmp1byte |= (HAL_8192C_HW_GPIO_WPS_BIT);
|
||||
/* enable GPIO[2] as output mode */
|
||||
rtl8723au_write8(padapter, GPIO_IO_SEL, tmp1byte);
|
||||
|
||||
tmp1byte &= ~(HAL_8192C_HW_GPIO_WPS_BIT);
|
||||
/* reset the floating voltage level */
|
||||
rtl8723au_write8(padapter, GPIO_IN, tmp1byte);
|
||||
|
||||
tmp1byte = rtl8723au_read8(padapter, GPIO_IO_SEL);
|
||||
tmp1byte &= ~(HAL_8192C_HW_GPIO_WPS_BIT);
|
||||
/* enable GPIO[2] as input mode */
|
||||
rtl8723au_write8(padapter, GPIO_IO_SEL, tmp1byte);
|
||||
|
||||
tmp1byte = rtl8723au_read8(padapter, GPIO_IN);
|
||||
|
||||
if (tmp1byte == 0xff)
|
||||
return;
|
||||
|
||||
if (tmp1byte&HAL_8192C_HW_GPIO_WPS_BIT)
|
||||
bPbcPressed = true;
|
||||
|
||||
if (bPbcPressed) {
|
||||
/* Here we only set bPbcPressed to true */
|
||||
/* After trigger PBC, the variable will be set to false */
|
||||
DBG_8723A("CheckPbcGPIO - PBC is pressed\n");
|
||||
|
||||
if (padapter->pid[0] == 0) {
|
||||
/* 0 is the default value and it means the application
|
||||
* monitors the HW PBC doesn't privde its pid to driver.
|
||||
*/
|
||||
return;
|
||||
}
|
||||
|
||||
kill_pid(find_vpid(padapter->pid[0]), SIGUSR1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
/* Initialize GPIO setting registers */
|
||||
/* functions */
|
||||
|
||||
void rtl8723a_init_dm_priv(struct rtw_adapter *Adapter)
|
||||
{
|
||||
struct hal_data_8723a *pHalData = GET_HAL_DATA(Adapter);
|
||||
struct dm_priv *pdmpriv = &pHalData->dmpriv;
|
||||
struct dm_odm_t *pDM_Odm = &pHalData->odmpriv;
|
||||
u8 cut_ver, fab_ver;
|
||||
|
||||
memset(pdmpriv, 0, sizeof(struct dm_priv));
|
||||
memset(pDM_Odm, 0, sizeof(*pDM_Odm));
|
||||
|
||||
pDM_Odm->Adapter = Adapter;
|
||||
|
||||
ODM_CmnInfoInit23a(pDM_Odm, ODM_CMNINFO_IC_TYPE, ODM_RTL8723A);
|
||||
|
||||
if (IS_8723A_A_CUT(pHalData->VersionID)) {
|
||||
fab_ver = ODM_UMC;
|
||||
cut_ver = ODM_CUT_A;
|
||||
} else if (IS_8723A_B_CUT(pHalData->VersionID)) {
|
||||
fab_ver = ODM_UMC;
|
||||
cut_ver = ODM_CUT_B;
|
||||
} else {
|
||||
fab_ver = ODM_TSMC;
|
||||
cut_ver = ODM_CUT_A;
|
||||
}
|
||||
ODM_CmnInfoInit23a(pDM_Odm, ODM_CMNINFO_FAB_VER, fab_ver);
|
||||
ODM_CmnInfoInit23a(pDM_Odm, ODM_CMNINFO_CUT_VER, cut_ver);
|
||||
ODM_CmnInfoInit23a(pDM_Odm, ODM_CMNINFO_MP_TEST_CHIP, IS_NORMAL_CHIP(pHalData->VersionID));
|
||||
|
||||
ODM_CmnInfoInit23a(pDM_Odm, ODM_CMNINFO_BOARD_TYPE, pHalData->BoardType);
|
||||
|
||||
if (pHalData->BoardType == BOARD_USB_High_PA) {
|
||||
ODM_CmnInfoInit23a(pDM_Odm, ODM_CMNINFO_EXT_LNA, true);
|
||||
ODM_CmnInfoInit23a(pDM_Odm, ODM_CMNINFO_EXT_PA, true);
|
||||
}
|
||||
ODM_CmnInfoInit23a(pDM_Odm, ODM_CMNINFO_BWIFI_TEST, Adapter->registrypriv.wifi_spec);
|
||||
}
|
||||
|
||||
static void Update_ODM_ComInfo_8723a(struct rtw_adapter *Adapter)
|
||||
{
|
||||
struct hal_data_8723a *pHalData = GET_HAL_DATA(Adapter);
|
||||
struct dm_odm_t *pDM_Odm = &pHalData->odmpriv;
|
||||
struct dm_priv *pdmpriv = &pHalData->dmpriv;
|
||||
int i;
|
||||
pdmpriv->InitODMFlag = 0;
|
||||
/* Pointer reference */
|
||||
rtl8723a_odm_support_ability_set(Adapter, DYNAMIC_ALL_FUNC_ENABLE);
|
||||
|
||||
for (i = 0; i < NUM_STA; i++)
|
||||
ODM_CmnInfoPtrArrayHook23a(pDM_Odm, ODM_CMNINFO_STA_STATUS, i, NULL);
|
||||
}
|
||||
|
||||
void rtl8723a_InitHalDm(struct rtw_adapter *Adapter)
|
||||
{
|
||||
struct hal_data_8723a *pHalData = GET_HAL_DATA(Adapter);
|
||||
struct dm_priv *pdmpriv = &pHalData->dmpriv;
|
||||
struct dm_odm_t *pDM_Odm = &pHalData->odmpriv;
|
||||
u8 i;
|
||||
|
||||
Update_ODM_ComInfo_8723a(Adapter);
|
||||
ODM23a_DMInit(pDM_Odm);
|
||||
/* Save REG_INIDATA_RATE_SEL value for TXDESC. */
|
||||
for (i = 0; i < 32; i++)
|
||||
pdmpriv->INIDATA_RATE[i] = rtl8723au_read8(Adapter, REG_INIDATA_RATE_SEL+i) & 0x3f;
|
||||
}
|
||||
|
||||
void
|
||||
rtl8723a_HalDmWatchDog(
|
||||
struct rtw_adapter *Adapter
|
||||
)
|
||||
{
|
||||
bool bFwCurrentInPSMode = false;
|
||||
bool bFwPSAwake = true;
|
||||
u8 bLinked = false;
|
||||
u8 hw_init_completed = false;
|
||||
struct hal_data_8723a *pHalData = GET_HAL_DATA(Adapter);
|
||||
struct dm_priv *pdmpriv = &pHalData->dmpriv;
|
||||
|
||||
hw_init_completed = Adapter->hw_init_completed;
|
||||
|
||||
if (hw_init_completed == false)
|
||||
goto skip_dm;
|
||||
|
||||
bFwCurrentInPSMode = Adapter->pwrctrlpriv.bFwCurrentInPSMode;
|
||||
bFwPSAwake = rtl8723a_get_fwlps_rf_on(Adapter);
|
||||
|
||||
if (!bFwCurrentInPSMode && bFwPSAwake) {
|
||||
/* Read REG_INIDATA_RATE_SEL value for TXDESC. */
|
||||
if (check_fwstate(&Adapter->mlmepriv, WIFI_STATION_STATE)) {
|
||||
pdmpriv->INIDATA_RATE[0] = rtl8723au_read8(Adapter, REG_INIDATA_RATE_SEL) & 0x3f;
|
||||
} else {
|
||||
u8 i;
|
||||
for (i = 1 ; i < (Adapter->stapriv.asoc_sta_count + 1); i++)
|
||||
pdmpriv->INIDATA_RATE[i] = rtl8723au_read8(Adapter, (REG_INIDATA_RATE_SEL+i)) & 0x3f;
|
||||
}
|
||||
}
|
||||
|
||||
/* ODM */
|
||||
if (rtw_linked_check(Adapter))
|
||||
bLinked = true;
|
||||
|
||||
ODM_CmnInfoUpdate23a(&pHalData->odmpriv, ODM_CMNINFO_LINK, bLinked);
|
||||
ODM_DMWatchdog23a(Adapter);
|
||||
|
||||
skip_dm:
|
||||
|
||||
/* Check GPIO to determine current RF on/off and Pbc status. */
|
||||
/* Check Hardware Radio ON/OFF or not */
|
||||
dm_CheckPbcGPIO(Adapter);
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -1,961 +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.
|
||||
*
|
||||
******************************************************************************/
|
||||
#define _RTL8723A_PHYCFG_C_
|
||||
|
||||
#include <osdep_service.h>
|
||||
#include <drv_types.h>
|
||||
|
||||
#include <rtl8723a_hal.h>
|
||||
#include <usb_ops_linux.h>
|
||||
|
||||
/*---------------------------Define Local Constant---------------------------*/
|
||||
/* Channel switch:The size of command tables for switch channel*/
|
||||
#define MAX_PRECMD_CNT 16
|
||||
#define MAX_RFDEPENDCMD_CNT 16
|
||||
#define MAX_POSTCMD_CNT 16
|
||||
|
||||
#define MAX_DOZE_WAITING_TIMES_9x 64
|
||||
|
||||
/*---------------------------Define Local Constant---------------------------*/
|
||||
|
||||
/*------------------------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;
|
||||
|
||||
for (i = 0; i <= 31; i++) {
|
||||
if (((BitMask>>i) & 0x1) == 1)
|
||||
break;
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function: PHY_QueryBBReg
|
||||
*
|
||||
* OverView: Read "sepcific bits" from BB register
|
||||
*
|
||||
* Input:
|
||||
* struct rtw_adapter * Adapter,
|
||||
* u32 RegAddr, Target address to be readback
|
||||
* u32 BitMask Target bit position in the
|
||||
* target address to be readback
|
||||
* Output:
|
||||
* None
|
||||
* Return:
|
||||
* u32 Data The readback register value
|
||||
* Note:
|
||||
* This function is equal to "GetRegSetting" in PHY programming guide
|
||||
*/
|
||||
u32
|
||||
PHY_QueryBBReg(struct rtw_adapter *Adapter, u32 RegAddr, u32 BitMask)
|
||||
{
|
||||
u32 ReturnValue = 0, OriginalValue, BitShift;
|
||||
|
||||
OriginalValue = rtl8723au_read32(Adapter, RegAddr);
|
||||
BitShift = phy_CalculateBitShift(BitMask);
|
||||
ReturnValue = (OriginalValue & BitMask) >> BitShift;
|
||||
return ReturnValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function: PHY_SetBBReg
|
||||
*
|
||||
* OverView: Write "Specific bits" to BB register (page 8~)
|
||||
*
|
||||
* Input:
|
||||
* struct rtw_adapter * Adapter,
|
||||
* u32 RegAddr, Target address to be modified
|
||||
* u32 BitMask Target bit position in the
|
||||
* target address to be modified
|
||||
* u32 Data The new register value in the
|
||||
* target bit position of the
|
||||
* target address
|
||||
*
|
||||
* Output:
|
||||
* None
|
||||
* Return:
|
||||
* None
|
||||
* Note:
|
||||
* This function is equal to "PutRegSetting" in PHY programming guide
|
||||
*/
|
||||
|
||||
void
|
||||
PHY_SetBBReg(struct rtw_adapter *Adapter, u32 RegAddr, u32 BitMask, u32 Data)
|
||||
{
|
||||
u32 OriginalValue, BitShift;
|
||||
|
||||
if (BitMask != bMaskDWord) {/* if not "double word" write */
|
||||
OriginalValue = rtl8723au_read32(Adapter, RegAddr);
|
||||
BitShift = phy_CalculateBitShift(BitMask);
|
||||
Data = (OriginalValue & (~BitMask)) | (Data << BitShift);
|
||||
}
|
||||
|
||||
rtl8723au_write32(Adapter, RegAddr, Data);
|
||||
|
||||
/* RTPRINT(FPHY, PHY_BBW, ("BBW MASK = 0x%lx Addr[0x%lx]= 0x%lx\n", BitMask, RegAddr, Data)); */
|
||||
}
|
||||
|
||||
/* */
|
||||
/* 2. RF register R/W API */
|
||||
/* */
|
||||
|
||||
/**
|
||||
* Function: phy_RFSerialRead
|
||||
*
|
||||
* OverView: Read regster from RF chips
|
||||
*
|
||||
* Input:
|
||||
* struct rtw_adapter * Adapter,
|
||||
* enum RF_RADIO_PATH eRFPath, Radio path of A/B/C/D
|
||||
* u32 Offset, The target address to be read
|
||||
*
|
||||
* Output: None
|
||||
* Return: u32 reback value
|
||||
* Note: Threre are three types of serial operations:
|
||||
* 1. Software serial write
|
||||
* 2. Hardware LSSI-Low Speed Serial Interface
|
||||
* 3. Hardware HSSI-High speed
|
||||
* serial write. Driver need to implement (1) and (2).
|
||||
* This function is equal to the combination of RF_ReadReg() and
|
||||
* RFLSSIRead()
|
||||
*/
|
||||
static u32
|
||||
phy_RFSerialRead(struct rtw_adapter *Adapter, enum RF_RADIO_PATH eRFPath,
|
||||
u32 Offset)
|
||||
{
|
||||
u32 retValue = 0;
|
||||
struct hal_data_8723a *pHalData = GET_HAL_DATA(Adapter);
|
||||
struct bb_reg_define *pPhyReg = &pHalData->PHYRegDef[eRFPath];
|
||||
u32 NewOffset;
|
||||
u32 tmplong, tmplong2;
|
||||
u8 RfPiEnable = 0;
|
||||
/* */
|
||||
/* Make sure RF register offset is correct */
|
||||
/* */
|
||||
Offset &= 0x3f;
|
||||
|
||||
/* */
|
||||
/* Switch page for 8256 RF IC */
|
||||
/* */
|
||||
NewOffset = Offset;
|
||||
|
||||
/* 2009/06/17 MH We can not execute IO for power save or
|
||||
other accident mode. */
|
||||
/* if (RT_CANNOT_IO(Adapter)) */
|
||||
/* */
|
||||
/* RTPRINT(FPHY, PHY_RFR, ("phy_RFSerialRead return all one\n")); */
|
||||
/* return 0xFFFFFFFF; */
|
||||
/* */
|
||||
|
||||
/* For 92S LSSI Read RFLSSIRead */
|
||||
/* For RF A/B write 0x824/82c(does not work in the future) */
|
||||
/* We must use 0x824 for RF A and B to execute read trigger */
|
||||
tmplong = rtl8723au_read32(Adapter, rFPGA0_XA_HSSIParameter2);
|
||||
if (eRFPath == RF_PATH_A)
|
||||
tmplong2 = tmplong;
|
||||
else
|
||||
tmplong2 = rtl8723au_read32(Adapter, pPhyReg->rfHSSIPara2);
|
||||
|
||||
tmplong2 = (tmplong2 & ~bLSSIReadAddress) |
|
||||
(NewOffset << 23) | bLSSIReadEdge; /* T65 RF */
|
||||
|
||||
rtl8723au_write32(Adapter, rFPGA0_XA_HSSIParameter2,
|
||||
tmplong & (~bLSSIReadEdge));
|
||||
udelay(10);/* PlatformStallExecution(10); */
|
||||
|
||||
rtl8723au_write32(Adapter, pPhyReg->rfHSSIPara2, tmplong2);
|
||||
udelay(100);/* PlatformStallExecution(100); */
|
||||
|
||||
rtl8723au_write32(Adapter, rFPGA0_XA_HSSIParameter2,
|
||||
tmplong | bLSSIReadEdge);
|
||||
udelay(10);/* PlatformStallExecution(10); */
|
||||
|
||||
if (eRFPath == RF_PATH_A)
|
||||
RfPiEnable = (u8)PHY_QueryBBReg(Adapter,
|
||||
rFPGA0_XA_HSSIParameter1,
|
||||
BIT(8));
|
||||
else if (eRFPath == RF_PATH_B)
|
||||
RfPiEnable = (u8)PHY_QueryBBReg(Adapter,
|
||||
rFPGA0_XB_HSSIParameter1,
|
||||
BIT(8));
|
||||
|
||||
if (RfPiEnable) {
|
||||
/* Read from BBreg8b8, 12 bits for 8190, 20bits for T65 RF */
|
||||
retValue = PHY_QueryBBReg(Adapter, pPhyReg->rfLSSIReadBackPi,
|
||||
bLSSIReadBackData);
|
||||
/* DBG_8723A("Readback from RF-PI : 0x%x\n", retValue); */
|
||||
} else {
|
||||
/* Read from BBreg8a0, 12 bits for 8190, 20 bits for T65 RF */
|
||||
retValue = PHY_QueryBBReg(Adapter, pPhyReg->rfLSSIReadBack,
|
||||
bLSSIReadBackData);
|
||||
/* DBG_8723A("Readback from RF-SI : 0x%x\n", retValue); */
|
||||
}
|
||||
/* DBG_8723A("RFR-%d Addr[0x%x]= 0x%x\n", eRFPath, pPhyReg->rfLSSIReadBack, retValue); */
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function: phy_RFSerialWrite
|
||||
*
|
||||
* OverView: Write data to RF register (page 8~)
|
||||
*
|
||||
* Input:
|
||||
* struct rtw_adapter * Adapter,
|
||||
* enum RF_RADIO_PATH eRFPath, Radio path of A/B/C/D
|
||||
* u32 Offset, The target address to be read
|
||||
* u32 Data The new register Data in the target
|
||||
* bit position of the target to be read
|
||||
*
|
||||
* Output:
|
||||
* None
|
||||
* Return:
|
||||
* None
|
||||
* Note:
|
||||
* Threre are three types of serial operations:
|
||||
* 1. Software serial write
|
||||
* 2. Hardware LSSI-Low Speed Serial Interface
|
||||
* 3. Hardware HSSI-High speed
|
||||
* serial write. Driver need to implement (1) and (2).
|
||||
* This function is equal to the combination of RF_ReadReg() and
|
||||
* RFLSSIRead()
|
||||
*
|
||||
* Note: For RF8256 only
|
||||
* The total count of RTL8256(Zebra4) register is around 36 bit it only employs
|
||||
* 4-bit RF address. RTL8256 uses "register mode control bit"
|
||||
* (Reg00[12], Reg00[10]) to access register address bigger than 0xf.
|
||||
* See "Appendix-4 in PHY Configuration programming guide" for more details.
|
||||
* Thus, we define a sub-finction for RTL8526 register address conversion
|
||||
* ===========================================================
|
||||
* Register Mode: RegCTL[1] RegCTL[0] Note
|
||||
* (Reg00[12]) (Reg00[10])
|
||||
* ===========================================================
|
||||
* Reg_Mode0 0 x Reg 0 ~15(0x0 ~ 0xf)
|
||||
* ------------------------------------------------------------------
|
||||
* Reg_Mode1 1 0 Reg 16 ~30(0x1 ~ 0xf)
|
||||
* ------------------------------------------------------------------
|
||||
* Reg_Mode2 1 1 Reg 31 ~ 45(0x1 ~ 0xf)
|
||||
* ------------------------------------------------------------------
|
||||
*
|
||||
* 2008/09/02 MH Add 92S RF definition
|
||||
*/
|
||||
static void
|
||||
phy_RFSerialWrite(struct rtw_adapter *Adapter, enum RF_RADIO_PATH eRFPath,
|
||||
u32 Offset, u32 Data)
|
||||
{
|
||||
u32 DataAndAddr = 0;
|
||||
struct hal_data_8723a *pHalData = GET_HAL_DATA(Adapter);
|
||||
struct bb_reg_define *pPhyReg = &pHalData->PHYRegDef[eRFPath];
|
||||
u32 NewOffset;
|
||||
|
||||
/* 2009/06/17 MH We can not execute IO for power save or
|
||||
other accident mode. */
|
||||
/* if (RT_CANNOT_IO(Adapter)) */
|
||||
/* */
|
||||
/* RTPRINT(FPHY, PHY_RFW, ("phy_RFSerialWrite stop\n")); */
|
||||
/* return; */
|
||||
/* */
|
||||
|
||||
Offset &= 0x3f;
|
||||
|
||||
/* */
|
||||
/* Shadow Update */
|
||||
/* */
|
||||
/* PHY_RFShadowWrite(Adapter, eRFPath, Offset, Data); */
|
||||
|
||||
/* */
|
||||
/* Switch page for 8256 RF IC */
|
||||
/* */
|
||||
NewOffset = Offset;
|
||||
|
||||
/* */
|
||||
/* Put write addr in [5:0] and write data in [31:16] */
|
||||
/* */
|
||||
/* DataAndAddr = (Data<<16) | (NewOffset&0x3f); */
|
||||
/* T65 RF */
|
||||
DataAndAddr = ((NewOffset<<20) | (Data&0x000fffff)) & 0x0fffffff;
|
||||
|
||||
/* */
|
||||
/* Write Operation */
|
||||
/* */
|
||||
rtl8723au_write32(Adapter, pPhyReg->rf3wireOffset, DataAndAddr);
|
||||
}
|
||||
|
||||
/**
|
||||
* Function: PHY_QueryRFReg
|
||||
*
|
||||
* OverView: Query "Specific bits" to RF register (page 8~)
|
||||
*
|
||||
* Input:
|
||||
* struct rtw_adapter * Adapter,
|
||||
* enum RF_RADIO_PATH eRFPath, Radio path of A/B/C/D
|
||||
* u32 RegAddr, The target address to be read
|
||||
* u32BitMask The target bit position in the target
|
||||
* address to be read
|
||||
*
|
||||
* Output:
|
||||
* None
|
||||
* Return:
|
||||
* u32 Readback value
|
||||
* Note:
|
||||
* This function is equal to "GetRFRegSetting" in PHY programming guide
|
||||
*/
|
||||
u32
|
||||
PHY_QueryRFReg(struct rtw_adapter *Adapter, enum RF_RADIO_PATH eRFPath,
|
||||
u32 RegAddr, u32 BitMask)
|
||||
{
|
||||
u32 Original_Value, Readback_Value, BitShift;
|
||||
/* struct hal_data_8723a *pHalData = GET_HAL_DATA(Adapter); */
|
||||
/* u8 RFWaitCounter = 0; */
|
||||
/* _irqL irqL; */
|
||||
|
||||
Original_Value = phy_RFSerialRead(Adapter, eRFPath, RegAddr);
|
||||
|
||||
BitShift = phy_CalculateBitShift(BitMask);
|
||||
Readback_Value = (Original_Value & BitMask) >> BitShift;
|
||||
|
||||
return Readback_Value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function: PHY_SetRFReg
|
||||
*
|
||||
* OverView: Write "Specific bits" to RF register (page 8~)
|
||||
*
|
||||
* Input:
|
||||
* struct rtw_adapter * Adapter,
|
||||
* enum RF_RADIO_PATH eRFPath, Radio path of A/B/C/D
|
||||
* u32 RegAddr, The target address to be modified
|
||||
* u32 BitMask The target bit position in the target
|
||||
* address to be modified
|
||||
* u32 Data The new register Data in the target
|
||||
* bit position of the target address
|
||||
*
|
||||
* Output:
|
||||
* None
|
||||
* Return:
|
||||
* None
|
||||
* Note: This function is equal to "PutRFRegSetting" in PHY programming guide
|
||||
*/
|
||||
void
|
||||
PHY_SetRFReg(struct rtw_adapter *Adapter, enum RF_RADIO_PATH eRFPath,
|
||||
u32 RegAddr, u32 BitMask, u32 Data)
|
||||
{
|
||||
/* struct hal_data_8723a *pHalData = GET_HAL_DATA(Adapter); */
|
||||
/* u8 RFWaitCounter = 0; */
|
||||
u32 Original_Value, BitShift;
|
||||
|
||||
/* RF data is 12 bits only */
|
||||
if (BitMask != bRFRegOffsetMask) {
|
||||
Original_Value = phy_RFSerialRead(Adapter, eRFPath, RegAddr);
|
||||
BitShift = phy_CalculateBitShift(BitMask);
|
||||
Data = (Original_Value & (~BitMask)) | (Data << BitShift);
|
||||
}
|
||||
|
||||
phy_RFSerialWrite(Adapter, eRFPath, RegAddr, Data);
|
||||
}
|
||||
|
||||
/* 3. Initial MAC/BB/RF config by reading MAC/BB/RF txt. */
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* Function: PHY_MACConfig8723A
|
||||
*
|
||||
* Overview: Condig MAC by header file or parameter file.
|
||||
*
|
||||
* Input: NONE
|
||||
*
|
||||
* Output: NONE
|
||||
*
|
||||
* Return: NONE
|
||||
*
|
||||
* Revised History:
|
||||
* When Who Remark
|
||||
* 08/12/2008 MHC Create Version 0.
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
int PHY_MACConfig8723A(struct rtw_adapter *Adapter)
|
||||
{
|
||||
struct hal_data_8723a *pHalData = GET_HAL_DATA(Adapter);
|
||||
|
||||
/* */
|
||||
/* Config MAC */
|
||||
/* */
|
||||
ODM_ReadAndConfig_MAC_REG_8723A(&pHalData->odmpriv);
|
||||
|
||||
/* 2010.07.13 AMPDU aggregation number 9 */
|
||||
rtl8723au_write8(Adapter, REG_MAX_AGGR_NUM, 0x0A);
|
||||
if (pHalData->rf_type == RF_2T2R &&
|
||||
BOARD_USB_DONGLE == pHalData->BoardType)
|
||||
rtl8723au_write8(Adapter, 0x40, 0x04);
|
||||
|
||||
return _SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function: phy_InitBBRFRegisterDefinition
|
||||
*
|
||||
* OverView: Initialize Register definition offset for Radio Path A/B/C/D
|
||||
*
|
||||
* Input:
|
||||
* struct rtw_adapter * Adapter,
|
||||
*
|
||||
* Output: None
|
||||
* Return: None
|
||||
* Note:
|
||||
* The initialization value is constant and it should never be changes
|
||||
*/
|
||||
static void
|
||||
phy_InitBBRFRegisterDefinition(struct rtw_adapter *Adapter)
|
||||
{
|
||||
struct hal_data_8723a *pHalData = GET_HAL_DATA(Adapter);
|
||||
|
||||
/* RF Interface Sowrtware Control */
|
||||
/* 16 LSBs if read 32-bit from 0x870 */
|
||||
pHalData->PHYRegDef[RF_PATH_A].rfintfs = rFPGA0_XAB_RFInterfaceSW;
|
||||
/* 16 MSBs if read 32-bit from 0x870 (16-bit for 0x872) */
|
||||
pHalData->PHYRegDef[RF_PATH_B].rfintfs = rFPGA0_XAB_RFInterfaceSW;
|
||||
|
||||
/* RF Interface Readback Value */
|
||||
/* 16 LSBs if read 32-bit from 0x8E0 */
|
||||
pHalData->PHYRegDef[RF_PATH_A].rfintfi = rFPGA0_XAB_RFInterfaceRB;
|
||||
/* 16 MSBs if read 32-bit from 0x8E0 (16-bit for 0x8E2) */
|
||||
pHalData->PHYRegDef[RF_PATH_B].rfintfi = rFPGA0_XAB_RFInterfaceRB;
|
||||
|
||||
/* RF Interface Output (and Enable) */
|
||||
/* 16 LSBs if read 32-bit from 0x860 */
|
||||
pHalData->PHYRegDef[RF_PATH_A].rfintfo = rFPGA0_XA_RFInterfaceOE;
|
||||
/* 16 LSBs if read 32-bit from 0x864 */
|
||||
pHalData->PHYRegDef[RF_PATH_B].rfintfo = rFPGA0_XB_RFInterfaceOE;
|
||||
|
||||
/* RF Interface (Output and) Enable */
|
||||
/* 16 MSBs if read 32-bit from 0x860 (16-bit for 0x862) */
|
||||
pHalData->PHYRegDef[RF_PATH_A].rfintfe = rFPGA0_XA_RFInterfaceOE;
|
||||
/* 16 MSBs if read 32-bit from 0x864 (16-bit for 0x866) */
|
||||
pHalData->PHYRegDef[RF_PATH_B].rfintfe = rFPGA0_XB_RFInterfaceOE;
|
||||
|
||||
/* Addr of LSSI. Wirte RF register by driver */
|
||||
pHalData->PHYRegDef[RF_PATH_A].rf3wireOffset = rFPGA0_XA_LSSIParameter;
|
||||
pHalData->PHYRegDef[RF_PATH_B].rf3wireOffset = rFPGA0_XB_LSSIParameter;
|
||||
|
||||
/* RF parameter */
|
||||
/* BB Band Select */
|
||||
pHalData->PHYRegDef[RF_PATH_A].rfLSSI_Select = rFPGA0_XAB_RFParameter;
|
||||
pHalData->PHYRegDef[RF_PATH_B].rfLSSI_Select = rFPGA0_XAB_RFParameter;
|
||||
|
||||
/* Tx AGC Gain Stage (same for all path. Should we remove this?) */
|
||||
pHalData->PHYRegDef[RF_PATH_A].rfTxGainStage = rFPGA0_TxGainStage;
|
||||
pHalData->PHYRegDef[RF_PATH_B].rfTxGainStage = rFPGA0_TxGainStage;
|
||||
|
||||
/* Tranceiver A~D HSSI Parameter-1 */
|
||||
/* wire control parameter1 */
|
||||
pHalData->PHYRegDef[RF_PATH_A].rfHSSIPara1 = rFPGA0_XA_HSSIParameter1;
|
||||
/* wire control parameter1 */
|
||||
pHalData->PHYRegDef[RF_PATH_B].rfHSSIPara1 = rFPGA0_XB_HSSIParameter1;
|
||||
|
||||
/* Tranceiver A~D HSSI Parameter-2 */
|
||||
/* wire control parameter2 */
|
||||
pHalData->PHYRegDef[RF_PATH_A].rfHSSIPara2 = rFPGA0_XA_HSSIParameter2;
|
||||
/* wire control parameter2 */
|
||||
pHalData->PHYRegDef[RF_PATH_B].rfHSSIPara2 = rFPGA0_XB_HSSIParameter2;
|
||||
|
||||
/* RF switch Control */
|
||||
pHalData->PHYRegDef[RF_PATH_A].rfSwitchControl =
|
||||
rFPGA0_XAB_SwitchControl; /* TR/Ant switch control */
|
||||
pHalData->PHYRegDef[RF_PATH_B].rfSwitchControl =
|
||||
rFPGA0_XAB_SwitchControl;
|
||||
|
||||
/* AGC control 1 */
|
||||
pHalData->PHYRegDef[RF_PATH_A].rfAGCControl1 = rOFDM0_XAAGCCore1;
|
||||
pHalData->PHYRegDef[RF_PATH_B].rfAGCControl1 = rOFDM0_XBAGCCore1;
|
||||
|
||||
/* AGC control 2 */
|
||||
pHalData->PHYRegDef[RF_PATH_A].rfAGCControl2 = rOFDM0_XAAGCCore2;
|
||||
pHalData->PHYRegDef[RF_PATH_B].rfAGCControl2 = rOFDM0_XBAGCCore2;
|
||||
|
||||
/* RX AFE control 1 */
|
||||
pHalData->PHYRegDef[RF_PATH_A].rfRxIQImbalance = rOFDM0_XARxIQImbalance;
|
||||
pHalData->PHYRegDef[RF_PATH_B].rfRxIQImbalance = rOFDM0_XBRxIQImbalance;
|
||||
|
||||
/* RX AFE control 1 */
|
||||
pHalData->PHYRegDef[RF_PATH_A].rfRxAFE = rOFDM0_XARxAFE;
|
||||
pHalData->PHYRegDef[RF_PATH_B].rfRxAFE = rOFDM0_XBRxAFE;
|
||||
|
||||
/* Tx AFE control 1 */
|
||||
pHalData->PHYRegDef[RF_PATH_A].rfTxIQImbalance = rOFDM0_XATxIQImbalance;
|
||||
pHalData->PHYRegDef[RF_PATH_B].rfTxIQImbalance = rOFDM0_XBTxIQImbalance;
|
||||
|
||||
/* Tx AFE control 2 */
|
||||
pHalData->PHYRegDef[RF_PATH_A].rfTxAFE = rOFDM0_XATxAFE;
|
||||
pHalData->PHYRegDef[RF_PATH_B].rfTxAFE = rOFDM0_XBTxAFE;
|
||||
|
||||
/* Tranceiver LSSI Readback SI mode */
|
||||
pHalData->PHYRegDef[RF_PATH_A].rfLSSIReadBack = rFPGA0_XA_LSSIReadBack;
|
||||
pHalData->PHYRegDef[RF_PATH_B].rfLSSIReadBack = rFPGA0_XB_LSSIReadBack;
|
||||
|
||||
/* Tranceiver LSSI Readback PI mode */
|
||||
pHalData->PHYRegDef[RF_PATH_A].rfLSSIReadBackPi =
|
||||
TransceiverA_HSPI_Readback;
|
||||
pHalData->PHYRegDef[RF_PATH_B].rfLSSIReadBackPi =
|
||||
TransceiverB_HSPI_Readback;
|
||||
}
|
||||
|
||||
/* The following is for High Power PA */
|
||||
static void
|
||||
storePwrIndexDiffRateOffset(struct rtw_adapter *Adapter, u32 RegAddr,
|
||||
u32 BitMask, u32 Data)
|
||||
{
|
||||
struct hal_data_8723a *pHalData = GET_HAL_DATA(Adapter);
|
||||
|
||||
if (RegAddr == rTxAGC_A_Rate18_06) {
|
||||
pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][0] = Data;
|
||||
}
|
||||
if (RegAddr == rTxAGC_A_Rate54_24) {
|
||||
pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][1] = Data;
|
||||
}
|
||||
if (RegAddr == rTxAGC_A_CCK1_Mcs32) {
|
||||
pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][6] = Data;
|
||||
}
|
||||
if (RegAddr == rTxAGC_B_CCK11_A_CCK2_11 && BitMask == 0xffffff00) {
|
||||
pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][7] = Data;
|
||||
}
|
||||
if (RegAddr == rTxAGC_A_Mcs03_Mcs00) {
|
||||
pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][2] = Data;
|
||||
}
|
||||
if (RegAddr == rTxAGC_A_Mcs07_Mcs04) {
|
||||
pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][3] = Data;
|
||||
}
|
||||
if (RegAddr == rTxAGC_A_Mcs11_Mcs08) {
|
||||
pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][4] = Data;
|
||||
}
|
||||
if (RegAddr == rTxAGC_A_Mcs15_Mcs12) {
|
||||
pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][5] = Data;
|
||||
}
|
||||
if (RegAddr == rTxAGC_B_Rate18_06) {
|
||||
pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][8] = Data;
|
||||
}
|
||||
if (RegAddr == rTxAGC_B_Rate54_24) {
|
||||
pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][9] = Data;
|
||||
}
|
||||
if (RegAddr == rTxAGC_B_CCK1_55_Mcs32) {
|
||||
pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][14] = Data;
|
||||
}
|
||||
if (RegAddr == rTxAGC_B_CCK11_A_CCK2_11 && BitMask == 0x000000ff) {
|
||||
pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][15] = Data;
|
||||
}
|
||||
if (RegAddr == rTxAGC_B_Mcs03_Mcs00) {
|
||||
pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][10] = Data;
|
||||
}
|
||||
if (RegAddr == rTxAGC_B_Mcs07_Mcs04) {
|
||||
pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][11] = Data;
|
||||
}
|
||||
if (RegAddr == rTxAGC_B_Mcs11_Mcs08) {
|
||||
pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][12] = Data;
|
||||
}
|
||||
if (RegAddr == rTxAGC_B_Mcs15_Mcs12) {
|
||||
pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][13] = Data;
|
||||
pHalData->pwrGroupCnt++;
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* Function: phy_ConfigBBWithPgHeaderFile
|
||||
*
|
||||
* Overview: Config PHY_REG_PG array
|
||||
*
|
||||
* Input: NONE
|
||||
*
|
||||
* Output: NONE
|
||||
*
|
||||
* Return: NONE
|
||||
*
|
||||
* Revised History:
|
||||
* When Who Remark
|
||||
* 11/06/2008 MHC Add later!!!!!!.. Please modify for new files!!!!
|
||||
* 11/10/2008 tynli Modify to mew files.
|
||||
*---------------------------------------------------------------------------*/
|
||||
static int
|
||||
phy_ConfigBBWithPgHeaderFile(struct rtw_adapter *Adapter)
|
||||
{
|
||||
int i;
|
||||
u32 *Rtl819XPHY_REGArray_Table_PG;
|
||||
u16 PHY_REGArrayPGLen;
|
||||
|
||||
PHY_REGArrayPGLen = Rtl8723_PHY_REG_Array_PGLength;
|
||||
Rtl819XPHY_REGArray_Table_PG = (u32 *)Rtl8723_PHY_REG_Array_PG;
|
||||
|
||||
for (i = 0; i < PHY_REGArrayPGLen; i = i + 3) {
|
||||
storePwrIndexDiffRateOffset(Adapter,
|
||||
Rtl819XPHY_REGArray_Table_PG[i],
|
||||
Rtl819XPHY_REGArray_Table_PG[i+1],
|
||||
Rtl819XPHY_REGArray_Table_PG[i+2]);
|
||||
}
|
||||
|
||||
return _SUCCESS;
|
||||
}
|
||||
|
||||
static void
|
||||
phy_BB8192C_Config_1T(struct rtw_adapter *Adapter)
|
||||
{
|
||||
/* for path - B */
|
||||
PHY_SetBBReg(Adapter, rFPGA0_TxInfo, 0x3, 0x2);
|
||||
PHY_SetBBReg(Adapter, rFPGA1_TxInfo, 0x300033, 0x200022);
|
||||
|
||||
/* 20100519 Joseph: Add for 1T2R config. Suggested by Kevin,
|
||||
Jenyu and Yunan. */
|
||||
PHY_SetBBReg(Adapter, rCCK0_AFESetting, bMaskByte3, 0x45);
|
||||
PHY_SetBBReg(Adapter, rOFDM0_TRxPathEnable, bMaskByte0, 0x23);
|
||||
/* B path first AGC */
|
||||
PHY_SetBBReg(Adapter, rOFDM0_AGCParameter1, 0x30, 0x1);
|
||||
|
||||
PHY_SetBBReg(Adapter, 0xe74, 0x0c000000, 0x2);
|
||||
PHY_SetBBReg(Adapter, 0xe78, 0x0c000000, 0x2);
|
||||
PHY_SetBBReg(Adapter, 0xe7c, 0x0c000000, 0x2);
|
||||
PHY_SetBBReg(Adapter, 0xe80, 0x0c000000, 0x2);
|
||||
PHY_SetBBReg(Adapter, 0xe88, 0x0c000000, 0x2);
|
||||
}
|
||||
|
||||
static int
|
||||
phy_BB8723a_Config_ParaFile(struct rtw_adapter *Adapter)
|
||||
{
|
||||
struct eeprom_priv *pEEPROM = GET_EEPROM_EFUSE_PRIV(Adapter);
|
||||
struct hal_data_8723a *pHalData = GET_HAL_DATA(Adapter);
|
||||
int rtStatus = _SUCCESS;
|
||||
|
||||
/* */
|
||||
/* 1. Read PHY_REG.TXT BB INIT!! */
|
||||
/* We will separate as 88C / 92C according to chip version */
|
||||
/* */
|
||||
ODM_ReadAndConfig_PHY_REG_1T_8723A(&pHalData->odmpriv);
|
||||
|
||||
/* */
|
||||
/* 20100318 Joseph: Config 2T2R to 1T2R if necessary. */
|
||||
/* */
|
||||
if (pHalData->rf_type == RF_1T2R) {
|
||||
phy_BB8192C_Config_1T(Adapter);
|
||||
DBG_8723A("phy_BB8723a_Config_ParaFile():Config to 1T!!\n");
|
||||
}
|
||||
|
||||
/* */
|
||||
/* 2. If EEPROM or EFUSE autoload OK, We must config by
|
||||
PHY_REG_PG.txt */
|
||||
/* */
|
||||
if (pEEPROM->bautoload_fail_flag == false) {
|
||||
pHalData->pwrGroupCnt = 0;
|
||||
|
||||
rtStatus = phy_ConfigBBWithPgHeaderFile(Adapter);
|
||||
}
|
||||
|
||||
if (rtStatus != _SUCCESS)
|
||||
goto phy_BB8190_Config_ParaFile_Fail;
|
||||
|
||||
/* */
|
||||
/* 3. BB AGC table Initialization */
|
||||
/* */
|
||||
ODM_ReadAndConfig_AGC_TAB_1T_8723A(&pHalData->odmpriv);
|
||||
|
||||
phy_BB8190_Config_ParaFile_Fail:
|
||||
|
||||
return rtStatus;
|
||||
}
|
||||
|
||||
int
|
||||
PHY_BBConfig8723A(struct rtw_adapter *Adapter)
|
||||
{
|
||||
int rtStatus = _SUCCESS;
|
||||
struct hal_data_8723a *pHalData = GET_HAL_DATA(Adapter);
|
||||
u8 TmpU1B = 0;
|
||||
u8 CrystalCap;
|
||||
|
||||
phy_InitBBRFRegisterDefinition(Adapter);
|
||||
|
||||
/* Suggested by Scott. tynli_test. 2010.12.30. */
|
||||
/* 1. 0x28[1] = 1 */
|
||||
TmpU1B = rtl8723au_read8(Adapter, REG_AFE_PLL_CTRL);
|
||||
udelay(2);
|
||||
rtl8723au_write8(Adapter, REG_AFE_PLL_CTRL, TmpU1B | BIT(1));
|
||||
udelay(2);
|
||||
|
||||
/* 2. 0x29[7:0] = 0xFF */
|
||||
rtl8723au_write8(Adapter, REG_AFE_PLL_CTRL+1, 0xff);
|
||||
udelay(2);
|
||||
|
||||
/* 3. 0x02[1:0] = 2b'11 */
|
||||
TmpU1B = rtl8723au_read8(Adapter, REG_SYS_FUNC_EN);
|
||||
rtl8723au_write8(Adapter, REG_SYS_FUNC_EN,
|
||||
(TmpU1B | FEN_BB_GLB_RSTn | FEN_BBRSTB));
|
||||
|
||||
/* 4. 0x25[6] = 0 */
|
||||
TmpU1B = rtl8723au_read8(Adapter, REG_AFE_XTAL_CTRL + 1);
|
||||
rtl8723au_write8(Adapter, REG_AFE_XTAL_CTRL+1, TmpU1B & ~BIT(6));
|
||||
|
||||
/* 5. 0x24[20] = 0 Advised by SD3 Alex Wang. 2011.02.09. */
|
||||
TmpU1B = rtl8723au_read8(Adapter, REG_AFE_XTAL_CTRL+2);
|
||||
rtl8723au_write8(Adapter, REG_AFE_XTAL_CTRL+2, TmpU1B & ~BIT(4));
|
||||
|
||||
/* 6. 0x1f[7:0] = 0x07 */
|
||||
rtl8723au_write8(Adapter, REG_RF_CTRL, 0x07);
|
||||
|
||||
/* */
|
||||
/* Config BB and AGC */
|
||||
/* */
|
||||
rtStatus = phy_BB8723a_Config_ParaFile(Adapter);
|
||||
|
||||
/* only for B-cut */
|
||||
if (pHalData->EEPROMVersion >= 0x01) {
|
||||
CrystalCap = pHalData->CrystalCap & 0x3F;
|
||||
PHY_SetBBReg(Adapter, REG_MAC_PHY_CTRL, 0xFFF000,
|
||||
(CrystalCap | (CrystalCap << 6)));
|
||||
}
|
||||
|
||||
rtl8723au_write32(Adapter, REG_LDOA15_CTRL, 0x01572505);
|
||||
return rtStatus;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* Function: SetTxPowerLevel8723A()
|
||||
*
|
||||
* Overview: This function is export to "HalCommon" moudule
|
||||
* We must consider RF path later!!!!!!!
|
||||
*
|
||||
* Input: struct rtw_adapter * Adapter
|
||||
* u8 channel
|
||||
*
|
||||
* Output: NONE
|
||||
*
|
||||
* Return: NONE
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
void PHY_SetTxPowerLevel8723A(struct rtw_adapter *Adapter, u8 channel)
|
||||
{
|
||||
struct hal_data_8723a *pHalData = GET_HAL_DATA(Adapter);
|
||||
u8 cckpwr[2], ofdmpwr[2]; /* [0]:RF-A, [1]:RF-B */
|
||||
int i = channel - 1;
|
||||
|
||||
if (pHalData->bTXPowerDataReadFromEEPORM == false)
|
||||
return;
|
||||
|
||||
/* 1. CCK */
|
||||
cckpwr[RF_PATH_A] = pHalData->TxPwrLevelCck[RF_PATH_A][i];
|
||||
cckpwr[RF_PATH_B] = pHalData->TxPwrLevelCck[RF_PATH_B][i];
|
||||
|
||||
/* 2. OFDM for 1S or 2S */
|
||||
if (GET_RF_TYPE(Adapter) == RF_1T2R ||
|
||||
GET_RF_TYPE(Adapter) == RF_1T1R) {
|
||||
/* Read HT 40 OFDM TX power */
|
||||
ofdmpwr[RF_PATH_A] = pHalData->TxPwrLevelHT40_1S[RF_PATH_A][i];
|
||||
ofdmpwr[RF_PATH_B] = pHalData->TxPwrLevelHT40_1S[RF_PATH_B][i];
|
||||
} else if (GET_RF_TYPE(Adapter) == RF_2T2R) {
|
||||
/* Read HT 40 OFDM TX power */
|
||||
ofdmpwr[RF_PATH_A] = pHalData->TxPwrLevelHT40_2S[RF_PATH_A][i];
|
||||
ofdmpwr[RF_PATH_B] = pHalData->TxPwrLevelHT40_2S[RF_PATH_B][i];
|
||||
}
|
||||
|
||||
rtl823a_phy_rf6052setccktxpower(Adapter, &cckpwr[0]);
|
||||
rtl8723a_PHY_RF6052SetOFDMTxPower(Adapter, &ofdmpwr[0], channel);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* Function: PHY_SetBWMode23aCallback8192C()
|
||||
*
|
||||
* Overview: Timer callback function for SetSetBWMode23a
|
||||
*
|
||||
* Input: PRT_TIMER pTimer
|
||||
*
|
||||
* Output: NONE
|
||||
*
|
||||
* Return: NONE
|
||||
*
|
||||
* Note:
|
||||
* (1) We do not take j mode into consideration now
|
||||
* (2) Will two workitem of "switch channel" and
|
||||
* "switch channel bandwidth" run concurrently?
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
_PHY_SetBWMode23a92C(struct rtw_adapter *Adapter)
|
||||
{
|
||||
struct hal_data_8723a *pHalData = GET_HAL_DATA(Adapter);
|
||||
u8 regBwOpMode;
|
||||
u8 regRRSR_RSC;
|
||||
|
||||
if (Adapter->bDriverStopped)
|
||||
return;
|
||||
|
||||
/* 3 */
|
||||
/* 3<1>Set MAC register */
|
||||
/* 3 */
|
||||
|
||||
regBwOpMode = rtl8723au_read8(Adapter, REG_BWOPMODE);
|
||||
regRRSR_RSC = rtl8723au_read8(Adapter, REG_RRSR+2);
|
||||
|
||||
switch (pHalData->CurrentChannelBW) {
|
||||
case HT_CHANNEL_WIDTH_20:
|
||||
regBwOpMode |= BW_OPMODE_20MHZ;
|
||||
rtl8723au_write8(Adapter, REG_BWOPMODE, regBwOpMode);
|
||||
break;
|
||||
case HT_CHANNEL_WIDTH_40:
|
||||
regBwOpMode &= ~BW_OPMODE_20MHZ;
|
||||
rtl8723au_write8(Adapter, REG_BWOPMODE, regBwOpMode);
|
||||
regRRSR_RSC = (regRRSR_RSC & 0x90) |
|
||||
(pHalData->nCur40MhzPrimeSC << 5);
|
||||
rtl8723au_write8(Adapter, REG_RRSR+2, regRRSR_RSC);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
/* 3 */
|
||||
/* 3<2>Set PHY related register */
|
||||
/* 3 */
|
||||
switch (pHalData->CurrentChannelBW) {
|
||||
/* 20 MHz channel*/
|
||||
case HT_CHANNEL_WIDTH_20:
|
||||
PHY_SetBBReg(Adapter, rFPGA0_RFMOD, bRFMOD, 0x0);
|
||||
PHY_SetBBReg(Adapter, rFPGA1_RFMOD, bRFMOD, 0x0);
|
||||
PHY_SetBBReg(Adapter, rFPGA0_AnalogParameter2, BIT(10), 1);
|
||||
|
||||
break;
|
||||
|
||||
/* 40 MHz channel*/
|
||||
case HT_CHANNEL_WIDTH_40:
|
||||
PHY_SetBBReg(Adapter, rFPGA0_RFMOD, bRFMOD, 0x1);
|
||||
PHY_SetBBReg(Adapter, rFPGA1_RFMOD, bRFMOD, 0x1);
|
||||
|
||||
/* Set Control channel to upper or lower. These settings
|
||||
are required only for 40MHz */
|
||||
PHY_SetBBReg(Adapter, rCCK0_System, bCCKSideBand,
|
||||
(pHalData->nCur40MhzPrimeSC >> 1));
|
||||
PHY_SetBBReg(Adapter, rOFDM1_LSTF, 0xC00,
|
||||
pHalData->nCur40MhzPrimeSC);
|
||||
PHY_SetBBReg(Adapter, rFPGA0_AnalogParameter2, BIT(10), 0);
|
||||
|
||||
PHY_SetBBReg(Adapter, 0x818, BIT(26) | BIT(27),
|
||||
(pHalData->nCur40MhzPrimeSC ==
|
||||
HAL_PRIME_CHNL_OFFSET_LOWER) ? 2:1);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
/* Skip over setting of J-mode in BB register here. Default value
|
||||
is "None J mode". Emily 20070315 */
|
||||
|
||||
/* Added it for 20/40 mhz switch time evaluation by guangan 070531 */
|
||||
/* NowL = PlatformEFIORead4Byte(Adapter, TSFR); */
|
||||
/* NowH = PlatformEFIORead4Byte(Adapter, TSFR+4); */
|
||||
/* EndTime = ((u64)NowH << 32) + NowL; */
|
||||
|
||||
rtl8723a_phy_rf6052set_bw(Adapter, pHalData->CurrentChannelBW);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* Function: SetBWMode23a8190Pci()
|
||||
*
|
||||
* Overview: This function is export to "HalCommon" moudule
|
||||
*
|
||||
* Input: struct rtw_adapter * Adapter
|
||||
* enum ht_channel_width Bandwidth 20M or 40M
|
||||
*
|
||||
* Output: NONE
|
||||
*
|
||||
* Return: NONE
|
||||
*
|
||||
* Note: We do not take j mode into consideration now
|
||||
*---------------------------------------------------------------------------*/
|
||||
void
|
||||
PHY_SetBWMode23a8723A(struct rtw_adapter *Adapter,
|
||||
enum ht_channel_width Bandwidth, unsigned char Offset)
|
||||
{
|
||||
struct hal_data_8723a *pHalData = GET_HAL_DATA(Adapter);
|
||||
enum ht_channel_width tmpBW = pHalData->CurrentChannelBW;
|
||||
|
||||
pHalData->CurrentChannelBW = Bandwidth;
|
||||
|
||||
pHalData->nCur40MhzPrimeSC = Offset;
|
||||
|
||||
if ((!Adapter->bDriverStopped) && (!Adapter->bSurpriseRemoved))
|
||||
_PHY_SetBWMode23a92C(Adapter);
|
||||
else
|
||||
pHalData->CurrentChannelBW = tmpBW;
|
||||
}
|
||||
|
||||
static void _PHY_SwChnl8723A(struct rtw_adapter *Adapter, u8 channel)
|
||||
{
|
||||
enum RF_RADIO_PATH eRFPath;
|
||||
u32 param1, param2;
|
||||
struct hal_data_8723a *pHalData = GET_HAL_DATA(Adapter);
|
||||
|
||||
/* s1. pre common command - CmdID_SetTxPowerLevel */
|
||||
PHY_SetTxPowerLevel8723A(Adapter, channel);
|
||||
|
||||
/* s2. RF dependent command - CmdID_RF_WriteReg,
|
||||
param1 = RF_CHNLBW, param2 = channel */
|
||||
param1 = RF_CHNLBW;
|
||||
param2 = channel;
|
||||
for (eRFPath = 0; eRFPath < pHalData->NumTotalRFPath; eRFPath++) {
|
||||
pHalData->RfRegChnlVal[eRFPath] =
|
||||
(pHalData->RfRegChnlVal[eRFPath] & 0xfffffc00) | param2;
|
||||
PHY_SetRFReg(Adapter, eRFPath, param1,
|
||||
bRFRegOffsetMask, pHalData->RfRegChnlVal[eRFPath]);
|
||||
}
|
||||
|
||||
/* s3. post common command - CmdID_End, None */
|
||||
}
|
||||
|
||||
void PHY_SwChnl8723A(struct rtw_adapter *Adapter, u8 channel)
|
||||
{
|
||||
struct hal_data_8723a *pHalData = GET_HAL_DATA(Adapter);
|
||||
u8 tmpchannel = pHalData->CurrentChannel;
|
||||
bool result = true;
|
||||
|
||||
if (channel == 0)
|
||||
channel = 1;
|
||||
|
||||
pHalData->CurrentChannel = channel;
|
||||
|
||||
if ((!Adapter->bDriverStopped) && (!Adapter->bSurpriseRemoved)) {
|
||||
_PHY_SwChnl8723A(Adapter, channel);
|
||||
|
||||
if (!result)
|
||||
pHalData->CurrentChannel = tmpchannel;
|
||||
} else {
|
||||
pHalData->CurrentChannel = tmpchannel;
|
||||
}
|
||||
}
|
|
@ -1,503 +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.
|
||||
*
|
||||
******************************************************************************/
|
||||
/******************************************************************************
|
||||
*
|
||||
*
|
||||
* Module: rtl8192c_rf6052.c (Source C File)
|
||||
*
|
||||
* Note: Provide RF 6052 series relative API.
|
||||
*
|
||||
* Function:
|
||||
*
|
||||
* Export:
|
||||
*
|
||||
* Abbrev:
|
||||
*
|
||||
* History:
|
||||
* Data Who Remark
|
||||
*
|
||||
* 09/25/2008 MHC Create initial version.
|
||||
* 11/05/2008 MHC Add API for tw power setting.
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#define _RTL8723A_RF6052_C_
|
||||
|
||||
#include <osdep_service.h>
|
||||
#include <drv_types.h>
|
||||
|
||||
#include <rtl8723a_hal.h>
|
||||
#include <usb_ops_linux.h>
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* Function: PHY_RF6052SetBandwidth()
|
||||
*
|
||||
* Overview: This function is called by SetBWMode23aCallback8190Pci() only
|
||||
*
|
||||
* Input: struct rtw_adapter * Adapter
|
||||
* WIRELESS_BANDWIDTH_E Bandwidth 20M or 40M
|
||||
*
|
||||
* Output: NONE
|
||||
*
|
||||
* Return: NONE
|
||||
*
|
||||
* Note: For RF type 0222D
|
||||
*---------------------------------------------------------------------------*/
|
||||
void rtl8723a_phy_rf6052set_bw(struct rtw_adapter *Adapter,
|
||||
enum ht_channel_width Bandwidth) /* 20M or 40M */
|
||||
{
|
||||
struct hal_data_8723a *pHalData = GET_HAL_DATA(Adapter);
|
||||
|
||||
switch (Bandwidth) {
|
||||
case HT_CHANNEL_WIDTH_20:
|
||||
pHalData->RfRegChnlVal[0] =
|
||||
(pHalData->RfRegChnlVal[0] & 0xfffff3ff) | 0x0400;
|
||||
PHY_SetRFReg(Adapter, RF_PATH_A, RF_CHNLBW, bRFRegOffsetMask,
|
||||
pHalData->RfRegChnlVal[0]);
|
||||
break;
|
||||
case HT_CHANNEL_WIDTH_40:
|
||||
pHalData->RfRegChnlVal[0] =
|
||||
(pHalData->RfRegChnlVal[0] & 0xfffff3ff);
|
||||
PHY_SetRFReg(Adapter, RF_PATH_A, RF_CHNLBW, bRFRegOffsetMask,
|
||||
pHalData->RfRegChnlVal[0]);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* Function: PHY_RF6052SetCckTxPower
|
||||
*
|
||||
* Overview:
|
||||
*
|
||||
* Input: NONE
|
||||
*
|
||||
* Output: NONE
|
||||
*
|
||||
* Return: NONE
|
||||
*
|
||||
* Revised History:
|
||||
* When Who Remark
|
||||
* 11/05/2008 MHC Simulate 8192series..
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
void rtl823a_phy_rf6052setccktxpower(struct rtw_adapter *Adapter,
|
||||
u8 *pPowerlevel)
|
||||
{
|
||||
struct hal_data_8723a *pHalData = GET_HAL_DATA(Adapter);
|
||||
struct dm_priv *pdmpriv = &pHalData->dmpriv;
|
||||
struct mlme_ext_priv *pmlmeext = &Adapter->mlmeextpriv;
|
||||
u32 TxAGC[2] = {0, 0}, tmpval = 0;
|
||||
u8 idx1, idx2;
|
||||
u8 *ptr;
|
||||
|
||||
if (pmlmeext->sitesurvey_res.state == SCAN_PROCESS) {
|
||||
TxAGC[RF_PATH_A] = 0x3f3f3f3f;
|
||||
TxAGC[RF_PATH_B] = 0x3f3f3f3f;
|
||||
|
||||
for (idx1 = RF_PATH_A; idx1 <= RF_PATH_B; idx1++) {
|
||||
TxAGC[idx1] = pPowerlevel[idx1] |
|
||||
(pPowerlevel[idx1] << 8) |
|
||||
(pPowerlevel[idx1] << 16) |
|
||||
(pPowerlevel[idx1] << 24);
|
||||
/*
|
||||
* 2010/10/18 MH For external PA module. We need
|
||||
* to limit power index to be less than 0x20.
|
||||
*/
|
||||
if (TxAGC[idx1] > 0x20 && pHalData->ExternalPA)
|
||||
TxAGC[idx1] = 0x20;
|
||||
}
|
||||
} else {
|
||||
/* 20100427 Joseph: Driver dynamic Tx power shall not affect Tx
|
||||
* power. It shall be determined by power training mechanism. */
|
||||
/* Currently, we cannot fully disable driver dynamic tx power
|
||||
* mechanism because it is referenced by BT coexist mechanism. */
|
||||
/* In the future, two mechanism shall be separated from each other
|
||||
* and maintained independently. Thanks for Lanhsin's reminder. */
|
||||
if (pdmpriv->DynamicTxHighPowerLvl == TxHighPwrLevel_Level1) {
|
||||
TxAGC[RF_PATH_A] = 0x10101010;
|
||||
TxAGC[RF_PATH_B] = 0x10101010;
|
||||
} else if (pdmpriv->DynamicTxHighPowerLvl ==
|
||||
TxHighPwrLevel_Level2) {
|
||||
TxAGC[RF_PATH_A] = 0x00000000;
|
||||
TxAGC[RF_PATH_B] = 0x00000000;
|
||||
} else {
|
||||
for (idx1 = RF_PATH_A; idx1 <= RF_PATH_B; idx1++) {
|
||||
TxAGC[idx1] = pPowerlevel[idx1] |
|
||||
(pPowerlevel[idx1] << 8) |
|
||||
(pPowerlevel[idx1] << 16) |
|
||||
(pPowerlevel[idx1] << 24);
|
||||
}
|
||||
|
||||
if (pHalData->EEPROMRegulatory == 0) {
|
||||
tmpval = (pHalData->MCSTxPowerLevelOriginalOffset[0][6]) +
|
||||
(pHalData->MCSTxPowerLevelOriginalOffset[0][7]<<8);
|
||||
TxAGC[RF_PATH_A] += tmpval;
|
||||
|
||||
tmpval = (pHalData->MCSTxPowerLevelOriginalOffset[0][14]) +
|
||||
(pHalData->MCSTxPowerLevelOriginalOffset[0][15]<<24);
|
||||
TxAGC[RF_PATH_B] += tmpval;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (idx1 = RF_PATH_A; idx1 <= RF_PATH_B; idx1++) {
|
||||
ptr = (u8 *)(&TxAGC[idx1]);
|
||||
for (idx2 = 0; idx2 < 4; idx2++) {
|
||||
if (*ptr > RF6052_MAX_TX_PWR)
|
||||
*ptr = RF6052_MAX_TX_PWR;
|
||||
ptr++;
|
||||
}
|
||||
}
|
||||
|
||||
/* rf-A cck tx power */
|
||||
tmpval = TxAGC[RF_PATH_A] & 0xff;
|
||||
PHY_SetBBReg(Adapter, rTxAGC_A_CCK1_Mcs32, bMaskByte1, tmpval);
|
||||
tmpval = TxAGC[RF_PATH_A] >> 8;
|
||||
PHY_SetBBReg(Adapter, rTxAGC_B_CCK11_A_CCK2_11, 0xffffff00, tmpval);
|
||||
|
||||
/* rf-B cck tx power */
|
||||
tmpval = TxAGC[RF_PATH_B] >> 24;
|
||||
PHY_SetBBReg(Adapter, rTxAGC_B_CCK11_A_CCK2_11, bMaskByte0, tmpval);
|
||||
tmpval = TxAGC[RF_PATH_B] & 0x00ffffff;
|
||||
PHY_SetBBReg(Adapter, rTxAGC_B_CCK1_55_Mcs32, 0xffffff00, tmpval);
|
||||
} /* PHY_RF6052SetCckTxPower */
|
||||
|
||||
/* powerbase0 for OFDM rates */
|
||||
/* powerbase1 for HT MCS rates */
|
||||
static void getPowerBase(struct rtw_adapter *Adapter, u8 *pPowerLevel,
|
||||
u8 Channel, u32 *OfdmBase, u32 *MCSBase)
|
||||
{
|
||||
struct hal_data_8723a *pHalData = GET_HAL_DATA(Adapter);
|
||||
u32 ofdm, mcs;
|
||||
u8 Legacy_pwrdiff = 0;
|
||||
s8 HT20_pwrdiff = 0;
|
||||
u8 i, powerlevel[2];
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
powerlevel[i] = pPowerLevel[i];
|
||||
Legacy_pwrdiff = pHalData->TxPwrLegacyHtDiff[i][Channel-1];
|
||||
ofdm = powerlevel[i] + Legacy_pwrdiff;
|
||||
|
||||
ofdm = ofdm << 24 | ofdm << 16 | ofdm << 8 | ofdm;
|
||||
*(OfdmBase + i) = ofdm;
|
||||
}
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
/* Check HT20 to HT40 diff */
|
||||
if (pHalData->CurrentChannelBW == HT_CHANNEL_WIDTH_20) {
|
||||
HT20_pwrdiff = pHalData->TxPwrHt20Diff[i][Channel-1];
|
||||
powerlevel[i] += HT20_pwrdiff;
|
||||
}
|
||||
mcs = powerlevel[i];
|
||||
mcs = mcs << 24 | mcs << 16 | mcs << 8 | mcs;
|
||||
*(MCSBase + i) = mcs;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
getTxPowerWriteValByRegulatory(struct rtw_adapter *Adapter, u8 Channel,
|
||||
u8 index, u32 *powerBase0, u32 *powerBase1,
|
||||
u32 *pOutWriteVal)
|
||||
{
|
||||
struct hal_data_8723a *pHalData = GET_HAL_DATA(Adapter);
|
||||
struct dm_priv *pdmpriv = &pHalData->dmpriv;
|
||||
u8 i, chnlGroup = 0, pwr_diff_limit[4];
|
||||
u32 writeVal, customer_limit, rf;
|
||||
|
||||
/* Index 0 & 1 = legacy OFDM, 2-5 = HT_MCS rate */
|
||||
for (rf = 0; rf < 2; rf++) {
|
||||
switch (pHalData->EEPROMRegulatory) {
|
||||
case 0: /* Realtek better performance */
|
||||
/* increase power diff defined by Realtek for
|
||||
* large power */
|
||||
chnlGroup = 0;
|
||||
writeVal = pHalData->MCSTxPowerLevelOriginalOffset[chnlGroup][index+(rf?8:0)] +
|
||||
((index < 2) ? powerBase0[rf] : powerBase1[rf]);
|
||||
break;
|
||||
case 1: /* Realtek regulatory */
|
||||
/* increase power diff defined by Realtek for
|
||||
* regulatory */
|
||||
if (pHalData->pwrGroupCnt == 1)
|
||||
chnlGroup = 0;
|
||||
if (pHalData->pwrGroupCnt >= 3) {
|
||||
if (Channel <= 3)
|
||||
chnlGroup = 0;
|
||||
else if (Channel >= 4 && Channel <= 9)
|
||||
chnlGroup = 1;
|
||||
else if (Channel > 9)
|
||||
chnlGroup = 2;
|
||||
|
||||
if (pHalData->CurrentChannelBW ==
|
||||
HT_CHANNEL_WIDTH_20)
|
||||
chnlGroup++;
|
||||
else
|
||||
chnlGroup += 4;
|
||||
}
|
||||
writeVal = pHalData->MCSTxPowerLevelOriginalOffset[chnlGroup][index+(rf?8:0)] +
|
||||
((index < 2) ? powerBase0[rf] :
|
||||
powerBase1[rf]);
|
||||
break;
|
||||
case 2: /* Better regulatory */
|
||||
/* don't increase any power diff */
|
||||
writeVal = (index < 2) ? powerBase0[rf] :
|
||||
powerBase1[rf];
|
||||
break;
|
||||
case 3: /* Customer defined power diff. */
|
||||
chnlGroup = 0;
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
pwr_diff_limit[i] = (u8)((pHalData->MCSTxPowerLevelOriginalOffset[chnlGroup][index +
|
||||
(rf ? 8 : 0)]&(0x7f << (i*8))) >> (i*8));
|
||||
if (pHalData->CurrentChannelBW == HT_CHANNEL_WIDTH_40) {
|
||||
if (pwr_diff_limit[i] > pHalData->PwrGroupHT40[rf][Channel-1])
|
||||
pwr_diff_limit[i] = pHalData->PwrGroupHT40[rf][Channel-1];
|
||||
} else {
|
||||
if (pwr_diff_limit[i] > pHalData->PwrGroupHT20[rf][Channel-1])
|
||||
pwr_diff_limit[i] = pHalData->PwrGroupHT20[rf][Channel-1];
|
||||
}
|
||||
}
|
||||
customer_limit = (pwr_diff_limit[3]<<24) | (pwr_diff_limit[2]<<16) |
|
||||
(pwr_diff_limit[1]<<8) | (pwr_diff_limit[0]);
|
||||
writeVal = customer_limit + ((index<2)?powerBase0[rf]:powerBase1[rf]);
|
||||
break;
|
||||
default:
|
||||
chnlGroup = 0;
|
||||
writeVal = pHalData->MCSTxPowerLevelOriginalOffset[chnlGroup][index+(rf?8:0)] +
|
||||
((index < 2) ? powerBase0[rf] : powerBase1[rf]);
|
||||
break;
|
||||
}
|
||||
|
||||
/* 20100427 Joseph: Driver dynamic Tx power shall not affect Tx power.
|
||||
It shall be determined by power training mechanism. */
|
||||
/* Currently, we cannot fully disable driver dynamic tx power mechanism
|
||||
because it is referenced by BT coexist mechanism. */
|
||||
/* In the future, two mechanism shall be separated from each other and
|
||||
maintained independently. Thanks for Lanhsin's reminder. */
|
||||
|
||||
if (pdmpriv->DynamicTxHighPowerLvl == TxHighPwrLevel_Level1)
|
||||
writeVal = 0x14141414;
|
||||
else if (pdmpriv->DynamicTxHighPowerLvl ==
|
||||
TxHighPwrLevel_Level2)
|
||||
writeVal = 0x00000000;
|
||||
|
||||
/* 20100628 Joseph: High power mode for BT-Coexist mechanism. */
|
||||
/* This mechanism is only applied when
|
||||
Driver-Highpower-Mechanism is OFF. */
|
||||
if (pdmpriv->DynamicTxHighPowerLvl == TxHighPwrLevel_BT1)
|
||||
writeVal = writeVal - 0x06060606;
|
||||
else if (pdmpriv->DynamicTxHighPowerLvl == TxHighPwrLevel_BT2)
|
||||
writeVal = writeVal;
|
||||
*(pOutWriteVal + rf) = writeVal;
|
||||
}
|
||||
}
|
||||
|
||||
static void writeOFDMPowerReg(struct rtw_adapter *Adapter, u8 index,
|
||||
u32 *pValue)
|
||||
{
|
||||
struct hal_data_8723a *pHalData = GET_HAL_DATA(Adapter);
|
||||
u16 RegOffset_A[6] = {
|
||||
rTxAGC_A_Rate18_06, rTxAGC_A_Rate54_24,
|
||||
rTxAGC_A_Mcs03_Mcs00, rTxAGC_A_Mcs07_Mcs04,
|
||||
rTxAGC_A_Mcs11_Mcs08, rTxAGC_A_Mcs15_Mcs12
|
||||
};
|
||||
u16 RegOffset_B[6] = {
|
||||
rTxAGC_B_Rate18_06, rTxAGC_B_Rate54_24,
|
||||
rTxAGC_B_Mcs03_Mcs00, rTxAGC_B_Mcs07_Mcs04,
|
||||
rTxAGC_B_Mcs11_Mcs08, rTxAGC_B_Mcs15_Mcs12
|
||||
};
|
||||
u8 i, rf, pwr_val[4];
|
||||
u32 writeVal;
|
||||
u16 RegOffset;
|
||||
|
||||
for (rf = 0; rf < 2; rf++) {
|
||||
writeVal = pValue[rf];
|
||||
for (i = 0; i < 4; i++) {
|
||||
pwr_val[i] = (u8)((writeVal &
|
||||
(0x7f << (i * 8))) >> (i * 8));
|
||||
if (pwr_val[i] > RF6052_MAX_TX_PWR)
|
||||
pwr_val[i] = RF6052_MAX_TX_PWR;
|
||||
}
|
||||
writeVal = pwr_val[3] << 24 | pwr_val[2] << 16 |
|
||||
pwr_val[1] << 8 | pwr_val[0];
|
||||
|
||||
if (rf == 0)
|
||||
RegOffset = RegOffset_A[index];
|
||||
else
|
||||
RegOffset = RegOffset_B[index];
|
||||
|
||||
rtl8723au_write32(Adapter, RegOffset, writeVal);
|
||||
|
||||
/* 201005115 Joseph: Set Tx Power diff for Tx power
|
||||
training mechanism. */
|
||||
if (((pHalData->rf_type == RF_2T2R) &&
|
||||
(RegOffset == rTxAGC_A_Mcs15_Mcs12 ||
|
||||
RegOffset == rTxAGC_B_Mcs15_Mcs12)) ||
|
||||
((pHalData->rf_type != RF_2T2R) &&
|
||||
(RegOffset == rTxAGC_A_Mcs07_Mcs04 ||
|
||||
RegOffset == rTxAGC_B_Mcs07_Mcs04))) {
|
||||
writeVal = pwr_val[3];
|
||||
if (RegOffset == rTxAGC_A_Mcs15_Mcs12 ||
|
||||
RegOffset == rTxAGC_A_Mcs07_Mcs04)
|
||||
RegOffset = 0xc90;
|
||||
if (RegOffset == rTxAGC_B_Mcs15_Mcs12 ||
|
||||
RegOffset == rTxAGC_B_Mcs07_Mcs04)
|
||||
RegOffset = 0xc98;
|
||||
for (i = 0; i < 3; i++) {
|
||||
if (i != 2)
|
||||
writeVal = (writeVal > 8) ?
|
||||
(writeVal - 8) : 0;
|
||||
else
|
||||
writeVal = (writeVal > 6) ?
|
||||
(writeVal - 6) : 0;
|
||||
rtl8723au_write8(Adapter, RegOffset + i,
|
||||
(u8)writeVal);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------
|
||||
* Function: PHY_RF6052SetOFDMTxPower
|
||||
*
|
||||
* Overview: For legacy and HY OFDM, we must read EEPROM TX power index for
|
||||
* different channel and read original value in TX power
|
||||
* register area from 0xe00. We increase offset and
|
||||
* original value to be correct tx pwr.
|
||||
*
|
||||
* Input: NONE
|
||||
*
|
||||
* Output: NONE
|
||||
*
|
||||
* Return: NONE
|
||||
*
|
||||
* Revised History:
|
||||
* When Remark
|
||||
* 11/05/2008 MHC Simulate 8192 series method.
|
||||
* 01/06/2009 MHC 1. Prevent Path B tx power overflow or
|
||||
* underflow dure to A/B pwr difference or
|
||||
* legacy/HT pwr diff.
|
||||
* 2. We concern with path B legacy/HT OFDM difference.
|
||||
* 01/22/2009 MHC Support new EPRO format from SD3.
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
void rtl8723a_PHY_RF6052SetOFDMTxPower(struct rtw_adapter *Adapter,
|
||||
u8 *pPowerLevel, u8 Channel)
|
||||
{
|
||||
u32 writeVal[2], powerBase0[2], powerBase1[2];
|
||||
u8 index = 0;
|
||||
|
||||
getPowerBase(Adapter, pPowerLevel, Channel,
|
||||
&powerBase0[0], &powerBase1[0]);
|
||||
|
||||
for (index = 0; index < 6; index++) {
|
||||
getTxPowerWriteValByRegulatory(Adapter, Channel, index,
|
||||
&powerBase0[0], &powerBase1[0], &writeVal[0]);
|
||||
|
||||
writeOFDMPowerReg(Adapter, index, &writeVal[0]);
|
||||
}
|
||||
}
|
||||
|
||||
static int phy_RF6052_Config_ParaFile(struct rtw_adapter *Adapter)
|
||||
{
|
||||
u32 u4RegValue = 0;
|
||||
u8 eRFPath;
|
||||
struct bb_reg_define *pPhyReg;
|
||||
int rtStatus = _SUCCESS;
|
||||
struct hal_data_8723a *pHalData = GET_HAL_DATA(Adapter);
|
||||
|
||||
/* 3----------------------------------------------------------------- */
|
||||
/* 3 <2> Initialize RF */
|
||||
/* 3----------------------------------------------------------------- */
|
||||
for (eRFPath = 0; eRFPath < pHalData->NumTotalRFPath; eRFPath++) {
|
||||
|
||||
pPhyReg = &pHalData->PHYRegDef[eRFPath];
|
||||
|
||||
/*----Store original RFENV control type----*/
|
||||
switch (eRFPath) {
|
||||
case RF_PATH_A:
|
||||
u4RegValue = PHY_QueryBBReg(Adapter, pPhyReg->rfintfs,
|
||||
bRFSI_RFENV);
|
||||
break;
|
||||
case RF_PATH_B:
|
||||
u4RegValue = PHY_QueryBBReg(Adapter, pPhyReg->rfintfs,
|
||||
bRFSI_RFENV << 16);
|
||||
break;
|
||||
}
|
||||
|
||||
/*----Set RF_ENV enable----*/
|
||||
PHY_SetBBReg(Adapter, pPhyReg->rfintfe, bRFSI_RFENV << 16, 0x1);
|
||||
udelay(1);/* PlatformStallExecution(1); */
|
||||
|
||||
/*----Set RF_ENV output high----*/
|
||||
PHY_SetBBReg(Adapter, pPhyReg->rfintfo, bRFSI_RFENV, 0x1);
|
||||
udelay(1);/* PlatformStallExecution(1); */
|
||||
|
||||
/* Set bit number of Address and Data for RF register */
|
||||
PHY_SetBBReg(Adapter, pPhyReg->rfHSSIPara2, b3WireAddressLength,
|
||||
0x0); /* Set 1 to 4 bits for 8255 */
|
||||
udelay(1);/* PlatformStallExecution(1); */
|
||||
|
||||
PHY_SetBBReg(Adapter, pPhyReg->rfHSSIPara2, b3WireDataLength,
|
||||
0x0); /* Set 0 to 12 bits for 8255 */
|
||||
udelay(1);/* PlatformStallExecution(1); */
|
||||
|
||||
/*----Initialize RF fom connfiguration file----*/
|
||||
switch (eRFPath) {
|
||||
case RF_PATH_A:
|
||||
ODM_ReadAndConfig_RadioA_1T_8723A(&pHalData->odmpriv);
|
||||
break;
|
||||
case RF_PATH_B:
|
||||
break;
|
||||
}
|
||||
|
||||
/*----Restore RFENV control type----*/
|
||||
switch (eRFPath) {
|
||||
case RF_PATH_A:
|
||||
PHY_SetBBReg(Adapter, pPhyReg->rfintfs,
|
||||
bRFSI_RFENV, u4RegValue);
|
||||
break;
|
||||
case RF_PATH_B:
|
||||
PHY_SetBBReg(Adapter, pPhyReg->rfintfs,
|
||||
bRFSI_RFENV << 16, u4RegValue);
|
||||
break;
|
||||
}
|
||||
|
||||
if (rtStatus != _SUCCESS) {
|
||||
goto phy_RF6052_Config_ParaFile_Fail;
|
||||
}
|
||||
}
|
||||
phy_RF6052_Config_ParaFile_Fail:
|
||||
return rtStatus;
|
||||
}
|
||||
|
||||
int PHY_RF6052_Config8723A(struct rtw_adapter *Adapter)
|
||||
{
|
||||
struct hal_data_8723a *pHalData = GET_HAL_DATA(Adapter);
|
||||
|
||||
/* Initialize general global value */
|
||||
/* TODO: Extend RF_PATH_C and RF_PATH_D in the future */
|
||||
if (pHalData->rf_type == RF_1T1R)
|
||||
pHalData->NumTotalRFPath = 1;
|
||||
else
|
||||
pHalData->NumTotalRFPath = 2;
|
||||
|
||||
/* Config BB and RF */
|
||||
return phy_RF6052_Config_ParaFile(Adapter);
|
||||
}
|
||||
|
||||
/* End of HalRf6052.c */
|
|
@ -1,69 +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.
|
||||
*
|
||||
******************************************************************************/
|
||||
#define _RTL8723A_REDESC_C_
|
||||
|
||||
#include <osdep_service.h>
|
||||
#include <drv_types.h>
|
||||
#include <rtl8723a_hal.h>
|
||||
|
||||
static void process_rssi(struct rtw_adapter *padapter,
|
||||
struct recv_frame *prframe)
|
||||
{
|
||||
struct rx_pkt_attrib *pattrib = &prframe->attrib;
|
||||
struct signal_stat *signal_stat = &padapter->recvpriv.signal_strength_data;
|
||||
|
||||
if (signal_stat->update_req) {
|
||||
signal_stat->total_num = 0;
|
||||
signal_stat->total_val = 0;
|
||||
signal_stat->update_req = 0;
|
||||
}
|
||||
|
||||
signal_stat->total_num++;
|
||||
signal_stat->total_val += pattrib->phy_info.SignalStrength;
|
||||
signal_stat->avg_val = signal_stat->total_val / signal_stat->total_num;
|
||||
}
|
||||
|
||||
static void process_link_qual(struct rtw_adapter *padapter,
|
||||
struct recv_frame *prframe)
|
||||
{
|
||||
struct rx_pkt_attrib *pattrib;
|
||||
struct signal_stat *signal_stat;
|
||||
|
||||
if (prframe == NULL || padapter == NULL)
|
||||
return;
|
||||
|
||||
pattrib = &prframe->attrib;
|
||||
signal_stat = &padapter->recvpriv.signal_qual_data;
|
||||
|
||||
if (signal_stat->update_req) {
|
||||
signal_stat->total_num = 0;
|
||||
signal_stat->total_val = 0;
|
||||
signal_stat->update_req = 0;
|
||||
}
|
||||
|
||||
signal_stat->total_num++;
|
||||
signal_stat->total_val += pattrib->phy_info.SignalQuality;
|
||||
signal_stat->avg_val = signal_stat->total_val / signal_stat->total_num;
|
||||
}
|
||||
|
||||
/* void rtl8723a_process_phy_info(struct rtw_adapter *padapter, union recv_frame *prframe) */
|
||||
void rtl8723a_process_phy_info(struct rtw_adapter *padapter, void *prframe)
|
||||
{
|
||||
struct recv_frame *precvframe = prframe;
|
||||
/* Check RSSI */
|
||||
process_rssi(padapter, precvframe);
|
||||
/* Check EVM */
|
||||
process_link_qual(padapter, precvframe);
|
||||
}
|
|
@ -1,55 +0,0 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
#define _RTL8723A_SRESET_C_
|
||||
|
||||
#include <rtl8723a_sreset.h>
|
||||
#include <rtl8723a_hal.h>
|
||||
#include <usb_ops_linux.h>
|
||||
|
||||
void rtl8723a_sreset_xmit_status_check(struct rtw_adapter *padapter)
|
||||
{
|
||||
struct hal_data_8723a *pHalData = GET_HAL_DATA(padapter);
|
||||
struct sreset_priv *psrtpriv = &pHalData->srestpriv;
|
||||
|
||||
unsigned long current_time;
|
||||
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
|
||||
unsigned int diff_time;
|
||||
u32 txdma_status;
|
||||
|
||||
txdma_status = rtl8723au_read32(padapter, REG_TXDMA_STATUS);
|
||||
if (txdma_status != 0) {
|
||||
DBG_8723A("%s REG_TXDMA_STATUS:0x%08x\n", __func__, txdma_status);
|
||||
rtw_sreset_reset(padapter);
|
||||
}
|
||||
|
||||
current_time = jiffies;
|
||||
|
||||
if (0 == pxmitpriv->free_xmitbuf_cnt || 0 == pxmitpriv->free_xmit_extbuf_cnt) {
|
||||
|
||||
diff_time = jiffies_to_msecs(jiffies - psrtpriv->last_tx_time);
|
||||
|
||||
if (diff_time > 2000) {
|
||||
if (psrtpriv->last_tx_complete_time == 0) {
|
||||
psrtpriv->last_tx_complete_time = current_time;
|
||||
} else {
|
||||
diff_time = jiffies_to_msecs(jiffies - psrtpriv->last_tx_complete_time);
|
||||
if (diff_time > 4000) {
|
||||
DBG_8723A("%s tx hang\n", __func__);
|
||||
rtw_sreset_reset(padapter);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,267 +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.
|
||||
*
|
||||
******************************************************************************/
|
||||
#define _RTL8192CU_RECV_C_
|
||||
#include <osdep_service.h>
|
||||
#include <drv_types.h>
|
||||
#include <recv_osdep.h>
|
||||
#include <mlme_osdep.h>
|
||||
#include <linux/ip.h>
|
||||
#include <linux/if_ether.h>
|
||||
#include <usb_ops.h>
|
||||
#include <wifi.h>
|
||||
#include <rtl8723a_hal.h>
|
||||
|
||||
int rtl8723au_init_recv_priv(struct rtw_adapter *padapter)
|
||||
{
|
||||
struct recv_priv *precvpriv = &padapter->recvpriv;
|
||||
int i, size, res = _SUCCESS;
|
||||
struct recv_buf *precvbuf;
|
||||
unsigned long tmpaddr;
|
||||
unsigned long alignment;
|
||||
struct sk_buff *pskb;
|
||||
|
||||
tasklet_init(&precvpriv->recv_tasklet,
|
||||
(void(*)(unsigned long))rtl8723au_recv_tasklet,
|
||||
(unsigned long)padapter);
|
||||
|
||||
precvpriv->int_in_urb = usb_alloc_urb(0, GFP_KERNEL);
|
||||
if (!precvpriv->int_in_urb)
|
||||
DBG_8723A("alloc_urb for interrupt in endpoint fail !!!!\n");
|
||||
precvpriv->int_in_buf = kzalloc(USB_INTR_CONTENT_LENGTH, GFP_KERNEL);
|
||||
if (!precvpriv->int_in_buf)
|
||||
DBG_8723A("alloc_mem for interrupt in endpoint fail !!!!\n");
|
||||
|
||||
size = NR_RECVBUFF * sizeof(struct recv_buf);
|
||||
precvpriv->precv_buf = kzalloc(size, GFP_KERNEL);
|
||||
if (!precvpriv->precv_buf) {
|
||||
res = _FAIL;
|
||||
RT_TRACE(_module_rtl871x_recv_c_, _drv_err_,
|
||||
"alloc recv_buf fail!\n");
|
||||
goto exit;
|
||||
}
|
||||
|
||||
precvbuf = (struct recv_buf *)precvpriv->precv_buf;
|
||||
|
||||
for (i = 0; i < NR_RECVBUFF; i++) {
|
||||
INIT_LIST_HEAD(&precvbuf->list);
|
||||
|
||||
precvbuf->purb = usb_alloc_urb(0, GFP_KERNEL);
|
||||
if (!precvbuf->purb)
|
||||
break;
|
||||
|
||||
precvbuf->adapter = padapter;
|
||||
|
||||
precvbuf++;
|
||||
}
|
||||
|
||||
skb_queue_head_init(&precvpriv->rx_skb_queue);
|
||||
skb_queue_head_init(&precvpriv->free_recv_skb_queue);
|
||||
|
||||
for (i = 0; i < NR_PREALLOC_RECV_SKB; i++) {
|
||||
size = MAX_RECVBUF_SZ + RECVBUFF_ALIGN_SZ;
|
||||
pskb = __netdev_alloc_skb(padapter->pnetdev, size, GFP_KERNEL);
|
||||
|
||||
if (pskb) {
|
||||
pskb->dev = padapter->pnetdev;
|
||||
|
||||
tmpaddr = (unsigned long)pskb->data;
|
||||
alignment = tmpaddr & (RECVBUFF_ALIGN_SZ-1);
|
||||
skb_reserve(pskb, (RECVBUFF_ALIGN_SZ - alignment));
|
||||
|
||||
skb_queue_tail(&precvpriv->free_recv_skb_queue, pskb);
|
||||
}
|
||||
|
||||
pskb = NULL;
|
||||
}
|
||||
|
||||
exit:
|
||||
return res;
|
||||
}
|
||||
|
||||
void rtl8723au_free_recv_priv(struct rtw_adapter *padapter)
|
||||
{
|
||||
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++) {
|
||||
usb_free_urb(precvbuf->purb);
|
||||
|
||||
if (precvbuf->pskb)
|
||||
dev_kfree_skb_any(precvbuf->pskb);
|
||||
|
||||
precvbuf++;
|
||||
}
|
||||
|
||||
kfree(precvpriv->precv_buf);
|
||||
|
||||
usb_free_urb(precvpriv->int_in_urb);
|
||||
kfree(precvpriv->int_in_buf);
|
||||
|
||||
if (skb_queue_len(&precvpriv->rx_skb_queue))
|
||||
DBG_8723A(KERN_WARNING "rx_skb_queue not empty\n");
|
||||
|
||||
skb_queue_purge(&precvpriv->rx_skb_queue);
|
||||
|
||||
if (skb_queue_len(&precvpriv->free_recv_skb_queue)) {
|
||||
DBG_8723A(KERN_WARNING "free_recv_skb_queue not empty, %d\n",
|
||||
skb_queue_len(&precvpriv->free_recv_skb_queue));
|
||||
}
|
||||
|
||||
skb_queue_purge(&precvpriv->free_recv_skb_queue);
|
||||
}
|
||||
|
||||
struct recv_stat_cpu {
|
||||
u32 rxdw0;
|
||||
u32 rxdw1;
|
||||
u32 rxdw2;
|
||||
u32 rxdw3;
|
||||
u32 rxdw4;
|
||||
u32 rxdw5;
|
||||
};
|
||||
|
||||
void update_recvframe_attrib(struct recv_frame *precvframe,
|
||||
struct recv_stat *prxstat)
|
||||
{
|
||||
struct rx_pkt_attrib *pattrib;
|
||||
struct recv_stat_cpu report;
|
||||
struct rxreport_8723a *prxreport;
|
||||
|
||||
report.rxdw0 = le32_to_cpu(prxstat->rxdw0);
|
||||
report.rxdw1 = le32_to_cpu(prxstat->rxdw1);
|
||||
report.rxdw2 = le32_to_cpu(prxstat->rxdw2);
|
||||
report.rxdw3 = le32_to_cpu(prxstat->rxdw3);
|
||||
report.rxdw4 = le32_to_cpu(prxstat->rxdw4);
|
||||
report.rxdw5 = le32_to_cpu(prxstat->rxdw5);
|
||||
|
||||
prxreport = (struct rxreport_8723a *)&report;
|
||||
|
||||
pattrib = &precvframe->attrib;
|
||||
memset(pattrib, 0, sizeof(struct rx_pkt_attrib));
|
||||
|
||||
/* update rx report to recv_frame attribute */
|
||||
pattrib->pkt_len = (u16)prxreport->pktlen;
|
||||
pattrib->drvinfo_sz = (u8)(prxreport->drvinfosize << 3);
|
||||
pattrib->physt = (u8)prxreport->physt;
|
||||
|
||||
pattrib->crc_err = (u8)prxreport->crc32;
|
||||
pattrib->icv_err = (u8)prxreport->icverr;
|
||||
|
||||
pattrib->bdecrypted = (u8)(prxreport->swdec ? 0 : 1);
|
||||
pattrib->encrypt = (u8)prxreport->security;
|
||||
|
||||
pattrib->qos = (u8)prxreport->qos;
|
||||
pattrib->priority = (u8)prxreport->tid;
|
||||
|
||||
pattrib->amsdu = (u8)prxreport->amsdu;
|
||||
|
||||
pattrib->seq_num = (u16)prxreport->seq;
|
||||
pattrib->frag_num = (u8)prxreport->frag;
|
||||
pattrib->mfrag = (u8)prxreport->mf;
|
||||
pattrib->mdata = (u8)prxreport->md;
|
||||
|
||||
pattrib->mcs_rate = (u8)prxreport->rxmcs;
|
||||
pattrib->rxht = (u8)prxreport->rxht;
|
||||
}
|
||||
|
||||
void update_recvframe_phyinfo(struct recv_frame *precvframe,
|
||||
struct phy_stat *pphy_status)
|
||||
{
|
||||
struct rtw_adapter *padapter = precvframe->adapter;
|
||||
struct rx_pkt_attrib *pattrib = &precvframe->attrib;
|
||||
struct hal_data_8723a *pHalData = GET_HAL_DATA(padapter);
|
||||
struct phy_info *pPHYInfo = &pattrib->phy_info;
|
||||
struct odm_packet_info pkt_info;
|
||||
u8 *sa = NULL, *da;
|
||||
struct sta_priv *pstapriv;
|
||||
struct sta_info *psta;
|
||||
struct sk_buff *skb = precvframe->pkt;
|
||||
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
|
||||
bool matchbssid = false;
|
||||
u8 *bssid;
|
||||
|
||||
matchbssid = !ieee80211_is_ctl(hdr->frame_control) &&
|
||||
!pattrib->icv_err && !pattrib->crc_err;
|
||||
|
||||
if (matchbssid) {
|
||||
switch (hdr->frame_control &
|
||||
cpu_to_le16(IEEE80211_FCTL_TODS |
|
||||
IEEE80211_FCTL_FROMDS)) {
|
||||
case cpu_to_le16(IEEE80211_FCTL_TODS):
|
||||
bssid = hdr->addr1;
|
||||
break;
|
||||
case cpu_to_le16(IEEE80211_FCTL_FROMDS):
|
||||
bssid = hdr->addr2;
|
||||
break;
|
||||
case cpu_to_le16(0):
|
||||
bssid = hdr->addr3;
|
||||
break;
|
||||
default:
|
||||
bssid = NULL;
|
||||
matchbssid = false;
|
||||
}
|
||||
|
||||
if (bssid)
|
||||
matchbssid = ether_addr_equal(
|
||||
get_bssid(&padapter->mlmepriv), bssid);
|
||||
}
|
||||
|
||||
pkt_info.bPacketMatchBSSID = matchbssid;
|
||||
|
||||
da = ieee80211_get_DA(hdr);
|
||||
pkt_info.bPacketToSelf = pkt_info.bPacketMatchBSSID &&
|
||||
(!memcmp(da, myid(&padapter->eeprompriv), ETH_ALEN));
|
||||
|
||||
pkt_info.bPacketBeacon = pkt_info.bPacketMatchBSSID &&
|
||||
ieee80211_is_beacon(hdr->frame_control);
|
||||
|
||||
pkt_info.StationID = 0xFF;
|
||||
if (pkt_info.bPacketBeacon) {
|
||||
if (check_fwstate(&padapter->mlmepriv, WIFI_STATION_STATE) == true)
|
||||
sa = padapter->mlmepriv.cur_network.network.MacAddress;
|
||||
/* to do Ad-hoc */
|
||||
} else {
|
||||
sa = ieee80211_get_SA(hdr);
|
||||
}
|
||||
|
||||
pstapriv = &padapter->stapriv;
|
||||
psta = rtw_get_stainfo23a(pstapriv, sa);
|
||||
if (psta) {
|
||||
pkt_info.StationID = psta->mac_id;
|
||||
/* printk("%s ==> StationID(%d)\n", __func__, pkt_info.StationID); */
|
||||
}
|
||||
pkt_info.Rate = pattrib->mcs_rate;
|
||||
|
||||
ODM_PhyStatusQuery23a(&pHalData->odmpriv, pPHYInfo,
|
||||
(u8 *)pphy_status, &pkt_info);
|
||||
precvframe->psta = NULL;
|
||||
if (pkt_info.bPacketMatchBSSID &&
|
||||
(check_fwstate(&padapter->mlmepriv, WIFI_AP_STATE) == true)) {
|
||||
if (psta) {
|
||||
precvframe->psta = psta;
|
||||
rtl8723a_process_phy_info(padapter, precvframe);
|
||||
}
|
||||
} else if (pkt_info.bPacketToSelf || pkt_info.bPacketBeacon) {
|
||||
if (check_fwstate(&padapter->mlmepriv,
|
||||
WIFI_ADHOC_STATE|WIFI_ADHOC_MASTER_STATE) ==
|
||||
true) {
|
||||
if (psta)
|
||||
precvframe->psta = psta;
|
||||
}
|
||||
rtl8723a_process_phy_info(padapter, precvframe);
|
||||
}
|
||||
}
|
|
@ -1,520 +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.
|
||||
*
|
||||
******************************************************************************/
|
||||
#define _RTL8192C_XMIT_C_
|
||||
#include <osdep_service.h>
|
||||
#include <drv_types.h>
|
||||
#include <wifi.h>
|
||||
#include <osdep_intf.h>
|
||||
#include <usb_ops.h>
|
||||
/* include <rtl8192c_hal.h> */
|
||||
#include <rtl8723a_hal.h>
|
||||
|
||||
static int urb_zero_packet_chk(struct rtw_adapter *padapter, int sz)
|
||||
{
|
||||
int blnSetTxDescOffset;
|
||||
struct dvobj_priv *pdvobj = adapter_to_dvobj(padapter);
|
||||
|
||||
if (pdvobj->ishighspeed) {
|
||||
if (((sz + TXDESC_SIZE) % 512) == 0)
|
||||
blnSetTxDescOffset = 1;
|
||||
else
|
||||
blnSetTxDescOffset = 0;
|
||||
} else {
|
||||
if (((sz + TXDESC_SIZE) % 64) == 0)
|
||||
blnSetTxDescOffset = 1;
|
||||
else
|
||||
blnSetTxDescOffset = 0;
|
||||
}
|
||||
return blnSetTxDescOffset;
|
||||
}
|
||||
|
||||
static void rtl8192cu_cal_txdesc_chksum(struct tx_desc *ptxdesc)
|
||||
{
|
||||
__le16 *usPtr = (__le16 *)ptxdesc;
|
||||
u32 count = 16; /* (32 bytes / 2 bytes per XOR) => 16 times */
|
||||
u32 index;
|
||||
u16 checksum = 0;
|
||||
|
||||
/* Clear first */
|
||||
ptxdesc->txdw7 &= cpu_to_le32(0xffff0000);
|
||||
|
||||
for (index = 0 ; index < count ; index++)
|
||||
checksum = checksum ^ le16_to_cpu(*(usPtr + index));
|
||||
|
||||
ptxdesc->txdw7 |= cpu_to_le32(0x0000ffff&checksum);
|
||||
}
|
||||
|
||||
static void fill_txdesc_sectype(struct pkt_attrib *pattrib, struct tx_desc *ptxdesc)
|
||||
{
|
||||
if ((pattrib->encrypt > 0) && !pattrib->bswenc) {
|
||||
switch (pattrib->encrypt) {
|
||||
/* SEC_TYPE */
|
||||
case WLAN_CIPHER_SUITE_WEP40:
|
||||
case WLAN_CIPHER_SUITE_WEP104:
|
||||
ptxdesc->txdw1 |= cpu_to_le32((0x01<<22)&0x00c00000);
|
||||
break;
|
||||
case WLAN_CIPHER_SUITE_TKIP:
|
||||
/* ptxdesc->txdw1 |= cpu_to_le32((0x02<<22)&0x00c00000); */
|
||||
ptxdesc->txdw1 |= cpu_to_le32((0x01<<22)&0x00c00000);
|
||||
break;
|
||||
case WLAN_CIPHER_SUITE_CCMP:
|
||||
ptxdesc->txdw1 |= cpu_to_le32((0x03<<22)&0x00c00000);
|
||||
break;
|
||||
case 0:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void fill_txdesc_vcs(struct pkt_attrib *pattrib, __le32 *pdw)
|
||||
{
|
||||
/* DBG_8723A("cvs_mode =%d\n", pattrib->vcs_mode); */
|
||||
|
||||
switch (pattrib->vcs_mode) {
|
||||
case RTS_CTS:
|
||||
*pdw |= cpu_to_le32(BIT(12));
|
||||
break;
|
||||
case CTS_TO_SELF:
|
||||
*pdw |= cpu_to_le32(BIT(11));
|
||||
break;
|
||||
case NONE_VCS:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (pattrib->vcs_mode) {
|
||||
*pdw |= cpu_to_le32(BIT(13));
|
||||
|
||||
/* Set RTS BW */
|
||||
if (pattrib->ht_en) {
|
||||
*pdw |= (pattrib->bwmode&HT_CHANNEL_WIDTH_40) ? cpu_to_le32(BIT(27)) : 0;
|
||||
|
||||
if (pattrib->ch_offset == HAL_PRIME_CHNL_OFFSET_LOWER)
|
||||
*pdw |= cpu_to_le32((0x01<<28)&0x30000000);
|
||||
else if (pattrib->ch_offset == HAL_PRIME_CHNL_OFFSET_UPPER)
|
||||
*pdw |= cpu_to_le32((0x02<<28)&0x30000000);
|
||||
else if (pattrib->ch_offset == HAL_PRIME_CHNL_OFFSET_DONT_CARE)
|
||||
*pdw |= 0;
|
||||
else
|
||||
*pdw |= cpu_to_le32((0x03<<28)&0x30000000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void fill_txdesc_phy(struct pkt_attrib *pattrib, __le32 *pdw)
|
||||
{
|
||||
if (pattrib->ht_en) {
|
||||
*pdw |= (pattrib->bwmode&HT_CHANNEL_WIDTH_40) ? cpu_to_le32(BIT(25)) : 0;
|
||||
|
||||
if (pattrib->ch_offset == HAL_PRIME_CHNL_OFFSET_LOWER)
|
||||
*pdw |= cpu_to_le32((0x01<<20)&0x003f0000);
|
||||
else if (pattrib->ch_offset == HAL_PRIME_CHNL_OFFSET_UPPER)
|
||||
*pdw |= cpu_to_le32((0x02<<20)&0x003f0000);
|
||||
else if (pattrib->ch_offset == HAL_PRIME_CHNL_OFFSET_DONT_CARE)
|
||||
*pdw |= 0;
|
||||
else
|
||||
*pdw |= cpu_to_le32((0x03<<20)&0x003f0000);
|
||||
}
|
||||
}
|
||||
|
||||
static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz)
|
||||
{
|
||||
int pull = 0;
|
||||
uint qsel;
|
||||
struct rtw_adapter *padapter = pxmitframe->padapter;
|
||||
struct pkt_attrib *pattrib = &pxmitframe->attrib;
|
||||
struct hal_data_8723a *pHalData = GET_HAL_DATA(padapter);
|
||||
struct dm_priv *pdmpriv = &pHalData->dmpriv;
|
||||
struct tx_desc *ptxdesc = (struct tx_desc *)pmem;
|
||||
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
|
||||
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
|
||||
int bmcst = is_multicast_ether_addr(pattrib->ra);
|
||||
|
||||
if (urb_zero_packet_chk(padapter, sz) == 0) {
|
||||
ptxdesc = (struct tx_desc *)(pmem+PACKET_OFFSET_SZ);
|
||||
pull = 1;
|
||||
pxmitframe->pkt_offset--;
|
||||
}
|
||||
|
||||
memset(ptxdesc, 0, sizeof(struct tx_desc));
|
||||
|
||||
if (pxmitframe->frame_tag == DATA_FRAMETAG) {
|
||||
/* offset 4 */
|
||||
ptxdesc->txdw1 |= cpu_to_le32(pattrib->mac_id&0x1f);
|
||||
|
||||
qsel = (uint)(pattrib->qsel & 0x0000001f);
|
||||
ptxdesc->txdw1 |= cpu_to_le32((qsel << QSEL_SHT) & 0x00001f00);
|
||||
|
||||
ptxdesc->txdw1 |= cpu_to_le32((pattrib->raid<<16) & 0x000f0000);
|
||||
|
||||
fill_txdesc_sectype(pattrib, ptxdesc);
|
||||
|
||||
if (pattrib->ampdu_en)
|
||||
ptxdesc->txdw1 |= cpu_to_le32(BIT(5));/* AGG EN */
|
||||
else
|
||||
ptxdesc->txdw1 |= cpu_to_le32(BIT(6));/* AGG BK */
|
||||
|
||||
/* offset 8 */
|
||||
|
||||
/* offset 12 */
|
||||
ptxdesc->txdw3 |= cpu_to_le32((pattrib->seqnum<<16)&0xffff0000);
|
||||
|
||||
/* offset 16 , offset 20 */
|
||||
if (pattrib->qos_en)
|
||||
ptxdesc->txdw4 |= cpu_to_le32(BIT(6));/* QoS */
|
||||
|
||||
if ((pattrib->ether_type != 0x888e) &&
|
||||
(pattrib->ether_type != 0x0806) &&
|
||||
(pattrib->dhcp_pkt != 1)) {
|
||||
/* Non EAP & ARP & DHCP type data packet */
|
||||
|
||||
fill_txdesc_vcs(pattrib, &ptxdesc->txdw4);
|
||||
fill_txdesc_phy(pattrib, &ptxdesc->txdw4);
|
||||
|
||||
ptxdesc->txdw4 |= cpu_to_le32(0x00000008);/* RTS Rate = 24M */
|
||||
ptxdesc->txdw5 |= cpu_to_le32(0x0001ff00);/* */
|
||||
|
||||
/* use REG_INIDATA_RATE_SEL value */
|
||||
ptxdesc->txdw5 |= cpu_to_le32(pdmpriv->INIDATA_RATE[pattrib->mac_id]);
|
||||
} else {
|
||||
/* EAP data packet and ARP packet. */
|
||||
/* Use the 1M data rate to send the EAP/ARP packet. */
|
||||
/* This will maybe make the handshake smooth. */
|
||||
|
||||
ptxdesc->txdw1 |= cpu_to_le32(BIT(6));/* AGG BK */
|
||||
|
||||
ptxdesc->txdw4 |= cpu_to_le32(BIT(8));/* driver uses rate */
|
||||
|
||||
if (pmlmeinfo->preamble_mode == PREAMBLE_SHORT)
|
||||
ptxdesc->txdw4 |= cpu_to_le32(BIT(24));/* DATA_SHORT */
|
||||
|
||||
ptxdesc->txdw5 |= cpu_to_le32(MRateToHwRate23a(pmlmeext->tx_rate));
|
||||
}
|
||||
} else if (pxmitframe->frame_tag == MGNT_FRAMETAG) {
|
||||
/* offset 4 */
|
||||
ptxdesc->txdw1 |= cpu_to_le32(pattrib->mac_id&0x1f);
|
||||
|
||||
qsel = (uint)(pattrib->qsel&0x0000001f);
|
||||
ptxdesc->txdw1 |= cpu_to_le32((qsel<<QSEL_SHT)&0x00001f00);
|
||||
|
||||
ptxdesc->txdw1 |= cpu_to_le32((pattrib->raid<<16) & 0x000f0000);
|
||||
|
||||
/* offset 8 */
|
||||
/* CCX-TXRPT ack for xmit mgmt frames. */
|
||||
if (pxmitframe->ack_report)
|
||||
ptxdesc->txdw2 |= cpu_to_le32(BIT(19));
|
||||
|
||||
/* offset 12 */
|
||||
ptxdesc->txdw3 |= cpu_to_le32((pattrib->seqnum<<16)&0xffff0000);
|
||||
|
||||
/* offset 16 */
|
||||
ptxdesc->txdw4 |= cpu_to_le32(BIT(8));/* driver uses rate */
|
||||
|
||||
/* offset 20 */
|
||||
ptxdesc->txdw5 |= cpu_to_le32(BIT(17));/* retry limit enable */
|
||||
ptxdesc->txdw5 |= cpu_to_le32(0x00180000);/* retry limit = 6 */
|
||||
|
||||
ptxdesc->txdw5 |= cpu_to_le32(MRateToHwRate23a(pmlmeext->tx_rate));
|
||||
} else if (pxmitframe->frame_tag == TXAGG_FRAMETAG) {
|
||||
DBG_8723A("pxmitframe->frame_tag == TXAGG_FRAMETAG\n");
|
||||
} else {
|
||||
DBG_8723A("pxmitframe->frame_tag = %d\n",
|
||||
pxmitframe->frame_tag);
|
||||
|
||||
/* offset 4 */
|
||||
ptxdesc->txdw1 |= cpu_to_le32((4)&0x1f);/* CAM_ID(MAC_ID) */
|
||||
|
||||
ptxdesc->txdw1 |= cpu_to_le32((6<<16) & 0x000f0000);/* raid */
|
||||
|
||||
/* offset 8 */
|
||||
|
||||
/* offset 12 */
|
||||
ptxdesc->txdw3 |= cpu_to_le32((pattrib->seqnum<<16)&0xffff0000);
|
||||
|
||||
/* offset 16 */
|
||||
ptxdesc->txdw4 |= cpu_to_le32(BIT(8));/* driver uses rate */
|
||||
|
||||
/* offset 20 */
|
||||
ptxdesc->txdw5 |= cpu_to_le32(MRateToHwRate23a(pmlmeext->tx_rate));
|
||||
}
|
||||
|
||||
/* (1) The sequence number of each non-Qos frame / broadcast / multicast / */
|
||||
/* mgnt frame should be controlled by Hw because Fw will also send null data */
|
||||
/* which we cannot control when Fw LPS enable. */
|
||||
/* --> default enable non-Qos data sequense number. 2010.06.23. by tynli. */
|
||||
/* (2) Enable HW SEQ control for beacon packet, because we use Hw beacon. */
|
||||
/* (3) Use HW Qos SEQ to control the seq num of Ext port non-Qos packets. */
|
||||
if (!pattrib->qos_en) {
|
||||
/* Hw set sequence number */
|
||||
ptxdesc->txdw4 |= cpu_to_le32(BIT(7));
|
||||
/* set bit3 to 1. */
|
||||
ptxdesc->txdw3 |= cpu_to_le32((8 << 28));
|
||||
}
|
||||
|
||||
/* offset 0 */
|
||||
ptxdesc->txdw0 |= cpu_to_le32(sz&0x0000ffff);
|
||||
ptxdesc->txdw0 |= cpu_to_le32(OWN | FSG | LSG);
|
||||
ptxdesc->txdw0 |= cpu_to_le32(((TXDESC_SIZE+OFFSET_SZ)<<OFFSET_SHT)&0x00ff0000);/* 32 bytes for TX Desc */
|
||||
|
||||
if (bmcst)
|
||||
ptxdesc->txdw0 |= cpu_to_le32(BIT(24));
|
||||
|
||||
RT_TRACE(_module_rtl871x_xmit_c_, _drv_info_,
|
||||
"offset0-txdesc = 0x%x\n", ptxdesc->txdw0);
|
||||
|
||||
/* offset 4 */
|
||||
/* pkt_offset, unit:8 bytes padding */
|
||||
if (pxmitframe->pkt_offset > 0)
|
||||
ptxdesc->txdw1 |= cpu_to_le32((pxmitframe->pkt_offset << 26) & 0x7c000000);
|
||||
|
||||
rtl8192cu_cal_txdesc_chksum(ptxdesc);
|
||||
return pull;
|
||||
}
|
||||
|
||||
static int rtw_dump_xframe(struct rtw_adapter *padapter,
|
||||
struct xmit_frame *pxmitframe)
|
||||
{
|
||||
int ret = _SUCCESS;
|
||||
int inner_ret = _SUCCESS;
|
||||
int t, sz, w_sz, pull = 0;
|
||||
u8 *mem_addr;
|
||||
u32 ff_hwaddr;
|
||||
struct xmit_buf *pxmitbuf = pxmitframe->pxmitbuf;
|
||||
struct pkt_attrib *pattrib = &pxmitframe->attrib;
|
||||
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
|
||||
|
||||
if (pxmitframe->frame_tag == DATA_FRAMETAG &&
|
||||
pxmitframe->attrib.ether_type != ETH_P_ARP &&
|
||||
pxmitframe->attrib.ether_type != ETH_P_PAE &&
|
||||
pxmitframe->attrib.dhcp_pkt != 1)
|
||||
rtw_issue_addbareq_cmd23a(padapter, pxmitframe);
|
||||
|
||||
mem_addr = pxmitframe->buf_addr;
|
||||
|
||||
RT_TRACE(_module_rtl871x_xmit_c_, _drv_info_, "rtw_dump_xframe()\n");
|
||||
|
||||
for (t = 0; t < pattrib->nr_frags; t++) {
|
||||
if (inner_ret != _SUCCESS && ret == _SUCCESS)
|
||||
ret = _FAIL;
|
||||
|
||||
if (t != (pattrib->nr_frags - 1)) {
|
||||
RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_,
|
||||
"pattrib->nr_frags =%d\n", pattrib->nr_frags);
|
||||
|
||||
sz = pxmitpriv->frag_len;
|
||||
sz = sz - 4 - pattrib->icv_len;
|
||||
} else {
|
||||
/* no frag */
|
||||
sz = pattrib->last_txcmdsz;
|
||||
}
|
||||
|
||||
pull = update_txdesc(pxmitframe, mem_addr, sz);
|
||||
|
||||
if (pull) {
|
||||
mem_addr += PACKET_OFFSET_SZ; /* pull txdesc head */
|
||||
|
||||
pxmitframe->buf_addr = mem_addr;
|
||||
|
||||
w_sz = sz + TXDESC_SIZE;
|
||||
} else {
|
||||
w_sz = sz + TXDESC_SIZE + PACKET_OFFSET_SZ;
|
||||
}
|
||||
|
||||
ff_hwaddr = rtw_get_ff_hwaddr23a(pxmitframe);
|
||||
inner_ret = rtl8723au_write_port(padapter, ff_hwaddr,
|
||||
w_sz, pxmitbuf);
|
||||
rtw_count_tx_stats23a(padapter, pxmitframe, sz);
|
||||
|
||||
RT_TRACE(_module_rtl871x_xmit_c_, _drv_info_,
|
||||
"rtw_write_port, w_sz =%d\n", w_sz);
|
||||
|
||||
mem_addr += w_sz;
|
||||
|
||||
mem_addr = PTR_ALIGN(mem_addr, 4);
|
||||
}
|
||||
|
||||
rtw_free_xmitframe23a(pxmitpriv, pxmitframe);
|
||||
|
||||
if (ret != _SUCCESS)
|
||||
rtw23a_sctx_done_err(&pxmitbuf->sctx, RTW_SCTX_DONE_UNKNOWN);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool rtl8723au_xmitframe_complete(struct rtw_adapter *padapter,
|
||||
struct xmit_priv *pxmitpriv,
|
||||
struct xmit_buf *pxmitbuf)
|
||||
{
|
||||
struct hw_xmit *phwxmits;
|
||||
struct xmit_frame *pxmitframe;
|
||||
int hwentry;
|
||||
int res = _SUCCESS, xcnt = 0;
|
||||
|
||||
phwxmits = pxmitpriv->hwxmits;
|
||||
hwentry = pxmitpriv->hwxmit_entry;
|
||||
|
||||
RT_TRACE(_module_rtl871x_xmit_c_, _drv_info_, "xmitframe_complete()\n");
|
||||
|
||||
if (pxmitbuf == NULL) {
|
||||
pxmitbuf = rtw_alloc_xmitbuf23a(pxmitpriv);
|
||||
if (!pxmitbuf)
|
||||
return false;
|
||||
}
|
||||
pxmitframe = rtw_dequeue_xframe23a(pxmitpriv, phwxmits, hwentry);
|
||||
|
||||
if (pxmitframe) {
|
||||
pxmitframe->pxmitbuf = pxmitbuf;
|
||||
|
||||
pxmitframe->buf_addr = pxmitbuf->pbuf;
|
||||
|
||||
pxmitbuf->priv_data = pxmitframe;
|
||||
|
||||
if (pxmitframe->frame_tag == DATA_FRAMETAG) {
|
||||
if (pxmitframe->attrib.priority <= 15)/* TID0~15 */
|
||||
res = rtw_xmitframe_coalesce23a(padapter, pxmitframe->pkt, pxmitframe);
|
||||
|
||||
rtw_os_xmit_complete23a(padapter, pxmitframe);/* always return ndis_packet after rtw_xmitframe_coalesce23a */
|
||||
}
|
||||
|
||||
RT_TRACE(_module_rtl871x_xmit_c_, _drv_info_,
|
||||
"xmitframe_complete(): rtw_dump_xframe\n");
|
||||
|
||||
if (res == _SUCCESS) {
|
||||
rtw_dump_xframe(padapter, pxmitframe);
|
||||
} else {
|
||||
rtw_free_xmitbuf23a(pxmitpriv, pxmitbuf);
|
||||
rtw_free_xmitframe23a(pxmitpriv, pxmitframe);
|
||||
}
|
||||
xcnt++;
|
||||
} else {
|
||||
rtw_free_xmitbuf23a(pxmitpriv, pxmitbuf);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static int xmitframe_direct(struct rtw_adapter *padapter,
|
||||
struct xmit_frame *pxmitframe)
|
||||
{
|
||||
int res;
|
||||
|
||||
res = rtw_xmitframe_coalesce23a(padapter, pxmitframe->pkt, pxmitframe);
|
||||
if (res == _SUCCESS)
|
||||
rtw_dump_xframe(padapter, pxmitframe);
|
||||
return res;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return
|
||||
* true dump packet directly
|
||||
* false enqueue packet
|
||||
*/
|
||||
bool rtl8723au_hal_xmit(struct rtw_adapter *padapter,
|
||||
struct xmit_frame *pxmitframe)
|
||||
{
|
||||
int res;
|
||||
struct xmit_buf *pxmitbuf = NULL;
|
||||
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
|
||||
struct pkt_attrib *pattrib = &pxmitframe->attrib;
|
||||
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
||||
|
||||
pattrib->qsel = pattrib->priority;
|
||||
spin_lock_bh(&pxmitpriv->lock);
|
||||
|
||||
#ifdef CONFIG_8723AU_AP_MODE
|
||||
if (xmitframe_enqueue_for_sleeping_sta23a(padapter, pxmitframe)) {
|
||||
struct sta_info *psta;
|
||||
struct sta_priv *pstapriv = &padapter->stapriv;
|
||||
|
||||
spin_unlock_bh(&pxmitpriv->lock);
|
||||
|
||||
if (pattrib->psta)
|
||||
psta = pattrib->psta;
|
||||
else
|
||||
psta = rtw_get_stainfo23a(pstapriv, pattrib->ra);
|
||||
|
||||
if (psta) {
|
||||
if (psta->sleepq_len > (NR_XMITFRAME>>3))
|
||||
wakeup_sta_to_xmit23a(padapter, psta);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (rtw_txframes_sta_ac_pending23a(padapter, pattrib) > 0)
|
||||
goto enqueue;
|
||||
|
||||
if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY|_FW_UNDER_LINKING) == true)
|
||||
goto enqueue;
|
||||
|
||||
pxmitbuf = rtw_alloc_xmitbuf23a(pxmitpriv);
|
||||
if (pxmitbuf == NULL)
|
||||
goto enqueue;
|
||||
|
||||
spin_unlock_bh(&pxmitpriv->lock);
|
||||
|
||||
pxmitframe->pxmitbuf = pxmitbuf;
|
||||
pxmitframe->buf_addr = pxmitbuf->pbuf;
|
||||
pxmitbuf->priv_data = pxmitframe;
|
||||
|
||||
if (xmitframe_direct(padapter, pxmitframe) != _SUCCESS) {
|
||||
rtw_free_xmitbuf23a(pxmitpriv, pxmitbuf);
|
||||
rtw_free_xmitframe23a(pxmitpriv, pxmitframe);
|
||||
}
|
||||
return true;
|
||||
|
||||
enqueue:
|
||||
res = rtw_xmitframe_enqueue23a(padapter, pxmitframe);
|
||||
spin_unlock_bh(&pxmitpriv->lock);
|
||||
|
||||
if (res != _SUCCESS) {
|
||||
RT_TRACE(_module_xmit_osdep_c_, _drv_err_,
|
||||
"pre_xmitframe: enqueue xmitframe fail\n");
|
||||
rtw_free_xmitframe23a(pxmitpriv, pxmitframe);
|
||||
|
||||
/* Trick, make the statistics correct */
|
||||
pxmitpriv->tx_pkts--;
|
||||
pxmitpriv->tx_drop++;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
int rtl8723au_mgnt_xmit(struct rtw_adapter *padapter,
|
||||
struct xmit_frame *pmgntframe)
|
||||
{
|
||||
return rtw_dump_xframe(padapter, pmgntframe);
|
||||
}
|
||||
|
||||
int rtl8723au_hal_xmitframe_enqueue(struct rtw_adapter *padapter,
|
||||
struct xmit_frame *pxmitframe)
|
||||
{
|
||||
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
|
||||
int err;
|
||||
|
||||
err = rtw_xmitframe_enqueue23a(padapter, pxmitframe);
|
||||
if (err != _SUCCESS) {
|
||||
rtw_free_xmitframe23a(pxmitpriv, pxmitframe);
|
||||
|
||||
/* Trick, make the statistics correct */
|
||||
pxmitpriv->tx_pkts--;
|
||||
pxmitpriv->tx_drop++;
|
||||
} else {
|
||||
tasklet_hi_schedule(&pxmitpriv->xmit_tasklet);
|
||||
}
|
||||
return err;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -1,690 +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.
|
||||
*
|
||||
******************************************************************************/
|
||||
#define _HCI_OPS_OS_C_
|
||||
|
||||
#include <osdep_service.h>
|
||||
#include <drv_types.h>
|
||||
#include <osdep_intf.h>
|
||||
#include <usb_ops.h>
|
||||
#include <recv_osdep.h>
|
||||
#include <rtl8723a_hal.h>
|
||||
#include <rtl8723a_recv.h>
|
||||
|
||||
u8 rtl8723au_read8(struct rtw_adapter *padapter, u16 addr)
|
||||
{
|
||||
struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter);
|
||||
struct usb_device *udev = pdvobjpriv->pusbdev;
|
||||
int len;
|
||||
u8 data;
|
||||
|
||||
mutex_lock(&pdvobjpriv->usb_vendor_req_mutex);
|
||||
len = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
|
||||
REALTEK_USB_VENQT_CMD_REQ, REALTEK_USB_VENQT_READ,
|
||||
addr, 0, &pdvobjpriv->usb_buf.val8, sizeof(data),
|
||||
RTW_USB_CONTROL_MSG_TIMEOUT);
|
||||
|
||||
data = pdvobjpriv->usb_buf.val8;
|
||||
mutex_unlock(&pdvobjpriv->usb_vendor_req_mutex);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
u16 rtl8723au_read16(struct rtw_adapter *padapter, u16 addr)
|
||||
{
|
||||
struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter);
|
||||
struct usb_device *udev = pdvobjpriv->pusbdev;
|
||||
int len;
|
||||
u16 data;
|
||||
|
||||
mutex_lock(&pdvobjpriv->usb_vendor_req_mutex);
|
||||
len = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
|
||||
REALTEK_USB_VENQT_CMD_REQ, REALTEK_USB_VENQT_READ,
|
||||
addr, 0, &pdvobjpriv->usb_buf.val16, sizeof(data),
|
||||
RTW_USB_CONTROL_MSG_TIMEOUT);
|
||||
|
||||
data = le16_to_cpu(pdvobjpriv->usb_buf.val16);
|
||||
mutex_unlock(&pdvobjpriv->usb_vendor_req_mutex);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
u32 rtl8723au_read32(struct rtw_adapter *padapter, u16 addr)
|
||||
{
|
||||
struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter);
|
||||
struct usb_device *udev = pdvobjpriv->pusbdev;
|
||||
int len;
|
||||
u32 data;
|
||||
|
||||
mutex_lock(&pdvobjpriv->usb_vendor_req_mutex);
|
||||
len = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
|
||||
REALTEK_USB_VENQT_CMD_REQ, REALTEK_USB_VENQT_READ,
|
||||
addr, 0, &pdvobjpriv->usb_buf.val32, sizeof(data),
|
||||
RTW_USB_CONTROL_MSG_TIMEOUT);
|
||||
|
||||
data = le32_to_cpu(pdvobjpriv->usb_buf.val32);
|
||||
mutex_unlock(&pdvobjpriv->usb_vendor_req_mutex);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
int rtl8723au_write8(struct rtw_adapter *padapter, u16 addr, u8 val)
|
||||
{
|
||||
struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter);
|
||||
struct usb_device *udev = pdvobjpriv->pusbdev;
|
||||
int ret;
|
||||
|
||||
mutex_lock(&pdvobjpriv->usb_vendor_req_mutex);
|
||||
pdvobjpriv->usb_buf.val8 = val;
|
||||
|
||||
ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
|
||||
REALTEK_USB_VENQT_CMD_REQ,
|
||||
REALTEK_USB_VENQT_WRITE,
|
||||
addr, 0, &pdvobjpriv->usb_buf.val8, sizeof(val),
|
||||
RTW_USB_CONTROL_MSG_TIMEOUT);
|
||||
|
||||
if (ret != sizeof(val))
|
||||
ret = _FAIL;
|
||||
else
|
||||
ret = _SUCCESS;
|
||||
|
||||
mutex_unlock(&pdvobjpriv->usb_vendor_req_mutex);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int rtl8723au_write16(struct rtw_adapter *padapter, u16 addr, u16 val)
|
||||
{
|
||||
struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter);
|
||||
struct usb_device *udev = pdvobjpriv->pusbdev;
|
||||
int ret;
|
||||
|
||||
mutex_lock(&pdvobjpriv->usb_vendor_req_mutex);
|
||||
pdvobjpriv->usb_buf.val16 = cpu_to_le16(val);
|
||||
|
||||
ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
|
||||
REALTEK_USB_VENQT_CMD_REQ,
|
||||
REALTEK_USB_VENQT_WRITE,
|
||||
addr, 0, &pdvobjpriv->usb_buf.val16, sizeof(val),
|
||||
RTW_USB_CONTROL_MSG_TIMEOUT);
|
||||
|
||||
if (ret != sizeof(val))
|
||||
ret = _FAIL;
|
||||
else
|
||||
ret = _SUCCESS;
|
||||
|
||||
mutex_unlock(&pdvobjpriv->usb_vendor_req_mutex);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int rtl8723au_write32(struct rtw_adapter *padapter, u16 addr, u32 val)
|
||||
{
|
||||
struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter);
|
||||
struct usb_device *udev = pdvobjpriv->pusbdev;
|
||||
int ret;
|
||||
|
||||
mutex_lock(&pdvobjpriv->usb_vendor_req_mutex);
|
||||
pdvobjpriv->usb_buf.val32 = cpu_to_le32(val);
|
||||
|
||||
ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
|
||||
REALTEK_USB_VENQT_CMD_REQ,
|
||||
REALTEK_USB_VENQT_WRITE,
|
||||
addr, 0, &pdvobjpriv->usb_buf.val32, sizeof(val),
|
||||
RTW_USB_CONTROL_MSG_TIMEOUT);
|
||||
|
||||
if (ret != sizeof(val))
|
||||
ret = _FAIL;
|
||||
else
|
||||
ret = _SUCCESS;
|
||||
|
||||
mutex_unlock(&pdvobjpriv->usb_vendor_req_mutex);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int rtl8723au_writeN(struct rtw_adapter *padapter, u16 addr, u16 len, u8 *buf)
|
||||
{
|
||||
struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter);
|
||||
struct usb_device *udev = pdvobjpriv->pusbdev;
|
||||
int ret;
|
||||
|
||||
ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
|
||||
REALTEK_USB_VENQT_CMD_REQ,
|
||||
REALTEK_USB_VENQT_WRITE,
|
||||
addr, 0, buf, len, RTW_USB_CONTROL_MSG_TIMEOUT);
|
||||
|
||||
if (ret != len)
|
||||
return _FAIL;
|
||||
return _SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* Description:
|
||||
* Recognize the interrupt content by reading the interrupt
|
||||
* register or content and masking interrupt mask (IMR)
|
||||
* if it is our NIC's interrupt. After recognizing, we may clear
|
||||
* the all interrupts (ISR).
|
||||
* Arguments:
|
||||
* [in] Adapter -
|
||||
* The adapter context.
|
||||
* [in] pContent -
|
||||
* Under PCI interface, this field is ignord.
|
||||
* Under USB interface, the content is the interrupt
|
||||
* content pointer.
|
||||
* Under SDIO interface, this is the interrupt type which
|
||||
* is Local interrupt or system interrupt.
|
||||
* [in] ContentLen -
|
||||
* The length in byte of pContent.
|
||||
* Return:
|
||||
* If any interrupt matches the mask (IMR), return true, and
|
||||
* return false otherwise.
|
||||
*/
|
||||
static bool
|
||||
InterruptRecognized8723AU(struct rtw_adapter *Adapter, void *pContent,
|
||||
u32 ContentLen)
|
||||
{
|
||||
struct hal_data_8723a *pHalData = GET_HAL_DATA(Adapter);
|
||||
u8 *buffer = (u8 *)pContent;
|
||||
struct reportpwrstate_parm report;
|
||||
|
||||
memcpy(&pHalData->IntArray[0], &buffer[USB_INTR_CONTENT_HISR_OFFSET],
|
||||
4);
|
||||
pHalData->IntArray[0] &= pHalData->IntrMask[0];
|
||||
|
||||
/* For HISR extension. Added by tynli. 2009.10.07. */
|
||||
memcpy(&pHalData->IntArray[1],
|
||||
&buffer[USB_INTR_CONTENT_HISRE_OFFSET], 4);
|
||||
pHalData->IntArray[1] &= pHalData->IntrMask[1];
|
||||
|
||||
/* We sholud remove this function later because DDK suggest
|
||||
* not to executing too many operations in MPISR */
|
||||
|
||||
memcpy(&report.state, &buffer[USB_INTR_CPWM_OFFSET], 1);
|
||||
|
||||
return (pHalData->IntArray[0] & pHalData->IntrMask[0]) != 0 ||
|
||||
(pHalData->IntArray[1] & pHalData->IntrMask[1]) != 0;
|
||||
}
|
||||
|
||||
static void usb_read_interrupt_complete(struct urb *purb)
|
||||
{
|
||||
int err;
|
||||
struct rtw_adapter *padapter = (struct rtw_adapter *)purb->context;
|
||||
|
||||
if (padapter->bSurpriseRemoved || padapter->bDriverStopped ||
|
||||
padapter->bReadPortCancel) {
|
||||
DBG_8723A("%s() RX Warning! bDriverStopped(%d) OR "
|
||||
"bSurpriseRemoved(%d) bReadPortCancel(%d)\n",
|
||||
__func__, padapter->bDriverStopped,
|
||||
padapter->bSurpriseRemoved,
|
||||
padapter->bReadPortCancel);
|
||||
return;
|
||||
}
|
||||
|
||||
if (purb->status == 0) {
|
||||
struct c2h_evt_hdr *c2h_evt;
|
||||
|
||||
c2h_evt = (struct c2h_evt_hdr *)purb->transfer_buffer;
|
||||
|
||||
if (purb->actual_length > USB_INTR_CONTENT_LENGTH) {
|
||||
DBG_8723A("usb_read_interrupt_complete: purb->actual_"
|
||||
"length > USB_INTR_CONTENT_LENGTH\n");
|
||||
goto urb_submit;
|
||||
}
|
||||
|
||||
InterruptRecognized8723AU(padapter, purb->transfer_buffer,
|
||||
purb->actual_length);
|
||||
|
||||
if (c2h_evt_exist(c2h_evt)) {
|
||||
if (c2h_id_filter_ccx_8723a(c2h_evt->id)) {
|
||||
/* Handle CCX report here */
|
||||
handle_txrpt_ccx_8723a(padapter, (void *)
|
||||
c2h_evt->payload);
|
||||
schedule_work(&padapter->evtpriv.irq_wk);
|
||||
} else {
|
||||
struct evt_work *c2w;
|
||||
int res;
|
||||
|
||||
c2w = kmalloc(sizeof(struct evt_work),
|
||||
GFP_ATOMIC);
|
||||
|
||||
if (!c2w)
|
||||
goto urb_submit;
|
||||
|
||||
c2w->adapter = padapter;
|
||||
INIT_WORK(&c2w->work, rtw_evt_work);
|
||||
memcpy(c2w->u.buf, purb->transfer_buffer, 16);
|
||||
|
||||
res = queue_work(padapter->evtpriv.wq,
|
||||
&c2w->work);
|
||||
|
||||
if (!res) {
|
||||
printk(KERN_ERR "%s: Call to "
|
||||
"queue_work() failed\n",
|
||||
__func__);
|
||||
kfree(c2w);
|
||||
goto urb_submit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
urb_submit:
|
||||
err = usb_submit_urb(purb, GFP_ATOMIC);
|
||||
if (err && (err != -EPERM)) {
|
||||
DBG_8723A("cannot submit interrupt in-token(err = "
|
||||
"0x%08x), urb_status = %d\n",
|
||||
err, purb->status);
|
||||
}
|
||||
} else {
|
||||
DBG_8723A("###=> usb_read_interrupt_complete => urb "
|
||||
"status(%d)\n", purb->status);
|
||||
|
||||
switch (purb->status) {
|
||||
case -EINVAL:
|
||||
case -EPIPE:
|
||||
case -ENODEV:
|
||||
case -ESHUTDOWN:
|
||||
RT_TRACE(_module_hci_ops_os_c_, _drv_err_,
|
||||
"usb_read_port_complete:bSurpriseRemoved =true\n");
|
||||
/* Fall Through here */
|
||||
case -ENOENT:
|
||||
padapter->bDriverStopped = true;
|
||||
RT_TRACE(_module_hci_ops_os_c_, _drv_err_,
|
||||
"usb_read_port_complete:bDriverStopped =true\n");
|
||||
break;
|
||||
case -EPROTO:
|
||||
break;
|
||||
case -EINPROGRESS:
|
||||
DBG_8723A("ERROR: URB IS IN PROGRESS!\n");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int rtl8723au_read_interrupt(struct rtw_adapter *adapter)
|
||||
{
|
||||
int err;
|
||||
unsigned int pipe;
|
||||
int ret = _SUCCESS;
|
||||
struct dvobj_priv *pdvobj = adapter_to_dvobj(adapter);
|
||||
struct recv_priv *precvpriv = &adapter->recvpriv;
|
||||
struct usb_device *pusbd = pdvobj->pusbdev;
|
||||
|
||||
/* translate DMA FIFO addr to pipehandle */
|
||||
pipe = usb_rcvintpipe(pusbd, pdvobj->RtInPipe[1]);
|
||||
|
||||
usb_fill_int_urb(precvpriv->int_in_urb, pusbd, pipe,
|
||||
precvpriv->int_in_buf, USB_INTR_CONTENT_LENGTH,
|
||||
usb_read_interrupt_complete, adapter, 1);
|
||||
|
||||
err = usb_submit_urb(precvpriv->int_in_urb, GFP_ATOMIC);
|
||||
if (err && (err != -EPERM)) {
|
||||
DBG_8723A("cannot submit interrupt in-token(err = 0x%08x),"
|
||||
"urb_status = %d\n", err,
|
||||
precvpriv->int_in_urb->status);
|
||||
ret = _FAIL;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int recvbuf2recvframe(struct rtw_adapter *padapter, struct sk_buff *pskb)
|
||||
{
|
||||
u8 *pbuf;
|
||||
u8 shift_sz = 0;
|
||||
u16 pkt_cnt;
|
||||
u32 pkt_offset, skb_len, alloc_sz;
|
||||
int transfer_len;
|
||||
struct recv_stat *prxstat;
|
||||
struct phy_stat *pphy_info;
|
||||
struct sk_buff *pkt_copy;
|
||||
struct recv_frame *precvframe;
|
||||
struct rx_pkt_attrib *pattrib;
|
||||
struct recv_priv *precvpriv = &padapter->recvpriv;
|
||||
struct rtw_queue *pfree_recv_queue = &precvpriv->free_recv_queue;
|
||||
|
||||
transfer_len = (int)pskb->len;
|
||||
pbuf = pskb->data;
|
||||
|
||||
prxstat = (struct recv_stat *)pbuf;
|
||||
pkt_cnt = (le32_to_cpu(prxstat->rxdw2) >> 16) & 0xff;
|
||||
|
||||
do {
|
||||
RT_TRACE(_module_rtl871x_recv_c_, _drv_info_,
|
||||
"recvbuf2recvframe: rxdesc = offsset 0:0x%08x, 4:0x%08x, 8:0x%08x, C:0x%08x\n",
|
||||
prxstat->rxdw0, prxstat->rxdw1,
|
||||
prxstat->rxdw2, prxstat->rxdw4);
|
||||
|
||||
prxstat = (struct recv_stat *)pbuf;
|
||||
|
||||
precvframe = rtw_alloc_recvframe23a(pfree_recv_queue);
|
||||
if (!precvframe) {
|
||||
RT_TRACE(_module_rtl871x_recv_c_, _drv_err_,
|
||||
"recvbuf2recvframe: precvframe == NULL\n");
|
||||
DBG_8723A("%s()-%d: rtw_alloc_recvframe23a() failed! RX "
|
||||
"Drop!\n", __func__, __LINE__);
|
||||
goto _exit_recvbuf2recvframe;
|
||||
}
|
||||
|
||||
INIT_LIST_HEAD(&precvframe->list);
|
||||
|
||||
update_recvframe_attrib(precvframe, prxstat);
|
||||
|
||||
pattrib = &precvframe->attrib;
|
||||
|
||||
if (pattrib->crc_err) {
|
||||
DBG_8723A("%s()-%d: RX Warning! rx CRC ERROR !!\n",
|
||||
__func__, __LINE__);
|
||||
rtw_free_recvframe23a(precvframe);
|
||||
goto _exit_recvbuf2recvframe;
|
||||
}
|
||||
|
||||
pkt_offset = RXDESC_SIZE + pattrib->drvinfo_sz +
|
||||
pattrib->shift_sz + pattrib->pkt_len;
|
||||
|
||||
if (pattrib->pkt_len <= 0 || pkt_offset > transfer_len) {
|
||||
RT_TRACE(_module_rtl871x_recv_c_, _drv_info_,
|
||||
"recvbuf2recvframe: pkt_len<= 0\n");
|
||||
DBG_8723A("%s()-%d: RX Warning!\n",
|
||||
__func__, __LINE__);
|
||||
rtw_free_recvframe23a(precvframe);
|
||||
goto _exit_recvbuf2recvframe;
|
||||
}
|
||||
|
||||
/* Modified by Albert 20101213 */
|
||||
/* For 8 bytes IP header alignment. */
|
||||
/* Qos data, wireless lan header length is 26 */
|
||||
if (pattrib->qos)
|
||||
shift_sz = 6;
|
||||
else
|
||||
shift_sz = 0;
|
||||
|
||||
skb_len = pattrib->pkt_len;
|
||||
|
||||
/* for first fragment packet, driver need allocate
|
||||
* 1536+drvinfo_sz+RXDESC_SIZE to defrag packet.
|
||||
* modify alloc_sz for recvive crc error packet
|
||||
* by thomas 2011-06-02 */
|
||||
if (pattrib->mfrag == 1 && pattrib->frag_num == 0) {
|
||||
/* alloc_sz = 1664; 1664 is 128 alignment. */
|
||||
if (skb_len <= 1650)
|
||||
alloc_sz = 1664;
|
||||
else
|
||||
alloc_sz = skb_len + 14;
|
||||
} else {
|
||||
alloc_sz = skb_len;
|
||||
/* 6 is for IP header 8 bytes alignment in QoS packet case. */
|
||||
/* 8 is for skb->data 4 bytes alignment. */
|
||||
alloc_sz += 14;
|
||||
}
|
||||
|
||||
pkt_copy = netdev_alloc_skb(padapter->pnetdev, alloc_sz);
|
||||
if (pkt_copy) {
|
||||
pkt_copy->dev = padapter->pnetdev;
|
||||
precvframe->pkt = pkt_copy;
|
||||
/* force pkt_copy->data at 8-byte alignment address */
|
||||
skb_reserve(pkt_copy, 8 -
|
||||
((unsigned long)(pkt_copy->data) & 7));
|
||||
/*force ip_hdr at 8-byte alignment address
|
||||
according to shift_sz. */
|
||||
skb_reserve(pkt_copy, shift_sz);
|
||||
memcpy(pkt_copy->data, pbuf + pattrib->shift_sz +
|
||||
pattrib->drvinfo_sz + RXDESC_SIZE, skb_len);
|
||||
skb_put(pkt_copy, skb_len);
|
||||
} else {
|
||||
if (pattrib->mfrag == 1 && pattrib->frag_num == 0) {
|
||||
DBG_8723A("recvbuf2recvframe: alloc_skb fail, "
|
||||
"drop frag frame \n");
|
||||
rtw_free_recvframe23a(precvframe);
|
||||
goto _exit_recvbuf2recvframe;
|
||||
}
|
||||
|
||||
precvframe->pkt = skb_clone(pskb, GFP_ATOMIC);
|
||||
if (!precvframe->pkt) {
|
||||
DBG_8723A("recvbuf2recvframe: skb_clone "
|
||||
"fail\n");
|
||||
rtw_free_recvframe23a(precvframe);
|
||||
goto _exit_recvbuf2recvframe;
|
||||
}
|
||||
}
|
||||
|
||||
if (pattrib->physt) {
|
||||
pphy_info = (struct phy_stat *)(pbuf + RXDESC_OFFSET);
|
||||
update_recvframe_phyinfo(precvframe, pphy_info);
|
||||
}
|
||||
|
||||
if (rtw_recv_entry23a(precvframe) != _SUCCESS)
|
||||
RT_TRACE(_module_rtl871x_recv_c_, _drv_err_,
|
||||
"recvbuf2recvframe: rtw_recv_entry23a(precvframe) != _SUCCESS\n");
|
||||
|
||||
pkt_cnt--;
|
||||
transfer_len -= pkt_offset;
|
||||
pbuf += pkt_offset;
|
||||
precvframe = NULL;
|
||||
pkt_copy = NULL;
|
||||
|
||||
if (transfer_len > 0 && pkt_cnt == 0)
|
||||
pkt_cnt = (le32_to_cpu(prxstat->rxdw2)>>16) & 0xff;
|
||||
|
||||
} while (transfer_len > 0 && pkt_cnt > 0);
|
||||
|
||||
_exit_recvbuf2recvframe:
|
||||
|
||||
return _SUCCESS;
|
||||
}
|
||||
|
||||
void rtl8723au_recv_tasklet(void *priv)
|
||||
{
|
||||
struct sk_buff *pskb;
|
||||
struct rtw_adapter *padapter = (struct rtw_adapter *)priv;
|
||||
struct recv_priv *precvpriv = &padapter->recvpriv;
|
||||
|
||||
while (NULL != (pskb = skb_dequeue(&precvpriv->rx_skb_queue))) {
|
||||
if (padapter->bDriverStopped || padapter->bSurpriseRemoved) {
|
||||
DBG_8723A("recv_tasklet => bDriverStopped or "
|
||||
"bSurpriseRemoved \n");
|
||||
dev_kfree_skb_any(pskb);
|
||||
break;
|
||||
}
|
||||
|
||||
recvbuf2recvframe(padapter, pskb);
|
||||
skb_reset_tail_pointer(pskb);
|
||||
|
||||
pskb->len = 0;
|
||||
|
||||
skb_queue_tail(&precvpriv->free_recv_skb_queue, pskb);
|
||||
}
|
||||
}
|
||||
|
||||
static void usb_read_port_complete(struct urb *purb)
|
||||
{
|
||||
struct recv_buf *precvbuf = (struct recv_buf *)purb->context;
|
||||
struct rtw_adapter *padapter = (struct rtw_adapter *)precvbuf->adapter;
|
||||
struct recv_priv *precvpriv = &padapter->recvpriv;
|
||||
|
||||
RT_TRACE(_module_hci_ops_os_c_, _drv_err_,
|
||||
"usb_read_port_complete!!!\n");
|
||||
|
||||
precvpriv->rx_pending_cnt--;
|
||||
|
||||
if (padapter->bSurpriseRemoved || padapter->bDriverStopped ||
|
||||
padapter->bReadPortCancel) {
|
||||
RT_TRACE(_module_hci_ops_os_c_, _drv_err_,
|
||||
"usb_read_port_complete:bDriverStopped(%d) OR bSurpriseRemoved(%d)\n",
|
||||
padapter->bDriverStopped, padapter->bSurpriseRemoved);
|
||||
|
||||
DBG_8723A("%s()-%d: RX Warning! bDriverStopped(%d) OR "
|
||||
"bSurpriseRemoved(%d) bReadPortCancel(%d)\n",
|
||||
__func__, __LINE__, padapter->bDriverStopped,
|
||||
padapter->bSurpriseRemoved, padapter->bReadPortCancel);
|
||||
return;
|
||||
}
|
||||
|
||||
if (purb->status == 0) {
|
||||
if (purb->actual_length > MAX_RECVBUF_SZ ||
|
||||
purb->actual_length < RXDESC_SIZE) {
|
||||
RT_TRACE(_module_hci_ops_os_c_, _drv_err_,
|
||||
"usb_read_port_complete: (purb->actual_length > MAX_RECVBUF_SZ) || (purb->actual_length < RXDESC_SIZE)\n");
|
||||
rtl8723au_read_port(padapter, 0, precvbuf);
|
||||
DBG_8723A("%s()-%d: RX Warning!\n",
|
||||
__func__, __LINE__);
|
||||
} else {
|
||||
rtw_reset_continual_urb_error(
|
||||
adapter_to_dvobj(padapter));
|
||||
|
||||
skb_put(precvbuf->pskb, purb->actual_length);
|
||||
skb_queue_tail(&precvpriv->rx_skb_queue,
|
||||
precvbuf->pskb);
|
||||
|
||||
if (skb_queue_len(&precvpriv->rx_skb_queue) <= 1)
|
||||
tasklet_schedule(&precvpriv->recv_tasklet);
|
||||
|
||||
precvbuf->pskb = NULL;
|
||||
rtl8723au_read_port(padapter, 0, precvbuf);
|
||||
}
|
||||
} else {
|
||||
RT_TRACE(_module_hci_ops_os_c_, _drv_err_,
|
||||
"usb_read_port_complete : purb->status(%d) != 0\n",
|
||||
purb->status);
|
||||
skb_put(precvbuf->pskb, purb->actual_length);
|
||||
precvbuf->pskb = NULL;
|
||||
|
||||
DBG_8723A("###=> usb_read_port_complete => urb status(%d)\n",
|
||||
purb->status);
|
||||
|
||||
if (rtw_inc_and_chk_continual_urb_error(
|
||||
adapter_to_dvobj(padapter))) {
|
||||
padapter->bSurpriseRemoved = true;
|
||||
}
|
||||
|
||||
switch (purb->status) {
|
||||
case -EINVAL:
|
||||
case -EPIPE:
|
||||
case -ENODEV:
|
||||
case -ESHUTDOWN:
|
||||
RT_TRACE(_module_hci_ops_os_c_, _drv_err_,
|
||||
"usb_read_port_complete:bSurpriseRemoved = true\n");
|
||||
/* Intentional fall through here */
|
||||
case -ENOENT:
|
||||
padapter->bDriverStopped = true;
|
||||
RT_TRACE(_module_hci_ops_os_c_, _drv_err_,
|
||||
"usb_read_port_complete:bDriverStopped = true\n");
|
||||
break;
|
||||
case -EPROTO:
|
||||
case -EOVERFLOW:
|
||||
rtl8723au_read_port(padapter, 0, precvbuf);
|
||||
break;
|
||||
case -EINPROGRESS:
|
||||
DBG_8723A("ERROR: URB IS IN PROGRESS!\n");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int rtl8723au_read_port(struct rtw_adapter *adapter, u32 cnt,
|
||||
struct recv_buf *precvbuf)
|
||||
{
|
||||
struct urb *purb;
|
||||
struct dvobj_priv *pdvobj = adapter_to_dvobj(adapter);
|
||||
struct recv_priv *precvpriv = &adapter->recvpriv;
|
||||
struct usb_device *pusbd = pdvobj->pusbdev;
|
||||
int err;
|
||||
unsigned int pipe;
|
||||
unsigned long tmpaddr;
|
||||
unsigned long alignment;
|
||||
int ret = _SUCCESS;
|
||||
|
||||
if (adapter->bDriverStopped || adapter->bSurpriseRemoved) {
|
||||
RT_TRACE(_module_hci_ops_os_c_, _drv_err_,
|
||||
"usb_read_port:(padapter->bDriverStopped ||padapter->bSurpriseRemoved)!!!\n");
|
||||
return _FAIL;
|
||||
}
|
||||
|
||||
if (!precvbuf) {
|
||||
RT_TRACE(_module_hci_ops_os_c_, _drv_err_,
|
||||
"usb_read_port:precvbuf == NULL\n");
|
||||
return _FAIL;
|
||||
}
|
||||
|
||||
if (!precvbuf->pskb)
|
||||
precvbuf->pskb = skb_dequeue(&precvpriv->free_recv_skb_queue);
|
||||
|
||||
/* re-assign for linux based on skb */
|
||||
if (!precvbuf->pskb) {
|
||||
precvbuf->pskb = netdev_alloc_skb(adapter->pnetdev, MAX_RECVBUF_SZ + RECVBUFF_ALIGN_SZ);
|
||||
if (precvbuf->pskb == NULL) {
|
||||
RT_TRACE(_module_hci_ops_os_c_, _drv_err_,
|
||||
"init_recvbuf(): alloc_skb fail!\n");
|
||||
return _FAIL;
|
||||
}
|
||||
|
||||
tmpaddr = (unsigned long)precvbuf->pskb->data;
|
||||
alignment = tmpaddr & (RECVBUFF_ALIGN_SZ-1);
|
||||
skb_reserve(precvbuf->pskb, (RECVBUFF_ALIGN_SZ - alignment));
|
||||
}
|
||||
|
||||
precvpriv->rx_pending_cnt++;
|
||||
|
||||
purb = precvbuf->purb;
|
||||
|
||||
/* translate DMA FIFO addr to pipehandle */
|
||||
pipe = usb_rcvbulkpipe(pusbd, pdvobj->RtInPipe[0]);
|
||||
|
||||
usb_fill_bulk_urb(purb, pusbd, pipe, precvbuf->pskb->data,
|
||||
MAX_RECVBUF_SZ, usb_read_port_complete,
|
||||
precvbuf);/* context is precvbuf */
|
||||
|
||||
err = usb_submit_urb(purb, GFP_ATOMIC);
|
||||
if ((err) && (err != -EPERM)) {
|
||||
RT_TRACE(_module_hci_ops_os_c_, _drv_err_,
|
||||
"cannot submit rx in-token(err = 0x%.8x), URB_STATUS = 0x%.8x\n",
|
||||
err, purb->status);
|
||||
DBG_8723A("cannot submit rx in-token(err = 0x%08x), urb_status "
|
||||
"= %d\n", err, purb->status);
|
||||
ret = _FAIL;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void rtl8723au_xmit_tasklet(void *priv)
|
||||
{
|
||||
int ret;
|
||||
struct rtw_adapter *padapter = (struct rtw_adapter *)priv;
|
||||
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
|
||||
|
||||
if (check_fwstate(&padapter->mlmepriv, _FW_UNDER_SURVEY))
|
||||
return;
|
||||
|
||||
while (1) {
|
||||
if (padapter->bDriverStopped || padapter->bSurpriseRemoved ||
|
||||
padapter->bWritePortCancel) {
|
||||
DBG_8723A("xmit_tasklet => bDriverStopped or "
|
||||
"bSurpriseRemoved or bWritePortCancel\n");
|
||||
break;
|
||||
}
|
||||
|
||||
ret = rtl8723au_xmitframe_complete(padapter, pxmitpriv, NULL);
|
||||
|
||||
if (!ret)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void rtl8723au_set_hw_type(struct rtw_adapter *padapter)
|
||||
{
|
||||
padapter->chip_type = RTL8723A;
|
||||
padapter->HardwareType = HARDWARE_TYPE_RTL8723AU;
|
||||
DBG_8723A("CHIP TYPE: RTL8723A\n");
|
||||
}
|
|
@ -1,162 +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.
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef __INC_HAL8723PHYCFG_H__
|
||||
#define __INC_HAL8723PHYCFG_H__
|
||||
|
||||
/*------------------------------Define structure----------------------------*/
|
||||
enum RF_RADIO_PATH {
|
||||
RF_PATH_A = 0, /* Radio Path A */
|
||||
RF_PATH_B = 1, /* Radio Path B */
|
||||
RF_PATH_MAX /* Max RF number 90 support */
|
||||
};
|
||||
|
||||
#define CHANNEL_MAX_NUMBER 14 /* 14 is the max channel number */
|
||||
|
||||
enum WIRELESS_MODE {
|
||||
WIRELESS_MODE_UNKNOWN = 0x00,
|
||||
WIRELESS_MODE_A = BIT(2),
|
||||
WIRELESS_MODE_B = BIT(0),
|
||||
WIRELESS_MODE_G = BIT(1),
|
||||
WIRELESS_MODE_AUTO = BIT(5),
|
||||
WIRELESS_MODE_N_24G = BIT(3),
|
||||
WIRELESS_MODE_N_5G = BIT(4),
|
||||
WIRELESS_MODE_AC = BIT(6)
|
||||
};
|
||||
|
||||
struct bb_reg_define {
|
||||
u32 rfintfs; /* set software control: */
|
||||
/* 0x870~0x877[8 bytes] */
|
||||
u32 rfintfi; /* readback data: */
|
||||
/* 0x8e0~0x8e7[8 bytes] */
|
||||
u32 rfintfo; /* output data: */
|
||||
/* 0x860~0x86f [16 bytes] */
|
||||
u32 rfintfe; /* output enable: */
|
||||
/* 0x860~0x86f [16 bytes] */
|
||||
u32 rf3wireOffset; /* LSSI data: */
|
||||
/* 0x840~0x84f [16 bytes] */
|
||||
u32 rfLSSI_Select; /* BB Band Select: */
|
||||
/* 0x878~0x87f [8 bytes] */
|
||||
u32 rfTxGainStage; /* Tx gain stage: */
|
||||
/* 0x80c~0x80f [4 bytes] */
|
||||
u32 rfHSSIPara1; /* wire parameter control1 : */
|
||||
/* 0x820~0x823, 0x828~0x82b, 0x830~0x833, 0x838~0x83b [16 bytes] */
|
||||
u32 rfHSSIPara2; /* wire parameter control2 : */
|
||||
/* 0x824~0x827, 0x82c~0x82f, 0x834~0x837, 0x83c~0x83f [16 bytes] */
|
||||
u32 rfSwitchControl; /* Tx Rx antenna control : */
|
||||
/* 0x858~0x85f [16 bytes] */
|
||||
u32 rfAGCControl1; /* AGC parameter control1 : */
|
||||
/* 0xc50~0xc53, 0xc58~0xc5b, 0xc60~0xc63, 0xc68~0xc6b [16 bytes] */
|
||||
u32 rfAGCControl2; /* AGC parameter control2 : */
|
||||
/* 0xc54~0xc57, 0xc5c~0xc5f, 0xc64~0xc67, 0xc6c~0xc6f [16 bytes] */
|
||||
u32 rfRxIQImbalance; /* OFDM Rx IQ imbalance matrix : */
|
||||
/* 0xc14~0xc17, 0xc1c~0xc1f, 0xc24~0xc27, 0xc2c~0xc2f [16 bytes] */
|
||||
u32 rfRxAFE; /* Rx IQ DC ofset and Rx digital filter, Rx DC notch filter : */
|
||||
/* 0xc10~0xc13, 0xc18~0xc1b, 0xc20~0xc23, 0xc28~0xc2b [16 bytes] */
|
||||
u32 rfTxIQImbalance; /* OFDM Tx IQ imbalance matrix */
|
||||
/* 0xc80~0xc83, 0xc88~0xc8b, 0xc90~0xc93, 0xc98~0xc9b [16 bytes] */
|
||||
u32 rfTxAFE; /* Tx IQ DC Offset and Tx DFIR type */
|
||||
/* 0xc84~0xc87, 0xc8c~0xc8f, 0xc94~0xc97, 0xc9c~0xc9f [16 bytes] */
|
||||
u32 rfLSSIReadBack; /* LSSI RF readback data SI mode */
|
||||
/* 0x8a0~0x8af [16 bytes] */
|
||||
u32 rfLSSIReadBackPi; /* LSSI RF readback data PI mode 0x8b8-8bc for Path A and B */
|
||||
};
|
||||
|
||||
struct r_antenna_sel_ofdm {
|
||||
u32 r_tx_antenna:4;
|
||||
u32 r_ant_l:4;
|
||||
u32 r_ant_non_ht:4;
|
||||
u32 r_ant_ht1:4;
|
||||
u32 r_ant_ht2:4;
|
||||
u32 r_ant_ht_s1:4;
|
||||
u32 r_ant_non_ht_s1:4;
|
||||
u32 OFDM_TXSC:2;
|
||||
u32 Reserved:2;
|
||||
};
|
||||
|
||||
struct r_antenna_sel_cck {
|
||||
u8 r_cckrx_enable_2:2;
|
||||
u8 r_cckrx_enable:2;
|
||||
u8 r_ccktx_enable:4;
|
||||
};
|
||||
|
||||
/*------------------------------Define structure----------------------------*/
|
||||
|
||||
|
||||
/*------------------------Export global variable----------------------------*/
|
||||
/*------------------------Export global variable----------------------------*/
|
||||
|
||||
|
||||
/*------------------------Export Macro Definition---------------------------*/
|
||||
/*------------------------Export Macro Definition---------------------------*/
|
||||
|
||||
|
||||
/*--------------------------Exported Function prototype---------------------*/
|
||||
/* */
|
||||
/* BB and RF register read/write */
|
||||
/* */
|
||||
u32 PHY_QueryBBReg(struct rtw_adapter *Adapter, u32 RegAddr,
|
||||
u32 BitMask);
|
||||
void PHY_SetBBReg(struct rtw_adapter *Adapter, u32 RegAddr,
|
||||
u32 BitMask, u32 Data);
|
||||
u32 PHY_QueryRFReg(struct rtw_adapter *Adapter,
|
||||
enum RF_RADIO_PATH eRFPath, u32 RegAddr,
|
||||
u32 BitMask);
|
||||
void PHY_SetRFReg(struct rtw_adapter *Adapter,
|
||||
enum RF_RADIO_PATH eRFPath, u32 RegAddr,
|
||||
u32 BitMask, u32 Data);
|
||||
|
||||
/* */
|
||||
/* BB TX Power R/W */
|
||||
/* */
|
||||
void PHY_SetTxPowerLevel8723A(struct rtw_adapter *Adapter, u8 channel);
|
||||
|
||||
/* */
|
||||
/* Switch bandwidth for 8723A */
|
||||
/* */
|
||||
void PHY_SetBWMode23a8723A(struct rtw_adapter *pAdapter,
|
||||
enum ht_channel_width ChnlWidth,
|
||||
unsigned char Offset);
|
||||
|
||||
/* */
|
||||
/* channel switch related funciton */
|
||||
/* */
|
||||
void PHY_SwChnl8723A(struct rtw_adapter *pAdapter, u8 channel);
|
||||
/* Call after initialization */
|
||||
void ChkFwCmdIoDone(struct rtw_adapter *Adapter);
|
||||
|
||||
/* */
|
||||
/* Modify the value of the hw register when beacon interval be changed. */
|
||||
/* */
|
||||
void
|
||||
rtl8192c_PHY_SetBeaconHwReg(struct rtw_adapter *Adapter, u16 BeaconInterval);
|
||||
|
||||
|
||||
void PHY_SwitchEphyParameter(struct rtw_adapter *Adapter);
|
||||
|
||||
void PHY_EnableHostClkReq(struct rtw_adapter *Adapter);
|
||||
|
||||
bool
|
||||
SetAntennaConfig92C(struct rtw_adapter *Adapter, u8 DefaultAnt);
|
||||
|
||||
/*--------------------------Exported Function prototype---------------------*/
|
||||
|
||||
#define PHY_SetMacReg PHY_SetBBReg
|
||||
|
||||
/* MAC/BB/RF HAL config */
|
||||
int PHY_BBConfig8723A(struct rtw_adapter *Adapter);
|
||||
s32 PHY_MACConfig8723A(struct rtw_adapter *padapter);
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
|
@ -1,126 +0,0 @@
|
|||
#ifndef __HAL8723PWRSEQ_H__
|
||||
#define __HAL8723PWRSEQ_H__
|
||||
/*
|
||||
Check document WM-20110607-Paul-RTL8723A_Power_Architecture-R02.vsd
|
||||
There are 6 HW Power States:
|
||||
0: POFF--Power Off
|
||||
1: PDN--Power Down
|
||||
2: CARDEMU--Card Emulation
|
||||
3: ACT--Active Mode
|
||||
4: LPS--Low Power State
|
||||
5: SUS--Suspend
|
||||
|
||||
The transision from different states are defined below
|
||||
TRANS_CARDEMU_TO_ACT
|
||||
TRANS_ACT_TO_CARDEMU
|
||||
TRANS_CARDEMU_TO_SUS
|
||||
TRANS_SUS_TO_CARDEMU
|
||||
TRANS_CARDEMU_TO_PDN
|
||||
TRANS_ACT_TO_LPS
|
||||
TRANS_LPS_TO_ACT
|
||||
|
||||
TRANS_END
|
||||
*/
|
||||
#include "HalPwrSeqCmd.h"
|
||||
#include "rtl8723a_spec.h"
|
||||
|
||||
#define RTL8723A_TRANS_CARDEMU_TO_ACT_STEPS 15
|
||||
#define RTL8723A_TRANS_ACT_TO_CARDEMU_STEPS 15
|
||||
#define RTL8723A_TRANS_CARDEMU_TO_SUS_STEPS 15
|
||||
#define RTL8723A_TRANS_SUS_TO_CARDEMU_STEPS 15
|
||||
#define RTL8723A_TRANS_CARDEMU_TO_PDN_STEPS 15
|
||||
#define RTL8723A_TRANS_PDN_TO_CARDEMU_STEPS 15
|
||||
#define RTL8723A_TRANS_ACT_TO_LPS_STEPS 15
|
||||
#define RTL8723A_TRANS_LPS_TO_ACT_STEPS 15
|
||||
#define RTL8723A_TRANS_END_STEPS 1
|
||||
|
||||
|
||||
/* format
|
||||
* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, comments here
|
||||
*/
|
||||
#define RTL8723A_TRANS_CARDEMU_TO_ACT \
|
||||
{0x0020, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(0), BIT(0)}, /*0x20[0] = 1b'1 enable LDOA12 MACRO block for all interface*/ \
|
||||
{0x0067, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(4), 0}, /*0x67[0] = 0 to disable BT_GPS_SEL pins*/ \
|
||||
{0x0001, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK, PWR_BASEADDR_MAC, PWR_CMD_DELAY, 1, PWRSEQ_DELAY_MS},/*Delay 1ms*/ \
|
||||
{0x0000, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(5), 0}, /*0x00[5] = 1b'0 release analog Ips to digital , 1:isolation*/ \
|
||||
{0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(2), 0},/* disable SW LPS 0x04[10]= 0*/ \
|
||||
{0x0006, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_POLLING, BIT(1), BIT(1)},/* wait till 0x04[17] = 1 power ready*/ \
|
||||
{0x0006, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(0), BIT(0)},/* release WLON reset 0x04[16]= 1*/ \
|
||||
{0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(7), 0},/* disable HWPDN 0x04[15]= 0*/ \
|
||||
{0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, (BIT(4)|BIT(3)), 0},/* disable WL suspend*/ \
|
||||
{0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(0), BIT(0)},/* polling until return 0*/ \
|
||||
{0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_POLLING, BIT(0), 0},/**/ \
|
||||
{0x004E, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(7), 1},/*0x4C[23] = 0x4E[7] = 1, switch DPDT_SEL_P output from WL BB */\
|
||||
|
||||
#define RTL8723A_TRANS_ACT_TO_CARDEMU \
|
||||
{0x001F, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0},/*0x1F[7:0] = 0 turn off RF*/ \
|
||||
{0x004E, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(7), 0},/*0x4C[23] = 0x4E[7] = 0, switch DPDT_SEL_P output from register 0x65[2] */\
|
||||
{0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(1), BIT(1)}, /*0x04[9] = 1 turn off MAC by HW state machine*/ \
|
||||
{0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_POLLING, BIT(1), 0}, /*wait till 0x04[9] = 0 polling until return 0 to disable*/ \
|
||||
{0x0000, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(5), BIT(5)}, /*0x00[5] = 1b'1 analog Ips to digital , 1:isolation*/ \
|
||||
{0x0020, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(0), 0}, /*0x20[0] = 1b'0 disable LDOA12 MACRO block*/ \
|
||||
|
||||
|
||||
#define RTL8723A_TRANS_CARDEMU_TO_SUS \
|
||||
{0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(3)|BIT(4), BIT(3)}, /*0x04[12:11] = 2b'01 enable WL suspend*/
|
||||
|
||||
#define RTL8723A_TRANS_SUS_TO_CARDEMU \
|
||||
{0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(3) | BIT(7), 0}, /*clear suspend enable and power down enable*/ \
|
||||
{0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(3)|BIT(4), 0}, /*0x04[12:11] = 2b'01enable WL suspend*/
|
||||
|
||||
#define RTL8723A_TRANS_CARDEMU_TO_CARDDIS \
|
||||
{0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(3)|BIT(4), BIT(3)}, /*0x04[12:11] = 2b'01 enable WL suspend*/ \
|
||||
{0x004A, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(0), BIT(0)}, /*0x48[16] = 1 to enable GPIO9 as EXT WAKEUP*/
|
||||
|
||||
#define RTL8723A_TRANS_CARDDIS_TO_CARDEMU \
|
||||
{0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(3) | BIT(7), 0}, /*clear suspend enable and power down enable*/ \
|
||||
{0x004A, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(0), 0}, /*0x48[16] = 0 to disable GPIO9 as EXT WAKEUP*/ \
|
||||
{0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(3)|BIT(4), 0}, /*0x04[12:11] = 2b'01enable WL suspend*/
|
||||
|
||||
#define RTL8723A_TRANS_CARDEMU_TO_PDN \
|
||||
{0x0007, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0x20}, /*0x07[7:0] = 0x20 SOP option to disable BG/MB/ACK/SWR*/ \
|
||||
{0x0006, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(0), 0},/* 0x04[16] = 0*/\
|
||||
{0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(7), BIT(7)},/* 0x04[15] = 1*/
|
||||
|
||||
#define RTL8723A_TRANS_PDN_TO_CARDEMU \
|
||||
{0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(7), 0},/* 0x04[15] = 0*/
|
||||
|
||||
#define RTL8723A_TRANS_ACT_TO_LPS \
|
||||
{0x0522, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0xFF},/*Tx Pause*/ \
|
||||
{0x05F8, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \
|
||||
{0x05F9, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \
|
||||
{0x05FA, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \
|
||||
{0x05FB, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \
|
||||
{0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(0), 0},/*CCK and OFDM are disabled, and clock are gated*/ \
|
||||
{0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_DELAY, 0, PWRSEQ_DELAY_US},/*Delay 1us*/ \
|
||||
{0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(1), 0},/*Whole BB is reset*/ \
|
||||
{0x0100, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0x03},/*Reset MAC TRX*/ \
|
||||
{0x0101, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(1), 0},/*check if removed later*/ \
|
||||
{0x0553, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(5), BIT(5)},/*Respond TxOK to scheduler*/
|
||||
|
||||
#define RTL8723A_TRANS_LPS_TO_ACT \
|
||||
{0xFE58, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0x84}, /*USB RPWM*/\
|
||||
{0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_DELAY, 0, PWRSEQ_DELAY_MS}, /*Delay*/\
|
||||
{0x0008, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(4), 0}, /*. 0x08[4] = 0 switch TSF to 40M*/\
|
||||
{0x0109, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_POLLING, BIT(7), 0}, /*Polling 0x109[7]= 0 TSF in 40M*/\
|
||||
{0x0029, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(6)|BIT(7), 0}, /*. 0x29[7:6] = 2b'00 enable BB clock*/\
|
||||
{0x0101, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(1), BIT(1)}, /*. 0x101[1] = 1*/\
|
||||
{0x0100, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0xFF}, /*. 0x100[7:0] = 0xFF enable WMAC TRX*/\
|
||||
{0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(1)|BIT(0), BIT(1)|BIT(0)}, /*. 0x02[1:0] = 2b'11 enable BB macro*/\
|
||||
{0x0522, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0}, /*. 0x522 = 0*/
|
||||
|
||||
#define RTL8723A_TRANS_END \
|
||||
{0xFFFF, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, 0, PWR_CMD_END, 0, 0},
|
||||
|
||||
|
||||
extern struct wlan_pwr_cfg rtl8723AU_power_on_flow[RTL8723A_TRANS_CARDEMU_TO_ACT_STEPS+RTL8723A_TRANS_END_STEPS];
|
||||
extern struct wlan_pwr_cfg rtl8723AU_radio_off_flow[RTL8723A_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723A_TRANS_END_STEPS];
|
||||
extern struct wlan_pwr_cfg rtl8723AU_card_disable_flow[RTL8723A_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723A_TRANS_CARDEMU_TO_PDN_STEPS+RTL8723A_TRANS_END_STEPS];
|
||||
extern struct wlan_pwr_cfg rtl8723AU_card_enable_flow[RTL8723A_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723A_TRANS_CARDEMU_TO_PDN_STEPS+RTL8723A_TRANS_END_STEPS];
|
||||
extern struct wlan_pwr_cfg rtl8723AU_suspend_flow[RTL8723A_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723A_TRANS_CARDEMU_TO_SUS_STEPS+RTL8723A_TRANS_END_STEPS];
|
||||
extern struct wlan_pwr_cfg rtl8723AU_resume_flow[RTL8723A_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723A_TRANS_CARDEMU_TO_SUS_STEPS+RTL8723A_TRANS_END_STEPS];
|
||||
extern struct wlan_pwr_cfg rtl8723AU_hwpdn_flow[RTL8723A_TRANS_ACT_TO_CARDEMU_STEPS+RTL8723A_TRANS_CARDEMU_TO_PDN_STEPS+RTL8723A_TRANS_END_STEPS];
|
||||
extern struct wlan_pwr_cfg rtl8723AU_enter_lps_flow[RTL8723A_TRANS_ACT_TO_LPS_STEPS+RTL8723A_TRANS_END_STEPS];
|
||||
extern struct wlan_pwr_cfg rtl8723AU_leave_lps_flow[RTL8723A_TRANS_LPS_TO_ACT_STEPS+RTL8723A_TRANS_END_STEPS];
|
||||
|
||||
#endif
|
|
@ -1,29 +0,0 @@
|
|||
#ifndef __INC_HAL8723U_FW_IMG_H
|
||||
#define __INC_HAL8723U_FW_IMG_H
|
||||
|
||||
/*Created on 2013/01/14, 15:51*/
|
||||
|
||||
/* FW v16 enable usb interrupt */
|
||||
#define Rtl8723UImgArrayLength 22172
|
||||
extern u8 Rtl8723UFwImgArray[Rtl8723UImgArrayLength];
|
||||
#define Rtl8723UBTImgArrayLength 1
|
||||
extern u8 Rtl8723UFwBTImgArray[Rtl8723UBTImgArrayLength];
|
||||
|
||||
#define Rtl8723UUMCBCutImgArrayWithBTLength 24118
|
||||
#define Rtl8723UUMCBCutImgArrayWithoutBTLength 19200
|
||||
|
||||
extern u8 Rtl8723UFwUMCBCutImgArrayWithBT[Rtl8723UUMCBCutImgArrayWithBTLength];
|
||||
extern u8 Rtl8723UFwUMCBCutImgArrayWithoutBT[Rtl8723UUMCBCutImgArrayWithoutBTLength];
|
||||
|
||||
#define Rtl8723SUMCBCutMPImgArrayLength 24174
|
||||
extern const u8 Rtl8723SFwUMCBCutMPImgArray[Rtl8723SUMCBCutMPImgArrayLength];
|
||||
|
||||
#define Rtl8723EBTImgArrayLength 15276
|
||||
extern u8 Rtl8723EFwBTImgArray[Rtl8723EBTImgArrayLength];
|
||||
|
||||
#define Rtl8723UPHY_REG_Array_PGLength 336
|
||||
extern u32 Rtl8723UPHY_REG_Array_PG[Rtl8723UPHY_REG_Array_PGLength];
|
||||
#define Rtl8723UMACPHY_Array_PGLength 1
|
||||
extern u32 Rtl8723UMACPHY_Array_PG[Rtl8723UMACPHY_Array_PGLength];
|
||||
|
||||
#endif /* ifndef __INC_HAL8723U_FW_IMG_H */
|
|
@ -1,64 +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.
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef __RTL8723A_ODM_H__
|
||||
#define __RTL8723A_ODM_H__
|
||||
/* */
|
||||
|
||||
#define RSSI_CCK 0
|
||||
#define RSSI_OFDM 1
|
||||
#define RSSI_DEFAULT 2
|
||||
|
||||
#define IQK_MAC_REG_NUM 4
|
||||
#define IQK_ADDA_REG_NUM 16
|
||||
#define IQK_BB_REG_NUM 9
|
||||
#define HP_THERMAL_NUM 8
|
||||
|
||||
|
||||
/* */
|
||||
/* structure and define */
|
||||
/* */
|
||||
|
||||
|
||||
|
||||
|
||||
/*------------------------Export global variable----------------------------*/
|
||||
/*------------------------Export global variable----------------------------*/
|
||||
/*------------------------Export Marco Definition---------------------------*/
|
||||
/* define DM_MultiSTA_InitGainChangeNotify(Event) {DM_DigTable.CurMultiSTAConnectState = Event;} */
|
||||
|
||||
|
||||
/* */
|
||||
/* function prototype */
|
||||
/* */
|
||||
|
||||
/* */
|
||||
/* IQ calibrate */
|
||||
/* */
|
||||
void rtl8723a_phy_iq_calibrate(struct rtw_adapter *pAdapter, bool bReCovery);
|
||||
|
||||
/* */
|
||||
/* LC calibrate */
|
||||
/* */
|
||||
void rtl8723a_phy_lc_calibrate(struct rtw_adapter *pAdapter);
|
||||
|
||||
/* */
|
||||
/* AP calibrate */
|
||||
/* */
|
||||
void rtl8723a_phy_ap_calibrate(struct rtw_adapter *pAdapter, char delta);
|
||||
|
||||
void rtl8723a_odm_check_tx_power_tracking(struct rtw_adapter *Adapter);
|
||||
|
||||
#endif
|
|
@ -1,38 +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.
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __INC_BB_8723A_HW_IMG_H
|
||||
#define __INC_BB_8723A_HW_IMG_H
|
||||
|
||||
/******************************************************************************
|
||||
* AGC_TAB_1T.TXT
|
||||
******************************************************************************/
|
||||
|
||||
void ODM_ReadAndConfig_AGC_TAB_1T_8723A(struct dm_odm_t *pDM_Odm);
|
||||
|
||||
/******************************************************************************
|
||||
* PHY_REG_1T.TXT
|
||||
******************************************************************************/
|
||||
|
||||
void ODM_ReadAndConfig_PHY_REG_1T_8723A(struct dm_odm_t *pDM_Odm);
|
||||
|
||||
/******************************************************************************
|
||||
* PHY_REG_MP.TXT
|
||||
******************************************************************************/
|
||||
|
||||
void ODM_ReadAndConfig_PHY_REG_MP_8723A(struct dm_odm_t *pDM_Odm);
|
||||
|
||||
#endif /* end of HWIMG_SUPPORT */
|
|
@ -1,28 +0,0 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __INC_FW_8723A_HW_IMG_H
|
||||
#define __INC_FW_8723A_HW_IMG_H
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* rtl8723fw_B.TXT
|
||||
******************************************************************************/
|
||||
|
||||
void ODM_ReadFirmware_8723A_rtl8723fw_B(struct dm_odm_t *pDM_Odm,
|
||||
u8 *pFirmware, u32 *pFirmwareSize);
|
||||
|
||||
#endif /* end of HWIMG_SUPPORT */
|
|
@ -1,26 +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.
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __INC_MAC_8723A_HW_IMG_H
|
||||
#define __INC_MAC_8723A_HW_IMG_H
|
||||
|
||||
/******************************************************************************
|
||||
* MAC_REG.TXT
|
||||
******************************************************************************/
|
||||
|
||||
void ODM_ReadAndConfig_MAC_REG_8723A(struct dm_odm_t *pDM_Odm);
|
||||
|
||||
#endif /* end of HWIMG_SUPPORT */
|
|
@ -1,25 +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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __INC_RF_8723A_HW_IMG_H
|
||||
#define __INC_RF_8723A_HW_IMG_H
|
||||
|
||||
/******************************************************************************
|
||||
* RadioA_1T.TXT
|
||||
******************************************************************************/
|
||||
|
||||
void ODM_ReadAndConfig_RadioA_1T_8723A(struct dm_odm_t *pDM_Odm);
|
||||
|
||||
#endif /* end of HWIMG_SUPPORT */
|
|
@ -1,130 +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.
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef __HALPWRSEQCMD_H__
|
||||
#define __HALPWRSEQCMD_H__
|
||||
|
||||
#include <drv_types.h>
|
||||
|
||||
/*---------------------------------------------*/
|
||||
/*---------------------------------------------*/
|
||||
#define PWR_CMD_READ 0x00
|
||||
/* offset: the read register offset */
|
||||
/* msk: the mask of the read value */
|
||||
/* value: N/A, left by 0 */
|
||||
/* note: dirver shall implement this function by read & msk */
|
||||
|
||||
#define PWR_CMD_WRITE 0x01
|
||||
/* offset: the read register offset */
|
||||
/* msk: the mask of the write bits */
|
||||
/* value: write value */
|
||||
/* note: driver shall implement this cmd by read & msk after write */
|
||||
|
||||
#define PWR_CMD_POLLING 0x02
|
||||
/* offset: the read register offset */
|
||||
/* msk: the mask of the polled value */
|
||||
/* value: the value to be polled, masked by the msd field. */
|
||||
/* note: driver shall implement this cmd by */
|
||||
/* do{ */
|
||||
/* if( (Read(offset) & msk) == (value & msk) ) */
|
||||
/* break; */
|
||||
/* } while(not timeout); */
|
||||
|
||||
#define PWR_CMD_DELAY 0x03
|
||||
/* offset: the value to delay */
|
||||
/* msk: N/A */
|
||||
/* value: the unit of delay, 0: us, 1: ms */
|
||||
|
||||
#define PWR_CMD_END 0x04
|
||||
/* offset: N/A */
|
||||
/* msk: N/A */
|
||||
/* value: N/A */
|
||||
|
||||
/*---------------------------------------------*/
|
||||
/* 3 The value of base: 4 bits */
|
||||
/*---------------------------------------------*/
|
||||
/* define the base address of each block */
|
||||
#define PWR_BASEADDR_MAC 0x00
|
||||
#define PWR_BASEADDR_USB 0x01
|
||||
#define PWR_BASEADDR_PCIE 0x02
|
||||
#define PWR_BASEADDR_SDIO 0x03
|
||||
|
||||
/*---------------------------------------------*/
|
||||
/* 3 The value of interface_msk: 4 bits */
|
||||
/*---------------------------------------------*/
|
||||
#define PWR_INTF_SDIO_MSK BIT(0)
|
||||
#define PWR_INTF_USB_MSK BIT(1)
|
||||
#define PWR_INTF_PCI_MSK BIT(2)
|
||||
#define PWR_INTF_ALL_MSK (BIT(0)|BIT(1)|BIT(2)|BIT(3))
|
||||
|
||||
/*---------------------------------------------*/
|
||||
/* 3 The value of fab_msk: 4 bits */
|
||||
/*---------------------------------------------*/
|
||||
#define PWR_FAB_TSMC_MSK BIT(0)
|
||||
#define PWR_FAB_UMC_MSK BIT(1)
|
||||
#define PWR_FAB_ALL_MSK (BIT(0)|BIT(1)|BIT(2)|BIT(3))
|
||||
|
||||
/*---------------------------------------------*/
|
||||
/* 3 The value of cut_msk: 8 bits */
|
||||
/*---------------------------------------------*/
|
||||
#define PWR_CUT_TESTCHIP_MSK BIT(0)
|
||||
#define PWR_CUT_A_MSK BIT(1)
|
||||
#define PWR_CUT_B_MSK BIT(2)
|
||||
#define PWR_CUT_C_MSK BIT(3)
|
||||
#define PWR_CUT_D_MSK BIT(4)
|
||||
#define PWR_CUT_E_MSK BIT(5)
|
||||
#define PWR_CUT_F_MSK BIT(6)
|
||||
#define PWR_CUT_G_MSK BIT(7)
|
||||
#define PWR_CUT_ALL_MSK 0xFF
|
||||
|
||||
|
||||
enum pwrseq_delay_unit {
|
||||
PWRSEQ_DELAY_US,
|
||||
PWRSEQ_DELAY_MS,
|
||||
};
|
||||
|
||||
struct wlan_pwr_cfg {
|
||||
u16 offset;
|
||||
u8 cut_msk;
|
||||
u8 fab_msk:4;
|
||||
u8 interface_msk:4;
|
||||
u8 base:4;
|
||||
u8 cmd:4;
|
||||
u8 msk;
|
||||
u8 value;
|
||||
};
|
||||
|
||||
|
||||
#define GET_PWR_CFG_OFFSET(__PWR_CMD) __PWR_CMD.offset
|
||||
#define GET_PWR_CFG_CUT_MASK(__PWR_CMD) __PWR_CMD.cut_msk
|
||||
#define GET_PWR_CFG_FAB_MASK(__PWR_CMD) __PWR_CMD.fab_msk
|
||||
#define GET_PWR_CFG_INTF_MASK(__PWR_CMD) __PWR_CMD.interface_msk
|
||||
#define GET_PWR_CFG_BASE(__PWR_CMD) __PWR_CMD.base
|
||||
#define GET_PWR_CFG_CMD(__PWR_CMD) __PWR_CMD.cmd
|
||||
#define GET_PWR_CFG_MASK(__PWR_CMD) __PWR_CMD.msk
|
||||
#define GET_PWR_CFG_VALUE(__PWR_CMD) __PWR_CMD.value
|
||||
|
||||
|
||||
/* */
|
||||
/* Prototype of protected function. */
|
||||
/* */
|
||||
u8 HalPwrSeqCmdParsing23a(
|
||||
struct rtw_adapter *padapter,
|
||||
u8 CutVersion,
|
||||
u8 FabVersion,
|
||||
u8 InterfaceType,
|
||||
struct wlan_pwr_cfg PwrCfgCmd[]);
|
||||
|
||||
#endif
|
|
@ -1,114 +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.
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef __HAL_VERSION_DEF_H__
|
||||
#define __HAL_VERSION_DEF_H__
|
||||
|
||||
enum hal_ic_type {
|
||||
CHIP_8192S = 0,
|
||||
CHIP_8188C = 1,
|
||||
CHIP_8192C = 2,
|
||||
CHIP_8192D = 3,
|
||||
CHIP_8723A = 4,
|
||||
CHIP_8188E = 5,
|
||||
CHIP_8881A = 6,
|
||||
CHIP_8812A = 7,
|
||||
CHIP_8821A = 8,
|
||||
CHIP_8723B = 9,
|
||||
CHIP_8192E = 10,
|
||||
};
|
||||
|
||||
enum hal_chip_type {
|
||||
TEST_CHIP = 0,
|
||||
NORMAL_CHIP = 1,
|
||||
FPGA = 2,
|
||||
};
|
||||
|
||||
enum hal_cut_version {
|
||||
A_CUT_VERSION = 0,
|
||||
B_CUT_VERSION = 1,
|
||||
C_CUT_VERSION = 2,
|
||||
D_CUT_VERSION = 3,
|
||||
E_CUT_VERSION = 4,
|
||||
F_CUT_VERSION = 5,
|
||||
G_CUT_VERSION = 6,
|
||||
};
|
||||
|
||||
/* HAL_Manufacturer */
|
||||
enum hal_vendor {
|
||||
CHIP_VENDOR_TSMC = 0,
|
||||
CHIP_VENDOR_UMC = 1,
|
||||
};
|
||||
|
||||
struct hal_version {
|
||||
enum hal_ic_type ICType;
|
||||
enum hal_chip_type ChipType;
|
||||
enum hal_cut_version CUTVersion;
|
||||
enum hal_vendor VendorType;
|
||||
u8 ROMVer;
|
||||
};
|
||||
|
||||
/* Get element */
|
||||
#define GET_CVID_IC_TYPE(version) ((version).ICType)
|
||||
#define GET_CVID_CHIP_TYPE(version) ((version).ChipType)
|
||||
#define GET_CVID_MANUFACTUER(version) ((version).VendorType)
|
||||
#define GET_CVID_CUT_VERSION(version) ((version).CUTVersion)
|
||||
#define GET_CVID_ROM_VERSION(version) (((version).ROMVer) & ROM_VERSION_MASK)
|
||||
|
||||
/* Common Macro. -- */
|
||||
|
||||
#define IS_81XXC(version) \
|
||||
(((GET_CVID_IC_TYPE(version) == CHIP_8192C) || \
|
||||
(GET_CVID_IC_TYPE(version) == CHIP_8188C)) ? true : false)
|
||||
#define IS_8723_SERIES(version) \
|
||||
((GET_CVID_IC_TYPE(version) == CHIP_8723A) ? true : false)
|
||||
|
||||
#define IS_TEST_CHIP(version) \
|
||||
((GET_CVID_CHIP_TYPE(version) == TEST_CHIP) ? true : false)
|
||||
#define IS_NORMAL_CHIP(version) \
|
||||
((GET_CVID_CHIP_TYPE(version) == NORMAL_CHIP) ? true : false)
|
||||
|
||||
#define IS_A_CUT(version) \
|
||||
((GET_CVID_CUT_VERSION(version) == A_CUT_VERSION) ? true : false)
|
||||
#define IS_B_CUT(version) \
|
||||
((GET_CVID_CUT_VERSION(version) == B_CUT_VERSION) ? true : false)
|
||||
#define IS_C_CUT(version) \
|
||||
((GET_CVID_CUT_VERSION(version) == C_CUT_VERSION) ? true : false)
|
||||
#define IS_D_CUT(version) \
|
||||
((GET_CVID_CUT_VERSION(version) == D_CUT_VERSION) ? true : false)
|
||||
#define IS_E_CUT(version) \
|
||||
((GET_CVID_CUT_VERSION(version) == E_CUT_VERSION) ? true : false)
|
||||
|
||||
#define IS_CHIP_VENDOR_TSMC(version) \
|
||||
((GET_CVID_MANUFACTUER(version) == CHIP_VENDOR_TSMC) ? true : false)
|
||||
#define IS_CHIP_VENDOR_UMC(version) \
|
||||
((GET_CVID_MANUFACTUER(version) == CHIP_VENDOR_UMC) ? true : false)
|
||||
|
||||
/* Chip version Macro. -- */
|
||||
|
||||
#define IS_81xxC_VENDOR_UMC_A_CUT(version) \
|
||||
(IS_81XXC(version)?(IS_CHIP_VENDOR_UMC(version) ? \
|
||||
(IS_A_CUT(version) ? true : false) : false) : false)
|
||||
#define IS_81xxC_VENDOR_UMC_B_CUT(version) \
|
||||
(IS_81XXC(version) ? (IS_CHIP_VENDOR_UMC(version) ? \
|
||||
(IS_B_CUT(version) ? true : false) : false): false)
|
||||
#define IS_81xxC_VENDOR_UMC_C_CUT(version) \
|
||||
(IS_81XXC(version)?(IS_CHIP_VENDOR_UMC(version) ? \
|
||||
(IS_C_CUT(version) ? true : false) : false) : false)
|
||||
#define IS_8723A_A_CUT(version) \
|
||||
((IS_8723_SERIES(version)) ? (IS_A_CUT(version) ? true : false) : false)
|
||||
#define IS_8723A_B_CUT(version) \
|
||||
((IS_8723_SERIES(version)) ? (IS_B_CUT(version) ? true : false) : false)
|
||||
|
||||
#endif
|
|
@ -1,274 +0,0 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
/*-----------------------------------------------------------------------------
|
||||
|
||||
For type defines and data structure defines
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#ifndef __DRV_TYPES_H__
|
||||
#define __DRV_TYPES_H__
|
||||
|
||||
#include <osdep_service.h>
|
||||
#include <wlan_bssdef.h>
|
||||
|
||||
|
||||
enum _NIC_VERSION {
|
||||
RTL8711_NIC,
|
||||
RTL8712_NIC,
|
||||
RTL8713_NIC,
|
||||
RTL8716_NIC
|
||||
|
||||
};
|
||||
|
||||
|
||||
#include <rtw_ht.h>
|
||||
|
||||
#include <rtw_cmd.h>
|
||||
#include <rtw_xmit.h>
|
||||
#include <rtw_recv.h>
|
||||
#include <hal_intf.h>
|
||||
#include <hal_com.h>
|
||||
#include <rtw_security.h>
|
||||
#include <rtw_pwrctrl.h>
|
||||
#include <rtw_io.h>
|
||||
#include <rtw_eeprom.h>
|
||||
#include <sta_info.h>
|
||||
#include <rtw_mlme.h>
|
||||
#include <rtw_debug.h>
|
||||
#include <rtw_rf.h>
|
||||
#include <rtw_event.h>
|
||||
#include <rtw_mlme_ext.h>
|
||||
#include <rtw_ap.h>
|
||||
|
||||
#include "ioctl_cfg80211.h"
|
||||
|
||||
struct registry_priv {
|
||||
u8 chip_version;
|
||||
u8 rfintfs;
|
||||
struct cfg80211_ssid ssid;
|
||||
u8 channel;/* ad-hoc support requirement */
|
||||
u8 wireless_mode;/* A, B, G, auto */
|
||||
u8 scan_mode;/* active, passive */
|
||||
u8 preamble;/* long, short, auto */
|
||||
u8 vrtl_carrier_sense;/* Enable, Disable, Auto */
|
||||
u8 vcs_type;/* RTS/CTS, CTS-to-self */
|
||||
u16 rts_thresh;
|
||||
u16 frag_thresh;
|
||||
u8 adhoc_tx_pwr;
|
||||
u8 soft_ap;
|
||||
u8 power_mgnt;
|
||||
u8 ips_mode;
|
||||
u8 smart_ps;
|
||||
u8 long_retry_lmt;
|
||||
u8 short_retry_lmt;
|
||||
u16 busy_thresh;
|
||||
u8 ack_policy;
|
||||
u8 software_encrypt;
|
||||
u8 software_decrypt;
|
||||
u8 acm_method;
|
||||
/* UAPSD */
|
||||
u8 wmm_enable;
|
||||
u8 uapsd_enable;
|
||||
|
||||
struct wlan_bssid_ex dev_network;
|
||||
|
||||
u8 ht_enable;
|
||||
u8 cbw40_enable;
|
||||
u8 ampdu_enable;/* for tx */
|
||||
u8 rx_stbc;
|
||||
u8 ampdu_amsdu;/* A-MPDU Supports A-MSDU is permitted */
|
||||
u8 lowrate_two_xmit;
|
||||
|
||||
u8 rf_config;
|
||||
u8 low_power;
|
||||
|
||||
u8 wifi_spec;/* !turbo_mode */
|
||||
|
||||
u8 channel_plan;
|
||||
#ifdef CONFIG_8723AU_BT_COEXIST
|
||||
u8 btcoex;
|
||||
u8 bt_iso;
|
||||
u8 bt_sco;
|
||||
u8 bt_ampdu;
|
||||
#endif
|
||||
bool bAcceptAddbaReq;
|
||||
|
||||
u8 antdiv_cfg;
|
||||
u8 antdiv_type;
|
||||
|
||||
u8 hwpdn_mode;/* 0:disable,1:enable,2:decide by EFUSE config */
|
||||
u8 hwpwrp_detect;/* 0:disable,1:enable */
|
||||
|
||||
u8 hw_wps_pbc;/* 0:disable,1:enable */
|
||||
|
||||
u8 max_roaming_times; /* max number driver will try to roaming */
|
||||
|
||||
u8 enable80211d;
|
||||
|
||||
u8 ifname[16];
|
||||
u8 if2name[16];
|
||||
|
||||
u8 notch_filter;
|
||||
|
||||
u8 regulatory_tid;
|
||||
};
|
||||
|
||||
|
||||
#define MAX_CONTINUAL_URB_ERR 4
|
||||
|
||||
#define GET_PRIMARY_ADAPTER(padapter) \
|
||||
(((struct rtw_adapter *)padapter)->dvobj->if1)
|
||||
|
||||
enum _IFACE_ID {
|
||||
IFACE_ID0, /* maping to PRIMARY_ADAPTER */
|
||||
IFACE_ID1, /* maping to SECONDARY_ADAPTER */
|
||||
IFACE_ID2,
|
||||
IFACE_ID3,
|
||||
IFACE_ID_MAX,
|
||||
};
|
||||
|
||||
struct dvobj_priv {
|
||||
struct rtw_adapter *if1; /* PRIMARY_ADAPTER */
|
||||
struct rtw_adapter *if2; /* SECONDARY_ADAPTER */
|
||||
|
||||
/* for local/global synchronization */
|
||||
struct mutex hw_init_mutex;
|
||||
struct mutex h2c_fwcmd_mutex;
|
||||
struct mutex setch_mutex;
|
||||
struct mutex setbw_mutex;
|
||||
|
||||
unsigned char oper_channel; /* saved chan info when set chan bw */
|
||||
unsigned char oper_bwmode;
|
||||
unsigned char oper_ch_offset;/* PRIME_CHNL_OFFSET */
|
||||
|
||||
struct rtw_adapter *padapters[IFACE_ID_MAX];
|
||||
u8 iface_nums; /* total number of ifaces used runtime */
|
||||
|
||||
/* For 92D, DMDP have 2 interface. */
|
||||
u8 InterfaceNumber;
|
||||
u8 NumInterfaces;
|
||||
|
||||
/* In /Out Pipe information */
|
||||
int RtInPipe[2];
|
||||
int RtOutPipe[3];
|
||||
u8 Queue2Pipe[HW_QUEUE_ENTRY];/* for out pipe mapping */
|
||||
|
||||
/*-------- below is for USB INTERFACE --------*/
|
||||
|
||||
u8 nr_endpoint;
|
||||
u8 ishighspeed;
|
||||
u8 RtNumInPipes;
|
||||
u8 RtNumOutPipes;
|
||||
int ep_num[5]; /* endpoint number */
|
||||
|
||||
struct mutex usb_vendor_req_mutex;
|
||||
|
||||
union {
|
||||
__le32 val32;
|
||||
__le16 val16;
|
||||
u8 val8;
|
||||
} usb_buf;
|
||||
|
||||
struct usb_interface *pusbintf;
|
||||
struct usb_device *pusbdev;
|
||||
atomic_t continual_urb_error;
|
||||
|
||||
/*-------- below is for PCIE INTERFACE --------*/
|
||||
|
||||
};
|
||||
|
||||
static inline struct device *dvobj_to_dev(struct dvobj_priv *dvobj)
|
||||
{
|
||||
/* todo: get interface type from dvobj and the return the dev accordingly */
|
||||
return &dvobj->pusbintf->dev;
|
||||
}
|
||||
|
||||
enum _IFACE_TYPE {
|
||||
IFACE_PORT0, /* mapping to port0 for C/D series chips */
|
||||
IFACE_PORT1, /* mapping to port1 for C/D series chip */
|
||||
MAX_IFACE_PORT,
|
||||
};
|
||||
|
||||
enum _ADAPTER_TYPE {
|
||||
PRIMARY_ADAPTER,
|
||||
SECONDARY_ADAPTER,
|
||||
MAX_ADAPTER,
|
||||
};
|
||||
|
||||
struct rtw_adapter {
|
||||
int pid[3];/* process id from UI, 0:wps, 1:hostapd, 2:dhcpcd */
|
||||
int bDongle;/* build-in module or external dongle */
|
||||
u16 chip_type;
|
||||
u16 HardwareType;
|
||||
|
||||
struct dvobj_priv *dvobj;
|
||||
struct mlme_priv mlmepriv;
|
||||
struct mlme_ext_priv mlmeextpriv;
|
||||
struct cmd_priv cmdpriv;
|
||||
struct evt_priv evtpriv;
|
||||
struct xmit_priv xmitpriv;
|
||||
struct recv_priv recvpriv;
|
||||
struct sta_priv stapriv;
|
||||
struct security_priv securitypriv;
|
||||
struct registry_priv registrypriv;
|
||||
struct pwrctrl_priv pwrctrlpriv;
|
||||
struct eeprom_priv eeprompriv;
|
||||
|
||||
u32 setband;
|
||||
|
||||
void *HalData;
|
||||
|
||||
s32 bDriverStopped;
|
||||
s32 bSurpriseRemoved;
|
||||
s32 bCardDisableWOHSM;
|
||||
|
||||
u32 IsrContent;
|
||||
u32 ImrContent;
|
||||
|
||||
u8 EepromAddressSize;
|
||||
u8 hw_init_completed;
|
||||
u8 bDriverIsGoingToUnload;
|
||||
u8 init_adpt_in_progress;
|
||||
u8 bHaltInProgress;
|
||||
|
||||
struct net_device *pnetdev;
|
||||
|
||||
/* used by rtw_rereg_nd_name related function */
|
||||
int bup;
|
||||
struct net_device_stats stats;
|
||||
|
||||
struct wireless_dev *rtw_wdev;
|
||||
int net_closed;
|
||||
|
||||
u8 bFWReady;
|
||||
u8 bReadPortCancel;
|
||||
u8 bWritePortCancel;
|
||||
|
||||
/* extend to support multi interface */
|
||||
/* IFACE_ID0 is equals to PRIMARY_ADAPTER */
|
||||
/* IFACE_ID1 is equals to SECONDARY_ADAPTER */
|
||||
u8 iface_id;
|
||||
};
|
||||
|
||||
#define adapter_to_dvobj(adapter) (adapter->dvobj)
|
||||
|
||||
static inline u8 *myid(struct eeprom_priv *peepriv)
|
||||
{
|
||||
return peepriv->mac_addr;
|
||||
}
|
||||
|
||||
#endif /* __DRV_TYPES_H__ */
|
|
@ -1,182 +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.
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef __HAL_COMMON_H__
|
||||
#define __HAL_COMMON_H__
|
||||
|
||||
/* */
|
||||
/* Rate Definition */
|
||||
/* */
|
||||
/* CCK */
|
||||
#define RATR_1M 0x00000001
|
||||
#define RATR_2M 0x00000002
|
||||
#define RATR_55M 0x00000004
|
||||
#define RATR_11M 0x00000008
|
||||
/* OFDM */
|
||||
#define RATR_6M 0x00000010
|
||||
#define RATR_9M 0x00000020
|
||||
#define RATR_12M 0x00000040
|
||||
#define RATR_18M 0x00000080
|
||||
#define RATR_24M 0x00000100
|
||||
#define RATR_36M 0x00000200
|
||||
#define RATR_48M 0x00000400
|
||||
#define RATR_54M 0x00000800
|
||||
/* MCS 1 Spatial Stream */
|
||||
#define RATR_MCS0 0x00001000
|
||||
#define RATR_MCS1 0x00002000
|
||||
#define RATR_MCS2 0x00004000
|
||||
#define RATR_MCS3 0x00008000
|
||||
#define RATR_MCS4 0x00010000
|
||||
#define RATR_MCS5 0x00020000
|
||||
#define RATR_MCS6 0x00040000
|
||||
#define RATR_MCS7 0x00080000
|
||||
/* MCS 2 Spatial Stream */
|
||||
#define RATR_MCS8 0x00100000
|
||||
#define RATR_MCS9 0x00200000
|
||||
#define RATR_MCS10 0x00400000
|
||||
#define RATR_MCS11 0x00800000
|
||||
#define RATR_MCS12 0x01000000
|
||||
#define RATR_MCS13 0x02000000
|
||||
#define RATR_MCS14 0x04000000
|
||||
#define RATR_MCS15 0x08000000
|
||||
|
||||
/* CCK */
|
||||
#define RATE_1M BIT(0)
|
||||
#define RATE_2M BIT(1)
|
||||
#define RATE_5_5M BIT(2)
|
||||
#define RATE_11M BIT(3)
|
||||
/* OFDM */
|
||||
#define RATE_6M BIT(4)
|
||||
#define RATE_9M BIT(5)
|
||||
#define RATE_12M BIT(6)
|
||||
#define RATE_18M BIT(7)
|
||||
#define RATE_24M BIT(8)
|
||||
#define RATE_36M BIT(9)
|
||||
#define RATE_48M BIT(10)
|
||||
#define RATE_54M BIT(11)
|
||||
|
||||
/*------------------------------ Tx Desc definition Macro ------------------------*/
|
||||
/* pragma mark -- Tx Desc related definition. -- */
|
||||
/* */
|
||||
/* */
|
||||
/* Rate */
|
||||
/* */
|
||||
/* CCK Rates, TxHT = 0 */
|
||||
#define DESC_RATE1M 0x00
|
||||
#define DESC_RATE2M 0x01
|
||||
#define DESC_RATE5_5M 0x02
|
||||
#define DESC_RATE11M 0x03
|
||||
|
||||
/* OFDM Rates, TxHT = 0 */
|
||||
#define DESC_RATE6M 0x04
|
||||
#define DESC_RATE9M 0x05
|
||||
#define DESC_RATE12M 0x06
|
||||
#define DESC_RATE18M 0x07
|
||||
#define DESC_RATE24M 0x08
|
||||
#define DESC_RATE36M 0x09
|
||||
#define DESC_RATE48M 0x0a
|
||||
#define DESC_RATE54M 0x0b
|
||||
|
||||
/* MCS Rates, TxHT = 1 */
|
||||
#define DESC_RATEMCS0 0x0c
|
||||
#define DESC_RATEMCS1 0x0d
|
||||
#define DESC_RATEMCS2 0x0e
|
||||
#define DESC_RATEMCS3 0x0f
|
||||
#define DESC_RATEMCS4 0x10
|
||||
#define DESC_RATEMCS5 0x11
|
||||
#define DESC_RATEMCS6 0x12
|
||||
#define DESC_RATEMCS7 0x13
|
||||
#define DESC_RATEMCS8 0x14
|
||||
#define DESC_RATEMCS9 0x15
|
||||
#define DESC_RATEMCS10 0x16
|
||||
#define DESC_RATEMCS11 0x17
|
||||
#define DESC_RATEMCS12 0x18
|
||||
#define DESC_RATEMCS13 0x19
|
||||
#define DESC_RATEMCS14 0x1a
|
||||
#define DESC_RATEMCS15 0x1b
|
||||
#define DESC_RATEMCS15_SG 0x1c
|
||||
#define DESC_RATEMCS32 0x20
|
||||
|
||||
#define REG_P2P_CTWIN 0x0572 /* 1 Byte long (in unit of TU) */
|
||||
#define REG_NOA_DESC_SEL 0x05CF
|
||||
#define REG_NOA_DESC_DURATION 0x05E0
|
||||
#define REG_NOA_DESC_INTERVAL 0x05E4
|
||||
#define REG_NOA_DESC_START 0x05E8
|
||||
#define REG_NOA_DESC_COUNT 0x05EC
|
||||
|
||||
#include "HalVerDef.h"
|
||||
|
||||
|
||||
u8 /* return the final channel plan decision */
|
||||
hal_com_get_channel_plan23a(
|
||||
struct rtw_adapter *padapter,
|
||||
u8 hw_channel_plan, /* channel plan from HW (efuse/eeprom) */
|
||||
u8 sw_channel_plan, /* channel plan from SW (registry/module param) */
|
||||
u8 def_channel_plan, /* channel plan used when the former two is invalid */
|
||||
bool AutoLoadFail
|
||||
);
|
||||
|
||||
u8 MRateToHwRate23a(u8 rate);
|
||||
|
||||
void HalSetBrateCfg23a(struct rtw_adapter *padapter, u8 *mBratesOS);
|
||||
|
||||
bool
|
||||
Hal_MappingOutPipe23a(struct rtw_adapter *pAdapter, u8 NumOutPipe);
|
||||
|
||||
void c2h_evt_clear23a(struct rtw_adapter *adapter);
|
||||
s32 c2h_evt_read23a(struct rtw_adapter *adapter, u8 *buf);
|
||||
|
||||
void rtl8723a_set_ampdu_min_space(struct rtw_adapter *padapter, u8 MinSpacingToSet);
|
||||
void rtl8723a_set_ampdu_factor(struct rtw_adapter *padapter, u8 FactorToSet);
|
||||
void rtl8723a_set_acm_ctrl(struct rtw_adapter *padapter, u8 ctrl);
|
||||
void rtl8723a_set_media_status(struct rtw_adapter *padapter, u8 status);
|
||||
void rtl8723a_set_media_status1(struct rtw_adapter *padapter, u8 status);
|
||||
void rtl8723a_set_bcn_func(struct rtw_adapter *padapter, u8 val);
|
||||
void rtl8723a_check_bssid(struct rtw_adapter *padapter, u8 val);
|
||||
void rtl8723a_mlme_sitesurvey(struct rtw_adapter *padapter, u8 flag);
|
||||
void rtl8723a_on_rcr_am(struct rtw_adapter *padapter);
|
||||
void rtl8723a_off_rcr_am(struct rtw_adapter *padapter);
|
||||
void rtl8723a_set_slot_time(struct rtw_adapter *padapter, u8 slottime);
|
||||
void rtl8723a_ack_preamble(struct rtw_adapter *padapter, u8 bShortPreamble);
|
||||
void rtl8723a_set_sec_cfg(struct rtw_adapter *padapter, u8 sec);
|
||||
void rtl8723a_cam_empty_entry(struct rtw_adapter *padapter, u8 ucIndex);
|
||||
void rtl8723a_cam_invalidate_all(struct rtw_adapter *padapter);
|
||||
void rtl8723a_cam_write(struct rtw_adapter *padapter,
|
||||
u8 entry, u16 ctrl, const u8 *mac, const u8 *key);
|
||||
void rtl8723a_fifo_cleanup(struct rtw_adapter *padapter);
|
||||
void rtl8723a_set_apfm_on_mac(struct rtw_adapter *padapter, u8 val);
|
||||
void rtl8723a_bcn_valid(struct rtw_adapter *padapter);
|
||||
bool rtl8723a_get_bcn_valid(struct rtw_adapter *padapter);
|
||||
void rtl8723a_set_beacon_interval(struct rtw_adapter *padapter, u16 interval);
|
||||
void rtl8723a_set_resp_sifs(struct rtw_adapter *padapter,
|
||||
u8 r2t1, u8 r2t2, u8 t2t1, u8 t2t2);
|
||||
void rtl8723a_set_ac_param_vo(struct rtw_adapter *padapter, u32 vo);
|
||||
void rtl8723a_set_ac_param_vi(struct rtw_adapter *padapter, u32 vi);
|
||||
void rtl8723a_set_ac_param_be(struct rtw_adapter *padapter, u32 be);
|
||||
void rtl8723a_set_ac_param_bk(struct rtw_adapter *padapter, u32 bk);
|
||||
void rtl8723a_set_rxdma_agg_pg_th(struct rtw_adapter *padapter, u8 val);
|
||||
void rtl8723a_set_initial_gain(struct rtw_adapter *padapter, u32 rx_gain);
|
||||
|
||||
void rtl8723a_odm_support_ability_write(struct rtw_adapter *padapter, u32 val);
|
||||
void rtl8723a_odm_support_ability_backup(struct rtw_adapter *padapter);
|
||||
void rtl8723a_odm_support_ability_restore(struct rtw_adapter *padapter);
|
||||
void rtl8723a_odm_support_ability_set(struct rtw_adapter *padapter, u32 val);
|
||||
void rtl8723a_odm_support_ability_clr(struct rtw_adapter *padapter, u32 val);
|
||||
|
||||
void rtl8723a_set_rpwm(struct rtw_adapter *padapter, u8 val);
|
||||
u8 rtl8723a_get_rf_type(struct rtw_adapter *padapter);
|
||||
bool rtl8723a_get_fwlps_rf_on(struct rtw_adapter *padapter);
|
||||
bool rtl8723a_chk_hi_queue_empty(struct rtw_adapter *padapter);
|
||||
|
||||
#endif /* __HAL_COMMON_H__ */
|
|
@ -1,115 +0,0 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef __HAL_INTF_H__
|
||||
#define __HAL_INTF_H__
|
||||
|
||||
#include <osdep_service.h>
|
||||
#include <drv_types.h>
|
||||
|
||||
enum _CHIP_TYPE {
|
||||
NULL_CHIP_TYPE,
|
||||
RTL8712_8188S_8191S_8192S,
|
||||
RTL8188C_8192C,
|
||||
RTL8192D,
|
||||
RTL8723A,
|
||||
RTL8188E,
|
||||
MAX_CHIP_TYPE
|
||||
};
|
||||
|
||||
enum hal_def_variable {
|
||||
HAL_DEF_UNDERCORATEDSMOOTHEDPWDB,
|
||||
HAL_DEF_IS_SUPPORT_ANT_DIV,
|
||||
HAL_DEF_CURRENT_ANTENNA,
|
||||
HAL_DEF_DRVINFO_SZ,
|
||||
HAL_DEF_MAX_RECVBUF_SZ,
|
||||
HAL_DEF_RX_PACKET_OFFSET,
|
||||
HAL_DEF_DBG_DUMP_RXPKT,/* for dbg */
|
||||
HAL_DEF_DBG_DM_FUNC,/* for dbg */
|
||||
HAL_DEF_RA_DECISION_RATE,
|
||||
HAL_DEF_RA_SGI,
|
||||
HAL_DEF_PT_PWR_STATUS,
|
||||
HW_VAR_MAX_RX_AMPDU_FACTOR,
|
||||
HW_DEF_RA_INFO_DUMP,
|
||||
HAL_DEF_DBG_DUMP_TXPKT,
|
||||
HW_DEF_FA_CNT_DUMP,
|
||||
HW_DEF_ODM_DBG_FLAG,
|
||||
};
|
||||
|
||||
enum hal_odm_variable {
|
||||
HAL_ODM_STA_INFO,
|
||||
HAL_ODM_P2P_STATE,
|
||||
HAL_ODM_WIFI_DISPLAY_STATE,
|
||||
};
|
||||
|
||||
enum rt_eeprom_type {
|
||||
EEPROM_93C46,
|
||||
EEPROM_93C56,
|
||||
EEPROM_BOOT_EFUSE,
|
||||
};
|
||||
|
||||
|
||||
|
||||
#define RF_CHANGE_BY_INIT 0
|
||||
#define RF_CHANGE_BY_IPS BIT(28)
|
||||
#define RF_CHANGE_BY_PS BIT(29)
|
||||
#define RF_CHANGE_BY_HW BIT(30)
|
||||
#define RF_CHANGE_BY_SW BIT(31)
|
||||
|
||||
enum hardware_type {
|
||||
HARDWARE_TYPE_RTL8180,
|
||||
HARDWARE_TYPE_RTL8185,
|
||||
HARDWARE_TYPE_RTL8187,
|
||||
HARDWARE_TYPE_RTL8188,
|
||||
HARDWARE_TYPE_RTL8190P,
|
||||
HARDWARE_TYPE_RTL8192E,
|
||||
HARDWARE_TYPE_RTL819xU,
|
||||
HARDWARE_TYPE_RTL8192SE,
|
||||
HARDWARE_TYPE_RTL8192SU,
|
||||
HARDWARE_TYPE_RTL8192CE,
|
||||
HARDWARE_TYPE_RTL8192CU,
|
||||
HARDWARE_TYPE_RTL8192DE,
|
||||
HARDWARE_TYPE_RTL8192DU,
|
||||
HARDWARE_TYPE_RTL8723AE,
|
||||
HARDWARE_TYPE_RTL8723AU,
|
||||
HARDWARE_TYPE_RTL8723AS,
|
||||
HARDWARE_TYPE_RTL8188EE,
|
||||
HARDWARE_TYPE_RTL8188EU,
|
||||
HARDWARE_TYPE_RTL8188ES,
|
||||
HARDWARE_TYPE_MAX,
|
||||
};
|
||||
|
||||
#define GET_EEPROM_EFUSE_PRIV(adapter) (&adapter->eeprompriv)
|
||||
|
||||
void rtw_hal_def_value_init23a(struct rtw_adapter *padapter);
|
||||
int pm_netdev_open23a(struct net_device *pnetdev, u8 bnormal);
|
||||
|
||||
int rtl8723au_hal_init(struct rtw_adapter *padapter);
|
||||
int rtl8723au_hal_deinit(struct rtw_adapter *padapter);
|
||||
void rtw_hal_stop(struct rtw_adapter *padapter);
|
||||
|
||||
void rtw_hal_update_ra_mask23a(struct sta_info *psta, u8 rssi_level);
|
||||
void rtw_hal_clone_data(struct rtw_adapter *dst_padapter, struct rtw_adapter *src_padapter);
|
||||
|
||||
void hw_var_set_correct_tsf(struct rtw_adapter *padapter);
|
||||
void hw_var_set_mlme_disconnect(struct rtw_adapter *padapter);
|
||||
void hw_var_set_opmode(struct rtw_adapter *padapter, u8 mode);
|
||||
void hw_var_set_macaddr(struct rtw_adapter *padapter, u8 *val);
|
||||
void hw_var_set_bssid(struct rtw_adapter *padapter, u8 *val);
|
||||
void hw_var_set_mlme_join(struct rtw_adapter *padapter, u8 type);
|
||||
|
||||
int GetHalDefVar8192CUsb(struct rtw_adapter *Adapter,
|
||||
enum hal_def_variable eVariable, void *pValue);
|
||||
|
||||
#endif /* __HAL_INTF_H__ */
|
|
@ -1,341 +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.
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef __IEEE80211_H
|
||||
#define __IEEE80211_H
|
||||
|
||||
#include <osdep_service.h>
|
||||
#include <drv_types.h>
|
||||
#include "linux/ieee80211.h"
|
||||
#include "wifi.h"
|
||||
|
||||
#include <linux/wireless.h>
|
||||
|
||||
#if (WIRELESS_EXT < 22)
|
||||
#error "Obsolete pre 2007 wireless extensions are not supported"
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef CONFIG_8723AU_AP_MODE
|
||||
|
||||
/* STA flags */
|
||||
#define WLAN_STA_AUTH BIT(0)
|
||||
#define WLAN_STA_ASSOC BIT(1)
|
||||
#define WLAN_STA_PS BIT(2)
|
||||
#define WLAN_STA_TIM BIT(3)
|
||||
#define WLAN_STA_PERM BIT(4)
|
||||
#define WLAN_STA_AUTHORIZED BIT(5)
|
||||
#define WLAN_STA_PENDING_POLL BIT(6) /* pending activity poll not ACKed */
|
||||
#define WLAN_STA_SHORT_PREAMBLE BIT(7)
|
||||
#define WLAN_STA_PREAUTH BIT(8)
|
||||
#define WLAN_STA_WME BIT(9)
|
||||
#define WLAN_STA_MFP BIT(10)
|
||||
#define WLAN_STA_HT BIT(11)
|
||||
#define WLAN_STA_WPS BIT(12)
|
||||
#define WLAN_STA_MAYBE_WPS BIT(13)
|
||||
#define WLAN_STA_NONERP BIT(31)
|
||||
|
||||
#endif
|
||||
|
||||
#define WPA_CIPHER_NONE BIT(0)
|
||||
#define WPA_CIPHER_WEP40 BIT(1)
|
||||
#define WPA_CIPHER_WEP104 BIT(2)
|
||||
#define WPA_CIPHER_TKIP BIT(3)
|
||||
#define WPA_CIPHER_CCMP BIT(4)
|
||||
|
||||
|
||||
|
||||
#define WPA_SELECTOR_LEN 4
|
||||
extern u8 RTW_WPA_OUI23A_TYPE[] ;
|
||||
extern u16 RTW_WPA_VERSION23A ;
|
||||
extern u8 WPA_AUTH_KEY_MGMT_NONE23A[];
|
||||
extern u8 WPA_AUTH_KEY_MGMT_UNSPEC_802_1X23A[];
|
||||
extern u8 WPA_AUTH_KEY_MGMT_PSK_OVER_802_1X23A[];
|
||||
extern u8 WPA_CIPHER_SUITE_NONE23A[];
|
||||
extern u8 WPA_CIPHER_SUITE_WEP4023A[];
|
||||
extern u8 WPA_CIPHER_SUITE_TKIP23A[];
|
||||
extern u8 WPA_CIPHER_SUITE_WRAP23A[];
|
||||
extern u8 WPA_CIPHER_SUITE_CCMP23A[];
|
||||
extern u8 WPA_CIPHER_SUITE_WEP10423A[];
|
||||
|
||||
|
||||
#define RSN_HEADER_LEN 4
|
||||
#define RSN_SELECTOR_LEN 4
|
||||
|
||||
extern u8 RSN_AUTH_KEY_MGMT_UNSPEC_802_1X23A[];
|
||||
extern u8 RSN_AUTH_KEY_MGMT_PSK_OVER_802_1X23A[];
|
||||
extern u8 RSN_CIPHER_SUITE_NONE23A[];
|
||||
extern u8 RSN_CIPHER_SUITE_WEP4023A[];
|
||||
extern u8 RSN_CIPHER_SUITE_TKIP23A[];
|
||||
extern u8 RSN_CIPHER_SUITE_WRAP23A[];
|
||||
extern u8 RSN_CIPHER_SUITE_CCMP23A[];
|
||||
extern u8 RSN_CIPHER_SUITE_WEP10423A[];
|
||||
|
||||
enum ratr_table_mode {
|
||||
RATR_INX_WIRELESS_NGB = 0, /* BGN 40 Mhz 2SS 1SS */
|
||||
RATR_INX_WIRELESS_NG = 1, /* GN or N */
|
||||
RATR_INX_WIRELESS_NB = 2, /* BGN 20 Mhz 2SS 1SS or BN */
|
||||
RATR_INX_WIRELESS_N = 3,
|
||||
RATR_INX_WIRELESS_GB = 4,
|
||||
RATR_INX_WIRELESS_G = 5,
|
||||
RATR_INX_WIRELESS_B = 6,
|
||||
RATR_INX_WIRELESS_MC = 7,
|
||||
RATR_INX_WIRELESS_AC_N = 8,
|
||||
};
|
||||
|
||||
enum NETWORK_TYPE
|
||||
{
|
||||
WIRELESS_INVALID = 0,
|
||||
/* Sub-Element */
|
||||
/* tx: cck only , rx: cck only, hw: cck */
|
||||
WIRELESS_11B = BIT(0),
|
||||
/* tx: ofdm only, rx: ofdm & cck, hw: cck & ofdm */
|
||||
WIRELESS_11G = BIT(1),
|
||||
/* tx: ofdm only, rx: ofdm only, hw: ofdm only */
|
||||
WIRELESS_11A = BIT(2),
|
||||
/* tx: MCS only, rx: MCS & cck, hw: MCS & cck */
|
||||
WIRELESS_11_24N = BIT(3),
|
||||
/* tx: MCS only, rx: MCS & ofdm, hw: ofdm only */
|
||||
WIRELESS_11_5N = BIT(4),
|
||||
/* WIRELESS_AUTO = BIT(5), */
|
||||
WIRELESS_AC = BIT(6),
|
||||
|
||||
/* Combination */
|
||||
/* tx: cck & ofdm, rx: cck & ofdm & MCS, hw: cck & ofdm */
|
||||
WIRELESS_11BG = WIRELESS_11B|WIRELESS_11G,
|
||||
/* tx: ofdm & MCS, rx: ofdm & cck & MCS, hw: cck & ofdm */
|
||||
WIRELESS_11G_24N = WIRELESS_11G | WIRELESS_11_24N,
|
||||
/* tx: ofdm & MCS, rx: ofdm & MCS, hw: ofdm only */
|
||||
WIRELESS_11A_5N = WIRELESS_11A | WIRELESS_11_5N,
|
||||
/* tx: ofdm & cck & MCS, rx: ofdm & cck & MCS, hw: ofdm & cck */
|
||||
WIRELESS_11BG_24N = WIRELESS_11B | WIRELESS_11G | WIRELESS_11_24N,
|
||||
/* tx: ofdm & MCS, rx: ofdm & MCS, hw: ofdm only */
|
||||
WIRELESS_11AGN = WIRELESS_11A | WIRELESS_11G | WIRELESS_11_24N |
|
||||
WIRELESS_11_5N,
|
||||
WIRELESS_11ABGN = WIRELESS_11A | WIRELESS_11B | WIRELESS_11G |
|
||||
WIRELESS_11_24N | WIRELESS_11_5N,
|
||||
};
|
||||
|
||||
#define SUPPORTED_24G_NETTYPE_MSK (WIRELESS_11B | WIRELESS_11G | WIRELESS_11_24N)
|
||||
#define SUPPORTED_5G_NETTYPE_MSK (WIRELESS_11A | WIRELESS_11_5N)
|
||||
|
||||
#define IsSupported24G(NetType) (NetType & SUPPORTED_24G_NETTYPE_MSK ? true : false)
|
||||
#define IsSupported5G(NetType) (NetType & SUPPORTED_5G_NETTYPE_MSK ? true : false)
|
||||
|
||||
#define IsEnableHWCCK(NetType) IsSupported24G(NetType)
|
||||
#define IsEnableHWOFDM(NetType) (NetType & (WIRELESS_11G|WIRELESS_11_24N|SUPPORTED_5G_NETTYPE_MSK) ? true : false)
|
||||
|
||||
#define IsSupportedRxCCK(NetType) IsEnableHWCCK(NetType)
|
||||
#define IsSupportedRxOFDM(NetType) IsEnableHWOFDM(NetType)
|
||||
#define IsSupportedRxMCS(NetType) IsEnableHWOFDM(NetType)
|
||||
|
||||
#define IsSupportedTxCCK(NetType) (NetType & (WIRELESS_11B) ? true : false)
|
||||
#define IsSupportedTxOFDM(NetType) (NetType & (WIRELESS_11G|WIRELESS_11A) ? true : false)
|
||||
#define IsSupportedTxMCS(NetType) (NetType & (WIRELESS_11_24N|WIRELESS_11_5N) ? true : false)
|
||||
|
||||
|
||||
#define MIN_FRAG_THRESHOLD 256U
|
||||
#define MAX_FRAG_THRESHOLD 2346U
|
||||
|
||||
/* QoS,QOS */
|
||||
#define NORMAL_ACK 0
|
||||
#define NO_ACK 1
|
||||
#define NON_EXPLICIT_ACK 2
|
||||
#define BLOCK_ACK 3
|
||||
|
||||
/* IEEE 802.11 defines */
|
||||
|
||||
#define P80211_OUI_LEN 3
|
||||
|
||||
struct ieee80211_snap_hdr {
|
||||
u8 dsap; /* always 0xAA */
|
||||
u8 ssap; /* always 0xAA */
|
||||
u8 ctrl; /* always 0x03 */
|
||||
u8 oui[P80211_OUI_LEN]; /* organizational universal id */
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
||||
#define SNAP_SIZE sizeof(struct ieee80211_snap_hdr)
|
||||
|
||||
#define WLAN_REASON_JOIN_WRONG_CHANNEL 65534
|
||||
#define WLAN_REASON_EXPIRATION_CHK 65535
|
||||
|
||||
#define IEEE80211_CCK_RATE_LEN 4
|
||||
#define IEEE80211_NUM_OFDM_RATESLEN 8
|
||||
|
||||
|
||||
#define IEEE80211_CCK_RATE_1MB 0x02
|
||||
#define IEEE80211_CCK_RATE_2MB 0x04
|
||||
#define IEEE80211_CCK_RATE_5MB 0x0B
|
||||
#define IEEE80211_CCK_RATE_11MB 0x16
|
||||
#define IEEE80211_OFDM_RATE_LEN 8
|
||||
#define IEEE80211_OFDM_RATE_6MB 0x0C
|
||||
#define IEEE80211_OFDM_RATE_9MB 0x12
|
||||
#define IEEE80211_OFDM_RATE_12MB 0x18
|
||||
#define IEEE80211_OFDM_RATE_18MB 0x24
|
||||
#define IEEE80211_OFDM_RATE_24MB 0x30
|
||||
#define IEEE80211_OFDM_RATE_36MB 0x48
|
||||
#define IEEE80211_OFDM_RATE_48MB 0x60
|
||||
#define IEEE80211_OFDM_RATE_54MB 0x6C
|
||||
#define IEEE80211_BASIC_RATE_MASK 0x80
|
||||
|
||||
#define IEEE80211_CCK_RATE_1MB_MASK (1<<0)
|
||||
#define IEEE80211_CCK_RATE_2MB_MASK (1<<1)
|
||||
#define IEEE80211_CCK_RATE_5MB_MASK (1<<2)
|
||||
#define IEEE80211_CCK_RATE_11MB_MASK (1<<3)
|
||||
#define IEEE80211_OFDM_RATE_6MB_MASK (1<<4)
|
||||
#define IEEE80211_OFDM_RATE_9MB_MASK (1<<5)
|
||||
#define IEEE80211_OFDM_RATE_12MB_MASK (1<<6)
|
||||
#define IEEE80211_OFDM_RATE_18MB_MASK (1<<7)
|
||||
#define IEEE80211_OFDM_RATE_24MB_MASK (1<<8)
|
||||
#define IEEE80211_OFDM_RATE_36MB_MASK (1<<9)
|
||||
#define IEEE80211_OFDM_RATE_48MB_MASK (1<<10)
|
||||
#define IEEE80211_OFDM_RATE_54MB_MASK (1<<11)
|
||||
|
||||
#define IEEE80211_CCK_RATES_MASK 0x0000000F
|
||||
#define IEEE80211_CCK_BASIC_RATES_MASK (IEEE80211_CCK_RATE_1MB_MASK | \
|
||||
IEEE80211_CCK_RATE_2MB_MASK)
|
||||
#define IEEE80211_CCK_DEFAULT_RATES_MASK (IEEE80211_CCK_BASIC_RATES_MASK | \
|
||||
IEEE80211_CCK_RATE_5MB_MASK | \
|
||||
IEEE80211_CCK_RATE_11MB_MASK)
|
||||
|
||||
#define IEEE80211_OFDM_RATES_MASK 0x00000FF0
|
||||
#define IEEE80211_OFDM_BASIC_RATES_MASK (IEEE80211_OFDM_RATE_6MB_MASK | \
|
||||
IEEE80211_OFDM_RATE_12MB_MASK | \
|
||||
IEEE80211_OFDM_RATE_24MB_MASK)
|
||||
#define IEEE80211_OFDM_DEFAULT_RATES_MASK (IEEE80211_OFDM_BASIC_RATES_MASK | \
|
||||
IEEE80211_OFDM_RATE_9MB_MASK | \
|
||||
IEEE80211_OFDM_RATE_18MB_MASK | \
|
||||
IEEE80211_OFDM_RATE_36MB_MASK | \
|
||||
IEEE80211_OFDM_RATE_48MB_MASK | \
|
||||
IEEE80211_OFDM_RATE_54MB_MASK)
|
||||
#define IEEE80211_DEFAULT_RATES_MASK (IEEE80211_OFDM_DEFAULT_RATES_MASK | \
|
||||
IEEE80211_CCK_DEFAULT_RATES_MASK)
|
||||
|
||||
#define IEEE80211_NUM_OFDM_RATES 8
|
||||
#define IEEE80211_NUM_CCK_RATES 4
|
||||
#define IEEE80211_OFDM_SHIFT_MASK_A 4
|
||||
|
||||
#define WEP_KEYS 4
|
||||
|
||||
|
||||
/* MAX_RATES_LENGTH needs to be 12. The spec says 8, and many APs
|
||||
* only use 8, and then use extended rates for the remaining supported
|
||||
* rates. Other APs, however, stick all of their supported rates on the
|
||||
* main rates information element... */
|
||||
#define MAX_RATES_LENGTH 12
|
||||
#define MAX_RATES_EX_LENGTH 16
|
||||
#define MAX_CHANNEL_NUMBER 161
|
||||
#define RTW_CH_MAX_2G_CHANNEL 14 /* Max channel in 2G band */
|
||||
|
||||
#define MAX_WPA_IE_LEN 256
|
||||
#define MAX_WPS_IE_LEN 256
|
||||
#define MAX_P2P_IE_LEN 256
|
||||
#define MAX_WFD_IE_LEN 128
|
||||
|
||||
/*
|
||||
join_res:
|
||||
-1: authentication fail
|
||||
-2: association fail
|
||||
> 0: TID
|
||||
*/
|
||||
|
||||
#define MAXTID 16
|
||||
|
||||
#define WME_OUI_TYPE 2
|
||||
#define WME_OUI_SUBTYPE_INFORMATION_ELEMENT 0
|
||||
#define WME_OUI_SUBTYPE_PARAMETER_ELEMENT 1
|
||||
#define WME_OUI_SUBTYPE_TSPEC_ELEMENT 2
|
||||
#define WME_VERSION 1
|
||||
|
||||
|
||||
#define OUI_BROADCOM 0x00904c /* Broadcom (Epigram) */
|
||||
|
||||
#define VENDOR_HT_CAPAB_OUI_TYPE 0x33 /* 00-90-4c:0x33 */
|
||||
|
||||
/* Represent channel details, subset of ieee80211_channel */
|
||||
struct rtw_ieee80211_channel {
|
||||
/* enum nl80211_band band; */
|
||||
/* u16 center_freq; */
|
||||
u16 hw_value;
|
||||
u32 flags;
|
||||
/* int max_antenna_gain; */
|
||||
/* int max_power; */
|
||||
/* int max_reg_power; */
|
||||
/* bool beacon_found; */
|
||||
/* u32 orig_flags; */
|
||||
/* int orig_mag; */
|
||||
/* int orig_mpwr; */
|
||||
};
|
||||
|
||||
#define CHAN_FMT \
|
||||
/*"band:%d, "*/ \
|
||||
/*"center_freq:%u, "*/ \
|
||||
"hw_value:%u, " \
|
||||
"flags:0x%08x" \
|
||||
/*"max_antenna_gain:%d\n"*/ \
|
||||
/*"max_power:%d\n"*/ \
|
||||
/*"max_reg_power:%d\n"*/ \
|
||||
/*"beacon_found:%u\n"*/ \
|
||||
/*"orig_flags:0x%08x\n"*/ \
|
||||
/*"orig_mag:%d\n"*/ \
|
||||
/*"orig_mpwr:%d\n"*/
|
||||
|
||||
#define CHAN_ARG(channel) \
|
||||
/*(channel)->band*/ \
|
||||
/*, (channel)->center_freq*/ \
|
||||
(channel)->hw_value \
|
||||
, (channel)->flags \
|
||||
/*, (channel)->max_antenna_gain*/ \
|
||||
/*, (channel)->max_power*/ \
|
||||
/*, (channel)->max_reg_power*/ \
|
||||
/*, (channel)->beacon_found*/ \
|
||||
/*, (channel)->orig_flags*/ \
|
||||
/*, (channel)->orig_mag*/ \
|
||||
/*, (channel)->orig_mpwr*/ \
|
||||
|
||||
u8 *rtw_set_ie23a(u8 *pbuf, int index, uint len, const u8 *source, uint *frlen);
|
||||
|
||||
u8 hal_ch_offset_to_secondary_ch_offset23a(u8 ch_offset);
|
||||
u8 *rtw_set_ie23a_ch_switch(u8 *buf, u32 *buf_len, u8 ch_switch_mode, u8 new_ch, u8 ch_switch_cnt);
|
||||
u8 *rtw_set_ie23a_secondary_ch_offset(u8 *buf, u32 *buf_len, u8 secondary_ch_offset);
|
||||
|
||||
u8 *rtw_get_ie23a(u8*pbuf, int index, int *len, int limit);
|
||||
u8 *rtw_get_ie23a_ex(u8 *in_ie, uint in_len, u8 eid, u8 *oui, u8 oui_len, u8 *ie, uint *ielen);
|
||||
int rtw_ies_remove_ie23a(u8 *ies, uint *ies_len, uint offset, u8 eid, u8 *oui, u8 oui_len);
|
||||
|
||||
void rtw_set_supported_rate23a(u8 *SupportedRates, uint mode);
|
||||
|
||||
int rtw_parse_wpa_ie23a(const u8* wpa_ie, int wpa_ie_len, int *group_cipher, int *pairwise_cipher, int *is_8021x);
|
||||
int rtw_parse_wpa2_ie23a(const u8* wpa_ie, int wpa_ie_len, int *group_cipher, int *pairwise_cipher, int *is_8021x);
|
||||
|
||||
const u8 *rtw_get_wps_attr23a(const u8 *wps_ie, uint wps_ielen, u16 target_attr_id ,u8 *buf_attr, u32 *len_attr);
|
||||
const u8 *rtw_get_wps_attr_content23a(const u8 *wps_ie, uint wps_ielen, u16 target_attr_id ,u8 *buf_content);
|
||||
|
||||
uint rtw_get_rateset_len23a(u8 *rateset);
|
||||
|
||||
struct registry_priv;
|
||||
int rtw_generate_ie23a(struct registry_priv *pregistrypriv);
|
||||
|
||||
|
||||
int rtw_get_bit_value_from_ieee_value23a(u8 val);
|
||||
|
||||
int rtw_check_network_type23a(unsigned char *rate, int ratelen, int channel);
|
||||
|
||||
void rtw_get_bcn_info23a(struct wlan_network *pnetwork);
|
||||
|
||||
u16 rtw_mcs_rate23a(u8 rf_type, u8 bw_40MHz, u8 short_GI_20, u8 short_GI_40,
|
||||
struct ieee80211_mcs_info *mcs);
|
||||
|
||||
#endif /* IEEE80211_H */
|
|
@ -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.
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef __IOCTL_CFG80211_H__
|
||||
#define __IOCTL_CFG80211_H__
|
||||
|
||||
struct rtw_wdev_priv {
|
||||
struct wireless_dev *rtw_wdev;
|
||||
|
||||
struct rtw_adapter *padapter;
|
||||
|
||||
struct cfg80211_scan_request *scan_request;
|
||||
spinlock_t scan_req_lock;
|
||||
|
||||
struct net_device *pmon_ndev;/* for monitor interface */
|
||||
char ifname_mon[IFNAMSIZ + 1]; /* name for monitor interface */
|
||||
|
||||
u8 p2p_enabled;
|
||||
|
||||
bool power_mgmt;
|
||||
};
|
||||
|
||||
#define wdev_to_priv(w) ((struct rtw_wdev_priv *)(wdev_priv(w)))
|
||||
|
||||
#define wiphy_to_adapter(x) \
|
||||
(struct rtw_adapter *)(((struct rtw_wdev_priv *) \
|
||||
wiphy_priv(x))->padapter)
|
||||
|
||||
#define wiphy_to_wdev(x) \
|
||||
(struct wireless_dev *)(((struct rtw_wdev_priv *) \
|
||||
wiphy_priv(x))->rtw_wdev)
|
||||
|
||||
int rtw_wdev_alloc(struct rtw_adapter *padapter, struct device *dev);
|
||||
void rtw_wdev_free(struct wireless_dev *wdev);
|
||||
void rtw_wdev_unregister(struct wireless_dev *wdev);
|
||||
|
||||
void rtw_cfg80211_init_wiphy(struct rtw_adapter *padapter);
|
||||
|
||||
void rtw_cfg80211_surveydone_event_callback(struct rtw_adapter *padapter);
|
||||
|
||||
void rtw_cfg80211_indicate_connect(struct rtw_adapter *padapter);
|
||||
void rtw_cfg80211_indicate_disconnect(struct rtw_adapter *padapter);
|
||||
void rtw_cfg80211_indicate_scan_done(struct rtw_wdev_priv *pwdev_priv,
|
||||
bool aborted);
|
||||
|
||||
#ifdef CONFIG_8723AU_AP_MODE
|
||||
void rtw_cfg80211_indicate_sta_assoc(struct rtw_adapter *padapter,
|
||||
u8 *pmgmt_frame, uint frame_len);
|
||||
void rtw_cfg80211_indicate_sta_disassoc(struct rtw_adapter *padapter,
|
||||
unsigned char *da, unsigned short reason);
|
||||
#endif /* CONFIG_8723AU_AP_MODE */
|
||||
|
||||
bool rtw_cfg80211_pwr_mgmt(struct rtw_adapter *adapter);
|
||||
|
||||
#endif /* __IOCTL_CFG80211_H__ */
|
|
@ -1,24 +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.
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef __MLME_OSDEP_H_
|
||||
#define __MLME_OSDEP_H_
|
||||
|
||||
#include <osdep_service.h>
|
||||
#include <drv_types.h>
|
||||
|
||||
void rtw_os_indicate_disconnect23a(struct rtw_adapter *adapter);
|
||||
void rtw_reset_securitypriv23a(struct rtw_adapter *adapter);
|
||||
|
||||
#endif /* _MLME_OSDEP_H_ */
|
|
@ -1,860 +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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
#ifndef __HALDMOUTSRC_H__
|
||||
#define __HALDMOUTSRC_H__
|
||||
|
||||
/* */
|
||||
/* Definition */
|
||||
/* */
|
||||
/* */
|
||||
/* 2011/09/22 MH Define all team supprt ability. */
|
||||
/* */
|
||||
|
||||
/* */
|
||||
/* 2011/09/22 MH Define for all teams. Please Define the constan in your precomp header. */
|
||||
/* */
|
||||
/* define DM_ODM_SUPPORT_AP 0 */
|
||||
/* define DM_ODM_SUPPORT_ADSL 0 */
|
||||
/* define DM_ODM_SUPPORT_CE 0 */
|
||||
/* define DM_ODM_SUPPORT_MP 1 */
|
||||
|
||||
#define TP_MODE 0
|
||||
#define RSSI_MODE 1
|
||||
#define TRAFFIC_LOW 0
|
||||
#define TRAFFIC_HIGH 1
|
||||
|
||||
|
||||
/* */
|
||||
/* 3 Tx Power Tracking */
|
||||
/* 3============================================================ */
|
||||
#define DPK_DELTA_MAPPING_NUM 13
|
||||
#define index_mapping_HP_NUM 15
|
||||
|
||||
|
||||
/* */
|
||||
/* 3 PSD Handler */
|
||||
/* 3============================================================ */
|
||||
|
||||
#define AFH_PSD 1 /* 0:normal PSD scan, 1: only do 20 pts PSD */
|
||||
#define MODE_40M 0 /* 0:20M, 1:40M */
|
||||
#define PSD_TH2 3
|
||||
#define PSD_CHMIN 20 /* Minimum channel number for BT AFH */
|
||||
#define SIR_STEP_SIZE 3
|
||||
#define Smooth_Size_1 5
|
||||
#define Smooth_TH_1 3
|
||||
#define Smooth_Size_2 10
|
||||
#define Smooth_TH_2 4
|
||||
#define Smooth_Size_3 20
|
||||
#define Smooth_TH_3 4
|
||||
#define Smooth_Step_Size 5
|
||||
#define Adaptive_SIR 1
|
||||
#define PSD_RESCAN 4
|
||||
#define PSD_SCAN_INTERVAL 700 /* ms */
|
||||
|
||||
/* 8723A High Power IGI Setting */
|
||||
#define DM_DIG_HIGH_PWR_IGI_LOWER_BOUND 0x22
|
||||
#define DM_DIG_Gmode_HIGH_PWR_IGI_LOWER_BOUND 0x28
|
||||
#define DM_DIG_HIGH_PWR_THRESHOLD 0x3a
|
||||
|
||||
/* LPS define */
|
||||
#define DM_DIG_FA_TH0_LPS 4 /* 4 in lps */
|
||||
#define DM_DIG_FA_TH1_LPS 15 /* 15 lps */
|
||||
#define DM_DIG_FA_TH2_LPS 30 /* 30 lps */
|
||||
#define RSSI_OFFSET_DIG 0x05;
|
||||
|
||||
/* 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 */
|
||||
|
||||
|
||||
/* */
|
||||
/* structure and define */
|
||||
/* */
|
||||
|
||||
struct dig_t {
|
||||
u8 Dig_Enable_Flag;
|
||||
u8 Dig_Ext_Port_Stage;
|
||||
|
||||
int RssiLowThresh;
|
||||
int RssiHighThresh;
|
||||
|
||||
u32 FALowThresh;
|
||||
u32 FAHighThresh;
|
||||
|
||||
u8 CurSTAConnectState;
|
||||
u8 PreSTAConnectState;
|
||||
u8 CurMultiSTAConnectState;
|
||||
|
||||
u8 PreIGValue;
|
||||
u8 CurIGValue;
|
||||
u8 BackupIGValue;
|
||||
|
||||
s8 BackoffVal;
|
||||
s8 BackoffVal_range_max;
|
||||
s8 BackoffVal_range_min;
|
||||
u8 rx_gain_range_max;
|
||||
u8 rx_gain_range_min;
|
||||
u8 Rssi_val_min;
|
||||
|
||||
u8 PreCCK_CCAThres;
|
||||
u8 CurCCK_CCAThres;
|
||||
u8 PreCCKPDState;
|
||||
u8 CurCCKPDState;
|
||||
|
||||
u8 LargeFAHit;
|
||||
u8 ForbiddenIGI;
|
||||
u32 Recover_cnt;
|
||||
|
||||
u8 DIG_Dynamic_MIN_0;
|
||||
u8 DIG_Dynamic_MIN_1;
|
||||
bool bMediaConnect_0;
|
||||
bool bMediaConnect_1;
|
||||
|
||||
u32 RSSI_max;
|
||||
};
|
||||
|
||||
struct dynamic_pwr_sav {
|
||||
u8 PreCCAState;
|
||||
u8 CurCCAState;
|
||||
|
||||
u8 PreRFState;
|
||||
u8 CurRFState;
|
||||
|
||||
int Rssi_val_min;
|
||||
|
||||
u8 initialize;
|
||||
u32 Reg874, RegC70, Reg85C, RegA74;
|
||||
};
|
||||
|
||||
struct false_alarm_stats {
|
||||
u32 Cnt_Parity_Fail;
|
||||
u32 Cnt_Rate_Illegal;
|
||||
u32 Cnt_Crc8_fail;
|
||||
u32 Cnt_Mcs_fail;
|
||||
u32 Cnt_Ofdm_fail;
|
||||
u32 Cnt_Cck_fail;
|
||||
u32 Cnt_all;
|
||||
u32 Cnt_Fast_Fsync;
|
||||
u32 Cnt_SB_Search_fail;
|
||||
u32 Cnt_OFDM_CCA;
|
||||
u32 Cnt_CCK_CCA;
|
||||
u32 Cnt_CCA_all;
|
||||
u32 Cnt_BW_USC; /* Gary */
|
||||
u32 Cnt_BW_LSC; /* Gary */
|
||||
};
|
||||
|
||||
#define ASSOCIATE_ENTRY_NUM 32 /* Max size of AsocEntry[]. */
|
||||
#define ODM_ASSOCIATE_ENTRY_NUM ASSOCIATE_ENTRY_NUM
|
||||
|
||||
/* This indicates two different the steps. */
|
||||
/* In SWAW_STEP_PEAK, driver needs to switch antenna and listen to the signal on the air. */
|
||||
/* In SWAW_STEP_DETERMINE, driver just compares the signal captured in SWAW_STEP_PEAK */
|
||||
/* with original RSSI to determine if it is necessary to switch antenna. */
|
||||
#define SWAW_STEP_PEAK 0
|
||||
#define SWAW_STEP_DETERMINE 1
|
||||
|
||||
#define TP_MODE 0
|
||||
#define RSSI_MODE 1
|
||||
#define TRAFFIC_LOW 0
|
||||
#define TRAFFIC_HIGH 1
|
||||
|
||||
struct sw_ant_sw {
|
||||
u8 try_flag;
|
||||
s32 PreRSSI;
|
||||
u8 CurAntenna;
|
||||
u8 PreAntenna;
|
||||
u8 RSSI_Trying;
|
||||
u8 TestMode;
|
||||
u8 bTriggerAntennaSwitch;
|
||||
u8 SelectAntennaMap;
|
||||
u8 RSSI_target;
|
||||
|
||||
/* Before link Antenna Switch check */
|
||||
u8 SWAS_NoLink_State;
|
||||
u32 SWAS_NoLink_BK_Reg860;
|
||||
bool ANTA_ON; /* To indicate Ant A is or not */
|
||||
bool ANTB_ON; /* To indicate Ant B is on or not */
|
||||
|
||||
s32 RSSI_sum_A;
|
||||
s32 RSSI_sum_B;
|
||||
s32 RSSI_cnt_A;
|
||||
s32 RSSI_cnt_B;
|
||||
|
||||
u64 lastTxOkCnt;
|
||||
u64 lastRxOkCnt;
|
||||
u64 TXByteCnt_A;
|
||||
u64 TXByteCnt_B;
|
||||
u64 RXByteCnt_A;
|
||||
u64 RXByteCnt_B;
|
||||
u8 TrafficLoad;
|
||||
};
|
||||
|
||||
struct edca_turbo {
|
||||
bool bCurrentTurboEDCA;
|
||||
u32 prv_traffic_idx; /* edca turbo */
|
||||
};
|
||||
|
||||
struct odm_rate_adapt {
|
||||
u8 Type; /* DM_Type_ByFW/DM_Type_ByDriver */
|
||||
u8 HighRSSIThresh; /* if RSSI > HighRSSIThresh => RATRState is DM_RATR_STA_HIGH */
|
||||
u8 LowRSSIThresh; /* if RSSI <= LowRSSIThresh => RATRState is DM_RATR_STA_LOW */
|
||||
u8 RATRState; /* Current RSSI level, DM_RATR_STA_HIGH/DM_RATR_STA_MIDDLE/DM_RATR_STA_LOW */
|
||||
u32 LastRATR; /* RATR Register Content */
|
||||
};
|
||||
|
||||
#define IQK_MAC_REG_NUM 4
|
||||
#define IQK_ADDA_REG_NUM 16
|
||||
#define IQK_BB_REG_NUM_MAX 10
|
||||
#define IQK_BB_REG_NUM 9
|
||||
#define HP_THERMAL_NUM 8
|
||||
|
||||
#define AVG_THERMAL_NUM 8
|
||||
#define IQK_Matrix_REG_NUM 8
|
||||
#define IQK_Matrix_Settings_NUM 1+24+21
|
||||
|
||||
#define DM_Type_ByFW 0
|
||||
#define DM_Type_ByDriver 1
|
||||
|
||||
/* Declare for common info */
|
||||
|
||||
struct odm_phy_dbg_info {
|
||||
/* ODM Write,debug info */
|
||||
s8 RxSNRdB[RF_PATH_MAX];
|
||||
u64 NumQryPhyStatus;
|
||||
u64 NumQryPhyStatusCCK;
|
||||
u64 NumQryPhyStatusOFDM;
|
||||
/* Others */
|
||||
s32 RxEVM[RF_PATH_MAX];
|
||||
|
||||
};
|
||||
|
||||
struct odm_packet_info {
|
||||
u8 Rate;
|
||||
u8 StationID;
|
||||
bool bPacketMatchBSSID;
|
||||
bool bPacketToSelf;
|
||||
bool bPacketBeacon;
|
||||
};
|
||||
|
||||
|
||||
enum {
|
||||
/* BB Team */
|
||||
ODM_DIG = 0x00000001,
|
||||
ODM_HIGH_POWER = 0x00000002,
|
||||
ODM_CCK_CCA_TH = 0x00000004,
|
||||
ODM_FA_STATISTICS = 0x00000008,
|
||||
ODM_RAMASK = 0x00000010,
|
||||
ODM_RSSI_MONITOR = 0x00000020,
|
||||
ODM_SW_ANTDIV = 0x00000040,
|
||||
ODM_HW_ANTDIV = 0x00000080,
|
||||
ODM_BB_PWRSV = 0x00000100,
|
||||
ODM_2TPATHDIV = 0x00000200,
|
||||
ODM_1TPATHDIV = 0x00000400,
|
||||
ODM_PSD2AFH = 0x00000800
|
||||
};
|
||||
|
||||
/* */
|
||||
/* 2011/10/20 MH Define Common info enum for all team. */
|
||||
/* */
|
||||
|
||||
enum odm_cmninfo {
|
||||
/* Fixed value: */
|
||||
/* */
|
||||
|
||||
ODM_CMNINFO_MP_TEST_CHIP = 2,
|
||||
ODM_CMNINFO_IC_TYPE, /* enum odm_ic_type_def */
|
||||
ODM_CMNINFO_CUT_VER, /* enum odm_cut_version */
|
||||
ODM_CMNINFO_FAB_VER, /* enum odm_fab_version */
|
||||
ODM_CMNINFO_BOARD_TYPE, /* enum odm_board_type */
|
||||
ODM_CMNINFO_EXT_LNA, /* true */
|
||||
ODM_CMNINFO_EXT_PA,
|
||||
ODM_CMNINFO_EXT_TRSW,
|
||||
ODM_CMNINFO_BINHCT_TEST,
|
||||
ODM_CMNINFO_BWIFI_TEST,
|
||||
ODM_CMNINFO_SMART_CONCURRENT,
|
||||
|
||||
|
||||
/* */
|
||||
/* Dynamic value: */
|
||||
/* */
|
||||
ODM_CMNINFO_MP_MODE,
|
||||
|
||||
ODM_CMNINFO_WIFI_DIRECT,
|
||||
ODM_CMNINFO_WIFI_DISPLAY,
|
||||
ODM_CMNINFO_LINK,
|
||||
ODM_CMNINFO_RSSI_MIN,
|
||||
ODM_CMNINFO_DBG_COMP, /* u64 */
|
||||
ODM_CMNINFO_DBG_LEVEL, /* u32 */
|
||||
ODM_CMNINFO_RA_THRESHOLD_HIGH, /* u8 */
|
||||
ODM_CMNINFO_RA_THRESHOLD_LOW, /* u8 */
|
||||
ODM_CMNINFO_RF_ANTENNA_TYPE, /* u8 */
|
||||
ODM_CMNINFO_BT_DISABLED,
|
||||
ODM_CMNINFO_BT_OPERATION,
|
||||
ODM_CMNINFO_BT_DIG,
|
||||
ODM_CMNINFO_BT_BUSY, /* Check Bt is using or not */
|
||||
ODM_CMNINFO_BT_DISABLE_EDCA,
|
||||
|
||||
/* */
|
||||
/* Dynamic ptr array hook itms. */
|
||||
/* */
|
||||
ODM_CMNINFO_STA_STATUS,
|
||||
ODM_CMNINFO_PHY_STATUS,
|
||||
ODM_CMNINFO_MAC_STATUS,
|
||||
|
||||
ODM_CMNINFO_MAX,
|
||||
};
|
||||
|
||||
/* Define ODM support ability. ODM_CMNINFO_ABILITY */
|
||||
enum {
|
||||
/* BB ODM section BIT 0-15 */
|
||||
ODM_BB_ANT_DIV = BIT(6),
|
||||
};
|
||||
|
||||
/* ODM_CMNINFO_INTERFACE */
|
||||
enum odm_interface_def {
|
||||
ODM_ITRF_PCIE = 0x1,
|
||||
ODM_ITRF_USB = 0x2,
|
||||
ODM_ITRF_SDIO = 0x4,
|
||||
ODM_ITRF_ALL = 0x7,
|
||||
};
|
||||
|
||||
/* ODM_CMNINFO_IC_TYPE */
|
||||
enum odm_ic_type_def {
|
||||
ODM_RTL8192S = BIT(0),
|
||||
ODM_RTL8192C = BIT(1),
|
||||
ODM_RTL8192D = BIT(2),
|
||||
ODM_RTL8723A = BIT(3),
|
||||
ODM_RTL8188E = BIT(4),
|
||||
ODM_RTL8812 = BIT(5),
|
||||
ODM_RTL8821 = BIT(6),
|
||||
};
|
||||
|
||||
/* ODM_CMNINFO_CUT_VER */
|
||||
enum odm_cut_version {
|
||||
ODM_CUT_A = 1,
|
||||
ODM_CUT_B = 2,
|
||||
ODM_CUT_C = 3,
|
||||
ODM_CUT_D = 4,
|
||||
ODM_CUT_E = 5,
|
||||
ODM_CUT_F = 6,
|
||||
ODM_CUT_TEST = 7,
|
||||
};
|
||||
|
||||
/* ODM_CMNINFO_FAB_VER */
|
||||
enum odm_fab_version {
|
||||
ODM_TSMC = 0,
|
||||
ODM_UMC = 1,
|
||||
};
|
||||
|
||||
/* For example 1T2R (A+AB = BIT0|BIT4|BIT5) */
|
||||
enum rf_path_def {
|
||||
ODM_RF_TX_A = BIT(0),
|
||||
ODM_RF_TX_B = BIT(1),
|
||||
ODM_RF_TX_C = BIT(2),
|
||||
ODM_RF_TX_D = BIT(3),
|
||||
ODM_RF_RX_A = BIT(4),
|
||||
ODM_RF_RX_B = BIT(5),
|
||||
ODM_RF_RX_C = BIT(6),
|
||||
ODM_RF_RX_D = BIT(7),
|
||||
};
|
||||
|
||||
/* ODM Dynamic common info value definition */
|
||||
|
||||
enum odm_mac_phy_mode {
|
||||
ODM_SMSP = 0,
|
||||
ODM_DMSP = 1,
|
||||
ODM_DMDP = 2,
|
||||
};
|
||||
|
||||
|
||||
enum odm_bt_coexist {
|
||||
ODM_BT_BUSY = 1,
|
||||
ODM_BT_ON = 2,
|
||||
ODM_BT_OFF = 3,
|
||||
ODM_BT_NONE = 4,
|
||||
};
|
||||
|
||||
/* ODM_CMNINFO_OP_MODE */
|
||||
enum odm_operation_mode {
|
||||
ODM_NO_LINK = BIT(0),
|
||||
ODM_LINK = BIT(1),
|
||||
ODM_SCAN = BIT(2),
|
||||
ODM_POWERSAVE = BIT(3),
|
||||
ODM_AP_MODE = BIT(4),
|
||||
ODM_CLIENT_MODE = BIT(5),
|
||||
ODM_AD_HOC = BIT(6),
|
||||
ODM_WIFI_DIRECT = BIT(7),
|
||||
ODM_WIFI_DISPLAY = BIT(8),
|
||||
};
|
||||
|
||||
/* ODM_CMNINFO_WM_MODE */
|
||||
enum odm_wireless_mode {
|
||||
ODM_WM_UNKNOW = 0x0,
|
||||
ODM_WM_B = BIT(0),
|
||||
ODM_WM_G = BIT(1),
|
||||
ODM_WM_A = BIT(2),
|
||||
ODM_WM_N24G = BIT(3),
|
||||
ODM_WM_N5G = BIT(4),
|
||||
ODM_WM_AUTO = BIT(5),
|
||||
ODM_WM_AC = BIT(6),
|
||||
};
|
||||
|
||||
/* ODM_CMNINFO_BAND */
|
||||
enum odm_band_type {
|
||||
ODM_BAND_2_4G = BIT(0),
|
||||
ODM_BAND_5G = BIT(1),
|
||||
|
||||
};
|
||||
|
||||
/* ODM_CMNINFO_SEC_CHNL_OFFSET */
|
||||
enum odm_sec_chnl_offset {
|
||||
ODM_DONT_CARE = 0,
|
||||
ODM_BELOW = 1,
|
||||
ODM_ABOVE = 2
|
||||
};
|
||||
|
||||
/* ODM_CMNINFO_CHNL */
|
||||
|
||||
/* ODM_CMNINFO_BOARD_TYPE */
|
||||
enum odm_board_type {
|
||||
ODM_BOARD_NORMAL = 0,
|
||||
ODM_BOARD_HIGHPWR = 1,
|
||||
ODM_BOARD_MINICARD = 2,
|
||||
ODM_BOARD_SLIM = 3,
|
||||
ODM_BOARD_COMBO = 4,
|
||||
|
||||
};
|
||||
|
||||
/* ODM_CMNINFO_ONE_PATH_CCA */
|
||||
enum odm_cca_path {
|
||||
ODM_CCA_2R = 0,
|
||||
ODM_CCA_1R_A = 1,
|
||||
ODM_CCA_1R_B = 2,
|
||||
};
|
||||
|
||||
struct iqk_matrix_regs_set {
|
||||
bool bIQKDone;
|
||||
s32 Value[1][IQK_Matrix_REG_NUM];
|
||||
};
|
||||
|
||||
struct odm_rf_cal_t {
|
||||
/* for tx power tracking */
|
||||
|
||||
u32 RegA24; /* for TempCCK */
|
||||
s32 RegE94;
|
||||
s32 RegE9C;
|
||||
s32 RegEB4;
|
||||
s32 RegEBC;
|
||||
|
||||
/* u8 bTXPowerTracking; */
|
||||
u8 TXPowercount;
|
||||
bool bTXPowerTrackingInit;
|
||||
bool bTXPowerTracking;
|
||||
u8 TxPowerTrackControl; /* for mp mode, turn off txpwrtracking as default */
|
||||
u8 TM_Trigger;
|
||||
u8 InternalPA5G[2]; /* pathA / pathB */
|
||||
|
||||
u8 ThermalMeter[2]; /* ThermalMeter, index 0 for RFIC0, and 1 for RFIC1 */
|
||||
u8 ThermalValue;
|
||||
u8 ThermalValue_LCK;
|
||||
u8 ThermalValue_IQK;
|
||||
u8 ThermalValue_DPK;
|
||||
u8 ThermalValue_AVG[AVG_THERMAL_NUM];
|
||||
u8 ThermalValue_AVG_index;
|
||||
u8 ThermalValue_RxGain;
|
||||
u8 ThermalValue_Crystal;
|
||||
u8 ThermalValue_DPKstore;
|
||||
u8 ThermalValue_DPKtrack;
|
||||
bool TxPowerTrackingInProgress;
|
||||
bool bDPKenable;
|
||||
|
||||
bool bReloadtxpowerindex;
|
||||
u8 bRfPiEnable;
|
||||
u32 TXPowerTrackingCallbackCnt; /* cosa add for debug */
|
||||
|
||||
u8 bCCKinCH14;
|
||||
u8 CCK_index;
|
||||
u8 OFDM_index[2];
|
||||
bool bDoneTxpower;
|
||||
|
||||
u8 ThermalValue_HP[HP_THERMAL_NUM];
|
||||
u8 ThermalValue_HP_index;
|
||||
struct iqk_matrix_regs_set IQKMatrixRegSetting[IQK_Matrix_Settings_NUM];
|
||||
|
||||
u8 Delta_IQK;
|
||||
u8 Delta_LCK;
|
||||
|
||||
/* for IQK */
|
||||
u32 RegC04;
|
||||
u32 Reg874;
|
||||
u32 RegC08;
|
||||
u32 RegB68;
|
||||
u32 RegB6C;
|
||||
u32 Reg870;
|
||||
u32 Reg860;
|
||||
u32 Reg864;
|
||||
|
||||
bool bIQKInitialized;
|
||||
bool bLCKInProgress;
|
||||
bool bAntennaDetected;
|
||||
u32 ADDA_backup[IQK_ADDA_REG_NUM];
|
||||
u32 IQK_MAC_backup[IQK_MAC_REG_NUM];
|
||||
u32 IQK_BB_backup_recover[9];
|
||||
u32 IQK_BB_backup[IQK_BB_REG_NUM];
|
||||
|
||||
/* for APK */
|
||||
u32 APKoutput[2][2]; /* path A/B; output1_1a/output1_2a */
|
||||
u8 bAPKdone;
|
||||
u8 bAPKThermalMeterIgnore;
|
||||
u8 bDPdone;
|
||||
u8 bDPPathAOK;
|
||||
u8 bDPPathBOK;
|
||||
};
|
||||
|
||||
enum ant_dif_type {
|
||||
NO_ANTDIV = 0xFF,
|
||||
CG_TRX_HW_ANTDIV = 0x01,
|
||||
CGCS_RX_HW_ANTDIV = 0x02,
|
||||
FIXED_HW_ANTDIV = 0x03,
|
||||
CG_TRX_SMART_ANTDIV = 0x04,
|
||||
CGCS_RX_SW_ANTDIV = 0x05,
|
||||
};
|
||||
|
||||
/* 2011/09/22 MH Copy from SD4 defined structure. We use to support PHY DM integration. */
|
||||
struct dm_odm_t {
|
||||
/* */
|
||||
/* Add for different team use temporarily */
|
||||
/* */
|
||||
struct rtw_adapter *Adapter; /* For CE/NIC team */
|
||||
|
||||
u64 DebugComponents;
|
||||
u32 DebugLevel;
|
||||
|
||||
/* ODM HANDLE, DRIVER NEEDS NOT TO HOOK------ */
|
||||
bool bCckHighPower;
|
||||
u8 RFPathRxEnable; /* ODM_CMNINFO_RFPATH_ENABLE */
|
||||
/* ODM HANDLE, DRIVER NEEDS NOT TO HOOK------ */
|
||||
|
||||
/* 1 COMMON INFORMATION */
|
||||
|
||||
/* Init Value */
|
||||
/* HOOK BEFORE REG INIT----------- */
|
||||
/* ODM Support Ability DIG/RATR/TX_PWR_TRACK/ ¡K¡K = 1/2/3/¡K */
|
||||
u32 SupportAbility;
|
||||
/* ODM composite or independent. Bit oriented/ 92C+92D+ .... or any other type = 1/2/3/... */
|
||||
u32 SupportICType;
|
||||
/* Cut Version TestChip/A-cut/B-cut... = 0/1/2/3/... */
|
||||
u8 CutVersion;
|
||||
/* Fab Version TSMC/UMC = 0/1 */
|
||||
u8 FabVersion;
|
||||
/* Board Type Normal/HighPower/MiniCard/SLIM/Combo/... = 0/1/2/3/4/... */
|
||||
u8 BoardType;
|
||||
/* with external LNA NO/Yes = 0/1 */
|
||||
u8 ExtLNA;
|
||||
/* with external PA NO/Yes = 0/1 */
|
||||
u8 ExtPA;
|
||||
/* with external TRSW NO/Yes = 0/1 */
|
||||
u8 ExtTRSW;
|
||||
bool bInHctTest;
|
||||
bool bWIFITest;
|
||||
|
||||
bool bDualMacSmartConcurrent;
|
||||
u32 BK_SupportAbility;
|
||||
/* HOOK BEFORE REG INIT----------- */
|
||||
|
||||
/* */
|
||||
/* Dynamic Value */
|
||||
/* */
|
||||
/* POINTER REFERENCE----------- */
|
||||
|
||||
u8 u8_temp;
|
||||
bool bool_temp;
|
||||
struct rtw_adapter *PADAPTER_temp;
|
||||
|
||||
/* POINTER REFERENCE----------- */
|
||||
/* */
|
||||
/* CALL BY VALUE------------- */
|
||||
bool bWIFI_Direct;
|
||||
bool bWIFI_Display;
|
||||
bool bLinked;
|
||||
u8 RSSI_Min;
|
||||
u8 InterfaceIndex; /* Add for 92D dual MAC: 0--Mac0 1--Mac1 */
|
||||
bool bIsMPChip;
|
||||
bool bOneEntryOnly;
|
||||
/* Common info for BTDM */
|
||||
bool bBtDisabled; /* BT is disabled */
|
||||
bool bBtHsOperation; /* BT HS mode is under progress */
|
||||
u8 btHsDigVal; /* use BT rssi to decide the DIG value */
|
||||
bool bBtDisableEdcaTurbo; /* Under some condition, don't enable the EDCA Turbo */
|
||||
bool bBtBusy; /* BT is busy. */
|
||||
/* CALL BY VALUE------------- */
|
||||
|
||||
/* 2 Define STA info. */
|
||||
/* _ODM_STA_INFO */
|
||||
/* 2012/01/12 MH For MP, we need to reduce one array pointer for default port.?? */
|
||||
struct sta_info * pODM_StaInfo[ODM_ASSOCIATE_ENTRY_NUM];
|
||||
|
||||
/* Latest packet phy info (ODM write) */
|
||||
struct odm_phy_dbg_info PhyDbgInfo;
|
||||
/* PHY_INFO_88E PhyInfo; */
|
||||
|
||||
/* Latest packet phy info (ODM write) */
|
||||
/* MAC_INFO_88E MacInfo; */
|
||||
|
||||
/* Different Team independt structure?? */
|
||||
|
||||
/* */
|
||||
/* TX_RTP_CMN TX_retrpo; */
|
||||
/* TX_RTP_88E TX_retrpo; */
|
||||
/* TX_RTP_8195 TX_retrpo; */
|
||||
|
||||
/* */
|
||||
/* ODM Structure */
|
||||
/* */
|
||||
struct dig_t DM_DigTable;
|
||||
struct dynamic_pwr_sav DM_PSTable;
|
||||
struct false_alarm_stats FalseAlmCnt;
|
||||
struct false_alarm_stats FlaseAlmCntBuddyAdapter;
|
||||
struct sw_ant_sw DM_SWAT_Table;
|
||||
|
||||
struct edca_turbo DM_EDCA_Table;
|
||||
u32 WMMEDCA_BE;
|
||||
/* Copy from SD4 structure */
|
||||
/* */
|
||||
/* ================================================== */
|
||||
/* */
|
||||
|
||||
/* PSD */
|
||||
u8 RSSI_BT; /* come from BT */
|
||||
struct odm_rate_adapt RateAdaptive;
|
||||
|
||||
|
||||
struct odm_rf_cal_t RFCalibrateInfo;
|
||||
}; /* DM_Dynamic_Mechanism_Structure */
|
||||
|
||||
enum odm_rf_content {
|
||||
odm_radioa_txt = 0x1000,
|
||||
odm_radiob_txt = 0x1001,
|
||||
odm_radioc_txt = 0x1002,
|
||||
odm_radiod_txt = 0x1003
|
||||
};
|
||||
|
||||
/* Status code */
|
||||
enum rt_status {
|
||||
RT_STATUS_SUCCESS,
|
||||
RT_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,
|
||||
};
|
||||
|
||||
/* include "odm_function.h" */
|
||||
|
||||
/* 3=========================================================== */
|
||||
/* 3 DIG */
|
||||
/* 3=========================================================== */
|
||||
|
||||
enum dm_dig_op {
|
||||
DIG_TYPE_THRESH_HIGH = 0,
|
||||
DIG_TYPE_THRESH_LOW = 1,
|
||||
DIG_TYPE_BACKOFF = 2,
|
||||
DIG_TYPE_RX_GAIN_MIN = 3,
|
||||
DIG_TYPE_RX_GAIN_MAX = 4,
|
||||
DIG_TYPE_ENABLE = 5,
|
||||
DIG_TYPE_DISABLE = 6,
|
||||
DIG_OP_TYPE_MAX
|
||||
};
|
||||
|
||||
#define DM_DIG_THRESH_HIGH 40
|
||||
#define DM_DIG_THRESH_LOW 35
|
||||
|
||||
#define DM_SCAN_RSSI_TH 0x14 /* scan return issue for LC */
|
||||
|
||||
|
||||
#define DM_FALSEALARM_THRESH_LOW 400
|
||||
#define DM_FALSEALARM_THRESH_HIGH 1000
|
||||
|
||||
#define DM_DIG_MAX_NIC 0x4e
|
||||
#define DM_DIG_MIN_NIC 0x1e
|
||||
|
||||
#define DM_DIG_MAX_AP 0x32
|
||||
#define DM_DIG_MIN_AP 0x20
|
||||
|
||||
#define DM_DIG_MAX_NIC_HP 0x46
|
||||
#define DM_DIG_MIN_NIC_HP 0x2e
|
||||
|
||||
#define DM_DIG_MAX_AP_HP 0x42
|
||||
#define DM_DIG_MIN_AP_HP 0x30
|
||||
|
||||
/* vivi 92c&92d has different definition, 20110504 */
|
||||
/* this is for 92c */
|
||||
#define DM_DIG_FA_TH0 0x200
|
||||
#define DM_DIG_FA_TH1 0x300
|
||||
#define DM_DIG_FA_TH2 0x400
|
||||
/* this is for 92d */
|
||||
#define DM_DIG_FA_TH0_92D 0x100
|
||||
#define DM_DIG_FA_TH1_92D 0x400
|
||||
#define DM_DIG_FA_TH2_92D 0x600
|
||||
|
||||
#define DM_DIG_BACKOFF_MAX 12
|
||||
#define DM_DIG_BACKOFF_MIN -4
|
||||
#define DM_DIG_BACKOFF_DEFAULT 10
|
||||
|
||||
/* 3=========================================================== */
|
||||
/* 3 AGC RX High Power Mode */
|
||||
/* 3=========================================================== */
|
||||
#define LNA_Low_Gain_1 0x64
|
||||
#define LNA_Low_Gain_2 0x5A
|
||||
#define LNA_Low_Gain_3 0x58
|
||||
|
||||
#define FA_RXHP_TH1 5000
|
||||
#define FA_RXHP_TH2 1500
|
||||
#define FA_RXHP_TH3 800
|
||||
#define FA_RXHP_TH4 600
|
||||
#define FA_RXHP_TH5 500
|
||||
|
||||
/* 3=========================================================== */
|
||||
/* 3 EDCA */
|
||||
/* 3=========================================================== */
|
||||
|
||||
/* 3=========================================================== */
|
||||
/* 3 Dynamic Tx Power */
|
||||
/* 3=========================================================== */
|
||||
/* Dynamic Tx Power Control Threshold */
|
||||
#define TX_POWER_NEAR_FIELD_THRESH_LVL2 74
|
||||
#define TX_POWER_NEAR_FIELD_THRESH_LVL1 67
|
||||
#define TX_POWER_NEAR_FIELD_THRESH_AP 0x3F
|
||||
|
||||
#define TxHighPwrLevel_Normal 0
|
||||
#define TxHighPwrLevel_Level1 1
|
||||
#define TxHighPwrLevel_Level2 2
|
||||
#define TxHighPwrLevel_BT1 3
|
||||
#define TxHighPwrLevel_BT2 4
|
||||
#define TxHighPwrLevel_15 5
|
||||
#define TxHighPwrLevel_35 6
|
||||
#define TxHighPwrLevel_50 7
|
||||
#define TxHighPwrLevel_70 8
|
||||
#define TxHighPwrLevel_100 9
|
||||
|
||||
/* 3=========================================================== */
|
||||
/* 3 Rate Adaptive */
|
||||
/* 3=========================================================== */
|
||||
#define DM_RATR_STA_INIT 0
|
||||
#define DM_RATR_STA_HIGH 1
|
||||
#define DM_RATR_STA_MIDDLE 2
|
||||
#define DM_RATR_STA_LOW 3
|
||||
|
||||
/* 3=========================================================== */
|
||||
/* 3 BB Power Save */
|
||||
/* 3=========================================================== */
|
||||
|
||||
|
||||
enum dm_1r_cca {
|
||||
CCA_1R =0,
|
||||
CCA_2R = 1,
|
||||
CCA_MAX = 2,
|
||||
};
|
||||
|
||||
enum dm_rf_def {
|
||||
RF_Save =0,
|
||||
RF_Normal = 1,
|
||||
RF_MAX = 2,
|
||||
};
|
||||
|
||||
/* 3=========================================================== */
|
||||
/* 3 Antenna Diversity */
|
||||
/* 3=========================================================== */
|
||||
enum dm_swas {
|
||||
Antenna_A = 1,
|
||||
Antenna_B = 2,
|
||||
Antenna_MAX = 3,
|
||||
};
|
||||
|
||||
/* Maximal number of antenna detection mechanism needs to perform, added by Roger, 2011.12.28. */
|
||||
#define MAX_ANTENNA_DETECTION_CNT 10
|
||||
|
||||
/* */
|
||||
/* Extern Global Variables. */
|
||||
/* */
|
||||
#define OFDM_TABLE_SIZE_92C 37
|
||||
#define OFDM_TABLE_SIZE_92D 43
|
||||
#define CCK_TABLE_SIZE 33
|
||||
|
||||
extern u32 OFDMSwingTable23A[OFDM_TABLE_SIZE_92D];
|
||||
extern u8 CCKSwingTable_Ch1_Ch1323A[CCK_TABLE_SIZE][8];
|
||||
extern u8 CCKSwingTable_Ch1423A [CCK_TABLE_SIZE][8];
|
||||
|
||||
|
||||
|
||||
/* 20100514 Joseph: Add definition for antenna switching test after link. */
|
||||
/* This indicates two different the steps. */
|
||||
/* In SWAW_STEP_PEAK, driver needs to switch antenna and listen to the signal on the air. */
|
||||
/* In SWAW_STEP_DETERMINE, driver just compares the signal captured in SWAW_STEP_PEAK */
|
||||
/* with original RSSI to determine if it is necessary to switch antenna. */
|
||||
#define SWAW_STEP_PEAK 0
|
||||
#define SWAW_STEP_DETERMINE 1
|
||||
|
||||
struct hal_data_8723a;
|
||||
|
||||
void ODM_Write_DIG23a(struct dm_odm_t *pDM_Odm, u8 CurrentIGI);
|
||||
void ODM_Write_CCK_CCA_Thres23a(struct dm_odm_t *pDM_Odm, u8 CurCCK_CCAThres);
|
||||
|
||||
void ODM_SetAntenna(struct dm_odm_t *pDM_Odm, u8 Antenna);
|
||||
|
||||
|
||||
#define dm_RF_Saving ODM_RF_Saving23a
|
||||
void ODM_RF_Saving23a(struct dm_odm_t *pDM_Odm, u8 bForceInNormal);
|
||||
|
||||
#define dm_CheckTXPowerTracking ODM_TXPowerTrackingCheck23a
|
||||
void ODM_TXPowerTrackingCheck23a(struct dm_odm_t *pDM_Odm);
|
||||
|
||||
bool ODM_RAStateCheck23a(struct dm_odm_t *pDM_Odm, s32 RSSI, bool bForceUpdate,
|
||||
u8 *pRATRState);
|
||||
|
||||
|
||||
u32 ConvertTo_dB23a(u32 Value);
|
||||
|
||||
u32 GetPSDData(struct dm_odm_t *pDM_Odm, unsigned int point, u8 initial_gain_psd);
|
||||
|
||||
void odm_DIG23abyRSSI_LPS(struct dm_odm_t *pDM_Odm);
|
||||
|
||||
u32 ODM_Get_Rate_Bitmap23a(struct hal_data_8723a *pHalData, u32 macid, u32 ra_mask, u8 rssi_level);
|
||||
|
||||
|
||||
void ODM23a_DMInit(struct dm_odm_t *pDM_Odm);
|
||||
|
||||
void ODM_DMWatchdog23a(struct rtw_adapter *adapter);
|
||||
|
||||
void ODM_CmnInfoInit23a(struct dm_odm_t *pDM_Odm, enum odm_cmninfo CmnInfo, u32 Value);
|
||||
|
||||
void ODM_CmnInfoPtrArrayHook23a(struct dm_odm_t *pDM_Odm, enum odm_cmninfo CmnInfo, u16 Index, void *pValue);
|
||||
|
||||
void ODM_CmnInfoUpdate23a(struct dm_odm_t *pDM_Odm, u32 CmnInfo, u64 Value);
|
||||
|
||||
void ODM_ResetIQKResult(struct dm_odm_t *pDM_Odm);
|
||||
|
||||
void ODM_AntselStatistics_88C(struct dm_odm_t *pDM_Odm, u8 MacId, u32 PWDBAll, bool isCCKrate);
|
||||
|
||||
void ODM_SingleDualAntennaDefaultSetting(struct dm_odm_t *pDM_Odm);
|
||||
|
||||
bool ODM_SingleDualAntennaDetection(struct dm_odm_t *pDM_Odm, u8 mode);
|
||||
|
||||
#endif
|
|
@ -1,153 +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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
#ifndef __HALHWOUTSRC_H__
|
||||
#define __HALHWOUTSRC_H__
|
||||
|
||||
#include <Hal8723APhyCfg.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 */
|
||||
/* */
|
||||
|
||||
struct phy_rx_agc_info {
|
||||
#ifdef __LITTLE_ENDIAN
|
||||
u8 gain:7, trsw:1;
|
||||
#else
|
||||
u8 trsw:1, gain:7;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct phy_status_rpt {
|
||||
struct phy_rx_agc_info path_agc[RF_PATH_MAX];
|
||||
u8 ch_corr[RF_PATH_MAX];
|
||||
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[RF_PATH_MAX];
|
||||
u8 pcts_mask[RF_PATH_MAX];
|
||||
s8 stream_rxevm[RF_PATH_MAX];
|
||||
u8 path_rxsnr[RF_PATH_MAX];
|
||||
u8 noise_power_db_lsb;
|
||||
u8 rsvd_2[3];
|
||||
u8 stream_csi[RF_PATH_MAX];
|
||||
u8 stream_target_csi[RF_PATH_MAX];
|
||||
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
|
||||
};
|
||||
|
||||
|
||||
struct phy_status_rpt_8195 {
|
||||
struct phy_rx_agc_info 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
|
||||
};
|
||||
|
||||
|
||||
void
|
||||
ODM_PhyStatusQuery23a(
|
||||
struct dm_odm_t *pDM_Odm,
|
||||
struct phy_info *pPhyInfo,
|
||||
u8 * pPhyStatus,
|
||||
struct odm_packet_info *pPktinfo
|
||||
);
|
||||
|
||||
#endif
|
|
@ -1,27 +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.
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef __INC_ODM_REGCONFIG_H_8723A
|
||||
#define __INC_ODM_REGCONFIG_H_8723A
|
||||
|
||||
void odm_ConfigRFReg_8723A(struct dm_odm_t *pDM_Odm, u32 Addr, u32 Data,
|
||||
enum RF_RADIO_PATH RF_PATH, u32 RegAddr);
|
||||
|
||||
void odm_ConfigMAC_8723A(struct dm_odm_t *pDM_Odm, u32 Addr, u8 Data);
|
||||
|
||||
void odm_ConfigBB_AGC_8723A(struct dm_odm_t *pDM_Odm, u32 addr, u32 data);
|
||||
|
||||
void odm_ConfigBB_PHY_8723A(struct dm_odm_t *pDM_Odm, u32 addr, u32 data);
|
||||
|
||||
#endif /* end of SUPPORT */
|
|
@ -1,165 +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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __ODM_REGDEFINE11N_H__
|
||||
#define __ODM_REGDEFINE11N_H__
|
||||
|
||||
|
||||
/* 2 RF REG LIST */
|
||||
#define ODM_REG_RF_MODE_11N 0x00
|
||||
#define ODM_REG_RF_0B_11N 0x0B
|
||||
#define ODM_REG_CHNBW_11N 0x18
|
||||
#define ODM_REG_T_METER_11N 0x24
|
||||
#define ODM_REG_RF_25_11N 0x25
|
||||
#define ODM_REG_RF_26_11N 0x26
|
||||
#define ODM_REG_RF_27_11N 0x27
|
||||
#define ODM_REG_RF_2B_11N 0x2B
|
||||
#define ODM_REG_RF_2C_11N 0x2C
|
||||
#define ODM_REG_RXRF_A3_11N 0x3C
|
||||
#define ODM_REG_T_METER_92D_11N 0x42
|
||||
#define ODM_REG_T_METER_88E_11N 0x42
|
||||
|
||||
|
||||
|
||||
/* 2 BB REG LIST */
|
||||
/* PAGE 8 */
|
||||
#define ODM_REG_BB_CTRL_11N 0x800
|
||||
#define ODM_REG_RF_PIN_11N 0x804
|
||||
#define ODM_REG_PSD_CTRL_11N 0x808
|
||||
#define ODM_REG_TX_ANT_CTRL_11N 0x80C
|
||||
#define ODM_REG_BB_PWR_SAV5_11N 0x818
|
||||
#define ODM_REG_CCK_RPT_FORMAT_11N 0x824
|
||||
#define ODM_REG_RX_DEFUALT_A_11N 0x858
|
||||
#define ODM_REG_RX_DEFUALT_B_11N 0x85A
|
||||
#define ODM_REG_BB_PWR_SAV3_11N 0x85C
|
||||
#define ODM_REG_ANTSEL_CTRL_11N 0x860
|
||||
#define ODM_REG_RX_ANT_CTRL_11N 0x864
|
||||
#define ODM_REG_PIN_CTRL_11N 0x870
|
||||
#define ODM_REG_BB_PWR_SAV1_11N 0x874
|
||||
#define ODM_REG_ANTSEL_PATH_11N 0x878
|
||||
#define ODM_REG_BB_3WIRE_11N 0x88C
|
||||
#define ODM_REG_SC_CNT_11N 0x8C4
|
||||
#define ODM_REG_PSD_DATA_11N 0x8B4
|
||||
/* PAGE 9 */
|
||||
#define ODM_REG_ANT_MAPPING1_11N 0x914
|
||||
#define ODM_REG_ANT_MAPPING2_11N 0x918
|
||||
/* PAGE A */
|
||||
#define ODM_REG_CCK_ANTDIV_PARA1_11N 0xA00
|
||||
#define ODM_REG_CCK_CCA_11N 0xA0A
|
||||
#define ODM_REG_CCK_ANTDIV_PARA2_11N 0xA0C
|
||||
#define ODM_REG_CCK_ANTDIV_PARA3_11N 0xA10
|
||||
#define ODM_REG_CCK_ANTDIV_PARA4_11N 0xA14
|
||||
#define ODM_REG_CCK_FILTER_PARA1_11N 0xA22
|
||||
#define ODM_REG_CCK_FILTER_PARA2_11N 0xA23
|
||||
#define ODM_REG_CCK_FILTER_PARA3_11N 0xA24
|
||||
#define ODM_REG_CCK_FILTER_PARA4_11N 0xA25
|
||||
#define ODM_REG_CCK_FILTER_PARA5_11N 0xA26
|
||||
#define ODM_REG_CCK_FILTER_PARA6_11N 0xA27
|
||||
#define ODM_REG_CCK_FILTER_PARA7_11N 0xA28
|
||||
#define ODM_REG_CCK_FILTER_PARA8_11N 0xA29
|
||||
#define ODM_REG_CCK_FA_RST_11N 0xA2C
|
||||
#define ODM_REG_CCK_FA_MSB_11N 0xA58
|
||||
#define ODM_REG_CCK_FA_LSB_11N 0xA5C
|
||||
#define ODM_REG_CCK_CCA_CNT_11N 0xA60
|
||||
#define ODM_REG_BB_PWR_SAV4_11N 0xA74
|
||||
/* PAGE B */
|
||||
#define ODM_REG_LNA_SWITCH_11N 0xB2C
|
||||
#define ODM_REG_PATH_SWITCH_11N 0xB30
|
||||
#define ODM_REG_RSSI_CTRL_11N 0xB38
|
||||
#define ODM_REG_CONFIG_ANTA_11N 0xB68
|
||||
#define ODM_REG_RSSI_BT_11N 0xB9C
|
||||
/* PAGE C */
|
||||
#define ODM_REG_OFDM_FA_HOLDC_11N 0xC00
|
||||
#define ODM_REG_RX_PATH_11N 0xC04
|
||||
#define ODM_REG_TRMUX_11N 0xC08
|
||||
#define ODM_REG_OFDM_FA_RSTC_11N 0xC0C
|
||||
#define ODM_REG_RXIQI_MATRIX_11N 0xC14
|
||||
#define ODM_REG_TXIQK_MATRIX_LSB1_11N 0xC4C
|
||||
#define ODM_REG_IGI_A_11N 0xC50
|
||||
#define ODM_REG_ANTDIV_PARA2_11N 0xC54
|
||||
#define ODM_REG_IGI_B_11N 0xC58
|
||||
#define ODM_REG_ANTDIV_PARA3_11N 0xC5C
|
||||
#define ODM_REG_BB_PWR_SAV2_11N 0xC70
|
||||
#define ODM_REG_RX_OFF_11N 0xC7C
|
||||
#define ODM_REG_TXIQK_MATRIXA_11N 0xC80
|
||||
#define ODM_REG_TXIQK_MATRIXB_11N 0xC88
|
||||
#define ODM_REG_TXIQK_MATRIXA_LSB2_11N 0xC94
|
||||
#define ODM_REG_TXIQK_MATRIXB_LSB2_11N 0xC9C
|
||||
#define ODM_REG_RXIQK_MATRIX_LSB_11N 0xCA0
|
||||
#define ODM_REG_ANTDIV_PARA1_11N 0xCA4
|
||||
#define ODM_REG_OFDM_FA_TYPE1_11N 0xCF0
|
||||
/* PAGE D */
|
||||
#define ODM_REG_OFDM_FA_RSTD_11N 0xD00
|
||||
#define ODM_REG_OFDM_FA_TYPE2_11N 0xDA0
|
||||
#define ODM_REG_OFDM_FA_TYPE3_11N 0xDA4
|
||||
#define ODM_REG_OFDM_FA_TYPE4_11N 0xDA8
|
||||
/* PAGE E */
|
||||
#define ODM_REG_TXAGC_A_6_18_11N 0xE00
|
||||
#define ODM_REG_TXAGC_A_24_54_11N 0xE04
|
||||
#define ODM_REG_TXAGC_A_1_MCS32_11N 0xE08
|
||||
#define ODM_REG_TXAGC_A_MCS0_3_11N 0xE10
|
||||
#define ODM_REG_TXAGC_A_MCS4_7_11N 0xE14
|
||||
#define ODM_REG_TXAGC_A_MCS8_11_11N 0xE18
|
||||
#define ODM_REG_TXAGC_A_MCS12_15_11N 0xE1C
|
||||
#define ODM_REG_FPGA0_IQK_11N 0xE28
|
||||
#define ODM_REG_TXIQK_TONE_A_11N 0xE30
|
||||
#define ODM_REG_RXIQK_TONE_A_11N 0xE34
|
||||
#define ODM_REG_TXIQK_PI_A_11N 0xE38
|
||||
#define ODM_REG_RXIQK_PI_A_11N 0xE3C
|
||||
#define ODM_REG_TXIQK_11N 0xE40
|
||||
#define ODM_REG_RXIQK_11N 0xE44
|
||||
#define ODM_REG_IQK_AGC_PTS_11N 0xE48
|
||||
#define ODM_REG_IQK_AGC_RSP_11N 0xE4C
|
||||
#define ODM_REG_BLUETOOTH_11N 0xE6C
|
||||
#define ODM_REG_RX_WAIT_CCA_11N 0xE70
|
||||
#define ODM_REG_TX_CCK_RFON_11N 0xE74
|
||||
#define ODM_REG_TX_CCK_BBON_11N 0xE78
|
||||
#define ODM_REG_OFDM_RFON_11N 0xE7C
|
||||
#define ODM_REG_OFDM_BBON_11N 0xE80
|
||||
#define ODM_REG_TX2RX_11N 0xE84
|
||||
#define ODM_REG_TX2TX_11N 0xE88
|
||||
#define ODM_REG_RX_CCK_11N 0xE8C
|
||||
#define ODM_REG_RX_OFDM_11N 0xED0
|
||||
#define ODM_REG_RX_WAIT_RIFS_11N 0xED4
|
||||
#define ODM_REG_RX2RX_11N 0xED8
|
||||
#define ODM_REG_STANDBY_11N 0xEDC
|
||||
#define ODM_REG_SLEEP_11N 0xEE0
|
||||
#define ODM_REG_PMPD_ANAEN_11N 0xEEC
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* 2 MAC REG LIST */
|
||||
#define ODM_REG_BB_RST_11N 0x02
|
||||
#define ODM_REG_ANTSEL_PIN_11N 0x4C
|
||||
#define ODM_REG_EARLY_MODE_11N 0x4D0
|
||||
#define ODM_REG_RSSI_MONITOR_11N 0x4FE
|
||||
#define ODM_REG_EDCA_VO_11N 0x500
|
||||
#define ODM_REG_EDCA_VI_11N 0x504
|
||||
#define ODM_REG_EDCA_BE_11N 0x508
|
||||
#define ODM_REG_EDCA_BK_11N 0x50C
|
||||
#define ODM_REG_TXPAUSE_11N 0x522
|
||||
#define ODM_REG_RESP_TX_11N 0x6D8
|
||||
#define ODM_REG_ANT_TRAIN_PARA1_11N 0x7b0
|
||||
#define ODM_REG_ANT_TRAIN_PARA2_11N 0x7b4
|
||||
|
||||
|
||||
/* DIG Related */
|
||||
#define ODM_BIT_IGI_11N 0x0000007F
|
||||
|
||||
#endif
|
|
@ -1,117 +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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
#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 develop 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 BIT(0)
|
||||
#define ODM_COMP_RA_MASK BIT(1)
|
||||
#define ODM_COMP_DYNAMIC_TXPWR BIT(2)
|
||||
#define ODM_COMP_FA_CNT BIT(3)
|
||||
#define ODM_COMP_RSSI_MONITOR BIT(4)
|
||||
#define ODM_COMP_CCK_PD BIT(5)
|
||||
#define ODM_COMP_ANT_DIV BIT(6)
|
||||
#define ODM_COMP_PWR_SAVE BIT(7)
|
||||
#define ODM_COMP_PWR_TRAIN BIT(8)
|
||||
#define ODM_COMP_RATE_ADAPTIVE BIT(9)
|
||||
#define ODM_COMP_PATH_DIV BIT(10)
|
||||
#define ODM_COMP_PSD BIT(11)
|
||||
#define ODM_COMP_DYNAMIC_PRICCA BIT(12)
|
||||
#define ODM_COMP_RXHP BIT(13)
|
||||
/* MAC Functions */
|
||||
#define ODM_COMP_EDCA_TURBO BIT(16)
|
||||
#define ODM_COMP_EARLY_MODE BIT(17)
|
||||
/* RF Functions */
|
||||
#define ODM_COMP_TX_PWR_TRACK BIT(24)
|
||||
#define ODM_COMP_RX_GAIN_TRACK BIT(25)
|
||||
#define ODM_COMP_CALIBRATION BIT(26)
|
||||
/* Common Functions */
|
||||
#define ODM_COMP_COMMON BIT(30)
|
||||
#define ODM_COMP_INIT BIT(31)
|
||||
|
||||
/*------------------------Export Macro Definition---------------------------*/
|
||||
#define RT_PRINTK(fmt, args...) printk("%s(): " fmt, __func__, ## args);
|
||||
|
||||
#ifndef ASSERT
|
||||
#define ASSERT(expr)
|
||||
#endif
|
||||
|
||||
#define ODM_RT_TRACE(pDM_Odm, comp, level, fmt) \
|
||||
if(((comp) & pDM_Odm->DebugComponents) && (level <= pDM_Odm->DebugLevel)) \
|
||||
{ \
|
||||
printk("[ODM-8723A] "); \
|
||||
RT_PRINTK fmt; \
|
||||
}
|
||||
|
||||
#define ODM_RT_ASSERT(pDM_Odm, expr, fmt) \
|
||||
if(!(expr)) { \
|
||||
printk("Assertion failed! %s at ......\n", #expr); \
|
||||
printk(" ......%s,%s,line=%d\n", __FILE__, __func__, __LINE__);\
|
||||
RT_PRINTK fmt; \
|
||||
ASSERT(false); \
|
||||
}
|
||||
|
||||
void ODM_InitDebugSetting23a(struct dm_odm_t *pDM_Odm);
|
||||
|
||||
#endif /* __ODM_DBG_H__ */
|
|
@ -1,62 +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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
#ifndef __ODM_INTERFACE_H__
|
||||
#define __ODM_INTERFACE_H__
|
||||
|
||||
|
||||
/* _cat: implemented by Token-Pasting Operator. */
|
||||
|
||||
/*===================================
|
||||
|
||||
#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, _func) \
|
||||
( \
|
||||
_func##_11N(_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, _reg)
|
||||
#define ODM_BIT(_name, _pDM_Odm) _cat(_name, _bit)
|
||||
|
||||
/* */
|
||||
/* 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 (*RT_WORKITEM_CALL_BACK)(struct work_struct *pContext);
|
||||
|
||||
/* */
|
||||
/* =========== EXtern Function Prototype */
|
||||
/* */
|
||||
|
||||
void ODM_SetRFReg(struct dm_odm_t *pDM_Odm, enum RF_RADIO_PATH eRFPath,
|
||||
u32 RegAddr, u32 BitMask, u32 Data);
|
||||
u32 ODM_GetRFReg(struct dm_odm_t *pDM_Odm, enum RF_RADIO_PATH eRFPath,
|
||||
u32 RegAddr, u32 BitMask);
|
||||
|
||||
#endif /* __ODM_INTERFACE_H__ */
|
|
@ -1,49 +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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __ODM_PRECOMP_H__
|
||||
#define __ODM_PRECOMP_H__
|
||||
|
||||
/* 2 Config Flags and Structs - defined by each ODM Type */
|
||||
|
||||
#include <osdep_service.h>
|
||||
#include <drv_types.h>
|
||||
#include <hal_intf.h>
|
||||
|
||||
|
||||
/* 2 Hardware Parameter Files */
|
||||
#include "Hal8723UHWImg_CE.h"
|
||||
|
||||
|
||||
/* 2 OutSrc Header Files */
|
||||
|
||||
#include "odm.h"
|
||||
#include "odm_HWConfig.h"
|
||||
#include "odm_debug.h"
|
||||
#include "odm_RegDefine11N.h"
|
||||
|
||||
#include "HalDMOutSrc8723A.h" /* for IQK,LCK,Power-tracking */
|
||||
#include "rtl8723a_hal.h"
|
||||
|
||||
#include "odm_interface.h"
|
||||
#include "odm_reg.h"
|
||||
|
||||
#include "HalHWImg8723A_MAC.h"
|
||||
#include "HalHWImg8723A_RF.h"
|
||||
#include "HalHWImg8723A_BB.h"
|
||||
#include "HalHWImg8723A_FW.h"
|
||||
#include "odm_RegConfig8723A.h"
|
||||
|
||||
#endif /* __ODM_PRECOMP_H__ */
|
|
@ -1,111 +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.
|
||||
*
|
||||
******************************************************************************/
|
||||
/* */
|
||||
/* 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 BIT(0)
|
||||
|
||||
#endif
|
|
@ -1,45 +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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __OSDEP_INTF_H_
|
||||
#define __OSDEP_INTF_H_
|
||||
|
||||
#include <osdep_service.h>
|
||||
#include <drv_types.h>
|
||||
|
||||
int rtw_init_drv_sw23a(struct rtw_adapter *padapter);
|
||||
int rtw_free_drv_sw23a(struct rtw_adapter *padapter);
|
||||
int rtw_reset_drv_sw23a(struct rtw_adapter *padapter);
|
||||
|
||||
void rtw_cancel_all_timer23a(struct rtw_adapter *padapter);
|
||||
|
||||
int rtw_init_netdev23a_name23a(struct net_device *pnetdev, const char *ifname);
|
||||
struct net_device *rtw_init_netdev23a(struct rtw_adapter *padapter);
|
||||
|
||||
u16 rtw_recv_select_queue23a(struct sk_buff *skb);
|
||||
|
||||
void rtw_ips_dev_unload23a(struct rtw_adapter *padapter);
|
||||
|
||||
int rtw_ips_pwr_up23a(struct rtw_adapter *padapter);
|
||||
void rtw_ips_pwr_down23a(struct rtw_adapter *padapter);
|
||||
|
||||
int rtw_drv_register_netdev(struct rtw_adapter *padapter);
|
||||
void rtw_ndev_destructor(struct net_device *ndev);
|
||||
|
||||
int rtl8723au_inirp_init(struct rtw_adapter *Adapter);
|
||||
int rtl8723au_inirp_deinit(struct rtw_adapter *Adapter);
|
||||
void rtl8723a_usb_intf_stop(struct rtw_adapter *padapter);
|
||||
|
||||
#endif /* _OSDEP_INTF_H_ */
|
|
@ -1,87 +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.
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef __OSDEP_SERVICE_H_
|
||||
#define __OSDEP_SERVICE_H_
|
||||
|
||||
#define _FAIL 0
|
||||
#define _SUCCESS 1
|
||||
#define RTW_RX_HANDLED 2
|
||||
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/compiler.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/kref.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/skbuff.h>
|
||||
#include <linux/uaccess.h>
|
||||
#include <asm/byteorder.h>
|
||||
#include <linux/atomic.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/sem.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/wireless.h>
|
||||
#include <linux/if_arp.h>
|
||||
#include <linux/rtnetlink.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/interrupt.h> /* for struct tasklet_struct */
|
||||
#include <linux/ip.h>
|
||||
|
||||
#include <net/ieee80211_radiotap.h>
|
||||
#include <net/cfg80211.h>
|
||||
|
||||
struct rtw_queue {
|
||||
struct list_head queue;
|
||||
spinlock_t lock;
|
||||
};
|
||||
|
||||
static inline struct list_head *get_list_head(struct rtw_queue *queue)
|
||||
{
|
||||
return &queue->queue;
|
||||
}
|
||||
|
||||
static inline int rtw_netif_queue_stopped(struct net_device *pnetdev)
|
||||
{
|
||||
return (netif_tx_queue_stopped(netdev_get_tx_queue(pnetdev, 0)) &&
|
||||
netif_tx_queue_stopped(netdev_get_tx_queue(pnetdev, 1)) &&
|
||||
netif_tx_queue_stopped(netdev_get_tx_queue(pnetdev, 2)) &&
|
||||
netif_tx_queue_stopped(netdev_get_tx_queue(pnetdev, 3)));
|
||||
}
|
||||
|
||||
static inline u32 CHKBIT(u32 x)
|
||||
{
|
||||
WARN_ON(x >= 32);
|
||||
if (x >= 32)
|
||||
return 0;
|
||||
return BIT(x);
|
||||
}
|
||||
|
||||
extern unsigned char MCS_rate_2R23A[16];
|
||||
|
||||
extern unsigned char MCS_rate_2R23A[16];
|
||||
extern unsigned char MCS_rate_1R23A[16];
|
||||
|
||||
void _rtw_init_queue23a(struct rtw_queue *pqueue);
|
||||
|
||||
/* Macros for handling unaligned memory accesses */
|
||||
|
||||
#define RTW_GET_BE24(a) ((((u32) (a)[0]) << 16) | (((u32) (a)[1]) << 8) | \
|
||||
((u32) (a)[2]))
|
||||
|
||||
#endif
|
|
@ -1,36 +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.
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef __RECV_OSDEP_H_
|
||||
#define __RECV_OSDEP_H_
|
||||
|
||||
#include <osdep_service.h>
|
||||
#include <drv_types.h>
|
||||
|
||||
int _rtw_init_recv_priv23a(struct recv_priv *precvpriv, struct rtw_adapter *padapter);
|
||||
void _rtw_free_recv_priv23a (struct recv_priv *precvpriv);
|
||||
|
||||
int rtw_recv_entry23a(struct recv_frame *precv_frame);
|
||||
int rtw_recv_indicatepkt23a(struct rtw_adapter *adapter, struct recv_frame *precv_frame);
|
||||
|
||||
void rtw_handle_tkip_mic_err23a(struct rtw_adapter *padapter, u8 bgroup);
|
||||
|
||||
int rtw_init_recv_priv(struct recv_priv *precvpriv, struct rtw_adapter *padapter);
|
||||
void rtw_free_recv_priv (struct recv_priv *precvpriv);
|
||||
|
||||
int rtw_os_recv_resource_init(struct recv_priv *precvpriv, struct rtw_adapter *padapter);
|
||||
|
||||
void rtw_init_recv_timer23a(struct recv_reorder_ctrl *preorder_ctrl);
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
|
@ -1,69 +0,0 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved.
|
||||
* Copyright(c) 2014, Jes Sorensen <Jes.Sorensen@redhat.com>
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef __RTL8723A_BT_INTF_H__
|
||||
#define __RTL8723A_BT_INTF_H__
|
||||
|
||||
#include <drv_types.h>
|
||||
|
||||
#ifdef CONFIG_8723AU_BT_COEXIST
|
||||
enum rt_media_status;
|
||||
bool rtl8723a_BT_using_antenna_1(struct rtw_adapter *padapter);
|
||||
bool rtl8723a_BT_enabled(struct rtw_adapter *padapter);
|
||||
bool rtl8723a_BT_coexist(struct rtw_adapter *padapter);
|
||||
void rtl8723a_BT_do_coexist(struct rtw_adapter *padapter);
|
||||
void rtl8723a_BT_wifiscan_notify(struct rtw_adapter *padapter, u8 scanType);
|
||||
void rtl8723a_BT_mediastatus_notify(struct rtw_adapter *padapter,
|
||||
enum rt_media_status mstatus);
|
||||
void rtl8723a_BT_specialpacket_notify(struct rtw_adapter *padapter);
|
||||
void rtl8723a_BT_lps_leave(struct rtw_adapter *padapter);
|
||||
void rtl8723a_BT_disable_coexist(struct rtw_adapter *padapter);
|
||||
bool rtl8723a_BT_disable_EDCA_turbo(struct rtw_adapter *padapter);
|
||||
void rtl8723a_dual_antenna_detection(struct rtw_adapter *padapter);
|
||||
void rtl8723a_BT_init_hwconfig(struct rtw_adapter *padapter);
|
||||
void rtl8723a_BT_wifiassociate_notify(struct rtw_adapter *padapter, u8 action);
|
||||
void rtl8723a_BT_init_hal_vars(struct rtw_adapter *padapter);
|
||||
void rtl8723a_fw_c2h_BT_info(struct rtw_adapter *padapter, u8 *tmpBuf, u8 length);
|
||||
#else
|
||||
static inline bool rtl8723a_BT_using_antenna_1(struct rtw_adapter *padapter)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
static inline bool rtl8723a_BT_enabled(struct rtw_adapter *padapter)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
static inline bool rtl8723a_BT_coexist(struct rtw_adapter *padapter)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#define rtl8723a_BT_do_coexist(padapter) do {} while(0)
|
||||
#define rtl8723a_BT_wifiscan_notify(padapter, scanType) do {} while(0)
|
||||
#define rtl8723a_BT_mediastatus_notify(padapter, mstatus) do {} while(0)
|
||||
#define rtl8723a_BT_specialpacket_notify(padapter) do {} while(0)
|
||||
#define rtl8723a_BT_lps_leave(padapter) do {} while(0)
|
||||
#define rtl8723a_BT_disable_coexist(padapter) do {} while(0)
|
||||
static inline bool rtl8723a_BT_disable_EDCA_turbo(struct rtw_adapter *padapter)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#define rtl8723a_dual_antenna_detection(padapter) do {} while(0)
|
||||
#define rtl8723a_BT_init_hwconfig(padapter) do {} while(0)
|
||||
#define rtl8723a_BT_wifiassociate_notify(padapter, action) do {} while(0)
|
||||
#define rtl8723a_BT_init_hal_vars(padapter) do {} while(0)
|
||||
#define rtl8723a_fw_c2h_BT_info(padapter, tmpBuf, length) do {} while(0)
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -1,158 +0,0 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef __RTL8723A_CMD_H__
|
||||
#define __RTL8723A_CMD_H__
|
||||
|
||||
|
||||
#define H2C_BT_FW_PATCH_LEN 3
|
||||
#define H2C_BT_PWR_FORCE_LEN 3
|
||||
|
||||
enum cmd_msg_element_id
|
||||
{
|
||||
NONE_CMDMSG_EID,
|
||||
AP_OFFLOAD_EID = 0,
|
||||
SET_PWRMODE_EID = 1,
|
||||
JOINBSS_RPT_EID = 2,
|
||||
RSVD_PAGE_EID = 3,
|
||||
RSSI_4_EID = 4,
|
||||
RSSI_SETTING_EID = 5,
|
||||
MACID_CONFIG_EID = 6,
|
||||
MACID_PS_MODE_EID = 7,
|
||||
P2P_PS_OFFLOAD_EID = 8,
|
||||
SELECTIVE_SUSPEND_ROF_CMD = 9,
|
||||
BT_QUEUE_PKT_EID = 17,
|
||||
BT_ANT_TDMA_EID = 20,
|
||||
BT_2ANT_HID_EID = 21,
|
||||
P2P_PS_CTW_CMD_EID = 32,
|
||||
FORCE_BT_TX_PWR_EID = 33,
|
||||
SET_TDMA_WLAN_ACT_TIME_EID = 34,
|
||||
SET_BT_TX_RETRY_INDEX_EID = 35,
|
||||
HID_PROFILE_ENABLE_EID = 36,
|
||||
BT_IGNORE_WLAN_ACT_EID = 37,
|
||||
BT_PTA_MANAGER_UPDATE_ENABLE_EID = 38,
|
||||
DAC_SWING_VALUE_EID = 41,
|
||||
TRADITIONAL_TDMA_EN_EID = 51,
|
||||
H2C_BT_FW_PATCH = 54,
|
||||
B_TYPE_TDMA_EID = 58,
|
||||
SCAN_EN_EID = 59,
|
||||
LOWPWR_LPS_EID = 71,
|
||||
H2C_RESET_TSF = 75,
|
||||
MAX_CMDMSG_EID
|
||||
};
|
||||
|
||||
struct cmd_msg_parm {
|
||||
u8 eid; /* element id */
|
||||
u8 sz; /* sz */
|
||||
u8 buf[6];
|
||||
};
|
||||
|
||||
struct setpwrmode_parm {
|
||||
u8 Mode;
|
||||
u8 SmartPS;
|
||||
u8 AwakeInterval; /* unit: beacon interval */
|
||||
u8 bAllQueueUAPSD;
|
||||
|
||||
#define SETPM_LOWRXBCN BIT(0)
|
||||
#define SETPM_AUTOANTSWITCH BIT(1)
|
||||
#define SETPM_PSALLOWBTHIGHPRI BIT(2)
|
||||
u8 BcnAntMode;
|
||||
} __packed;
|
||||
|
||||
struct H2C_SS_RFOFF_PARAM{
|
||||
u8 ROFOn; /* 1: on, 0:off */
|
||||
u16 gpio_period; /* unit: 1024 us */
|
||||
}__attribute__ ((packed));
|
||||
|
||||
|
||||
struct joinbssrpt_parm {
|
||||
u8 OpMode; /* enum rt_media_status */
|
||||
};
|
||||
|
||||
struct rsvdpage_loc {
|
||||
u8 LocProbeRsp;
|
||||
u8 LocPsPoll;
|
||||
u8 LocNullData;
|
||||
u8 LocQosNull;
|
||||
u8 LocBTQosNull;
|
||||
};
|
||||
|
||||
struct P2P_PS_Offload_t {
|
||||
u8 Offload_En:1;
|
||||
u8 role:1; /* 1: Owner, 0: Client */
|
||||
u8 CTWindow_En:1;
|
||||
u8 NoA0_En:1;
|
||||
u8 NoA1_En:1;
|
||||
u8 AllStaSleep:1; /* Only valid in Owner */
|
||||
u8 discovery:1;
|
||||
u8 rsvd:1;
|
||||
};
|
||||
|
||||
struct P2P_PS_CTWPeriod_t {
|
||||
u8 CTWPeriod; /* TU */
|
||||
};
|
||||
|
||||
#define B_TDMA_EN BIT(0)
|
||||
#define B_TDMA_FIXANTINBT BIT(1)
|
||||
#define B_TDMA_TXPSPOLL BIT(2)
|
||||
#define B_TDMA_VAL870 BIT(3)
|
||||
#define B_TDMA_AUTOWAKEUP BIT(4)
|
||||
#define B_TDMA_NOPS BIT(5)
|
||||
#define B_TDMA_WLANHIGHPRI BIT(6)
|
||||
|
||||
struct b_type_tdma_parm {
|
||||
u8 option;
|
||||
|
||||
u8 TBTTOnPeriod;
|
||||
u8 MedPeriod;
|
||||
u8 rsvd30;
|
||||
} __packed;
|
||||
|
||||
struct scan_en_parm {
|
||||
u8 En;
|
||||
} __packed;
|
||||
|
||||
/* BT_PWR */
|
||||
#define SET_H2CCMD_BT_PWR_IDX(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT(__pH2CCmd, 0, 8, __Value)
|
||||
|
||||
/* BT_FW_PATCH */
|
||||
#define SET_H2CCMD_BT_FW_PATCH_ENABLE(__pH2CCmd, __Value) SET_BITS_TO_LE_4BYTE(__pH2CCmd, 0, 8, __Value) /* SET_BITS_TO_LE_1BYTE(__pH2CCmd, 0, 8, __Value) */
|
||||
#define SET_H2CCMD_BT_FW_PATCH_SIZE(__pH2CCmd, __Value) SET_BITS_TO_LE_4BYTE(__pH2CCmd, 8, 16, __Value) /* SET_BITS_TO_LE_2BYTE((__pH2CCmd)+1, 0, 16, __Value) */
|
||||
|
||||
struct lowpwr_lps_parm{
|
||||
u8 bcn_count:4;
|
||||
u8 tb_bcn_threshold:3;
|
||||
u8 enable:1;
|
||||
u8 bcn_interval;
|
||||
u8 drop_threshold;
|
||||
u8 max_early_period;
|
||||
u8 max_bcn_timeout_period;
|
||||
} __packed;
|
||||
|
||||
|
||||
/* host message to firmware cmd */
|
||||
void rtl8723a_set_FwPwrMode_cmd(struct rtw_adapter *padapter, u8 Mode);
|
||||
void rtl8723a_set_FwJoinBssReport_cmd(struct rtw_adapter *padapter, u8 mstatus);
|
||||
#ifdef CONFIG_8723AU_BT_COEXIST
|
||||
void rtl8723a_set_BTCoex_AP_mode_FwRsvdPkt_cmd(struct rtw_adapter *padapter);
|
||||
#else
|
||||
#define rtl8723a_set_BTCoex_AP_mode_FwRsvdPkt_cmd(padapter) do {} while(0)
|
||||
#endif
|
||||
int rtl8723a_set_rssi_cmd(struct rtw_adapter *padapter, u32 param);
|
||||
int rtl8723a_set_raid_cmd(struct rtw_adapter *padapter, u32 mask, u8 arg);
|
||||
void rtl8723a_add_rateatid(struct rtw_adapter *padapter, u32 bitmap, u8 arg, u8 rssi_level);
|
||||
|
||||
int FillH2CCmd(struct rtw_adapter *padapter, u8 ElementID, u32 CmdLen, u8 *pCmdBuffer);
|
||||
|
||||
#endif
|
|
@ -1,137 +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.
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef __RTL8723A_DM_H__
|
||||
#define __RTL8723A_DM_H__
|
||||
/* */
|
||||
/* Description: */
|
||||
/* */
|
||||
/* This file is for 8723A dynamic mechanism only */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
#define DYNAMIC_FUNC_BT BIT(0)
|
||||
|
||||
enum{
|
||||
UP_LINK,
|
||||
DOWN_LINK,
|
||||
};
|
||||
/* */
|
||||
/* structure and define */
|
||||
/* */
|
||||
|
||||
/* duplicate code,will move to ODM ######### */
|
||||
#define IQK_MAC_REG_NUM 4
|
||||
#define IQK_ADDA_REG_NUM 16
|
||||
#define IQK_BB_REG_NUM 9
|
||||
#define HP_THERMAL_NUM 8
|
||||
/* duplicate code,will move to ODM ######### */
|
||||
struct dm_priv {
|
||||
u32 InitODMFlag;
|
||||
|
||||
/* Upper and Lower Signal threshold for Rate Adaptive*/
|
||||
int UndecoratedSmoothedPWDB;
|
||||
int UndecoratedSmoothedCCK;
|
||||
int EntryMinUndecoratedSmoothedPWDB;
|
||||
int EntryMaxUndecoratedSmoothedPWDB;
|
||||
int MinUndecoratedPWDBForDM;
|
||||
int LastMinUndecoratedPWDBForDM;
|
||||
|
||||
s32 UndecoratedSmoothedBeacon;
|
||||
#ifdef CONFIG_8723AU_BT_COEXIST
|
||||
s32 BT_EntryMinUndecoratedSmoothedPWDB;
|
||||
s32 BT_EntryMaxUndecoratedSmoothedPWDB;
|
||||
#endif
|
||||
|
||||
/* for High Power */
|
||||
u8 DynamicTxHighPowerLvl;/* Add by Jacken Tx Power Control for Near/Far Range 2008/03/06 */
|
||||
|
||||
/* for tx power tracking */
|
||||
u8 bTXPowerTracking;
|
||||
u8 TXPowercount;
|
||||
u8 bTXPowerTrackingInit;
|
||||
u8 TxPowerTrackControl; /* for mp mode, turn off txpwrtracking as default */
|
||||
u8 TM_Trigger;
|
||||
|
||||
u8 ThermalMeter[2]; /* ThermalMeter, index 0 for RFIC0, and 1 for RFIC1 */
|
||||
u8 ThermalValue;
|
||||
u8 ThermalValue_LCK;
|
||||
u8 ThermalValue_IQK;
|
||||
u8 ThermalValue_DPK;
|
||||
|
||||
u8 bRfPiEnable;
|
||||
|
||||
/* for APK */
|
||||
u32 APKoutput[2][2]; /* path A/B; output1_1a/output1_2a */
|
||||
u8 bAPKdone;
|
||||
u8 bAPKThermalMeterIgnore;
|
||||
u8 bDPdone;
|
||||
u8 bDPPathAOK;
|
||||
u8 bDPPathBOK;
|
||||
|
||||
/* for IQK */
|
||||
u32 RegC04;
|
||||
u32 Reg874;
|
||||
u32 RegC08;
|
||||
u32 RegB68;
|
||||
u32 RegB6C;
|
||||
u32 Reg870;
|
||||
u32 Reg860;
|
||||
u32 Reg864;
|
||||
u32 ADDA_backup[IQK_ADDA_REG_NUM];
|
||||
u32 IQK_MAC_backup[IQK_MAC_REG_NUM];
|
||||
u32 IQK_BB_backup_recover[9];
|
||||
u32 IQK_BB_backup[IQK_BB_REG_NUM];
|
||||
u8 PowerIndex_backup[6];
|
||||
|
||||
u8 bCCKinCH14;
|
||||
|
||||
u8 CCK_index;
|
||||
u8 OFDM_index[2];
|
||||
|
||||
u8 bDoneTxpower;
|
||||
u8 CCK_index_HP;
|
||||
u8 OFDM_index_HP[2];
|
||||
u8 ThermalValue_HP[HP_THERMAL_NUM];
|
||||
u8 ThermalValue_HP_index;
|
||||
|
||||
/* for TxPwrTracking */
|
||||
s32 RegE94;
|
||||
s32 RegE9C;
|
||||
s32 RegEB4;
|
||||
s32 RegEBC;
|
||||
|
||||
u32 TXPowerTrackingCallbackCnt; /* cosa add for debug */
|
||||
|
||||
u32 prv_traffic_idx; /* edca turbo */
|
||||
|
||||
s32 OFDM_Pkt_Cnt;
|
||||
u8 RSSI_Select;
|
||||
/* u8 DIG_Dynamic_MIN ; */
|
||||
/* duplicate code,will move to ODM ######### */
|
||||
/* Add for Reading Initial Data Rate SEL Register 0x484 during watchdog. Using for fill tx desc. 2011.3.21 by Thomas */
|
||||
u8 INIDATA_RATE[32];
|
||||
};
|
||||
|
||||
|
||||
/* */
|
||||
/* function prototype */
|
||||
/* */
|
||||
|
||||
void rtl8723a_init_dm_priv(struct rtw_adapter *padapter);
|
||||
|
||||
void rtl8723a_InitHalDm(struct rtw_adapter *padapter);
|
||||
void rtl8723a_HalDmWatchDog(struct rtw_adapter *padapter);
|
||||
|
||||
#endif
|
|
@ -1,538 +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.
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef __RTL8723A_HAL_H__
|
||||
#define __RTL8723A_HAL_H__
|
||||
|
||||
#include "rtl8723a_spec.h"
|
||||
#include "rtl8723a_pg.h"
|
||||
#include "Hal8723APhyReg.h"
|
||||
#include "Hal8723APhyCfg.h"
|
||||
#include "rtl8723a_rf.h"
|
||||
#include "rtl8723a_bt_intf.h"
|
||||
#ifdef CONFIG_8723AU_BT_COEXIST
|
||||
#include "rtl8723a_bt-coexist.h"
|
||||
#endif
|
||||
#include "rtl8723a_dm.h"
|
||||
#include "rtl8723a_recv.h"
|
||||
#include "rtl8723a_xmit.h"
|
||||
#include "rtl8723a_cmd.h"
|
||||
#include "rtl8723a_sreset.h"
|
||||
#include "rtw_efuse.h"
|
||||
#include "rtw_eeprom.h"
|
||||
|
||||
#include "odm_precomp.h"
|
||||
#include "odm.h"
|
||||
|
||||
|
||||
/* 2TODO: We should define 8192S firmware related macro settings here!! */
|
||||
#define RTL819X_DEFAULT_RF_TYPE RF_1T2R
|
||||
#define RTL819X_TOTAL_RF_PATH 2
|
||||
|
||||
/* */
|
||||
/* RTL8723S From header */
|
||||
/* */
|
||||
|
||||
/* Fw Array */
|
||||
#define Rtl8723_FwImageArray Rtl8723UFwImgArray
|
||||
#define Rtl8723_FwUMCBCutImageArrayWithBT Rtl8723UFwUMCBCutImgArrayWithBT
|
||||
#define Rtl8723_FwUMCBCutImageArrayWithoutBT Rtl8723UFwUMCBCutImgArrayWithoutBT
|
||||
|
||||
#define Rtl8723_ImgArrayLength Rtl8723UImgArrayLength
|
||||
#define Rtl8723_UMCBCutImgArrayWithBTLength Rtl8723UUMCBCutImgArrayWithBTLength
|
||||
#define Rtl8723_UMCBCutImgArrayWithoutBTLength Rtl8723UUMCBCutImgArrayWithoutBTLength
|
||||
|
||||
#define Rtl8723_PHY_REG_Array_PG Rtl8723UPHY_REG_Array_PG
|
||||
#define Rtl8723_PHY_REG_Array_PGLength Rtl8723UPHY_REG_Array_PGLength
|
||||
|
||||
#define Rtl8723_FwUMCBCutMPImageArray Rtl8723SFwUMCBCutMPImgAr
|
||||
#define Rtl8723_UMCBCutMPImgArrayLength Rtl8723SUMCBCutMPImgArrayLength
|
||||
|
||||
#define DRVINFO_SZ 4 /* unit is 8bytes */
|
||||
#define PageNum_128(_Len) (u32)(((_Len)>>7) + ((_Len)&0x7F ? 1:0))
|
||||
|
||||
#define FW_8723A_SIZE 0x8000
|
||||
#define FW_8723A_START_ADDRESS 0x1000
|
||||
#define FW_8723A_END_ADDRESS 0x1FFF /* 0x5FFF */
|
||||
|
||||
#define MAX_PAGE_SIZE 4096 /* @ page : 4k bytes */
|
||||
|
||||
#define IS_FW_HEADER_EXIST(_pFwHdr) ((le16_to_cpu(_pFwHdr->Signature)&0xFFF0) == 0x92C0 ||\
|
||||
(le16_to_cpu(_pFwHdr->Signature)&0xFFF0) == 0x88C0 ||\
|
||||
(le16_to_cpu(_pFwHdr->Signature)&0xFFF0) == 0x2300)
|
||||
|
||||
/* */
|
||||
/* This structure must be cared byte-ordering */
|
||||
/* */
|
||||
/* Added by tynli. 2009.12.04. */
|
||||
struct rt_8723a_firmware_hdr {
|
||||
/* 8-byte alinment required */
|
||||
|
||||
/* LONG WORD 0 ---- */
|
||||
__le16 Signature; /*
|
||||
* 92C0: test chip; 92C, 88C0: test chip;
|
||||
* 88C1: MP A-cut; 92C1: MP A-cut
|
||||
*/
|
||||
u8 Category; /* AP/NIC and USB/PCI */
|
||||
u8 Function; /* Reserved for different FW function indcation, for further use when driver needs to download different FW in different conditions */
|
||||
__le16 Version; /* FW Version */
|
||||
u8 Subversion; /* FW Subversion, default 0x00 */
|
||||
u8 Rsvd1;
|
||||
|
||||
|
||||
/* LONG WORD 1 ---- */
|
||||
u8 Month; /* Release time Month field */
|
||||
u8 Date; /* Release time Date field */
|
||||
u8 Hour; /* Release time Hour field */
|
||||
u8 Minute; /* Release time Minute field */
|
||||
__le16 RamCodeSize; /* The size of RAM code */
|
||||
__le16 Rsvd2;
|
||||
|
||||
/* LONG WORD 2 ---- */
|
||||
__le32 SvnIdx; /* The SVN entry index */
|
||||
__le32 Rsvd3;
|
||||
|
||||
/* LONG WORD 3 ---- */
|
||||
__le32 Rsvd4;
|
||||
__le32 Rsvd5;
|
||||
};
|
||||
|
||||
#define DRIVER_EARLY_INT_TIME 0x05
|
||||
#define BCN_DMA_ATIME_INT_TIME 0x02
|
||||
|
||||
|
||||
/* BK, BE, VI, VO, HCCA, MANAGEMENT, COMMAND, HIGH, BEACON. */
|
||||
#define MAX_TX_QUEUE 9
|
||||
|
||||
#define TX_SELE_HQ BIT(0) /* High Queue */
|
||||
#define TX_SELE_LQ BIT(1) /* Low Queue */
|
||||
#define TX_SELE_NQ BIT(2) /* Normal Queue */
|
||||
|
||||
/* Note: We will divide number of page equally for each queue other than public queue! */
|
||||
#define TX_TOTAL_PAGE_NUMBER 0xF8
|
||||
#define TX_PAGE_BOUNDARY (TX_TOTAL_PAGE_NUMBER + 1)
|
||||
|
||||
/* For Normal Chip Setting */
|
||||
/* (HPQ + LPQ + NPQ + PUBQ) shall be TX_TOTAL_PAGE_NUMBER */
|
||||
#define NORMAL_PAGE_NUM_PUBQ 0xE7
|
||||
#define NORMAL_PAGE_NUM_HPQ 0x0C
|
||||
#define NORMAL_PAGE_NUM_LPQ 0x02
|
||||
#define NORMAL_PAGE_NUM_NPQ 0x02
|
||||
|
||||
/* For Test Chip Setting */
|
||||
/* (HPQ + LPQ + PUBQ) shall be TX_TOTAL_PAGE_NUMBER */
|
||||
#define TEST_PAGE_NUM_PUBQ 0x7E
|
||||
|
||||
/* For Test Chip Setting */
|
||||
#define WMM_TEST_TX_TOTAL_PAGE_NUMBER 0xF5
|
||||
#define WMM_TEST_TX_PAGE_BOUNDARY (WMM_TEST_TX_TOTAL_PAGE_NUMBER + 1) /* F6 */
|
||||
|
||||
#define WMM_TEST_PAGE_NUM_PUBQ 0xA3
|
||||
#define WMM_TEST_PAGE_NUM_HPQ 0x29
|
||||
#define WMM_TEST_PAGE_NUM_LPQ 0x29
|
||||
|
||||
/* Note: For Normal Chip Setting, modify later */
|
||||
#define WMM_NORMAL_TX_TOTAL_PAGE_NUMBER 0xF5
|
||||
#define WMM_NORMAL_TX_PAGE_BOUNDARY (WMM_TEST_TX_TOTAL_PAGE_NUMBER + 1) /* F6 */
|
||||
|
||||
#define WMM_NORMAL_PAGE_NUM_PUBQ 0xB0
|
||||
#define WMM_NORMAL_PAGE_NUM_HPQ 0x29
|
||||
#define WMM_NORMAL_PAGE_NUM_LPQ 0x1C
|
||||
#define WMM_NORMAL_PAGE_NUM_NPQ 0x1C
|
||||
|
||||
|
||||
/* */
|
||||
/* Chip specific */
|
||||
/* */
|
||||
#define CHIP_BONDING_IDENTIFIER(_value) (((_value)>>22)&0x3)
|
||||
#define CHIP_BONDING_92C_1T2R 0x1
|
||||
#define CHIP_BONDING_88C_USB_MCARD 0x2
|
||||
#define CHIP_BONDING_88C_USB_HP 0x1
|
||||
|
||||
#include "HalVerDef.h"
|
||||
#include "hal_com.h"
|
||||
|
||||
/* */
|
||||
/* Channel Plan */
|
||||
/* */
|
||||
enum ChannelPlan
|
||||
{
|
||||
CHPL_FCC = 0,
|
||||
CHPL_IC = 1,
|
||||
CHPL_ETSI = 2,
|
||||
CHPL_SPAIN = 3,
|
||||
CHPL_FRANCE = 4,
|
||||
CHPL_MKK = 5,
|
||||
CHPL_MKK1 = 6,
|
||||
CHPL_ISRAEL = 7,
|
||||
CHPL_TELEC = 8,
|
||||
CHPL_GLOBAL = 9,
|
||||
CHPL_WORLD = 10,
|
||||
};
|
||||
|
||||
#define EFUSE_REAL_CONTENT_LEN 512
|
||||
#define EFUSE_MAP_LEN 128
|
||||
#define EFUSE_MAX_SECTION 16
|
||||
#define EFUSE_IC_ID_OFFSET 506 /* For some inferiority IC purpose. added by Roger, 2009.09.02. */
|
||||
#define AVAILABLE_EFUSE_ADDR(addr) (addr < EFUSE_REAL_CONTENT_LEN)
|
||||
/* */
|
||||
/* <Roger_Notes> */
|
||||
/* To prevent out of boundary programming case, */
|
||||
/* leave 1byte and program full section */
|
||||
/* 9bytes + 1byt + 5bytes and pre 1byte. */
|
||||
/* For worst case: */
|
||||
/* | 1byte|----8bytes----|1byte|--5bytes--| */
|
||||
/* | | Reserved(14bytes) | */
|
||||
/* */
|
||||
|
||||
/* PG data exclude header, dummy 6 bytes from CP test and reserved 1byte. */
|
||||
#define EFUSE_OOB_PROTECT_BYTES 15
|
||||
|
||||
#define EFUSE_REAL_CONTENT_LEN_8723A 512
|
||||
#define EFUSE_MAP_LEN_8723A 256
|
||||
#define EFUSE_MAX_SECTION_8723A 32
|
||||
|
||||
/* */
|
||||
/* EFUSE for BT definition */
|
||||
/* */
|
||||
#define EFUSE_BT_REAL_BANK_CONTENT_LEN 512
|
||||
#define EFUSE_BT_REAL_CONTENT_LEN 1536 /* 512*3 */
|
||||
#define EFUSE_BT_MAP_LEN 1024 /* 1k bytes */
|
||||
#define EFUSE_BT_MAX_SECTION 128 /* 1024/8 */
|
||||
|
||||
#define EFUSE_PROTECT_BYTES_BANK 16
|
||||
|
||||
/* */
|
||||
/* <Roger_Notes> For RTL8723 WiFi/BT/GPS multi-function configuration. 2010.10.06. */
|
||||
/* */
|
||||
enum RT_MULTI_FUNC {
|
||||
RT_MULTI_FUNC_NONE = 0x00,
|
||||
RT_MULTI_FUNC_WIFI = 0x01,
|
||||
RT_MULTI_FUNC_BT = 0x02,
|
||||
RT_MULTI_FUNC_GPS = 0x04,
|
||||
};
|
||||
|
||||
/* */
|
||||
/* <Roger_Notes> For RTL8723 WiFi PDn/GPIO polarity control configuration. 2010.10.08. */
|
||||
/* */
|
||||
enum RT_POLARITY_CTL {
|
||||
RT_POLARITY_LOW_ACT = 0,
|
||||
RT_POLARITY_HIGH_ACT = 1,
|
||||
};
|
||||
|
||||
/* For RTL8723 regulator mode. by tynli. 2011.01.14. */
|
||||
enum RT_REGULATOR_MODE {
|
||||
RT_SWITCHING_REGULATOR = 0,
|
||||
RT_LDO_REGULATOR = 1,
|
||||
};
|
||||
|
||||
/* Description: Determine the types of C2H events that are the same in driver and Fw. */
|
||||
/* Fisrt constructed by tynli. 2009.10.09. */
|
||||
enum {
|
||||
C2H_DBG = 0,
|
||||
C2H_TSF = 1,
|
||||
C2H_AP_RPT_RSP = 2,
|
||||
C2H_CCX_TX_RPT = 3, /* The FW notify the report of the specific tx packet. */
|
||||
C2H_BT_RSSI = 4,
|
||||
C2H_BT_OP_MODE = 5,
|
||||
C2H_EXT_RA_RPT = 6,
|
||||
C2H_HW_INFO_EXCH = 10,
|
||||
C2H_C2H_H2C_TEST = 11,
|
||||
C2H_BT_INFO = 12,
|
||||
C2H_BT_MP_INFO = 15,
|
||||
MAX_C2HEVENT
|
||||
};
|
||||
|
||||
struct hal_data_8723a {
|
||||
struct hal_version VersionID;
|
||||
enum rt_customer_id CustomerID;
|
||||
|
||||
u16 FirmwareVersion;
|
||||
u16 FirmwareVersionRev;
|
||||
u16 FirmwareSubVersion;
|
||||
u16 FirmwareSignature;
|
||||
|
||||
/* current WIFI_PHY values */
|
||||
u32 ReceiveConfig;
|
||||
enum WIRELESS_MODE CurrentWirelessMode;
|
||||
enum ht_channel_width CurrentChannelBW;
|
||||
u8 CurrentChannel;
|
||||
u8 nCur40MhzPrimeSC;/* Control channel sub-carrier */
|
||||
|
||||
u16 BasicRateSet;
|
||||
|
||||
/* rf_ctrl */
|
||||
u8 rf_type;
|
||||
u8 NumTotalRFPath;
|
||||
|
||||
u8 BoardType;
|
||||
u8 CrystalCap;
|
||||
/* */
|
||||
/* EEPROM setting. */
|
||||
/* */
|
||||
u8 EEPROMVersion;
|
||||
u8 EEPROMCustomerID;
|
||||
u8 EEPROMSubCustomerID;
|
||||
u8 EEPROMRegulatory;
|
||||
u8 EEPROMThermalMeter;
|
||||
u8 EEPROMBluetoothCoexist;
|
||||
u8 EEPROMBluetoothType;
|
||||
u8 EEPROMBluetoothAntNum;
|
||||
u8 EEPROMBluetoothAntIsolation;
|
||||
u8 EEPROMBluetoothRadioShared;
|
||||
|
||||
u8 bTXPowerDataReadFromEEPORM;
|
||||
u8 bAPKThermalMeterIgnore;
|
||||
|
||||
u8 bIQKInitialized;
|
||||
u8 bAntennaDetected;
|
||||
|
||||
u8 TxPwrLevelCck[RF_PATH_MAX][CHANNEL_MAX_NUMBER];
|
||||
u8 TxPwrLevelHT40_1S[RF_PATH_MAX][CHANNEL_MAX_NUMBER]; /* For HT 40MHZ pwr */
|
||||
u8 TxPwrLevelHT40_2S[RF_PATH_MAX][CHANNEL_MAX_NUMBER]; /* For HT 40MHZ pwr */
|
||||
u8 TxPwrHt20Diff[RF_PATH_MAX][CHANNEL_MAX_NUMBER];/* HT 20<->40 Pwr diff */
|
||||
u8 TxPwrLegacyHtDiff[RF_PATH_MAX][CHANNEL_MAX_NUMBER];/* For HT<->legacy pwr diff */
|
||||
/* For power group */
|
||||
u8 PwrGroupHT20[RF_PATH_MAX][CHANNEL_MAX_NUMBER];
|
||||
u8 PwrGroupHT40[RF_PATH_MAX][CHANNEL_MAX_NUMBER];
|
||||
|
||||
u8 LegacyHTTxPowerDiff;/* Legacy to HT rate power diff */
|
||||
|
||||
/* Read/write are allow for following hardware information variables */
|
||||
u8 framesync;
|
||||
u32 framesyncC34;
|
||||
u8 framesyncMonitor;
|
||||
u8 pwrGroupCnt;
|
||||
u32 MCSTxPowerLevelOriginalOffset[7][16];
|
||||
u32 CCKTxPowerLevelOriginalOffset;
|
||||
|
||||
u32 AntennaTxPath; /* Antenna path Tx */
|
||||
u32 AntennaRxPath; /* Antenna path Rx */
|
||||
u8 ExternalPA;
|
||||
|
||||
u8 bLedOpenDrain; /* Support Open-drain arrangement for controlling the LED. Added by Roger, 2009.10.16. */
|
||||
|
||||
u8 b1x1RecvCombine; /* for 1T1R receive combining */
|
||||
|
||||
/* For EDCA Turbo mode */
|
||||
|
||||
u32 AcParam_BE; /* Original parameter for BE, use for EDCA turbo. */
|
||||
|
||||
/* vivi, for tx power tracking, 20080407 */
|
||||
/* u16 TSSI_13dBm; */
|
||||
/* u32 Pwr_Track; */
|
||||
/* The current Tx Power Level */
|
||||
u8 CurrentCckTxPwrIdx;
|
||||
u8 CurrentOfdm24GTxPwrIdx;
|
||||
|
||||
struct bb_reg_define PHYRegDef[4]; /* Radio A/B/C/D */
|
||||
|
||||
bool bRFPathRxEnable[4]; /* We support 4 RF path now. */
|
||||
|
||||
u32 RfRegChnlVal[2];
|
||||
|
||||
u8 bCckHighPower;
|
||||
|
||||
/* RDG enable */
|
||||
bool bRDGEnable;
|
||||
|
||||
/* for host message to fw */
|
||||
u8 LastHMEBoxNum;
|
||||
|
||||
u8 RegTxPause;
|
||||
/* Beacon function related global variable. */
|
||||
u8 RegFwHwTxQCtrl;
|
||||
u8 RegReg542;
|
||||
|
||||
struct dm_priv dmpriv;
|
||||
struct dm_odm_t odmpriv;
|
||||
struct sreset_priv srestpriv;
|
||||
|
||||
#ifdef CONFIG_8723AU_BT_COEXIST
|
||||
u8 bBTMode;
|
||||
/* BT only. */
|
||||
struct bt_30info BtInfo;
|
||||
/* For bluetooth co-existance */
|
||||
struct bt_coexist_str bt_coexist;
|
||||
#endif
|
||||
|
||||
u8 bDumpRxPkt;/* for debug */
|
||||
u8 FwRsvdPageStartOffset; /* 2010.06.23. Added by tynli. Reserve page start offset except beacon in TxQ. */
|
||||
|
||||
/* 2010/08/09 MH Add CU power down mode. */
|
||||
u8 pwrdown;
|
||||
|
||||
u8 OutEpQueueSel;
|
||||
u8 OutEpNumber;
|
||||
|
||||
/* */
|
||||
/* Add For EEPROM Efuse switch and Efuse Shadow map Setting */
|
||||
/* */
|
||||
u8 EepromOrEfuse;
|
||||
u16 EfuseUsedBytes;
|
||||
u16 BTEfuseUsedBytes;
|
||||
|
||||
/* Interrupt relatd register information. */
|
||||
u32 SysIntrStatus;
|
||||
u32 SysIntrMask;
|
||||
|
||||
/* */
|
||||
/* 2011/02/23 MH Add for 8723 mylti function definition. The define should be moved to an */
|
||||
/* independent file in the future. */
|
||||
/* */
|
||||
/* 8723-----------------------------------------*/
|
||||
enum RT_MULTI_FUNC MultiFunc; /* For multi-function consideration. */
|
||||
enum RT_POLARITY_CTL PolarityCtl; /* For Wifi PDn Polarity control. */
|
||||
enum RT_REGULATOR_MODE RegulatorMode; /* switching regulator or LDO */
|
||||
/* 8723-----------------------------------------
|
||||
* 2011/02/23 MH Add for 8723 mylti function definition. The define should be moved to an */
|
||||
/* independent file in the future. */
|
||||
|
||||
/* Interrupt related register information. */
|
||||
u32 IntArray[2];
|
||||
u32 IntrMask[2];
|
||||
};
|
||||
|
||||
#define GET_HAL_DATA(__pAdapter) ((struct hal_data_8723a *)((__pAdapter)->HalData))
|
||||
#define GET_RF_TYPE(priv) (GET_HAL_DATA(priv)->rf_type)
|
||||
|
||||
#define INCLUDE_MULTI_FUNC_BT(_Adapter) (GET_HAL_DATA(_Adapter)->MultiFunc & RT_MULTI_FUNC_BT)
|
||||
#define INCLUDE_MULTI_FUNC_GPS(_Adapter) (GET_HAL_DATA(_Adapter)->MultiFunc & RT_MULTI_FUNC_GPS)
|
||||
|
||||
struct rxreport_8723a {
|
||||
u32 pktlen:14;
|
||||
u32 crc32:1;
|
||||
u32 icverr:1;
|
||||
u32 drvinfosize:4;
|
||||
u32 security:3;
|
||||
u32 qos:1;
|
||||
u32 shift:2;
|
||||
u32 physt:1;
|
||||
u32 swdec:1;
|
||||
u32 ls:1;
|
||||
u32 fs:1;
|
||||
u32 eor:1;
|
||||
u32 own:1;
|
||||
|
||||
u32 macid:5;
|
||||
u32 tid:4;
|
||||
u32 hwrsvd:4;
|
||||
u32 amsdu:1;
|
||||
u32 paggr:1;
|
||||
u32 faggr:1;
|
||||
u32 a1fit:4;
|
||||
u32 a2fit:4;
|
||||
u32 pam:1;
|
||||
u32 pwr:1;
|
||||
u32 md:1;
|
||||
u32 mf:1;
|
||||
u32 type:2;
|
||||
u32 mc:1;
|
||||
u32 bc:1;
|
||||
|
||||
u32 seq:12;
|
||||
u32 frag:4;
|
||||
u32 nextpktlen:14;
|
||||
u32 nextind:1;
|
||||
u32 rsvd0831:1;
|
||||
|
||||
u32 rxmcs:6;
|
||||
u32 rxht:1;
|
||||
u32 gf:1;
|
||||
u32 splcp:1;
|
||||
u32 bw:1;
|
||||
u32 htc:1;
|
||||
u32 eosp:1;
|
||||
u32 bssidfit:2;
|
||||
u32 rsvd1214:16;
|
||||
u32 unicastwake:1;
|
||||
u32 magicwake:1;
|
||||
|
||||
u32 pattern0match:1;
|
||||
u32 pattern1match:1;
|
||||
u32 pattern2match:1;
|
||||
u32 pattern3match:1;
|
||||
u32 pattern4match:1;
|
||||
u32 pattern5match:1;
|
||||
u32 pattern6match:1;
|
||||
u32 pattern7match:1;
|
||||
u32 pattern8match:1;
|
||||
u32 pattern9match:1;
|
||||
u32 patternamatch:1;
|
||||
u32 patternbmatch:1;
|
||||
u32 patterncmatch:1;
|
||||
u32 rsvd1613:19;
|
||||
|
||||
u32 tsfl;
|
||||
|
||||
u32 bassn:12;
|
||||
u32 bavld:1;
|
||||
u32 rsvd2413:19;
|
||||
};
|
||||
|
||||
/* rtl8723a_hal_init.c */
|
||||
s32 rtl8723a_FirmwareDownload(struct rtw_adapter *padapter);
|
||||
void rtl8723a_FirmwareSelfReset(struct rtw_adapter *padapter);
|
||||
void rtl8723a_InitializeFirmwareVars(struct rtw_adapter *padapter);
|
||||
|
||||
void rtl8723a_InitAntenna_Selection(struct rtw_adapter *padapter);
|
||||
void rtl8723a_DeinitAntenna_Selection(struct rtw_adapter *padapter);
|
||||
void rtl8723a_CheckAntenna_Selection(struct rtw_adapter *padapter);
|
||||
void rtl8723a_init_default_value(struct rtw_adapter *padapter);
|
||||
|
||||
s32 InitLLTTable23a(struct rtw_adapter *padapter, u32 boundary);
|
||||
|
||||
s32 CardDisableHWSM(struct rtw_adapter *padapter, u8 resetMCU);
|
||||
s32 CardDisableWithoutHWSM(struct rtw_adapter *padapter);
|
||||
|
||||
/* EFuse */
|
||||
u8 GetEEPROMSize8723A(struct rtw_adapter *padapter);
|
||||
void Hal_InitPGData(struct rtw_adapter *padapter, u8 *PROMContent);
|
||||
void Hal_EfuseParseIDCode(struct rtw_adapter *padapter, u8 *hwinfo);
|
||||
void Hal_EfuseParsetxpowerinfo_8723A(struct rtw_adapter *padapter, u8 *PROMContent, bool AutoLoadFail);
|
||||
void Hal_EfuseParseBTCoexistInfo_8723A(struct rtw_adapter *padapter, u8 *hwinfo, bool AutoLoadFail);
|
||||
void Hal_EfuseParseEEPROMVer(struct rtw_adapter *padapter, u8 *hwinfo, bool AutoLoadFail);
|
||||
void rtl8723a_EfuseParseChnlPlan(struct rtw_adapter *padapter, u8 *hwinfo, bool AutoLoadFail);
|
||||
void Hal_EfuseParseCustomerID(struct rtw_adapter *padapter, u8 *hwinfo, bool AutoLoadFail);
|
||||
void Hal_EfuseParseAntennaDiversity(struct rtw_adapter *padapter, u8 *hwinfo, bool AutoLoadFail);
|
||||
void Hal_EfuseParseRateIndicationOption(struct rtw_adapter *padapter, u8 *hwinfo, bool AutoLoadFail);
|
||||
void Hal_EfuseParseXtal_8723A(struct rtw_adapter *pAdapter, u8 *hwinfo, u8 AutoLoadFail);
|
||||
void Hal_EfuseParseThermalMeter_8723A(struct rtw_adapter *padapter, u8 *hwinfo, bool AutoLoadFail);
|
||||
|
||||
/* register */
|
||||
void SetBcnCtrlReg23a(struct rtw_adapter *padapter, u8 SetBits, u8 ClearBits);
|
||||
void rtl8723a_InitBeaconParameters(struct rtw_adapter *padapter);
|
||||
|
||||
void rtl8723a_start_thread(struct rtw_adapter *padapter);
|
||||
void rtl8723a_stop_thread(struct rtw_adapter *padapter);
|
||||
|
||||
bool c2h_id_filter_ccx_8723a(u8 id);
|
||||
int c2h_handler_8723a(struct rtw_adapter *padapter, struct c2h_evt_hdr *c2h_evt);
|
||||
|
||||
void rtl8723a_read_adapter_info(struct rtw_adapter *Adapter);
|
||||
void rtl8723a_read_chip_version(struct rtw_adapter *padapter);
|
||||
void rtl8723a_notch_filter(struct rtw_adapter *adapter, bool enable);
|
||||
void rtl8723a_SetBeaconRelatedRegisters(struct rtw_adapter *padapter);
|
||||
void rtl8723a_SetHalODMVar(struct rtw_adapter *Adapter,
|
||||
enum hal_odm_variable eVariable,
|
||||
void *pValue1, bool bSet);
|
||||
void
|
||||
rtl8723a_readefuse(struct rtw_adapter *padapter,
|
||||
u8 efuseType, u16 _offset, u16 _size_byte, u8 *pbuf);
|
||||
u16 rtl8723a_EfuseGetCurrentSize_WiFi(struct rtw_adapter *padapter);
|
||||
u16 rtl8723a_EfuseGetCurrentSize_BT(struct rtw_adapter *padapter);
|
||||
void rtl8723a_update_ramask(struct rtw_adapter *padapter,
|
||||
u32 mac_id, u8 rssi_level);
|
||||
|
||||
#endif
|
|
@ -1,98 +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.
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef __RTL8723A_PG_H__
|
||||
#define __RTL8723A_PG_H__
|
||||
|
||||
/* EEPROM/Efuse PG Offset for 8723E/8723U/8723S */
|
||||
#define EEPROM_CCK_TX_PWR_INX_8723A 0x10
|
||||
#define EEPROM_HT40_1S_TX_PWR_INX_8723A 0x16
|
||||
#define EEPROM_HT20_TX_PWR_INX_DIFF_8723A 0x1C
|
||||
#define EEPROM_OFDM_TX_PWR_INX_DIFF_8723A 0x1F
|
||||
#define EEPROM_HT40_MAX_PWR_OFFSET_8723A 0x22
|
||||
#define EEPROM_HT20_MAX_PWR_OFFSET_8723A 0x25
|
||||
|
||||
#define EEPROM_ChannelPlan_8723A 0x28
|
||||
#define EEPROM_TSSI_A_8723A 0x29
|
||||
#define EEPROM_THERMAL_METER_8723A 0x2A
|
||||
#define RF_OPTION1_8723A 0x2B
|
||||
#define RF_OPTION2_8723A 0x2C
|
||||
#define RF_OPTION3_8723A 0x2D
|
||||
#define RF_OPTION4_8723A 0x2E
|
||||
#define EEPROM_VERSION_8723A 0x30
|
||||
#define EEPROM_CustomID_8723A 0x31
|
||||
#define EEPROM_SubCustomID_8723A 0x32
|
||||
#define EEPROM_XTAL_K_8723A 0x33
|
||||
#define EEPROM_Chipset_8723A 0x34
|
||||
|
||||
/* RTL8723AE */
|
||||
#define EEPROM_VID_8723AE 0x49
|
||||
#define EEPROM_DID_8723AE 0x4B
|
||||
#define EEPROM_SVID_8723AE 0x4D
|
||||
#define EEPROM_SMID_8723AE 0x4F
|
||||
#define EEPROM_MAC_ADDR_8723AE 0x67
|
||||
|
||||
/* RTL8723AU */
|
||||
#define EEPROM_MAC_ADDR_8723AU 0xC6
|
||||
#define EEPROM_VID_8723AU 0xB7
|
||||
#define EEPROM_PID_8723AU 0xB9
|
||||
|
||||
/* RTL8723AS */
|
||||
#define EEPROM_MAC_ADDR_8723AS 0xAA
|
||||
|
||||
/* EEPROM/Efuse Value Type */
|
||||
#define EETYPE_TX_PWR 0x0
|
||||
|
||||
/* EEPROM/Efuse Default Value */
|
||||
#define EEPROM_Default_CrystalCap_8723A 0x20
|
||||
|
||||
|
||||
/* EEPROM/EFUSE data structure definition. */
|
||||
#define MAX_CHNL_GROUP 3+9
|
||||
|
||||
struct txpowerinfo {
|
||||
u8 CCKIndex[RF_PATH_MAX][MAX_CHNL_GROUP];
|
||||
u8 HT40_1SIndex[RF_PATH_MAX][MAX_CHNL_GROUP];
|
||||
u8 HT40_2SIndexDiff[RF_PATH_MAX][MAX_CHNL_GROUP];
|
||||
u8 HT20IndexDiff[RF_PATH_MAX][MAX_CHNL_GROUP];
|
||||
u8 OFDMIndexDiff[RF_PATH_MAX][MAX_CHNL_GROUP];
|
||||
u8 HT40MaxOffset[RF_PATH_MAX][MAX_CHNL_GROUP];
|
||||
u8 HT20MaxOffset[RF_PATH_MAX][MAX_CHNL_GROUP];
|
||||
u8 TSSI_A[3];
|
||||
u8 TSSI_B[3];
|
||||
u8 TSSI_A_5G[3]; /* 5GL/5GM/5GH */
|
||||
u8 TSSI_B_5G[3];
|
||||
};
|
||||
|
||||
enum bt_ant_num {
|
||||
Ant_x2 = 0,
|
||||
Ant_x1 = 1
|
||||
};
|
||||
|
||||
enum bt_cotype {
|
||||
BT_2Wire = 0,
|
||||
BT_ISSC_3Wire = 1,
|
||||
BT_Accel = 2,
|
||||
BT_CSR_BC4 = 3,
|
||||
BT_CSR_BC8 = 4,
|
||||
BT_RTL8756 = 5,
|
||||
BT_RTL8723A = 6
|
||||
};
|
||||
|
||||
enum bt_radioshared {
|
||||
BT_Radio_Shared = 0,
|
||||
BT_Radio_Individual = 1,
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,65 +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.
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef __RTL8723A_RECV_H__
|
||||
#define __RTL8723A_RECV_H__
|
||||
|
||||
#include <osdep_service.h>
|
||||
#include <drv_types.h>
|
||||
|
||||
#define NR_RECVBUFF 4
|
||||
|
||||
#define NR_PREALLOC_RECV_SKB 8
|
||||
|
||||
#define RECV_BLK_SZ 512
|
||||
#define RECV_BLK_CNT 16
|
||||
#define RECV_BLK_TH RECV_BLK_CNT
|
||||
|
||||
#define MAX_RECVBUF_SZ 15360 /* 15k < 16k */
|
||||
|
||||
#define PHY_RSSI_SLID_WIN_MAX 100
|
||||
#define PHY_LINKQUALITY_SLID_WIN_MAX 20
|
||||
|
||||
|
||||
struct phy_stat {
|
||||
unsigned int phydw0;
|
||||
unsigned int phydw1;
|
||||
unsigned int phydw2;
|
||||
unsigned int phydw3;
|
||||
unsigned int phydw4;
|
||||
unsigned int phydw5;
|
||||
unsigned int phydw6;
|
||||
unsigned int phydw7;
|
||||
};
|
||||
|
||||
/* Rx smooth factor */
|
||||
#define Rx_Smooth_Factor 20
|
||||
|
||||
struct interrupt_msg_format {
|
||||
unsigned int C2H_MSG0;
|
||||
unsigned int C2H_MSG1;
|
||||
unsigned int C2H_MSG2;
|
||||
unsigned int C2H_MSG3;
|
||||
unsigned int HISR; /* from HISR Reg0x124, read to clear */
|
||||
unsigned int HISRE;/* from HISRE Reg0x12c, read to clear */
|
||||
unsigned int MSG_EX;
|
||||
};
|
||||
|
||||
int rtl8723au_init_recv_priv(struct rtw_adapter *padapter);
|
||||
void rtl8723au_free_recv_priv(struct rtw_adapter *padapter);
|
||||
void rtl8723a_process_phy_info(struct rtw_adapter *padapter, void *prframe);
|
||||
void update_recvframe_attrib(struct recv_frame *precvframe, struct recv_stat *prxstat);
|
||||
void update_recvframe_phyinfo(struct recv_frame *precvframe, struct phy_stat *pphy_info);
|
||||
|
||||
#endif
|
|
@ -1,58 +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.
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef __RTL8723A_RF_H__
|
||||
#define __RTL8723A_RF_H__
|
||||
|
||||
/*--------------------------Define Parameters-------------------------------*/
|
||||
|
||||
/* */
|
||||
/* For RF 6052 Series */
|
||||
/* */
|
||||
#define RF6052_MAX_TX_PWR 0x3F
|
||||
#define RF6052_MAX_REG 0x3F
|
||||
#define RF6052_MAX_PATH 2
|
||||
/*--------------------------Define Parameters-------------------------------*/
|
||||
|
||||
|
||||
/*------------------------------Define structure----------------------------*/
|
||||
|
||||
/*------------------------------Define structure----------------------------*/
|
||||
|
||||
|
||||
/*------------------------Export global variable----------------------------*/
|
||||
/*------------------------Export global variable----------------------------*/
|
||||
|
||||
/*------------------------Export Marco Definition---------------------------*/
|
||||
|
||||
/*------------------------Export Marco Definition---------------------------*/
|
||||
|
||||
|
||||
/*--------------------------Exported Function prototype---------------------*/
|
||||
|
||||
/* */
|
||||
/* RF RL6052 Series API */
|
||||
/* */
|
||||
void rtl8723a_phy_rf6052set_bw(struct rtw_adapter *Adapter,
|
||||
enum ht_channel_width Bandwidth);
|
||||
void rtl823a_phy_rf6052setccktxpower(struct rtw_adapter *Adapter,
|
||||
u8 *pPowerlevel);
|
||||
void rtl8723a_PHY_RF6052SetOFDMTxPower(struct rtw_adapter *Adapter,
|
||||
u8 *pPowerLevel, u8 Channel);
|
||||
|
||||
/*--------------------------Exported Function prototype---------------------*/
|
||||
|
||||
int PHY_RF6052_Config8723A(struct rtw_adapter *Adapter);
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
|
@ -1,24 +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.
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef _RTL8723A_SRESET_H_
|
||||
#define _RTL8723A_SRESET_H_
|
||||
|
||||
#include <osdep_service.h>
|
||||
#include <drv_types.h>
|
||||
#include <rtw_sreset.h>
|
||||
|
||||
void rtl8723a_sreset_xmit_status_check(struct rtw_adapter *padapter);
|
||||
|
||||
#endif
|
|
@ -1,225 +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.
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef __RTL8723A_XMIT_H__
|
||||
#define __RTL8723A_XMIT_H__
|
||||
|
||||
/* */
|
||||
/* Queue Select Value in TxDesc */
|
||||
/* */
|
||||
#define QSLT_BK 0x2/* 0x01 */
|
||||
#define QSLT_BE 0x0
|
||||
#define QSLT_VI 0x5/* 0x4 */
|
||||
#define QSLT_VO 0x7/* 0x6 */
|
||||
#define QSLT_BEACON 0x10
|
||||
#define QSLT_HIGH 0x11
|
||||
#define QSLT_MGNT 0x12
|
||||
#define QSLT_CMD 0x13
|
||||
|
||||
/* */
|
||||
/* defined for TX DESC Operation */
|
||||
/* */
|
||||
|
||||
#define MAX_TID (15)
|
||||
|
||||
/* OFFSET 0 */
|
||||
#define OFFSET_SZ 0
|
||||
#define OFFSET_SHT 16
|
||||
#define BMC BIT(24)
|
||||
#define LSG BIT(26)
|
||||
#define FSG BIT(27)
|
||||
#define OWN BIT(31)
|
||||
|
||||
|
||||
/* OFFSET 4 */
|
||||
#define PKT_OFFSET_SZ 0
|
||||
#define BK BIT(6)
|
||||
#define QSEL_SHT 8
|
||||
#define Rate_ID_SHT 16
|
||||
#define NAVUSEHDR BIT(20)
|
||||
#define PKT_OFFSET_SHT 26
|
||||
#define HWPC BIT(31)
|
||||
|
||||
/* OFFSET 8 */
|
||||
#define AGG_EN BIT(29)
|
||||
|
||||
/* OFFSET 12 */
|
||||
#define SEQ_SHT 16
|
||||
|
||||
/* OFFSET 16 */
|
||||
#define QoS BIT(6)
|
||||
#define HW_SEQ_EN BIT(7)
|
||||
#define USERATE BIT(8)
|
||||
#define DISDATAFB BIT(10)
|
||||
#define DATA_SHORT BIT(24)
|
||||
#define DATA_BW BIT(25)
|
||||
|
||||
/* OFFSET 20 */
|
||||
#define SGI BIT(6)
|
||||
|
||||
struct txdesc_8723a {
|
||||
u32 pktlen:16;
|
||||
u32 offset:8;
|
||||
u32 bmc:1;
|
||||
u32 htc:1;
|
||||
u32 ls:1;
|
||||
u32 fs:1;
|
||||
u32 linip:1;
|
||||
u32 noacm:1;
|
||||
u32 gf:1;
|
||||
u32 own:1;
|
||||
|
||||
u32 macid:5;
|
||||
u32 agg_en:1;
|
||||
u32 bk:1;
|
||||
u32 rd_en:1;
|
||||
u32 qsel:5;
|
||||
u32 rd_nav_ext:1;
|
||||
u32 lsig_txop_en:1;
|
||||
u32 pifs:1;
|
||||
u32 rate_id:4;
|
||||
u32 navusehdr:1;
|
||||
u32 en_desc_id:1;
|
||||
u32 sectype:2;
|
||||
u32 rsvd0424:2;
|
||||
u32 pkt_offset:5; /* unit: 8 bytes */
|
||||
u32 rsvd0431:1;
|
||||
|
||||
u32 rts_rc:6;
|
||||
u32 data_rc:6;
|
||||
u32 rsvd0812:2;
|
||||
u32 bar_rty_th:2;
|
||||
u32 rsvd0816:1;
|
||||
u32 morefrag:1;
|
||||
u32 raw:1;
|
||||
u32 ccx:1;
|
||||
u32 ampdu_density:3;
|
||||
u32 bt_null:1;
|
||||
u32 ant_sel_a:1;
|
||||
u32 ant_sel_b:1;
|
||||
u32 tx_ant_cck:2;
|
||||
u32 tx_antl:2;
|
||||
u32 tx_ant_ht:2;
|
||||
|
||||
u32 nextheadpage:8;
|
||||
u32 tailpage:8;
|
||||
u32 seq:12;
|
||||
u32 cpu_handle:1;
|
||||
u32 tag1:1;
|
||||
u32 trigger_int:1;
|
||||
u32 hwseq_en:1;
|
||||
|
||||
u32 rtsrate:5;
|
||||
u32 ap_dcfe:1;
|
||||
u32 hwseq_sel:2;
|
||||
u32 userate:1;
|
||||
u32 disrtsfb:1;
|
||||
u32 disdatafb:1;
|
||||
u32 cts2self:1;
|
||||
u32 rtsen:1;
|
||||
u32 hw_rts_en:1;
|
||||
u32 port_id:1;
|
||||
u32 rsvd1615:3;
|
||||
u32 wait_dcts:1;
|
||||
u32 cts2ap_en:1;
|
||||
u32 data_sc:2;
|
||||
u32 data_stbc:2;
|
||||
u32 data_short:1;
|
||||
u32 data_bw:1;
|
||||
u32 rts_short:1;
|
||||
u32 rts_bw:1;
|
||||
u32 rts_sc:2;
|
||||
u32 vcs_stbc:2;
|
||||
|
||||
u32 datarate:6;
|
||||
u32 sgi:1;
|
||||
u32 try_rate:1;
|
||||
u32 data_ratefb_lmt:5;
|
||||
u32 rts_ratefb_lmt:4;
|
||||
u32 rty_lmt_en:1;
|
||||
u32 data_rt_lmt:6;
|
||||
u32 usb_txagg_num:8;
|
||||
|
||||
u32 txagg_a:5;
|
||||
u32 txagg_b:5;
|
||||
u32 use_max_len:1;
|
||||
u32 max_agg_num:5;
|
||||
u32 mcsg1_max_len:4;
|
||||
u32 mcsg2_max_len:4;
|
||||
u32 mcsg3_max_len:4;
|
||||
u32 mcs7_sgi_max_len:4;
|
||||
|
||||
u32 checksum:16; /* TxBuffSize(PCIe)/CheckSum(USB) */
|
||||
u32 mcsg4_max_len:4;
|
||||
u32 mcsg5_max_len:4;
|
||||
u32 mcsg6_max_len:4;
|
||||
u32 mcs15_sgi_max_len:4;
|
||||
};
|
||||
|
||||
#define txdesc_set_ccx_sw_8723a(txdesc, value) \
|
||||
do { \
|
||||
((struct txdesc_8723a *)(txdesc))->mcsg4_max_len = (((value)>>8) & 0x0f); \
|
||||
((struct txdesc_8723a *)(txdesc))->mcs15_sgi_max_len= (((value)>>4) & 0x0f); \
|
||||
((struct txdesc_8723a *)(txdesc))->mcsg6_max_len = ((value) & 0x0f); \
|
||||
} while (0)
|
||||
|
||||
struct txrpt_ccx_8723a {
|
||||
/* offset 0 */
|
||||
u8 tag1:1;
|
||||
u8 rsvd:4;
|
||||
u8 int_bt:1;
|
||||
u8 int_tri:1;
|
||||
u8 int_ccx:1;
|
||||
|
||||
/* offset 1 */
|
||||
u8 mac_id:5;
|
||||
u8 pkt_drop:1;
|
||||
u8 pkt_ok:1;
|
||||
u8 bmc:1;
|
||||
|
||||
/* offset 2 */
|
||||
u8 retry_cnt:6;
|
||||
u8 lifetime_over:1;
|
||||
u8 retry_over:1;
|
||||
|
||||
/* offset 3 */
|
||||
u8 ccx_qtime0;
|
||||
u8 ccx_qtime1;
|
||||
|
||||
/* offset 5 */
|
||||
u8 final_data_rate;
|
||||
|
||||
/* offset 6 */
|
||||
u8 sw1:4;
|
||||
u8 qsel:4;
|
||||
|
||||
/* offset 7 */
|
||||
u8 sw0;
|
||||
};
|
||||
|
||||
#define txrpt_ccx_sw_8723a(txrpt_ccx) ((txrpt_ccx)->sw0 + ((txrpt_ccx)->sw1<<8))
|
||||
#define txrpt_ccx_qtime_8723a(txrpt_ccx) ((txrpt_ccx)->ccx_qtime0+((txrpt_ccx)->ccx_qtime1<<8))
|
||||
|
||||
void handle_txrpt_ccx_8723a(struct rtw_adapter *adapter, void *buf);
|
||||
void rtl8723a_fill_fake_txdesc(struct rtw_adapter *padapter, u8 *pDesc, u32 BufferLen, u8 IsPsPoll, u8 IsBTQosNull);
|
||||
|
||||
int rtl8723au_hal_xmitframe_enqueue(struct rtw_adapter *padapter, struct xmit_frame *pxmitframe);
|
||||
s32 rtl8723au_xmit_buf_handler(struct rtw_adapter *padapter);
|
||||
#define hal_xmit_handler rtl8723au_xmit_buf_handler
|
||||
bool rtl8723au_hal_xmit(struct rtw_adapter *padapter, struct xmit_frame *pxmitframe);
|
||||
int rtl8723au_mgnt_xmit(struct rtw_adapter *padapter, struct xmit_frame *pmgntframe);
|
||||
bool rtl8723au_xmitframe_complete(struct rtw_adapter *padapter, struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf);
|
||||
|
||||
|
||||
#endif
|
|
@ -1,51 +0,0 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef __RTW_AP_H_
|
||||
#define __RTW_AP_H_
|
||||
|
||||
#include <osdep_service.h>
|
||||
#include <drv_types.h>
|
||||
|
||||
|
||||
#ifdef CONFIG_8723AU_AP_MODE
|
||||
|
||||
/* external function */
|
||||
|
||||
void init_mlme_ap_info23a(struct rtw_adapter *padapter);
|
||||
void free_mlme_ap_info23a(struct rtw_adapter *padapter);
|
||||
/* void update_BCNTIM(struct rtw_adapter *padapter); */
|
||||
void rtw_add_bcn_ie(struct rtw_adapter *padapter, struct wlan_bssid_ex *pnetwork, u8 index, u8 *data, u8 len);
|
||||
void rtw_remove_bcn_ie(struct rtw_adapter *padapter, struct wlan_bssid_ex *pnetwork, u8 index);
|
||||
void update_beacon23a(struct rtw_adapter *padapter, u8 ie_id, u8 *oui, u8 tx);
|
||||
void add_RATid23a(struct rtw_adapter *padapter, struct sta_info *psta, u8 rssi_level);
|
||||
void expire_timeout_chk23a(struct rtw_adapter *padapter);
|
||||
void update_sta_info23a_apmode23a(struct rtw_adapter *padapter, struct sta_info *psta);
|
||||
int rtw_check_beacon_data23a(struct rtw_adapter *padapter,
|
||||
struct ieee80211_mgmt *mgmt, unsigned int len);
|
||||
void rtw_ap_restore_network(struct rtw_adapter *padapter);
|
||||
void rtw_set_macaddr_acl23a(struct rtw_adapter *padapter, int mode);
|
||||
|
||||
void associated_clients_update23a(struct rtw_adapter *padapter, u8 updated);
|
||||
void bss_cap_update_on_sta_join23a(struct rtw_adapter *padapter, struct sta_info *psta);
|
||||
u8 bss_cap_update_on_sta_leave23a(struct rtw_adapter *padapter, struct sta_info *psta);
|
||||
void sta_info_update23a(struct rtw_adapter *padapter, struct sta_info *psta);
|
||||
void ap_sta_info_defer_update23a(struct rtw_adapter *padapter, struct sta_info *psta);
|
||||
u8 ap_free_sta23a(struct rtw_adapter *padapter, struct sta_info *psta, bool active, u16 reason);
|
||||
int rtw_sta_flush23a(struct rtw_adapter *padapter);
|
||||
void start_ap_mode23a(struct rtw_adapter *padapter);
|
||||
void stop_ap_mode23a(struct rtw_adapter *padapter);
|
||||
#endif /* end of CONFIG_8723AU_AP_MODE */
|
||||
|
||||
#endif
|
|
@ -1,815 +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.
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef __RTW_CMD_H_
|
||||
#define __RTW_CMD_H_
|
||||
|
||||
#include <wlan_bssdef.h>
|
||||
#include <rtw_rf.h>
|
||||
|
||||
#define C2H_MEM_SZ (16*1024)
|
||||
|
||||
#include <osdep_service.h>
|
||||
#include <ieee80211.h> /* <ieee80211/ieee80211.h> */
|
||||
|
||||
|
||||
#define MAX_CMDSZ 1024
|
||||
#define MAX_RSPSZ 512
|
||||
#define MAX_EVTSZ 1024
|
||||
|
||||
#define CMDBUFF_ALIGN_SZ 512
|
||||
|
||||
struct cmd_obj {
|
||||
struct work_struct work;
|
||||
struct rtw_adapter *padapter;
|
||||
u16 cmdcode;
|
||||
int res;
|
||||
u32 cmdsz;
|
||||
u8 *parmbuf;
|
||||
u8 *rsp;
|
||||
u32 rspsz;
|
||||
};
|
||||
|
||||
struct cmd_priv {
|
||||
struct workqueue_struct *wq;
|
||||
u32 cmd_issued_cnt;
|
||||
u32 cmd_done_cnt;
|
||||
u32 rsp_cnt;
|
||||
struct rtw_adapter *padapter;
|
||||
};
|
||||
|
||||
#define C2H_QUEUE_MAX_LEN 10
|
||||
|
||||
struct evt_priv {
|
||||
struct workqueue_struct *wq;
|
||||
struct work_struct irq_wk;
|
||||
};
|
||||
|
||||
#define init_h2fwcmd_w_parm_no_rsp(pcmd, pparm, code) \
|
||||
do {\
|
||||
pcmd->cmdcode = code;\
|
||||
pcmd->parmbuf = (u8 *)(pparm);\
|
||||
pcmd->cmdsz = sizeof (*pparm);\
|
||||
pcmd->rsp = NULL;\
|
||||
pcmd->rspsz = 0;\
|
||||
} while(0)
|
||||
|
||||
struct c2h_evt_hdr {
|
||||
u8 id:4;
|
||||
u8 plen:4;
|
||||
u8 seq;
|
||||
u8 payload[0];
|
||||
};
|
||||
|
||||
/*
|
||||
* Do not reorder - this allows for struct evt_work to be passed on to
|
||||
* rtw_c2h_wk_cmd23a() as a 'struct c2h_evt_hdr *' without making an
|
||||
* additional copy.
|
||||
*/
|
||||
struct evt_work {
|
||||
union {
|
||||
struct c2h_evt_hdr c2h_evt;
|
||||
u8 buf[16];
|
||||
} u;
|
||||
struct work_struct work;
|
||||
struct rtw_adapter *adapter;
|
||||
};
|
||||
|
||||
#define c2h_evt_exist(c2h_evt) ((c2h_evt)->id || (c2h_evt)->plen)
|
||||
|
||||
void rtw_evt_work(struct work_struct *work);
|
||||
|
||||
int rtw_enqueue_cmd23a(struct cmd_priv *pcmdpriv, struct cmd_obj *obj);
|
||||
void rtw_free_cmd_obj23a(struct cmd_obj *pcmd);
|
||||
|
||||
int rtw_cmd_thread23a(void *context);
|
||||
|
||||
int rtw_init_cmd_priv23a(struct cmd_priv *pcmdpriv);
|
||||
|
||||
u32 rtw_init_evt_priv23a (struct evt_priv *pevtpriv);
|
||||
void rtw_free_evt_priv23a (struct evt_priv *pevtpriv);
|
||||
void rtw_evt_notify_isr(struct evt_priv *pevtpriv);
|
||||
|
||||
enum rtw_drvextra_cmd_id
|
||||
{
|
||||
NONE_WK_CID,
|
||||
DYNAMIC_CHK_WK_CID,
|
||||
DM_CTRL_WK_CID,
|
||||
PBC_POLLING_WK_CID,
|
||||
POWER_SAVING_CTRL_WK_CID,/* IPS,AUTOSuspend */
|
||||
LPS_CTRL_WK_CID,
|
||||
ANT_SELECT_WK_CID,
|
||||
P2P_PS_WK_CID,
|
||||
P2P_PROTO_WK_CID,
|
||||
CHECK_HIQ_WK_CID,/* for softap mode, check hi queue if empty */
|
||||
C2H_WK_CID,
|
||||
RTP_TIMER_CFG_WK_CID,
|
||||
MAX_WK_CID
|
||||
};
|
||||
|
||||
enum LPS_CTRL_TYPE
|
||||
{
|
||||
LPS_CTRL_SCAN=0,
|
||||
LPS_CTRL_JOINBSS=1,
|
||||
LPS_CTRL_CONNECT=2,
|
||||
LPS_CTRL_DISCONNECT=3,
|
||||
LPS_CTRL_SPECIAL_PACKET=4,
|
||||
LPS_CTRL_LEAVE=5,
|
||||
};
|
||||
|
||||
enum RFINTFS {
|
||||
SWSI,
|
||||
HWSI,
|
||||
HWPI,
|
||||
};
|
||||
|
||||
/*
|
||||
Caller Mode: Infra, Ad-HoC(C)
|
||||
|
||||
Notes: To enter USB suspend mode
|
||||
|
||||
Command Mode
|
||||
|
||||
*/
|
||||
struct usb_suspend_parm {
|
||||
u32 action;/* 1: sleep, 0:resume */
|
||||
};
|
||||
|
||||
/*
|
||||
Caller Mode: Infra, Ad-HoC
|
||||
|
||||
Notes: To join a known BSS.
|
||||
|
||||
Command-Event Mode
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
Caller Mode: Infra, Ad-HoC(C)
|
||||
|
||||
Notes: To disconnect the current associated BSS
|
||||
|
||||
Command Mode
|
||||
|
||||
*/
|
||||
struct disconnect_parm {
|
||||
u32 deauth_timeout_ms;
|
||||
};
|
||||
|
||||
struct setopmode_parm {
|
||||
enum nl80211_iftype mode;
|
||||
};
|
||||
|
||||
/*
|
||||
Caller Mode: AP, Ad-HoC, Infra
|
||||
|
||||
Notes: To ask RTL8711 performing site-survey
|
||||
|
||||
Command-Event Mode
|
||||
|
||||
*/
|
||||
|
||||
#define RTW_SSID_SCAN_AMOUNT 9 /* for WEXT_CSCAN_AMOUNT 9 */
|
||||
#define RTW_CHANNEL_SCAN_AMOUNT (14+37)
|
||||
struct sitesurvey_parm {
|
||||
int scan_mode; /* active: 1, passive: 0 */
|
||||
u8 ssid_num;
|
||||
u8 ch_num;
|
||||
struct cfg80211_ssid ssid[RTW_SSID_SCAN_AMOUNT];
|
||||
struct rtw_ieee80211_channel ch[RTW_CHANNEL_SCAN_AMOUNT];
|
||||
};
|
||||
|
||||
/*
|
||||
Caller Mode: Any
|
||||
|
||||
Notes: To set the auth type of RTL8711. open/shared/802.1x
|
||||
|
||||
Command Mode
|
||||
|
||||
*/
|
||||
struct setauth_parm {
|
||||
u8 mode; /* 0: legacy open, 1: legacy shared 2: 802.1x */
|
||||
u8 _1x; /* 0: PSK, 1: TLS */
|
||||
u8 rsvd[2];
|
||||
};
|
||||
|
||||
/*
|
||||
Caller Mode: Infra
|
||||
|
||||
a. algorithm: wep40, wep104, tkip & aes
|
||||
b. keytype: grp key/unicast key
|
||||
c. key contents
|
||||
|
||||
when shared key ==> keyid is the camid
|
||||
when 802.1x ==> keyid [0:1] ==> grp key
|
||||
when 802.1x ==> keyid > 2 ==> unicast key
|
||||
|
||||
*/
|
||||
struct setkey_parm {
|
||||
u32 algorithm; /* encryption algorithm, could be none, wep40, TKIP, CCMP, wep104 */
|
||||
u8 keyid;
|
||||
u8 grpkey; /* 1: this is the grpkey for 802.1x. 0: this is the unicast key for 802.1x */
|
||||
u8 set_tx; /* 1: main tx key for wep. 0: other key. */
|
||||
u8 key[16]; /* this could be 40 or 104 */
|
||||
};
|
||||
|
||||
/*
|
||||
When in AP or Ad-Hoc mode, this is used to
|
||||
allocate an sw/hw entry for a newly associated sta.
|
||||
|
||||
Command
|
||||
|
||||
when shared key ==> algorithm/keyid
|
||||
|
||||
*/
|
||||
struct set_stakey_parm {
|
||||
u8 addr[ETH_ALEN];
|
||||
u8 id;/* currently for erasing cam entry if algorithm == _NO_PRIVACY_ */
|
||||
u32 algorithm;
|
||||
u8 key[16];
|
||||
};
|
||||
|
||||
struct set_stakey_rsp {
|
||||
u8 addr[ETH_ALEN];
|
||||
u8 keyid;
|
||||
u8 rsvd;
|
||||
};
|
||||
|
||||
/*
|
||||
Caller Ad-Hoc/AP
|
||||
|
||||
Command -Rsp(AID == CAMID) mode
|
||||
|
||||
This is to force fw to add an sta_data entry per driver's request.
|
||||
|
||||
FW will write an cam entry associated with it.
|
||||
|
||||
*/
|
||||
struct set_assocsta_parm {
|
||||
u8 addr[ETH_ALEN];
|
||||
};
|
||||
|
||||
struct set_assocsta_rsp {
|
||||
u8 cam_id;
|
||||
u8 rsvd[3];
|
||||
};
|
||||
|
||||
/*
|
||||
Caller Ad-Hoc/AP
|
||||
|
||||
Command mode
|
||||
|
||||
This is to force fw to del an sta_data entry per driver's request
|
||||
|
||||
FW will invalidate the cam entry associated with it.
|
||||
|
||||
*/
|
||||
struct del_assocsta_parm {
|
||||
u8 addr[ETH_ALEN];
|
||||
};
|
||||
|
||||
/*
|
||||
Caller Mode: AP/Ad-HoC(M)
|
||||
|
||||
Notes: To notify fw that given staid has changed its power state
|
||||
|
||||
Command Mode
|
||||
|
||||
*/
|
||||
struct setstapwrstate_parm {
|
||||
u8 staid;
|
||||
u8 status;
|
||||
u8 hwaddr[6];
|
||||
};
|
||||
|
||||
/*
|
||||
Caller Mode: Any
|
||||
|
||||
Notes: To setup the basic rate of RTL8711
|
||||
|
||||
Command Mode
|
||||
|
||||
*/
|
||||
struct setbasicrate_parm {
|
||||
u8 basicrates[NumRates];
|
||||
};
|
||||
|
||||
/*
|
||||
Caller Mode: Any
|
||||
|
||||
Notes: To read the current basic rate
|
||||
|
||||
Command-Rsp Mode
|
||||
|
||||
*/
|
||||
struct getbasicrate_parm {
|
||||
u32 rsvd;
|
||||
};
|
||||
|
||||
struct getbasicrate_rsp {
|
||||
u8 basicrates[NumRates];
|
||||
};
|
||||
|
||||
/*
|
||||
Caller Mode: Any
|
||||
|
||||
Notes: To setup the data rate of RTL8711
|
||||
|
||||
Command Mode
|
||||
|
||||
*/
|
||||
struct setdatarate_parm {
|
||||
u8 mac_id;
|
||||
u8 datarates[NumRates];
|
||||
};
|
||||
|
||||
/*
|
||||
Caller Mode: Any
|
||||
|
||||
Notes: To read the current data rate
|
||||
|
||||
Command-Rsp Mode
|
||||
|
||||
*/
|
||||
struct getdatarate_parm {
|
||||
u32 rsvd;
|
||||
};
|
||||
|
||||
struct getdatarate_rsp {
|
||||
u8 datarates[NumRates];
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
Caller Mode: Any
|
||||
AP: AP can use the info for the contents of beacon frame
|
||||
Infra: STA can use the info when sitesurveying
|
||||
Ad-HoC(M): Like AP
|
||||
Ad-HoC(C): Like STA
|
||||
|
||||
|
||||
Notes: To set the phy capability of the NIC
|
||||
|
||||
Command Mode
|
||||
|
||||
*/
|
||||
|
||||
struct setphyinfo_parm {
|
||||
struct regulatory_class class_sets[NUM_REGULATORYS];
|
||||
u8 status;
|
||||
};
|
||||
|
||||
struct getphyinfo_parm {
|
||||
u32 rsvd;
|
||||
};
|
||||
|
||||
struct getphyinfo_rsp {
|
||||
struct regulatory_class class_sets[NUM_REGULATORYS];
|
||||
u8 status;
|
||||
};
|
||||
|
||||
/*
|
||||
Caller Mode: Any
|
||||
|
||||
Notes: To set the channel/modem/band
|
||||
This command will be used when channel/modem/band is changed.
|
||||
|
||||
Command Mode
|
||||
|
||||
*/
|
||||
struct setphy_parm {
|
||||
u8 rfchannel;
|
||||
u8 modem;
|
||||
};
|
||||
|
||||
/*
|
||||
Caller Mode: Any
|
||||
|
||||
Notes: To get the current setting of channel/modem/band
|
||||
|
||||
Command-Rsp Mode
|
||||
|
||||
*/
|
||||
struct getphy_parm {
|
||||
u32 rsvd;
|
||||
};
|
||||
|
||||
struct getphy_rsp {
|
||||
u8 rfchannel;
|
||||
u8 modem;
|
||||
};
|
||||
|
||||
struct readBB_parm {
|
||||
u8 offset;
|
||||
};
|
||||
|
||||
struct readBB_rsp {
|
||||
u8 value;
|
||||
};
|
||||
|
||||
struct readTSSI_parm {
|
||||
u8 offset;
|
||||
};
|
||||
|
||||
struct readTSSI_rsp {
|
||||
u8 value;
|
||||
};
|
||||
|
||||
struct writeBB_parm {
|
||||
u8 offset;
|
||||
u8 value;
|
||||
};
|
||||
|
||||
struct readRF_parm {
|
||||
u8 offset;
|
||||
};
|
||||
|
||||
struct readRF_rsp {
|
||||
u32 value;
|
||||
};
|
||||
|
||||
struct writeRF_parm {
|
||||
u32 offset;
|
||||
u32 value;
|
||||
};
|
||||
|
||||
struct getrfintfs_parm {
|
||||
u8 rfintfs;
|
||||
};
|
||||
|
||||
struct Tx_Beacon_param {
|
||||
struct wlan_bssid_ex network;
|
||||
};
|
||||
|
||||
/* CMD param Formart for driver extra cmd handler */
|
||||
struct drvextra_cmd_parm {
|
||||
int ec_id; /* extra cmd id */
|
||||
int type_size; /* Can use this field as the type id or command size */
|
||||
unsigned char *pbuf;
|
||||
};
|
||||
|
||||
/*------------------- Below are used for RF/BB tunning ---------------------*/
|
||||
|
||||
struct setantenna_parm {
|
||||
u8 tx_antset;
|
||||
u8 rx_antset;
|
||||
u8 tx_antenna;
|
||||
u8 rx_antenna;
|
||||
};
|
||||
|
||||
struct enrateadaptive_parm {
|
||||
u32 en;
|
||||
};
|
||||
|
||||
struct settxagctbl_parm {
|
||||
u32 txagc[MAX_RATES_LENGTH];
|
||||
};
|
||||
|
||||
struct gettxagctbl_parm {
|
||||
u32 rsvd;
|
||||
};
|
||||
|
||||
struct gettxagctbl_rsp {
|
||||
u32 txagc[MAX_RATES_LENGTH];
|
||||
};
|
||||
|
||||
struct setagcctrl_parm {
|
||||
u32 agcctrl; /* 0: pure hw, 1: fw */
|
||||
};
|
||||
|
||||
struct setssup_parm {
|
||||
u32 ss_ForceUp[MAX_RATES_LENGTH];
|
||||
};
|
||||
|
||||
struct getssup_parm {
|
||||
u32 rsvd;
|
||||
};
|
||||
|
||||
struct getssup_rsp {
|
||||
u8 ss_ForceUp[MAX_RATES_LENGTH];
|
||||
};
|
||||
|
||||
struct setssdlevel_parm {
|
||||
u8 ss_DLevel[MAX_RATES_LENGTH];
|
||||
};
|
||||
|
||||
struct getssdlevel_parm {
|
||||
u32 rsvd;
|
||||
};
|
||||
|
||||
struct getssdlevel_rsp {
|
||||
u8 ss_DLevel[MAX_RATES_LENGTH];
|
||||
};
|
||||
|
||||
struct setssulevel_parm {
|
||||
u8 ss_ULevel[MAX_RATES_LENGTH];
|
||||
};
|
||||
|
||||
struct getssulevel_parm {
|
||||
u32 rsvd;
|
||||
};
|
||||
|
||||
struct getssulevel_rsp {
|
||||
u8 ss_ULevel[MAX_RATES_LENGTH];
|
||||
};
|
||||
|
||||
struct setcountjudge_parm {
|
||||
u8 count_judge[MAX_RATES_LENGTH];
|
||||
};
|
||||
|
||||
struct getcountjudge_parm {
|
||||
u32 rsvd;
|
||||
};
|
||||
|
||||
struct getcountjudge_rsp {
|
||||
u8 count_judge[MAX_RATES_LENGTH];
|
||||
};
|
||||
|
||||
struct setratable_parm {
|
||||
u8 ss_ForceUp[NumRates];
|
||||
u8 ss_ULevel[NumRates];
|
||||
u8 ss_DLevel[NumRates];
|
||||
u8 count_judge[NumRates];
|
||||
};
|
||||
|
||||
struct getratable_parm {
|
||||
uint rsvd;
|
||||
};
|
||||
|
||||
struct getratable_rsp {
|
||||
u8 ss_ForceUp[NumRates];
|
||||
u8 ss_ULevel[NumRates];
|
||||
u8 ss_DLevel[NumRates];
|
||||
u8 count_judge[NumRates];
|
||||
};
|
||||
|
||||
/* to get TX,RX retry count */
|
||||
struct gettxretrycnt_parm{
|
||||
unsigned int rsvd;
|
||||
};
|
||||
struct gettxretrycnt_rsp{
|
||||
unsigned long tx_retrycnt;
|
||||
};
|
||||
|
||||
struct getrxretrycnt_parm{
|
||||
unsigned int rsvd;
|
||||
};
|
||||
struct getrxretrycnt_rsp{
|
||||
unsigned long rx_retrycnt;
|
||||
};
|
||||
|
||||
/* to get BCNOK,BCNERR count */
|
||||
struct getbcnokcnt_parm{
|
||||
unsigned int rsvd;
|
||||
};
|
||||
struct getbcnokcnt_rsp{
|
||||
unsigned long bcnokcnt;
|
||||
};
|
||||
|
||||
struct getbcnerrcnt_parm{
|
||||
unsigned int rsvd;
|
||||
};
|
||||
struct getbcnerrcnt_rsp{
|
||||
unsigned long bcnerrcnt;
|
||||
};
|
||||
|
||||
/* to get current TX power level */
|
||||
struct getcurtxpwrlevel_parm{
|
||||
unsigned int rsvd;
|
||||
};
|
||||
|
||||
struct getcurtxpwrlevel_rsp{
|
||||
unsigned short tx_power;
|
||||
};
|
||||
|
||||
struct setprobereqextraie_parm {
|
||||
unsigned char e_id;
|
||||
unsigned char ie_len;
|
||||
unsigned char ie[0];
|
||||
};
|
||||
|
||||
struct setassocreqextraie_parm {
|
||||
unsigned char e_id;
|
||||
unsigned char ie_len;
|
||||
unsigned char ie[0];
|
||||
};
|
||||
|
||||
struct setproberspextraie_parm {
|
||||
unsigned char e_id;
|
||||
unsigned char ie_len;
|
||||
unsigned char ie[0];
|
||||
};
|
||||
|
||||
struct setassocrspextraie_parm {
|
||||
unsigned char e_id;
|
||||
unsigned char ie_len;
|
||||
unsigned char ie[0];
|
||||
};
|
||||
|
||||
struct addBaReq_parm {
|
||||
unsigned int tid;
|
||||
u8 addr[ETH_ALEN];
|
||||
};
|
||||
|
||||
/*H2C Handler index: 46 */
|
||||
struct set_ch_parm {
|
||||
u8 ch;
|
||||
u8 bw;
|
||||
u8 ch_offset;
|
||||
};
|
||||
|
||||
/*H2C Handler index: 59 */
|
||||
struct SetChannelPlan_param {
|
||||
u8 channel_plan;
|
||||
};
|
||||
|
||||
/*H2C Handler index: 60 */
|
||||
struct LedBlink_param {
|
||||
struct led_8723a *pLed;
|
||||
};
|
||||
|
||||
/*H2C Handler index: 61 */
|
||||
struct SetChannelSwitch_param {
|
||||
u8 new_ch_no;
|
||||
};
|
||||
|
||||
/*H2C Handler index: 62 */
|
||||
struct TDLSoption_param {
|
||||
u8 addr[ETH_ALEN];
|
||||
u8 option;
|
||||
};
|
||||
|
||||
#define GEN_CMD_CODE(cmd) cmd ## _CMD_
|
||||
|
||||
|
||||
/*
|
||||
|
||||
Result:
|
||||
0x00: success
|
||||
0x01: success, and check Response.
|
||||
0x02: cmd ignored due to duplicated sequcne number
|
||||
0x03: cmd dropped due to invalid cmd code
|
||||
0x04: reserved.
|
||||
|
||||
*/
|
||||
|
||||
#define H2C_RSP_OFFSET 512
|
||||
|
||||
#define H2C_SUCCESS 0x00
|
||||
#define H2C_SUCCESS_RSP 0x01
|
||||
#define H2C_DUPLICATED 0x02
|
||||
#define H2C_DROPPED 0x03
|
||||
#define H2C_PARAMETERS_ERROR 0x04
|
||||
#define H2C_REJECTED 0x05
|
||||
#define H2C_CMD_OVERFLOW 0x06
|
||||
#define H2C_RESERVED 0x07
|
||||
|
||||
int rtw_setassocsta_cmd(struct rtw_adapter *padapter, u8 *mac_addr);
|
||||
int rtw_setstandby_cmd(struct rtw_adapter *padapter, uint action);
|
||||
int rtw_sitesurvey_cmd23a(struct rtw_adapter *padapter, struct cfg80211_ssid *ssid, int ssid_num, struct rtw_ieee80211_channel *ch, int ch_num);
|
||||
int rtw_createbss_cmd23a(struct rtw_adapter *padapter);
|
||||
int rtw_createbss_cmd23a_ex(struct rtw_adapter *padapter, unsigned char *pbss, unsigned int sz);
|
||||
int rtw_setphy_cmd(struct rtw_adapter *padapter, u8 modem, u8 ch);
|
||||
int rtw_setstakey_cmd23a(struct rtw_adapter *padapter, u8 *psta, u8 unicast_key);
|
||||
int rtw_clearstakey_cmd23a(struct rtw_adapter *padapter, u8 *psta, u8 entry, u8 enqueue);
|
||||
int rtw_joinbss_cmd23a(struct rtw_adapter *padapter, struct wlan_network* pnetwork);
|
||||
int rtw_disassoc_cmd23a(struct rtw_adapter *padapter, u32 deauth_timeout_ms, bool enqueue);
|
||||
int rtw_setopmode_cmd23a(struct rtw_adapter *padapter, enum nl80211_iftype ifmode);
|
||||
int rtw_setdatarate_cmd(struct rtw_adapter *padapter, u8 *rateset);
|
||||
int rtw_setbasicrate_cmd(struct rtw_adapter *padapter, u8 *rateset);
|
||||
int rtw_setbbreg_cmd(struct rtw_adapter *padapter, u8 offset, u8 val);
|
||||
int rtw_setrfreg_cmd(struct rtw_adapter *padapter, u8 offset, u32 val);
|
||||
int rtw_getbbreg_cmd(struct rtw_adapter *padapter, u8 offset, u8 *pval);
|
||||
int rtw_getrfreg_cmd(struct rtw_adapter *padapter, u8 offset, u8 *pval);
|
||||
int rtw_setrfintfs_cmd(struct rtw_adapter *padapter, u8 mode);
|
||||
int rtw_setrttbl_cmd(struct rtw_adapter *padapter, struct setratable_parm *prate_table);
|
||||
int rtw_getrttbl_cmd(struct rtw_adapter *padapter, struct getratable_rsp *pval);
|
||||
|
||||
int rtw_gettssi_cmd(struct rtw_adapter *padapter, u8 offset, u8 *pval);
|
||||
int rtw_setfwdig_cmd(struct rtw_adapter*padapter, u8 type);
|
||||
int rtw_setfwra_cmd(struct rtw_adapter*padapter, u8 type);
|
||||
|
||||
int rtw_addbareq_cmd23a(struct rtw_adapter*padapter, u8 tid, u8 *addr);
|
||||
|
||||
int rtw_dynamic_chk_wk_cmd23a(struct rtw_adapter *adapter);
|
||||
|
||||
int rtw_lps_ctrl_wk_cmd23a(struct rtw_adapter*padapter, u8 lps_ctrl_type, u8 enqueue);
|
||||
|
||||
int rtw_ps_cmd23a(struct rtw_adapter*padapter);
|
||||
|
||||
#ifdef CONFIG_8723AU_AP_MODE
|
||||
int rtw_chk_hi_queue_cmd23a(struct rtw_adapter*padapter);
|
||||
#endif
|
||||
|
||||
int rtw_set_chplan_cmd(struct rtw_adapter*padapter, u8 chplan, u8 enqueue);
|
||||
int rtw_led_blink_cmd(struct rtw_adapter*padapter, struct led_8723a *pLed);
|
||||
int rtw_set_csa_cmd(struct rtw_adapter*padapter, u8 new_ch_no);
|
||||
|
||||
int rtw_c2h_wk_cmd23a(struct rtw_adapter *padapter, u8 *c2h_evt);
|
||||
|
||||
int rtw_drvextra_cmd_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf);
|
||||
|
||||
void rtw_survey_cmd_callback23a(struct rtw_adapter *padapter, struct cmd_obj *pcmd);
|
||||
void rtw_disassoc_cmd23a_callback(struct rtw_adapter *padapter, struct cmd_obj *pcmd);
|
||||
void rtw_joinbss_cmd23a_callback(struct rtw_adapter *padapter, struct cmd_obj *pcmd);
|
||||
void rtw_createbss_cmd23a_callback(struct rtw_adapter *padapter, struct cmd_obj *pcmd);
|
||||
void rtw_getbbrfreg_cmdrsp_callback23a(struct rtw_adapter *padapter, struct cmd_obj *pcmd);
|
||||
|
||||
void rtw_setstaKey_cmdrsp_callback23a(struct rtw_adapter *padapter, struct cmd_obj *pcmd);
|
||||
void rtw_setassocsta_cmdrsp_callback23a(struct rtw_adapter *padapter, struct cmd_obj *pcmd);
|
||||
|
||||
struct _cmd_callback {
|
||||
u32 cmd_code;
|
||||
void (*callback)(struct rtw_adapter *padapter, struct cmd_obj *cmd);
|
||||
};
|
||||
|
||||
enum rtw_h2c_cmd {
|
||||
GEN_CMD_CODE(_Read_MACREG) , /*0*/
|
||||
GEN_CMD_CODE(_Write_MACREG) ,
|
||||
GEN_CMD_CODE(_Read_BBREG) ,
|
||||
GEN_CMD_CODE(_Write_BBREG) ,
|
||||
GEN_CMD_CODE(_Read_RFREG) ,
|
||||
GEN_CMD_CODE(_Write_RFREG) , /*5*/
|
||||
GEN_CMD_CODE(_Read_EEPROM) ,
|
||||
GEN_CMD_CODE(_Write_EEPROM) ,
|
||||
GEN_CMD_CODE(_Read_EFUSE) ,
|
||||
GEN_CMD_CODE(_Write_EFUSE) ,
|
||||
|
||||
GEN_CMD_CODE(_Read_CAM) , /*10*/
|
||||
GEN_CMD_CODE(_Write_CAM) ,
|
||||
GEN_CMD_CODE(_setBCNITV),
|
||||
GEN_CMD_CODE(_setMBIDCFG),
|
||||
GEN_CMD_CODE(_JoinBss), /*14*/
|
||||
GEN_CMD_CODE(_DisConnect) , /*15*/
|
||||
GEN_CMD_CODE(_CreateBss) ,
|
||||
GEN_CMD_CODE(_SetOpMode) ,
|
||||
GEN_CMD_CODE(_SiteSurvey), /*18*/
|
||||
GEN_CMD_CODE(_SetAuth) ,
|
||||
|
||||
GEN_CMD_CODE(_SetKey) , /*20*/
|
||||
GEN_CMD_CODE(_SetStaKey) ,
|
||||
GEN_CMD_CODE(_SetAssocSta) ,
|
||||
GEN_CMD_CODE(_DelAssocSta) ,
|
||||
GEN_CMD_CODE(_SetStaPwrState) ,
|
||||
GEN_CMD_CODE(_SetBasicRate) , /*25*/
|
||||
GEN_CMD_CODE(_GetBasicRate) ,
|
||||
GEN_CMD_CODE(_SetDataRate) ,
|
||||
GEN_CMD_CODE(_GetDataRate) ,
|
||||
GEN_CMD_CODE(_SetPhyInfo) ,
|
||||
|
||||
GEN_CMD_CODE(_GetPhyInfo) , /*30*/
|
||||
GEN_CMD_CODE(_SetPhy) ,
|
||||
GEN_CMD_CODE(_GetPhy) ,
|
||||
GEN_CMD_CODE(_readRssi) ,
|
||||
GEN_CMD_CODE(_readGain) ,
|
||||
GEN_CMD_CODE(_SetAtim) , /*35*/
|
||||
GEN_CMD_CODE(_SetPwrMode) ,
|
||||
GEN_CMD_CODE(_JoinbssRpt),
|
||||
GEN_CMD_CODE(_SetRaTable) ,
|
||||
GEN_CMD_CODE(_GetRaTable) ,
|
||||
|
||||
GEN_CMD_CODE(_GetCCXReport), /*40*/
|
||||
GEN_CMD_CODE(_GetDTMReport),
|
||||
GEN_CMD_CODE(_GetTXRateStatistics),
|
||||
GEN_CMD_CODE(_SetUsbSuspend),
|
||||
GEN_CMD_CODE(_SetH2cLbk),
|
||||
GEN_CMD_CODE(_AddBAReq) , /*45*/
|
||||
GEN_CMD_CODE(_SetChannel), /*46*/
|
||||
GEN_CMD_CODE(_SetTxPower),
|
||||
GEN_CMD_CODE(_SwitchAntenna),
|
||||
GEN_CMD_CODE(_SetCrystalCap),
|
||||
GEN_CMD_CODE(_SetSingleCarrierTx), /*50*/
|
||||
|
||||
GEN_CMD_CODE(_SetSingleToneTx),/*51*/
|
||||
GEN_CMD_CODE(_SetCarrierSuppressionTx),
|
||||
GEN_CMD_CODE(_SetContinuousTx),
|
||||
GEN_CMD_CODE(_SwitchBandwidth), /*54*/
|
||||
GEN_CMD_CODE(_TX_Beacon), /*55*/
|
||||
|
||||
GEN_CMD_CODE(_Set_MLME_EVT), /*56*/
|
||||
GEN_CMD_CODE(_Set_Drv_Extra), /*57*/
|
||||
GEN_CMD_CODE(_Set_H2C_MSG), /*58*/
|
||||
|
||||
GEN_CMD_CODE(_SetChannelPlan), /*59*/
|
||||
GEN_CMD_CODE(_LedBlink), /*60*/
|
||||
|
||||
GEN_CMD_CODE(_SetChannelSwitch), /*61*/
|
||||
GEN_CMD_CODE(_TDLS), /*62*/
|
||||
|
||||
MAX_H2CCMD
|
||||
};
|
||||
|
||||
extern struct _cmd_callback rtw_cmd_callback[];
|
||||
|
||||
#endif /* _CMD_H_ */
|
|
@ -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.
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef __RTW_DEBUG_H__
|
||||
#define __RTW_DEBUG_H__
|
||||
|
||||
#include <osdep_service.h>
|
||||
#include <drv_types.h>
|
||||
|
||||
#define _drv_always_ 1
|
||||
#define _drv_emerg_ 2
|
||||
#define _drv_alert_ 3
|
||||
#define _drv_err_ 4
|
||||
#define _drv_warning_ 5
|
||||
#define _drv_notice_ 6
|
||||
#define _drv_info_ 7
|
||||
#define _drv_debug_ 8
|
||||
|
||||
#define _module_rtl871x_xmit_c_ BIT(0)
|
||||
#define _module_xmit_osdep_c_ BIT(1)
|
||||
#define _module_rtl871x_recv_c_ BIT(2)
|
||||
#define _module_recv_osdep_c_ BIT(3)
|
||||
#define _module_rtl871x_mlme_c_ BIT(4)
|
||||
#define _module_mlme_osdep_c_ BIT(5)
|
||||
#define _module_rtl871x_sta_mgt_c_ BIT(6)
|
||||
#define _module_rtl871x_cmd_c_ BIT(7)
|
||||
#define _module_cmd_osdep_c_ BIT(8)
|
||||
#define _module_rtl871x_io_c_ BIT(9)
|
||||
#define _module_io_osdep_c_ BIT(10)
|
||||
#define _module_os_intfs_c_ BIT(11)
|
||||
#define _module_rtl871x_security_c_ BIT(12)
|
||||
#define _module_rtl871x_eeprom_c_ BIT(13)
|
||||
#define _module_hal_init_c_ BIT(14)
|
||||
#define _module_hci_hal_init_c_ BIT(15)
|
||||
#define _module_rtl871x_ioctl_c_ BIT(16)
|
||||
#define _module_rtl871x_ioctl_set_c_ BIT(17)
|
||||
#define _module_rtl871x_ioctl_query_c_ BIT(18)
|
||||
#define _module_rtl871x_pwrctrl_c_ BIT(19)
|
||||
#define _module_hci_intfs_c_ BIT(20)
|
||||
#define _module_hci_ops_c_ BIT(21)
|
||||
#define _module_osdep_service_c_ BIT(22)
|
||||
#define _module_mp_ BIT(23)
|
||||
#define _module_hci_ops_os_c_ BIT(24)
|
||||
#define _module_rtl871x_ioctl_os_c BIT(25)
|
||||
#define _module_rtl8712_cmd_c_ BIT(26)
|
||||
#define _module_rtl8192c_xmit_c_ BIT(28)
|
||||
#define _module_hal_xmit_c_ BIT(28) /* duplication intentional */
|
||||
#define _module_efuse_ BIT(29)
|
||||
#define _module_rtl8712_recv_c_ BIT(30)
|
||||
#define _module_rtl8712_led_c_ BIT(31)
|
||||
|
||||
#undef _MODULE_DEFINE_
|
||||
|
||||
#if defined _RTW_XMIT_C_
|
||||
#define _MODULE_DEFINE_ _module_rtl871x_xmit_c_
|
||||
#elif defined _XMIT_OSDEP_C_
|
||||
#define _MODULE_DEFINE_ _module_xmit_osdep_c_
|
||||
#elif defined _RTW_RECV_C_
|
||||
#define _MODULE_DEFINE_ _module_rtl871x_recv_c_
|
||||
#elif defined _RECV_OSDEP_C_
|
||||
#define _MODULE_DEFINE_ _module_recv_osdep_c_
|
||||
#elif defined _RTW_MLME_C_
|
||||
#define _MODULE_DEFINE_ _module_rtl871x_mlme_c_
|
||||
#elif defined _MLME_OSDEP_C_
|
||||
#define _MODULE_DEFINE_ _module_mlme_osdep_c_
|
||||
#elif defined _RTW_MLME_EXT_C_
|
||||
#define _MODULE_DEFINE_ 1
|
||||
#elif defined _RTW_STA_MGT_C_
|
||||
#define _MODULE_DEFINE_ _module_rtl871x_sta_mgt_c_
|
||||
#elif defined _RTW_CMD_C_
|
||||
#define _MODULE_DEFINE_ _module_rtl871x_cmd_c_
|
||||
#elif defined _CMD_OSDEP_C_
|
||||
#define _MODULE_DEFINE_ _module_cmd_osdep_c_
|
||||
#elif defined _RTW_IO_C_
|
||||
#define _MODULE_DEFINE_ _module_rtl871x_io_c_
|
||||
#elif defined _IO_OSDEP_C_
|
||||
#define _MODULE_DEFINE_ _module_io_osdep_c_
|
||||
#elif defined _OS_INTFS_C_
|
||||
#define _MODULE_DEFINE_ _module_os_intfs_c_
|
||||
#elif defined _RTW_SECURITY_C_
|
||||
#define _MODULE_DEFINE_ _module_rtl871x_security_c_
|
||||
#elif defined _RTW_EEPROM_C_
|
||||
#define _MODULE_DEFINE_ _module_rtl871x_eeprom_c_
|
||||
#elif defined _HAL_INTF_C_
|
||||
#define _MODULE_DEFINE_ _module_hal_init_c_
|
||||
#elif (defined _HCI_HAL_INIT_C_) || (defined _SDIO_HALINIT_C_)
|
||||
#define _MODULE_DEFINE_ _module_hci_hal_init_c_
|
||||
#elif defined _RTL871X_IOCTL_C_
|
||||
#define _MODULE_DEFINE_ _module_rtl871x_ioctl_c_
|
||||
#elif defined _RTL871X_IOCTL_SET_C_
|
||||
#define _MODULE_DEFINE_ _module_rtl871x_ioctl_set_c_
|
||||
#elif defined _RTL871X_IOCTL_QUERY_C_
|
||||
#define _MODULE_DEFINE_ _module_rtl871x_ioctl_query_c_
|
||||
#elif defined _RTL871X_PWRCTRL_C_
|
||||
#define _MODULE_DEFINE_ _module_rtl871x_pwrctrl_c_
|
||||
#elif defined _RTW_PWRCTRL_C_
|
||||
#define _MODULE_DEFINE_ 1
|
||||
#elif defined _HCI_INTF_C_
|
||||
#define _MODULE_DEFINE_ _module_hci_intfs_c_
|
||||
#elif defined _HCI_OPS_C_
|
||||
#define _MODULE_DEFINE_ _module_hci_ops_c_
|
||||
#elif defined _SDIO_OPS_C_
|
||||
#define _MODULE_DEFINE_ 1
|
||||
#elif defined _OSDEP_HCI_INTF_C_
|
||||
#define _MODULE_DEFINE_ _module_hci_intfs_c_
|
||||
#elif defined _OSDEP_SERVICE_C_
|
||||
#define _MODULE_DEFINE_ _module_osdep_service_c_
|
||||
#elif defined _HCI_OPS_OS_C_
|
||||
#define _MODULE_DEFINE_ _module_hci_ops_os_c_
|
||||
#elif defined _RTL871X_IOCTL_LINUX_C_
|
||||
#define _MODULE_DEFINE_ _module_rtl871x_ioctl_os_c
|
||||
#elif defined _RTL8712_CMD_C_
|
||||
#define _MODULE_DEFINE_ _module_rtl8712_cmd_c_
|
||||
#elif defined _RTL8192C_XMIT_C_
|
||||
#define _MODULE_DEFINE_ 1
|
||||
#elif defined _RTL8723AS_XMIT_C_
|
||||
#define _MODULE_DEFINE_ 1
|
||||
#elif defined _RTL8712_RECV_C_
|
||||
#define _MODULE_DEFINE_ _module_rtl8712_recv_c_
|
||||
#elif defined _RTL8192CU_RECV_C_
|
||||
#define _MODULE_DEFINE_ _module_rtl8712_recv_c_
|
||||
#elif defined _RTL871X_MLME_EXT_C_
|
||||
#define _MODULE_DEFINE_ _module_mlme_osdep_c_
|
||||
#elif defined _RTW_MP_C_
|
||||
#define _MODULE_DEFINE_ _module_mp_
|
||||
#elif defined _RTW_MP_IOCTL_C_
|
||||
#define _MODULE_DEFINE_ _module_mp_
|
||||
#elif defined _RTW_EFUSE_C_
|
||||
#define _MODULE_DEFINE_ _module_efuse_
|
||||
#endif
|
||||
|
||||
#define DRIVER_PREFIX "RTL8723AU: "
|
||||
#define DEBUG_LEVEL (_drv_err_)
|
||||
#define DBG_8723A_LEVEL(_level, fmt, arg...) \
|
||||
do { \
|
||||
if (_level <= GlobalDebugLevel23A) \
|
||||
pr_info(DRIVER_PREFIX fmt, ##arg);\
|
||||
} while (0)
|
||||
|
||||
#define DBG_8723A(...) \
|
||||
do { \
|
||||
if (_drv_err_ <= GlobalDebugLevel23A) \
|
||||
pr_info(DRIVER_PREFIX __VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
#define MSG_8723A(...) \
|
||||
do { \
|
||||
if (_drv_err_ <= GlobalDebugLevel23A) \
|
||||
pr_info(DRIVER_PREFIX __VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
extern u32 GlobalDebugLevel23A;
|
||||
|
||||
__printf(3, 4)
|
||||
void rt_trace(int comp, int level, const char *fmt, ...);
|
||||
|
||||
#define RT_TRACE(_Comp, _Level, Fmt, ...) \
|
||||
do { \
|
||||
if (_Level <= GlobalDebugLevel23A) \
|
||||
rt_trace(_Comp, _Level, Fmt, ##__VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
#define RT_PRINT_DATA(_Comp, _Level, _TitleString, _HexData, \
|
||||
_HexDataLen) \
|
||||
if (_Level <= GlobalDebugLevel23A) { \
|
||||
int __i; \
|
||||
u8 *ptr = (u8 *)_HexData; \
|
||||
pr_info("%s", DRIVER_PREFIX); \
|
||||
pr_info(_TitleString); \
|
||||
for (__i = 0; __i < (int)_HexDataLen; __i++) { \
|
||||
printk("%02X%s", ptr[__i], \
|
||||
(((__i + 1) % 4) == 0) ? " " : " "); \
|
||||
if (((__i + 1) % 16) == 0) \
|
||||
printk("\n"); \
|
||||
} \
|
||||
printk("\n"); \
|
||||
}
|
||||
|
||||
#endif /* __RTW_DEBUG_H__ */
|
|
@ -1,135 +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.
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef __RTW_EEPROM_H__
|
||||
#define __RTW_EEPROM_H__
|
||||
|
||||
#include <osdep_service.h>
|
||||
#include <drv_types.h>
|
||||
|
||||
#define RTL8712_EEPROM_ID 0x8712
|
||||
/* define EEPROM_MAX_SIZE 256 */
|
||||
|
||||
#define HWSET_MAX_SIZE_512 512
|
||||
#define EEPROM_MAX_SIZE HWSET_MAX_SIZE_512
|
||||
|
||||
#define CLOCK_RATE 50 /* 100us */
|
||||
|
||||
/* EEPROM opcodes */
|
||||
#define EEPROM_READ_OPCODE 06
|
||||
#define EEPROM_WRITE_OPCODE 05
|
||||
#define EEPROM_ERASE_OPCODE 07
|
||||
#define EEPROM_EWEN_OPCODE 19 /* Erase/write enable */
|
||||
#define EEPROM_EWDS_OPCODE 16 /* Erase/write disable */
|
||||
|
||||
/* Country codes */
|
||||
#define USA 0x555320
|
||||
#define EUROPE 0x1 /* temp, should be provided later */
|
||||
#define JAPAN 0x2 /* temp, should be provided later */
|
||||
|
||||
#define EEPROM_CID_DEFAULT 0x0
|
||||
#define EEPROM_CID_ALPHA 0x1
|
||||
#define EEPROM_CID_Senao 0x3
|
||||
#define EEPROM_CID_NetCore 0x5
|
||||
#define EEPROM_CID_CAMEO 0X8
|
||||
#define EEPROM_CID_SITECOM 0x9
|
||||
#define EEPROM_CID_COREGA 0xB
|
||||
#define EEPROM_CID_EDIMAX_BELKIN 0xC
|
||||
#define EEPROM_CID_SERCOMM_BELKIN 0xE
|
||||
#define EEPROM_CID_CAMEO1 0xF
|
||||
#define EEPROM_CID_WNC_COREGA 0x12
|
||||
#define EEPROM_CID_CLEVO 0x13
|
||||
#define EEPROM_CID_WHQL 0xFE /* added by chiyoko for dtm, 20090108 */
|
||||
|
||||
/* */
|
||||
/* Customer ID, note that: */
|
||||
/* This variable is initiailzed through EEPROM or registry, */
|
||||
/* however, its definition may be different with that in EEPROM for */
|
||||
/* EEPROM size consideration. So, we have to perform proper translation between them. */
|
||||
/* Besides, CustomerID of registry has precedence of that of EEPROM. */
|
||||
/* defined below. 060703, by rcnjko. */
|
||||
/* */
|
||||
enum rt_customer_id
|
||||
{
|
||||
RT_CID_DEFAULT = 0,
|
||||
RT_CID_8187_ALPHA0 = 1,
|
||||
RT_CID_8187_SERCOMM_PS = 2,
|
||||
RT_CID_8187_HW_LED = 3,
|
||||
RT_CID_8187_NETGEAR = 4,
|
||||
RT_CID_WHQL = 5,
|
||||
RT_CID_819x_CAMEO = 6,
|
||||
RT_CID_819x_RUNTOP = 7,
|
||||
RT_CID_819x_Senao = 8,
|
||||
RT_CID_TOSHIBA = 9, /* Merge by Jacken, 2008/01/31. */
|
||||
RT_CID_819x_Netcore = 10,
|
||||
RT_CID_Nettronix = 11,
|
||||
RT_CID_DLINK = 12,
|
||||
RT_CID_PRONET = 13,
|
||||
RT_CID_COREGA = 14,
|
||||
RT_CID_CHINA_MOBILE = 15,
|
||||
RT_CID_819x_ALPHA = 16,
|
||||
RT_CID_819x_Sitecom = 17,
|
||||
RT_CID_CCX = 18, /* It's set under CCX logo test and isn't demanded for CCX functions, but for test behavior like retry limit and tx report. By Bruce, 2009-02-17. */
|
||||
RT_CID_819x_Lenovo = 19,
|
||||
RT_CID_819x_QMI = 20,
|
||||
RT_CID_819x_Edimax_Belkin = 21,
|
||||
RT_CID_819x_Sercomm_Belkin = 22,
|
||||
RT_CID_819x_CAMEO1 = 23,
|
||||
RT_CID_819x_MSI = 24,
|
||||
RT_CID_819x_Acer = 25,
|
||||
RT_CID_819x_AzWave_ASUS = 26,
|
||||
RT_CID_819x_AzWave = 27, /* For AzWave in PCIe, The ID is AzWave use and not only Asus */
|
||||
RT_CID_819x_HP = 28,
|
||||
RT_CID_819x_WNC_COREGA = 29,
|
||||
RT_CID_819x_Arcadyan_Belkin = 30,
|
||||
RT_CID_819x_SAMSUNG = 31,
|
||||
RT_CID_819x_CLEVO = 32,
|
||||
RT_CID_819x_DELL = 33,
|
||||
RT_CID_819x_PRONETS = 34,
|
||||
RT_CID_819x_Edimax_ASUS = 35,
|
||||
RT_CID_819x_CAMEO_NETGEAR = 36,
|
||||
RT_CID_PLANEX = 37,
|
||||
RT_CID_CC_C = 38,
|
||||
RT_CID_819x_Xavi = 39,
|
||||
RT_CID_819x_FUNAI_TV = 40,
|
||||
RT_CID_819x_ALPHA_WD=41,
|
||||
};
|
||||
|
||||
struct eeprom_priv {
|
||||
u8 mac_addr[6]; /* PermanentAddress */
|
||||
u8 bautoload_fail_flag;
|
||||
u8 bloadfile_fail_flag;
|
||||
u8 bloadmac_fail_flag;
|
||||
/* u8 bempty; */
|
||||
/* u8 sys_config; */
|
||||
/* u8 config0; */
|
||||
u16 channel_plan;
|
||||
/* u8 country_string[3]; */
|
||||
/* u8 tx_power_b[15]; */
|
||||
/* u8 tx_power_g[15]; */
|
||||
/* u8 tx_power_a[201]; */
|
||||
|
||||
u8 EepromOrEfuse;
|
||||
|
||||
u8 efuse_eeprom_data[HWSET_MAX_SIZE_512]; /* 92C:256bytes, 88E:512bytes, we use union set (512bytes) */
|
||||
};
|
||||
|
||||
void eeprom_write16(struct rtw_adapter *padapter, u16 reg, u16 data);
|
||||
u16 eeprom_read16(struct rtw_adapter *padapter, u16 reg);
|
||||
void read_eeprom_content(struct rtw_adapter *padapter);
|
||||
void eeprom_read_sz(struct rtw_adapter *padapter, u16 reg, u8 *data, u32 sz);
|
||||
|
||||
void read_eeprom_content_by_attrib(struct rtw_adapter *padapter);
|
||||
|
||||
#endif /* __RTL871X_EEPROM_H__ */
|
|
@ -1,109 +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.
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef __RTW_EFUSE_H__
|
||||
#define __RTW_EFUSE_H__
|
||||
|
||||
#include <osdep_service.h>
|
||||
|
||||
#define EFUSE_ERROE_HANDLE 1
|
||||
|
||||
#define PG_STATE_HEADER 0x01
|
||||
#define PG_STATE_WORD_0 0x02
|
||||
#define PG_STATE_WORD_1 0x04
|
||||
#define PG_STATE_WORD_2 0x08
|
||||
#define PG_STATE_WORD_3 0x10
|
||||
#define PG_STATE_DATA 0x20
|
||||
|
||||
#define PG_SWBYTE_H 0x01
|
||||
#define PG_SWBYTE_L 0x02
|
||||
|
||||
#define PGPKT_DATA_SIZE 8
|
||||
|
||||
#define EFUSE_WIFI 0
|
||||
#define EFUSE_BT 1
|
||||
|
||||
enum _EFUSE_DEF_TYPE {
|
||||
TYPE_EFUSE_MAX_SECTION = 0,
|
||||
TYPE_EFUSE_REAL_CONTENT_LEN = 1,
|
||||
TYPE_AVAILABLE_EFUSE_BYTES_BANK = 2,
|
||||
TYPE_AVAILABLE_EFUSE_BYTES_TOTAL = 3,
|
||||
TYPE_EFUSE_MAP_LEN = 4,
|
||||
TYPE_EFUSE_PROTECT_BYTES_BANK = 5,
|
||||
TYPE_EFUSE_CONTENT_LEN_BANK = 6,
|
||||
};
|
||||
|
||||
/* E-Fuse */
|
||||
#define EFUSE_MAP_SIZE 256
|
||||
|
||||
#define EFUSE_MAX_SIZE 512
|
||||
/* end of E-Fuse */
|
||||
|
||||
#define EFUSE_MAX_MAP_LEN 256
|
||||
#define EFUSE_MAX_HW_SIZE 512
|
||||
#define EFUSE_MAX_SECTION_BASE 16
|
||||
|
||||
#define EXT_HEADER(header) ((header & 0x1F) == 0x0F)
|
||||
#define ALL_WORDS_DISABLED(wde) ((wde & 0x0F) == 0x0F)
|
||||
#define GET_HDR_OFFSET_2_0(header) ( (header & 0xE0) >> 5)
|
||||
|
||||
#define EFUSE_REPEAT_THRESHOLD_ 3
|
||||
|
||||
/* */
|
||||
/* The following is for BT Efuse definition */
|
||||
/* */
|
||||
#define EFUSE_BT_MAX_MAP_LEN 1024
|
||||
#define EFUSE_MAX_BANK 4
|
||||
#define EFUSE_MAX_BT_BANK (EFUSE_MAX_BANK-1)
|
||||
/* */
|
||||
/*--------------------------Define Parameters-------------------------------*/
|
||||
#define EFUSE_MAX_WORD_UNIT 4
|
||||
|
||||
/*------------------------------Define structure----------------------------*/
|
||||
struct pg_pkt_struct {
|
||||
u8 offset;
|
||||
u8 word_en;
|
||||
u8 data[8];
|
||||
u8 word_cnts;
|
||||
};
|
||||
|
||||
/*------------------------Export global variable----------------------------*/
|
||||
|
||||
u16 efuse_GetMaxSize23a(struct rtw_adapter *padapter);
|
||||
int rtw_efuse_access23a(struct rtw_adapter *padapter, u8 bRead, u16 start_addr, u16 cnts, u8 *data);
|
||||
int rtw_efuse_map_read23a(struct rtw_adapter *padapter, u16 addr, u16 cnts, u8 *data);
|
||||
u8 rtw_efuse_map_write(struct rtw_adapter *padapter, u16 addr, u16 cnts, u8 *data);
|
||||
int rtw_BT_efuse_map_read23a(struct rtw_adapter *padapter, u16 addr, u16 cnts, u8 *data);
|
||||
u8 rtw_BT_efuse_map_write(struct rtw_adapter *padapter, u16 addr, u16 cnts, u8 *data);
|
||||
|
||||
u16 Efuse_GetCurrentSize23a(struct rtw_adapter *pAdapter, u8 efuseType);
|
||||
u8 Efuse_CalculateWordCnts23a(u8 word_en);
|
||||
void ReadEFuseByte23a(struct rtw_adapter *Adapter, u16 _offset, u8 *pbuf);
|
||||
void EFUSE_GetEfuseDefinition23a(struct rtw_adapter *pAdapter, u8 efuseType, u8 type, void *pOut);
|
||||
int efuse_OneByteRead23a(struct rtw_adapter *pAdapter, u16 addr, u8 *data);
|
||||
int efuse_OneByteWrite23a(struct rtw_adapter *pAdapter, u16 addr, u8 data);
|
||||
|
||||
void Efuse_PowerSwitch23a(struct rtw_adapter *pAdapter, u8 bWrite,
|
||||
u8 PwrState);
|
||||
int Efuse_PgPacketRead23a(struct rtw_adapter *pAdapter, u8 offset, u8 *data);
|
||||
int Efuse_PgPacketWrite23a(struct rtw_adapter *pAdapter, u8 offset, u8 word_en, u8 *data);
|
||||
void efuse_WordEnableDataRead23a(u8 word_en, u8 *sourdata, u8 *targetdata);
|
||||
u8 Efuse_WordEnableDataWrite23a(struct rtw_adapter *pAdapter, u16 efuse_addr, u8 word_en, u8 *data);
|
||||
|
||||
u8 EFUSE_Read1Byte23a(struct rtw_adapter *pAdapter, u16 Address);
|
||||
void EFUSE_ShadowMapUpdate23a(struct rtw_adapter *pAdapter, u8 efuseType);
|
||||
void EFUSE_ShadowRead23a(struct rtw_adapter *pAdapter, u8 Type, u16 Offset, u32 *Value);
|
||||
|
||||
#endif
|
|
@ -1,74 +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.
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef _RTW_EVENT_H_
|
||||
#define _RTW_EVENT_H_
|
||||
|
||||
#include <osdep_service.h>
|
||||
#include <wlan_bssdef.h>
|
||||
|
||||
/*
|
||||
Used to report a bss has been scanned
|
||||
*/
|
||||
struct survey_event {
|
||||
struct wlan_bssid_ex *bss;
|
||||
};
|
||||
|
||||
/*
|
||||
Used to report that the requested site survey has been done.
|
||||
bss_cnt indicates the number of bss that has been reported.
|
||||
*/
|
||||
struct surveydone_event {
|
||||
unsigned int bss_cnt;
|
||||
};
|
||||
|
||||
/*
|
||||
Used to report the link result of joinning the given bss
|
||||
join_res:
|
||||
-1: authentication fail
|
||||
-2: association fail
|
||||
> 0: TID
|
||||
*/
|
||||
struct joinbss_event {
|
||||
struct wlan_network network;
|
||||
};
|
||||
|
||||
/*
|
||||
Used to report a given STA has joinned the created BSS.
|
||||
It is used in AP/Ad-HoC(M) mode.
|
||||
*/
|
||||
struct stassoc_event {
|
||||
unsigned char macaddr[6];
|
||||
unsigned char rsvd[2];
|
||||
int cam_id;
|
||||
};
|
||||
|
||||
struct stadel_event {
|
||||
unsigned char macaddr[6];
|
||||
unsigned char rsvd[2]; /* for reason */
|
||||
int mac_id;
|
||||
};
|
||||
|
||||
struct addba_event {
|
||||
unsigned int tid;
|
||||
};
|
||||
|
||||
#define GEN_EVT_CODE(event) event ## _EVT_
|
||||
|
||||
struct fwevent {
|
||||
u32 parmsize;
|
||||
void (*event_callback)(struct rtw_adapter *dev, const u8 *pbuf);
|
||||
};
|
||||
|
||||
#endif /* _WLANEVENT_H_ */
|
|
@ -1,42 +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.
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef _RTW_HT_H_
|
||||
#define _RTW_HT_H_
|
||||
|
||||
#include <osdep_service.h>
|
||||
#include "linux/ieee80211.h"
|
||||
#include "wifi.h"
|
||||
|
||||
struct ht_priv {
|
||||
bool ht_option;
|
||||
bool ampdu_enable;/* for enable Tx A-MPDU */
|
||||
/* u8 baddbareq_issued[16]; */
|
||||
u32 tx_amsdu_enable;/* for enable Tx A-MSDU */
|
||||
u32 tx_amdsu_maxlen; /* 1: 8k, 0:4k ; default:8k, for tx */
|
||||
u32 rx_ampdu_maxlen; /* for rx reordering ctrl win_sz, updated when join_callback. */
|
||||
|
||||
u8 bwmode;/* */
|
||||
u8 ch_offset;/* PRIME_CHNL_OFFSET */
|
||||
u8 sgi;/* short GI */
|
||||
|
||||
/* for processing Tx A-MPDU */
|
||||
u16 agg_enable_bitmap;
|
||||
/* u8 ADDBA_retry_count; */
|
||||
u16 candidate_tid_bitmap;
|
||||
|
||||
struct ieee80211_ht_cap ht_cap;
|
||||
};
|
||||
|
||||
#endif /* _RTL871X_HT_H_ */
|
|
@ -1,235 +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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef _RTW_IO_H_
|
||||
#define _RTW_IO_H_
|
||||
|
||||
#include <osdep_service.h>
|
||||
#include <osdep_intf.h>
|
||||
|
||||
#include <asm/byteorder.h>
|
||||
#include <linux/list.h>
|
||||
/* include <linux/smp_lock.h> */
|
||||
#include <linux/spinlock.h>
|
||||
#include <asm/atomic.h>
|
||||
|
||||
#include <linux/usb.h>
|
||||
#include <linux/usb/ch9.h>
|
||||
|
||||
#define rtw_usb_buffer_alloc(dev, size, dma) usb_alloc_coherent((dev), (size), (in_interrupt() ? GFP_ATOMIC : GFP_KERNEL), (dma))
|
||||
#define rtw_usb_buffer_free(dev, size, addr, dma) usb_free_coherent((dev), (size), (addr), (dma))
|
||||
|
||||
#define NUM_IOREQ 8
|
||||
|
||||
#define MAX_PROT_SZ (64-16)
|
||||
|
||||
#define _IOREADY 0
|
||||
#define _IO_WAIT_COMPLETE 1
|
||||
#define _IO_WAIT_RSP 2
|
||||
|
||||
/* IO COMMAND TYPE */
|
||||
#define _IOSZ_MASK_ (0x7F)
|
||||
#define _IO_WRITE_ BIT(7)
|
||||
#define _IO_FIXED_ BIT(8)
|
||||
#define _IO_BURST_ BIT(9)
|
||||
#define _IO_BYTE_ BIT(10)
|
||||
#define _IO_HW_ BIT(11)
|
||||
#define _IO_WORD_ BIT(12)
|
||||
#define _IO_SYNC_ BIT(13)
|
||||
#define _IO_CMDMASK_ (0x1F80)
|
||||
|
||||
|
||||
/*
|
||||
For prompt mode accessing, caller shall free io_req
|
||||
Otherwise, io_handler will free io_req
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* IO STATUS TYPE */
|
||||
#define _IO_ERR_ BIT(2)
|
||||
#define _IO_SUCCESS_ BIT(1)
|
||||
#define _IO_DONE_ BIT(0)
|
||||
|
||||
|
||||
#define IO_RD32 (_IO_SYNC_ | _IO_WORD_)
|
||||
#define IO_RD16 (_IO_SYNC_ | _IO_HW_)
|
||||
#define IO_RD8 (_IO_SYNC_ | _IO_BYTE_)
|
||||
|
||||
#define IO_RD32_ASYNC (_IO_WORD_)
|
||||
#define IO_RD16_ASYNC (_IO_HW_)
|
||||
#define IO_RD8_ASYNC (_IO_BYTE_)
|
||||
|
||||
#define IO_WR32 (_IO_WRITE_ | _IO_SYNC_ | _IO_WORD_)
|
||||
#define IO_WR16 (_IO_WRITE_ | _IO_SYNC_ | _IO_HW_)
|
||||
#define IO_WR8 (_IO_WRITE_ | _IO_SYNC_ | _IO_BYTE_)
|
||||
|
||||
#define IO_WR32_ASYNC (_IO_WRITE_ | _IO_WORD_)
|
||||
#define IO_WR16_ASYNC (_IO_WRITE_ | _IO_HW_)
|
||||
#define IO_WR8_ASYNC (_IO_WRITE_ | _IO_BYTE_)
|
||||
|
||||
/*
|
||||
|
||||
Only Sync. burst accessing is provided.
|
||||
|
||||
*/
|
||||
|
||||
#define IO_WR_BURST(x) (_IO_WRITE_ | _IO_SYNC_ | _IO_BURST_ | ( (x) & _IOSZ_MASK_))
|
||||
#define IO_RD_BURST(x) (_IO_SYNC_ | _IO_BURST_ | ( (x) & _IOSZ_MASK_))
|
||||
|
||||
|
||||
|
||||
/* below is for the intf_option bit defition... */
|
||||
|
||||
#define _INTF_ASYNC_ BIT(0) /* support async io */
|
||||
|
||||
struct intf_priv;
|
||||
|
||||
struct io_req {
|
||||
struct list_head list;
|
||||
u32 addr;
|
||||
volatile u32 val;
|
||||
u32 command;
|
||||
u32 status;
|
||||
u8 *pbuf;
|
||||
|
||||
void (*_async_io_callback)(struct rtw_adapter *padater, struct io_req *pio_req, u8 *cnxt);
|
||||
u8 *cnxt;
|
||||
};
|
||||
|
||||
struct reg_protocol_rd {
|
||||
|
||||
#ifdef __LITTLE_ENDIAN
|
||||
|
||||
/* DW1 */
|
||||
u32 NumOfTrans:4;
|
||||
u32 Reserved1:4;
|
||||
u32 Reserved2:24;
|
||||
/* DW2 */
|
||||
u32 ByteCount:7;
|
||||
u32 WriteEnable:1; /* 0:read, 1:write */
|
||||
u32 FixOrContinuous:1; /* 0:continuous, 1: Fix */
|
||||
u32 BurstMode:1;
|
||||
u32 Byte1Access:1;
|
||||
u32 Byte2Access:1;
|
||||
u32 Byte4Access:1;
|
||||
u32 Reserved3:3;
|
||||
u32 Reserved4:16;
|
||||
/* DW3 */
|
||||
u32 BusAddress;
|
||||
/* DW4 */
|
||||
/* u32 Value; */
|
||||
#else
|
||||
|
||||
|
||||
/* DW1 */
|
||||
u32 Reserved1 :4;
|
||||
u32 NumOfTrans :4;
|
||||
|
||||
u32 Reserved2 :24;
|
||||
|
||||
/* DW2 */
|
||||
u32 WriteEnable : 1;
|
||||
u32 ByteCount :7;
|
||||
|
||||
|
||||
u32 Reserved3 : 3;
|
||||
u32 Byte4Access : 1;
|
||||
|
||||
u32 Byte2Access : 1;
|
||||
u32 Byte1Access : 1;
|
||||
u32 BurstMode :1 ;
|
||||
u32 FixOrContinuous : 1;
|
||||
|
||||
u32 Reserved4 : 16;
|
||||
|
||||
/* DW3 */
|
||||
u32 BusAddress;
|
||||
|
||||
/* DW4 */
|
||||
/* u32 Value; */
|
||||
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
|
||||
struct reg_protocol_wt {
|
||||
|
||||
|
||||
#ifdef __LITTLE_ENDIAN
|
||||
|
||||
/* DW1 */
|
||||
u32 NumOfTrans:4;
|
||||
u32 Reserved1:4;
|
||||
u32 Reserved2:24;
|
||||
/* DW2 */
|
||||
u32 ByteCount:7;
|
||||
u32 WriteEnable:1; /* 0:read, 1:write */
|
||||
u32 FixOrContinuous:1; /* 0:continuous, 1: Fix */
|
||||
u32 BurstMode:1;
|
||||
u32 Byte1Access:1;
|
||||
u32 Byte2Access:1;
|
||||
u32 Byte4Access:1;
|
||||
u32 Reserved3:3;
|
||||
u32 Reserved4:16;
|
||||
/* DW3 */
|
||||
u32 BusAddress;
|
||||
/* DW4 */
|
||||
u32 Value;
|
||||
|
||||
#else
|
||||
/* DW1 */
|
||||
u32 Reserved1 :4;
|
||||
u32 NumOfTrans :4;
|
||||
|
||||
u32 Reserved2 :24;
|
||||
|
||||
/* DW2 */
|
||||
u32 WriteEnable : 1;
|
||||
u32 ByteCount :7;
|
||||
|
||||
u32 Reserved3 : 3;
|
||||
u32 Byte4Access : 1;
|
||||
|
||||
u32 Byte2Access : 1;
|
||||
u32 Byte1Access : 1;
|
||||
u32 BurstMode :1 ;
|
||||
u32 FixOrContinuous : 1;
|
||||
|
||||
u32 Reserved4 : 16;
|
||||
|
||||
/* DW3 */
|
||||
u32 BusAddress;
|
||||
|
||||
/* DW4 */
|
||||
u32 Value;
|
||||
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
#define PlatformEFIOWrite1Byte(_a, _b, _c) \
|
||||
rtl8723au_write8(_a, _b, _c)
|
||||
#define PlatformEFIOWrite2Byte(_a, _b, _c) \
|
||||
rtl8723au_write16(_a, _b, _c)
|
||||
#define PlatformEFIOWrite4Byte(_a, _b, _c) \
|
||||
rtl8723au_write32(_a, _b, _c)
|
||||
|
||||
#define PlatformEFIORead1Byte(_a, _b) rtl8723au_read8(_a, _b)
|
||||
#define PlatformEFIORead2Byte(_a, _b) rtl8723au_read16(_a, _b)
|
||||
#define PlatformEFIORead4Byte(_a, _b) rtl8723au_read32(_a, _b)
|
||||
|
||||
#endif /* _RTL8711_IO_H_ */
|
|
@ -1,340 +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.
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef __RTW_MLME_H_
|
||||
#define __RTW_MLME_H_
|
||||
|
||||
#include <osdep_service.h>
|
||||
#include <mlme_osdep.h>
|
||||
#include <drv_types.h>
|
||||
#include <wlan_bssdef.h>
|
||||
|
||||
#define MAX_BSS_CNT 128
|
||||
#define MAX_JOIN_TIMEOUT 6500
|
||||
|
||||
/* Increase the scanning timeout because of increasing the SURVEY_TO value. */
|
||||
|
||||
#define SCANNING_TIMEOUT 8000
|
||||
|
||||
#define SCAN_INTERVAL (30) /* unit:2sec, 30*2 = 60sec */
|
||||
|
||||
#define SCANQUEUE_LIFETIME 20 /* unit:sec */
|
||||
|
||||
#define WIFI_NULL_STATE 0x00000000
|
||||
|
||||
#define WIFI_ASOC_STATE 0x00000001 /* Under Linked state.*/
|
||||
#define WIFI_REASOC_STATE 0x00000002
|
||||
#define WIFI_SLEEP_STATE 0x00000004
|
||||
#define WIFI_STATION_STATE 0x00000008
|
||||
|
||||
#define WIFI_AP_STATE 0x00000010
|
||||
#define WIFI_ADHOC_STATE 0x00000020
|
||||
#define WIFI_ADHOC_MASTER_STATE 0x00000040
|
||||
#define WIFI_UNDER_LINKING 0x00000080
|
||||
|
||||
#define WIFI_UNDER_WPS 0x00000100
|
||||
#define WIFI_STA_ALIVE_CHK_STATE 0x00000400
|
||||
/* to indicate the station is under site surveying */
|
||||
#define WIFI_SITE_MONITOR 0x00000800
|
||||
|
||||
#define WIFI_MP_STATE 0x00010000
|
||||
#define WIFI_MP_CTX_BACKGROUND 0x00020000 /* in continuous tx background */
|
||||
#define WIFI_MP_CTX_ST 0x00040000 /* in continuous tx with single-tone */
|
||||
#define WIFI_MP_CTX_BACKGROUND_PENDING 0x00080000 /* pending in continuous tx background due to out of skb */
|
||||
#define WIFI_MP_CTX_CCK_HW 0x00100000 /* in continuous tx */
|
||||
#define WIFI_MP_CTX_CCK_CS 0x00200000 /* in continuous tx with carrier suppression */
|
||||
#define WIFI_MP_LPBK_STATE 0x00400000
|
||||
|
||||
#define _FW_UNDER_LINKING WIFI_UNDER_LINKING
|
||||
#define _FW_LINKED WIFI_ASOC_STATE
|
||||
#define _FW_UNDER_SURVEY WIFI_SITE_MONITOR
|
||||
|
||||
|
||||
enum dot11AuthAlgrthmNum {
|
||||
dot11AuthAlgrthm_Open = 0,
|
||||
dot11AuthAlgrthm_Shared,
|
||||
dot11AuthAlgrthm_8021X,
|
||||
dot11AuthAlgrthm_Auto,
|
||||
dot11AuthAlgrthm_MaxNum
|
||||
};
|
||||
|
||||
/* Scan type including active and passive scan. */
|
||||
enum rt_scan_type {
|
||||
SCAN_PASSIVE,
|
||||
SCAN_ACTIVE,
|
||||
SCAN_MIX,
|
||||
};
|
||||
|
||||
enum {
|
||||
GHZ24_50 = 0,
|
||||
GHZ_50,
|
||||
GHZ_24,
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
there are several "locks" in mlme_priv,
|
||||
since mlme_priv is a shared resource between many threads,
|
||||
like ISR/Call-Back functions, the OID handlers, and even timer functions.
|
||||
|
||||
|
||||
Each _queue has its own locks, already.
|
||||
Other items are protected by mlme_priv.lock.
|
||||
|
||||
To avoid possible dead lock, any thread trying to modifiying mlme_priv
|
||||
SHALL not lock up more than one locks at a time!
|
||||
*/
|
||||
|
||||
struct rt_link_detect {
|
||||
u32 NumTxOkInPeriod;
|
||||
u32 NumRxOkInPeriod;
|
||||
u32 NumRxUnicastOkInPeriod;
|
||||
bool bBusyTraffic;
|
||||
bool bTxBusyTraffic;
|
||||
bool bRxBusyTraffic;
|
||||
bool bHigherBusyTraffic; /* For interrupt migration purpose. */
|
||||
bool bHigherBusyRxTraffic; /* We may disable Tx interrupt according as Rx traffic. */
|
||||
bool bHigherBusyTxTraffic; /* We may disable Tx interrupt according as Tx traffic. */
|
||||
};
|
||||
|
||||
struct mlme_priv {
|
||||
spinlock_t lock;
|
||||
int fw_state;
|
||||
u8 bScanInProcess;
|
||||
u8 to_join; /* flag */
|
||||
u8 to_roaming; /* roaming trying times */
|
||||
|
||||
struct rtw_adapter *nic_hdl;
|
||||
|
||||
u8 not_indic_disco;
|
||||
struct rtw_queue scanned_queue;
|
||||
|
||||
struct cfg80211_ssid assoc_ssid;
|
||||
u8 assoc_bssid[6];
|
||||
|
||||
struct wlan_network cur_network;
|
||||
|
||||
/* uint wireless_mode; no used, remove it */
|
||||
|
||||
u32 scan_interval;
|
||||
|
||||
struct timer_list assoc_timer;
|
||||
|
||||
uint assoc_by_bssid;
|
||||
uint assoc_by_rssi;
|
||||
|
||||
struct timer_list scan_to_timer;
|
||||
|
||||
struct timer_list set_scan_deny_timer;
|
||||
atomic_t set_scan_deny; /* 0: allowed, 1: deny */
|
||||
|
||||
unsigned int qos_option;
|
||||
|
||||
/* Number of non-HT AP/stations */
|
||||
int num_sta_no_ht;
|
||||
|
||||
int num_FortyMHzIntolerant;
|
||||
|
||||
struct ht_priv htpriv;
|
||||
|
||||
struct rt_link_detect LinkDetectInfo;
|
||||
struct timer_list dynamic_chk_timer; /* dynamic/periodic check timer */
|
||||
|
||||
u8 key_mask; /* use for ips to set wep key after ips_leave23a */
|
||||
u8 acm_mask; /* for wmm acm mask */
|
||||
u8 ChannelPlan;
|
||||
enum rt_scan_type scan_mode; /* active: 1, passive: 0 */
|
||||
|
||||
u8 *wps_probe_req_ie;
|
||||
u32 wps_probe_req_ie_len;
|
||||
u8 *assoc_req;
|
||||
u32 assoc_req_len;
|
||||
u32 assoc_rsp_len;
|
||||
u8 *assoc_rsp;
|
||||
|
||||
#ifdef CONFIG_8723AU_AP_MODE
|
||||
/* Number of associated Non-ERP stations (i.e., stations using 802.11b
|
||||
* in 802.11g BSS) */
|
||||
int num_sta_non_erp;
|
||||
|
||||
/* Number of associated stations that do not support Short Slot Time */
|
||||
int num_sta_no_short_slot_time;
|
||||
|
||||
/* Number of associated stations that do not support Short Preamble */
|
||||
int num_sta_no_short_preamble;
|
||||
|
||||
int olbc; /* Overlapping Legacy BSS Condition */
|
||||
|
||||
/* Number of HT associated stations that do not support greenfield */
|
||||
int num_sta_ht_no_gf;
|
||||
|
||||
/* Number of associated non-HT stations */
|
||||
/* int num_sta_no_ht; */
|
||||
|
||||
/* Number of HT associated stations 20 MHz */
|
||||
int num_sta_ht_20mhz;
|
||||
|
||||
/* Overlapping BSS information */
|
||||
int olbc_ht;
|
||||
|
||||
u16 ht_op_mode;
|
||||
|
||||
spinlock_t bcn_update_lock;
|
||||
u8 update_bcn;
|
||||
|
||||
#endif /* ifdef CONFIG_8723AU_AP_MODE */
|
||||
};
|
||||
|
||||
void rtw_joinbss_event_prehandle23a(struct rtw_adapter *adapter, u8 *pbuf);
|
||||
void rtw_survey_event_cb23a(struct rtw_adapter *adapter, const u8 *pbuf);
|
||||
void rtw_surveydone_event_callback23a(struct rtw_adapter *adapter, const u8 *pbuf);
|
||||
void rtw23a_joinbss_event_cb(struct rtw_adapter *adapter, const u8 *pbuf);
|
||||
void rtw_stassoc_event_callback23a(struct rtw_adapter *adapter, const u8 *pbuf);
|
||||
void rtw_stadel_event_callback23a(struct rtw_adapter *adapter, const u8 *pbuf);
|
||||
|
||||
int event_thread(void *context);
|
||||
void rtw23a_join_to_handler(unsigned long);
|
||||
|
||||
void rtw_free_network_queue23a(struct rtw_adapter *adapter);
|
||||
int rtw_init_mlme_priv23a(struct rtw_adapter *adapter);
|
||||
|
||||
void rtw_free_mlme_priv23a(struct mlme_priv *pmlmepriv);
|
||||
|
||||
int rtw_do_join_adhoc(struct rtw_adapter *adapter);
|
||||
int rtw_do_join_network(struct rtw_adapter *adapter,
|
||||
struct wlan_network *candidate);
|
||||
int rtw_select_and_join_from_scanned_queue23a(struct mlme_priv *pmlmepriv);
|
||||
int rtw_set_key23a(struct rtw_adapter *adapter,
|
||||
struct security_priv *psecuritypriv, int keyid, u8 set_tx);
|
||||
int rtw_set_auth23a(struct rtw_adapter *adapter,
|
||||
struct security_priv *psecuritypriv);
|
||||
|
||||
static inline u8 *get_bssid(struct mlme_priv *pmlmepriv)
|
||||
{ /* if sta_mode:pmlmepriv->cur_network.network.MacAddress => bssid */
|
||||
/* if adhoc_mode:pmlmepriv->cur_network.network.MacAddress => ibss mac address */
|
||||
return pmlmepriv->cur_network.network.MacAddress;
|
||||
}
|
||||
|
||||
static inline bool check_fwstate(struct mlme_priv *pmlmepriv, int state)
|
||||
{
|
||||
if (pmlmepriv->fw_state & state)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline int get_fwstate(struct mlme_priv *pmlmepriv)
|
||||
{
|
||||
return pmlmepriv->fw_state;
|
||||
}
|
||||
|
||||
/*
|
||||
* No Limit on the calling context,
|
||||
* therefore set it to be the critical section...
|
||||
*
|
||||
* ### NOTE:#### (!!!!)
|
||||
* MUST TAKE CARE THAT BEFORE CALLING THIS FUNC, YOU SHOULD HAVE LOCKED pmlmepriv->lock
|
||||
*/
|
||||
static inline void set_fwstate(struct mlme_priv *pmlmepriv, int state)
|
||||
{
|
||||
pmlmepriv->fw_state |= state;
|
||||
/* FOR HW integration */
|
||||
if (_FW_UNDER_SURVEY == state)
|
||||
pmlmepriv->bScanInProcess = true;
|
||||
}
|
||||
|
||||
static inline void _clr_fwstate_(struct mlme_priv *pmlmepriv, int state)
|
||||
{
|
||||
pmlmepriv->fw_state &= ~state;
|
||||
/* FOR HW integration */
|
||||
if (_FW_UNDER_SURVEY == state)
|
||||
pmlmepriv->bScanInProcess = false;
|
||||
}
|
||||
|
||||
/*
|
||||
* No Limit on the calling context,
|
||||
* therefore set it to be the critical section...
|
||||
*/
|
||||
static inline void clr_fwstate(struct mlme_priv *pmlmepriv, int state)
|
||||
{
|
||||
spin_lock_bh(&pmlmepriv->lock);
|
||||
if (check_fwstate(pmlmepriv, state))
|
||||
pmlmepriv->fw_state ^= state;
|
||||
spin_unlock_bh(&pmlmepriv->lock);
|
||||
}
|
||||
|
||||
static inline void clr_fwstate_ex(struct mlme_priv *pmlmepriv, int state)
|
||||
{
|
||||
spin_lock_bh(&pmlmepriv->lock);
|
||||
_clr_fwstate_(pmlmepriv, state);
|
||||
spin_unlock_bh(&pmlmepriv->lock);
|
||||
}
|
||||
|
||||
void rtw_disconnect_hdl23a_under_linked(struct rtw_adapter *adapter,
|
||||
struct sta_info *psta, u8 free_assoc);
|
||||
void rtw_generate_random_ibss23a(u8 *pibss);
|
||||
struct wlan_network *rtw_find_network23a(struct rtw_queue *scanned_queue, u8 *addr);
|
||||
struct wlan_network *rtw_get_oldest_wlan_network23a(struct rtw_queue *scanned_queue);
|
||||
|
||||
void rtw_free_assoc_resources23a(struct rtw_adapter *adapter,
|
||||
int lock_scanned_queue);
|
||||
void rtw_indicate_disconnect23a(struct rtw_adapter *adapter);
|
||||
void rtw_indicate_connect23a(struct rtw_adapter *adapter);
|
||||
void rtw_scan_abort23a(struct rtw_adapter *adapter);
|
||||
|
||||
int rtw_restruct_sec_ie23a(struct rtw_adapter *adapter, u8 *in_ie, u8 *out_ie,
|
||||
uint in_len);
|
||||
int rtw_restruct_wmm_ie23a(struct rtw_adapter *adapter, u8 *in_ie, u8 *out_ie,
|
||||
uint in_len, uint initial_out_len);
|
||||
void rtw_init_registrypriv_dev_network23a(struct rtw_adapter *adapter);
|
||||
|
||||
void rtw_update_registrypriv_dev_network23a(struct rtw_adapter *adapter);
|
||||
|
||||
void rtw_scan_timeout_handler23a(unsigned long data);
|
||||
|
||||
void rtw_dynamic_check_timer_handler(unsigned long data);
|
||||
bool rtw_is_scan_deny(struct rtw_adapter *adapter);
|
||||
void rtw_clear_scan_deny(struct rtw_adapter *adapter);
|
||||
void rtw_set_scan_deny_timer_hdl(unsigned long data);
|
||||
void rtw_set_scan_deny(struct rtw_adapter *adapter, u32 ms);
|
||||
|
||||
void rtw23a_free_mlme_priv_ie_data(struct mlme_priv *pmlmepriv);
|
||||
|
||||
void _rtw_free_mlme_priv23a(struct mlme_priv *pmlmepriv);
|
||||
|
||||
struct wlan_network *rtw_alloc_network(struct mlme_priv *pmlmepriv, gfp_t gfp);
|
||||
|
||||
int rtw_if_up23a(struct rtw_adapter *padapter);
|
||||
|
||||
int rtw_linked_check(struct rtw_adapter *padapter);
|
||||
|
||||
void rtw_joinbss_reset23a(struct rtw_adapter *padapter);
|
||||
|
||||
bool rtw_restructure_ht_ie23a(struct rtw_adapter *padapter, u8 *in_ie,
|
||||
u8 *out_ie, uint in_len, uint *pout_len);
|
||||
void rtw_update_ht_cap23a(struct rtw_adapter *padapter,
|
||||
u8 *pie, uint ie_len);
|
||||
void rtw_issue_addbareq_cmd23a(struct rtw_adapter *padapter,
|
||||
struct xmit_frame *pxmitframe);
|
||||
|
||||
bool rtw_is_same_ibss23a(struct rtw_adapter *adapter,
|
||||
struct wlan_network *pnetwork);
|
||||
int is_same_network23a(struct wlan_bssid_ex *src, struct wlan_bssid_ex *dst);
|
||||
|
||||
void rtw23a_roaming(struct rtw_adapter *adapter,
|
||||
struct wlan_network *tgt_network);
|
||||
void rtw_set_roaming(struct rtw_adapter *adapter, u8 to_roaming);
|
||||
|
||||
#endif /* __RTL871X_MLME_H_ */
|
|
@ -1,683 +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.
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef __RTW_MLME_EXT_H_
|
||||
#define __RTW_MLME_EXT_H_
|
||||
|
||||
#include <osdep_service.h>
|
||||
#include <drv_types.h>
|
||||
#include <wlan_bssdef.h>
|
||||
|
||||
|
||||
/* Commented by Albert 20101105 */
|
||||
/* Increase the SURVEY_TO value from 100 to 150 ( 100ms to 150ms ) */
|
||||
/* The Realtek 8188CE SoftAP will spend around 100ms to send the probe response after receiving the probe request. */
|
||||
/* So, this driver tried to extend the dwell time for each scanning channel. */
|
||||
/* This will increase the chance to receive the probe response from SoftAP. */
|
||||
|
||||
#define SURVEY_TO (100)
|
||||
#define REAUTH_TO (300) /* 50) */
|
||||
#define REASSOC_TO (300) /* 50) */
|
||||
/* define DISCONNECT_TO (3000) */
|
||||
#define ADDBA_TO (2000)
|
||||
|
||||
#define LINKED_TO (1) /* unit:2 sec, 1x2=2 sec */
|
||||
|
||||
#define REAUTH_LIMIT (4)
|
||||
#define REASSOC_LIMIT (4)
|
||||
#define READDBA_LIMIT (2)
|
||||
|
||||
#define ROAMING_LIMIT 8
|
||||
|
||||
#define DYNAMIC_FUNC_DISABLE (0x0)
|
||||
|
||||
/* ====== enum odm_ability ======== */
|
||||
/* BB ODM section BIT 0-15 */
|
||||
#define DYNAMIC_BB_DIG BIT(0)
|
||||
#define DYNAMIC_BB_RA_MASK BIT(1)
|
||||
#define DYNAMIC_BB_DYNAMIC_TXPWR BIT(2)
|
||||
#define DYNAMIC_BB_BB_FA_CNT BIT(3)
|
||||
|
||||
#define DYNAMIC_BB_RSSI_MONITOR BIT(4)
|
||||
#define DYNAMIC_BB_CCK_PD BIT(5)
|
||||
#define DYNAMIC_BB_ANT_DIV BIT(6)
|
||||
#define DYNAMIC_BB_PWR_SAVE BIT(7)
|
||||
#define DYNAMIC_BB_PWR_TRAIN BIT(8)
|
||||
#define DYNAMIC_BB_RATE_ADAPTIVE BIT(9)
|
||||
#define DYNAMIC_BB_PATH_DIV BIT(10)
|
||||
#define DYNAMIC_BB_PSD BIT(11)
|
||||
|
||||
/* MAC DM section BIT 16-23 */
|
||||
#define DYNAMIC_MAC_struct edca_turboURBO BIT(16)
|
||||
#define DYNAMIC_MAC_EARLY_MODE BIT(17)
|
||||
|
||||
/* RF ODM section BIT 24-31 */
|
||||
#define DYNAMIC_RF_TX_PWR_TRACK BIT(24)
|
||||
#define DYNAMIC_RF_RX_GAIN_TRACK BIT(25)
|
||||
#define DYNAMIC_RF_CALIBRATION BIT(26)
|
||||
|
||||
#define DYNAMIC_ALL_FUNC_ENABLE 0xFFFFFFF
|
||||
|
||||
#define _HW_STATE_NOLINK_ 0x00
|
||||
#define _HW_STATE_ADHOC_ 0x01
|
||||
#define _HW_STATE_STATION_ 0x02
|
||||
#define _HW_STATE_AP_ 0x03
|
||||
|
||||
|
||||
#define _1M_RATE_ 0
|
||||
#define _2M_RATE_ 1
|
||||
#define _5M_RATE_ 2
|
||||
#define _11M_RATE_ 3
|
||||
#define _6M_RATE_ 4
|
||||
#define _9M_RATE_ 5
|
||||
#define _12M_RATE_ 6
|
||||
#define _18M_RATE_ 7
|
||||
#define _24M_RATE_ 8
|
||||
#define _36M_RATE_ 9
|
||||
#define _48M_RATE_ 10
|
||||
#define _54M_RATE_ 11
|
||||
|
||||
|
||||
extern unsigned char WMM_OUI23A[];
|
||||
extern unsigned char WPS_OUI23A[];
|
||||
extern unsigned char WFD_OUI23A[];
|
||||
extern unsigned char P2P_OUI23A[];
|
||||
|
||||
extern unsigned char WMM_INFO_OUI23A[];
|
||||
extern unsigned char WMM_PARA_OUI23A[];
|
||||
|
||||
|
||||
/* */
|
||||
/* Channel Plan Type. */
|
||||
/* Note: */
|
||||
/* We just add new channel plan when the new channel plan is different from any of the following */
|
||||
/* channel plan. */
|
||||
/* If you just want to customize the actions(scan period or join actions) about one of the channel plan, */
|
||||
/* customize them in struct rt_channel_info in the RT_CHANNEL_LIST. */
|
||||
/* */
|
||||
enum { /* _RT_CHANNEL_DOMAIN */
|
||||
/* old channel plan mapping ===== */
|
||||
RT_CHANNEL_DOMAIN_FCC = 0x00,
|
||||
RT_CHANNEL_DOMAIN_IC = 0x01,
|
||||
RT_CHANNEL_DOMAIN_ETSI = 0x02,
|
||||
RT_CHANNEL_DOMAIN_SPAIN = 0x03,
|
||||
RT_CHANNEL_DOMAIN_FRANCE = 0x04,
|
||||
RT_CHANNEL_DOMAIN_MKK = 0x05,
|
||||
RT_CHANNEL_DOMAIN_MKK1 = 0x06,
|
||||
RT_CHANNEL_DOMAIN_ISRAEL = 0x07,
|
||||
RT_CHANNEL_DOMAIN_TELEC = 0x08,
|
||||
RT_CHANNEL_DOMAIN_GLOBAL_DOAMIN = 0x09,
|
||||
RT_CHANNEL_DOMAIN_WORLD_WIDE_13 = 0x0A,
|
||||
RT_CHANNEL_DOMAIN_TAIWAN = 0x0B,
|
||||
RT_CHANNEL_DOMAIN_CHINA = 0x0C,
|
||||
RT_CHANNEL_DOMAIN_SINGAPORE_INDIA_MEXICO = 0x0D,
|
||||
RT_CHANNEL_DOMAIN_KOREA = 0x0E,
|
||||
RT_CHANNEL_DOMAIN_TURKEY = 0x0F,
|
||||
RT_CHANNEL_DOMAIN_JAPAN = 0x10,
|
||||
RT_CHANNEL_DOMAIN_FCC_NO_DFS = 0x11,
|
||||
RT_CHANNEL_DOMAIN_JAPAN_NO_DFS = 0x12,
|
||||
RT_CHANNEL_DOMAIN_WORLD_WIDE_5G = 0x13,
|
||||
RT_CHANNEL_DOMAIN_TAIWAN_NO_DFS = 0x14,
|
||||
|
||||
/* new channel plan mapping, (2GDOMAIN_5GDOMAIN) ===== */
|
||||
RT_CHANNEL_DOMAIN_WORLD_NULL = 0x20,
|
||||
RT_CHANNEL_DOMAIN_ETSI1_NULL = 0x21,
|
||||
RT_CHANNEL_DOMAIN_FCC1_NULL = 0x22,
|
||||
RT_CHANNEL_DOMAIN_MKK1_NULL = 0x23,
|
||||
RT_CHANNEL_DOMAIN_ETSI2_NULL = 0x24,
|
||||
RT_CHANNEL_DOMAIN_FCC1_FCC1 = 0x25,
|
||||
RT_CHANNEL_DOMAIN_WORLD_ETSI1 = 0x26,
|
||||
RT_CHANNEL_DOMAIN_MKK1_MKK1 = 0x27,
|
||||
RT_CHANNEL_DOMAIN_WORLD_KCC1 = 0x28,
|
||||
RT_CHANNEL_DOMAIN_WORLD_FCC2 = 0x29,
|
||||
RT_CHANNEL_DOMAIN_WORLD_FCC3 = 0x30,
|
||||
RT_CHANNEL_DOMAIN_WORLD_FCC4 = 0x31,
|
||||
RT_CHANNEL_DOMAIN_WORLD_FCC5 = 0x32,
|
||||
RT_CHANNEL_DOMAIN_WORLD_FCC6 = 0x33,
|
||||
RT_CHANNEL_DOMAIN_FCC1_FCC7 = 0x34,
|
||||
RT_CHANNEL_DOMAIN_WORLD_ETSI2 = 0x35,
|
||||
RT_CHANNEL_DOMAIN_WORLD_ETSI3 = 0x36,
|
||||
RT_CHANNEL_DOMAIN_MKK1_MKK2 = 0x37,
|
||||
RT_CHANNEL_DOMAIN_MKK1_MKK3 = 0x38,
|
||||
RT_CHANNEL_DOMAIN_FCC1_NCC1 = 0x39,
|
||||
RT_CHANNEL_DOMAIN_FCC1_NCC2 = 0x40,
|
||||
RT_CHANNEL_DOMAIN_GLOBAL_DOAMIN_2G = 0x41,
|
||||
/* Add new channel plan above this line=============== */
|
||||
RT_CHANNEL_DOMAIN_MAX,
|
||||
RT_CHANNEL_DOMAIN_REALTEK_DEFINE = 0x7F,
|
||||
};
|
||||
|
||||
enum { /* _RT_CHANNEL_DOMAIN_2G */
|
||||
RT_CHANNEL_DOMAIN_2G_WORLD = 0x00, /* Worldwird 13 */
|
||||
RT_CHANNEL_DOMAIN_2G_ETSI1 = 0x01, /* Europe */
|
||||
RT_CHANNEL_DOMAIN_2G_FCC1 = 0x02, /* US */
|
||||
RT_CHANNEL_DOMAIN_2G_MKK1 = 0x03, /* Japan */
|
||||
RT_CHANNEL_DOMAIN_2G_ETSI2 = 0x04, /* France */
|
||||
RT_CHANNEL_DOMAIN_2G_NULL = 0x05,
|
||||
/* Add new channel plan above this line=============== */
|
||||
RT_CHANNEL_DOMAIN_2G_MAX,
|
||||
};
|
||||
|
||||
enum { /* _RT_CHANNEL_DOMAIN_5G */
|
||||
RT_CHANNEL_DOMAIN_5G_NULL = 0x00,
|
||||
RT_CHANNEL_DOMAIN_5G_ETSI1 = 0x01, /* Europe */
|
||||
RT_CHANNEL_DOMAIN_5G_ETSI2 = 0x02, /* Australia, New Zealand */
|
||||
RT_CHANNEL_DOMAIN_5G_ETSI3 = 0x03, /* Russia */
|
||||
RT_CHANNEL_DOMAIN_5G_FCC1 = 0x04, /* US */
|
||||
RT_CHANNEL_DOMAIN_5G_FCC2 = 0x05, /* FCC o/w DFS Channels */
|
||||
RT_CHANNEL_DOMAIN_5G_FCC3 = 0x06, /* India, Mexico */
|
||||
RT_CHANNEL_DOMAIN_5G_FCC4 = 0x07, /* Venezuela */
|
||||
RT_CHANNEL_DOMAIN_5G_FCC5 = 0x08, /* China */
|
||||
RT_CHANNEL_DOMAIN_5G_FCC6 = 0x09, /* Israel */
|
||||
RT_CHANNEL_DOMAIN_5G_FCC7_IC1 = 0x0A, /* US, Canada */
|
||||
RT_CHANNEL_DOMAIN_5G_KCC1 = 0x0B, /* Korea */
|
||||
RT_CHANNEL_DOMAIN_5G_MKK1 = 0x0C, /* Japan */
|
||||
RT_CHANNEL_DOMAIN_5G_MKK2 = 0x0D, /* Japan (W52, W53) */
|
||||
RT_CHANNEL_DOMAIN_5G_MKK3 = 0x0E, /* Japan (W56) */
|
||||
RT_CHANNEL_DOMAIN_5G_NCC1 = 0x0F, /* Taiwan */
|
||||
RT_CHANNEL_DOMAIN_5G_NCC2 = 0x10, /* Taiwan o/w DFS */
|
||||
/* Add new channel plan above this line=============== */
|
||||
/* Driver Self Defined ===== */
|
||||
RT_CHANNEL_DOMAIN_5G_FCC = 0x11,
|
||||
RT_CHANNEL_DOMAIN_5G_JAPAN_NO_DFS = 0x12,
|
||||
RT_CHANNEL_DOMAIN_5G_FCC4_NO_DFS = 0x13,
|
||||
RT_CHANNEL_DOMAIN_5G_MAX,
|
||||
};
|
||||
|
||||
#define rtw_is_channel_plan_valid(chplan) (chplan<RT_CHANNEL_DOMAIN_MAX || chplan == RT_CHANNEL_DOMAIN_REALTEK_DEFINE)
|
||||
|
||||
struct rt_channel_plan {
|
||||
unsigned char Channel[MAX_CHANNEL_NUM];
|
||||
unsigned char Len;
|
||||
};
|
||||
|
||||
struct rt_channel_plan_2g {
|
||||
unsigned char Channel[MAX_CHANNEL_NUM_2G];
|
||||
unsigned char Len;
|
||||
};
|
||||
|
||||
struct rt_channel_plan_5g {
|
||||
unsigned char Channel[MAX_CHANNEL_NUM_5G];
|
||||
unsigned char Len;
|
||||
};
|
||||
|
||||
struct rt_channel_plan_map {
|
||||
unsigned char Index2G;
|
||||
unsigned char Index5G;
|
||||
};
|
||||
|
||||
enum Associated_AP {
|
||||
atherosAP = 0,
|
||||
broadcomAP = 1,
|
||||
ciscoAP = 2,
|
||||
marvellAP = 3,
|
||||
ralinkAP = 4,
|
||||
realtekAP = 5,
|
||||
airgocapAP = 6,
|
||||
unknownAP = 7,
|
||||
maxAP,
|
||||
};
|
||||
|
||||
enum { /* HT_IOT_PEER_E */
|
||||
HT_IOT_PEER_UNKNOWN = 0,
|
||||
HT_IOT_PEER_REALTEK = 1,
|
||||
HT_IOT_PEER_REALTEK_92SE = 2,
|
||||
HT_IOT_PEER_BROADCOM = 3,
|
||||
HT_IOT_PEER_RALINK = 4,
|
||||
HT_IOT_PEER_ATHEROS = 5,
|
||||
HT_IOT_PEER_CISCO = 6,
|
||||
HT_IOT_PEER_MERU = 7,
|
||||
HT_IOT_PEER_MARVELL = 8,
|
||||
HT_IOT_PEER_REALTEK_SOFTAP = 9,/* peer is RealTek SOFT_AP, by Bohn, 2009.12.17 */
|
||||
HT_IOT_PEER_SELF_SOFTAP = 10, /* Self is SoftAP */
|
||||
HT_IOT_PEER_AIRGO = 11,
|
||||
HT_IOT_PEER_INTEL = 12,
|
||||
HT_IOT_PEER_RTK_APCLIENT = 13,
|
||||
HT_IOT_PEER_REALTEK_81XX = 14,
|
||||
HT_IOT_PEER_REALTEK_WOW = 15,
|
||||
HT_IOT_PEER_TENDA = 16,
|
||||
HT_IOT_PEER_MAX = 17
|
||||
};
|
||||
|
||||
enum SCAN_STATE {
|
||||
SCAN_DISABLE = 0,
|
||||
SCAN_START = 1,
|
||||
SCAN_TXNULL = 2,
|
||||
SCAN_PROCESS = 3,
|
||||
SCAN_COMPLETE = 4,
|
||||
SCAN_STATE_MAX,
|
||||
};
|
||||
|
||||
struct mlme_handler {
|
||||
char *str;
|
||||
int (*func)(struct rtw_adapter *padapter, struct recv_frame *precv_frame);
|
||||
};
|
||||
|
||||
struct action_handler {
|
||||
unsigned int num;
|
||||
char *str;
|
||||
int (*func)(struct rtw_adapter *padapter, struct recv_frame *precv_frame);
|
||||
};
|
||||
|
||||
struct ss_res {
|
||||
int state;
|
||||
int bss_cnt;
|
||||
int channel_idx;
|
||||
int scan_mode;
|
||||
u8 ssid_num;
|
||||
u8 ch_num;
|
||||
struct cfg80211_ssid ssid[RTW_SSID_SCAN_AMOUNT];
|
||||
struct rtw_ieee80211_channel ch[RTW_CHANNEL_SCAN_AMOUNT];
|
||||
};
|
||||
|
||||
#define WIFI_FW_AUTH_NULL 0x00000100
|
||||
#define WIFI_FW_AUTH_STATE 0x00000200
|
||||
#define WIFI_FW_AUTH_SUCCESS 0x00000400
|
||||
|
||||
#define WIFI_FW_ASSOC_STATE 0x00002000
|
||||
#define WIFI_FW_ASSOC_SUCCESS 0x00004000
|
||||
|
||||
#define WIFI_FW_LINKING_STATE (WIFI_FW_AUTH_NULL | WIFI_FW_AUTH_STATE | WIFI_FW_AUTH_SUCCESS |WIFI_FW_ASSOC_STATE)
|
||||
|
||||
struct FW_Sta_Info {
|
||||
struct sta_info *psta;
|
||||
u32 status;
|
||||
u32 rx_pkt;
|
||||
u32 retry;
|
||||
unsigned char SupportedRates[NDIS_802_11_LENGTH_RATES_EX];
|
||||
};
|
||||
|
||||
/*
|
||||
* Usage:
|
||||
* When one iface acted as AP mode and the other iface is STA mode and scanning,
|
||||
* it should switch back to AP's operating channel periodically.
|
||||
* Parameters info:
|
||||
* When the driver scanned RTW_SCAN_NUM_OF_CH channels, it would switch back to AP's operating channel for
|
||||
* RTW_STAY_AP_CH_MILLISECOND * SURVEY_TO milliseconds.
|
||||
* Example:
|
||||
* For chip supports 2.4G + 5GHz and AP mode is operating in channel 1,
|
||||
* RTW_SCAN_NUM_OF_CH is 8, RTW_STAY_AP_CH_MILLISECOND is 3 and SURVEY_TO is 100.
|
||||
* When it's STA mode gets set_scan command,
|
||||
* it would
|
||||
* 1. Doing the scan on channel 1.2.3.4.5.6.7.8
|
||||
* 2. Back to channel 1 for 300 milliseconds
|
||||
* 3. Go through doing site survey on channel 9.10.11.36.40.44.48.52
|
||||
* 4. Back to channel 1 for 300 milliseconds
|
||||
* 5. ... and so on, till survey done.
|
||||
*/
|
||||
|
||||
struct mlme_ext_info {
|
||||
u32 state;
|
||||
u32 reauth_count;
|
||||
u32 reassoc_count;
|
||||
u32 link_count;
|
||||
u32 auth_seq;
|
||||
u32 auth_algo; /* 802.11 auth, could be open, shared, auto */
|
||||
u32 authModeToggle;
|
||||
u32 enc_algo;/* encrypt algorithm; */
|
||||
u32 key_index; /* this is only valid for legendary wep, 0~3 for key id. */
|
||||
u32 iv;
|
||||
u8 chg_txt[128];
|
||||
u16 aid;
|
||||
u16 bcn_interval;
|
||||
u16 capability;
|
||||
u8 assoc_AP_vendor;
|
||||
u8 slotTime;
|
||||
u8 preamble_mode;
|
||||
u8 WMM_enable;
|
||||
u8 ERP_enable;
|
||||
u8 ERP_IE;
|
||||
u8 HT_enable;
|
||||
u8 HT_caps_enable;
|
||||
u8 HT_info_enable;
|
||||
u8 HT_protection;
|
||||
u8 turboMode_cts2self;
|
||||
u8 turboMode_rtsen;
|
||||
u8 SM_PS;
|
||||
u8 ADDBA_retry_count;
|
||||
u8 dialogToken;
|
||||
/* Accept ADDBA Request */
|
||||
bool bAcceptAddbaReq;
|
||||
u8 bwmode_updated;
|
||||
u8 hidden_ssid_mode;
|
||||
|
||||
struct ADDBA_request ADDBA_req;
|
||||
struct WMM_para_element WMM_param;
|
||||
struct ieee80211_ht_cap ht_cap;
|
||||
struct ieee80211_ht_operation HT_info;
|
||||
struct wlan_bssid_ex network;/* join network or bss_network, if in ap mode, it is the same to cur_network.network */
|
||||
struct FW_Sta_Info FW_sta_info[NUM_STA];
|
||||
};
|
||||
|
||||
/* The channel information about this channel including joining, scanning, and power constraints. */
|
||||
struct rt_channel_info {
|
||||
u8 ChannelNum; /* The channel number. */
|
||||
enum rt_scan_type ScanType; /* Scan type such as passive or active scan. */
|
||||
};
|
||||
|
||||
int rtw_ch_set_search_ch23a(struct rt_channel_info *ch_set, const u32 ch);
|
||||
|
||||
/* P2P_MAX_REG_CLASSES - Maximum number of regulatory classes */
|
||||
#define P2P_MAX_REG_CLASSES 10
|
||||
|
||||
/* P2P_MAX_REG_CLASS_CHANNELS - Maximum number of channels per regulatory class */
|
||||
#define P2P_MAX_REG_CLASS_CHANNELS 20
|
||||
|
||||
/* struct p2p_channels - List of supported channels */
|
||||
struct p2p_channels {
|
||||
/* struct p2p_reg_class - Supported regulatory class */
|
||||
struct p2p_reg_class {
|
||||
/* reg_class - Regulatory class (IEEE 802.11-2007, Annex J) */
|
||||
u8 reg_class;
|
||||
|
||||
/* channel - Supported channels */
|
||||
u8 channel[P2P_MAX_REG_CLASS_CHANNELS];
|
||||
|
||||
/* channels - Number of channel entries in use */
|
||||
size_t channels;
|
||||
} reg_class[P2P_MAX_REG_CLASSES];
|
||||
|
||||
/* reg_classes - Number of reg_class entries in use */
|
||||
size_t reg_classes;
|
||||
};
|
||||
|
||||
struct p2p_oper_class_map {
|
||||
enum hw_mode {IEEE80211G, IEEE80211A} mode;
|
||||
u8 op_class;
|
||||
u8 min_chan;
|
||||
u8 max_chan;
|
||||
u8 inc;
|
||||
enum {
|
||||
BW20, BW40PLUS, BW40MINUS
|
||||
} bw;
|
||||
};
|
||||
|
||||
struct mlme_ext_priv {
|
||||
struct rtw_adapter *padapter;
|
||||
u8 mlmeext_init;
|
||||
atomic_t event_seq;
|
||||
u16 mgnt_seq;
|
||||
|
||||
/* struct fw_priv fwpriv; */
|
||||
|
||||
unsigned char cur_channel;
|
||||
unsigned char cur_bwmode;
|
||||
unsigned char cur_ch_offset;/* PRIME_CHNL_OFFSET */
|
||||
unsigned char cur_wireless_mode; /* NETWORK_TYPE */
|
||||
|
||||
unsigned char max_chan_nums;
|
||||
struct rt_channel_info channel_set[MAX_CHANNEL_NUM];
|
||||
struct p2p_channels channel_list;
|
||||
unsigned char basicrate[NumRates];
|
||||
unsigned char datarate[NumRates];
|
||||
|
||||
struct ss_res sitesurvey_res;
|
||||
struct mlme_ext_info mlmext_info;/* for sta/adhoc mode, including current scanning/connecting/connected related info. */
|
||||
/* for ap mode, network includes ap's cap_info */
|
||||
struct timer_list survey_timer;
|
||||
struct timer_list link_timer;
|
||||
u16 chan_scan_time;
|
||||
|
||||
u8 scan_abort;
|
||||
u8 tx_rate; /* TXRATE when USERATE is set. */
|
||||
|
||||
u32 retry; /* retry for issue probereq */
|
||||
|
||||
u64 TSFValue;
|
||||
|
||||
unsigned char bstart_bss;
|
||||
u8 update_channel_plan_by_ap_done;
|
||||
/* recv_decache check for Action_public frame */
|
||||
u8 action_public_dialog_token;
|
||||
u16 action_public_rxseq;
|
||||
u8 active_keep_alive_check;
|
||||
};
|
||||
|
||||
int init_mlme_ext_priv23a(struct rtw_adapter *padapter);
|
||||
int init_hw_mlme_ext23a(struct rtw_adapter *padapter);
|
||||
void free_mlme_ext_priv23a (struct mlme_ext_priv *pmlmeext);
|
||||
void init_mlme_ext_timer23a(struct rtw_adapter *padapter);
|
||||
void init_addba_retry_timer23a(struct sta_info *psta);
|
||||
struct xmit_frame *alloc_mgtxmitframe23a(struct xmit_priv *pxmitpriv);
|
||||
|
||||
unsigned char networktype_to_raid23a(unsigned char network_type);
|
||||
u8 judge_network_type23a(struct rtw_adapter *padapter, unsigned char *rate,
|
||||
int ratelen);
|
||||
void get_rate_set23a(struct rtw_adapter *padapter, unsigned char *pbssrate,
|
||||
int *bssrate_len);
|
||||
void UpdateBrateTbl23a(struct rtw_adapter *padapter, u8 *mBratesOS);
|
||||
void Update23aTblForSoftAP(u8 *bssrateset, u32 bssratelen);
|
||||
|
||||
u8 rtw_get_oper_ch23a(struct rtw_adapter *adapter);
|
||||
void rtw_set_oper_ch23a(struct rtw_adapter *adapter, u8 ch);
|
||||
void rtw_set_oper_bw23a(struct rtw_adapter *adapter, u8 bw);
|
||||
void rtw_set_oper_ch23aoffset23a(struct rtw_adapter *adapter, u8 offset);
|
||||
|
||||
void set_channel_bwmode23a(struct rtw_adapter *padapter, unsigned char channel,
|
||||
unsigned char channel_offset, unsigned short bwmode);
|
||||
void SelectChannel23a(struct rtw_adapter *padapter, unsigned char channel);
|
||||
|
||||
unsigned int decide_wait_for_beacon_timeout23a(unsigned int bcn_interval);
|
||||
|
||||
void clear_cam_entry23a(struct rtw_adapter *padapter, u8 entry);
|
||||
|
||||
void invalidate_cam_all23a(struct rtw_adapter *padapter);
|
||||
|
||||
int allocate_fw_sta_entry23a(struct rtw_adapter *padapter);
|
||||
void flush_all_cam_entry23a(struct rtw_adapter *padapter);
|
||||
|
||||
bool IsLegal5GChannel(struct rtw_adapter *Adapter, u8 channel);
|
||||
|
||||
void update_network23a(struct wlan_bssid_ex *dst, struct wlan_bssid_ex *src,
|
||||
struct rtw_adapter *padapter, bool update_ie);
|
||||
|
||||
u8 *get_my_bssid23a(struct wlan_bssid_ex *pnetwork);
|
||||
|
||||
bool is_client_associated_to_ap23a(struct rtw_adapter *padapter);
|
||||
bool is_client_associated_to_ibss23a(struct rtw_adapter *padapter);
|
||||
bool is_IBSS_empty23a(struct rtw_adapter *padapter);
|
||||
|
||||
unsigned char check_assoc_AP23a(u8 *pframe, uint len);
|
||||
|
||||
int WMM_param_handler23a(struct rtw_adapter *padapter, const u8 *p);
|
||||
void WMMOnAssocRsp23a(struct rtw_adapter *padapter);
|
||||
|
||||
void HT_caps_handler23a(struct rtw_adapter *padapter, const u8 *p);
|
||||
void HT_info_handler23a(struct rtw_adapter *padapter, const u8 *p);
|
||||
void HTOnAssocRsp23a(struct rtw_adapter *padapter);
|
||||
|
||||
void ERP_IE_handler23a(struct rtw_adapter *padapter, const u8 *p);
|
||||
void VCS_update23a(struct rtw_adapter *padapter, struct sta_info *psta);
|
||||
|
||||
void update_beacon23a_info(struct rtw_adapter *padapter,
|
||||
struct ieee80211_mgmt *mgmt, uint len,
|
||||
struct sta_info *psta);
|
||||
int rtw_check_bcn_info23a(struct rtw_adapter *Adapter,
|
||||
struct ieee80211_mgmt *mgmt, u32 packet_len);
|
||||
void update_IOT_info23a(struct rtw_adapter *padapter);
|
||||
void update_capinfo23a(struct rtw_adapter *Adapter, u16 updateCap);
|
||||
void update_wireless_mode23a(struct rtw_adapter *padapter);
|
||||
void update_tx_basic_rate23a(struct rtw_adapter *padapter, u8 modulation);
|
||||
void update_bmc_sta_support_rate23a(struct rtw_adapter *padapter, u32 mac_id);
|
||||
int update_sta_support_rate23a(struct rtw_adapter *padapter, u8 *pvar_ie,
|
||||
uint var_ie_len, int cam_idx);
|
||||
|
||||
/* for sta/adhoc mode */
|
||||
void update_sta_info23a(struct rtw_adapter *padapter, struct sta_info *psta);
|
||||
unsigned int update_basic_rate23a(unsigned char *ptn, unsigned int ptn_sz);
|
||||
unsigned int update_supported_rate23a(unsigned char *ptn, unsigned int ptn_sz);
|
||||
unsigned int update_MSC_rate23a(struct ieee80211_ht_cap *ht_cap);
|
||||
void Update_RA_Entry23a(struct rtw_adapter *padapter, struct sta_info *psta);
|
||||
void set_sta_rate23a(struct rtw_adapter *padapter, struct sta_info *psta);
|
||||
|
||||
int receive_disconnect23a(struct rtw_adapter *padapter,
|
||||
unsigned char *MacAddr, unsigned short reason);
|
||||
|
||||
unsigned char get_highest_rate_idx23a(u32 mask);
|
||||
int support_short_GI23a(struct rtw_adapter *padapter,
|
||||
struct ieee80211_ht_cap *ht_cap);
|
||||
bool is_ap_in_tkip23a(struct rtw_adapter *padapter);
|
||||
bool is_ap_in_wep23a(struct rtw_adapter *padapter);
|
||||
bool should_forbid_n_rate23a(struct rtw_adapter *padapter);
|
||||
|
||||
void report_join_res23a(struct rtw_adapter *padapter, int res);
|
||||
void report_survey_event23a(struct rtw_adapter *padapter,
|
||||
struct recv_frame *precv_frame);
|
||||
void report_surveydone_event23a(struct rtw_adapter *padapter);
|
||||
void report_del_sta_event23a(struct rtw_adapter *padapter,
|
||||
unsigned char *MacAddr, unsigned short reason);
|
||||
void report_add_sta_event23a(struct rtw_adapter *padapter,
|
||||
unsigned char *MacAddr, int cam_idx);
|
||||
|
||||
int set_tx_beacon_cmd23a(struct rtw_adapter*padapter);
|
||||
unsigned int setup_beacon_frame(struct rtw_adapter *padapter,
|
||||
unsigned char *beacon_frame);
|
||||
void update_mgnt_tx_rate23a(struct rtw_adapter *padapter, u8 rate);
|
||||
void update_mgntframe_attrib23a(struct rtw_adapter *padapter,
|
||||
struct pkt_attrib *pattrib);
|
||||
void dump_mgntframe23a(struct rtw_adapter *padapter,
|
||||
struct xmit_frame *pmgntframe);
|
||||
s32 dump_mgntframe23a_and_wait(struct rtw_adapter *padapter,
|
||||
struct xmit_frame *pmgntframe, int timeout_ms);
|
||||
s32 dump_mgntframe23a_and_wait_ack23a(struct rtw_adapter *padapter,
|
||||
struct xmit_frame *pmgntframe);
|
||||
|
||||
void issue_beacon23a(struct rtw_adapter *padapter, int timeout_ms);
|
||||
int issue_nulldata23a(struct rtw_adapter *padapter, unsigned char *da,
|
||||
unsigned int power_mode, int try_cnt, int wait_ms);
|
||||
int issue_qos_nulldata23a(struct rtw_adapter *padapter, unsigned char *da, u16 tid,
|
||||
int try_cnt, int wait_ms);
|
||||
int issue_deauth23a(struct rtw_adapter *padapter, unsigned char *da,
|
||||
unsigned short reason);
|
||||
void issue_action_spct_ch_switch23a(struct rtw_adapter *padapter, u8 *ra,
|
||||
u8 new_ch, u8 ch_offset);
|
||||
void issue_action_BA23a(struct rtw_adapter *padapter,
|
||||
const unsigned char *raddr,
|
||||
unsigned char action, unsigned short status);
|
||||
int send_delba23a(struct rtw_adapter *padapter, u8 initiator, u8 *addr);
|
||||
int send_beacon23a(struct rtw_adapter *padapter);
|
||||
|
||||
void mlmeext_joinbss_event_callback23a(struct rtw_adapter *padapter, int join_res);
|
||||
void mlmeext_sta_del_event_callback23a(struct rtw_adapter *padapter);
|
||||
void mlmeext_sta_add_event_callback23a(struct rtw_adapter *padapter, struct sta_info *psta);
|
||||
|
||||
void linked_status_chk23a(struct rtw_adapter *padapter);
|
||||
|
||||
#define set_survey_timer(mlmeext, ms) \
|
||||
/*DBG_8723A("%s set_survey_timer(%p, %d)\n", __func__, (mlmeext), (ms));*/ \
|
||||
mod_timer(&mlmeext->survey_timer, jiffies + msecs_to_jiffies(ms));
|
||||
|
||||
#define set_link_timer(mlmeext, ms) \
|
||||
/*DBG_8723A("%s set_link_timer(%p, %d)\n", __func__, (mlmeext), (ms));*/ \
|
||||
mod_timer(&mlmeext->link_timer, jiffies + msecs_to_jiffies(ms));
|
||||
|
||||
int cckrates_included23a(unsigned char *rate, int ratelen);
|
||||
int cckratesonly_included23a(unsigned char *rate, int ratelen);
|
||||
|
||||
void process_addba_req23a(struct rtw_adapter *padapter, u8 *paddba_req, u8 *addr);
|
||||
|
||||
void correct_TSF23a(struct rtw_adapter *padapter, struct mlme_ext_priv *pmlmeext);
|
||||
|
||||
struct cmd_hdl {
|
||||
uint parmsize;
|
||||
int (*h2cfuns)(struct rtw_adapter *padapter, const u8 *pbuf);
|
||||
};
|
||||
|
||||
|
||||
int read_macreg_hdl(struct rtw_adapter *padapter, u8 *pbuf);
|
||||
int write_macreg_hdl(struct rtw_adapter *padapter, u8 *pbuf);
|
||||
int read_bbreg_hdl(struct rtw_adapter *padapter, u8 *pbuf);
|
||||
int write_bbreg_hdl(struct rtw_adapter *padapter, u8 *pbuf);
|
||||
int read_rfreg_hdl(struct rtw_adapter *padapter, u8 *pbuf);
|
||||
int write_rfreg_hdl(struct rtw_adapter *padapter, u8 *pbuf);
|
||||
|
||||
|
||||
int NULL_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf);
|
||||
int join_cmd_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf);
|
||||
int disconnect_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf);
|
||||
int createbss_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf);
|
||||
int setopmode_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf);
|
||||
int sitesurvey_cmd_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf);
|
||||
int setauth_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf);
|
||||
int setkey_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf);
|
||||
int set_stakey_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf);
|
||||
int set_assocsta_hdl(struct rtw_adapter *padapter, const u8 *pbuf);
|
||||
int del_assocsta_hdl(struct rtw_adapter *padapter, const u8 *pbuf);
|
||||
int add_ba_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf);
|
||||
|
||||
int mlme_evt_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf);
|
||||
int h2c_msg_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf);
|
||||
int tx_beacon_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf);
|
||||
int set_ch_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf);
|
||||
int set_chplan_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf);
|
||||
int led_blink_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf);
|
||||
int set_csa_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf); /* Kurt: Handling DFS channel switch announcement ie. */
|
||||
int tdls_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf);
|
||||
|
||||
#define GEN_DRV_CMD_HANDLER(size, cmd) {size, &cmd ## _hdl23a},
|
||||
#define GEN_MLME_EXT_HANDLER(size, cmd) {size, cmd},
|
||||
|
||||
struct C2HEvent_Header {
|
||||
#ifdef __LITTLE_ENDIAN
|
||||
|
||||
unsigned int len:16;
|
||||
unsigned int ID:8;
|
||||
unsigned int seq:8;
|
||||
|
||||
#elif defined(__BIG_ENDIAN)
|
||||
|
||||
unsigned int seq:8;
|
||||
unsigned int ID:8;
|
||||
unsigned int len:16;
|
||||
|
||||
#else
|
||||
|
||||
# error "Must be LITTLE or BIG Endian"
|
||||
|
||||
#endif
|
||||
|
||||
unsigned int rsvd;
|
||||
};
|
||||
|
||||
enum rtw_c2h_event {
|
||||
GEN_EVT_CODE(_Read_MACREG) = 0, /*0*/
|
||||
GEN_EVT_CODE(_Read_BBREG),
|
||||
GEN_EVT_CODE(_Read_RFREG),
|
||||
GEN_EVT_CODE(_Read_EEPROM),
|
||||
GEN_EVT_CODE(_Read_EFUSE),
|
||||
GEN_EVT_CODE(_Read_CAM), /*5*/
|
||||
GEN_EVT_CODE(_Get_BasicRate),
|
||||
GEN_EVT_CODE(_Get_DataRate),
|
||||
GEN_EVT_CODE(_Survey), /*8*/
|
||||
GEN_EVT_CODE(_SurveyDone), /*9*/
|
||||
|
||||
GEN_EVT_CODE(_JoinBss) , /*10*/
|
||||
GEN_EVT_CODE(_AddSTA),
|
||||
GEN_EVT_CODE(_DelSTA),
|
||||
GEN_EVT_CODE(_AtimDone) ,
|
||||
GEN_EVT_CODE(_TX_Report),
|
||||
GEN_EVT_CODE(_CCX_Report), /*15*/
|
||||
GEN_EVT_CODE(_DTM_Report),
|
||||
GEN_EVT_CODE(_TX_Rate_Statistics),
|
||||
GEN_EVT_CODE(_C2HLBK),
|
||||
GEN_EVT_CODE(_FWDBG),
|
||||
GEN_EVT_CODE(_C2HFEEDBACK), /*20*/
|
||||
GEN_EVT_CODE(_ADDBA),
|
||||
GEN_EVT_CODE(_C2HBCN),
|
||||
GEN_EVT_CODE(_ReportPwrState), /* filen: only for PCIE, USB */
|
||||
GEN_EVT_CODE(_CloseRF), /* filen: only for PCIE, work around ASPM */
|
||||
MAX_C2HEVT
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,242 +0,0 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef __RTW_PWRCTRL_H_
|
||||
#define __RTW_PWRCTRL_H_
|
||||
|
||||
#include <linux/mutex.h>
|
||||
#include <osdep_service.h>
|
||||
#include <drv_types.h>
|
||||
|
||||
#define FW_PWR0 0
|
||||
#define FW_PWR1 1
|
||||
#define FW_PWR2 2
|
||||
#define FW_PWR3 3
|
||||
|
||||
|
||||
#define HW_PWR0 7
|
||||
#define HW_PWR1 6
|
||||
#define HW_PWR2 2
|
||||
#define HW_PWR3 0
|
||||
#define HW_PWR4 8
|
||||
|
||||
#define FW_PWRMSK 0x7
|
||||
|
||||
|
||||
#define XMIT_ALIVE BIT(0)
|
||||
#define RECV_ALIVE BIT(1)
|
||||
#define CMD_ALIVE BIT(2)
|
||||
#define EVT_ALIVE BIT(3)
|
||||
|
||||
enum Power_Mgnt {
|
||||
PS_MODE_ACTIVE = 0,
|
||||
PS_MODE_MIN,
|
||||
PS_MODE_MAX,
|
||||
PS_MODE_DTIM,
|
||||
PS_MODE_VOIP,
|
||||
PS_MODE_UAPSD_WMM,
|
||||
PS_MODE_UAPSD,
|
||||
PS_MODE_IBSS,
|
||||
PS_MODE_WWLAN,
|
||||
PM_Radio_Off,
|
||||
PM_Card_Disable,
|
||||
PS_MODE_NUM
|
||||
};
|
||||
|
||||
|
||||
/* BIT[2:0] = HW state
|
||||
* BIT[3] = Protocol PS state, 0: active, 1: sleep state
|
||||
* BIT[4] = sub-state
|
||||
*/
|
||||
|
||||
#define PS_DPS BIT(0)
|
||||
#define PS_LCLK (PS_DPS)
|
||||
#define PS_RF_OFF BIT(1)
|
||||
#define PS_ALL_ON BIT(2)
|
||||
#define PS_ST_ACTIVE BIT(3)
|
||||
|
||||
#define PS_ISR_ENABLE BIT(4)
|
||||
#define PS_IMR_ENABLE BIT(5)
|
||||
#define PS_ACK BIT(6)
|
||||
#define PS_TOGGLE BIT(7)
|
||||
|
||||
#define PS_STATE_MASK (0x0F)
|
||||
#define PS_STATE_HW_MASK (0x07)
|
||||
#define PS_SEQ_MASK (0xc0)
|
||||
|
||||
#define PS_STATE(x) (PS_STATE_MASK & (x))
|
||||
#define PS_STATE_HW(x) (PS_STATE_HW_MASK & (x))
|
||||
#define PS_SEQ(x) (PS_SEQ_MASK & (x))
|
||||
|
||||
#define PS_STATE_S0 (PS_DPS)
|
||||
#define PS_STATE_S1 (PS_LCLK)
|
||||
#define PS_STATE_S2 (PS_RF_OFF)
|
||||
#define PS_STATE_S3 (PS_ALL_ON)
|
||||
#define PS_STATE_S4 ((PS_ST_ACTIVE) | (PS_ALL_ON))
|
||||
|
||||
|
||||
#define PS_IS_RF_ON(x) ((x) & (PS_ALL_ON))
|
||||
#define PS_IS_ACTIVE(x) ((x) & (PS_ST_ACTIVE))
|
||||
#define CLR_PS_STATE(x) ((x) = ((x) & (0xF0)))
|
||||
|
||||
|
||||
struct reportpwrstate_parm {
|
||||
unsigned char mode;
|
||||
unsigned char state; /* the CPWM value */
|
||||
unsigned short rsvd;
|
||||
};
|
||||
|
||||
#define LPS_DELAY_TIME (1*HZ) /* 1 sec */
|
||||
|
||||
#define EXE_PWR_NONE 0x01
|
||||
#define EXE_PWR_IPS 0x02
|
||||
#define EXE_PWR_LPS 0x04
|
||||
|
||||
/* RF state. */
|
||||
enum rt_rf_power_state {
|
||||
rf_on, /* RF is on after RFSleep or RFOff */
|
||||
rf_sleep, /* 802.11 Power Save mode */
|
||||
rf_off, /* HW/SW Radio OFF or Inactive Power Save */
|
||||
/* Add the new RF state above this line===== */
|
||||
rf_max
|
||||
};
|
||||
|
||||
/* RF Off Level for IPS or HW/SW radio off */
|
||||
#define RT_RF_OFF_LEVL_ASPM BIT(0) /* PCI ASPM */
|
||||
#define RT_RF_OFF_LEVL_CLK_REQ BIT(1) /* PCI clock request */
|
||||
#define RT_RF_OFF_LEVL_PCI_D3 BIT(2) /* PCI D3 mode */
|
||||
/* NIC halt, re-init hw params */
|
||||
#define RT_RF_OFF_LEVL_HALT_NIC BIT(3)
|
||||
/* FW free, re-download the FW */
|
||||
#define RT_RF_OFF_LEVL_FREE_FW BIT(4)
|
||||
#define RT_RF_OFF_LEVL_FW_32K BIT(5) /* FW in 32k */
|
||||
/* Always enable ASPM and Clock Req in initialization. */
|
||||
#define RT_RF_PS_LEVEL_ALWAYS_ASPM BIT(6)
|
||||
/* When LPS is on, disable 2R if no packet is received or transmittd. */
|
||||
#define RT_RF_LPS_DISALBE_2R BIT(30)
|
||||
#define RT_RF_LPS_LEVEL_ASPM BIT(31) /* LPS with ASPM */
|
||||
|
||||
#define RT_IN_PS_LEVEL(ppsc, _PS_FLAG) \
|
||||
((ppsc->cur_ps_level & _PS_FLAG) ? true : false)
|
||||
#define RT_CLEAR_PS_LEVEL(ppsc, _PS_FLAG) \
|
||||
(ppsc->cur_ps_level &= (~(_PS_FLAG)))
|
||||
#define RT_SET_PS_LEVEL(ppsc, _PS_FLAG) \
|
||||
(ppsc->cur_ps_level |= _PS_FLAG)
|
||||
|
||||
|
||||
enum {
|
||||
PSBBREG_RF0 = 0,
|
||||
PSBBREG_RF1,
|
||||
PSBBREG_RF2,
|
||||
PSBBREG_AFE0,
|
||||
PSBBREG_TOTALCNT
|
||||
};
|
||||
|
||||
enum { /* for ips_mode */
|
||||
IPS_NONE = 0,
|
||||
IPS_NORMAL,
|
||||
IPS_LEVEL_2,
|
||||
};
|
||||
|
||||
struct pwrctrl_priv {
|
||||
struct mutex mutex_lock;
|
||||
volatile u8 rpwm; /* requested power state for fw */
|
||||
volatile u8 cpwm; /* fw current power state. updated when 1.
|
||||
* read from HCPWM 2. driver lowers power level
|
||||
*/
|
||||
volatile u8 tog; /* toggling */
|
||||
|
||||
u8 pwr_mode;
|
||||
u8 smart_ps;
|
||||
u8 bcn_ant_mode;
|
||||
|
||||
u8 bpower_saving;
|
||||
|
||||
u8 reg_rfoff;
|
||||
u32 rfoff_reason;
|
||||
|
||||
/* RF OFF Level */
|
||||
u32 cur_ps_level;
|
||||
u32 reg_rfps_level;
|
||||
|
||||
uint ips_enter23a_cnts;
|
||||
uint ips_leave23a_cnts;
|
||||
|
||||
u8 ips_mode;
|
||||
u8 ips_mode_req; /* used to accept the mode setting request */
|
||||
uint bips_processing;
|
||||
unsigned long ips_deny_time; /* deny IPS when system time is smaller */
|
||||
u8 ps_processing; /* used to mark whether in rtw_ps_processor23a */
|
||||
|
||||
u8 bLeisurePs;
|
||||
u8 LpsIdleCount;
|
||||
u8 power_mgnt;
|
||||
u8 bFwCurrentInPSMode;
|
||||
unsigned long DelayLPSLastTimeStamp;
|
||||
u8 btcoex_rfon;
|
||||
|
||||
u8 bInSuspend;
|
||||
#ifdef CONFIG_8723AU_BT_COEXIST
|
||||
u8 bAutoResume;
|
||||
u8 autopm_cnt;
|
||||
#endif
|
||||
u8 bSupportRemoteWakeup;
|
||||
struct timer_list pwr_state_check_timer;
|
||||
int pwr_state_check_interval;
|
||||
u8 pwr_state_check_cnts;
|
||||
|
||||
enum rt_rf_power_state rf_pwrstate;/* cur power state */
|
||||
enum rt_rf_power_state change_rfpwrstate;
|
||||
|
||||
u8 bkeepfwalive;
|
||||
unsigned long PS_BBRegBackup[PSBBREG_TOTALCNT];
|
||||
};
|
||||
|
||||
#define RTW_PWR_STATE_CHK_INTERVAL 2000
|
||||
|
||||
#define _rtw_set_pwr_state_check_timer(pwrctrlpriv, ms) \
|
||||
(mod_timer(&pwrctrlpriv->pwr_state_check_timer, jiffies + \
|
||||
msecs_to_jiffies(ms)))
|
||||
|
||||
#define rtw_set_pwr_state_check_timer(pwrctrlpriv) \
|
||||
(_rtw_set_pwr_state_check_timer((pwrctrlpriv), \
|
||||
(pwrctrlpriv)->pwr_state_check_interval))
|
||||
|
||||
void rtw_init_pwrctrl_priv23a(struct rtw_adapter *adapter);
|
||||
void rtw_free_pwrctrl_priv(struct rtw_adapter *adapter);
|
||||
|
||||
void rtw_set_ps_mode23a(struct rtw_adapter *padapter, u8 ps_mode,
|
||||
u8 smart_ps, u8 bcn_ant_mode);
|
||||
void rtw_set_rpwm23a(struct rtw_adapter *padapter, u8 val8);
|
||||
void LeaveAllPowerSaveMode23a(struct rtw_adapter *adapter);
|
||||
void ips_enter23a(struct rtw_adapter *padapter);
|
||||
int ips_leave23a(struct rtw_adapter *padapter);
|
||||
|
||||
void rtw_ps_processor23a(struct rtw_adapter *padapter);
|
||||
|
||||
enum rt_rf_power_state RfOnOffDetect23a(struct rtw_adapter *adapter);
|
||||
|
||||
s32 LPS_RF_ON_check23a(struct rtw_adapter *padapter, u32 delay_ms);
|
||||
void LPS_Enter23a(struct rtw_adapter *padapter);
|
||||
void LPS_Leave23a(struct rtw_adapter *padapter);
|
||||
|
||||
void rtw_set_ips_deny23a(struct rtw_adapter *padapter, u32 ms);
|
||||
int _rtw_pwr_wakeup23a(struct rtw_adapter *padapter, u32 ips_deffer_ms,
|
||||
const char *caller);
|
||||
#define rtw_pwr_wakeup(adapter) _rtw_pwr_wakeup23a(adapter, \
|
||||
RTW_PWR_STATE_CHK_INTERVAL, __func__)
|
||||
int rtw_pm_set_ips23a(struct rtw_adapter *padapter, u8 mode);
|
||||
int rtw_pm_set_lps23a(struct rtw_adapter *padapter, u8 mode);
|
||||
|
||||
#endif /* __RTL871X_PWRCTRL_H_ */
|
|
@ -1,305 +0,0 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef _RTW_RECV_H_
|
||||
#define _RTW_RECV_H_
|
||||
|
||||
#include <osdep_service.h>
|
||||
#include <drv_types.h>
|
||||
#include <Hal8723APhyCfg.h>
|
||||
|
||||
#define NR_RECVFRAME 256
|
||||
|
||||
#define MAX_RXFRAME_CNT 512
|
||||
#define MAX_RX_NUMBLKS (32)
|
||||
#define RECVFRAME_HDR_ALIGN 128
|
||||
|
||||
#define SNAP_SIZE sizeof(struct ieee80211_snap_hdr)
|
||||
|
||||
#define MAX_SUBFRAME_COUNT 64
|
||||
|
||||
/* for Rx reordering buffer control */
|
||||
struct recv_reorder_ctrl {
|
||||
struct rtw_adapter *padapter;
|
||||
u8 enable;
|
||||
u16 indicate_seq;/* wstart_b, init_value=0xffff */
|
||||
u16 wend_b;
|
||||
u8 wsize_b;
|
||||
struct rtw_queue pending_recvframe_queue;
|
||||
struct timer_list reordering_ctrl_timer;
|
||||
};
|
||||
|
||||
struct stainfo_rxcache {
|
||||
u16 tid_rxseq[16];
|
||||
/*
|
||||
unsigned short tid0_rxseq;
|
||||
unsigned short tid1_rxseq;
|
||||
unsigned short tid2_rxseq;
|
||||
unsigned short tid3_rxseq;
|
||||
unsigned short tid4_rxseq;
|
||||
unsigned short tid5_rxseq;
|
||||
unsigned short tid6_rxseq;
|
||||
unsigned short tid7_rxseq;
|
||||
unsigned short tid8_rxseq;
|
||||
unsigned short tid9_rxseq;
|
||||
unsigned short tid10_rxseq;
|
||||
unsigned short tid11_rxseq;
|
||||
unsigned short tid12_rxseq;
|
||||
unsigned short tid13_rxseq;
|
||||
unsigned short tid14_rxseq;
|
||||
unsigned short tid15_rxseq;
|
||||
*/
|
||||
};
|
||||
|
||||
struct smooth_rssi_data {
|
||||
u32 elements[100]; /* array to store values */
|
||||
u32 index; /* index to current array to store */
|
||||
u32 total_num; /* num of valid elements */
|
||||
u32 total_val; /* sum of valid elements */
|
||||
};
|
||||
|
||||
struct signal_stat {
|
||||
u8 update_req; /* used to indicate */
|
||||
u8 avg_val; /* avg of valid elements */
|
||||
u32 total_num; /* num of valid elements */
|
||||
u32 total_val; /* sum of valid elements */
|
||||
};
|
||||
|
||||
struct phy_info {
|
||||
u8 RxPWDBAll;
|
||||
u8 SignalQuality; /* in 0-100 index. */
|
||||
u8 RxMIMOSignalQuality[RF_PATH_MAX]; /* EVM */
|
||||
u8 RxMIMOSignalStrength[RF_PATH_MAX];/* 0~100 */
|
||||
s8 RxPower; /* in dBm Translate from PWdB */
|
||||
/* Real power in dBm for this packet, no beautification and aggregation.
|
||||
* Keep this raw info to be used for the other procedures.
|
||||
*/
|
||||
s8 RecvSignalPower;
|
||||
u8 BTRxRSSIPercentage;
|
||||
u8 SignalStrength; /* in 0-100 index. */
|
||||
u8 RxPwr[RF_PATH_MAX];/* per-path's pwdb */
|
||||
u8 RxSNR[RF_PATH_MAX];/* per-path's SNR */
|
||||
};
|
||||
|
||||
|
||||
struct rx_pkt_attrib {
|
||||
u16 pkt_len;
|
||||
u8 physt;
|
||||
u8 drvinfo_sz;
|
||||
u8 shift_sz;
|
||||
u8 hdrlen; /* the WLAN Header Len */
|
||||
u8 amsdu;
|
||||
u8 qos;
|
||||
u8 priority;
|
||||
u8 pw_save;
|
||||
u8 mdata;
|
||||
u16 seq_num;
|
||||
u8 frag_num;
|
||||
u8 mfrag;
|
||||
u8 order;
|
||||
u8 privacy; /* in frame_ctrl field */
|
||||
u8 bdecrypted;
|
||||
/* when 0 indicate no encrypt. when non-zero, indicate the algorith */
|
||||
u32 encrypt;
|
||||
u8 iv_len;
|
||||
u8 icv_len;
|
||||
u8 crc_err;
|
||||
u8 icv_err;
|
||||
|
||||
u16 eth_type;
|
||||
|
||||
u8 dst[ETH_ALEN];
|
||||
u8 src[ETH_ALEN];
|
||||
u8 ta[ETH_ALEN];
|
||||
u8 ra[ETH_ALEN];
|
||||
u8 bssid[ETH_ALEN];
|
||||
|
||||
u8 ack_policy;
|
||||
|
||||
u8 tcpchk_valid; /* 0: invalid, 1: valid */
|
||||
u8 ip_chkrpt; /* 0: incorrect, 1: correct */
|
||||
u8 tcp_chkrpt; /* 0: incorrect, 1: correct */
|
||||
u8 key_index;
|
||||
|
||||
u8 mcs_rate;
|
||||
u8 rxht;
|
||||
u8 sgi;
|
||||
u8 pkt_rpt_type;
|
||||
u32 MacIDValidEntry[2]; /* 64 bits present 64 entry. */
|
||||
struct phy_info phy_info;
|
||||
};
|
||||
|
||||
/* These definition is used for Rx packet reordering. */
|
||||
#define SN_LESS(a, b) (((a-b) & 0x800) != 0)
|
||||
#define SN_EQUAL(a, b) (a == b)
|
||||
#define REORDER_WAIT_TIME (50) /* (ms) */
|
||||
|
||||
#define RECVBUFF_ALIGN_SZ 8
|
||||
|
||||
#define RXDESC_SIZE 24
|
||||
#define RXDESC_OFFSET RXDESC_SIZE
|
||||
|
||||
struct recv_stat {
|
||||
__le32 rxdw0;
|
||||
__le32 rxdw1;
|
||||
__le32 rxdw2;
|
||||
__le32 rxdw3;
|
||||
__le32 rxdw4;
|
||||
__le32 rxdw5;
|
||||
};
|
||||
|
||||
/* accesser of recv_priv: rtw_recv_entry23a(dispatch / passive level); \
|
||||
* recv_thread(passive) ; returnpkt(dispatch) ; halt(passive) ;
|
||||
*
|
||||
* using enter_critical section to protect
|
||||
*/
|
||||
struct recv_priv {
|
||||
spinlock_t lock;
|
||||
|
||||
struct rtw_queue free_recv_queue;
|
||||
struct rtw_queue recv_pending_queue;
|
||||
struct rtw_queue uc_swdec_pending_queue;
|
||||
|
||||
int free_recvframe_cnt;
|
||||
|
||||
struct rtw_adapter *adapter;
|
||||
|
||||
u32 bIsAnyNonBEPkts;
|
||||
u64 rx_bytes;
|
||||
u64 rx_pkts;
|
||||
u64 rx_drop;
|
||||
u64 last_rx_bytes;
|
||||
|
||||
uint rx_icv_err;
|
||||
uint rx_largepacket_crcerr;
|
||||
uint rx_smallpacket_crcerr;
|
||||
uint rx_middlepacket_crcerr;
|
||||
|
||||
/* u8 *pallocated_urb_buf; */
|
||||
u8 rx_pending_cnt;
|
||||
|
||||
struct urb *int_in_urb;
|
||||
|
||||
u8 *int_in_buf;
|
||||
|
||||
struct tasklet_struct irq_prepare_beacon_tasklet;
|
||||
struct tasklet_struct recv_tasklet;
|
||||
struct sk_buff_head free_recv_skb_queue;
|
||||
struct sk_buff_head rx_skb_queue;
|
||||
u8 *precv_buf;
|
||||
|
||||
/* For display the phy informatiom */
|
||||
s8 rxpwdb;
|
||||
u8 signal_strength;
|
||||
u8 signal_qual;
|
||||
u8 noise;
|
||||
int RxSNRdB[2];
|
||||
s8 RxRssi[2];
|
||||
int FalseAlmCnt_all;
|
||||
|
||||
struct timer_list signal_stat_timer;
|
||||
u32 signal_stat_sampling_interval;
|
||||
/* u32 signal_stat_converging_constant; */
|
||||
struct signal_stat signal_qual_data;
|
||||
struct signal_stat signal_strength_data;
|
||||
};
|
||||
|
||||
#define rtw_set_signal_stat_timer(recvpriv) \
|
||||
mod_timer(&(recvpriv)->signal_stat_timer, jiffies + \
|
||||
msecs_to_jiffies((recvpriv)->signal_stat_sampling_interval))
|
||||
|
||||
struct sta_recv_priv {
|
||||
spinlock_t lock;
|
||||
int option;
|
||||
|
||||
/* struct rtw_queue blk_strms[MAX_RX_NUMBLKS]; */
|
||||
struct rtw_queue defrag_q; /* keeping the fragment frame until defrag */
|
||||
|
||||
struct stainfo_rxcache rxcache;
|
||||
|
||||
/* uint sta_rx_bytes; */
|
||||
/* uint sta_rx_pkts; */
|
||||
/* uint sta_rx_fail; */
|
||||
|
||||
};
|
||||
|
||||
|
||||
struct recv_buf {
|
||||
struct list_head list;
|
||||
|
||||
struct rtw_adapter *adapter;
|
||||
|
||||
struct urb *purb;
|
||||
struct sk_buff *pskb;
|
||||
};
|
||||
|
||||
/* head ----->
|
||||
*
|
||||
* data ----->
|
||||
*
|
||||
* payload
|
||||
*
|
||||
* tail ----->
|
||||
*
|
||||
* end ----->
|
||||
*
|
||||
* len = (unsigned int )(tail - data);
|
||||
*
|
||||
*/
|
||||
struct recv_frame {
|
||||
struct list_head list;
|
||||
struct sk_buff *pkt;
|
||||
|
||||
struct rtw_adapter *adapter;
|
||||
|
||||
struct rx_pkt_attrib attrib;
|
||||
|
||||
struct sta_info *psta;
|
||||
|
||||
/* for A-MPDU Rx reordering buffer control */
|
||||
struct recv_reorder_ctrl *preorder_ctrl;
|
||||
};
|
||||
|
||||
/* get a free recv_frame from pfree_recv_queue */
|
||||
struct recv_frame *rtw_alloc_recvframe23a(struct rtw_queue *pfree_recv_queue);
|
||||
int rtw_free_recvframe23a(struct recv_frame *precvframe);
|
||||
|
||||
int rtw_enqueue_recvframe23a(struct recv_frame *precvframe, struct rtw_queue *queue);
|
||||
|
||||
u32 rtw_free_uc_swdec_pending_queue23a(struct rtw_adapter *adapter);
|
||||
|
||||
struct recv_buf *rtw_dequeue_recvbuf23a(struct rtw_queue *queue);
|
||||
|
||||
void rtw_reordering_ctrl_timeout_handler23a(unsigned long pcontext);
|
||||
|
||||
static inline s32 translate_percentage_to_dbm(u32 SignalStrengthIndex)
|
||||
{
|
||||
s32 SignalPower; /* in dBm. */
|
||||
|
||||
/* Translate to dBm (x=0.5y-95). */
|
||||
SignalPower = (s32)((SignalStrengthIndex + 1) >> 1);
|
||||
SignalPower -= 95;
|
||||
|
||||
return SignalPower;
|
||||
}
|
||||
|
||||
|
||||
struct sta_info;
|
||||
|
||||
void _rtw_init_sta_recv_priv23a(struct sta_recv_priv *psta_recvpriv);
|
||||
|
||||
void mgt_dispatcher23a(struct rtw_adapter *padapter,
|
||||
struct recv_frame *precv_frame);
|
||||
|
||||
#endif
|
|
@ -1,102 +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.
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef __RTW_RF_H_
|
||||
#define __RTW_RF_H_
|
||||
|
||||
#include <rtw_cmd.h>
|
||||
|
||||
#define OFDM_PHY 1
|
||||
#define MIXED_PHY 2
|
||||
#define CCK_PHY 3
|
||||
|
||||
#define NumRates (13)
|
||||
|
||||
/* slot time for 11g */
|
||||
#define SHORT_SLOT_TIME 9
|
||||
#define NON_SHORT_SLOT_TIME 20
|
||||
|
||||
/* We now define the max channels in each channel plan. */
|
||||
#define MAX_CHANNEL_NUM_2G 14
|
||||
#define MAX_CHANNEL_NUM_5G 24
|
||||
#define MAX_CHANNEL_NUM 38/* 14+24 */
|
||||
|
||||
/* define NUM_REGULATORYS 21 */
|
||||
#define NUM_REGULATORYS 1
|
||||
|
||||
/* Country codes */
|
||||
#define USA 0x555320
|
||||
#define EUROPE 0x1 /* temp, should be provided later */
|
||||
#define JAPAN 0x2 /* temp, should be provided later */
|
||||
|
||||
struct regulatory_class {
|
||||
u32 starting_freq; /* MHz, */
|
||||
u8 channel_set[MAX_CHANNEL_NUM];
|
||||
u8 channel_cck_power[MAX_CHANNEL_NUM];/* dbm */
|
||||
u8 channel_ofdm_power[MAX_CHANNEL_NUM];/* dbm */
|
||||
u8 txpower_limit; /* dbm */
|
||||
u8 channel_spacing; /* MHz */
|
||||
u8 modem;
|
||||
};
|
||||
|
||||
enum {
|
||||
cESS = 0x0001,
|
||||
cIBSS = 0x0002,
|
||||
cPollable = 0x0004,
|
||||
cPollReq = 0x0008,
|
||||
cPrivacy = 0x0010,
|
||||
cShortPreamble = 0x0020,
|
||||
cPBCC = 0x0040,
|
||||
cChannelAgility = 0x0080,
|
||||
cSpectrumMgnt = 0x0100,
|
||||
cQos = 0x0200, /* For HCCA, use with CF-Pollable and CF-PollReq */
|
||||
cShortSlotTime = 0x0400,
|
||||
cAPSD = 0x0800,
|
||||
cRM = 0x1000, /* RRM (Radio Request Measurement) */
|
||||
cDSSS_OFDM = 0x2000,
|
||||
cDelayedBA = 0x4000,
|
||||
cImmediateBA = 0x8000,
|
||||
};
|
||||
|
||||
enum {
|
||||
PREAMBLE_LONG = 1,
|
||||
PREAMBLE_AUTO = 2,
|
||||
PREAMBLE_SHORT = 3,
|
||||
};
|
||||
|
||||
/* Bandwidth Offset */
|
||||
#define HAL_PRIME_CHNL_OFFSET_DONT_CARE 0
|
||||
#define HAL_PRIME_CHNL_OFFSET_LOWER 1
|
||||
#define HAL_PRIME_CHNL_OFFSET_UPPER 2
|
||||
|
||||
/* Represent Channel Width in HT Capabilities */
|
||||
enum ht_channel_width {
|
||||
HT_CHANNEL_WIDTH_20 = 0,
|
||||
HT_CHANNEL_WIDTH_40 = 1,
|
||||
HT_CHANNEL_WIDTH_80 = 2,
|
||||
HT_CHANNEL_WIDTH_160 = 3,
|
||||
HT_CHANNEL_WIDTH_10 = 4,
|
||||
};
|
||||
|
||||
/* 2007/11/15 MH Define different RF type. */
|
||||
enum {
|
||||
RF_1T2R = 0,
|
||||
RF_2T4R = 1,
|
||||
RF_2T2R = 2,
|
||||
RF_1T1R = 3,
|
||||
RF_2T2R_GREEN = 4,
|
||||
RF_819X_MAX_TYPE = 5,
|
||||
};
|
||||
|
||||
#endif /* _RTL8711_RF_H_ */
|
|
@ -1,331 +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.
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef __RTW_SECURITY_H_
|
||||
#define __RTW_SECURITY_H_
|
||||
|
||||
#include <osdep_service.h>
|
||||
#include <drv_types.h>
|
||||
#include <net/lib80211.h>
|
||||
|
||||
|
||||
#define is_wep_enc(alg) (alg == WLAN_CIPHER_SUITE_WEP40 || \
|
||||
alg == WLAN_CIPHER_SUITE_WEP104)
|
||||
|
||||
#define SHA256_MAC_LEN 32
|
||||
#define AES_BLOCK_SIZE 16
|
||||
#define AES_PRIV_SIZE (4 * 44)
|
||||
|
||||
enum ENCRYP_PROTOCOL {
|
||||
ENCRYP_PROTOCOL_OPENSYS, /* open system */
|
||||
ENCRYP_PROTOCOL_WEP, /* WEP */
|
||||
ENCRYP_PROTOCOL_WPA, /* WPA */
|
||||
ENCRYP_PROTOCOL_WPA2, /* WPA2 */
|
||||
ENCRYP_PROTOCOL_MAX
|
||||
};
|
||||
|
||||
#ifndef Ndis802_11AuthModeWPA2
|
||||
#define Ndis802_11AuthModeWPA2 (Ndis802_11AuthModeWPANone + 1)
|
||||
#endif
|
||||
|
||||
#ifndef Ndis802_11AuthModeWPA2PSK
|
||||
#define Ndis802_11AuthModeWPA2PSK (Ndis802_11AuthModeWPANone + 2)
|
||||
#endif
|
||||
|
||||
union pn48 {
|
||||
u64 val;
|
||||
|
||||
#ifdef __LITTLE_ENDIAN
|
||||
|
||||
struct {
|
||||
u8 TSC0;
|
||||
u8 TSC1;
|
||||
u8 TSC2;
|
||||
u8 TSC3;
|
||||
u8 TSC4;
|
||||
u8 TSC5;
|
||||
u8 TSC6;
|
||||
u8 TSC7;
|
||||
} _byte_;
|
||||
|
||||
#elif defined(__BIG_ENDIAN)
|
||||
|
||||
struct {
|
||||
u8 TSC7;
|
||||
u8 TSC6;
|
||||
u8 TSC5;
|
||||
u8 TSC4;
|
||||
u8 TSC3;
|
||||
u8 TSC2;
|
||||
u8 TSC1;
|
||||
u8 TSC0;
|
||||
} _byte_;
|
||||
#else
|
||||
#error Need BIG or LITTLE endian
|
||||
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
union Keytype {
|
||||
u8 skey[16];
|
||||
u32 lkey[4];
|
||||
};
|
||||
|
||||
struct rtw_wep_key {
|
||||
u8 key[WLAN_KEY_LEN_WEP104 + 1]; /* 14 */
|
||||
u16 keylen;
|
||||
};
|
||||
|
||||
struct rt_pmkid_list {
|
||||
u8 bUsed;
|
||||
u8 Bssid[6];
|
||||
u8 PMKID[16];
|
||||
u8 SsidBuf[33];
|
||||
u8 *ssid_octet;
|
||||
u16 ssid_length;
|
||||
};
|
||||
|
||||
struct security_priv {
|
||||
u32 dot11AuthAlgrthm; /* 802.11 auth, could be open, shared,
|
||||
* 8021x and authswitch */
|
||||
u32 dot11PrivacyAlgrthm; /* This specifies the privacy for
|
||||
* shared auth. algorithm.
|
||||
*/
|
||||
/* WEP */
|
||||
u32 dot11PrivacyKeyIndex; /* this is only valid for legendary
|
||||
* wep, 0~3 for key id. (tx key index)
|
||||
*/
|
||||
struct rtw_wep_key wep_key[NUM_WEP_KEYS];
|
||||
|
||||
u32 dot118021XGrpPrivacy; /* specify the privacy algthm.
|
||||
* used for Grp key
|
||||
*/
|
||||
u32 dot118021XGrpKeyid; /* key id used for Grp Key
|
||||
* (tx key index)
|
||||
*/
|
||||
union Keytype dot118021XGrpKey[4];/* 802.1x Grp Key, inx0 and inx1 */
|
||||
union Keytype dot118021XGrptxmickey[4];
|
||||
union Keytype dot118021XGrprxmickey[4];
|
||||
union pn48 dot11Grptxpn; /* PN48 used for Grp Key xmit.*/
|
||||
union pn48 dot11Grprxpn; /* PN48 used for Grp Key recv.*/
|
||||
|
||||
#ifdef CONFIG_8723AU_AP_MODE
|
||||
/* extend security capabilities for AP_MODE */
|
||||
unsigned int dot8021xalg;/* 0:disable, 1:psk, 2:802.1x */
|
||||
unsigned int wpa_psk;/* 0:disable, bit(0): WPA, bit(1):WPA2 */
|
||||
unsigned int wpa_group_cipher;
|
||||
unsigned int wpa2_group_cipher;
|
||||
unsigned int wpa_pairwise_cipher;
|
||||
unsigned int wpa2_pairwise_cipher;
|
||||
#endif
|
||||
|
||||
u8 wps_ie[MAX_WPS_IE_LEN];/* added in assoc req */
|
||||
int wps_ie_len;
|
||||
unsigned int binstallGrpkey:1;
|
||||
unsigned int busetkipkey:1;
|
||||
unsigned int bcheck_grpkey:1;
|
||||
unsigned int hw_decrypted:1;
|
||||
u32 ndisauthtype; /* enum ndis_802_11_auth_mode */
|
||||
u32 ndisencryptstatus; /* NDIS_802_11_ENCRYPTION_STATUS */
|
||||
struct wlan_bssid_ex sec_bss; /* for joinbss (h2c buffer) usage */
|
||||
u8 assoc_info[600];
|
||||
u8 szofcapability[256]; /* for wpa2 usage */
|
||||
u8 oidassociation[512]; /* for wpa/wpa2 usage */
|
||||
u8 supplicant_ie[256]; /* store sta security information element */
|
||||
|
||||
/* for tkip countermeasure */
|
||||
unsigned long last_mic_err_time;
|
||||
u8 btkip_countermeasure;
|
||||
u8 btkip_wait_report;
|
||||
unsigned long btkip_countermeasure_time;
|
||||
|
||||
/* For WPA2 Pre-Authentication. */
|
||||
struct rt_pmkid_list PMKIDList[NUM_PMKID_CACHE];
|
||||
u8 PMKIDIndex;
|
||||
u8 bWepDefaultKeyIdxSet;
|
||||
};
|
||||
|
||||
struct sha256_state {
|
||||
u64 length;
|
||||
u32 state[8], curlen;
|
||||
u8 buf[64];
|
||||
};
|
||||
|
||||
#define GET_ENCRY_ALGO(psecuritypriv, psta, encry_algo, bmcst)\
|
||||
do {\
|
||||
switch (psecuritypriv->dot11AuthAlgrthm) {\
|
||||
case dot11AuthAlgrthm_Open:\
|
||||
case dot11AuthAlgrthm_Shared:\
|
||||
case dot11AuthAlgrthm_Auto:\
|
||||
encry_algo = psecuritypriv->dot11PrivacyAlgrthm;\
|
||||
break;\
|
||||
case dot11AuthAlgrthm_8021X:\
|
||||
if (bmcst)\
|
||||
encry_algo = psecuritypriv->dot118021XGrpPrivacy;\
|
||||
else\
|
||||
encry_algo = psta->dot118021XPrivacy;\
|
||||
break;\
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define GET_TKIP_PN(iv, dot11txpn)\
|
||||
do {\
|
||||
dot11txpn._byte_.TSC0 = iv[2];\
|
||||
dot11txpn._byte_.TSC1 = iv[0];\
|
||||
dot11txpn._byte_.TSC2 = iv[4];\
|
||||
dot11txpn._byte_.TSC3 = iv[5];\
|
||||
dot11txpn._byte_.TSC4 = iv[6];\
|
||||
dot11txpn._byte_.TSC5 = iv[7];\
|
||||
} while (0)
|
||||
|
||||
#define ROL32(A, n) (((A) << (n)) | (((A)>>(32-(n))) & ((1UL << (n)) - 1)))
|
||||
#define ROR32(A, n) ROL32((A), 32-(n))
|
||||
|
||||
struct mic_data {
|
||||
u32 K0, K1; /* Key */
|
||||
u32 L, R; /* Current state */
|
||||
u32 M; /* Message accumulator (single word) */
|
||||
u32 nBytesInM; /* # bytes in M */
|
||||
};
|
||||
|
||||
extern const u32 Te0[256];
|
||||
extern const u32 Te1[256];
|
||||
extern const u32 Te2[256];
|
||||
extern const u32 Te3[256];
|
||||
extern const u32 Te4[256];
|
||||
extern const u32 Td0[256];
|
||||
extern const u32 Td1[256];
|
||||
extern const u32 Td2[256];
|
||||
extern const u32 Td3[256];
|
||||
extern const u32 Td4[256];
|
||||
extern const u32 rcon[10];
|
||||
extern const u8 Td4s[256];
|
||||
extern const u8 rcons[10];
|
||||
|
||||
#define RCON(i) (rcons[(i)] << 24)
|
||||
|
||||
static inline u32 rotr(u32 val, int bits)
|
||||
{
|
||||
return (val >> bits) | (val << (32 - bits));
|
||||
}
|
||||
|
||||
#define TE0(i) Te0[((i) >> 24) & 0xff]
|
||||
#define TE1(i) rotr(Te0[((i) >> 16) & 0xff], 8)
|
||||
#define TE2(i) rotr(Te0[((i) >> 8) & 0xff], 16)
|
||||
#define TE3(i) rotr(Te0[(i) & 0xff], 24)
|
||||
#define TE41(i) ((Te0[((i) >> 24) & 0xff] << 8) & 0xff000000)
|
||||
#define TE42(i) (Te0[((i) >> 16) & 0xff] & 0x00ff0000)
|
||||
#define TE43(i) (Te0[((i) >> 8) & 0xff] & 0x0000ff00)
|
||||
#define TE44(i) ((Te0[(i) & 0xff] >> 8) & 0x000000ff)
|
||||
#define TE421(i) ((Te0[((i) >> 16) & 0xff] << 8) & 0xff000000)
|
||||
#define TE432(i) (Te0[((i) >> 8) & 0xff] & 0x00ff0000)
|
||||
#define TE443(i) (Te0[(i) & 0xff] & 0x0000ff00)
|
||||
#define TE414(i) ((Te0[((i) >> 24) & 0xff] >> 8) & 0x000000ff)
|
||||
#define TE4(i) ((Te0[(i)] >> 8) & 0x000000ff)
|
||||
|
||||
#define TD0(i) Td0[((i) >> 24) & 0xff]
|
||||
#define TD1(i) rotr(Td0[((i) >> 16) & 0xff], 8)
|
||||
#define TD2(i) rotr(Td0[((i) >> 8) & 0xff], 16)
|
||||
#define TD3(i) rotr(Td0[(i) & 0xff], 24)
|
||||
#define TD41(i) (Td4s[((i) >> 24) & 0xff] << 24)
|
||||
#define TD42(i) (Td4s[((i) >> 16) & 0xff] << 16)
|
||||
#define TD43(i) (Td4s[((i) >> 8) & 0xff] << 8)
|
||||
#define TD44(i) (Td4s[(i) & 0xff])
|
||||
#define TD0_(i) Td0[(i) & 0xff]
|
||||
#define TD1_(i) rotr(Td0[(i) & 0xff], 8)
|
||||
#define TD2_(i) rotr(Td0[(i) & 0xff], 16)
|
||||
#define TD3_(i) rotr(Td0[(i) & 0xff], 24)
|
||||
|
||||
#define GETU32(pt) (((u32)(pt)[0] << 24) ^ ((u32)(pt)[1] << 16) ^ \
|
||||
((u32)(pt)[2] << 8) ^ ((u32)(pt)[3]))
|
||||
|
||||
#define PUTU32(ct, st) { \
|
||||
(ct)[0] = (u8)((st) >> 24); (ct)[1] = (u8)((st) >> 16); \
|
||||
(ct)[2] = (u8)((st) >> 8); (ct)[3] = (u8)(st); }
|
||||
|
||||
#define WPA_GET_BE32(a) ((((u32) (a)[0]) << 24) | (((u32) (a)[1]) << 16) | \
|
||||
(((u32) (a)[2]) << 8) | ((u32) (a)[3]))
|
||||
|
||||
#define WPA_PUT_LE16(a, val) \
|
||||
do { \
|
||||
(a)[1] = ((u16) (val)) >> 8; \
|
||||
(a)[0] = ((u16) (val)) & 0xff; \
|
||||
} while (0)
|
||||
|
||||
#define WPA_PUT_BE32(a, val) \
|
||||
do { \
|
||||
(a)[0] = (u8) ((((u32) (val)) >> 24) & 0xff); \
|
||||
(a)[1] = (u8) ((((u32) (val)) >> 16) & 0xff); \
|
||||
(a)[2] = (u8) ((((u32) (val)) >> 8) & 0xff); \
|
||||
(a)[3] = (u8) (((u32) (val)) & 0xff); \
|
||||
} while (0)
|
||||
|
||||
#define WPA_PUT_BE64(a, val) \
|
||||
do { \
|
||||
(a)[0] = (u8) (((u64) (val)) >> 56); \
|
||||
(a)[1] = (u8) (((u64) (val)) >> 48); \
|
||||
(a)[2] = (u8) (((u64) (val)) >> 40); \
|
||||
(a)[3] = (u8) (((u64) (val)) >> 32); \
|
||||
(a)[4] = (u8) (((u64) (val)) >> 24); \
|
||||
(a)[5] = (u8) (((u64) (val)) >> 16); \
|
||||
(a)[6] = (u8) (((u64) (val)) >> 8); \
|
||||
(a)[7] = (u8) (((u64) (val)) & 0xff); \
|
||||
} while (0)
|
||||
|
||||
/* ===== start - public domain SHA256 implementation ===== */
|
||||
|
||||
/* This is based on SHA256 implementation in LibTomCrypt that was released into
|
||||
* public domain by Tom St Denis. */
|
||||
|
||||
/* the K array */
|
||||
static const unsigned long K[64] = {
|
||||
0x428a2f98UL, 0x71374491UL, 0xb5c0fbcfUL, 0xe9b5dba5UL, 0x3956c25bUL,
|
||||
0x59f111f1UL, 0x923f82a4UL, 0xab1c5ed5UL, 0xd807aa98UL, 0x12835b01UL,
|
||||
0x243185beUL, 0x550c7dc3UL, 0x72be5d74UL, 0x80deb1feUL, 0x9bdc06a7UL,
|
||||
0xc19bf174UL, 0xe49b69c1UL, 0xefbe4786UL, 0x0fc19dc6UL, 0x240ca1ccUL,
|
||||
0x2de92c6fUL, 0x4a7484aaUL, 0x5cb0a9dcUL, 0x76f988daUL, 0x983e5152UL,
|
||||
0xa831c66dUL, 0xb00327c8UL, 0xbf597fc7UL, 0xc6e00bf3UL, 0xd5a79147UL,
|
||||
0x06ca6351UL, 0x14292967UL, 0x27b70a85UL, 0x2e1b2138UL, 0x4d2c6dfcUL,
|
||||
0x53380d13UL, 0x650a7354UL, 0x766a0abbUL, 0x81c2c92eUL, 0x92722c85UL,
|
||||
0xa2bfe8a1UL, 0xa81a664bUL, 0xc24b8b70UL, 0xc76c51a3UL, 0xd192e819UL,
|
||||
0xd6990624UL, 0xf40e3585UL, 0x106aa070UL, 0x19a4c116UL, 0x1e376c08UL,
|
||||
0x2748774cUL, 0x34b0bcb5UL, 0x391c0cb3UL, 0x4ed8aa4aUL, 0x5b9cca4fUL,
|
||||
0x682e6ff3UL, 0x748f82eeUL, 0x78a5636fUL, 0x84c87814UL, 0x8cc70208UL,
|
||||
0x90befffaUL, 0xa4506cebUL, 0xbef9a3f7UL, 0xc67178f2UL
|
||||
};
|
||||
|
||||
void rtw_secmicsetkey23a(struct mic_data *pmicdata, u8 *key);
|
||||
void rtw_secmicappend23abyte23a(struct mic_data *pmicdata, u8 b);
|
||||
void rtw_secmicappend23a(struct mic_data *pmicdata, u8 *src, u32 nbBytes);
|
||||
void rtw_secgetmic23a(struct mic_data *pmicdata, u8 *dst);
|
||||
|
||||
void rtw_seccalctkipmic23a(u8 *key, u8 *header, u8 *data, u32 data_len,
|
||||
u8 *Miccode, u8 priorityi);
|
||||
|
||||
int rtw_aes_encrypt23a(struct rtw_adapter *padapter,
|
||||
struct xmit_frame *pxmitframe);
|
||||
int rtw_tkip_encrypt23a(struct rtw_adapter *padapter,
|
||||
struct xmit_frame *pxmitframe);
|
||||
void rtw_wep_encrypt23a(struct rtw_adapter *padapter,
|
||||
struct xmit_frame *pxmitframe);
|
||||
int rtw_aes_decrypt23a(struct rtw_adapter *padapter,
|
||||
struct recv_frame *precvframe);
|
||||
int rtw_tkip_decrypt23a(struct rtw_adapter *padapter,
|
||||
struct recv_frame *precvframe);
|
||||
void rtw_wep_decrypt23a(struct rtw_adapter *padapter, struct recv_frame *precvframe);
|
||||
|
||||
void rtw_use_tkipkey_handler23a(void *FunctionContext);
|
||||
|
||||
#endif /* __RTL871X_SECURITY_H_ */
|
|
@ -1,36 +0,0 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef _RTW_SRESET_C_
|
||||
#define _RTW_SRESET_C_
|
||||
|
||||
#include <osdep_service.h>
|
||||
#include <drv_types.h>
|
||||
|
||||
struct sreset_priv {
|
||||
struct mutex silentreset_mutex;
|
||||
u8 silent_reset_inprogress;
|
||||
unsigned long last_tx_time;
|
||||
unsigned long last_tx_complete_time;
|
||||
};
|
||||
|
||||
#include <rtl8723a_hal.h>
|
||||
|
||||
void rtw_sreset_init(struct rtw_adapter *padapter);
|
||||
void rtw_sreset_reset_value(struct rtw_adapter *padapter);
|
||||
bool rtw_sreset_inprogress(struct rtw_adapter *padapter);
|
||||
void sreset_set_trigger_point(struct rtw_adapter *padapter, s32 tgp);
|
||||
void rtw_sreset_reset(struct rtw_adapter *active_adapter);
|
||||
|
||||
#endif
|
|
@ -1 +0,0 @@
|
|||
#define DRIVERVERSION "v4.1.6_7336.20130426"
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue